report, timezone
This commit is contained in:
@ -9,6 +9,12 @@
|
||||
@endsection
|
||||
|
||||
@section('customcss')
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
|
||||
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
|
||||
crossorigin=""
|
||||
/>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
@ -43,8 +49,8 @@
|
||||
<div class="form-group">
|
||||
<label class="text-muted">From</label>
|
||||
<!-- default today -->
|
||||
<!-- <input class="form-control" id="tgl0" value="25-08-2025 00:00"> -->
|
||||
<input class="form-control" id="tgl0" value="{{ date('d-m-Y 00:00') }}">
|
||||
<input class="form-control" id="tgl0" value="25-08-2025 00:00">
|
||||
<!-- <input class="form-control" id="tgl0" value="{{ date('d-m-Y 00:00') }}"> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
@ -76,14 +82,20 @@
|
||||
<table id="tVehicleTrips" class="table table-hover dataTable w-100">
|
||||
<thead>
|
||||
<tr class="">
|
||||
<th class="">Vehicle ID</th>
|
||||
<th class="hidden">Vehicle ID</th>
|
||||
<th class="">License Plate Number</th>
|
||||
<th class="">Dist. Cat.</th>
|
||||
<th class="">Pool</th>
|
||||
<th class="">Number of Trip</th>
|
||||
<th class="">Total Mileage (km)</th>
|
||||
<th class="">Trip #</th>
|
||||
<th class="">Start</th>
|
||||
<th class="">Finish</th>
|
||||
<th class="">Duration</th>
|
||||
<th class="">Start (km)</th>
|
||||
<th class="">Finish (km)</th>
|
||||
<th class="">Mileage (km)</th>
|
||||
<th class="">Detail</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<!-- <tbody>
|
||||
@ -162,6 +174,20 @@
|
||||
</div>
|
||||
|
||||
<!-- modal -->
|
||||
<div class="modal fade" data-bs-backdrop="static" data-bs-keyboard="false" id="mdlDetailTrip" aria-labelledby="mdlDetailTripLabel" aria-hidden="true">
|
||||
<!-- <div class="modal-dialog modal-dialog modal-dialog-centered modal-dialog-scrollable modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="mdlDetailTripLabel">-----</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('customjs')
|
||||
@ -170,6 +196,14 @@
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.2/js/dataTables.buttons.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/2.4.2/js/buttons.html5.min.js"></script>
|
||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js" integrity="sha512-ozq8xQKq6urvuU6jNgkfqAmT7jKN2XumbrX1JiB3TnF7tI48DPI4Gy1GXKD/V3EExgAs1V+pRO7vwtS1LHg0Gw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> -->
|
||||
<!-- <script src="https://unpkg.com/leaflet-routing-machine@3.2.12/dist/leaflet-routing-machine.js"></script> -->
|
||||
<script
|
||||
src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
|
||||
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
|
||||
crossorigin=""
|
||||
></script>
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
const State = {
|
||||
@ -185,6 +219,7 @@
|
||||
activate: function() {
|
||||
Wrapper.init();
|
||||
Wrapper.event();
|
||||
// DTable.table = $('#tVehicleTrips').DataTable()
|
||||
// DTable.activate();
|
||||
},
|
||||
init: ()=>{
|
||||
@ -204,6 +239,20 @@
|
||||
$('#btnDownloadReport').on('click', function() {
|
||||
DTable.table.button('.buttons-excel').trigger();
|
||||
});
|
||||
|
||||
// detail trip
|
||||
$('#tVehicleTrips').on('click', '.btnDetailTrip', function(e) {
|
||||
e.preventDefault();
|
||||
const vid = $(this).data('vid');
|
||||
const tgl0 = $(this).data('tgl0');
|
||||
const tgl1 = $(this).data('tgl1');
|
||||
|
||||
// $("#mdlDetailTrip").load("{{ route('view_report_trip_detail') }}");
|
||||
$('#mdlDetailTrip').empty().load("{{ route('view_report_trip_detail') }}", `vid=${vid}&tgl0=${tgl0}&tgl1=${tgl1}`, () => {
|
||||
$('#mdlDetailTrip').modal('show')
|
||||
})
|
||||
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
@ -269,7 +318,9 @@
|
||||
orderable: true,
|
||||
searchable: true,
|
||||
},
|
||||
{ data: "total_trip", className: 'text-end'},
|
||||
{ data: "dc_code", className: 'text-start'},
|
||||
{ data: "pool_code", className: 'text-start'},
|
||||
{ data: "total_trip", className: 'text-end'},
|
||||
{ data: "total_mileage", className: 'text-end', render: (data, type, row, meta) => parseFloat(data).toFixed(2)},
|
||||
{ data: "trip_id", className: 'text-end'},
|
||||
{
|
||||
@ -292,12 +343,51 @@
|
||||
`;
|
||||
}
|
||||
},
|
||||
{
|
||||
className: 'text-start', render: function(data, type, row, meta) {
|
||||
const start = moment.unix(row.start);
|
||||
const finish = moment.unix(row.finish);
|
||||
|
||||
// calculate duration
|
||||
const diff = moment.duration(finish.diff(start));
|
||||
const hours = Math.floor(diff.asHours());
|
||||
const minutes = diff.minutes();
|
||||
|
||||
return `${hours}h ${minutes}m`;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'startMileage',
|
||||
className: 'text-end', render: function(data, type, row, meta) {
|
||||
console.log(data);
|
||||
|
||||
return (data === null) ? '0' : parseFloat(data).toFixed(0);
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'finishMileage',
|
||||
className: 'text-end', render: function(data, type, row, meta) {
|
||||
return (data === null) ? '0' : parseFloat(data).toFixed(0);
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'mileage',
|
||||
className: 'text-end', render: function(data, type, row, meta) {
|
||||
return (data === null) ? '0' : parseFloat(data).toFixed(2);
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'id',
|
||||
className: 'text-center',
|
||||
render: function(data, type, row, meta) {
|
||||
let action = `
|
||||
<a href="#" class="text-decoration-none me-1 btnDetailTrip" data-vid="${data}" data-tgl0="${row.start}" data-tgl1="${row.finish}">
|
||||
<span class="icon ion-eye fz-16"></span>
|
||||
</a>
|
||||
`;
|
||||
return action;
|
||||
}
|
||||
},
|
||||
],
|
||||
paging: false,
|
||||
drawCallback: function (settings) {
|
||||
@ -321,6 +411,9 @@
|
||||
$(rows).eq(i).find('td:eq(0)').attr('rowspan', rowspanCount);
|
||||
$(rows).eq(i).find('td:eq(1)').attr('rowspan', rowspanCount);
|
||||
$(rows).eq(i).find('td:eq(2)').attr('rowspan', rowspanCount);
|
||||
$(rows).eq(i).find('td:eq(3)').attr('rowspan', rowspanCount);
|
||||
$(rows).eq(i).find('td:eq(4)').attr('rowspan', rowspanCount);
|
||||
|
||||
// $(rows).eq(i).find('td:eq(3)').attr('rowspan', rowspanCount);
|
||||
|
||||
last = group;
|
||||
@ -329,6 +422,8 @@
|
||||
$(rows).eq(i).find('td:eq(0)').remove();
|
||||
$(rows).eq(i).find('td:eq(0)').remove();
|
||||
$(rows).eq(i).find('td:eq(0)').remove();
|
||||
$(rows).eq(i).find('td:eq(0)').remove();
|
||||
$(rows).eq(i).find('td:eq(0)').remove();
|
||||
// $(rows).eq(i).find('td:eq(0)').remove();
|
||||
}
|
||||
});
|
||||
@ -345,7 +440,7 @@
|
||||
},
|
||||
className: 'd-none', // hide default button
|
||||
exportOptions: {
|
||||
columns: ':visible' // 🔹 exclude first column
|
||||
columns: ':visible:not(:last-child)' //
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -358,16 +453,6 @@
|
||||
return (val === undefined || val === null || val === '') ? null : val;
|
||||
}
|
||||
|
||||
const Filter = {
|
||||
activate: function() {
|
||||
Filter.event();
|
||||
},
|
||||
event: function() {},
|
||||
triggerFilterCompany: function() {
|
||||
DTable.reload();
|
||||
},
|
||||
}
|
||||
|
||||
async function convertImgHtmlToFile(imgHtml, imgWidth, imgHeight, mimeType, fileName) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user