Update to Dashboard Preorder statistics

This commit is contained in:
Frank Schubert
2024-01-15 18:16:20 +01:00
parent 686082a62d
commit 898e35f830
2 changed files with 152 additions and 12 deletions
+107 -3
View File
@@ -159,22 +159,76 @@ $chartColors = [
</div>
<div class="col-12 col-xl-6">
<table>
<?php $i=0; foreach($partner_orders as $provider => $count): ?>
<?php $i=0; foreach($partner_orders as $partner => $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>
<td title="<?=$partner?>" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"><?=$this->strtrim($partner,22)?></td>
</tr>
<?php $i++; endforeach; ?>
</table>
</div>
<?php else: ?>
<i>Keine Aktiven Anschlüsse</i>
<i>Keine Bestellungen</i>
<?php endif; ?>
</div>
</div>
</div>
</div>
<div class="col-12 col-xl-6">
<div class="card">
<div class="card-body">
<h4 class="card-title">Bestellstatus je Partner</h4>
<hr />
<div class="row">
<?php if(count($partner_orders_by_status)): ?>
<?php $i=0; foreach($partner_orders_by_status as $partner => $status): ?>
<div class="col-lg-12">
<div class="card">
<div class="card-header no-decoration">
<span class="card-title" title="<?=$partner?>"><?=$this->strtrim($partner, 200)?></span>
</div>
<div class="card-body">
<div class="row">
<div class="col-12 col-xl-6">
<canvas id="partner-status-<?=$i?>"></canvas>
</div>
<div class="col-12 col-xl-6">
<table>
<?php $j=0; foreach($status as $status_id => $count): ?>
<?php if($status_id == "total") continue; ?>
<tr style="border-bottom: 1px solid <?=$chartColors[$j]?>;">
<td><span style="background-color: <?=$chartColors[$j]?>; color: <?=$chartColors[$j]?>">##</span></td>
<td class="pl-2 pr-2" style="white-space: nowrap;"><?=round(($count / $status['total']) * 100, 1)?>% (<?=($count)?>)</td>
<td title="<?=$stati[$status_id]["code"]?> - <?=$stati[$status_id]["name"]?>" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
<?=$stati[$status_id]["code"]." - ".$stati[$status_id]["name"]?>
</td>
</tr>
<?php $j++; endforeach; ?>
</table>
</div>
</div>
</div>
</div>
</div>
<?php if($i % 2 != 0): ?>
</div>
<div class="row">
<?php endif; ?>
<?php $i++; endforeach; ?>
<?php if($i % 2 == 0): ?>
</div>
<?php endif; ?>
<?php else: ?>
<i>Keine Bestellungen</i>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
@@ -301,6 +355,56 @@ $chartColors = [
<?php endif; ?>
var status = [];
<?php foreach(PreorderstatusModel::getAll() as $status):?>
status[<?=$status->id?>] = {"code": "<?=$status->code?>", "name": "<?=$status->name?>"};
<?php endforeach; ?>
var productCharts = [];
<?php $i=0; foreach($partner_orders_by_status as $partner => $status): ?>
productCharts[<?=$i?>] = new Chart(document.getElementById('partner-status-<?=$i?>').getContext('2d'), {
type: 'doughnut',
data: {
labels: [
<?php foreach($status as $status_id => $count): ?>
<?php if($status_id == "total") continue; ?>
<?=$stati[$status_id]->code?> - <?=$stati[$status_id]->name?> " (<?=round($count / $status["total"] * 100, 1)?>%)",
<?php endforeach; ?>
],
datasets: [{
data: [
<?php foreach($status as $status_id => $count): ?>
<?php if($status_id == "total") continue; ?>
<?=$count?>,
<?php endforeach; ?>
],
backgroundColor: [
"<?=implode('","', $chartColors)?>"
],
/*borderColor: [
"#d54369",
"#4592e0"
],*/
borderWidth: 1
}]
},
options: {
scales: {
y: {
beginAtZero: true
}
},
legend: false
}
});
<?php $i++; endforeach; ?>
});
</script>