refactor: rename Unit Support to Heavy Equipment across views, controllers, reports, and tests
This commit is contained in:
@@ -66,7 +66,7 @@ class ImportAssetsFromExcelCommand extends Command
|
||||
];
|
||||
|
||||
/**
|
||||
* Pemetaan kode singkat kategori untuk master Unit Support.
|
||||
* Pemetaan kode singkat kategori untuk master Heavy Equipment.
|
||||
*/
|
||||
protected array $categoryCodePrefixes = [
|
||||
'ASPHALT PATCH MIXER' => 'CAT-APM',
|
||||
@@ -184,7 +184,7 @@ class ImportAssetsFromExcelCommand extends Command
|
||||
);
|
||||
|
||||
// 6. Proses Sheet Heavy Equipment
|
||||
$this->line("\n--- Memproses Data Heavy Equipment / Unit Support ---");
|
||||
$this->line("\n--- Memproses Data Heavy Equipment ---");
|
||||
$heStats = $this->importHeavyEquipment(
|
||||
$zip,
|
||||
$sheetFiles['he'],
|
||||
@@ -594,7 +594,7 @@ class ImportAssetsFromExcelCommand extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* Import seluruh data Heavy Equipment (Unit Support) dari Sheet 4.
|
||||
* Import seluruh data Heavy Equipment dari Sheet 4.
|
||||
*/
|
||||
protected function importHeavyEquipment(
|
||||
ZipArchive $zip,
|
||||
@@ -637,7 +637,7 @@ class ImportAssetsFromExcelCommand extends Command
|
||||
|
||||
$this->line("Memproses " . count($distinctTypes) . " kategori master alat berat...");
|
||||
|
||||
// 2. Siapkan atau update Master Kategori Unit Support
|
||||
// 2. Siapkan atau update Master Kategori Heavy Equipment
|
||||
$categoryMap = [];
|
||||
foreach (array_keys($distinctTypes) as $type) {
|
||||
$tmpl = $this->resolveMatchingTemplate($type, $templates);
|
||||
|
||||
@@ -19,7 +19,7 @@ use Illuminate\View\View;
|
||||
class P2hFormController extends Controller
|
||||
{
|
||||
/**
|
||||
* Halaman katalog/pemilihan unit support untuk pengisian P2H.
|
||||
* Halaman katalog/pemilihan Heavy Equipment untuk pengisian P2H.
|
||||
*/
|
||||
public function index(Request $request): View
|
||||
{
|
||||
@@ -54,7 +54,7 @@ class P2hFormController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Tampilkan formulir pengisian P2H untuk unit support tertentu.
|
||||
* Tampilkan formulir pengisian P2H untuk Heavy Equipment tertentu.
|
||||
*/
|
||||
public function show(Request $request, string $code): View|RedirectResponse
|
||||
{
|
||||
|
||||
@@ -495,7 +495,7 @@ class ActivityLogController extends Controller
|
||||
|
||||
$typeText = 'Semua Armada';
|
||||
if ($type === 'lv' || $type === 'light_vehicle') $typeText = 'Light Vehicle';
|
||||
elseif ($type === 'support' || $type === 'unit_support') $typeText = 'Unit Support';
|
||||
elseif ($type === 'support' || $type === 'unit_support') $typeText = 'Heavy Equipment';
|
||||
|
||||
$totalKmAll = $vehicleSummaries->sum('total_km');
|
||||
$totalTripsAll = $vehicleSummaries->sum('total_trips');
|
||||
@@ -531,7 +531,7 @@ class ActivityLogController extends Controller
|
||||
$veh?->code ?: '-',
|
||||
$veh?->brand_type ?: '-',
|
||||
$veh?->license_plate ?: '-',
|
||||
$veh?->isLightVehicle() ? 'Light Vehicle' : 'Unit Support',
|
||||
$veh?->isLightVehicle() ? 'Light Vehicle' : 'Heavy Equipment',
|
||||
$veh?->ownership ?: '-',
|
||||
$veh?->division ?: ($veh?->department ?: '-'),
|
||||
(int) $vs->in_trips,
|
||||
@@ -620,7 +620,7 @@ class ActivityLogController extends Controller
|
||||
|
||||
$typeText = 'Semua Armada';
|
||||
if ($type === 'lv' || $type === 'light_vehicle') $typeText = 'Light Vehicle';
|
||||
elseif ($type === 'support' || $type === 'unit_support') $typeText = 'Unit Support';
|
||||
elseif ($type === 'support' || $type === 'unit_support') $typeText = 'Heavy Equipment';
|
||||
|
||||
$totalKmAll = $vehicleSummaries->sum('total_km');
|
||||
$totalTripsAll = $vehicleSummaries->sum('total_trips');
|
||||
@@ -660,7 +660,7 @@ class ActivityLogController extends Controller
|
||||
$veh?->code ?: '-',
|
||||
$veh?->brand_type ?: '-',
|
||||
$veh?->license_plate ?: '-',
|
||||
$veh?->isLightVehicle() ? 'Light Vehicle' : 'Unit Support',
|
||||
$veh?->isLightVehicle() ? 'Light Vehicle' : 'Heavy Equipment',
|
||||
$veh?->ownership ?: '-',
|
||||
(int) $vs->in_trips,
|
||||
(int) $vs->out_trips,
|
||||
|
||||
@@ -19,7 +19,7 @@ use Illuminate\View\View;
|
||||
class P2hInspectionController extends Controller
|
||||
{
|
||||
/**
|
||||
* Helper query builder untuk riwayat pemeriksaan P2H Unit Support dengan filter aktif.
|
||||
* Helper query builder untuk riwayat pemeriksaan P2H Heavy Equipment dengan filter aktif.
|
||||
*/
|
||||
private function getFilteredP2hQuery(Request $request): Builder
|
||||
{
|
||||
@@ -54,7 +54,7 @@ class P2hInspectionController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Tampilkan riwayat dan log pemeriksaan P2H Unit Support untuk Admin QMA.
|
||||
* Tampilkan riwayat dan log pemeriksaan P2H Heavy Equipment untuk Admin QMA.
|
||||
*/
|
||||
public function index(Request $request): View
|
||||
{
|
||||
@@ -78,7 +78,7 @@ class P2hInspectionController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Ekspor Riwayat Pemeriksaan P2H Unit Support ke format Excel (.xlsx).
|
||||
* Ekspor Riwayat Pemeriksaan P2H Heavy Equipment ke format Excel (.xlsx).
|
||||
*/
|
||||
public function exportExcel(Request $request): Response
|
||||
{
|
||||
@@ -149,8 +149,8 @@ class P2hInspectionController extends Controller
|
||||
}
|
||||
|
||||
$alignments = ['center', 'center', 'center', 'center', 'left', 'left', 'center', 'center', 'right', 'center', 'center', 'center', 'left', 'left'];
|
||||
$title = 'LAPORAN PEMERIKSAAN HARIAN (P2H) ALAT BERAT & UNIT SUPPORT - PT KERINCI MERANGIN HIDRO';
|
||||
$fileName = 'Laporan_P2H_Unit_Support_' . now()->format('Ymd_Hi') . '.xlsx';
|
||||
$title = 'LAPORAN PEMERIKSAAN HARIAN (P2H) HEAVY EQUIPMENT - PT KERINCI MERANGIN HIDRO';
|
||||
$fileName = 'Laporan_P2H_Heavy_Equipment_' . now()->format('Ymd_Hi') . '.xlsx';
|
||||
|
||||
$binary = SimpleXlsxExporter::create($title, $metaLines, $headers, $rows, $alignments);
|
||||
|
||||
@@ -164,7 +164,7 @@ class P2hInspectionController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Ekspor Riwayat Pemeriksaan P2H Unit Support ke format PDF (Pratinjau Asli dengan Logo PT KMH).
|
||||
* Ekspor Riwayat Pemeriksaan P2H Heavy Equipment ke format PDF (Pratinjau Asli dengan Logo PT KMH).
|
||||
*/
|
||||
public function exportPdf(Request $request): Response
|
||||
{
|
||||
@@ -239,19 +239,19 @@ class P2hInspectionController extends Controller
|
||||
];
|
||||
}
|
||||
|
||||
$title = 'Laporan Pemeriksaan Harian (P2H) Unit Support';
|
||||
$subtitle = 'Rekapitulasi Kelaikan Alat Berat & Unit Pendukung Lapangan - PT KMH';
|
||||
$title = 'Laporan Pemeriksaan Harian (P2H) Heavy Equipment';
|
||||
$subtitle = 'Rekapitulasi Kelaikan Alat Berat & Heavy Equipment Lapangan - PT KMH';
|
||||
$pdfBinary = QmaTablePdfExporter::generate(
|
||||
$title,
|
||||
$subtitle,
|
||||
'P2H UNIT SUPPORT RKM-KMH',
|
||||
'P2H HEAVY EQUIPMENT RKM-KMH',
|
||||
$metaLeft,
|
||||
$metaRight,
|
||||
$columns,
|
||||
$rows
|
||||
);
|
||||
|
||||
$fileName = 'Laporan_P2H_Unit_Support_' . now()->format('Ymd_Hi') . '.pdf';
|
||||
$fileName = 'Laporan_P2H_Heavy_Equipment_' . now()->format('Ymd_Hi') . '.pdf';
|
||||
|
||||
return response($pdfBinary, 200, [
|
||||
'Content-Type' => 'application/pdf',
|
||||
@@ -263,7 +263,7 @@ class P2hInspectionController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Tampilkan Summary Pemeriksaan P2H Unit Support (Analitik, Rekapitulasi Alat Berat & Status).
|
||||
* Tampilkan Summary Pemeriksaan P2H Heavy Equipment (Analitik, Rekapitulasi Alat Berat & Status).
|
||||
*/
|
||||
public function summary(Request $request): View
|
||||
{
|
||||
@@ -318,7 +318,7 @@ class P2hInspectionController extends Controller
|
||||
$totalNormal = $records->where('summary_condition', 'good')->count();
|
||||
$totalHm = $records->sum('start_hm');
|
||||
|
||||
// Rekapitulasi per Unit Support
|
||||
// Rekapitulasi per Heavy Equipment
|
||||
$unitSummary = $records->groupBy('vehicle_id')->map(function ($group) {
|
||||
$vehicle = $group->first()->vehicle;
|
||||
return [
|
||||
@@ -334,7 +334,7 @@ class P2hInspectionController extends Controller
|
||||
];
|
||||
})->sortByDesc('total');
|
||||
|
||||
// Daftar Unit Support untuk opsi filter
|
||||
// Daftar Heavy Equipment untuk opsi filter
|
||||
$supportVehicles = Vehicle::where('category', 'unit_support')->orderBy('code')->get();
|
||||
|
||||
return view('qma.p2h_summary', compact(
|
||||
@@ -354,7 +354,7 @@ class P2hInspectionController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper untuk memproses data rekapitulasi summary P2H per unit support.
|
||||
* Helper untuk memproses data rekapitulasi summary P2H per Heavy Equipment.
|
||||
*/
|
||||
private function getP2hSummaryData(Request $request): array
|
||||
{
|
||||
@@ -424,7 +424,7 @@ class P2hInspectionController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Ekspor Rekapitulasi Summary P2H Unit Support ke format Excel (.xlsx).
|
||||
* Ekspor Rekapitulasi Summary P2H Heavy Equipment ke format Excel (.xlsx).
|
||||
*/
|
||||
public function exportSummaryExcel(Request $request): Response
|
||||
{
|
||||
@@ -489,8 +489,8 @@ class P2hInspectionController extends Controller
|
||||
}
|
||||
|
||||
$alignments = ['center', 'center', 'left', 'left', 'center', 'center', 'center', 'center', 'center', 'right', 'center'];
|
||||
$title = 'LAPORAN REKAPITULASI SUMMARY P2H UNIT SUPPORT - PT KERINCI MERANGIN HIDRO';
|
||||
$fileName = 'Laporan_Summary_P2H_Unit_Support_' . now()->format('Ymd_Hi') . '.xlsx';
|
||||
$title = 'LAPORAN REKAPITULASI SUMMARY P2H HEAVY EQUIPMENT - PT KERINCI MERANGIN HIDRO';
|
||||
$fileName = 'Laporan_Summary_P2H_Heavy_Equipment_' . now()->format('Ymd_Hi') . '.xlsx';
|
||||
|
||||
$binary = SimpleXlsxExporter::create($title, $metaLines, $headers, $rows, $alignments);
|
||||
|
||||
@@ -504,7 +504,7 @@ class P2hInspectionController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Ekspor Rekapitulasi Summary P2H Unit Support ke format PDF (Pratinjau Asli dengan Logo PT KMH).
|
||||
* Ekspor Rekapitulasi Summary P2H Heavy Equipment ke format PDF (Pratinjau Asli dengan Logo PT KMH).
|
||||
*/
|
||||
public function exportSummaryPdf(Request $request): Response
|
||||
{
|
||||
@@ -533,7 +533,7 @@ class P2hInspectionController extends Controller
|
||||
];
|
||||
|
||||
$metaRight = [
|
||||
'Unit Support Aktif' => $unitSummary->count() . ' Unit Alat Berat',
|
||||
'Heavy Equipment Aktif' => $unitSummary->count() . ' Unit Alat Berat',
|
||||
'Total Pemeriksaan' => $records->count() . ' Form P2H Terkumpul',
|
||||
'Rincian Status' => "{$totalApproved} Disetujui, {$totalPending} Menunggu, {$totalRejected} Ditolak",
|
||||
];
|
||||
@@ -573,7 +573,7 @@ class P2hInspectionController extends Controller
|
||||
];
|
||||
}
|
||||
|
||||
$title = 'Laporan Summary Rekapitulasi P2H Unit Support';
|
||||
$title = 'Laporan Summary Rekapitulasi P2H Heavy Equipment';
|
||||
$subtitle = 'Kepatuhan & Kelayakan Operasional Alat Berat Lapangan - Periode: ' . $dateRangeStr;
|
||||
$pdfBinary = QmaTablePdfExporter::generate(
|
||||
$title,
|
||||
@@ -585,7 +585,7 @@ class P2hInspectionController extends Controller
|
||||
$rows
|
||||
);
|
||||
|
||||
$fileName = 'Laporan_Summary_P2H_Unit_Support_' . now()->format('Ymd_Hi') . '.pdf';
|
||||
$fileName = 'Laporan_Summary_P2H_Heavy_Equipment_' . now()->format('Ymd_Hi') . '.pdf';
|
||||
|
||||
return response($pdfBinary, 200, [
|
||||
'Content-Type' => 'application/pdf',
|
||||
@@ -651,7 +651,7 @@ class P2hInspectionController extends Controller
|
||||
|
||||
$metaLines = [
|
||||
'No. Transaksi: ' . $record->transaction_no . ' | Waktu Pemeriksaan: ' . ($record->inspected_at ? $record->inspected_at->format('d/m/Y H:i') : '-') . ' WIB | Shift: ' . $record->shift,
|
||||
'Unit Support: ' . ($record->vehicle->code ?? '-') . ' (' . ($record->vehicle->brand_type ?? '-') . ') | Kategori: ' . ($record->vehicle->unit_category ?? ($record->template->name ?? '-')) . ' | Lokasi: ' . ($record->vehicle->location ?? '-'),
|
||||
'Heavy Equipment: ' . ($record->vehicle->code ?? '-') . ' (' . ($record->vehicle->brand_type ?? '-') . ') | Kategori: ' . ($record->vehicle->unit_category ?? ($record->template->name ?? '-')) . ' | Lokasi: ' . ($record->vehicle->location ?? '-'),
|
||||
'Operator: ' . ($record->employee->name ?? '-') . ' (NIK: ' . ($record->employee->nik ?? '-') . ') | SIMPER: ' . ($record->employee?->simper_expired_at ? $record->employee->simper_expired_at->format('d/m/Y') : 'Non-SIMPER'),
|
||||
'Hour Meter (HM): ' . number_format($record->start_hm, 1, ',', '.') . ' HM | Kondisi Fisik: ' . $conditionLabel . ' | Status QMA: ' . $statusLabel,
|
||||
'Verifikator: ' . ($record->validator->name ?? '-') . ' | Waktu Validasi: ' . ($record->validated_at ? $record->validated_at->format('d/m/Y H:i') . ' WIB' : '-'),
|
||||
@@ -698,7 +698,7 @@ class P2hInspectionController extends Controller
|
||||
];
|
||||
|
||||
$xlsxContent = SimpleXlsxExporter::create(
|
||||
'LEMBAR PEMERIKSAAN HARIAN (P2H) UNIT SUPPORT - ' . ($record->vehicle->code ?? 'UNIT'),
|
||||
'LEMBAR PEMERIKSAAN HARIAN (P2H) HEAVY EQUIPMENT - ' . ($record->vehicle->code ?? 'UNIT'),
|
||||
$metaLines,
|
||||
$headers,
|
||||
$rows,
|
||||
|
||||
@@ -13,7 +13,7 @@ use Illuminate\View\View;
|
||||
class P2hTemplateController extends Controller
|
||||
{
|
||||
/**
|
||||
* Tampilkan daftar Master Template Checksheet P2H Unit Support sesuai kategori aset.
|
||||
* Tampilkan daftar Master Template Checksheet P2H Heavy Equipment sesuai kategori aset.
|
||||
*/
|
||||
public function index(Request $request): View
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ class SupportTimesheetController extends Controller
|
||||
];
|
||||
|
||||
/**
|
||||
* Helper query builder untuk memfilter timesheet unit support.
|
||||
* Helper query builder untuk memfilter timesheet Heavy Equipment.
|
||||
*/
|
||||
private function getFilteredQuery(Request $request): Builder
|
||||
{
|
||||
@@ -101,7 +101,7 @@ class SupportTimesheetController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Tampilkan halaman utama Timesheet Unit Support.
|
||||
* Tampilkan halaman utama Timesheet Heavy Equipment.
|
||||
*/
|
||||
public function index(Request $request): View
|
||||
{
|
||||
@@ -258,7 +258,7 @@ class SupportTimesheetController extends Controller
|
||||
$shift,
|
||||
$updaterName
|
||||
) {
|
||||
// 1. Simpan Data Timesheet Unit Support
|
||||
// 1. Simpan Data Timesheet Heavy Equipment
|
||||
$timesheet = UnitSupportTimesheet::create([
|
||||
'timesheet_no' => $timesheetNo,
|
||||
'vehicle_id' => $vehicle->id,
|
||||
@@ -316,7 +316,7 @@ class SupportTimesheetController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Perbarui entri timesheet unit support.
|
||||
* Perbarui entri timesheet Heavy Equipment.
|
||||
*/
|
||||
public function update(Request $request, int $id): RedirectResponse
|
||||
{
|
||||
@@ -406,7 +406,7 @@ class SupportTimesheetController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Hapus entri timesheet unit support.
|
||||
* Hapus entri timesheet Heavy Equipment.
|
||||
*/
|
||||
public function destroy(int $id): RedirectResponse
|
||||
{
|
||||
@@ -418,14 +418,14 @@ class SupportTimesheetController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Ekspor data timesheet unit support ke format Excel (.xlsx).
|
||||
* Ekspor data timesheet Heavy Equipment ke format Excel (.xlsx).
|
||||
*/
|
||||
public function exportExcel(Request $request): Response
|
||||
{
|
||||
$timesheets = $this->getFilteredQuery($request)->get();
|
||||
|
||||
$metaLines = [
|
||||
'Laporan Timesheet Operasional Unit Support (Alat Berat)',
|
||||
'Laporan Timesheet Operasional Heavy Equipment',
|
||||
'Periode: ' . ($request->filled('start_date') ? Carbon::parse($request->input('start_date'))->format('d/m/Y') : 'Semua') . ' s/d ' . ($request->filled('end_date') ? Carbon::parse($request->input('end_date'))->format('d/m/Y') : 'Semua'),
|
||||
'Waktu Ekspor: ' . Carbon::now()->translatedFormat('d F Y, H:i') . ' WIB',
|
||||
'Total Record: ' . $timesheets->count() . ' Entri Timesheet',
|
||||
@@ -496,14 +496,14 @@ class SupportTimesheetController extends Controller
|
||||
];
|
||||
|
||||
$xlsxContent = SimpleXlsxExporter::create(
|
||||
'LAPORAN TIMESHEET OPERASIONAL UNIT SUPPORT',
|
||||
'LAPORAN TIMESHEET OPERASIONAL HEAVY EQUIPMENT',
|
||||
$metaLines,
|
||||
$headers,
|
||||
$rows,
|
||||
$alignments
|
||||
);
|
||||
|
||||
$fileName = 'Timesheet_Unit_Support_' . Carbon::now()->format('Ymd_His') . '.xlsx';
|
||||
$fileName = 'Timesheet_Heavy_Equipment_' . Carbon::now()->format('Ymd_His') . '.xlsx';
|
||||
|
||||
return response($xlsxContent, 200, [
|
||||
'Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
@@ -514,7 +514,7 @@ class SupportTimesheetController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Ekspor data timesheet unit support ke format PDF.
|
||||
* Ekspor data timesheet Heavy Equipment ke format PDF.
|
||||
*/
|
||||
public function exportPdf(Request $request): Response
|
||||
{
|
||||
@@ -522,7 +522,7 @@ class SupportTimesheetController extends Controller
|
||||
|
||||
$metaLeft = [
|
||||
'Sub-Sistem' => 'Quality Management Asset (QMA)',
|
||||
'Modul' => 'Timesheet Operasional Unit Support',
|
||||
'Modul' => 'Timesheet Operasional Heavy Equipment',
|
||||
'Periode' => ($request->filled('start_date') ? Carbon::parse($request->input('start_date'))->format('d/m/Y') : 'Semua') . ' s/d ' . ($request->filled('end_date') ? Carbon::parse($request->input('end_date'))->format('d/m/Y') : 'Semua'),
|
||||
];
|
||||
|
||||
@@ -563,9 +563,9 @@ class SupportTimesheetController extends Controller
|
||||
];
|
||||
}
|
||||
|
||||
$subtitle = 'Monitoring Jam Operasi Alat Berat & Unit Support Proyek Kerinci Hydropower';
|
||||
$subtitle = 'Monitoring Jam Operasi Alat Berat & Heavy Equipment Proyek Kerinci Hydropower';
|
||||
$pdfBinary = QmaTablePdfExporter::generate(
|
||||
'Laporan Timesheet Unit Support',
|
||||
'Laporan Timesheet Heavy Equipment',
|
||||
$subtitle,
|
||||
'SISTEM QMA RKM-KMH',
|
||||
$metaLeft,
|
||||
@@ -574,7 +574,7 @@ class SupportTimesheetController extends Controller
|
||||
$rows
|
||||
);
|
||||
|
||||
$fileName = 'Laporan_Timesheet_Unit_Support_' . Carbon::now()->format('Ymd_His') . '.pdf';
|
||||
$fileName = 'Laporan_Timesheet_Heavy_Equipment_' . Carbon::now()->format('Ymd_His') . '.pdf';
|
||||
|
||||
return response($pdfBinary, 200, [
|
||||
'Content-Type' => 'application/pdf',
|
||||
|
||||
@@ -249,7 +249,7 @@ class UnitManagementController extends Controller
|
||||
'code' => $vehicle->code,
|
||||
'brand_type' => $vehicle->brand_type,
|
||||
'license_plate' => $vehicle->license_plate ?: '-',
|
||||
'category' => $vehicle->isLightVehicle() ? 'Light Vehicle' : 'Unit Support',
|
||||
'category' => $vehicle->isLightVehicle() ? 'Light Vehicle' : 'Heavy Equipment',
|
||||
'photo_url' => $vehicle->photo_url,
|
||||
'site_status' => $vehicle->site_status ?? 'inside_site',
|
||||
'site_status_label' => $vehicle->site_status_label,
|
||||
@@ -404,7 +404,7 @@ class UnitManagementController extends Controller
|
||||
$metaLeft = [
|
||||
'Unit' => "{$vehicle->code} ({$vehicle->brand_type})",
|
||||
'Identitas' => $vehicle->license_plate ?: ($vehicle->serial_number ?: '-'),
|
||||
'Kategori' => $vehicle->isLightVehicle() ? 'Light Vehicle' : 'Unit Support',
|
||||
'Kategori' => $vehicle->isLightVehicle() ? 'Light Vehicle' : 'Heavy Equipment',
|
||||
'Posisi Saat Ini' => ($vehicle->location ?: 'Belum diisi') . ' (' . $vehicle->site_status_label . ')',
|
||||
];
|
||||
|
||||
@@ -469,7 +469,7 @@ class UnitManagementController extends Controller
|
||||
|
||||
$metaLines = [
|
||||
'Laporan Monitoring & Tracking Posisi Unit (QMA)',
|
||||
'Filter Kategori: ' . ($request->filled('category') && $request->input('category') !== 'all' ? ($request->input('category') === 'light_vehicle' ? 'Light Vehicle' : 'Unit Support') : 'Semua Unit'),
|
||||
'Filter Kategori: ' . ($request->filled('category') && $request->input('category') !== 'all' ? ($request->input('category') === 'light_vehicle' ? 'Light Vehicle' : 'Heavy Equipment') : 'Semua Unit'),
|
||||
'Filter Posisi Site: ' . ($request->filled('site_status') && $request->input('site_status') !== 'all' ? ($request->input('site_status') === 'inside_site' ? 'Di Dalam Site' : 'Di Luar Site') : 'Semua Posisi'),
|
||||
'Waktu Ekspor: ' . Carbon::now()->translatedFormat('d F Y, H:i') . ' WIB',
|
||||
];
|
||||
@@ -490,7 +490,7 @@ class UnitManagementController extends Controller
|
||||
|
||||
$rows = [];
|
||||
foreach ($units as $idx => $u) {
|
||||
$catLabel = $u->isLightVehicle() ? 'Light Vehicle' : 'Unit Support';
|
||||
$catLabel = $u->isLightVehicle() ? 'Light Vehicle' : 'Heavy Equipment';
|
||||
$plateOrSn = $u->license_plate ?: ($u->serial_number ?: '-');
|
||||
$updatedAt = $u->location_updated_at ? $u->location_updated_at->format('d/m/Y H:i') : ($u->updated_at ? $u->updated_at->format('d/m/Y H:i') : '-');
|
||||
|
||||
@@ -546,7 +546,7 @@ class UnitManagementController extends Controller
|
||||
|
||||
$metaLeft = [
|
||||
'Sub-Sistem' => 'Quality Management Asset (QMA)',
|
||||
'Kategori' => $request->filled('category') && $request->input('category') !== 'all' ? ($request->input('category') === 'light_vehicle' ? 'Light Vehicle' : 'Unit Support') : 'Semua Unit',
|
||||
'Kategori' => $request->filled('category') && $request->input('category') !== 'all' ? ($request->input('category') === 'light_vehicle' ? 'Light Vehicle' : 'Heavy Equipment') : 'Semua Unit',
|
||||
'Status Posisi' => $request->filled('site_status') && $request->input('site_status') !== 'all' ? ($request->input('site_status') === 'inside_site' ? 'Di Dalam Site' : 'Di Luar Site') : 'Semua Posisi',
|
||||
];
|
||||
|
||||
@@ -570,7 +570,7 @@ class UnitManagementController extends Controller
|
||||
|
||||
$rows = [];
|
||||
foreach ($units as $idx => $u) {
|
||||
$catLabel = $u->isLightVehicle() ? 'Light Vehicle' : 'Unit Support';
|
||||
$catLabel = $u->isLightVehicle() ? 'Light Vehicle' : 'Heavy Equipment';
|
||||
$plateOrSn = $u->license_plate ?: ($u->serial_number ?: '-');
|
||||
$updatedAt = $u->location_updated_at ? $u->location_updated_at->format('d/m/Y H:i') : ($u->updated_at ? $u->updated_at->format('d/m/Y H:i') : '-');
|
||||
|
||||
@@ -587,7 +587,7 @@ class UnitManagementController extends Controller
|
||||
];
|
||||
}
|
||||
|
||||
$subtitle = 'Monitoring Posisi Armada LV & Unit Support Proyek Kerinci Hydropower';
|
||||
$subtitle = 'Monitoring Posisi Armada LV & Heavy Equipment Proyek Kerinci Hydropower';
|
||||
$pdfBinary = QmaTablePdfExporter::generate(
|
||||
'Laporan Monitoring Posisi Unit',
|
||||
$subtitle,
|
||||
|
||||
@@ -48,7 +48,7 @@ class VehicleController extends Controller
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
// 3. Status Kesiapan Unit Support
|
||||
// 3. Status Kesiapan Heavy Equipment
|
||||
$supportOperation = Vehicle::unitSupports()->where('status', 'Operation')->count();
|
||||
$supportStandby = Vehicle::unitSupports()->where('status', 'Standby')->count();
|
||||
$supportBreakdown = Vehicle::unitSupports()->where('status', 'Breakdown')->count();
|
||||
@@ -270,7 +270,7 @@ class VehicleController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Halaman khusus pengelolaan Kategori Kendaraan Berat (Unit Support / Alat Berat).
|
||||
* Halaman khusus pengelolaan Kategori Kendaraan Berat (Heavy Equipment / Alat Berat).
|
||||
*/
|
||||
public function indexSupport(Request $request): View
|
||||
{
|
||||
@@ -281,12 +281,12 @@ class VehicleController extends Controller
|
||||
$query->where('status', $request->input('status'));
|
||||
}
|
||||
|
||||
// Filter Kategori Unit Support (Excavator, Crane, Bulldozer, dll)
|
||||
// Filter Kategori Heavy Equipment (Excavator, Crane, Bulldozer, dll)
|
||||
if ($request->filled('unit_category')) {
|
||||
$query->where('unit_category', $request->input('unit_category'));
|
||||
}
|
||||
|
||||
// Filter Pencarian Keyword Unit Support
|
||||
// Filter Pencarian Keyword Heavy Equipment
|
||||
if ($request->filled('search')) {
|
||||
$search = trim($request->input('search'));
|
||||
$query->where(function ($q) use ($search) {
|
||||
@@ -304,7 +304,7 @@ class VehicleController extends Controller
|
||||
|
||||
$vehicles = $query->orderBy('code')->paginate(15)->withQueryString();
|
||||
|
||||
// Statistik Ringkasan Khusus Unit Support
|
||||
// Statistik Ringkasan Khusus Heavy Equipment
|
||||
$totalSupport = Vehicle::unitSupportCategories()->count();
|
||||
$totalUnits = Vehicle::unitSupportPhysical()->count();
|
||||
$totalOperation = Vehicle::unitSupportCategories()->where('status', 'Operation')->count();
|
||||
@@ -342,7 +342,7 @@ class VehicleController extends Controller
|
||||
->values()
|
||||
->all();
|
||||
|
||||
// Daftar semua kode unit support untuk validasi unik langsung di form
|
||||
// Daftar semua kode Heavy Equipment untuk validasi unik langsung di form
|
||||
$existingCodes = Vehicle::unitSupports()->pluck('code')->map(fn($c) => strtoupper(trim($c)))->values()->all();
|
||||
|
||||
return view('qma.vehicles_support', compact(
|
||||
@@ -359,7 +359,7 @@ class VehicleController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Halaman daftar unit fisik berdasarkan kategori Unit Support yang dipilih.
|
||||
* Halaman daftar unit fisik berdasarkan kategori Heavy Equipment yang dipilih.
|
||||
*/
|
||||
public function indexSupportUnits(Request $request, int $id): View
|
||||
{
|
||||
@@ -430,7 +430,7 @@ class VehicleController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper query builder untuk unit fisik alat berat (Unit Support Physical).
|
||||
* Helper query builder untuk unit fisik alat berat (Heavy Equipment Physical).
|
||||
*/
|
||||
private function getFilteredSupportPhysicalQuery(Request $request): Builder
|
||||
{
|
||||
@@ -469,7 +469,7 @@ class VehicleController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper query builder untuk master kategori Unit Support.
|
||||
* Helper query builder untuk master kategori Heavy Equipment.
|
||||
*/
|
||||
private function getFilteredSupportCategoriesQuery(Request $request): Builder
|
||||
{
|
||||
@@ -498,7 +498,7 @@ class VehicleController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Ekspor data Unit Support ke format Excel (.xlsx).
|
||||
* Ekspor data Heavy Equipment ke format Excel (.xlsx).
|
||||
*/
|
||||
public function exportSupportExcel(Request $request): Response
|
||||
{
|
||||
@@ -530,7 +530,7 @@ class VehicleController extends Controller
|
||||
|
||||
$rows = [];
|
||||
foreach ($units as $idx => $u) {
|
||||
$categoryName = $u->parent?->unit_category ?: ($u->parent?->brand_type ?: ($u->unit_category ?: 'Unit Support'));
|
||||
$categoryName = $u->parent?->unit_category ?: ($u->parent?->brand_type ?: ($u->unit_category ?: 'Heavy Equipment'));
|
||||
$odo = $u->current_km ? number_format($u->current_km, 0, ',', '.') . ' HM' : '0 HM';
|
||||
$docs = trim(($u->silo_document ? 'SILO ' : '') . ($u->kir_document ? 'KIR ' : '')) ?: '-';
|
||||
|
||||
@@ -549,8 +549,8 @@ class VehicleController extends Controller
|
||||
}
|
||||
|
||||
$alignments = ['center', 'center', 'left', 'left', 'center', 'center', 'left', 'center', 'center', 'center'];
|
||||
$title = 'LAPORAN DAFTAR UNIT FISIK ALAT BERAT (UNIT SUPPORT) - PT KERINCI MERANGIN HIDRO';
|
||||
$fileName = 'Laporan_Unit_Support_Lengkap_' . now()->format('Ymd_Hi') . '.xlsx';
|
||||
$title = 'LAPORAN DAFTAR UNIT FISIK ALAT BERAT (HEAVY EQUIPMENT) - PT KERINCI MERANGIN HIDRO';
|
||||
$fileName = 'Laporan_Heavy_Equipment_Lengkap_' . now()->format('Ymd_Hi') . '.xlsx';
|
||||
} else {
|
||||
// Fallback ke master kategori jika unit fisik belum diinput
|
||||
$categories = $this->getFilteredSupportCategoriesQuery($request)->get();
|
||||
@@ -585,8 +585,8 @@ class VehicleController extends Controller
|
||||
}
|
||||
|
||||
$alignments = ['center', 'center', 'left', 'left', 'center', 'left', 'center'];
|
||||
$title = 'LAPORAN MASTER KATEGORI ALAT BERAT (UNIT SUPPORT) - PT KERINCI MERANGIN HIDRO';
|
||||
$fileName = 'Laporan_Kategori_Unit_Support_' . now()->format('Ymd_Hi') . '.xlsx';
|
||||
$title = 'LAPORAN MASTER KATEGORI ALAT BERAT (HEAVY EQUIPMENT) - PT KERINCI MERANGIN HIDRO';
|
||||
$fileName = 'Laporan_Kategori_Heavy_Equipment_' . now()->format('Ymd_Hi') . '.xlsx';
|
||||
}
|
||||
|
||||
$binary = SimpleXlsxExporter::create($title, $metaLines, $headers, $rows, $alignments);
|
||||
@@ -601,7 +601,7 @@ class VehicleController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Ekspor data Unit Support ke format PDF (Pratinjau Asli dengan Logo PT KMH).
|
||||
* Ekspor data Heavy Equipment ke format PDF (Pratinjau Asli dengan Logo PT KMH).
|
||||
*/
|
||||
public function exportSupportPdf(Request $request): Response
|
||||
{
|
||||
@@ -617,7 +617,7 @@ class VehicleController extends Controller
|
||||
$totalBd = $units->where('status', 'Breakdown')->count();
|
||||
|
||||
$metaLeft = [
|
||||
'Kategori' => 'Unit Support (Alat Berat Fisik)',
|
||||
'Kategori' => 'Heavy Equipment (Alat Berat Fisik)',
|
||||
'Status Operasional' => $statusFilter,
|
||||
'Tanggal Cetak' => $today . ' WIB',
|
||||
];
|
||||
@@ -641,7 +641,7 @@ class VehicleController extends Controller
|
||||
|
||||
$rows = [];
|
||||
foreach ($units as $idx => $u) {
|
||||
$categoryName = $u->parent?->unit_category ?: ($u->parent?->brand_type ?: ($u->unit_category ?: 'Unit Support'));
|
||||
$categoryName = $u->parent?->unit_category ?: ($u->parent?->brand_type ?: ($u->unit_category ?: 'Heavy Equipment'));
|
||||
$odo = $u->current_km ? number_format($u->current_km, 0, ',', '.') . ' HM' : '0 HM';
|
||||
|
||||
$rows[] = [
|
||||
@@ -657,9 +657,9 @@ class VehicleController extends Controller
|
||||
];
|
||||
}
|
||||
|
||||
$title = 'Laporan Data Unit Support (Alat Berat)';
|
||||
$title = 'Laporan Data Heavy Equipment (Alat Berat)';
|
||||
$subtitle = 'Daftar Seluruh Unit Fisik Alat Berat Lapangan - ' . now()->translatedFormat('d F Y');
|
||||
$fileName = 'Laporan_Unit_Support_' . now()->format('Ymd_Hi') . '.pdf';
|
||||
$fileName = 'Laporan_Heavy_Equipment_' . now()->format('Ymd_Hi') . '.pdf';
|
||||
} else {
|
||||
$categories = $this->getFilteredSupportCategoriesQuery($request)->get();
|
||||
|
||||
@@ -668,7 +668,7 @@ class VehicleController extends Controller
|
||||
$totalBd = $categories->where('status', 'Breakdown')->count();
|
||||
|
||||
$metaLeft = [
|
||||
'Kategori' => 'Master Kategori Unit Support',
|
||||
'Kategori' => 'Master Kategori Heavy Equipment',
|
||||
'Status Operasional' => $statusFilter,
|
||||
'Tanggal Cetak' => $today . ' WIB',
|
||||
];
|
||||
@@ -701,9 +701,9 @@ class VehicleController extends Controller
|
||||
];
|
||||
}
|
||||
|
||||
$title = 'Laporan Master Kategori Unit Support';
|
||||
$title = 'Laporan Master Kategori Heavy Equipment';
|
||||
$subtitle = 'Master 28 Kategori Alat Berat Proyek KMH - ' . now()->translatedFormat('d F Y');
|
||||
$fileName = 'Laporan_Kategori_Unit_Support_' . now()->format('Ymd_Hi') . '.pdf';
|
||||
$fileName = 'Laporan_Kategori_Heavy_Equipment_' . now()->format('Ymd_Hi') . '.pdf';
|
||||
}
|
||||
|
||||
$pdfBinary = VehiclePdfExporter::generate($title, $subtitle, $metaLeft, $metaRight, $columns, $rows);
|
||||
@@ -877,7 +877,7 @@ class VehicleController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Simpan penambahan unit fisik baru di bawah kategori Unit Support tertentu.
|
||||
* Simpan penambahan unit fisik baru di bawah kategori Heavy Equipment tertentu.
|
||||
*/
|
||||
public function storeSupportUnit(Request $request, int $id): RedirectResponse
|
||||
{
|
||||
@@ -973,7 +973,7 @@ class VehicleController extends Controller
|
||||
'photo' => ['nullable', 'image', 'mimes:jpeg,png,jpg,webp', 'max:10240'],
|
||||
];
|
||||
|
||||
// Atribut opsional spesifik Unit Support (Kendaraan Berat)
|
||||
// Atribut opsional spesifik Heavy Equipment (Kendaraan Berat)
|
||||
if ($category === 'unit_support') {
|
||||
$rules = array_merge($rules, [
|
||||
'unit_category' => ['nullable', 'string', 'max:100'],
|
||||
@@ -1023,14 +1023,14 @@ class VehicleController extends Controller
|
||||
$vehicle->update(['p2h_template_id' => $template->id]);
|
||||
}
|
||||
|
||||
$categoryLabel = $vehicle->isLightVehicle() ? 'Light Vehicle (LV)' : 'Kategori Unit Support';
|
||||
$categoryLabel = $vehicle->isLightVehicle() ? 'Light Vehicle (LV)' : 'Kategori Heavy Equipment';
|
||||
|
||||
return back()->with('success', "Data {$categoryLabel} [{$vehicle->code}] berhasil ditambahkan ke sistem.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Perbarui data aset kendaraan (LV atau Unit Support).
|
||||
* Jika kode Kategori Unit Support diubah, otomatis sinkronisasikan kode seluruh unit fisik di bawahnya serta Master Template P2H.
|
||||
* Perbarui data aset kendaraan (LV atau Heavy Equipment).
|
||||
* Jika kode Kategori Heavy Equipment diubah, otomatis sinkronisasikan kode seluruh unit fisik di bawahnya serta Master Template P2H.
|
||||
*/
|
||||
public function update(Request $request, int $id): RedirectResponse
|
||||
{
|
||||
@@ -1078,7 +1078,7 @@ class VehicleController extends Controller
|
||||
DB::transaction(function () use ($vehicle, $validated, $oldCode, $newCode) {
|
||||
$vehicle->update($validated);
|
||||
|
||||
// Jika ini kategori Unit Support, sinkronkan Master Template P2H dan unit-unit fisik di bawahnya
|
||||
// Jika ini kategori Heavy Equipment, sinkronkan Master Template P2H dan unit-unit fisik di bawahnya
|
||||
if ($vehicle->isSupportCategory()) {
|
||||
$template = $vehicle->p2hTemplate ?: P2hTemplate::where('code', $oldCode)->first();
|
||||
if ($template) {
|
||||
|
||||
@@ -127,7 +127,7 @@ class Vehicle extends Model
|
||||
/**
|
||||
* Scope untuk seluruh unit operasional yang dapat dilacak posisinya:
|
||||
* - Seluruh Light Vehicle
|
||||
* - Seluruh Unit Support fisik (anak kategori) ATAU kategori tunggal yang belum memiliki anak unit
|
||||
* - Seluruh Heavy Equipment fisik (anak kategori) ATAU kategori tunggal yang belum memiliki anak unit
|
||||
*/
|
||||
public function scopeTrackableUnits(Builder $query): Builder
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ class P2hInspectionPdfExporter extends FPDF
|
||||
$this->SetXY(18, 22.5);
|
||||
$this->SetFont('Arial', 'B', 10);
|
||||
$this->SetTextColor(255, 255, 255);
|
||||
$this->Cell(115, 5, 'LEMBAR PEMERIKSAAN HARIAN (P2H) UNIT SUPPORT', 0, 1, 'L');
|
||||
$this->Cell(115, 5, 'LEMBAR PEMERIKSAAN HARIAN (P2H) HEAVY EQUIPMENT', 0, 1, 'L');
|
||||
|
||||
$this->SetXY(18, 27.5);
|
||||
$this->SetFont('Arial', '', 7);
|
||||
@@ -94,7 +94,7 @@ class P2hInspectionPdfExporter extends FPDF
|
||||
// -------------------------------------------------------------
|
||||
$pdf->SetY(37);
|
||||
|
||||
// Box 1: Identitas Unit Support
|
||||
// Box 1: Identitas Heavy Equipment
|
||||
$pdf->SetFillColor(248, 250, 252); // #f8fafc
|
||||
$pdf->SetDrawColor(226, 232, 240); // #e2e8f0
|
||||
$pdf->Rect(15, 37, 58, 30, 'DF');
|
||||
@@ -102,7 +102,7 @@ class P2hInspectionPdfExporter extends FPDF
|
||||
$pdf->SetXY(17, 38.5);
|
||||
$pdf->SetFont('Arial', 'B', 7);
|
||||
$pdf->SetTextColor(180, 83, 9); // Amber
|
||||
$pdf->Cell(54, 4, 'UNIT SUPPORT', 0, 1, 'L');
|
||||
$pdf->Cell(54, 4, 'HEAVY EQUIPMENT', 0, 1, 'L');
|
||||
|
||||
$pdf->SetX(17);
|
||||
$pdf->SetFont('Arial', 'B', 10);
|
||||
|
||||
Reference in New Issue
Block a user