diff --git a/app/Resources/views/logged/history.html.twig b/app/Resources/views/logged/history.html.twig index 51fb5bdf..c129a839 100755 --- a/app/Resources/views/logged/history.html.twig +++ b/app/Resources/views/logged/history.html.twig @@ -7,16 +7,6 @@

Historique

-

Ventes de produits

-
-
-

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

-
-
@@ -51,8 +41,7 @@ {% endif %} - € - panier moyen + € panier moyen
@@ -68,53 +57,67 @@ Exporter toutes vos données en format csv -

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

-
-
-
- date -
-
- commentaire -
-
- produits -
-
- montant -
-
-
- {% for vente in recentSells %} -
-
- {{ vente.date |date('Y-m-d H:i:s') }} -
-
- {{ vente.comment }} -
-
- {{ vente.productsSold |length }} -
-
- - {{ vente.amount }} - - - -
-
- - {% endfor %}
+
+

Statistiques de ventes

+
+
+

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

+
+
+

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

+
+
+
+ date +
+
+ commentaire +
+
+ produits +
+
+ montant +
+
+
+ {% for vente in recentSells %} + +
+
+ {{ vente.date |date('Y-m-d H:i:s') }} +
+
+ {{ vente.comment }} +
+
+ {{ vente.productsSold |length }} +
+
+ + {{ vente.amount }} + + + +
+
+ + {% endfor %} +
{% include ':logged:history-script.html.twig' %} diff --git a/src/AppBundle/Controller/SellRecordController.php b/src/AppBundle/Controller/SellRecordController.php index 52590bea..32594617 100755 --- a/src/AppBundle/Controller/SellRecordController.php +++ b/src/AppBundle/Controller/SellRecordController.php @@ -8,6 +8,8 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; + /** * Sellrecord controller. * @@ -106,27 +108,21 @@ class SellRecordController extends Controller { 'delete_form' => $deleteForm->createView(), ] ); } - /** * Deletes a sellRecord entity. * - * @Route("/{id}", name="sellrecord_delete") - * @Method("DELETE") + * @Route("/delete/{id}", name="sellrecord_delete") */ - public function deleteAction( Request $request, SellRecord $sellRecord ) { + public function deleteAction( Request $request, SellRecord $id) { + $sellRecord = $id; if ( $sellRecord->getUser()->getId() !== $this->getUser()->getId() ) { $this->denyAccessUnlessGranted( 'ROLE_ADMIN' ); } - $form = $this->createDeleteForm( $sellRecord ); - $form->handleRequest( $request ); - - if ( $form->isSubmitted() && $form->isValid() ) { $em = $this->getDoctrine()->getManager(); $em->remove( $sellRecord ); $em->flush(); - } - return $this->redirectToRoute( 'sellrecord_index' ); + return $this->redirectToRoute( 'history' ); } /** diff --git a/src/AppBundle/Entity/SellRecord.php b/src/AppBundle/Entity/SellRecord.php index 6ebfa0d6..1532c81d 100644 --- a/src/AppBundle/Entity/SellRecord.php +++ b/src/AppBundle/Entity/SellRecord.php @@ -24,7 +24,7 @@ class SellRecord { private $gender; /** * liste des produits de la vente - * @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="sellRecords") + * @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="sellRecords", cascade={"remove", "persist","detach"}) */ private $productsSold;