diff --git a/app/Resources/views/logged/history-script.html.twig b/app/Resources/views/logged/history-script.html.twig new file mode 100644 index 00000000..d0011768 --- /dev/null +++ b/app/Resources/views/logged/history-script.html.twig @@ -0,0 +1,75 @@ + + diff --git a/app/Resources/views/logged/history.html.twig b/app/Resources/views/logged/history.html.twig index 17d5ec50..51fb5bdf 100755 --- a/app/Resources/views/logged/history.html.twig +++ b/app/Resources/views/logged/history.html.twig @@ -7,36 +7,58 @@

Historique

-

Ventes de produits

+

Ventes de produits

-

Festivals

-
+

{{ statisticsFestivals |length }} Festival + {% if statisticsFestivals |length >1 %} + s + {% endif %}

+
-

- -
- {{ recentSells |length }} +
+
+

+ + + {{ allSellings |length }} + + Clients +

- Clients -

-

- - Chiffre d'affaires -
- {{ chiffreAffaires }} € +
+

+ + + {{ chiffreAffaires }} + + Chiffre d'affaires + +

-

-

- - panier moyen -
- {{ chiffreAffaires / ((recentSells |length) or 1) }} € +
+

+ + + {% if allSellings %} + {{ (chiffreAffaires / (allSellings |length))|round }} + {% else %} + ? + {% endif %} + + + € + panier moyen + +

-

+
+ +
@@ -47,7 +69,7 @@ Exporter toutes vos données en format csv

- Dernières ventes + {{ recentSells |length }} Dernières ventes

@@ -78,7 +100,11 @@ {{ vente.productsSold |length }}
+ {{ vente.amount }} + + +
@@ -91,80 +117,6 @@
- - {% endblock %} diff --git a/assets/css/app.scss b/assets/css/app.scss index 77898c9f..7864f7b0 100755 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -7,6 +7,7 @@ @import 'pages/global'; //@import 'pages/demo'; @import 'pages/home'; +@import 'pages/history'; @import 'pages/dashboard'; @import 'pages/special'; @import 'pages/responsive'; diff --git a/assets/css/pages/_history.scss b/assets/css/pages/_history.scss new file mode 100644 index 00000000..29a432e9 --- /dev/null +++ b/assets/css/pages/_history.scss @@ -0,0 +1,4 @@ +.key-figure{ + font-size: 2em; + font-weight: light; +} diff --git a/src/AppBundle/Controller/DefaultController.php b/src/AppBundle/Controller/DefaultController.php index b6462456..e99e1de5 100755 --- a/src/AppBundle/Controller/DefaultController.php +++ b/src/AppBundle/Controller/DefaultController.php @@ -232,7 +232,8 @@ class DefaultController extends Controller $currentUser = $this->getUser(); $m = $this->getDoctrine()->getManager(); $sellingRepo = $m->getRepository('AppBundle:SellRecord'); - $mySellings = $sellingRepo->findByUser($currentUser->getId()); + $allSellingList = $sellingRepo->findByUser($currentUser->getId()); + $mySellings = array_splice($allSellingList, 0 , 15); $chiffreAffaires = 0; $myFestivals = $currentUser->getFestivals(); @@ -253,8 +254,13 @@ class DefaultController extends Controller ]; $statsForFestival = [ - ['name' => 'festoche bidule', 'clients_count' => 125, 'chiffre_affaire' => 236], + ['name' => 'festoche bidule', 'clients_count' => 125, 'chiffreAffaire' => 236, 'date'=> new \DateTime()], ]; + foreach ($allSellingList as $client) { + foreach ($client->getProductsSold() as $product) { + $chiffreAffaires += $product->getPrice(); + } + } foreach ($mySellings as $client) { foreach ($client->getProductsSold() as $product) { $chiffreAffaires += $product->getPrice(); @@ -276,10 +282,11 @@ class DefaultController extends Controller return $this->render('logged/history.html.twig', [ - 'statisticsFestivals' => $statisticsFestivals, + 'statisticsFestivals' => $statsForFestival, 'statisticsSoldProducts' => $statisticsSoldProducts, 'chiffreAffaires' => $chiffreAffaires, 'recentSells' => $mySellings, + 'allSellings' => $allSellingList, 'base_dir' => realpath($this->getParameter('kernel.project_dir')) . DIRECTORY_SEPARATOR, ]); } diff --git a/src/AppBundle/Controller/SellRecordController.php b/src/AppBundle/Controller/SellRecordController.php index dccab82f..52590bea 100755 --- a/src/AppBundle/Controller/SellRecordController.php +++ b/src/AppBundle/Controller/SellRecordController.php @@ -110,7 +110,7 @@ class SellRecordController extends Controller { /** * Deletes a sellRecord entity. * - * @Route("/{date}", name="sellrecord_delete") + * @Route("/{id}", name="sellrecord_delete") * @Method("DELETE") */ public function deleteAction( Request $request, SellRecord $sellRecord ) {