update latitude and longitude for trips

This commit is contained in:
wayanrivan
2026-07-13 10:48:38 +07:00
parent a19e12ec7b
commit a0ce09cdda
4 changed files with 161 additions and 103 deletions

View File

@ -178,6 +178,10 @@ class ReportsController extends Controller
) )
SELECT SELECT
t.*, t.*,
ttll.start_latitude,
ttll.start_longitude,
ttll.finish_latitude,
ttll.finish_longitude,
tm.total_mileage, tm.total_mileage,
tm.total_trip, tm.total_trip,
vt.name AS type_name, vt.name AS type_name,
@ -189,6 +193,7 @@ class ReportsController extends Controller
JOIN TotalMileage tm ON t.id = tm.id JOIN TotalMileage tm ON t.id = tm.id
LEFT JOIN t_vehicles tvt ON tvt.id = t.vhc_id LEFT JOIN t_vehicles tvt ON tvt.id = t.vhc_id
LEFT JOIN t_vehicles_cats vt ON vt.id = tvt.cat_id LEFT JOIN t_vehicles_cats vt ON vt.id = tvt.cat_id
LEFT JOIN t_trips_latitude_longitude ttll ON t.id = ttll.tripsid
WHERE WHERE
t.start BETWEEN ? AND ? t.start BETWEEN ? AND ?
AND (? IS NULL OR t.id = ?) AND (? IS NULL OR t.id = ?)

View File

