target festival actuel in list

This commit is contained in:
Kayn Ty 2018-05-22 16:53:23 +02:00
parent fe4f202bed
commit db7210c00b
No known key found for this signature in database
GPG Key ID: 55B09AA0ED327CD3
3 changed files with 50 additions and 16 deletions

View File

@ -29,8 +29,13 @@
</thead>
<tbody>
{% for festival in festivals %}
<tr>
<tr
{% if app.user.activeFestival and (app.user.activeFestival.id == festival.id) %}
class="bg-success"
{% endif %}
>
<td>
<a class="btn btn-primary"
href="{{ path('festival_show', { 'id': festival.id }) }}">{{ festival.id }}</a>
@ -56,17 +61,19 @@
</td>
<td>{{ festival.chiffreAffaire - (festival.fraisInscription + festival.fraisTransport + festival.fraisRepas + festival.fraisHebergement ) }}</td>
<td>
{% if app.user.activeFestival and (app.user.activeFestival.id == festival.id) %}
Actuel
{% else %}
<a class="btn btn-success" href="{{ path('set_active_festival', { 'id': festival.id }) }}">
choisir comme actuel
</a>
{% endif %}
<ul>
<li>
<a class="btn btn-success" href="{{ path('set_active_festival', { 'id': festival.id }) }}">
choisir comme actuel
</a>
</li>
<li>
<li class="pull-left">
<a class="btn btn-primary" href="{{ path('festival_show', { 'id': festival.id }) }}">voir
</a>
</li>
<li>
<li class="pull-left">
<a class="btn btn-primary" href="{{ path('festival_edit', { 'id': festival.id }) }}">
<i class="fa fa-pencil"></i>
Modifier

View File

@ -7,9 +7,11 @@
<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>Festivals</h2>
<div id="chartContainerstatisticsFestivals" style="display: inline-block; height: 300px; width: 100%;"></div>
<div class="row">
<div class="col-xs-6">
@ -101,7 +103,26 @@
{% for pair in statisticsSoldProducts %}
{ label: "{{ pair.name }}", y: {{ pair.value }} },
{% endfor %}
];var dataPointsFestivals = [
{% for pair in statisticsFestivals %}
{ label: "{{ pair.name }}", y: {{ pair.chiffreAffaire }} , countClients : {{ pair.clients_count }}, date: "{{ pair.date |date('Y-m-d')}}" },
{% endfor %}
];
console.log(dataPointsFestivals);
var chartFestival = new CanvasJS.Chart("chartContainer", {
title:{
text: "Chiffre d'affaire par festival"
},
animationEnabled: true,
data: [
{
// Change type to "doughnut", "line", "splineArea", etc.
type: "bar",
dataPoints: dataPointsFestivals
}
]
});
chartFestival.render();
var chart = new CanvasJS.Chart("chartContainer", {
title:{
text: "Volume de produits vendus"

View File

@ -290,8 +290,19 @@ class DefaultController extends Controller
$mySellings = $sellingRepo->findByUser($currentUser->getId());
$chiffreAffaires = 0;
$myFestivals = $currentUser->getFestivals();
$productsSoldOfUser = $currentUser->getProductsSold();
$statisticsFestivals = [
];
foreach ($myFestivals as $festival) {
$statisticsFestivals[]=[
'date'=>$festival->getDateCreation(),
'name'=>$festival->getName(),
'clients_count' => count($festival->getSellRecords()),
'chiffreAffaire'=>$festival->getChiffreAffaire(),
];
}
$statisticsSoldProducts = [
// ['name' => 'bidule', 'count' => 0, 'value' => 0],
];
@ -312,20 +323,15 @@ class DefaultController extends Controller
];
}
// echo '<pre>';
// var_dump(intval($product->getPrice()));
// echo '</pre>';
$statisticsSoldProducts[$product->getName()]['count']++;
$statisticsSoldProducts[$product->getName()]['value'] = $statisticsSoldProducts[$product->getName()]['value'] + intval($product->getPrice());
}
}
// echo '<pre>';
// var_dump($statisticsSoldProducts);
// echo '</pre>';
return $this->render('logged/history.html.twig',
[
'statisticsFestivals' => $statisticsFestivals,
'statisticsSoldProducts' => $statisticsSoldProducts,
'chiffreAffaires' => $chiffreAffaires,
'recentSells' => $mySellings,