|
Server : LiteSpeed System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64 User : elvh3918 ( 1528) PHP Version : 8.2.31 Disable Function : mail Directory : /home/elvh3918/public_html/pmm/storage/framework/views/ |
<?php $__env->startSection('content-guest-page-1-graph'); ?>
<div class="card" style="height: 350px; overflow-y: auto;" id="graph_id" hidden>
<div class="card-header border-0">
<div class="d-flex justify-content-between">
<h3 class="card-title">Visit Over Time</h3>
<a href="javascript:void(0);" onclick='report_mtc()'>View Report</a>
</div>
</div>
<div class="card-body">
<div class="d-flex">
<p class="d-flex flex-column">
<span class="text-bold text-lg"><span id="lbl_graph_mtc_visit_this_month">0</span> Visiting</span>
<span>Visit This Month</span>
</p>
<p class="ml-auto d-flex flex-column text-right">
<span id="lbl_text_mtc_visit_last_month" class="text-success"><i id="lbl_icon_mtc_visit_last_month" class="fas fa-arrow-up mr-1"></i><span id="lbl_percent_mtc_visit_last_month">0%</span></span>
<span class="text-muted">Since last month</span>
</p>
</div>
<!-- /.d-flex -->
<div class="position-relative" id="mtc_chart_container">
<div class="flex animate-pulse space-x-4">
<div class="size-10 rounded-full bg-gray-200"></div>
<div class="flex-1 space-y-6 py-1">
<div class="h-2 rounded bg-gray-200"></div>
<div class="space-y-3">
<div class="grid grid-cols-3 gap-4">
<div class="col-span-2 h-2 rounded bg-gray-200"></div>
<div class="col-span-1 h-2 rounded bg-gray-200"></div>
</div>
<div class="h-2 rounded bg-gray-200"></div>
<div class="h-2 rounded bg-gray-200"></div>
<div class="h-2 rounded bg-gray-200"></div>
<div class="h-2 rounded bg-gray-200"></div>
<div class="h-2 rounded bg-gray-200"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page-script-guest-page-1-graph'); ?>
<script>
function showVisitMonthly(customer_id) {
$.ajax({
dataType: 'json',
type: "GET",
url: '<?php echo e(env('APP_URL')); ?>' + "/api/dashboard/show-visit-monthly-by-customer/" + customer_id,
success: function(res) {
if (res.length == 0) {
document.getElementById('lbl_graph_mtc_visit_this_month').innerHTML = 'No Data';
document.getElementById('lbl_percent_mtc_visit_last_month').innerHTML = 'No Data';
document.getElementById('mtc_chart_container').innerHTML = 'No Data';
return;
} else {
document.getElementById('lbl_graph_mtc_visit_this_month').innerHTML = document.getElementById('box-month').innerHTML;
document.getElementById('mtc_chart_container').innerHTML = '<canvas id="mtc-chart"></canvas>';
setShowVisitMonthly(res);
}
},
error: function(xhr, status, error) {
document.getElementById('lbl_graph_mtc_visit_this_month').innerHTML = error;
document.getElementById('lbl_percent_mtc_visit_last_month').innerHTML = error;
document.getElementById('mtc_chart_container').innerHTML = error;
return;
}
});
}
function setShowVisitMonthly(data) {
const month = [];
const value = [];
for (let index = 0; index < data.length; index++) {
month.push(data[index]['month']);
value.push(data[index]['visit']);
}
var value_now = value[value.length - 1];
var value_past = value[value.length - 1];
if (data.length > 1) {
value_past = value[value.length - 2];
}
var diff = parseFloat(value_now) - parseFloat(value_past);
document.getElementById("lbl_percent_mtc_visit_last_month").removeAttribute("class");
document.getElementById("lbl_text_mtc_visit_last_month").removeAttribute("class");
document.getElementById("lbl_icon_mtc_visit_last_month").removeAttribute("class");
if (diff < 0) {
document.getElementById("lbl_percent_mtc_visit_last_month").setAttribute("class", "text-danger");
document.getElementById("lbl_text_mtc_visit_last_month").setAttribute("class", "text-danger");
document.getElementById("lbl_icon_mtc_visit_last_month").setAttribute("class", "fas fa-arrow-down mr-1");
} else if (diff == 0) {
document.getElementById("lbl_percent_mtc_visit_last_month").setAttribute("class", "text-purple");
document.getElementById("lbl_text_mtc_visit_last_month").setAttribute("class", "text-purple");
document.getElementById("lbl_icon_mtc_visit_last_month").setAttribute("class", "fas fa-smile mr-1");
} else {
document.getElementById("lbl_percent_mtc_visit_last_month").setAttribute("class", "text-success");
document.getElementById("lbl_text_mtc_visit_last_month").setAttribute("class", "text-success");
document.getElementById("lbl_icon_mtc_visit_last_month").setAttribute("class", "fas fa-arrow-up mr-1");
}
if (diff != 0) {
diff = parseFloat(diff) / parseFloat(value_now) * 100;
} else {
diff = 0;
}
document.getElementById('lbl_percent_mtc_visit_last_month').innerHTML = formatDecimal(diff, 1) + "%";
var ticksStyle = {
fontColor: '#495057',
fontStyle: 'bold'
}
var mode = 'index'
var intersect = true
var $mtcChart = $('#mtc-chart')
var mtcChart = new Chart($mtcChart, {
type: 'bar',
data: {
labels: month,
datasets: [
{
backgroundColor: '#007bff',
borderColor: '#007bff',
data: value
}
]
},
options: {
maintainAspectRatio: false,
tooltips: {
mode: mode,
intersect: intersect
},
hover: {
mode: mode,
intersect: intersect
},
legend: {
display: false
},
scales: {
yAxes: [{
// display: false,
gridLines: {
display: true,
lineWidth: '4px',
color: 'rgba(0, 0, 0, .2)',
zeroLineColor: 'transparent'
},
ticks: $.extend({
beginAtZero: true,
}, ticksStyle)
}],
xAxes: [{
display: true,
gridLines: {
display: false
},
ticks: ticksStyle
}]
}
}
})
}
function report_mtc() {
var now = new Date(<?php echo json_encode(\Carbon\Carbon::now()); ?>);
var date_from = new Date(new Date(now).setMonth(now.getMonth() - 11));
date_from = new Date(date_from.getFullYear(), date_from.getMonth(), 1);
date_from = moment(date_from).format('YYYY-MM-DD');
var date_to = moment(now).format('YYYY-MM-DD');
var url = "<?php echo e(route('report.maintenance', [':date_from', ':date_to'])); ?>";
url = url.replace(':date_from', date_from);
url = url.replace(':date_to', date_to);
location.href = url;
}
</script>
<?php $__env->stopSection(); ?><?php /**PATH /home/elvh3918/public_html/pmm/resources/views/content/guest/partials/page-1/graph.blade.php ENDPATH**/ ?>