Files
citrus-cms/resources/views/admin/dashboard/chart/punch-status.blade.php
T
2026-04-28 21:15:09 +03:00

56 lines
1.4 KiB
PHP

<?php $punchLists = db("punch_lists")
->select("status")
->selectRaw("count(*) val")
->groupBy("status")
->get();
?>
<div id="punchStatusChart"></div>
<script>
$(() => {
const punchStatusData = <?php echo json_encode_tr($punchLists) ?>;
$('#punchStatusChart').dxPieChart({
type: 'doughnut',
// palette: 'Bright',
dataSource: punchStatusData,
title: '{{e2("Punch Status Percents")}}',
tooltip: {
enabled: true,
format: 'millions',
customizeTooltip(arg) {
return {
text: `${arg.valueText} - ${(arg.percent * 100).toFixed(2)}%`,
};
},
},
legend: {
horizontalAlignment: 'center',
verticalAlignment: 'top',
margin: 0,
visible: true
},
export: {
enabled: true,
},
series: [{
argumentField: 'status',
label: {
visible: true,
//format: 'percent',
connector: {
visible: true,
},
customizeText: function (arg) {
return arg.percentText;
}
},
}],
});
});
</script>