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>
|
@ -10,33 +10,55 @@
|
||||
<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>
|
||||
<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">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
<h2>
|
||||
<i class="fa fa-users"></i>
|
||||
<div class="chiffre">
|
||||
{{ recentSells |length }}
|
||||
</div>
|
||||
<span class="chiffre key-figure">
|
||||
{{ allSellings |length }}
|
||||
</span>
|
||||
Clients
|
||||
</h2>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
<h2>
|
||||
<i class="fa fa-euro"></i>
|
||||
<span class="chiffre key-figure">
|
||||
{{ chiffreAffaires }}
|
||||
</span>
|
||||
Chiffre d'affaires
|
||||
<div class="chiffre">
|
||||
{{ chiffreAffaires }} €
|
||||
</div>
|
||||
|
||||
</h2>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
<h2>
|
||||
<i class="fa fa-shopping-cart"></i>
|
||||
<span class="chiffre key-figure">
|
||||
{% if allSellings %}
|
||||
{{ (chiffreAffaires / (allSellings |length))|round }}
|
||||
{% else %}
|
||||
?
|
||||
{% endif %}
|
||||
|
||||
</span>
|
||||
€
|
||||
panier moyen
|
||||
<div class="chiffre">
|
||||
{{ chiffreAffaires / ((recentSells |length) or 1) }} €
|
||||
</div>
|
||||
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
@ -47,7 +69,7 @@
|
||||
Exporter toutes vos données en format csv
|
||||
</a>
|
||||
<h2>
|
||||
Dernières ventes
|
||||
{{ recentSells |length }} Dernières ventes
|
||||
</h2>
|
||||
<div class="table">
|
||||
<div class="row">
|
||||
@ -78,7 +100,11 @@
|
||||
{{ 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>
|
||||
|
||||
@ -91,80 +117,6 @@
|
||||
</div>
|
||||
|
||||
|
||||
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
|
||||
<script>
|
||||
{% include ':logged:history-script.html.twig' %}
|
||||
|
||||
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 %}
|
||||
|
@ -7,6 +7,7 @@
|
||||
@import 'pages/global';
|
||||
//@import 'pages/demo';
|
||||
@import 'pages/home';
|
||||
@import 'pages/history';
|
||||
@import 'pages/dashboard';
|
||||
@import 'pages/special';
|
||||
@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();
|
||||
$m = $this->getDoctrine()->getManager();
|
||||
$sellingRepo = $m->getRepository('AppBundle:SellRecord');
|
||||
$mySellings = $sellingRepo->findByUser($currentUser->getId());
|
||||
$allSellingList = $sellingRepo->findByUser($currentUser->getId());
|
||||
$mySellings = array_splice($allSellingList, 0 , 15);
|
||||
$chiffreAffaires = 0;
|
||||
|
||||
$myFestivals = $currentUser->getFestivals();
|
||||
@ -253,8 +254,13 @@ class DefaultController extends Controller
|
||||
];
|
||||
|
||||
$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 ($client->getProductsSold() as $product) {
|
||||
$chiffreAffaires += $product->getPrice();
|
||||
@ -276,10 +282,11 @@ class DefaultController extends Controller
|
||||
|
||||
return $this->render('logged/history.html.twig',
|
||||
[
|
||||
'statisticsFestivals' => $statisticsFestivals,
|
||||
'statisticsFestivals' => $statsForFestival,
|
||||
'statisticsSoldProducts' => $statisticsSoldProducts,
|
||||
'chiffreAffaires' => $chiffreAffaires,
|
||||
'recentSells' => $mySellings,
|
||||
'allSellings' => $allSellingList,
|
||||
'base_dir' => realpath($this->getParameter('kernel.project_dir')) . DIRECTORY_SEPARATOR,
|
||||
]);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ class SellRecordController extends Controller {
|
||||
/**
|
||||
* Deletes a sellRecord entity.
|
||||
*
|
||||
* @Route("/{date}", name="sellrecord_delete")
|
||||
* @Route("/{id}", name="sellrecord_delete")
|
||||
* @Method("DELETE")
|
||||
*/
|
||||
public function deleteAction( Request $request, SellRecord $sellRecord ) {
|
||||
|
Loading…
Reference in New Issue
Block a user