deletable sell records
This commit is contained in:
parent
ff118f64a6
commit
9a97f7312d
@ -7,16 +7,6 @@
|
||||
<div class="row">
|
||||
<h1>Historique</h1>
|
||||
</div>
|
||||
<h2>Ventes de produits</h2>
|
||||
<div id="chartContainer" style="display: inline-block; height: 300px; width: 49%;"></div>
|
||||
<div id="chartContainerChiffreAffaire" style="display: inline-block; height: 300px; width: 49%;"></div>
|
||||
<h2> {{ statisticsFestivals |length }} Festival
|
||||
{% if statisticsFestivals |length >1 %}
|
||||
s
|
||||
{% endif %}</h2>
|
||||
<div id="chartContainerstatisticsFestivals"
|
||||
style="display: inline-block; height: 300px; width: 100%;"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="sells">
|
||||
@ -51,8 +41,7 @@
|
||||
{% endif %}
|
||||
|
||||
</span>
|
||||
€
|
||||
panier moyen
|
||||
€ panier moyen
|
||||
|
||||
</h2>
|
||||
</div>
|
||||
@ -68,53 +57,67 @@
|
||||
<i class="fa fa-file-o fa-3x"></i>
|
||||
Exporter toutes vos données en format csv
|
||||
</a>
|
||||
<h2>
|
||||
{{ recentSells |length }} Dernières ventes
|
||||
</h2>
|
||||
<div class="table">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
date
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
commentaire
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
produits
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
montant
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% for vente in recentSells %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
{{ vente.date |date('Y-m-d H:i:s') }}
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
{{ vente.comment }}
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
{{ vente.productsSold |length }}
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
|
||||
{{ vente.amount }}
|
||||
<a href="{{ path('sellrecord_delete',{id: vente.id}) }}" class="btn btn-warning pull-right">
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<h2 class="text-center">Statistiques de ventes </h2>
|
||||
<div id="chartContainer" style="display: inline-block; height: 300px; width: 49%;"></div>
|
||||
<div id="chartContainerChiffreAffaire" style="display: inline-block; height: 300px; width: 49%;"></div>
|
||||
<h2> {{ statisticsFestivals |length }} Festival
|
||||
{% if statisticsFestivals |length >1 %}
|
||||
s
|
||||
{% endif %}</h2>
|
||||
<div id="chartContainerstatisticsFestivals"
|
||||
style="display: inline-block; height: 300px; width: 100%;"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="last-sellings">
|
||||
<h2>
|
||||
{{ recentSells |length }} Dernières ventes
|
||||
</h2>
|
||||
<div class="table">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
date
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
commentaire
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
produits
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
montant
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% for vente in recentSells %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
{{ vente.date |date('Y-m-d H:i:s') }}
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
{{ vente.comment }}
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
{{ vente.productsSold |length }}
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
|
||||
{{ vente.amount }}
|
||||
<a href="{{ path('sellrecord_delete',{id: vente.id }) }}"
|
||||
class="btn btn-warning pull-right">
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
|
||||
{% include ':logged:history-script.html.twig' %}
|
||||
|
@ -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' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user