101 lines
3.1 KiB
PHP
101 lines
3.1 KiB
PHP
<?php
|
|
$projects = active_projects();
|
|
$projects[] = "General";
|
|
|
|
foreach($projects AS $project) {
|
|
$id = str_slug($project);
|
|
$appr = setting("$id-approximate-planned-wdi");
|
|
|
|
$totalNps = apply_welded_filter(db("weld_logs"))->where("no_of_the_joint_as_per_as_built_survey", "not like", "%R%");
|
|
|
|
$currentNps = apply_welded_filter(db("weld_logs"))->where("no_of_the_joint_as_per_as_built_survey", "not like", "%R%")->whereNotNull("welding_date");
|
|
|
|
|
|
|
|
$countNps = apply_welded_filter(db("weld_logs"))->where("no_of_the_joint_as_per_as_built_survey", "not like", "%R%");
|
|
|
|
$max = 80000;
|
|
if($project != "General") {
|
|
$totalNps = $totalNps->where("project", $project);
|
|
$currentNps = $currentNps->where("project", $project);
|
|
$countNps = $countNps->where("project", $project);
|
|
$max = 20000;
|
|
}
|
|
|
|
|
|
$currentNps = $currentNps->sum("nps_1");
|
|
$totalNps = $totalNps->sum("nps_1");
|
|
$countNps = $countNps->sum("nps_1");
|
|
|
|
|
|
try {
|
|
$npsPercent = round($currentNps * 100 / $totalNps, 2);
|
|
$apprPercent = round($appr * 100 / $totalNps, 2);
|
|
} catch (\Throwable $th) {
|
|
$apprPercent = 0;
|
|
$npsPercent = 0;
|
|
}
|
|
|
|
?>
|
|
<script>
|
|
$(() => {
|
|
$('#gauge{{$id}}').dxLinearGauge({
|
|
// geometry: { orientation: 'vertical' },
|
|
scale: {
|
|
majorTick: {
|
|
visible: true,
|
|
length: 10 // Specify the length of the major tick lines
|
|
},
|
|
|
|
line: {
|
|
visible: true,
|
|
width: 5 // Set the line thickness here
|
|
},
|
|
startValue: 0,
|
|
endValue: 100,
|
|
|
|
// customTicks: [0, {{$appr}}],
|
|
},
|
|
title: {
|
|
text: '{{strtoupper($project)}}',
|
|
font: { size: 28 },
|
|
},
|
|
export: {
|
|
enabled: true,
|
|
},
|
|
|
|
tooltip: {
|
|
enabled: true,
|
|
customizeTooltip: function (info) {
|
|
console.log(info);
|
|
// Customize the tooltip text based on your logic
|
|
var text = "";
|
|
if(info.type == 'subvalue-indicator') {
|
|
if(info.index == 0) {
|
|
text = "Real Total Value: %";
|
|
} else {
|
|
text = "Approximate Value: %";
|
|
}
|
|
}
|
|
info.valueText = text + info.valueText;
|
|
}
|
|
},
|
|
value: {{$npsPercent}},
|
|
subvalues: [{{$npsPercent}}, {{$apprPercent}}],
|
|
subvalueIndicator: {
|
|
|
|
type: 'triangleMarker',
|
|
color: 'red',
|
|
|
|
tooltip: {
|
|
enabled: true,
|
|
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
</script>
|
|
<div id="gauge{{$id}}"></div>
|
|
<?php } ?>
|