feat: timesheet auto hm, sync excel vehicle locations, heavy equipment grouped by type, 2-party bast signature, and compact role permission ui

This commit is contained in:
Ray1111-aa
2026-11-01 22:28:12 +07:00
parent b83a8fa843
commit 96178971fd
11 changed files with 1509 additions and 478 deletions
+194 -166
View File
@@ -301,11 +301,23 @@
</div>
</td>
<!-- Odometer Awal -->
<!-- Odometer Awal & Akhir -->
<td class="py-3.5 px-4 text-center font-mono whitespace-nowrap">
<span class="text-xs font-bold text-slate-900 bg-slate-100 px-2.5 py-1 rounded-lg border border-slate-200">
{{ number_format($ts->start_meter, 1, ',', '.') }} {{ $ts->meter_type }}
</span>
<div class="text-xs font-bold text-slate-900 bg-slate-100 px-2.5 py-1 rounded-lg border border-slate-200 inline-block">
{{ number_format($ts->start_meter, 1, ',', '.') }} {{ $ts->meter_type }}@if($ts->effective_end_meter) <span class="text-slate-400 font-normal">s/d</span> <span class="text-emerald-700">{{ number_format($ts->effective_end_meter, 1, ',', '.') }} {{ $ts->meter_type }}</span>@endif
</div>
@if($ts->effective_operating_hours !== null && $ts->effective_operating_hours > 0)
<div class="text-[10px] text-emerald-700 font-semibold font-sans mt-0.5">
+{{ number_format($ts->effective_operating_hours, 1, ',', '.') }} Jam Operasi
</div>
@elseif($ts->effective_end_meter)
<div class="text-[10px] text-slate-400 font-sans mt-0.5">0.0 Jam</div>
@else
<div class="text-[10px] text-amber-600 font-sans mt-0.5 flex items-center justify-center gap-1">
<span class="w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse"></span>
<span>Berjalan (Finish Otomatis)</span>
</div>
@endif
</td>
<!-- Lokasi & Aktivitas -->
@@ -361,9 +373,9 @@
'operator_type' => $ts->operator?->employee_type ?: 'Karyawan',
'operator_nik' => $ts->operator?->nik ?: '-',
'start_meter' => number_format($ts->start_meter, 1, ',', '.'),
'end_meter' => number_format($ts->end_meter, 1, ',', '.'),
'end_meter' => $ts->effective_end_meter !== null ? number_format($ts->effective_end_meter, 1, ',', '.') : '-',
'meter_type' => $ts->meter_type,
'operating_hours' => number_format($ts->operating_hours, 1, ',', '.'),
'operating_hours' => $ts->effective_operating_hours !== null ? number_format($ts->effective_operating_hours, 1, ',', '.') : '-',
'standby_hours' => number_format($ts->standby_hours, 1, ',', '.'),
'breakdown_hours' => number_format($ts->breakdown_hours, 1, ',', '.'),
'fuel_liters' => $ts->fuel_liters ? number_format($ts->fuel_liters, 0, ',', '.') : '-',
@@ -479,37 +491,37 @@
<!-- Baris 1: Lokasi Kerja & Heavy Equipment -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Lokasi Kerja <span class="text-rose-500">*</span>
<label class="block text-xs font-bold text-slate-700 mb-1.5 flex items-center justify-between">
<span>Lokasi Kerja <span class="text-rose-500">*</span></span>
<span class="sr-only">Tentukan Lokasi Dulu</span>
<span class="text-[10px] text-emerald-700 font-semibold">Bisa ketik / pilih</span>
</label>
<select id="addLocationSelect"
required
onchange="onTimesheetLocationChanged(this.value, 'add')"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
<option value="" disabled selected>-- Pilih Lokasi Kerja --</option>
<option value="ALL">[Semua Lokasi / Semua Unit]</option>
@foreach($unitLocations as $locName => $count)
<option value="{{ $locName }}">{{ $locName }} ({{ $count }} Unit Ready)</option>
@endforeach
@if(isset($otherLocations) && count($otherLocations))
<optgroup label="Lokasi Lainnya di Site">
@foreach($otherLocations as $otherLoc)
<option value="{{ $otherLoc }}">{{ $otherLoc }} (0 Unit)</option>
@endforeach
</optgroup>
@endif
<option value="__CUSTOM__">+ Ketik Lokasi Baru...</option>
</select>
<div id="addCustomLocationWrapper" class="hidden mt-2">
<div class="relative">
<input type="text"
id="addCustomLocationInput"
name="custom_location"
placeholder="Ketik nama lokasi kerja baru..."
oninput="onCustomLocationTyped(this.value, 'add')"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-emerald-300 bg-emerald-50/40 text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20]">
id="addLocationInput"
name="location"
list="addLocationsDatalist"
required
autocomplete="off"
placeholder="Pilih atau ketik lokasi kerja..."
oninput="onTimesheetLocationTyped(this.value, 'add')"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
<datalist id="addLocationsDatalist">
<option value="[Semua Unit]">[Semua Lokasi / Tampilkan Semua Unit]</option>
@foreach($unitLocations as $locName => $count)
<option value="{{ $locName }}">{{ $locName }} ({{ $count }} Unit Ready)</option>
@endforeach
@foreach($locationSuggestions as $suggLoc)
@if(!isset($unitLocations[$suggLoc]))
<option value="{{ $suggLoc }}">{{ $suggLoc }}</option>
@endif
@endforeach
</datalist>
</div>
<input type="hidden" name="location" id="addFinalLocation" required>
<input type="hidden" id="addFinalLocation" value="">
<p class="text-[10px] text-slate-400 mt-1">
Pilih dari daftar atau ketik lokasi baru (otomatis tersimpan ke database).
</p>
</div>
<div>
@@ -626,7 +638,7 @@
</div>
</div>
<!-- Baris 4: Meter Awal & Satuan Meteran -->
<!-- Baris 4: Meter Awal & Meter Akhir (Finish HM) -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
@@ -644,6 +656,28 @@
</div>
</div>
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5 flex items-center justify-between">
<span>Meter Akhir (Finish HM/KM)</span>
<span class="text-[10px] text-emerald-700 font-semibold">Otomatis / Opsional</span>
</label>
<div class="relative">
<input type="number"
step="0.01"
name="end_meter"
id="addEndMeter"
placeholder="Dihitung otomatis jika kosong"
class="w-full text-xs pl-3.5 pr-14 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono font-bold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
<span id="addEndMeterUnitLabel" class="absolute right-3.5 top-1/2 -translate-y-1/2 text-xs font-extrabold text-slate-400">HM</span>
</div>
<p class="text-[10px] text-slate-400 mt-1">
<i class="fa-solid fa-clock text-emerald-600 mr-0.5"></i> 1 HM = 1 Jam. Dihitung otomatis saat entri berikutnya diinput.
</p>
</div>
</div>
<!-- Baris 4b: Satuan Meteran & Status Akhir Unit -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Satuan Meteran <span class="text-rose-500">*</span>
@@ -653,21 +687,21 @@
<option value="KM">KM (Odometer)</option>
</select>
</div>
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Status Akhir Unit <span class="text-rose-500">*</span>
</label>
<select name="status" required class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
<option value="Operation">Operation (Siap Jalan)</option>
<option value="Standby">Standby (Tersedia / Siaga)</option>
<option value="Breakdown">Breakdown (Kendala / Rusak)</option>
<option value="Maintenance">Maintenance (Servis Rutin)</option>
</select>
</div>
</div>
<!-- Baris 5: Status Akhir Unit (Shift diset otomatis) -->
<input type="hidden" name="shift" value="Shift Siang">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Status Akhir Unit <span class="text-rose-500">*</span>
</label>
<select name="status" required class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
<option value="Operation">Operation (Siap Jalan)</option>
<option value="Standby">Standby (Tersedia / Siaga)</option>
<option value="Breakdown">Breakdown (Kendala / Rusak)</option>
<option value="Maintenance">Maintenance (Servis Rutin)</option>
</select>
</div>
<!-- Baris 6: Rincian Tugas & Catatan -->
<div>
@@ -811,37 +845,37 @@
<!-- Baris 1: Lokasi Kerja & Heavy Equipment -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Lokasi Kerja <span class="text-rose-500">*</span>
<label class="block text-xs font-bold text-slate-700 mb-1.5 flex items-center justify-between">
<span>Lokasi Kerja <span class="text-rose-500">*</span></span>
<span class="sr-only">Tentukan Lokasi Dulu</span>
<span class="text-[10px] text-emerald-700 font-semibold">Bisa ketik / pilih</span>
</label>
<select id="editLocationSelect"
required
onchange="onTimesheetLocationChanged(this.value, 'edit')"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
<option value="" disabled selected>-- Pilih Lokasi Kerja --</option>
<option value="ALL">[Semua Lokasi / Semua Unit]</option>
@foreach($unitLocations as $locName => $count)
<option value="{{ $locName }}">{{ $locName }} ({{ $count }} Unit Ready)</option>
@endforeach
@if(isset($otherLocations) && count($otherLocations))
<optgroup label="Lokasi Lainnya di Site">
@foreach($otherLocations as $otherLoc)
<option value="{{ $otherLoc }}">{{ $otherLoc }} (0 Unit)</option>
@endforeach
</optgroup>
@endif
<option value="__CUSTOM__">+ Ketik Lokasi Baru...</option>
</select>
<div id="editCustomLocationWrapper" class="hidden mt-2">
<div class="relative">
<input type="text"
id="editCustomLocationInput"
name="custom_location"
placeholder="Ketik nama lokasi kerja baru..."
oninput="onCustomLocationTyped(this.value, 'edit')"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-emerald-300 bg-emerald-50/40 text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20]">
id="editLocationInput"
name="location"
list="editLocationsDatalist"
required
autocomplete="off"
placeholder="Pilih atau ketik lokasi kerja..."
oninput="onTimesheetLocationTyped(this.value, 'edit')"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
<datalist id="editLocationsDatalist">
<option value="[Semua Unit]">[Semua Lokasi / Tampilkan Semua Unit]</option>
@foreach($unitLocations as $locName => $count)
<option value="{{ $locName }}">{{ $locName }} ({{ $count }} Unit Ready)</option>
@endforeach
@foreach($locationSuggestions as $suggLoc)
@if(!isset($unitLocations[$suggLoc]))
<option value="{{ $suggLoc }}">{{ $suggLoc }}</option>
@endif
@endforeach
</datalist>
</div>
<input type="hidden" name="location" id="editFinalLocation" required>
<input type="hidden" id="editFinalLocation" value="">
<p class="text-[10px] text-slate-400 mt-1">
Pilih dari daftar atau ketik lokasi baru (otomatis tersimpan).
</p>
</div>
<div>
@@ -956,7 +990,7 @@
</div>
</div>
<!-- Baris 4: Meter Awal & Satuan Meteran -->
<!-- Baris 4: Meter Awal & Meter Akhir (Finish HM) -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
@@ -974,6 +1008,28 @@
</div>
</div>
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5 flex items-center justify-between">
<span>Meter Akhir (Finish HM/KM)</span>
<span class="text-[10px] text-emerald-700 font-semibold">Otomatis / Opsional</span>
</label>
<div class="relative">
<input type="number"
step="0.01"
name="end_meter"
id="editEndMeter"
placeholder="Dihitung otomatis jika kosong"
class="w-full text-xs pl-3.5 pr-14 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono font-bold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
<span id="editEndMeterUnitLabel" class="absolute right-3.5 top-1/2 -translate-y-1/2 text-xs font-extrabold text-slate-400">HM</span>
</div>
<p class="text-[10px] text-slate-400 mt-1">
<i class="fa-solid fa-clock text-emerald-600 mr-0.5"></i> 1 HM = 1 Jam. Dihitung otomatis saat entri berikutnya diinput.
</p>
</div>
</div>
<!-- Baris 4b: Satuan Meteran & Status Akhir Unit -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Satuan Meteran <span class="text-rose-500">*</span>
@@ -983,21 +1039,22 @@
<option value="KM">KM (Odometer)</option>
</select>
</div>
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Status Akhir Unit <span class="text-rose-500">*</span>
</label>
<select name="status" id="editStatus" required class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
<option value="Operation">Operation (Siap Jalan)</option>
<option value="Standby">Standby (Tersedia / Siaga)</option>
<option value="Breakdown">Breakdown (Kendala / Rusak)</option>
<option value="Maintenance">Maintenance (Servis Rutin)</option>
</select>
</div>
</div>
<!-- Baris 5: Status Akhir Unit (Shift disimpan secara otomatis) -->
<!-- Baris 5: Shift (disimpan otomatis) -->
<input type="hidden" name="shift" id="editShift" value="Shift Siang">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Status Akhir Unit <span class="text-rose-500">*</span>
</label>
<select name="status" id="editStatus" required class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
<option value="Operation">Operation (Siap Jalan)</option>
<option value="Standby">Standby (Tersedia / Siaga)</option>
<option value="Breakdown">Breakdown (Kendala / Rusak)</option>
<option value="Maintenance">Maintenance (Servis Rutin)</option>
</select>
</div>
<!-- Baris 6: Deskripsi & Catatan -->
<div>
@@ -1318,23 +1375,15 @@
const modal = document.getElementById('addTimesheetModal');
if (modal) {
// Reset form pilihan lokasi & unit
const addLocSelect = document.getElementById('addLocationSelect');
if (addLocSelect) addLocSelect.selectedIndex = 0;
const customWrap = document.getElementById('addCustomLocationWrapper');
if (customWrap) customWrap.classList.add('hidden');
const customInput = document.getElementById('addCustomLocationInput');
if (customInput) customInput.value = '';
const addLocInput = document.getElementById('addLocationInput');
if (addLocInput) addLocInput.value = '';
const finalLoc = document.getElementById('addFinalLocation');
if (finalLoc) finalLoc.value = '';
const vehSelect = document.getElementById('addVehicleSelect');
if (vehSelect) {
vehSelect.innerHTML = '<option value="" disabled selected>-- Pilih Lokasi Kerja Terlebih Dahulu --</option>';
}
const counter = document.getElementById('addUnitCounterBadge');
if (counter) counter.classList.add('hidden');
const preview = document.getElementById('addVehiclePreview');
if (preview) preview.classList.add('hidden');
const endMeter = document.getElementById('addEndMeter');
if (endMeter) endMeter.value = '';
onTimesheetLocationTyped('', 'add');
const startMeter = document.getElementById('addStartMeter');
if (startMeter) startMeter.value = '';
@@ -1424,37 +1473,14 @@
document.getElementById('editTimesheetSubtitle').textContent = `No: ${ts.timesheet_no} (${unitCode || '-'})`;
// 1. Sinkronisasi Lokasi Kerja
const locSelect = document.getElementById('editLocationSelect');
const locInput = document.getElementById('editLocationInput');
const finalLoc = document.getElementById('editFinalLocation');
const customWrap = document.getElementById('editCustomLocationWrapper');
const targetLoc = ts.location || '';
finalLoc.value = targetLoc;
let matched = false;
if (locSelect) {
for (let i = 0; i < locSelect.options.length; i++) {
if (locSelect.options[i].value.toLowerCase() === targetLoc.toLowerCase()) {
locSelect.selectedIndex = i;
matched = true;
break;
}
}
if (!matched && targetLoc) {
// Tambahkan option lokasi baru jika belum terdaftar
const newOpt = document.createElement('option');
newOpt.value = targetLoc;
newOpt.textContent = `${targetLoc} (Lokasi Riwayat)`;
locSelect.appendChild(newOpt);
locSelect.value = targetLoc;
}
}
if (customWrap) customWrap.classList.add('hidden');
if (locInput) locInput.value = targetLoc;
if (finalLoc) finalLoc.value = targetLoc;
// Filter unit pada lokasi ini dengan memilih ts.vehicle_id
onTimesheetLocationChanged(locSelect ? locSelect.value : targetLoc, 'edit', ts.vehicle_id);
onTimesheetLocationTyped(targetLoc, 'edit', ts.vehicle_id);
// Cari jenis operator yang sedang diedit untuk mengaktifkan filter yang sesuai
let selectedOpType = 'all';
@@ -1487,6 +1513,10 @@
document.getElementById('editMeterType').value = ts.meter_type || 'HM';
document.getElementById('editStartMeter').value = ts.start_meter;
const editEndMeter = document.getElementById('editEndMeter');
if (editEndMeter) {
editEndMeter.value = (ts.end_meter && ts.end_meter !== '-') ? ts.end_meter.replace('.', '').replace(',', '.') : '';
}
document.getElementById('editActivityType').value = ts.activity_type;
document.getElementById('editStatus').value = ts.status || 'Operation';
@@ -1520,10 +1550,17 @@
modal.style.display = 'none';
}
// 5. Handler saat Lokasi Kerja Dipilih (Filter Heavy Equipment yang Ready di Lokasi tersebut)
// 5. Handler saat Lokasi Kerja Diketik / Dipilih via Datalist Input
function onTimesheetLocationTyped(val, prefix, preselectVehicleId = null) {
const trimmed = (val || '').trim();
const finalLoc = document.getElementById(`${prefix}FinalLocation`);
if (finalLoc) {
finalLoc.value = (trimmed === '[Semua Unit]' || trimmed === 'ALL') ? '' : trimmed;
}
onTimesheetLocationChanged(trimmed, prefix, preselectVehicleId);
}
function onTimesheetLocationChanged(selectedLoc, prefix, preselectVehicleId = null) {
const customWrapper = document.getElementById(`${prefix}CustomLocationWrapper`);
const customInput = document.getElementById(`${prefix}CustomLocationInput`);
const finalLocation = document.getElementById(`${prefix}FinalLocation`);
const vehicleSelect = document.getElementById(`${prefix}VehicleSelect`);
const counterBadge = document.getElementById(`${prefix}UnitCounterBadge`);
@@ -1531,56 +1568,40 @@
if (!vehicleSelect) return;
// Tangani pilihan custom atau ALL
if (selectedLoc === '__CUSTOM__') {
if (customWrapper) customWrapper.classList.remove('hidden');
if (customInput) {
customInput.focus();
if (finalLocation) finalLocation.value = customInput.value.trim();
}
} else {
if (customWrapper) customWrapper.classList.add('hidden');
if (finalLocation) {
finalLocation.value = (selectedLoc === 'ALL' || !selectedLoc) ? '' : selectedLoc;
}
if (finalLocation) {
finalLocation.value = (selectedLoc === 'ALL' || selectedLoc === '[Semua Unit]' || !selectedLoc) ? '' : selectedLoc;
}
const allUnits = window.unitSupportsData || [];
let filteredUnits = [];
if (!selectedLoc) {
vehicleSelect.innerHTML = '<option value="" disabled selected>-- Pilih Lokasi Kerja Terlebih Dahulu --</option>';
if (counterBadge) counterBadge.classList.add('hidden');
if (previewEl) previewEl.classList.add('hidden');
filterOperatorSelect('all', prefix);
return;
} else if (selectedLoc === 'ALL' || selectedLoc === '__CUSTOM__') {
if (!selectedLoc || selectedLoc === 'ALL' || selectedLoc === '[Semua Unit]') {
filteredUnits = allUnits;
} else {
const norm = selectedLoc.trim().toLowerCase();
filteredUnits = allUnits.filter(u => {
const uLoc = (u.location || 'Site Kerinci').trim().toLowerCase();
return uLoc === norm;
return uLoc === norm || uLoc.includes(norm);
});
// Jika lokasi yang diketik adalah lokasi baru, tetap tampilkan semua unit agar bisa dipilih
if (filteredUnits.length === 0) {
filteredUnits = allUnits;
}
}
// Jika dalam mode edit dan preselectVehicleId tidak ditemukan di lokasi ini (misal unit berpindah setelah ts dicatat), sertakan unit tersebut
if (preselectVehicleId) {
const foundInFiltered = filteredUnits.some(u => String(u.id) === String(preselectVehicleId));
if (!foundInFiltered) {
const extra = allUnits.find(u => String(u.id) === String(preselectVehicleId));
if (extra) filteredUnits.unshift(extra);
}
// Jika dalam mode edit dan preselectVehicleId tidak ditemukan di lokasi ini, sertakan unit tersebut
if (preselectVehicleId) {
const foundInFiltered = filteredUnits.some(u => String(u.id) === String(preselectVehicleId));
if (!foundInFiltered) {
const extra = allUnits.find(u => String(u.id) === String(preselectVehicleId));
if (extra) filteredUnits.unshift(extra);
}
}
// Update badge counter
if (counterBadge) {
counterBadge.classList.remove('hidden');
if (selectedLoc === 'ALL' || selectedLoc === '__CUSTOM__') {
counterBadge.textContent = `${filteredUnits.length} Total Unit`;
} else {
counterBadge.textContent = `${filteredUnits.length} Unit Ready`;
}
counterBadge.textContent = `${filteredUnits.length} Unit Ready`;
}
// Render option heavy equipment
@@ -1590,7 +1611,7 @@
defaultPrompt.disabled = true;
defaultPrompt.textContent = filteredUnits.length > 0
? `-- Pilih Heavy Equipment (${filteredUnits.length} Unit Ready) --`
: `-- Tidak ada unit di lokasi ini (Pilih 'Semua Unit') --`;
: `-- Tidak ada unit (${allUnits.length} Unit Total) --`;
vehicleSelect.appendChild(defaultPrompt);
let hasSelected = false;
@@ -1670,10 +1691,13 @@
updateMeterUnitLabels(prefix);
}
// Jika lokasi kerja dipilih 'ALL', sinkronkan finalLocation ke lokasi unit
const locSelect = document.getElementById(`${prefix}LocationSelect`);
// Jika lokasi kerja dipilih 'ALL' atau kosong, sinkronkan ke lokasi unit
const locInput = document.getElementById(`${prefix}LocationInput`);
const finalLoc = document.getElementById(`${prefix}FinalLocation`);
if (locSelect && locSelect.value === 'ALL' && finalLoc && !finalLoc.value) {
if (locInput && (!locInput.value || locInput.value === 'ALL' || locInput.value === '[Semua Unit]')) {
locInput.value = unitLocation;
}
if (finalLoc && (!finalLoc.value || finalLoc.value === 'ALL' || finalLoc.value === '[Semua Unit]')) {
finalLoc.value = unitLocation;
}
@@ -1690,6 +1714,10 @@
if (label) {
label.textContent = unit;
}
const endLabel = document.getElementById(`${prefix}EndMeterUnitLabel`);
if (endLabel) {
endLabel.textContent = unit;
}
}
document.getElementById('addMeterType')?.addEventListener('change', () => updateMeterUnitLabels('add'));
@@ -233,62 +233,34 @@
Demikian Berita Acara ini dibuat dengan sebenarnya dalam rangkap yang sah untuk dipergunakan sebagaimana mestinya dalam tertib administrasi aset dan operasional alat berat proyek Kerinci Merangin Hidro.
</p>
<!-- KOLOM TANDA TANGAN (4 PIHAK) -->
<!-- KOLOM TANDA TANGAN (2 PIHAK) -->
<div class="pt-6">
<div class="grid grid-cols-2 sm:grid-cols-4 gap-4 text-center text-xs">
<!-- 1. Yang Menyerahkan (Driver / Pengangkut) -->
<div class="flex flex-col justify-between min-h-[140px] p-2 border border-slate-200 rounded-xl bg-slate-50/40">
<p class="font-bold text-slate-600 text-[11px]">Yang Menyerahkan / Pengangkut,</p>
<div class="py-6">
<span class="text-[10px] text-slate-300 italic">(Tanda Tangan)</span>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-8 text-center text-xs max-w-2xl mx-auto">
<!-- 1. Yang Melakukan / Mencatat Pemindahan -->
<div class="flex flex-col justify-between min-h-[150px] p-4 border border-slate-200 rounded-xl bg-slate-50/40 shadow-sm">
<p class="font-bold text-slate-700 text-xs uppercase tracking-wider">Yang Mencatat Pemindahan,</p>
<div class="py-8">
<span class="text-[11px] text-slate-400 italic">( Tanda Tangan )</span>
</div>
<div>
<p class="font-bold text-slate-900 border-t border-slate-300 pt-1">
{{ $transfer->transporter_driver_name ?: 'Driver Pengangkut' }}
<p class="font-bold text-slate-900 border-t border-slate-300 pt-2 text-sm">
{{ $transfer->user?->name ?? $transfer->reported_by }}
</p>
<p class="text-[10px] text-slate-400">Pengemudi / Operator</p>
<p class="text-[11px] text-slate-500 font-medium">Petugas Pemindahan / Pelapor</p>
</div>
</div>
<!-- 2. Yang Melaporkan (Petugas QMA) -->
<div class="flex flex-col justify-between min-h-[140px] p-2 border border-slate-200 rounded-xl bg-slate-50/40">
<p class="font-bold text-slate-600 text-[11px]">Yang Melaporkan,</p>
<div class="py-6">
<span class="text-[10px] text-slate-300 italic">(Tanda Tangan)</span>
<!-- 2. Admin QMA (Mengetahui / Menyetujui) -->
<div class="flex flex-col justify-between min-h-[150px] p-4 border border-slate-200 rounded-xl bg-slate-50/40 shadow-sm">
<p class="font-bold text-slate-700 text-xs uppercase tracking-wider">Mengetahui / Menyetujui,</p>
<div class="py-8">
<span class="text-[11px] text-slate-400 italic">( Tanda Tangan )</span>
</div>
<div>
<p class="font-bold text-slate-900 border-t border-slate-300 pt-1">
{{ $transfer->reported_by }}
</p>
<p class="text-[10px] text-slate-400">Petugas QMA Field</p>
</div>
</div>
<!-- 3. Yang Menerima (Penanggung Jawab Lokasi Baru) -->
<div class="flex flex-col justify-between min-h-[140px] p-2 border border-slate-200 rounded-xl bg-slate-50/40">
<p class="font-bold text-slate-600 text-[11px]">Yang Menerima,</p>
<div class="py-6">
<span class="text-[10px] text-slate-300 italic">(Tanda Tangan)</span>
</div>
<div>
<p class="font-bold text-slate-900 border-t border-slate-300 pt-1">
<p class="font-bold text-slate-900 border-t border-slate-300 pt-2 text-sm">
( .................................... )
</p>
<p class="text-[10px] text-slate-400">PIC {{ $transfer->to_location }}</p>
</div>
</div>
<!-- 4. Mengetahui (Superintendent / Site Manager) -->
<div class="flex flex-col justify-between min-h-[140px] p-2 border border-slate-200 rounded-xl bg-slate-50/40">
<p class="font-bold text-slate-600 text-[11px]">Mengetahui,</p>
<div class="py-6">
<span class="text-[10px] text-slate-300 italic">(Tanda Tangan)</span>
</div>
<div>
<p class="font-bold text-slate-900 border-t border-slate-300 pt-1">
( .................................... )
</p>
<p class="text-[10px] text-slate-400">Superintendent QMA</p>
<p class="text-[11px] text-slate-500 font-medium">Admin QMA</p>
</div>
</div>
</div>
+217 -71
View File
@@ -61,8 +61,46 @@
</div>
<!-- Kotak Pencarian & Filter Kategori Alat Berat -->
<!-- Top Banner jika sedang melihat unit dalam tipe tertentu -->
@if(isset($selectedType) && $selectedType)
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 p-4 bg-emerald-50/80 border border-emerald-200 rounded-2xl shadow-2xs">
<div class="flex items-center space-x-3">
<a href="{{ route('qma.vehicles.support') }}" class="px-3.5 py-2 rounded-xl bg-white border border-emerald-300 hover:bg-emerald-100/60 text-[#1b5e20] text-xs font-bold transition flex items-center gap-1.5 shadow-2xs">
<i class="fa-solid fa-arrow-left text-[11px]"></i>
<span>Semua Tipe Alat</span>
</a>
<div>
<h3 class="text-sm sm:text-base font-extrabold text-slate-900 flex items-center gap-2">
<span>Tipe: {{ $selectedType }}</span>
<span class="px-2 py-0.5 rounded-full text-[10px] font-bold bg-emerald-600 text-white">{{ $totalUnitsOfType ?? $typeUnits->total() }} Unit Fisik</span>
</h3>
<p class="text-[11px] text-emerald-800 font-medium mt-0.5">
Daftar unit alat berat spesifik di bawah tipe {{ $selectedType }}.
</p>
</div>
</div>
<div class="flex flex-wrap items-center gap-1.5 text-[11px]">
<span class="px-2.5 py-1 rounded-lg font-bold bg-emerald-100 text-emerald-800 border border-emerald-200">
{{ $opCount ?? 0 }} Operation
</span>
<span class="px-2.5 py-1 rounded-lg font-bold bg-amber-100 text-amber-800 border border-amber-200">
{{ $stCount ?? 0 }} Standby
</span>
<span class="px-2.5 py-1 rounded-lg font-bold bg-rose-100 text-rose-800 border border-rose-200">
{{ $bdCount ?? 0 }} Breakdown
</span>
<span class="px-2.5 py-1 rounded-lg font-bold bg-blue-100 text-blue-800 border border-blue-200">
{{ $insideCount ?? 0 }} Site / {{ $outsideCount ?? 0 }} Luar
</span>
</div>
</div>
@endif
<!-- Kotak Pencarian & Filter Alat Berat -->
<form method="GET" action="{{ route('qma.vehicles.support') }}" id="supportFilterForm" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
@if(isset($selectedType) && $selectedType)
<input type="hidden" name="type" value="{{ $selectedType }}">
@endif
<div class="relative w-full max-w-sm sm:max-w-md">
<span class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
<i class="fa-solid fa-magnifying-glass text-xs"></i>
@@ -71,18 +109,33 @@
id="supportSearchInput"
name="search"
value="{{ request('search') }}"
placeholder="Cari kode unit, model, tipe, lokasi, dokumen..."
placeholder="{{ isset($selectedType) && $selectedType ? 'Cari kode unit, seri, model, lokasi di ' . $selectedType . '...' : 'Cari tipe alat berat (Boomlift, Excavator, Dump Truck)...' }}"
class="w-full text-xs pl-10 pr-4 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-emerald-600 focus:ring-2 focus:ring-emerald-600/10 shadow-sm transition">
</div>
<div class="flex flex-wrap items-center gap-2">
@if(!isset($selectedType) || !$selectedType)
<!-- Filter Kategori Alat Berat -->
<select name="unit_category" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20]">
<option value="">Semua Kategori Alat</option>
<option value="">Semua Kategori (Handling, Support, Hauling...)</option>
@foreach($availableCategories as $cat)
<option value="{{ $cat }}" {{ request('unit_category') === $cat ? 'selected' : '' }}>{{ $cat }}</option>
@endforeach
</select>
@else
<!-- Filter Status Operasional untuk Drilldown Unit -->
<select name="status" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20]">
<option value="">Semua Status Operasi</option>
<option value="Operation" {{ request('status') === 'Operation' ? 'selected' : '' }}>Operation</option>
<option value="Standby" {{ request('status') === 'Standby' ? 'selected' : '' }}>Standby</option>
<option value="Breakdown" {{ request('status') === 'Breakdown' ? 'selected' : '' }}>Breakdown</option>
</select>
<select name="site_status" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20]">
<option value="">Semua Area</option>
<option value="inside_site" {{ request('site_status') === 'inside_site' ? 'selected' : '' }}>Di Dalam Site</option>
<option value="outside_site" {{ request('site_status') === 'outside_site' ? 'selected' : '' }}>Di Luar Site</option>
</select>
@endif
<!-- Filter Jumlah Per Halaman -->
<select name="per_page" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20]">
@@ -96,8 +149,8 @@
</button>
<div id="supportResetWrapper" class="flex items-center">
@if(request()->anyFilled(['search', 'unit_category', 'per_page']))
<a id="supportResetBtn" href="{{ route('qma.vehicles.support') }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1">
@if(request()->anyFilled(['search', 'unit_category', 'status', 'site_status', 'per_page']))
<a id="supportResetBtn" href="{{ isset($selectedType) && $selectedType ? route('qma.vehicles.support', ['type' => $selectedType]) : route('qma.vehicles.support') }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1">
<i class="fa-solid fa-rotate-left"></i>
<span>Reset</span>
</a>
@@ -106,19 +159,125 @@
</div>
</form>
<!-- Tabel Data Kategori Heavy Equipment (Header Navy Solid #06213f) -->
<!-- Tabel Data Heavy Equipment (Header Navy Solid #06213f) -->
<div class="bg-white rounded-none sm:rounded-2xl border border-slate-200 shadow-sm overflow-hidden">
<div class="overflow-x-auto">
@if(isset($selectedType) && $selectedType)
<!-- TABEL 1: DAFTAR UNIT FISIK SPESIFIK TIPE INI -->
<table class="min-w-full text-xs text-left border-collapse">
<thead class="bg-[#06213f] text-white font-bold text-[11px] uppercase tracking-wider">
<tr>
<th class="py-3.5 px-4 text-center w-12">NO</th>
<th class="py-3.5 px-4">KODE KATEGORI</th>
<th class="py-3.5 px-4">KATEGORI ALAT</th>
<th class="py-3.5 px-4 text-center">JUMLAH (QTY)</th>
<th class="py-3.5 px-4">KODE UNIT</th>
<th class="py-3.5 px-4">MEREK & MODEL</th>
<th class="py-3.5 px-4">SPESIFIKASI</th>
<th class="py-3.5 px-4">DIVISI & KEPEMILIKAN</th>
<th class="py-3.5 px-4">NO. SERI / RANGKA</th>
<th class="py-3.5 px-4 text-center">TAHUN</th>
<th class="py-3.5 px-4">LOKASI SAAT INI</th>
<th class="py-3.5 px-4 text-center">AREA</th>
<th class="py-3.5 px-4 text-center">STATUS</th>
<th class="py-3.5 px-4 text-center">AKSI</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 text-slate-700 bg-white">
@forelse($typeUnits as $index => $u)
<tr class="hover:bg-slate-50/70 transition">
<td class="py-3.5 px-4 text-center font-medium text-slate-400">
{{ $typeUnits->firstItem() + $index }}
</td>
<td class="py-3.5 px-4 font-bold text-slate-900 font-mono text-xs whitespace-nowrap">
<span class="bg-blue-50 text-blue-800 px-2.5 py-1 rounded border border-blue-200">
{{ $u->code }}
</span>
</td>
<td class="py-3.5 px-4">
<div class="font-bold text-slate-900">{{ $u->brand_type ?: ($u->brand ?: '-') }}</div>
@if($u->model_number)
<div class="text-[10px] text-slate-400 font-mono mt-0.5">Model: {{ $u->model_number }}</div>
@endif
</td>
<td class="py-3.5 px-4 font-mono text-slate-600">
{{ $u->serial_number ?: '-' }}
</td>
<td class="py-3.5 px-4 text-center text-slate-600">
{{ $u->production_year ?: '-' }}
</td>
<td class="py-3.5 px-4 font-semibold text-slate-800">
<div class="flex items-center space-x-1">
<i class="fa-solid fa-location-dot text-emerald-600 text-[10px]"></i>
<span>{{ $u->location ?: 'Site Kerinci' }}</span>
</div>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
<span class="px-2 py-0.5 rounded text-[10px] font-bold {{ $u->isOutsideSite() ? 'bg-amber-50 text-amber-800 border border-amber-200' : 'bg-emerald-50 text-emerald-800 border border-emerald-200' }}">
{{ $u->site_status_label }}
</span>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
@if($u->status === 'Operation')
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-emerald-50 text-emerald-700 border border-emerald-200">
Operation
</span>
@elseif($u->status === 'Standby')
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-50 text-amber-700 border border-amber-200">
Standby
</span>
@elseif($u->status === 'Breakdown')
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-rose-50 text-rose-700 border border-rose-200">
Breakdown
</span>
@else
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-medium bg-slate-100 text-slate-600">
{{ $u->status }}
</span>
@endif
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
<div class="flex items-center justify-center space-x-1.5">
<button onclick='openDetailModal(@json($u))'
class="inline-flex items-center space-x-1 text-slate-600 hover:text-slate-900 hover:bg-slate-100 px-2 py-1 rounded-lg transition"
title="Lihat Detail Unit">
<i class="fa-regular fa-eye text-sm"></i>
</button>
@can('qma.vehicles.edit')
<button onclick='openEditModal(@json($u))'
class="inline-flex items-center space-x-1 text-amber-600 hover:text-amber-800 hover:bg-amber-50 px-2 py-1 rounded-lg transition"
title="Edit Data Unit">
<i class="fa-regular fa-pen-to-square text-sm"></i>
</button>
@endcan
@can('qma.vehicles.delete')
<button type="button"
onclick="openDeleteModal('{{ $u->id }}', '{{ $u->code }}', '{{ addslashes($u->brand_type ?? '') }}')"
class="inline-flex items-center space-x-1 text-rose-600 hover:text-rose-800 hover:bg-rose-50 px-2 py-1 rounded-lg transition"
title="Hapus Unit">
<i class="fa-regular fa-trash-can text-sm"></i>
</button>
@endcan
</div>
</td>
</tr>
@empty
<tr>
<td colspan="9" class="py-12 text-center text-slate-400">
<i class="fa-solid fa-magnifying-glass text-3xl mb-3 block text-slate-300"></i>
<p class="text-sm font-semibold text-slate-700">Tidak ada unit fisik untuk tipe {{ $selectedType }}</p>
<p class="text-xs text-slate-400 mt-1">Belum ada unit terdaftar atau sesuai kriteria filter.</p>
</td>
</tr>
@endforelse
</tbody>
</table>
@else
<!-- TABEL 2: PENGELOMPOKAN BERDASARKAN TIPE HEAVY EQUIPMENT -->
<table class="min-w-full text-xs text-left border-collapse">
<thead class="bg-[#06213f] text-white font-bold text-[11px] uppercase tracking-wider">
<tr>
<th class="py-3.5 px-4 text-center w-12">NO</th>
<th class="py-3.5 px-4">TIPE ALAT BERAT</th>
<th class="py-3.5 px-4">KATEGORI</th>
<th class="py-3.5 px-4 text-center">JUMLAH (QTY)</th>
<th class="py-3.5 px-4">STATUS OPERASIONAL</th>
<th class="py-3.5 px-4">DISTRIBUSI AREA</th>
<th class="py-3.5 px-4 text-center">AKSI</th>
</tr>
</thead>
@@ -129,84 +288,66 @@
{{ $vehicles->firstItem() + $index }}
</td>
<td class="py-3.5 px-4 font-bold text-slate-900 font-mono text-xs whitespace-nowrap">
<span class="bg-blue-50 text-blue-800 px-2.5 py-1 rounded border border-blue-200">
{{ $v->code }}
</span>
<td class="py-3.5 px-4 font-bold text-slate-900 text-xs whitespace-nowrap">
<a href="{{ route('qma.vehicles.support', ['type' => $v->unit_type]) }}" class="hover:text-[#1b5e20] transition flex items-center space-x-2.5">
<div class="w-8 h-8 rounded-lg bg-emerald-50 text-emerald-800 border border-emerald-200 flex items-center justify-center flex-shrink-0">
<i class="fa-solid fa-truck-monster text-xs"></i>
</div>
<div>
<span class="font-extrabold text-slate-900 block text-xs">{{ $v->unit_type }}</span>
@if(isset($v->sample_brand_type) && $v->sample_brand_type)
<span class="text-[10px] text-slate-400 font-normal block">{{ $v->sample_brand_type }}</span>
@endif
</div>
</a>
</td>
<td class="py-3.5 px-4 whitespace-nowrap">
<div class="flex items-center space-x-3">
@if($v->photo_path)
<img src="{{ $v->photo_url }}" alt="{{ $v->code }}" class="w-9 h-9 rounded-lg object-cover border border-slate-200 shadow-2xs flex-shrink-0 cursor-pointer" onclick='openDetailModal(@json($v))'>
@else
<div class="w-9 h-9 rounded-lg bg-slate-100 border border-slate-200 flex items-center justify-center text-slate-400 flex-shrink-0">
<i class="fa-solid fa-truck-monster text-xs"></i>
</div>
@endif
<div>
<span class="font-bold text-slate-900 block text-xs">{{ $v->unit_category ?? 'Alat Berat' }}</span>
</div>
</div>
<span class="px-2.5 py-1 rounded-md text-[10px] font-bold bg-slate-100 text-slate-700 border border-slate-200 uppercase tracking-wider">
{{ $v->unit_category ?? 'SUPPORT' }}
</span>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
<a href="{{ route('qma.vehicles.support.units', $v->id) }}"
class="inline-flex items-center space-x-1.5 px-3.5 py-1.5 rounded-full text-xs font-bold bg-[#e8f8f0] text-[#00897b] border border-[#a7f3d0] hover:bg-[#d1fae5] transition shadow-2xs group cursor-pointer"
title="Buka daftar {{ $v->units_count ?? 0 }} unit fisik">
<a href="{{ route('qma.vehicles.support', ['type' => $v->unit_type]) }}"
class="inline-flex items-center space-x-1.5 px-3 py-1.5 rounded-full text-xs font-bold bg-[#e8f8f0] text-[#00897b] border border-[#a7f3d0] hover:bg-[#d1fae5] transition shadow-2xs group cursor-pointer"
title="Buka daftar {{ $v->units_count ?? 0 }} unit fisik tipe {{ $v->unit_type }}">
<span>{{ $v->units_count ?? 0 }} Unit</span>
<i class="fa-solid fa-chevron-right text-[10px] ml-1 transition group-hover:translate-x-0.5"></i>
</a>
</td>
<td class="py-3.5 px-4">
<div class="font-bold text-slate-900">{{ $v->brand_type }}</div>
@if($v->model_number)
<div class="text-[10px] text-slate-500 font-mono mt-0.5">Model: {{ $v->model_number }}</div>
@endif
<div class="flex items-center space-x-2 text-[10px] font-bold">
<span class="text-emerald-700 bg-emerald-50 px-2 py-0.5 rounded border border-emerald-200">
{{ $v->total_operation ?? 0 }} Operasi
</span>
<span class="text-amber-700 bg-amber-50 px-2 py-0.5 rounded border border-amber-200">
{{ $v->total_standby ?? 0 }} Standby
</span>
<span class="text-rose-700 bg-rose-50 px-2 py-0.5 rounded border border-rose-200">
{{ $v->total_breakdown ?? 0 }} Breakdown
</span>
</div>
</td>
<td class="py-3.5 px-4 text-slate-700">
@if($v->unit_type)
<span class="font-medium text-xs">{{ $v->unit_type }}</span>
@else
<span class="text-slate-300">-</span>
@endif
</td>
<td class="py-3.5 px-4 text-slate-600">
<div class="font-medium text-slate-800">{{ $v->division ?? '-' }}</div>
<span class="text-[10px] text-slate-400 block">{{ $v->ownership ?? 'PT Kerinci Merangin Hidro' }}</span>
<td class="py-3.5 px-4 text-slate-600 text-[11px]">
<span class="font-medium text-emerald-800">{{ $v->inside_site_count ?? 0 }} Di Dalam Site</span>
<span class="text-slate-300 mx-1">&bull;</span>
<span class="text-slate-500">{{ $v->outside_site_count ?? 0 }} Di Luar Site</span>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
<div class="flex items-center justify-center space-x-1.5">
<button onclick='openDetailModal(@json($v))'
class="inline-flex items-center space-x-1 text-slate-600 hover:text-slate-900 hover:bg-slate-100 px-2 py-1 rounded-lg transition"
title="Lihat Spesifikasi Kategori">
<i class="fa-regular fa-eye text-sm"></i>
</button>
@can('qma.vehicles.edit')
<button onclick='openEditModal(@json($v))'
class="inline-flex items-center space-x-1 text-amber-600 hover:text-amber-800 hover:bg-amber-50 px-2 py-1 rounded-lg transition"
title="Edit Data Kategori">
<i class="fa-regular fa-pen-to-square text-sm"></i>
</button>
@endcan
@can('qma.vehicles.delete')
<button type="button"
onclick="openDeleteModal('{{ $v->id }}', '{{ $v->code }}', '{{ addslashes($v->brand_type ?? '') }}')"
class="inline-flex items-center space-x-1 text-rose-600 hover:text-rose-800 hover:bg-rose-50 px-2 py-1 rounded-lg transition"
title="Hapus Kategori / Unit">
<i class="fa-regular fa-trash-can text-sm"></i>
</button>
@endcan
</div>
<a href="{{ route('qma.vehicles.support', ['type' => $v->unit_type]) }}"
class="inline-flex items-center space-x-1.5 px-3 py-1.5 bg-[#1b5e20] hover:bg-[#144919] text-white rounded-xl text-xs font-bold transition shadow-2xs">
<i class="fa-regular fa-folder-open text-xs"></i>
<span>Buka Unit</span>
</a>
</td>
</tr>
@empty
<tr id="serverSupportEmptyRow">
<td colspan="8" class="py-12 text-center text-slate-400">
<td colspan="7" class="py-12 text-center text-slate-400">
<i class="fa-solid fa-magnifying-glass text-3xl mb-3 block text-slate-300"></i>
@if(request('search'))
<p class="text-sm font-semibold text-slate-700">
@@ -222,18 +363,23 @@
</a>
</div>
@else
<p class="text-sm font-semibold text-slate-700">Belum ada unit alat berat</p>
<p class="text-xs text-slate-400 mt-0.5">Belum ada unit alat berat yang sesuai dengan filter.</p>
<p class="text-sm font-semibold text-slate-700">Belum ada tipe alat berat</p>
<p class="text-xs text-slate-400 mt-0.5">Belum ada tipe alat berat yang sesuai dengan filter.</p>
@endif
</td>
</tr>
@endforelse
</tbody>
</table>
@endif
</div>
<div id="supportPaginationContainer" class="p-4 bg-slate-50 border-t border-slate-200">
{{ $vehicles->links() }}
@if(isset($selectedType) && $selectedType)
{{ $typeUnits->links() }}
@else
{{ $vehicles->links() }}
@endif
</div>
</div>
</div>