@ -472,9 +472,25 @@
render: (data, type, row, meta) => { render: (data, type, row, meta) => {
// saat export, hanya tampilkan lokasi tanpa tanggal/jam // saat export, hanya tampilkan lokasi tanpa tanggal/jam
if (type === 'export') { if (type === 'export') {
const nearestSite = findNearestSite(
row.start_latitude,
row.start_longitude
);
if (nearestSite) {
return formatSiteLabel(nearestSite);
}
return Helper.shortenText(decodeURIComponent(row.startLoc || return Helper.shortenText(decodeURIComponent(row.startLoc ||
'address'), 255) || "-"; 'address'), 255) || "-";
} }
const nearestSite = findNearestSite(
row.start_latitude,
row.start_longitude
);
if (nearestSite) {
return formatSiteLabel(nearestSite);
}
return ` return `
${moment.unix(data + AppState.TIMEFIX).format('DD MMM YYYY HH:mm:ss')}<br> ${moment.unix(data + AppState.TIMEFIX).format('DD MMM YYYY HH:mm:ss')}<br>
${Helper.shortenText(decodeURIComponent(row.startLoc || 'address'), 255) || "-"} ${Helper.shortenText(decodeURIComponent(row.startLoc || 'address'), 255) || "-"}
@ -507,14 +523,14 @@
// Saat export Excel // Saat export Excel
if (type === 'export') { if (type === 'export') {
// const nearestSite = findNearestSite( const nearestSite = findNearestSite(
// row.latitude, row.finish_latitude,
// row.longitude row.finish_longitude
// ); );
// if (nearestSite) { if (nearestSite) {
// return formatSiteLabel(nearestSite); return formatSiteLabel(nearestSite);
// } }
return Helper.shortenText( return Helper.shortenText(
decodeURIComponent(row.finishLoc || 'address'), decodeURIComponent(row.finishLoc || 'address'),
@ -522,6 +538,15 @@
) || '-'; ) || '-';
} }
const nearestSite = findNearestSite(
row.finish_latitude,
row.finish_longitude
);
if (nearestSite) {
return formatSiteLabel(nearestSite);
}
// Tampilan di tabel // Tampilan di tabel
return ` return `
${moment.unix(data + AppState.TIMEFIX) ${moment.unix(data + AppState.TIMEFIX)

View File

@ -75,6 +75,7 @@
auth()->user()->can('config_distribution_category.view') || auth()->user()->can('config_distribution_category.view') ||
auth()->user()->can('config_pool.view') || auth()->user()->can('config_pool.view') ||
auth()->user()->can('user_logs.view') auth()->user()->can('user_logs.view')
|| auth()->user()->can('config_vehicle_maintenance_type.view')
) )
<li class="nav-item dropdown {{ Request::segment(1) == 'config' ? 'active' : '' }}"> <li class="nav-item dropdown {{ Request::segment(1) == 'config' ? 'active' : '' }}">
<a class="nav-link dropdown-toggle" href="#" id="dropdownConfig" role="button" data-bs-toggle="dropdown" aria-expanded="false"> <a class="nav-link dropdown-toggle" href="#" id="dropdownConfig" role="button" data-bs-toggle="dropdown" aria-expanded="false">
@ -86,6 +87,11 @@
<a class="dropdown-item {{ Request::segment(2) == 'truck_types' ? 'active' : '' }}" href="{{ route('view_config_truck_types') }}" title="">Vehicle Type</a> <a class="dropdown-item {{ Request::segment(2) == 'truck_types' ? 'active' : '' }}" href="{{ route('view_config_truck_types') }}" title="">Vehicle Type</a>
</li> </li>
@endcan @endcan
@can('vehicle_maintenance_type.view')
<li>
<a class="dropdown-item {{ Request::segment(2) == 'maintenance_type' ? 'active' : '' }}" href="{{ route('view_vehicle_maintenance_type') }}" title="">Maintenance Type</a>
</li>
@endcan
@can('config_master_device.view') @can('config_master_device.view')
<li> <li>
<a class="dropdown-item {{ Request::segment(2) == 'devices' ? 'active' : '' }}" href="{{ route('view_config_devices') }}" title="">Master Devices</a> <a class="dropdown-item {{ Request::segment(2) == 'devices' ? 'active' : '' }}" href="{{ route('view_config_devices') }}" title="">Master Devices</a>

View File

@ -141,6 +141,10 @@ Route::middleware(["auth", "auth.user"])->group(function () {
->name("view_config_truck_types") ->name("view_config_truck_types")
->middleware("permission:config_truck_type.view"); ->middleware("permission:config_truck_type.view");
Route::get("/config/maintenance_type", "VehicleMaintenanceController@view_vehicle_maintenance_type")
->name("view_vehicle_maintenance_type")
->middleware("permission:vehicle_maintenance_type.view");
Route::get("/config/devices", "DevicesController@view_devices") Route::get("/config/devices", "DevicesController@view_devices")
->name("view_config_devices") ->name("view_config_devices")
->middleware("permission:config_master_device.view"); ->middleware("permission:config_master_device.view");
@ -611,6 +615,24 @@ Route::middleware(["auth", "auth.user"])->group(function () {
"api_conf_del_truck_type" "api_conf_del_truck_type"
); );
Route::get("/api/conf/maintenance_type/{id}", "VehicleMaintenanceController@api_show_maintenance_type")->name(
"api_show_maintenance_type"
);
Route::get("/api/conf/maintenance_type", "VehicleMaintenanceController@api_list_vehicle_maintenance_type")->name(
"api_list_vehicle_maintenance_type"
);
Route::post("/api/conf/maintenance_type", "VehicleMaintenanceController@api_add_vehicle_maintenance_type")->name(
"api_add_vehicle_maintenance_type"
);
Route::put("/api/conf/maintenance_type/{id}", "VehicleMaintenanceController@api_edit_vehicle_maintenance_type")->name(
"api_edit_vehicle_maintenance_type"
);
Route::delete("/api/conf/maintenance_type/{id}", "VehicleMaintenanceController@api_del_vehicle_maintenance_type")->name(
"api_del_vehicle_maintenance_type"
);
Route::get("/api/devices", "DevicesController@api_list_devices")->name("api_list_devices"); Route::get("/api/devices", "DevicesController@api_list_devices")->name("api_list_devices");
Route::get("/api/devices/{id}", "DevicesController@api_show_device")->name("api_show_device"); Route::get("/api/devices/{id}", "DevicesController@api_show_device")->name("api_show_device");
Route::post("/api/devices", "DevicesController@api_add_device")->name("api_add_device"); Route::post("/api/devices", "DevicesController@api_add_device")->name("api_add_device");