Added partner order statistic on dashboard

This commit is contained in:
Frank Schubert
2024-01-11 18:21:02 +01:00
parent 42c527c38c
commit f86190d72c
5 changed files with 138 additions and 17 deletions

View File

@@ -1,3 +1,30 @@
<?php
$additionalJS = ["plugins/chart.js/Chart.min.js"];
$chartColors = [
'#3366CC',
'#DC3912',
'#FF9900',
'#109618',
'#990099',
'#3B3EAC',
'#0099C6',
'#DD4477',
'#66AA00',
'#B82E2E',
'#316395',
'#994499',
'#22AA99',
'#AAAA11',
'#6633CC',
'#E67300',
'#8B0707',
'#329262',
'#5574A6',
'#3B3EAC'
]
?>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<div class="row justify-content-center mt-1">
@@ -115,25 +142,37 @@
</div>
<!--div class="row mt-2">
<div class="col-lg">
<h4 class="card-title">Kunden pro Provider</h4>
<div class="row">
<?php if(1): ?>
<div class="col-lg-7">
<canvas id="partner-chart" height="200"></canvas>
<div class="row mt-2">
<div class="col-6">
<div class="card">
<div class="card-body">
<h4 class="card-title">Kunden pro Provider</h4>
<hr />
<div class="row">
<?php if(1): ?>
<div class="col-lg-7">
<canvas id="partner-chart" height="200"></canvas>
</div>
<div class="col-lg-5">
<table>
<?php $i=0; foreach($partner_orders as $provider => $count): ?>
<tr style="border-bottom: 1px solid <?=$chartColors[$i]?>;">
<td><span style="background-color: <?=$chartColors[$i]?>; color: <?=$chartColors[$i]?>">##</span></td>
<td class="pl-2 pr-2" style="white-space: nowrap;"><?=round(($count / $total_orders) * 100, 1)?>% (<?=($count)?>)</td>
<td title="<?=$provider?>" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"><?=$this->strtrim($provider,22)?></td>
</tr>
<?php $i++; endforeach; ?>
</table>
</div>
<?php else: ?>
<i>Keine Aktiven Anschlüsse</i>
<?php endif; ?>
</div>
</div>
<div class="col-lg-5">
<table>
</table>
</div>
<?php else: ?>
<i>Keine Aktiven Anschlüsse</i>
<?php endif; ?>
</div>
</div>
</div-->
</div>
</div>
</div>
@@ -163,6 +202,39 @@
});
<?php if(count($partner_orders)): ?>
var providerChart = new Chart(document.getElementById('partner-chart').getContext('2d'), {
type: 'doughnut',
data: {
labels: [
<?php foreach($partner_orders as $partner => $c): ?>
"<?=$partner?> (<?=round(($c / $total_orders) * 100, 1)?>%)",
<?php endforeach; ?>
],
datasets: [{
data: [
<?php foreach($partner_orders as $c): ?>
<?=($c)?>,
<?php endforeach; ?>
],
backgroundColor: [
"<?=implode('","', $chartColors)?>"
],
borderWidth: 2
}]
},
options: {
scales: {
y: {
beginAtZero: true
}
},
legend: false,
}
});
<?php endif; ?>
});
</script>

View File

@@ -42,7 +42,7 @@ $pagination_entity_name = "Pops";
<thead>
<tr>
<th>Name</th>
<th>Netgebiet</th>
<th>Netzgebiet</th>
<th>Zutritt</th>
<th>Vlan Public/Nat/IPv6</th>
<th>Koordinaten</th>

View File

@@ -21,6 +21,12 @@
<link href="<?=self::getResourcePath()?>plugins/summernote/summernote-bs4.css" rel="stylesheet" type="text/css" />
<link href="<?=self::getResourcePath()?>datatables/datatables.min.css?<?=date('U')?>" rel="stylesheet" type="text/css" />
<?php if(isset($additionalCSS) && is_array($additionalCSS) && count($additionalCSS)): ?>
<?php foreach($additionalCSS as $css): ?>
<link rel="stylesheet" href="<?=self::getResourcePath()?><?=$css?>" />
<?php endforeach; ?>
<?php endif; ?>
<script type="text/javascript" src="<?=self::getResourcePath()?>js/jquery.min.js"></script>
<script type="text/javascript" src="<?=self::getResourcePath()?>assets/libs/select2/select2.full.min.js"></script>
<script type="text/javascript" src="<?=self::getResourcePath()?>js/bootstrap-datepicker.min.js"></script>
@@ -34,6 +40,12 @@
<script type="text/javascript" src="<?=self::getResourcePath()?>js/bootstrap-autocomplete.min.js"></script>
<script type="text/javascript" src="<?=self::getResourcePath()?>datatables/datatables.min.js?<?=date('U')?>"></script>
<?php if(isset($additionalJS) && is_array($additionalJS) && count($additionalJS)): ?>
<?php foreach($additionalJS as $js): ?>
<script src="<?=self::getResourcePath()?><?=$js?>"></script>
<?php endforeach; ?>
<?php endif; ?>
<?php if(MFAPPNAME == "devthetool"): ?>
<style type="text/css">
body {