feat: fix HSE simper 500 error, enhance PG rejection, P2H wizard, simper renewal, QMA table UI, and nginx upload timeouts

This commit is contained in:
Ray1111-aa
2026-11-01 21:26:22 +07:00
parent bc6213d864
commit b83a8fa843
12 changed files with 1020 additions and 170 deletions
@@ -1012,6 +1012,7 @@
const xhr = new XMLHttpRequest();
xhr.open('POST', form.action, true);
xhr.timeout = 600000; // 10 Menit timeout untuk berkas backup besar
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.upload.onprogress = function(e) {
@@ -1074,6 +1075,18 @@
document.getElementById('directRestoreError').classList.remove('hidden');
};
xhr.ontimeout = function() {
loading.classList.add('hidden');
document.getElementById('directRestoreDropzoneContainer').classList.remove('hidden');
if (btn) {
btn.disabled = false;
btn.classList.remove('opacity-75', 'cursor-not-allowed');
}
if (text) text.textContent = 'Mulai Pemulihan Sistem';
document.getElementById('directRestoreErrorMessage').textContent = 'Waktu pengunggahan habis (Timeout 10 Menit). Silakan periksa kestabilan jaringan internet Anda.';
document.getElementById('directRestoreError').classList.remove('hidden');
};
xhr.send(formData);
return false;
}
@@ -1239,6 +1252,7 @@
const xhr = new XMLHttpRequest();
xhr.open('POST', `{{ route('admin.backups.converter.inspect') }}`, true);
xhr.timeout = 600000; // 10 Menit timeout
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.setRequestHeader('Accept', 'application/json');
@@ -1314,6 +1328,12 @@
showConverterError('Koneksi terputus saat mengunggah berkas.');
};
xhr.ontimeout = function() {
loading.classList.add('hidden');
document.getElementById('panelConverterUpload').classList.remove('hidden');
showConverterError('Waktu pengunggahan habis (Timeout 10 Menit). Silakan periksa kestabilan jaringan internet Anda.');
};
xhr.send(formData);
}
+15 -2
View File
@@ -242,9 +242,11 @@
</label>
<input type="text"
name="simper_assignments[{{ $st->id }}][simper_number]"
id="inputSimperNum_{{ $st->id }}"
value="{{ $simperNum }}"
{{ $isChecked ? '' : 'disabled' }}
placeholder="Contoh: SMP-LV-001"
class="w-full text-xs px-3 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono font-bold focus:outline-none focus:border-emerald-600">
class="w-full text-xs px-3 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono font-bold focus:outline-none focus:border-emerald-600 disabled:opacity-50 disabled:bg-slate-100">
</div>
<div>
<label class="block text-[11px] font-bold text-slate-600 mb-1">
@@ -252,8 +254,10 @@
</label>
<input type="date"
name="simper_assignments[{{ $st->id }}][expired_at]"
id="inputSimperExp_{{ $st->id }}"
value="{{ $simperExp }}"
class="w-full text-xs px-3 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-emerald-600">
{{ $isChecked ? '' : 'disabled' }}
class="w-full text-xs px-3 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-emerald-600 disabled:opacity-50 disabled:bg-slate-100">
</div>
</div>
</div>
@@ -359,11 +363,20 @@
function toggleSimperRow(id) {
const chk = document.getElementById(`chkSimper_${id}`);
const fields = document.getElementById(`fieldsSimper_${id}`);
const numInp = document.getElementById(`inputSimperNum_${id}`);
const expInp = document.getElementById(`inputSimperExp_${id}`);
if (chk && fields) {
if (chk.checked) {
fields.classList.remove('hidden');
if (numInp) numInp.disabled = false;
if (expInp) expInp.disabled = false;
} else {
fields.classList.add('hidden');
if (numInp) numInp.disabled = true;
if (expInp) {
expInp.disabled = true;
expInp.value = '';
}
}
}
}
+178 -34
View File
@@ -281,7 +281,7 @@
<i class="fa-solid fa-up-right-from-square text-[11px]"></i>
</a>
<span class="text-slate-200">|</span>
<button onclick="openRenewModal({{ $emp->id }}, '{{ addslashes($emp->name) }}', '{{ $emp->simper_expired_at ? $emp->simper_expired_at->format('Y-m-d') : '' }}', {{ $emp->is_operator ? '1' : '0' }})"
<button onclick='openRenewModal(@json($emp))'
class="text-emerald-700 hover:text-emerald-900 font-bold underline text-[11px] px-1 cursor-pointer"
title="Perpanjang Masa Berlaku SIMPER">
Perpanjang
@@ -633,43 +633,81 @@
</div>
</div>
<!-- Modal Dialog Perpanjang SIMPER (Clean White Card) -->
<!-- Modal Dialog Perpanjang SIMPER (Clean White Card dengan Dukungan Multi-SIMPER) -->
<div id="renewModal" data-backdrop="static" class="hidden fixed inset-0 z-50 bg-slate-900/50 backdrop-blur-sm flex items-center justify-center p-4">
<div class="bg-white rounded-3xl shadow-2xl max-w-md w-full p-7 border border-slate-100 overflow-hidden">
<div class="bg-white rounded-3xl shadow-2xl max-w-md w-full p-6 sm:p-7 border border-slate-100 overflow-hidden animate-scale-in">
<div class="flex items-center justify-between pb-4 border-b border-slate-100">
<h3 class="text-xl font-bold text-slate-900 tracking-tight">Perpanjang SIMPER</h3>
<div>
<h3 class="text-lg font-bold text-slate-900 tracking-tight flex items-center gap-2">
<i class="fa-solid fa-id-card-clip text-emerald-700"></i>
<span>Perpanjang Masa Berlaku SIMPER</span>
</h3>
<p class="text-xs text-slate-500 mt-0.5">Pilih jenis SIMPER dan tentukan tanggal perpanjangan izin operasional.</p>
</div>
<button type="button" onclick="closeRenewModal()" class="text-slate-400 hover:text-slate-600 transition p-1">
<i class="fa-solid fa-xmark text-lg"></i>
</button>
</div>
<form id="renewForm" method="POST" action="" class="mt-5 space-y-4">
<form id="renewForm" method="POST" action="" class="mt-4 space-y-4">
@csrf
<div class="bg-slate-50 p-3.5 rounded-2xl border border-slate-200/80">
<span class="text-xs text-slate-400 block font-medium">Pengemudi:</span>
<strong id="renewName" class="block text-base text-slate-900 font-bold mt-0.5"></strong>
<!-- Identitas Driver -->
<div class="bg-slate-50 p-3.5 rounded-2xl border border-slate-200/80 flex items-center justify-between">
<div>
<span class="text-[10px] text-slate-400 block font-bold uppercase tracking-wider">Pengemudi / Operator:</span>
<strong id="renewName" class="block text-sm text-slate-900 font-bold mt-0.5"></strong>
<span id="renewNik" class="text-[11px] font-mono text-slate-500"></span>
</div>
<span class="px-2.5 py-1 rounded-xl text-xs font-bold bg-emerald-100 text-[#1b5e20] border border-emerald-200/80">
Driver Aktif
</span>
</div>
<!-- Status Driver (Hidden input default 1) -->
<input type="hidden" name="is_operator" id="renewOperator" value="1">
<!-- Dropdown Pilihan Jenis SIMPER -->
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Status Driver</label>
<select name="is_operator" id="renewOperator" onchange="toggleSimperInput('renew')"
class="w-full text-sm px-4 py-3 rounded-2xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
<option value="1">YA (Aktif Mengemudi)</option>
<option value="0">TIDAK (Bukan Driver)</option>
<label for="renewSimperTypeSelect" class="block text-xs font-bold text-slate-800 mb-1.5 flex items-center justify-between">
<span>Jenis SIMPER yang Diperpanjang <span class="text-rose-500">*</span></span>
<span id="renewSimperBadge" class="text-[10px] font-normal text-slate-400 font-mono"></span>
</label>
<select name="renew_simper_type_id" id="renewSimperTypeSelect" onchange="onRenewSimperTypeChange(this.value)" 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-2 focus:ring-[#1b5e20]/10 transition">
<!-- Dinamis via JavaScript -->
</select>
<p id="renewCurrentExpInfo" class="text-[11px] text-slate-500 mt-1.5 flex items-center gap-1 font-medium"></p>
</div>
<!-- Input Tanggal Kedaluwarsa Baru -->
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Masa Berlaku Baru <span class="text-rose-500">*</span></label>
<label for="renewDate" class="block text-xs font-bold text-slate-800 mb-1.5">
Masa Berlaku Baru <span class="text-rose-500">*</span>
</label>
<input type="date" name="simper_expired_at" id="renewDate" required
class="w-full text-sm px-4 py-3 rounded-2xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
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-2 focus:ring-[#1b5e20]/10 transition">
<!-- Quick Preset Buttons (+6 Bulan, +1 Tahun) -->
<div class="flex items-center gap-2 mt-2">
<span class="text-[10px] text-slate-400 font-bold uppercase tracking-wider">Pintas:</span>
<button type="button" onclick="setRenewDateOffset(6)" class="text-[11px] px-2.5 py-1 rounded-lg border border-slate-200 bg-slate-50 hover:bg-slate-100 text-slate-700 font-semibold transition cursor-pointer">
+6 Bulan
</button>
<button type="button" onclick="setRenewDateOffset(12)" class="text-[11px] px-2.5 py-1 rounded-lg border border-slate-200 bg-slate-50 hover:bg-slate-100 text-slate-700 font-semibold transition cursor-pointer">
+1 Tahun
</button>
</div>
</div>
<div class="pt-6 border-t border-slate-100 flex items-center justify-end space-x-3 mt-6">
<div class="pt-4 border-t border-slate-100 flex items-center justify-end space-x-2.5 mt-5">
<button type="button" onclick="closeRenewModal()"
class="px-6 py-2.5 rounded-xl border border-slate-300 bg-white hover:bg-slate-50 text-slate-700 font-bold text-sm transition">
class="px-4 py-2 rounded-xl border border-slate-300 bg-white hover:bg-slate-50 text-slate-700 font-bold text-xs transition">
Batal
</button>
<button type="submit"
class="px-6 py-2.5 rounded-xl bg-[#1b5e20] hover:bg-[#144919] text-white font-bold text-sm transition shadow-sm">
Simpan Data
class="px-5 py-2 rounded-xl bg-[#1b5e20] hover:bg-[#144919] text-white font-bold text-xs transition shadow-sm inline-flex items-center gap-1.5">
<i class="fa-solid fa-floppy-disk text-xs"></i>
<span>Simpan Perpanjangan</span>
</button>
</div>
</form>
@@ -1152,13 +1190,20 @@
function toggleEditSimperFields(id) {
const check = document.getElementById(`editSimperCheck_${id}`);
const fields = document.getElementById(`editSimperFields_${id}`);
const numInp = document.getElementById(`editSimperNum_${id}`);
const expInp = document.getElementById(`editSimperExp_${id}`);
if (check && fields) {
if (check.checked) {
fields.classList.remove('hidden');
if (numInp) numInp.disabled = false;
if (expInp) expInp.disabled = false;
} else {
fields.classList.add('hidden');
const expInp = document.getElementById(`editSimperExp_${id}`);
if (expInp) expInp.value = '';
if (numInp) numInp.disabled = true;
if (expInp) {
expInp.disabled = true;
expInp.value = '';
}
}
}
syncEditPrimarySimperDate();
@@ -1248,9 +1293,9 @@
const fields = document.getElementById(`editSimperFields_${id}`);
if (fields) fields.classList.add('hidden');
const num = document.getElementById(`editSimperNum_${id}`);
if (num) num.value = '';
if (num) { num.value = ''; num.disabled = true; }
const exp = document.getElementById(`editSimperExp_${id}`);
if (exp) exp.value = '';
if (exp) { exp.value = ''; exp.disabled = true; }
});
// Isi checklist SIMPER dari data emp.simpers
@@ -1263,8 +1308,8 @@
if (cb) {
cb.checked = true;
if (fields) fields.classList.remove('hidden');
if (num) num.value = s.simper_number || '';
if (exp && s.expired_at) exp.value = s.expired_at.substring(0, 10);
if (num) { num.value = s.simper_number || ''; num.disabled = false; }
if (exp && s.expired_at) { exp.value = s.expired_at.substring(0, 10); exp.disabled = false; }
}
});
} else if (emp.is_operator && expDate) {
@@ -1274,8 +1319,10 @@
const id = firstCb.id.replace('editSimperCheck_', '');
const fields = document.getElementById(`editSimperFields_${id}`);
if (fields) fields.classList.remove('hidden');
const num = document.getElementById(`editSimperNum_${id}`);
if (num) num.disabled = false;
const exp = document.getElementById(`editSimperExp_${id}`);
if (exp) exp.value = expDate;
if (exp) { exp.value = expDate; exp.disabled = false; }
}
}
syncEditPrimarySimperDate();
@@ -1327,21 +1374,118 @@
if (modal) modal.classList.add('hidden');
}
function openRenewModal(id, name, expiredDate, isOperator) {
document.getElementById('renewName').textContent = name;
document.getElementById('renewOperator').value = isOperator ? '1' : '0';
document.getElementById('renewDate').value = expiredDate;
// Cek status driver untuk mengunci/membuka input SIMPER
toggleSimperInput('renew');
let currentRenewEmployee = null;
document.getElementById('renewForm').action = `/hse/employees/${id}`;
function openRenewModal(empOrId, legacyName, legacyDate, legacyIsOp) {
let emp = null;
if (typeof empOrId === 'object' && empOrId !== null) {
emp = empOrId;
} else {
emp = {
id: empOrId,
name: legacyName || '',
nik: '',
is_operator: legacyIsOp ? 1 : 0,
simper_expired_at: legacyDate || '',
simpers: []
};
}
currentRenewEmployee = emp;
document.getElementById('renewName').textContent = emp.name || '-';
document.getElementById('renewNik').textContent = emp.nik ? `NIK: ${emp.nik}` : '';
document.getElementById('renewOperator').value = '1';
const select = document.getElementById('renewSimperTypeSelect');
const badge = document.getElementById('renewSimperBadge');
select.innerHTML = '';
const simpers = Array.isArray(emp.simpers) ? emp.simpers : [];
const simperCount = simpers.length;
if (simperCount > 1) {
badge.textContent = `${simperCount} Izin SIMPER`;
// Opsi Semua SIMPER Sekaligus
const allOpt = document.createElement('option');
allOpt.value = 'all';
allOpt.textContent = '★ Perpanjang Semua Jenis SIMPER Sekaligus';
select.appendChild(allOpt);
simpers.forEach(s => {
const opt = document.createElement('option');
opt.value = s.simper_type_id;
const typeName = s.simper_type ? s.simper_type.name : `SIMPER ID #${s.simper_type_id}`;
const expText = s.expired_at ? s.expired_at.substring(0, 10) : 'Belum diatur';
opt.textContent = `${typeName} (s/d ${expText})`;
opt.dataset.exp = s.expired_at ? s.expired_at.substring(0, 10) : '';
select.appendChild(opt);
});
} else if (simperCount === 1) {
badge.textContent = '1 Izin SIMPER';
const s = simpers[0];
const opt = document.createElement('option');
opt.value = s.simper_type_id;
const typeName = s.simper_type ? s.simper_type.name : 'SIMPER';
const expText = s.expired_at ? s.expired_at.substring(0, 10) : 'Belum diatur';
opt.textContent = `${typeName} (Masa berlaku saat ini: ${expText})`;
opt.dataset.exp = s.expired_at ? s.expired_at.substring(0, 10) : '';
select.appendChild(opt);
} else {
badge.textContent = 'Belum Ada SIMPER';
const opt = document.createElement('option');
opt.value = 'all';
opt.textContent = 'SIMPER Standar / Default (Semua)';
select.appendChild(opt);
}
// Sinkronisasi tanggal
onRenewSimperTypeChange(select.value);
document.getElementById('renewForm').action = `/hse/employees/${emp.id}`;
document.getElementById('renewModal').classList.remove('hidden');
}
function onRenewSimperTypeChange(val) {
const select = document.getElementById('renewSimperTypeSelect');
const selectedOpt = select.options[select.selectedIndex];
const infoEl = document.getElementById('renewCurrentExpInfo');
const dateInput = document.getElementById('renewDate');
let currentExp = '';
if (selectedOpt && selectedOpt.dataset.exp) {
currentExp = selectedOpt.dataset.exp;
} else if (currentRenewEmployee && currentRenewEmployee.simper_expired_at) {
currentExp = currentRenewEmployee.simper_expired_at.substring(0, 10);
}
if (currentExp) {
infoEl.innerHTML = `<i class="fa-regular fa-clock text-slate-400"></i> Masa berlaku saat ini: <strong class="text-slate-700">${currentExp}</strong>`;
// Preset tanggal baru: 1 tahun dari masa berlaku sekarang (jika masa depan) atau 1 tahun dari hari ini
const currDateObj = new Date(currentExp);
const today = new Date();
const targetBase = (!isNaN(currDateObj) && currDateObj > today) ? currDateObj : today;
const newDate = new Date(targetBase);
newDate.setFullYear(newDate.getFullYear() + 1);
dateInput.value = newDate.toISOString().substring(0, 10);
} else {
infoEl.innerHTML = `<i class="fa-solid fa-circle-info text-amber-500"></i> Belum ada masa berlaku sebelumnya.`;
const now = new Date();
now.setFullYear(now.getFullYear() + 1);
dateInput.value = now.toISOString().substring(0, 10);
}
}
function setRenewDateOffset(months) {
const dateInput = document.getElementById('renewDate');
const now = new Date();
now.setMonth(now.getMonth() + months);
dateInput.value = now.toISOString().substring(0, 10);
}
function closeRenewModal() {
const modal = document.getElementById('renewModal');
if (modal) modal.classList.add('hidden');
currentRenewEmployee = null;
}
function openDeleteEmployeeModal(id, name, nik) {
+133 -24
View File
@@ -165,8 +165,13 @@
onclick="switchP2hSection('{{ $secKey }}')"
id="p2h-tab-{{ $secKey }}"
data-section-key="{{ $secKey }}"
class="p2h-section-tab group inline-flex items-center px-4 py-2.5 rounded-xl text-xs font-bold transition whitespace-nowrap cursor-pointer shrink-0 {{ $isFirst ? 'bg-[#1b5e20] text-white shadow-xs border border-[#1b5e20]' : 'bg-white border border-slate-200 text-slate-700 hover:bg-slate-50 hover:border-slate-300' }}">
data-section-index="{{ $loop->index }}"
class="p2h-section-tab group inline-flex items-center space-x-1.5 px-4 py-2.5 rounded-xl text-xs font-bold transition whitespace-nowrap cursor-pointer shrink-0 {{ $isFirst ? 'bg-[#1b5e20] text-white shadow-xs border border-[#1b5e20]' : 'bg-white border border-slate-200 text-slate-700 hover:bg-slate-50 hover:border-slate-300' }}">
<span class="step-num text-[10px] font-mono opacity-80">#{{ $loop->iteration }}</span>
<span>{{ $sectionName }}</span>
<span id="tab-check-{{ $secKey }}" class="tab-check-icon hidden text-emerald-400 font-black">
<i class="fa-solid fa-circle-check text-[11px]"></i>
</span>
</button>
@endforeach
</div>
@@ -289,15 +294,15 @@
@endforeach
</div>
<!-- Navigasi Cepat Antar Section (Sebelumnya & Selanjutnya) -->
<!-- Navigasi Wizard Bertahap Antar Section -->
@if(count($groupedItems) > 1)
<div class="px-4 py-3 bg-slate-50/80 border-t border-slate-100 flex items-center justify-between">
@if($prevKey)
<button type="button"
onclick="switchP2hSection('{{ $prevKey }}')"
class="inline-flex items-center space-x-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold text-slate-600 hover:text-slate-900 bg-white border border-slate-200 hover:bg-slate-100 transition shadow-2xs cursor-pointer">
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-slate-600 hover:text-slate-900 bg-white border border-slate-200 hover:bg-slate-100 transition shadow-2xs cursor-pointer">
<i class="fa-solid fa-chevron-left text-[10px]"></i>
<span>Bagian Sebelumnya</span>
<span>Kembali</span>
</button>
@else
<div></div>
@@ -305,15 +310,18 @@
@if($nextKey)
<button type="button"
onclick="switchP2hSection('{{ $nextKey }}')"
class="inline-flex items-center space-x-1.5 px-3 py-1.5 rounded-lg text-xs font-bold text-emerald-800 bg-emerald-50 hover:bg-emerald-100 border border-emerald-200 transition shadow-2xs cursor-pointer">
<span>Bagian Selanjutnya</span>
onclick="completeAndNextSection('{{ $secKey }}', '{{ $nextKey }}')"
class="inline-flex items-center space-x-1.5 px-4 py-2 rounded-xl text-xs font-bold text-white bg-[#1b5e20] hover:bg-[#144918] transition shadow-xs cursor-pointer">
<span>Selesaikan Bagian Ini & Lanjut</span>
<i class="fa-solid fa-chevron-right text-[10px]"></i>
</button>
@else
<span class="text-[11px] font-semibold text-slate-400 flex items-center">
<i class="fa-solid fa-flag-checkered mr-1.5 text-emerald-600"></i> Bagian Terakhir
</span>
<button type="button"
onclick="markLastSectionComplete('{{ $secKey }}')"
class="inline-flex items-center space-x-1.5 px-4 py-2 rounded-xl text-xs font-bold text-emerald-800 bg-emerald-100 hover:bg-emerald-200 border border-emerald-300 transition shadow-xs cursor-pointer">
<i class="fa-solid fa-circle-check text-xs"></i>
<span>Selesaikan Pemeriksaan Bagian Terakhir</span>
</button>
@endif
</div>
@endif
@@ -330,18 +338,29 @@
<textarea name="general_notes" id="general_notes" rows="3" placeholder="Tuliskan temuan atau catatan umum lainnya mengenai kondisi Heavy Equipment hari ini..." class="w-full rounded-xl border border-slate-300 bg-white px-3.5 py-2.5 text-xs text-slate-800 focus:border-emerald-500 focus:ring-4 focus:ring-emerald-500/10 transition resize-none">{{ old('general_notes') }}</textarea>
</div>
<!-- Tombol Aksi Submit -->
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 p-4 sm:p-5 flex items-center justify-between gap-3">
<a href="{{ route('p2h.index') }}" class="bg-slate-100 hover:bg-slate-200 text-slate-600 font-semibold py-2.5 px-4 rounded-xl transition text-xs">
Batal
</a>
<!-- Card Tombol Aksi Submit P2H (Aktif Setelah Seluruh Bagian Ditinjau) -->
<div id="p2hSubmitCard" class="bg-white rounded-2xl shadow-sm border border-slate-200 p-4 sm:p-5 transition-all">
<div id="p2hPendingNotice" class="{{ count($groupedItems) > 1 ? '' : 'hidden' }} flex items-center justify-between text-xs text-amber-800 bg-amber-50 border border-amber-200 rounded-xl p-3 mb-3">
<div class="flex items-center gap-2">
<i class="fa-solid fa-circle-info text-amber-600 text-sm"></i>
<span>Harap selesaikan pemeriksaan pada seluruh bagian (section) di atas untuk memunculkan tombol pengiriman formulir P2H ke QMA.</span>
</div>
</div>
<button type="submit"
id="btnSubmitP2h"
class="bg-[#1b5e20] hover:bg-[#144918] active:scale-[0.99] text-white font-bold py-2.5 px-6 rounded-xl shadow-sm hover:shadow transition flex items-center space-x-2 text-xs sm:text-sm cursor-pointer">
<i class="fa-solid fa-paper-plane text-xs"></i>
<span>Kirim Formulir P2H ke QMA</span>
</button>
<div class="flex items-center justify-between gap-3">
<a href="{{ route('p2h.index') }}" class="bg-slate-100 hover:bg-slate-200 text-slate-600 font-semibold py-2.5 px-4 rounded-xl transition text-xs">
Batal
</a>
<div id="p2hSubmitBtnContainer" class="{{ count($groupedItems) > 1 ? 'hidden' : '' }}">
<button type="submit"
id="btnSubmitP2h"
class="bg-[#1b5e20] hover:bg-[#144918] active:scale-[0.99] text-white font-bold py-2.5 px-6 rounded-xl shadow-sm hover:shadow transition flex items-center space-x-2 text-xs sm:text-sm cursor-pointer">
<i class="fa-solid fa-paper-plane text-xs"></i>
<span>Kirim Formulir P2H ke QMA</span>
</button>
</div>
</div>
</div>
</form>
</div>
@@ -349,20 +368,26 @@
@section('scripts')
<script>
const allSectionKeys = @json($sectionKeys);
const completedSections = {};
function switchP2hSection(secKey) {
// 1. Update tab styling
const allTabs = document.querySelectorAll('.p2h-section-tab');
allTabs.forEach(tab => {
const key = tab.dataset.sectionKey;
const isCompleted = !!completedSections[key];
if (key === secKey) {
tab.className = 'p2h-section-tab group inline-flex items-center px-4 py-2.5 rounded-xl text-xs font-bold transition whitespace-nowrap cursor-pointer shrink-0 bg-[#1b5e20] text-white shadow-xs border border-[#1b5e20]';
tab.className = 'p2h-section-tab group inline-flex items-center space-x-1.5 px-4 py-2.5 rounded-xl text-xs font-bold transition whitespace-nowrap cursor-pointer shrink-0 bg-[#1b5e20] text-white shadow-xs border border-[#1b5e20]';
tab.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });
} else if (isCompleted) {
tab.className = 'p2h-section-tab group inline-flex items-center space-x-1.5 px-4 py-2.5 rounded-xl text-xs font-bold transition whitespace-nowrap cursor-pointer shrink-0 bg-emerald-50 border border-emerald-200 text-emerald-800 hover:bg-emerald-100';
} else {
tab.className = 'p2h-section-tab group inline-flex items-center px-4 py-2.5 rounded-xl text-xs font-bold transition whitespace-nowrap cursor-pointer shrink-0 bg-white border border-slate-200 text-slate-700 hover:bg-slate-50 hover:border-slate-300';
tab.className = 'p2h-section-tab group inline-flex items-center space-x-1.5 px-4 py-2.5 rounded-xl text-xs font-bold transition whitespace-nowrap cursor-pointer shrink-0 bg-white border border-slate-200 text-slate-700 hover:bg-slate-50 hover:border-slate-300';
}
});
// 2. Show active panel, hide others
// 2. Tampilkan panel aktif, sembunyikan lainnya
const allPanels = document.querySelectorAll('.p2h-section-content');
allPanels.forEach(panel => {
if (panel.id === 'p2h-content-' + secKey) {
@@ -371,6 +396,83 @@
panel.classList.add('hidden');
}
});
checkAllSectionsCompleted();
}
function validateSectionNotes(secKey) {
const panel = document.getElementById('p2h-content-' + secKey);
if (!panel) return true;
const damagedRadios = panel.querySelectorAll('input[type="radio"][value="rusak"]:checked');
for (const radio of damagedRadios) {
const match = radio.name.match(/items\[(\d+)\]/);
if (match && match[1]) {
const notesInput = panel.querySelector(`input[name="items[${match[1]}][notes]"]`);
if (notesInput && !notesInput.value.trim()) {
notesInput.focus();
alert('Mohon isi catatan kerusakan pada butir yang Anda tandai "Rusak" sebelum melanjutkan.');
return false;
}
}
}
return true;
}
function completeAndNextSection(currentKey, nextKey) {
if (!validateSectionNotes(currentKey)) {
return;
}
completedSections[currentKey] = true;
const checkIcon = document.getElementById('tab-check-' + currentKey);
if (checkIcon) checkIcon.classList.remove('hidden');
switchP2hSection(nextKey);
}
function markLastSectionComplete(lastSecKey) {
if (!validateSectionNotes(lastSecKey)) {
return;
}
completedSections[lastSecKey] = true;
const checkIcon = document.getElementById('tab-check-' + lastSecKey);
if (checkIcon) checkIcon.classList.remove('hidden');
checkAllSectionsCompleted();
// Gulir halus ke tombol kirim di bawah
const submitCard = document.getElementById('p2hSubmitCard');
if (submitCard) {
submitCard.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
}
function checkAllSectionsCompleted() {
if (!allSectionKeys || allSectionKeys.length <= 1) {
showSubmitButton();
return;
}
let allDone = true;
for (const key of allSectionKeys) {
if (!completedSections[key]) {
allDone = false;
break;
}
}
if (allDone) {
showSubmitButton();
}
}
function showSubmitButton() {
const container = document.getElementById('p2hSubmitBtnContainer');
const notice = document.getElementById('p2hPendingNotice');
if (container) container.classList.remove('hidden');
if (notice) notice.classList.add('hidden');
}
function handleConditionChange(itemId, condition) {
@@ -396,5 +498,12 @@
}
});
}
// Inisialisasi awal
document.addEventListener('DOMContentLoaded', function() {
if (!allSectionKeys || allSectionKeys.length <= 1) {
showSubmitButton();
}
});
</script>
@endsection
@@ -471,6 +471,38 @@
openGateSelectionModal(true);
});
@endif
// Modal Tolak Perjalanan Kendaraan di Pos Gerbang
function openRejectModal(id, unit, driver, direction) {
document.getElementById('rejectUnitDisplay').textContent = unit || '-';
document.getElementById('rejectDriverDisplay').textContent = driver || '-';
const dirEl = document.getElementById('rejectDirectionDisplay');
if (direction === 'in') {
dirEl.textContent = 'Masuk Gerbang (IN)';
dirEl.className = 'font-bold text-xs uppercase px-2 py-0.5 rounded-md bg-blue-100 text-blue-800';
} else {
dirEl.textContent = 'Keluar Gerbang (OUT)';
dirEl.className = 'font-bold text-xs uppercase px-2 py-0.5 rounded-md bg-amber-100 text-amber-800';
}
document.getElementById('rejectNoteInput').value = '';
document.getElementById('rejectForm').action = `/pg/gate-inspection/${id}/reject`;
const modal = document.getElementById('rejectModal');
if (modal) modal.classList.remove('hidden');
}
function closeRejectModal() {
const modal = document.getElementById('rejectModal');
if (modal) modal.classList.add('hidden');
}
function setQuickReason(text) {
const input = document.getElementById('rejectNoteInput');
if (input) {
input.value = text;
input.focus();
}
}
</script>
<!-- MODAL LIGHTBOX PRATINJAU FOTO DRIVER & MOBIL LV -->
@@ -581,4 +613,111 @@
</div>
</div>
</div>
<!-- ========================================================================= -->
<!-- MODAL POPUP: TOLAK PERJALANAN KENDARAAN (DENGAN DETAIL ALASAN) -->
<!-- ========================================================================= -->
<div id="rejectModal" data-backdrop="static" class="hidden fixed inset-0 z-50 bg-slate-900/60 backdrop-blur-xs flex items-center justify-center p-4 overflow-y-auto">
<div class="bg-white rounded-3xl shadow-2xl max-w-lg w-full p-6 sm:p-7 border border-slate-100 overflow-hidden animate-scale-in space-y-4">
<!-- Header Modal -->
<div class="flex items-start justify-between gap-3 pb-3 border-b border-slate-100">
<div class="flex items-center space-x-3">
<div class="w-12 h-12 rounded-2xl bg-rose-100 text-rose-700 flex items-center justify-center text-xl flex-shrink-0 shadow-2xs">
<i class="fa-solid fa-ban"></i>
</div>
<div>
<h3 class="text-base sm:text-lg font-black text-slate-900 tracking-tight">
Tolak Perjalanan Kendaraan
</h3>
<p class="text-xs text-slate-500 mt-0.5">
Berikan alasan penolakan secara jelas untuk catatan log audit & driver.
</p>
</div>
</div>
<button type="button" onclick="closeRejectModal()" class="text-slate-400 hover:text-slate-600 p-1.5 rounded-lg hover:bg-slate-100 transition cursor-pointer">
<i class="fa-solid fa-xmark text-sm"></i>
</button>
</div>
<!-- Identitas Kendaraan & Driver -->
<div class="bg-slate-50 p-3.5 rounded-2xl border border-slate-200/80 space-y-1.5">
<div class="flex items-center justify-between text-xs">
<span class="text-slate-500 font-bold">Kendaraan:</span>
<span id="rejectUnitDisplay" class="font-mono font-black text-slate-900"></span>
</div>
<div class="flex items-center justify-between text-xs">
<span class="text-slate-500 font-bold">Pengemudi:</span>
<span id="rejectDriverDisplay" class="font-bold text-slate-900"></span>
</div>
<div class="flex items-center justify-between text-xs">
<span class="text-slate-500 font-bold">Arah Perlintasan:</span>
<span id="rejectDirectionDisplay" class="font-bold text-xs uppercase px-2 py-0.5 rounded-md"></span>
</div>
</div>
<!-- Form Penolakan -->
<form id="rejectForm" method="POST" action="" class="space-y-4">
@csrf
@if($currentGuard)
<input type="hidden" name="security_guard_id" value="{{ $currentGuard->id }}">
@elseif($guards->isNotEmpty())
<div>
<label class="block text-xs font-bold text-slate-700 mb-1">
Petugas Satpam Pemeriksa <span class="text-rose-500">*</span>
</label>
<select name="security_guard_id" 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-rose-600">
@foreach($guards as $g)
<option value="{{ $g->id }}">{{ $g->name }} (Reg: {{ $g->badge_id }})</option>
@endforeach
</select>
</div>
@endif
<!-- Quick Reason Chips -->
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Pilih Cepat Alasan Penolakan:
</label>
<div class="flex flex-wrap gap-1.5">
<button type="button" onclick="setQuickReason('Masa berlaku SIMPER pengemudi telah kedaluwarsa (Expired)')" class="text-[11px] px-2.5 py-1 rounded-lg border border-slate-200 bg-slate-50 hover:bg-rose-50 hover:border-rose-300 hover:text-rose-700 transition font-medium cursor-pointer">
SIMPER Expired
</button>
<button type="button" onclick="setQuickReason('Kondisi fisik kendaraan tidak layak jalan (Rem blong / Lampu mati / Ban botak)')" class="text-[11px] px-2.5 py-1 rounded-lg border border-slate-200 bg-slate-50 hover:bg-rose-50 hover:border-rose-300 hover:text-rose-700 transition font-medium cursor-pointer">
Fisik Tidak Layak
</button>
<button type="button" onclick="setQuickReason('Tujuan atau keperluan perjalanan tidak jelas / Tanpa instruksi kerja')" class="text-[11px] px-2.5 py-1 rounded-lg border border-slate-200 bg-slate-50 hover:bg-rose-50 hover:border-rose-300 hover:text-rose-700 transition font-medium cursor-pointer">
Tujuan Tidak Jelas
</button>
<button type="button" onclick="setQuickReason('Surat jalan / BAST belum lengkap')" class="text-[11px] px-2.5 py-1 rounded-lg border border-slate-200 bg-slate-50 hover:bg-rose-50 hover:border-rose-300 hover:text-rose-700 transition font-medium cursor-pointer">
Surat Jalan Kurang
</button>
<button type="button" onclick="setQuickReason('Pengemudi bukan operator / driver yang terdaftar untuk unit ini')" class="text-[11px] px-2.5 py-1 rounded-lg border border-slate-200 bg-slate-50 hover:bg-rose-50 hover:border-rose-300 hover:text-rose-700 transition font-medium cursor-pointer">
Bukan Driver Resmi
</button>
</div>
</div>
<!-- Detail Alasan Wajib -->
<div>
<label for="rejectNoteInput" class="block text-xs font-bold text-slate-700 mb-1.5">
Detail Catatan / Alasan Penolakan <span class="text-rose-500">*</span>
</label>
<textarea name="rejection_note" id="rejectNoteInput" rows="3" required
placeholder="Jelaskan alasan penolakan secara spesifik..."
class="w-full text-xs p-3 rounded-xl border border-slate-300 bg-white text-slate-800 placeholder:text-slate-400 focus:outline-none focus:border-rose-600 focus:ring-2 focus:ring-rose-500/10 transition resize-none"></textarea>
</div>
<div class="pt-3 border-t border-slate-100 flex items-center justify-end gap-2.5">
<button type="button" onclick="closeRejectModal()" class="px-4 py-2 text-xs font-bold text-slate-600 hover:bg-slate-100 rounded-xl transition cursor-pointer">
Batal
</button>
<button type="submit"
onclick="if(!document.getElementById('rejectNoteInput').value.trim()){ alert('Alasan penolakan wajib diisi!'); return false; }"
class="px-5 py-2.5 bg-rose-600 hover:bg-rose-700 active:bg-rose-800 text-white font-bold text-xs rounded-xl shadow-xs transition flex items-center space-x-1.5 cursor-pointer">
<i class="fa-solid fa-ban text-xs"></i>
<span>Konfirmasi Tolak Perjalanan</span>
</button>
</div>
</form>
</div>
</div>
@endsection
@@ -113,32 +113,41 @@
</div>
@endif
<!-- Baris 4: Tombol Verifikasi Langsung di Card (Tanpa Popup & Tanpa Fitur Tolak) -->
<!-- Baris 4: Tombol Aksi Verifikasi & Tolak Perjalanan -->
<div class="mt-3.5 pt-3 border-t border-slate-100 flex flex-col sm:flex-row items-center justify-between gap-2.5">
<span class="text-[11px] text-slate-400 font-medium hidden sm:inline flex items-center gap-1.5">
<i class="fa-solid fa-shield-check text-[#1b5e20]"></i>
<span>Cek fisik kendaraan lalu klik verifikasi untuk membuka portal</span>
<span>Cek fisik kendaraan lalu pilih verifikasi atau tolak</span>
</span>
@can('gate.approve')
<form action="{{ route('pg.gate.approve', $act->id) }}" method="POST" class="w-full sm:w-auto m-0">
@csrf
@if($currentGuard)
<input type="hidden" name="security_guard_id" value="{{ $currentGuard->id }}">
@elseif($guards->isNotEmpty())
<input type="hidden" name="security_guard_id" value="{{ $guards->first()->id }}">
@endif
<button type="submit"
onclick="this.disabled=true; this.innerHTML='<i class=\'fa-solid fa-spinner fa-spin text-xs\'></i> Memverifikasi...'; this.form.submit();"
class="w-full sm:w-auto px-6 py-2.5 bg-[#1b5e20] hover:bg-[#144919] active:bg-[#0f3613] text-white font-bold text-xs sm:text-sm rounded-xl shadow-xs hover:shadow transition flex items-center justify-center space-x-2 cursor-pointer">
<i class="fa-solid fa-clipboard-check text-sm"></i>
<span>Verifikasi</span>
<div class="flex items-center gap-2 w-full sm:w-auto">
@can('gate.reject')
<button type="button"
onclick="openRejectModal({{ $act->id }}, '{{ addslashes($act->vehicle->code . ' (' . ($act->vehicle->license_plate ?? 'Tanpa Plat') . ')') }}', '{{ addslashes($act->driver->name ?? 'Pengemudi') }}', '{{ strtolower($act->direction) }}')"
class="w-1/2 sm:w-auto px-4 py-2.5 bg-rose-50 hover:bg-rose-100 active:bg-rose-200 text-rose-700 border border-rose-200 font-bold text-xs sm:text-sm rounded-xl transition flex items-center justify-center space-x-1.5 cursor-pointer shadow-2xs">
<i class="fa-solid fa-ban text-xs"></i>
<span>Tolak</span>
</button>
</form>
@else
<span class="text-xs text-slate-400 italic">Tidak memiliki izin verifikasi</span>
@endcan
@endcan
@can('gate.approve')
<form action="{{ route('pg.gate.approve', $act->id) }}" method="POST" class="w-1/2 sm:w-auto m-0">
@csrf
@if($currentGuard)
<input type="hidden" name="security_guard_id" value="{{ $currentGuard->id }}">
@elseif($guards->isNotEmpty())
<input type="hidden" name="security_guard_id" value="{{ $guards->first()->id }}">
@endif
<button type="submit"
onclick="this.disabled=true; this.innerHTML='<i class=\'fa-solid fa-spinner fa-spin text-xs\'></i> Memverifikasi...'; this.form.submit();"
class="w-full sm:w-auto px-6 py-2.5 bg-[#1b5e20] hover:bg-[#144919] active:bg-[#0f3613] text-white font-bold text-xs sm:text-sm rounded-xl shadow-xs hover:shadow transition flex items-center justify-center space-x-2 cursor-pointer">
<i class="fa-solid fa-clipboard-check text-sm"></i>
<span>Verifikasi</span>
</button>
</form>
@endcan
</div>
</div>
</div>
@@ -173,99 +173,91 @@
</form>
</div>
<!-- Tabel Riwayat Transfer Unit dengan Header Biru Tua Navy (Pada Mobile: Format Kotak Tanpa Border Radius) -->
<!-- Tabel Riwayat Transfer Unit dengan Header Biru Tua Navy (Format Ramping & Nyaman) -->
<div class="bg-white rounded-none sm:rounded-2xl border border-slate-200 shadow-sm overflow-hidden">
<div class="overflow-x-auto">
<table class="min-w-full text-xs text-left border-collapse">
<!-- Header Tabel Navy Gelap Solid #06213f -->
<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 whitespace-nowrap">TANGGAL & NO TRANSFER</th>
<th class="py-3.5 px-4 whitespace-nowrap">BERITA ACARA (BAST)</th>
<th class="py-3.5 px-4 whitespace-nowrap min-w-[180px]">UNIT ALAT BERAT</th>
<th class="py-3.5 px-4 whitespace-nowrap min-w-[200px]">PERPINDAHAN LOKASI</th>
<th class="py-3.5 px-4 whitespace-nowrap">ARMADA & SUPIR</th>
<th class="py-3.5 px-4 whitespace-nowrap">PELAPOR</th>
<th class="py-3.5 px-4 text-center whitespace-nowrap w-28">AKSI</th>
<th class="py-3 px-3.5 text-center w-10">NO</th>
<th class="py-3 px-3.5 whitespace-nowrap">DOKUMEN & TANGGAL</th>
<th class="py-3 px-3.5 whitespace-nowrap">UNIT ALAT BERAT</th>
<th class="py-3 px-3.5 whitespace-nowrap">RUTE PEMINDAHAN</th>
<th class="py-3 px-3.5 whitespace-nowrap">PENGANGKUT & SUPIR</th>
<th class="py-3 px-3.5 whitespace-nowrap">PELAPOR</th>
<th class="py-3 px-3.5 text-center whitespace-nowrap w-24">AKSI</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 text-slate-700 bg-white">
@forelse($transfers as $index => $t)
<tr class="hover:bg-slate-50/80 transition">
<!-- 1. No -->
<td class="py-3.5 px-3.5 text-center text-slate-400 font-medium">
<td class="py-2.5 px-3.5 text-center text-slate-400 font-medium">
{{ $transfers->firstItem() + $index }}
</td>
<!-- 2. Tanggal & No Transfer -->
<td class="py-3.5 px-3.5 whitespace-nowrap">
<div class="font-bold text-slate-900">
{{ $t->transfer_date ? $t->transfer_date->translatedFormat('d M Y') : '-' }}
</div>
<span class="inline-block mt-0.5 font-mono text-[10px] text-slate-500 bg-slate-100 px-1.5 py-0.5 rounded">
{{ $t->transfer_no }}
</span>
</td>
<!-- 3. Berita Acara -->
<td class="py-3.5 px-3.5 min-w-[200px]">
@if($t->document_number)
<div class="font-bold text-slate-900 leading-tight font-mono text-xs">
{{ $t->document_number }}
</div>
<div class="text-[11px] text-slate-500 mt-0.5 line-clamp-1" title="{{ $t->document_title }}">
{{ $t->document_title }}
</div>
@if($t->document_file_path)
<a href="{{ $t->document_file_url }}" target="_blank" class="inline-flex items-center space-x-1 text-[10px] font-bold text-emerald-700 hover:text-emerald-900 mt-1">
<i class="fa-solid fa-paperclip"></i>
<span>Lihat Lampiran</span>
</a>
@endif
@else
<span class="inline-flex items-center space-x-1 px-2 py-0.5 rounded text-[11px] font-medium text-slate-500 bg-slate-100 border border-slate-200">
<span>Tanpa BAST (Internal Site)</span>
</span>
@endif
</td>
<!-- 4. Unit Alat Berat -->
<td class="py-3.5 px-3.5 whitespace-nowrap">
<div class="flex items-center space-x-2.5">
@if($t->vehicle && $t->vehicle->photo_url)
<img src="{{ $t->vehicle->photo_url }}" alt="{{ $t->vehicle->code }}" class="w-9 h-9 rounded-xl object-cover border border-slate-200 shrink-0">
<!-- 2. Dokumen BAST & Tanggal Transfer -->
<td class="py-2.5 px-3.5 whitespace-nowrap">
<div class="flex items-center space-x-1.5">
@if($t->document_number)
<span class="font-bold text-slate-900 font-mono text-xs">
{{ $t->document_number }}
</span>
@if($t->document_file_path)
<a href="{{ $t->document_file_url }}" target="_blank" class="text-emerald-700 hover:text-emerald-900 text-xs" title="Lihat Lampiran Berkas">
<i class="fa-solid fa-paperclip"></i>
</a>
@endif
@else
<div class="w-9 h-9 rounded-xl bg-slate-100 text-slate-400 flex items-center justify-center shrink-0 border border-slate-200">
<i class="fa-solid fa-truck-monster text-sm"></i>
<span class="px-1.5 py-0.5 rounded text-[10px] font-bold text-slate-600 bg-slate-100 border border-slate-200">
Internal Site
</span>
@endif
</div>
<div class="text-[11px] text-slate-500 mt-0.5 flex items-center gap-1.5 font-medium">
<span>{{ $t->transfer_date ? $t->transfer_date->translatedFormat('d M Y') : '-' }}</span>
<span class="text-slate-300">&bull;</span>
<span class="font-mono text-[10px] text-slate-400">{{ $t->transfer_no }}</span>
</div>
</td>
<!-- 3. Unit Alat Berat -->
<td class="py-2.5 px-3.5 whitespace-nowrap">
<div class="flex items-center space-x-2">
@if($t->vehicle && $t->vehicle->photo_url)
<img src="{{ $t->vehicle->photo_url }}" alt="{{ $t->vehicle->code }}" class="w-8 h-8 rounded-lg object-cover border border-slate-200 shrink-0">
@else
<div class="w-8 h-8 rounded-lg bg-slate-100 text-slate-400 flex items-center justify-center shrink-0 border border-slate-200 text-xs">
<i class="fa-solid fa-truck-monster"></i>
</div>
@endif
<div>
<div class="font-black text-slate-900 tracking-tight">
<div class="font-black text-slate-900 tracking-tight text-xs">
{{ $t->vehicle?->code ?? '-' }}
</div>
<div class="text-[11px] text-slate-500">
<div class="text-[10px] text-slate-500 max-w-[150px] truncate" title="{{ $t->vehicle?->brand_type ?? '-' }}">
{{ $t->vehicle?->brand_type ?? '-' }}
</div>
</div>
</div>
</td>
<!-- 5. Lokasi Asal -> Lokasi Tujuan -->
<td class="py-3.5 px-3.5">
<div class="flex items-center space-x-1.5 text-xs">
<!-- 4. Rute Pemindahan -->
<td class="py-2.5 px-3.5">
<div class="flex items-center space-x-1.5 text-xs whitespace-nowrap">
<span class="text-slate-600 font-medium">{{ $t->from_location }}</span>
<i class="fa-solid fa-arrow-right text-[10px] text-emerald-600"></i>
<span class="font-extrabold text-[#1b5e20]">{{ $t->to_location }}</span>
<i class="fa-solid fa-arrow-right text-[10px] text-slate-400"></i>
<span class="font-bold text-[#1b5e20]">{{ $t->to_location }}</span>
</div>
<div class="mt-1">
<div class="mt-0.5">
@if($t->isToInsideSite())
<span class="inline-flex items-center space-x-1 px-2 py-0.5 rounded-full text-[10px] font-bold bg-emerald-50 text-emerald-700 border border-emerald-200">
<span class="inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-700">
<span class="w-1.5 h-1.5 rounded-full bg-emerald-500"></span>
<span>Di Dalam Site</span>
</span>
@else
<span class="inline-flex items-center space-x-1 px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-50 text-amber-700 border border-amber-200">
<span class="inline-flex items-center gap-1 text-[10px] font-semibold text-amber-700">
<span class="w-1.5 h-1.5 rounded-full bg-amber-500"></span>
<span>Di Luar Site</span>
</span>
@@ -273,34 +265,33 @@
</div>
</td>
<!-- 6. Armada & Supir Pengangkut -->
<td class="py-3.5 px-3.5 whitespace-nowrap">
<div class="font-semibold text-slate-800">
<i class="fa-solid fa-truck-moving text-slate-400 mr-1 text-[11px]"></i>
{{ $t->transporter_unit_name ?: ($t->transporterVehicle?->code ?? 'Tanpa Pengangkut') }}
<!-- 5. Armada & Supir Pengangkut -->
<td class="py-2.5 px-3.5 whitespace-nowrap">
<div class="font-semibold text-slate-800 text-xs flex items-center gap-1">
<i class="fa-solid fa-truck-moving text-slate-400 text-[10px]"></i>
<span>{{ $t->transporter_unit_name ?: ($t->transporterVehicle?->code ?? 'Tanpa Pengangkut') }}</span>
</div>
<div class="text-[11px] text-slate-500 mt-0.5">
<i class="fa-solid fa-id-badge text-slate-400 mr-1 text-[11px]"></i>
{{ $t->transporter_driver_name ?: ($t->transporterDriver?->name ?? '-') }}
</div>
</td>
<!-- 7. Pelapor -->
<td class="py-3.5 px-3.5 whitespace-nowrap">
<div class="font-bold text-slate-800">
<!-- 6. Pelapor -->
<td class="py-2.5 px-3.5 whitespace-nowrap">
<div class="font-bold text-slate-800 text-xs">
{{ $t->reported_by }}
</div>
<div class="text-[10px] text-slate-400">
Petugas QMA
QMA
</div>
</td>
<!-- 8. Aksi -->
<td class="py-3.5 px-3.5 text-center whitespace-nowrap">
<div class="inline-flex items-center space-x-1.5">
<!-- 7. Aksi -->
<td class="py-2.5 px-3.5 text-center whitespace-nowrap">
<div class="inline-flex items-center space-x-1">
<!-- Tombol Lihat Detail BAST -->
<a href="{{ route('qma.unit_transfers.show', $t->id) }}"
class="p-2 rounded-xl text-emerald-700 bg-emerald-50 hover:bg-emerald-100 border border-emerald-200/80 transition shadow-2xs"
class="p-1.5 rounded-lg text-emerald-700 bg-emerald-50 hover:bg-emerald-100 border border-emerald-200/80 transition"
title="Lihat Berita Acara & Detail">
<i class="fa-solid fa-file-invoice text-xs"></i>
</a>
@@ -309,7 +300,7 @@
@can('qma.vehicles.delete')
<button type="button"
onclick="openDeleteModal('{{ $t->id }}', '{{ e($t->document_number) }}', '{{ e($t->vehicle?->code ?? 'Unit') }}')"
class="p-2 rounded-xl text-rose-600 bg-rose-50 hover:bg-rose-100 border border-rose-200/80 transition shadow-2xs cursor-pointer"
class="p-1.5 rounded-lg text-rose-600 bg-rose-50 hover:bg-rose-100 border border-rose-200/80 transition cursor-pointer"
title="Hapus Data Transfer">
<i class="fa-solid fa-trash text-xs"></i>
</button>
@@ -319,12 +310,12 @@
</tr>
@empty
<tr>
<td colspan="8" class="py-12 text-center text-slate-400">
<div class="w-16 h-16 rounded-full bg-slate-100 flex items-center justify-center mx-auto mb-3 text-slate-400 text-2xl">
<td colspan="7" class="py-12 text-center text-slate-400">
<div class="w-14 h-14 rounded-full bg-slate-100 flex items-center justify-center mx-auto mb-2 text-slate-400 text-xl">
<i class="fa-solid fa-truck-ramp-box"></i>
</div>
<p class="text-sm font-bold text-slate-700">Belum Ada Data Pemindahan Unit</p>
<p class="text-xs text-slate-400 mt-1 max-w-sm mx-auto">
<p class="text-xs font-bold text-slate-700">Belum Ada Data Pemindahan Unit</p>
<p class="text-[11px] text-slate-400 mt-0.5 max-w-sm mx-auto">
Belum ada transaksi pemindahan alat berat yang tercatat. Silakan klik tombol "Buat Transfer Unit" untuk membuat Berita Acara baru.
</p>
@canany(['qma.vehicles.create', 'qma.vehicles.edit'])