target festival actuel in list
This commit is contained in:
parent
fe4f202bed
commit
db7210c00b
|
@ -29,8 +29,13 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
|
|
||||||
{% for festival in festivals %}
|
{% for festival in festivals %}
|
||||||
<tr>
|
<tr
|
||||||
|
{% if app.user.activeFestival and (app.user.activeFestival.id == festival.id) %}
|
||||||
|
class="bg-success"
|
||||||
|
{% endif %}
|
||||||
|
>
|
||||||
<td>
|
<td>
|
||||||
<a class="btn btn-primary"
|
<a class="btn btn-primary"
|
||||||
href="{{ path('festival_show', { 'id': festival.id }) }}">{{ festival.id }}</a>
|
href="{{ path('festival_show', { 'id': festival.id }) }}">{{ festival.id }}</a>
|
||||||
|
@ -56,17 +61,19 @@
|
||||||
</td>
|
</td>
|
||||||
<td>{{ festival.chiffreAffaire - (festival.fraisInscription + festival.fraisTransport + festival.fraisRepas + festival.fraisHebergement ) }}</td>
|
<td>{{ festival.chiffreAffaire - (festival.fraisInscription + festival.fraisTransport + festival.fraisRepas + festival.fraisHebergement ) }}</td>
|
||||||
<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>
|
<ul>
|
||||||
<li>
|
<li class="pull-left">
|
||||||
<a class="btn btn-success" href="{{ path('set_active_festival', { 'id': festival.id }) }}">
|
|
||||||
choisir comme actuel
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a class="btn btn-primary" href="{{ path('festival_show', { 'id': festival.id }) }}">voir
|
<a class="btn btn-primary" href="{{ path('festival_show', { 'id': festival.id }) }}">voir
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li class="pull-left">
|
||||||
<a class="btn btn-primary" href="{{ path('festival_edit', { 'id': festival.id }) }}">
|
<a class="btn btn-primary" href="{{ path('festival_edit', { 'id': festival.id }) }}">
|
||||||
<i class="fa fa-pencil"></i>
|
<i class="fa fa-pencil"></i>
|
||||||
Modifier
|
Modifier
|
||||||
|
|
|
@ -7,9 +7,11 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h1>Historique</h1>
|
<h1>Historique</h1>
|
||||||
</div>
|
</div>
|
||||||
|
<h2>Ventes de produits</h2>
|
||||||
<div id="chartContainer" style="display: inline-block; height: 300px; width: 49%;"></div>
|
<div id="chartContainer" style="display: inline-block; height: 300px; width: 49%;"></div>
|
||||||
<div id="chartContainerChiffreAffaire" 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="row">
|
||||||
<div class="col-xs-6">
|
<div class="col-xs-6">
|
||||||
|
@ -101,7 +103,26 @@
|
||||||
{% for pair in statisticsSoldProducts %}
|
{% for pair in statisticsSoldProducts %}
|
||||||
{ label: "{{ pair.name }}", y: {{ pair.value }} },
|
{ label: "{{ pair.name }}", y: {{ pair.value }} },
|
||||||
{% endfor %}
|
{% 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", {
|
var chart = new CanvasJS.Chart("chartContainer", {
|
||||||
title:{
|
title:{
|
||||||
text: "Volume de produits vendus"
|
text: "Volume de produits vendus"
|
||||||
|
|
|
@ -290,8 +290,19 @@ class DefaultController extends Controller
|
||||||
$mySellings = $sellingRepo->findByUser($currentUser->getId());
|
$mySellings = $sellingRepo->findByUser($currentUser->getId());
|
||||||
$chiffreAffaires = 0;
|
$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 = [
|
$statisticsSoldProducts = [
|
||||||
// ['name' => 'bidule', 'count' => 0, 'value' => 0],
|
// ['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()]['count']++;
|
||||||
$statisticsSoldProducts[$product->getName()]['value'] = $statisticsSoldProducts[$product->getName()]['value'] + intval($product->getPrice());
|
$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',
|
return $this->render('logged/history.html.twig',
|
||||||
[
|
[
|
||||||
|
'statisticsFestivals' => $statisticsFestivals,
|
||||||
'statisticsSoldProducts' => $statisticsSoldProducts,
|
'statisticsSoldProducts' => $statisticsSoldProducts,
|
||||||
'chiffreAffaires' => $chiffreAffaires,
|
'chiffreAffaires' => $chiffreAffaires,
|
||||||
'recentSells' => $mySellings,
|
'recentSells' => $mySellings,
|
||||||
|
|
Loading…
Reference in New Issue