added sparkline to order count on dashboard

This commit is contained in:
Frank Schubert
2024-01-11 22:47:26 +01:00
parent ea8fd727f6
commit bb93587135
2 changed files with 111 additions and 16 deletions
+81 -15
View File
@@ -61,12 +61,14 @@ $chartColors = [
<?php endif; ?>
<div class="row justify-content-center mt-4">
<div class="row justify-content-center mt-2">
<div class="col-12 col-xl-10">
<h4>Akquise Statistiken <small>Momentan nur für Admins sichtbar <i class="far fa-smile text-success"></i></small></h4>
<div class="card bg-light border-top-success">
<div class="card-header pb-0">
<h4 class="card-title">Akquise Statistiken <small>Momentan nur für Admins sichtbar <i class="far fa-smile text-success"></i></small></h4>
</div>
<div class="card-body">
<div class="row mb-2">
<div class="col">
<label for="campaign_id">Kampagne:</label>
@@ -83,14 +85,15 @@ $chartColors = [
<div class="col-xl-3 col-lg-6">
<div class="card">
<div class="card-body p-0 bg-danger">
<div class="p-3 pb-0">
<div style="height: 128px;" class="p-3">
<div class="float-right">
<i class="mdi mdi-cart text-white widget-icon"></i>
</div>
<h5 class="text-white font-weight-normal mt-0">Bestellungen</h5>
<h3 class="mt-2 text-white"><?=$count_orders?> / <?=$max_connections?></h3>
</div>
<div id="sparkline1"></div>
<canvas style="position: absolute; bottom:0;" height="60" id="sparkline1"></canvas>
</div> <!-- end card-body-->
</div> <!-- end card-->
</div> <!-- end col-->
@@ -98,14 +101,14 @@ $chartColors = [
<div class="col-xl-3 col-lg-6">
<div class="card">
<div class="card-body p-0 bg-primary">
<div class="p-3 pb-0">
<div style="height: 128px;" class="p-3">
<div class="float-right">
<i class="mdi mdi-cart text-white widget-icon"></i>
</div>
<h5 class="text-white font-weight-normal mt-0">Status BEP Installed (244, SD)</h5>
<h3 class="mt-2 text-white"><?=$status_connected_single?> / <?=$count_orders?></h3>
</div>
<div id="sparkline1"></div>
<canvas style="position: absolute; bottom:0;" height="60" id="sparkline2"></canvas>
</div> <!-- end card-body-->
</div> <!-- end card-->
</div> <!-- end col-->
@@ -113,14 +116,14 @@ $chartColors = [
<div class="col-xl-3 col-lg-6">
<div class="card">
<div class="card-body p-0 bg-info">
<div class="p-3 pb-0">
<div style="height: 128px;" class="p-3">
<div class="float-right">
<i class="mdi mdi-cart text-white widget-icon"></i>
</div>
<h5 class="text-white font-weight-normal mt-0">Status OTO Installed (245, MD)</h5>
<h3 class="mt-2 text-white"><?=$status_connected_multi?> / <?=$count_orders?></h3>
</div>
<div id="sparkline1"></div>
<canvas style="position: absolute; bottom:0;" height="60" id="sparkline3"></canvas>
</div> <!-- end card-body-->
</div> <!-- end card-->
</div> <!-- end col-->
@@ -128,14 +131,14 @@ $chartColors = [
<div class="col-xl-3 col-lg-6">
<div class="card">
<div class="card-body p-0 bg-warning">
<div class="p-3 pb-0">
<div style="height: 128px;" class="p-3">
<div class="float-right">
<i class="mdi mdi-cart text-dark widget-icon"></i>
</div>
<h5 class="text-dark font-weight-normal mt-0">Aktive Anschlüsse</h5>
<h3 class="mt-2 text-dark"><?=$status_connected?> / <?=$count_orders?></h3>
</div>
<div id="sparkline1"></div>
<canvas style="position: absolute; bottom:0;" height="60" id="sparkline4"></canvas>
</div> <!-- end card-body-->
</div> <!-- end card-->
</div> <!-- end col-->
@@ -143,18 +146,18 @@ $chartColors = [
</div>
<div class="row mt-2">
<div class="col-6">
<div class="col-12 col-xl-6">
<div class="card">
<div class="card-body">
<h4 class="card-title">Kunden je Partner</h4>
<hr />
<div class="row">
<?php if(1): ?>
<div class="col-lg-7">
<?php if(count($partner_orders)): ?>
<div class="col-12 col-xl-7">
<canvas id="partner-chart" height="200"></canvas>
</div>
<div class="col-lg-5">
<div class="col-12 col-xl-5">
<table>
<?php $i=0; foreach($partner_orders as $provider => $count): ?>
<tr style="border-bottom: 1px solid <?=$chartColors[$i]?>;">
@@ -234,7 +237,70 @@ $chartColors = [
}
});
<?php endif; ?>
<?php if(count($weekly_orders)): ?>
const chart = new Chart(document.getElementById('sparkline1').getContext('2d'), {
type: 'line',
data: {
labels: [
<?php $wo = [] ?>
<?php foreach($weekly_orders as $time => $o): $wo[] = "KW".date("W Y", $time); endforeach; ?>
"<?=implode('","', $wo)?>"
],
datasets: [
{
label: "",
fill: true,
data: [
<?=implode(",", $weekly_orders)?>
]
}
]
},
options: {
responsive: true,
legend: {
display: false
},
elements: {
line: {
borderColor: '#800',
borderWidth: 1
},
point: {
radius: 0
}
},
tooltips: {
mode: 'index',
intersect: false
},
hover: {
mode: 'nearest',
intersect: true
},
scales: {
yAxes: [
{
display: false
}
],
xAxes: [
{
display: false
}
]
},
interaction: {
intersect: false,
mode: 'index',
},
}
});
<?php endif; ?>
});
</script>