show history
This commit is contained in:
parent
604c5cabd1
commit
d772f478b5
75
app/Resources/views/logged/history-script.html.twig
Normal file
75
app/Resources/views/logged/history-script.html.twig
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var dataPoints = [
|
||||||
|
{% for pair in statisticsSoldProducts %}
|
||||||
|
{
|
||||||
|
label: "{{ pair.name }}",
|
||||||
|
x: {{ pair.count }},
|
||||||
|
y: {{ pair.count }}
|
||||||
|
},
|
||||||
|
{% endfor %}
|
||||||
|
];
|
||||||
|
var dataPointsChiffreAffaire = [
|
||||||
|
{% for pair in statisticsSoldProducts %}
|
||||||
|
{
|
||||||
|
label: "{{ pair.name }}",
|
||||||
|
x: {{ pair.value }},
|
||||||
|
y: {{ pair.value }}
|
||||||
|
},
|
||||||
|
{% endfor %}
|
||||||
|
];
|
||||||
|
var dataPointsFestivals = [
|
||||||
|
{% for pair in statisticsFestivals %}
|
||||||
|
{
|
||||||
|
label: "{{ pair.date|date('Y-m-d') }}",
|
||||||
|
y: {{ pair.chiffreAffaire }} ,
|
||||||
|
countClients : {{ pair.clients_count }}
|
||||||
|
},
|
||||||
|
{% endfor %}
|
||||||
|
];
|
||||||
|
console.log(dataPointsFestivals);
|
||||||
|
var chartFestival = new CanvasJS.Chart("chartContainerstatisticsFestivals", {
|
||||||
|
title:{
|
||||||
|
text: "Chiffre d'affaire par festival"
|
||||||
|
},
|
||||||
|
animationEnabled: true,
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
// Change type to "doughnut", "line", "splineArea", etc.
|
||||||
|
type: "line",
|
||||||
|
dataPoints: dataPointsFestivals
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
console.log('dataPointsFestivals', dataPointsFestivals);
|
||||||
|
chartFestival.render();
|
||||||
|
var chart = new CanvasJS.Chart("chartContainer", {
|
||||||
|
title:{
|
||||||
|
text: "Volume de produits vendus"
|
||||||
|
},
|
||||||
|
animationEnabled: true,
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
// Change type to "doughnut", "line", "splineArea", etc.
|
||||||
|
type: "pie",
|
||||||
|
dataPoints: dataPoints
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
chart.render();
|
||||||
|
var chartContainerChiffreAffaire = new CanvasJS.Chart("chartContainerChiffreAffaire", {
|
||||||
|
title:{
|
||||||
|
text: "Valeur en euros des produits vendus"
|
||||||
|
},
|
||||||
|
animationEnabled: true,
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
// Change type to "doughnut", "line", "splineArea", etc.
|
||||||
|
type: "pie",
|
||||||
|
dataPoints: dataPointsChiffreAffaire
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
chartContainerChiffreAffaire.render();
|
||||||
|
</script>
|
@ -7,36 +7,58 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<h1>Historique</h1>
|
<h1>Historique</h1>
|
||||||
</div>
|
</div>
|
||||||
<h2>Ventes de produits</h2>
|
<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>
|
<h2> {{ statisticsFestivals |length }} Festival
|
||||||
<div id="chartContainerstatisticsFestivals" style="display: inline-block; height: 300px; width: 100%;"></div>
|
{% if statisticsFestivals |length >1 %}
|
||||||
|
s
|
||||||
|
{% endif %}</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">
|
||||||
<div class="sells">
|
<div class="sells">
|
||||||
<h2>
|
<div class="row">
|
||||||
<i class="fa fa-users"></i>
|
<div class="col-xs-12 col-sm-4">
|
||||||
<div class="chiffre">
|
<h2>
|
||||||
{{ recentSells |length }}
|
<i class="fa fa-users"></i>
|
||||||
|
<span class="chiffre key-figure">
|
||||||
|
{{ allSellings |length }}
|
||||||
|
</span>
|
||||||
|
Clients
|
||||||
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
Clients
|
<div class="col-xs-12 col-sm-4">
|
||||||
</h2>
|
<h2>
|
||||||
<h2>
|
<i class="fa fa-euro"></i>
|
||||||
<i class="fa fa-euro"></i>
|
<span class="chiffre key-figure">
|
||||||
Chiffre d'affaires
|
{{ chiffreAffaires }}
|
||||||
<div class="chiffre">
|
</span>
|
||||||
{{ chiffreAffaires }} €
|
Chiffre d'affaires
|
||||||
|
|
||||||
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</h2>
|
<div class="col-xs-12 col-sm-4">
|
||||||
<h2>
|
<h2>
|
||||||
<i class="fa fa-shopping-cart"></i>
|
<i class="fa fa-shopping-cart"></i>
|
||||||
panier moyen
|
<span class="chiffre key-figure">
|
||||||
<div class="chiffre">
|
{% if allSellings %}
|
||||||
{{ chiffreAffaires / ((recentSells |length) or 1) }} €
|
{{ (chiffreAffaires / (allSellings |length))|round }}
|
||||||
|
{% else %}
|
||||||
|
?
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</span>
|
||||||
|
€
|
||||||
|
panier moyen
|
||||||
|
|
||||||
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</h2>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -47,7 +69,7 @@
|
|||||||
Exporter toutes vos données en format csv
|
Exporter toutes vos données en format csv
|
||||||
</a>
|
</a>
|
||||||
<h2>
|
<h2>
|
||||||
Dernières ventes
|
{{ recentSells |length }} Dernières ventes
|
||||||
</h2>
|
</h2>
|
||||||
<div class="table">
|
<div class="table">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -78,7 +100,11 @@
|
|||||||
{{ vente.productsSold |length }}
|
{{ vente.productsSold |length }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-3">
|
<div class="col-xs-3">
|
||||||
|
|
||||||
{{ vente.amount }}
|
{{ 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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -91,80 +117,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
|
{% include ':logged:history-script.html.twig' %}
|
||||||
<script>
|
|
||||||
|
|
||||||
var dataPoints = [
|
|
||||||
{% for pair in statisticsSoldProducts %}
|
|
||||||
{
|
|
||||||
label: "{{ pair.name }}",
|
|
||||||
x: {{ pair.count }},
|
|
||||||
y: {{ pair.count }}
|
|
||||||
},
|
|
||||||
{% endfor %}
|
|
||||||
];
|
|
||||||
var dataPointsChiffreAffaire = [
|
|
||||||
{% for pair in statisticsSoldProducts %}
|
|
||||||
{
|
|
||||||
label: "{{ pair.name }}",
|
|
||||||
x: {{ pair.value }},
|
|
||||||
y: {{ pair.value }}
|
|
||||||
},
|
|
||||||
{% endfor %}
|
|
||||||
];
|
|
||||||
var dataPointsFestivals = [
|
|
||||||
{% for pair in statisticsFestivals %}
|
|
||||||
{
|
|
||||||
label: "{{ pair.name }}",
|
|
||||||
name: "{{ pair.name }}",
|
|
||||||
x: "{{ pair.date |date('Y-m-d')}}",
|
|
||||||
y: {{ pair.chiffreAffaire }} ,
|
|
||||||
countClients : {{ pair.clients_count }}
|
|
||||||
},
|
|
||||||
{% 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"
|
|
||||||
},
|
|
||||||
animationEnabled: true,
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
// Change type to "doughnut", "line", "splineArea", etc.
|
|
||||||
type: "pie",
|
|
||||||
dataPoints: dataPoints
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
chart.render();
|
|
||||||
var chartContainerChiffreAffaire = new CanvasJS.Chart("chartContainerChiffreAffaire", {
|
|
||||||
title:{
|
|
||||||
text: "Valeur en euros des produits vendus"
|
|
||||||
},
|
|
||||||
animationEnabled: true,
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
// Change type to "doughnut", "line", "splineArea", etc.
|
|
||||||
type: "pie",
|
|
||||||
dataPoints: dataPointsChiffreAffaire
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
chartContainerChiffreAffaire.render();
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
@import 'pages/global';
|
@import 'pages/global';
|
||||||
//@import 'pages/demo';
|
//@import 'pages/demo';
|
||||||
@import 'pages/home';
|
@import 'pages/home';
|
||||||
|
@import 'pages/history';
|
||||||
@import 'pages/dashboard';
|
@import 'pages/dashboard';
|
||||||
@import 'pages/special';
|
@import 'pages/special';
|
||||||
@import 'pages/responsive';
|
@import 'pages/responsive';
|
||||||
|
4
assets/css/pages/_history.scss
Normal file
4
assets/css/pages/_history.scss
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.key-figure{
|
||||||
|
font-size: 2em;
|
||||||
|
font-weight: light;
|
||||||
|
}
|
@ -232,7 +232,8 @@ class DefaultController extends Controller
|
|||||||
$currentUser = $this->getUser();
|
$currentUser = $this->getUser();
|
||||||
$m = $this->getDoctrine()->getManager();
|
$m = $this->getDoctrine()->getManager();
|
||||||
$sellingRepo = $m->getRepository('AppBundle:SellRecord');
|
$sellingRepo = $m->getRepository('AppBundle:SellRecord');
|
||||||
$mySellings = $sellingRepo->findByUser($currentUser->getId());
|
$allSellingList = $sellingRepo->findByUser($currentUser->getId());
|
||||||
|
$mySellings = array_splice($allSellingList, 0 , 15);
|
||||||
$chiffreAffaires = 0;
|
$chiffreAffaires = 0;
|
||||||
|
|
||||||
$myFestivals = $currentUser->getFestivals();
|
$myFestivals = $currentUser->getFestivals();
|
||||||
@ -253,8 +254,13 @@ class DefaultController extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
$statsForFestival = [
|
$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 ($mySellings as $client) {
|
||||||
foreach ($client->getProductsSold() as $product) {
|
foreach ($client->getProductsSold() as $product) {
|
||||||
$chiffreAffaires += $product->getPrice();
|
$chiffreAffaires += $product->getPrice();
|
||||||
@ -276,10 +282,11 @@ class DefaultController extends Controller
|
|||||||
|
|
||||||
return $this->render('logged/history.html.twig',
|
return $this->render('logged/history.html.twig',
|
||||||
[
|
[
|
||||||
'statisticsFestivals' => $statisticsFestivals,
|
'statisticsFestivals' => $statsForFestival,
|
||||||
'statisticsSoldProducts' => $statisticsSoldProducts,
|
'statisticsSoldProducts' => $statisticsSoldProducts,
|
||||||
'chiffreAffaires' => $chiffreAffaires,
|
'chiffreAffaires' => $chiffreAffaires,
|
||||||
'recentSells' => $mySellings,
|
'recentSells' => $mySellings,
|
||||||
|
'allSellings' => $allSellingList,
|
||||||
'base_dir' => realpath($this->getParameter('kernel.project_dir')) . DIRECTORY_SEPARATOR,
|
'base_dir' => realpath($this->getParameter('kernel.project_dir')) . DIRECTORY_SEPARATOR,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ class SellRecordController extends Controller {
|
|||||||
/**
|
/**
|
||||||
* Deletes a sellRecord entity.
|
* Deletes a sellRecord entity.
|
||||||
*
|
*
|
||||||
* @Route("/{date}", name="sellrecord_delete")
|
* @Route("/{id}", name="sellrecord_delete")
|
||||||
* @Method("DELETE")
|
* @Method("DELETE")
|
||||||
*/
|
*/
|
||||||
public function deleteAction( Request $request, SellRecord $sellRecord ) {
|
public function deleteAction( Request $request, SellRecord $sellRecord ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user