feat: resolve audit items (multi-simper hse dashboard & export, soft-delete conflict handling, p2h blank initial state, qma breakdown recovery, and exclude lv from transporter)

This commit is contained in:
Ray1111-aa
2026-11-01 23:18:17 +07:00
parent aec6c36344
commit e2054dcb8a
8 changed files with 204 additions and 63 deletions
@@ -735,8 +735,11 @@ class P2hInspectionController extends Controller
]);
// Jika unit dinyatakan aman dan sebelumnya breakdown karena review, status unit disetujui operasi
if (!$record->hasDefects() && $record->vehicle->status === 'Breakdown') {
$record->vehicle->update(['status' => 'Operation']);
if (!$record->hasDefects() && $record->vehicle && $record->vehicle->status === 'Breakdown') {
$record->vehicle->update([
'status' => 'Operation',
'location_note' => "Status dipulihkan ke Operation pasca persetujuan P2H {$record->transaction_no}",
]);
}
return back()->with('success', "Inspeksi P2H [{$record->transaction_no}] untuk unit {$record->vehicle->code} berhasil DISETUJUI.");
@@ -144,8 +144,14 @@ class SupportTimesheetController extends Controller
$activeUnitsCount = $statsItems->pluck('vehicle_id')->unique()->count();
$breakdownCount = $statsItems->where('status', 'Breakdown')->count();
// Data Master untuk Form & Filter
// Data Master untuk Form & Filter (Alat Berat / Heavy Equipment - Bebas dari Unit LV)
$unitSupports = Vehicle::unitSupports()
->where('category', '!=', 'light_vehicle')
->where(function (Builder $q) {
$q->where('code', 'not like', 'LV %')
->where('code', 'not like', 'LV-%')
->where('code', 'not like', 'LV_%');
})
->where(function (Builder $q) {
$q->whereNotNull('parent_id')
->orWhereDoesntHave('units');
@@ -425,7 +431,12 @@ class SupportTimesheetController extends Controller
]);
});
return back()->with('success', "Timesheet {$timesheetNo} untuk unit {$vehicle->code} berhasil disimpan.");
$successMsg = "Timesheet {$timesheetNo} untuk unit {$vehicle->code} berhasil disimpan.";
if ($operatingHours !== null && $operatingHours > 24) {
$successMsg .= " (Catatan: Total waktu operasi tercatat {$operatingHours} HM/Jam [> 24 jam]. Harap periksa apakah angka Start HM atau End HM sudah sesuai).";
}
return back()->with('success', $successMsg);
}
/**
@@ -527,7 +538,12 @@ class SupportTimesheetController extends Controller
'notes' => $validated['notes'] ?? null,
]);
return back()->with('success', "Timesheet {$timesheet->timesheet_no} berhasil diperbarui.");
$successMsg = "Timesheet {$timesheet->timesheet_no} berhasil diperbarui.";
if ($operatingHours !== null && $operatingHours > 24) {
$successMsg .= " (Catatan: Total waktu operasi tercatat {$operatingHours} HM/Jam [> 24 jam]. Harap periksa apakah angka Start HM atau End HM sudah sesuai).";
}
return back()->with('success', $successMsg);
}
/**
@@ -143,9 +143,18 @@ class UnitTransferController extends Controller
->map(fn($group) => $group->count())
->sortKeys();
// 2. Daftar unit kendaraan kita untuk armada pengangkut (Truk, Flatbed, Lowbed, Towing, LV, dsb.)
$transporterUnits = Vehicle::trackableUnits()
->orderBy('category')
// 2. Daftar armada pengangkut khusus truk/alat angkut (Truk, Flatbed, Lowbed, Towing, dsb. - Eksklusif Non-LV)
$transporterUnits = Vehicle::where('category', '!=', 'light_vehicle')
->where(function (Builder $q) {
$q->where('code', 'not like', 'LV %')
->where('code', 'not like', 'LV-%')
->where('code', 'not like', 'LV/%')
->where('code', 'not like', 'LV_%');
})
->where(function (Builder $q) {
$q->whereNotNull('parent_id')
->orWhereDoesntHave('units');
})
->orderBy('code')
->get();