feat: setup Docker production stack, Vite asset compilation, and resolve audit findings (P1/P2)

This commit is contained in:
Wahyudin
2026-10-15 13:53:52 +07:00
parent 9c00515a73
commit 38c70f9413
65 changed files with 13315 additions and 933 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Masuk ke Sistem RKM - PT Kerinci Merangin Hidro</title>
<script src="https://cdn.tailwindcss.com"></script>
@vite(['resources/css/app.css', 'resources/js/app.js'])
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@@ -0,0 +1,103 @@
@extends('layouts.app')
@section('title', 'Dashboard Karyawan - Sistem RKM | PT Kerinci Merangin Hidro')
@section('content')
<div class="w-full space-y-6">
<!-- Header Halaman Simple Kayak Satpam (Seamless, Tanpa Card Wrapper) -->
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-3 border-b border-slate-200/80">
<div class="min-w-0">
<div class="flex items-center flex-wrap gap-2.5">
<h1 class="text-lg sm:text-xl font-black text-slate-900 tracking-tight">
Dashboard Karyawan
</h1>
@if($employee && $employee->hasValidSimper())
<span class="px-2.5 py-1 rounded-lg text-xs font-black bg-emerald-50 text-emerald-700 border border-emerald-200">
SIMPER Aktif
</span>
@elseif($employee)
<span class="px-2.5 py-1 rounded-lg text-xs font-black bg-rose-50 text-rose-700 border border-rose-200">
SIMPER Exp
</span>
@endif
</div>
<div class="text-sm sm:text-base text-slate-600 font-medium truncate mt-1 flex items-center flex-wrap gap-1.5">
<span>Karyawan: <strong class="text-slate-900 font-bold">{{ $employee ? $employee->name : auth()->user()->name }}</strong></span>
@if($employee && $employee->nik)
<span class="text-slate-500 font-mono text-xs sm:text-sm font-semibold">({{ $employee->nik }})</span>
@endif
@if($employee && $employee->division)
<span class="text-slate-400">&bull;</span>
<span class="text-slate-500 text-xs sm:text-sm">{{ $employee->division }}</span>
@endif
</div>
</div>
@if($employee && $employee->simper_expired_at)
<div class="text-xs text-slate-500 font-medium self-start sm:self-center">
Masa Berlaku SIMPER: <span class="font-bold text-slate-800">{{ $employee->simper_expired_at->format('d/m/Y') }}</span>
</div>
@endif
</div>
<!-- 2 Card Fitur: Pemeriksaan P2H dan Timesheet -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-5 sm:gap-6">
<!-- Card 1: Pemeriksaan P2H -->
<div class="bg-white rounded-2xl border border-slate-200 p-6 shadow-sm hover:shadow-md transition flex flex-col justify-between group">
<div>
<div class="flex items-center justify-end mb-4">
<span class="px-2.5 py-1 rounded-lg text-[11px] font-bold bg-amber-50 text-amber-800 border border-amber-200">
Unit Support / Alat Berat
</span>
</div>
<h2 class="text-lg sm:text-xl font-black text-slate-900 tracking-tight mb-1">
Pemeriksaan Pra-Harian (P2H)
</h2>
<p class="text-xs sm:text-sm text-slate-500 leading-relaxed mb-4">
Pengisian formulir checklist kelaikan operasi harian sebelum mengoperasikan alat berat support unit (Excavator, Crane, Bulldozer, dan unit support lainnya).
</p>
<div class="text-xs text-slate-600 bg-slate-50 p-3 rounded-xl border border-slate-100 flex items-center justify-between">
<span class="text-slate-400">Total Unit Terdaftar:</span>
<span class="font-extrabold text-[#1b5e20]">{{ $totalSupport }} Unit Support</span>
</div>
</div>
<div class="mt-6 pt-4 border-t border-slate-100">
<a href="{{ route('p2h.index') }}" class="w-full bg-[#1b5e20] hover:bg-[#144918] active:scale-[0.99] text-white font-bold py-3 px-4 rounded-xl shadow-sm transition flex items-center justify-center space-x-2 text-xs sm:text-sm">
<span>Buka Modul Pemeriksaan P2H</span>
<i class="fa-solid fa-arrow-right text-xs"></i>
</a>
</div>
</div>
<!-- Card 2: Timesheet Kendaraan Ringan (LV) -->
<div class="bg-white rounded-2xl border border-slate-200 p-6 shadow-sm hover:shadow-md transition flex flex-col justify-between group">
<div>
<div class="flex items-center justify-end mb-4">
<span class="px-2.5 py-1 rounded-lg text-[11px] font-bold bg-emerald-50 text-emerald-800 border border-emerald-200">
Kendaraan Ringan (LV)
</span>
</div>
<h2 class="text-lg sm:text-xl font-black text-slate-900 tracking-tight mb-1">
Timesheet Kendaraan Ringan
</h2>
<p class="text-xs sm:text-sm text-slate-500 leading-relaxed mb-4">
Pencatatan aktivitas mobilisasi harian light vehicle (LV), odometer kilometer (KM), tujuan penugasan operasional, dan verifikasi pos gerbang.
</p>
<div class="text-xs text-slate-600 bg-slate-50 p-3 rounded-xl border border-slate-100 flex items-center justify-between">
<span class="text-slate-400">Armada Tersedia:</span>
<span class="font-extrabold text-[#1b5e20]">{{ $totalLv }} Unit Kendaraan Ringan</span>
</div>
</div>
<div class="mt-6 pt-4 border-t border-slate-100">
<a href="{{ route('timesheet.index') }}" class="w-full bg-[#1b5e20] hover:bg-[#144918] active:scale-[0.99] text-white font-bold py-3 px-4 rounded-xl shadow-sm transition flex items-center justify-center space-x-2 text-xs sm:text-sm">
<span>Buka Modul Timesheet LV</span>
<i class="fa-solid fa-arrow-right text-xs"></i>
</a>
</div>
</div>
</div>
</div>
@endsection
+69 -175
View File
@@ -25,8 +25,8 @@
</h2>
</div>
<!-- Tombol Aksi Kanan (Pada Mobile: Lebar Sama / Proporsional 50-50) -->
<div class="grid grid-cols-2 gap-2.5 w-full sm:flex sm:items-center sm:gap-3 sm:w-auto">
<!-- Tombol Aksi Kanan -->
<div class="w-full sm:w-auto">
<!-- Tombol Ekspor Dropdown -->
<button type="button"
onclick="alert('Fitur ekspor spreadsheet SIMPER sedang disiapkan')"
@@ -35,14 +35,6 @@
<span>Ekspor Simper</span>
<i class="fa-solid fa-chevron-down text-[9px] text-slate-400 ml-0.5 sm:ml-1"></i>
</button>
<!-- Tombol Tambah Karyawan (+ Tambah Karyawan Hijau Tua) -->
<button type="button"
onclick="document.getElementById('addKaryawanModal').classList.remove('hidden')"
class="w-full sm:w-auto bg-[#1b5e20] hover:bg-[#144919] text-white px-3 sm:px-4 py-2.5 rounded-xl text-xs font-bold flex items-center justify-center space-x-2 transition shadow-sm">
<i class="fa-solid fa-plus text-xs"></i>
<span>Tambah Karyawan</span>
</button>
</div>
</div>
@@ -190,7 +182,7 @@
</td>
</tr>
@empty
<tr>
<tr id="serverSimperEmptyRow">
<td colspan="8" 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'))
@@ -216,99 +208,16 @@
</tbody>
</table>
</div>
@if($employees->hasPages())
<div class="p-4 border-t border-slate-100 bg-white">
{{ $employees->links() }}
</div>
@endif
</div>
</div>
<!-- Modal Dialog Add Karyawan (Persis Format Gambar IT All Role) -->
<div id="addKaryawanModal" onclick="if(event.target === this) this.classList.add('hidden')" 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-lg w-full p-7 sm:p-8 border border-slate-100 overflow-hidden">
<!-- Header Modal Bersih Tanpa Banner Gelap Sesuai Gambar -->
<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">
Tambah Data Simper
</h3>
<button type="button" onclick="document.getElementById('addKaryawanModal').classList.add('hidden')" class="text-slate-400 hover:text-slate-600 transition p-1">
<i class="fa-solid fa-xmark text-lg"></i>
</button>
</div>
<form action="{{ route('hse.employees.store') }}" method="POST" class="mt-5 space-y-4">
@csrf
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Nomor Induk Karyawan (NIK) <span class="text-rose-500">*</span></label>
<input type="text" name="nik" required placeholder="Contoh: 0001"
class="w-full text-sm px-4 py-3 rounded-2xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Nama Lengkap <span class="text-rose-500">*</span></label>
<input type="text" name="name" required placeholder="Contoh: Ahmad Budi"
class="w-full text-sm px-4 py-3 rounded-2xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Unit Kerja <span class="text-rose-500">*</span></label>
<select name="unit_kerja" 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">
<option value="" disabled selected>Pilih Unit Kerja</option>
<option value="Pembangkit">Pembangkit</option>
<option value="Bendungan">Bendungan</option>
<option value="Teknik">Teknik</option>
<option value="Umum">Umum</option>
</select>
</div>
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Divisi <span class="text-rose-500">*</span></label>
<select name="division" 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">
<option value="" disabled selected>Pilih Divisi</option>
<option value="INFORMATION & TECHNOLOGY">INFORMATION & TECHNOLOGY</option>
<option value="K3">K3 / HSE</option>
<option value="Quality Management Asset (QMA)">Quality Management Asset (QMA)</option>
<option value="GA">General Affairs (GA)</option>
<option value="HR">Human Resources (HR)</option>
<option value="Keuangan">Keuangan</option>
<option value="Logistik">Logistik / Warehouse</option>
<option value="Mechanical">Mechanical</option>
<option value="Civil & Inviro">Civil & Inviro</option>
<option value="PG">Private Guard (PG)</option>
</select>
</div>
</div>
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Jabatan <span class="text-rose-500">*</span></label>
<input type="text" name="position" required placeholder="Contoh: Staff IT"
class="w-full text-sm px-4 py-3 rounded-2xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Operator / Driver <span class="text-rose-500">*</span></label>
<select name="is_operator" id="addOperator" onchange="toggleSimperInput('add')" 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">
<option value="1">YA (Aktif Mengemudi)</option>
<option value="0">TIDAK (Bukan Driver)</option>
</select>
</div>
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Masa Berlaku SIMPER</label>
<input type="date" name="simper_expired_at" id="addSimperDate"
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">
</div>
</div>
<!-- Footer Tombol: Batal & Simpan Data Sesuai Gambar -->
<div class="pt-6 border-t border-slate-100 flex items-center justify-end space-x-3 mt-6">
<button type="button" onclick="document.getElementById('addKaryawanModal').classList.add('hidden')"
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">
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
</button>
</div>
</form>
</div>
</div>
<!-- Modal Dialog Perpanjang SIMPER (Clean White Card) -->
<div id="renewModal" onclick="if(event.target === this) this.classList.add('hidden')" class="hidden fixed inset-0 z-50 bg-slate-900/50 backdrop-blur-sm flex items-center justify-center p-4">
@@ -358,9 +267,12 @@
<div class="bg-white rounded-3xl shadow-2xl max-w-lg w-full p-7 sm:p-8 border border-slate-100 overflow-hidden">
<!-- Header Modal -->
<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">
Edit Data Simper
</h3>
<div>
<h3 class="text-xl font-bold text-slate-900 tracking-tight">
Kelola SIMPER Karyawan
</h3>
<p class="text-xs text-slate-500 mt-0.5">Kelola status pengemudi dan masa berlaku izin SIMPER.</p>
</div>
<button type="button" onclick="document.getElementById('editModal').classList.add('hidden')" class="text-slate-400 hover:text-slate-600 transition p-1">
<i class="fa-solid fa-xmark text-lg"></i>
</button>
@@ -368,63 +280,49 @@
<form id="editForm" method="POST" action="" class="mt-5 space-y-4">
@csrf
<!-- Profil Master Data Karyawan (Read-Only Info Card) -->
<div class="bg-slate-50 border border-slate-200/80 rounded-2xl p-4">
<div class="flex items-center justify-between mb-2 pb-2 border-b border-slate-200/60">
<span class="text-[11px] font-bold text-slate-500 uppercase tracking-wider">Profil Karyawan</span>
<span class="text-[10px] font-semibold text-slate-500 bg-slate-200/70 px-2.5 py-0.5 rounded-full inline-flex items-center">
<i class="fa-solid fa-lock text-[9px] mr-1.5 text-slate-400"></i>Master Super Admin
</span>
</div>
<div class="grid grid-cols-2 gap-3 text-xs">
<div>
<span class="text-slate-400 block text-[11px]">NIK:</span>
<span id="editNikDisplay" class="font-bold text-slate-800 font-mono"></span>
</div>
<div>
<span class="text-slate-400 block text-[11px]">Nama Lengkap:</span>
<span id="editNameDisplay" class="font-bold text-slate-900"></span>
</div>
<div>
<span class="text-slate-400 block text-[11px]">Unit Kerja:</span>
<span id="editUnitKerjaDisplay" class="font-semibold text-slate-700"></span>
</div>
<div>
<span class="text-slate-400 block text-[11px]">Divisi / Jabatan:</span>
<span id="editDivisionPositionDisplay" class="font-semibold text-slate-700"></span>
</div>
</div>
</div>
<!-- Bagian yang Dikelola HSE -->
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Nomor Induk Karyawan (NIK) <span class="text-rose-500">*</span></label>
<input type="text" name="nik" id="editNik" required placeholder="Contoh: 0001"
class="w-full text-sm px-4 py-3 rounded-2xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
<label class="block text-sm font-bold text-slate-800 mb-2">Operator / Driver <span class="text-rose-500">*</span></label>
<select name="is_operator" id="editOperator" onchange="toggleSimperInput('edit')" 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">
<option value="1">YA (Aktif Mengemudi)</option>
<option value="0">TIDAK (Bukan Driver)</option>
</select>
</div>
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Nama Lengkap <span class="text-rose-500">*</span></label>
<input type="text" name="name" id="editName" required placeholder="Contoh: Ahmad Budi"
class="w-full text-sm px-4 py-3 rounded-2xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Unit Kerja <span class="text-rose-500">*</span></label>
<select name="unit_kerja" id="editUnitKerja" 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">
<option value="Pembangkit">Pembangkit</option>
<option value="Bendungan">Bendungan</option>
<option value="Teknik">Teknik</option>
<option value="Umum">Umum</option>
</select>
</div>
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Divisi <span class="text-rose-500">*</span></label>
<select name="division" id="editDivision" 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">
<option value="INFORMATION & TECHNOLOGY">INFORMATION & TECHNOLOGY</option>
<option value="K3">K3 / HSE</option>
<option value="Quality Management Asset (QMA)">Quality Management Asset (QMA)</option>
<option value="GA">General Affairs (GA)</option>
<option value="HR">Human Resources (HR)</option>
<option value="Keuangan">Keuangan</option>
<option value="Logistik">Logistik / Warehouse</option>
<option value="Mechanical">Mechanical</option>
<option value="Civil & Inviro">Civil & Inviro</option>
<option value="PG">Private Guard (PG)</option>
</select>
</div>
</div>
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Jabatan <span class="text-rose-500">*</span></label>
<input type="text" name="position" id="editPosition" required placeholder="Contoh: Staff IT"
class="w-full text-sm px-4 py-3 rounded-2xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Operator / Driver <span class="text-rose-500">*</span></label>
<select name="is_operator" id="editOperator" onchange="toggleSimperInput('edit')" 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">
<option value="1">YA (Aktif Mengemudi)</option>
<option value="0">TIDAK (Bukan Driver)</option>
</select>
</div>
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Masa Berlaku SIMPER</label>
<input type="date" name="simper_expired_at" id="editSimperDate"
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">
</div>
<label class="block text-sm font-bold text-slate-800 mb-2">Masa Berlaku SIMPER</label>
<input type="date" name="simper_expired_at" id="editSimperDate"
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">
<p class="text-[11px] text-slate-400 mt-1">Kosongkan jika bukan driver atau belum memiliki SIMPER.</p>
</div>
<!-- Footer Tombol -->
@@ -502,12 +400,12 @@
<!-- Fitur 3 (Amber) -->
<div class="bg-slate-50/70 border border-slate-100 rounded-2xl p-3.5 flex items-start space-x-3.5">
<div class="w-9 h-9 rounded-xl bg-amber-100/70 text-amber-700 flex items-center justify-center flex-shrink-0 mt-0.5 text-sm border border-amber-200/50">
<i class="fa-solid fa-user-plus"></i>
<i class="fa-solid fa-id-badge"></i>
</div>
<div class="min-w-0 flex-1">
<h4 class="text-xs font-bold text-slate-900">Tambah & Perbarui Data Karyawan</h4>
<h4 class="text-xs font-bold text-slate-900">Kelola Status Driver & SIMPER</h4>
<p class="text-[11px] text-slate-500 mt-0.5 leading-relaxed">
Mendaftarkan karyawan baru melalui tombol '+ Tambah Karyawan', serta mengedit informasi jabatan atau unit kerja melalui tombol aksi di tabel.
Mengatur status kelayakan driver dan memperbarui tanggal SIMPER. Pendaftaran dan master data profil karyawan dikelola terpusat oleh Super Admin.
</p>
</div>
</div>
@@ -550,10 +448,7 @@
// Logika Penguncian Input SIMPER jika Bukan Driver
function toggleSimperInput(type) {
let opSelect, dateInput;
if (type === 'add') {
opSelect = document.getElementById('addOperator');
dateInput = document.getElementById('addSimperDate');
} else if (type === 'edit') {
if (type === 'edit') {
opSelect = document.getElementById('editOperator');
dateInput = document.getElementById('editSimperDate');
} else if (type === 'renew') {
@@ -579,11 +474,10 @@
}
function openEditModal(emp) {
document.getElementById('editNik').value = emp.nik || '';
document.getElementById('editName').value = emp.name || '';
document.getElementById('editUnitKerja').value = emp.unit_kerja || '';
document.getElementById('editDivision').value = emp.division || '';
document.getElementById('editPosition').value = emp.position || '';
document.getElementById('editNikDisplay').textContent = emp.nik || '-';
document.getElementById('editNameDisplay').textContent = emp.name || '-';
document.getElementById('editUnitKerjaDisplay').textContent = emp.unit_kerja || '-';
document.getElementById('editDivisionPositionDisplay').textContent = (emp.division || '-') + ' / ' + (emp.position || '-');
document.getElementById('editOperator').value = emp.is_operator ? '1' : '0';
let expDate = '';
@@ -611,11 +505,6 @@
document.getElementById('renewModal').classList.remove('hidden');
}
// Inisialisasi awal untuk modal tambah
document.addEventListener('DOMContentLoaded', function() {
toggleSimperInput('add');
});
// Filter Pencarian Instan Real-time
const searchInput = document.getElementById('simperSearchInput');
const resetContainer = document.getElementById('simperResetContainer');
@@ -641,6 +530,11 @@
if (match) visibleCount++;
});
const serverEmptyRow = document.getElementById('serverSimperEmptyRow');
if (serverEmptyRow) {
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
}
// Hapus baris pesan kosong pencarian jika ada sebelumnya
const existingEmptyRow = document.getElementById('simperEmptySearchRow');
if (existingEmptyRow) {
@@ -648,7 +542,7 @@
}
// Tampilkan pesan jika tidak ada data yang cocok di tabel
if (rows.length > 0 && visibleCount === 0 && query.length > 0) {
if (visibleCount === 0 && query.length > 0) {
const emptyTr = document.createElement('tr');
emptyTr.id = 'simperEmptySearchRow';
emptyTr.innerHTML = `
+291 -111
View File
@@ -4,8 +4,8 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@yield('title', 'Sistem RKM - PT Kerinci Merangin Hidro')</title>
<!-- Tailwind CSS CDN -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Compiled Assets via Vite -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@@ -96,17 +96,36 @@
body.modal-open {
scrollbar-color: rgba(255, 255, 255, 0.2) rgba(15, 23, 42, 0.6);
}
/* Hilangkan Scrollbar pada Sidebar Desktop & Mobile (tetap dapat di-scroll) */
aside .overflow-y-auto,
#mobileDrawerPanel .overflow-y-auto,
.no-scrollbar {
-ms-overflow-style: none !important; /* IE dan Edge */
scrollbar-width: none !important; /* Firefox */
}
aside .overflow-y-auto::-webkit-scrollbar,
#mobileDrawerPanel .overflow-y-auto::-webkit-scrollbar,
.no-scrollbar::-webkit-scrollbar {
display: none !important;
width: 0 !important;
height: 0 !important;
}
</style>
</head>
<body class="bg-slate-50 text-slate-800 antialiased font-sans min-h-screen">
@php
$isFormMobil = request()->routeIs('vehicle.activity.*') || request()->is('gate-activity*');
$isStandaloneForm = request()->routeIs('vehicle.activity.*')
|| request()->is('gate-activity*')
|| request()->routeIs('p2h.form', 'p2h.store')
|| (request()->is('p2h/*') && !request()->routeIs('qma.*'));
$isFormMobil = $isStandaloneForm;
@endphp
@if($isFormMobil)
@if($isStandaloneForm)
<!-- ========================================================================= -->
<!-- LAYOUT KHUSUS FORM UNIT MOBIL (TANPA SIDEBAR & TOPBAR) -->
<!-- LAYOUT KHUSUS FORM STANDALONE / FORM MOBIL & P2H (TANPA SIDEBAR & TOPBAR) -->
<!-- ========================================================================= -->
<div class="min-h-screen bg-slate-50 flex flex-col justify-between py-6 px-4 sm:px-6">
<main class="w-full">
@@ -135,8 +154,34 @@
</div>
<!-- Menu Navigasi Sidebar -->
<div class="flex-1 overflow-y-auto px-4 py-5 space-y-6">
<!-- Grup: Navigasi Utama -->
<div class="flex-1 overflow-y-auto px-4 py-5 space-y-6 no-scrollbar">
@if(auth()->user()->isSuperAdmin())
<!-- Kategori Khusus Super Admin: Dashboard & Manajemen Role -->
<div>
<p class="px-3 text-[11px] font-bold text-slate-400 uppercase tracking-wider mb-2">
MENU ADMIN
</p>
<nav class="space-y-1">
<a href="{{ route('superadmin.dashboard') }}"
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('superadmin.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="14" width="7" height="7" rx="2"></rect>
<rect x="3" y="14" width="7" height="7" rx="2"></rect>
</svg>
<span>Dashboard</span>
</a>
<a href="{{ route('superadmin.roles.index') }}"
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('superadmin.roles.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-users-gear text-base w-5 text-center"></i>
<span>Manajemen Role</span>
</a>
</nav>
</div>
@else
<!-- Grup: Navigasi Utama (Departemen Lain) -->
<div>
<nav class="space-y-1">
@if(auth()->user()->isHseAdmin())
@@ -178,18 +223,39 @@
<i class="fa-solid fa-shield-halved text-base w-5 text-center"></i>
<span>Verifikasi Pos Gerbang</span>
</a>
@elseif(auth()->user()->isEmployee())
<a href="{{ route('employee.dashboard') }}"
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('employee.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="14" width="7" height="7" rx="2"></rect>
<rect x="3" y="14" width="7" height="7" rx="2"></rect>
</svg>
<span>Dashboard</span>
</a>
<a href="{{ route('p2h.index') }}"
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('p2h.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-clipboard-check text-base w-5 text-center"></i>
<span>Pemeriksaan P2H</span>
</a>
<a href="{{ route('timesheet.index') }}"
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('timesheet.*') || request()->routeIs('mobilisasi.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-car text-base w-5 text-center"></i>
<span>Timesheet</span>
</a>
@endif
</nav>
</div>
<!-- Grup: Modul Operasional RKM -->
<!-- Grup: Modul Operasional Departemen RKM -->
@if(!auth()->user()->isGateOfficer())
<div>
<p class="px-3 text-[11px] font-bold text-slate-400 uppercase tracking-wider mb-2">
MANAJEMEN SISTEM
</p>
<nav class="space-y-1">
@if(auth()->user()->isHseAdmin() || auth()->user()->isAdmin())
@if(auth()->user()->isHseAdmin())
<a href="{{ route('hse.employees.index') }}"
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('hse.employees.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-id-card text-base w-5 text-center"></i>
@@ -197,7 +263,7 @@
</a>
@endif
@if(auth()->user()->isQmaAdmin() || auth()->user()->isAdmin())
@if(auth()->user()->isQmaAdmin())
@php
$isVehicleRoute = request()->routeIs('qma.vehicles.*');
@endphp
@@ -227,20 +293,45 @@
</div>
</div>
<a href="{{ route('qma.activity.log') }}"
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('qma.activity.log') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-clipboard-list text-base w-5 text-center"></i>
<span>Log Aktivitas Kendaraan</span>
@php
$isActivityRoute = request()->routeIs('qma.activity.log') || request()->routeIs('qma.p2h.index') || request()->routeIs('qma.p2h.show');
@endphp
<!-- Dropdown Menu: Log Aktifitas -->
<div>
<button type="button"
onclick="toggleActivityMenu('desktop')"
class="w-full flex items-center justify-between px-3.5 py-2.5 text-sm rounded-xl transition group {{ $isActivityRoute ? 'bg-emerald-50/70 text-[#1b5e20] font-bold' : 'sidebar-item-inactive' }}">
<div class="flex items-center space-x-3">
<i class="fa-solid fa-clipboard-list text-base w-5 text-center {{ $isActivityRoute ? 'text-[#1b5e20]' : '' }}"></i>
<span>Log Aktifitas</span>
</div>
<i id="activityChevronDesktop" class="fa-solid fa-chevron-down text-[11px] transition-transform duration-200 {{ $isActivityRoute ? 'rotate-180 text-[#1b5e20]' : 'text-slate-400 group-hover:text-slate-600' }}"></i>
</button>
<!-- Submenu Dropdown: Timesheet LV & P2H Unit Support (Tanpa Icon) -->
<div id="activitySubmenuDesktop" class="{{ $isActivityRoute ? '' : 'hidden' }} mt-1 pl-7 pr-1 space-y-1">
<a href="{{ route('qma.activity.log') }}"
class="block px-3.5 py-2 text-xs rounded-xl transition {{ request()->routeIs('qma.activity.log') ? 'bg-[#1b5e20] text-white font-bold shadow-sm' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100 font-medium' }}">
<span>Timesheet LV</span>
</a>
<a href="{{ route('qma.p2h.index') }}"
class="block px-3.5 py-2 text-xs rounded-xl transition {{ request()->routeIs('qma.p2h.index') || request()->routeIs('qma.p2h.show') ? 'bg-[#1b5e20] text-white font-bold shadow-sm' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100 font-medium' }}">
<span>P2H Unit Support</span>
</a>
</div>
</div>
<a href="{{ route('qma.p2h.templates') }}"
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('qma.p2h.templates*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-layer-group text-base w-5 text-center"></i>
<span>Master Template P2H</span>
</a>
<a href="{{ route('qma.activity.summary') }}"
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('qma.activity.summary') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-chart-pie text-base w-5 text-center"></i>
<span>Summary Aktivitas</span>
</a>
@endif
@if(auth()->user()->isPgAdmin() || auth()->user()->isAdmin())
@if(auth()->user()->isPgAdmin())
<a href="{{ route('pg.guards.index') }}"
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('pg.guards.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-user-shield text-base w-5 text-center"></i>
@@ -256,6 +347,7 @@
</nav>
</div>
@endif
@endif
<!-- Grup: Pengaturan Akun -->
<div class="mt-6">
@@ -311,96 +403,156 @@
</button>
</div>
<div class="p-4 space-y-4 flex-1 overflow-y-auto">
<p class="text-[11px] font-bold text-slate-400 uppercase tracking-wider px-2">NAVIGASI</p>
<div class="space-y-1">
@if(auth()->user()->isHseAdmin() || auth()->user()->isAdmin())
<a href="{{ route('hse.dashboard') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('hse.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="14" width="7" height="7" rx="2"></rect>
<rect x="3" y="14" width="7" height="7" rx="2"></rect>
</svg>
<span>Dashboard</span>
</a>
<a href="{{ route('hse.employees.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('hse.employees.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-id-card w-5 text-center"></i>
<span>Data Simper</span>
</a>
@endif
@if(auth()->user()->isQmaAdmin() || auth()->user()->isAdmin())
<a href="{{ route('qma.dashboard') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('qma.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="14" width="7" height="7" rx="2"></rect>
<rect x="3" y="14" width="7" height="7" rx="2"></rect>
</svg>
<span>Dashboard</span>
</a>
@php
$isVehicleRouteMob = request()->routeIs('qma.vehicles.*');
@endphp
<div>
<button type="button"
onclick="toggleVehicleMenu('mobile')"
class="w-full flex items-center justify-between px-3 py-2.5 text-sm rounded-xl transition group {{ $isVehicleRouteMob ? 'bg-emerald-50/70 text-[#1b5e20] font-bold' : 'sidebar-item-inactive' }}">
<div class="flex items-center space-x-3">
<i class="fa-solid fa-car w-5 text-center {{ $isVehicleRouteMob ? 'text-[#1b5e20]' : '' }}"></i>
<span>Data Kendaraan</span>
</div>
<i id="vehicleChevronMobile" class="fa-solid fa-chevron-down text-[11px] transition-transform duration-200 {{ $isVehicleRouteMob ? 'rotate-180 text-[#1b5e20]' : 'text-slate-400 group-hover:text-slate-600' }}"></i>
</button>
<div id="vehicleSubmenuMobile" class="{{ $isVehicleRouteMob ? '' : 'hidden' }} mt-1 pl-7 pr-1 space-y-1">
<a href="{{ route('qma.vehicles.lv') }}"
class="block px-3.5 py-2 text-xs rounded-xl transition {{ request()->routeIs('qma.vehicles.lv') ? 'bg-[#1b5e20] text-white font-bold shadow-sm' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100 font-medium' }}">
<span>Light Vehicle</span>
</a>
<a href="{{ route('qma.vehicles.support') }}"
class="block px-3.5 py-2 text-xs rounded-xl transition {{ request()->routeIs('qma.vehicles.support') ? 'bg-[#1b5e20] text-white font-bold shadow-sm' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100 font-medium' }}">
<span>Unit Support</span>
</a>
</div>
<div class="p-4 space-y-4 flex-1 overflow-y-auto no-scrollbar">
@if(auth()->user()->isSuperAdmin())
<div class="mb-3 space-y-1">
<p class="text-[11px] font-bold text-slate-400 uppercase tracking-wider px-2 mb-1">MENU ADMIN</p>
<a href="{{ route('superadmin.dashboard') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('superadmin.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="14" width="7" height="7" rx="2"></rect>
<rect x="3" y="14" width="7" height="7" rx="2"></rect>
</svg>
<span>Dashboard</span>
</a>
<a href="{{ route('superadmin.roles.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('superadmin.roles.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-users-gear w-5 text-center"></i>
<span>Manajemen Role</span>
</a>
</div>
@else
@if(auth()->user()->isHseAdmin())
<a href="{{ route('hse.dashboard') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('hse.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="14" width="7" height="7" rx="2"></rect>
<rect x="3" y="14" width="7" height="7" rx="2"></rect>
</svg>
<span>Dashboard</span>
</a>
<a href="{{ route('hse.employees.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('hse.employees.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-id-card w-5 text-center"></i>
<span>Data Simper</span>
</a>
@endif
@if(auth()->user()->isQmaAdmin())
<a href="{{ route('qma.dashboard') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('qma.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="14" width="7" height="7" rx="2"></rect>
<rect x="3" y="14" width="7" height="7" rx="2"></rect>
</svg>
<span>Dashboard</span>
</a>
<a href="{{ route('qma.activity.log') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('qma.activity.log') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-clipboard-list w-5 text-center"></i>
<span>Log Aktivitas Kendaraan</span>
</a>
@php
$isVehicleRouteMob = request()->routeIs('qma.vehicles.*');
@endphp
<div>
<button type="button"
onclick="toggleVehicleMenu('mobile')"
class="w-full flex items-center justify-between px-3 py-2.5 text-sm rounded-xl transition group {{ $isVehicleRouteMob ? 'bg-emerald-50/70 text-[#1b5e20] font-bold' : 'sidebar-item-inactive' }}">
<div class="flex items-center space-x-3">
<i class="fa-solid fa-car w-5 text-center {{ $isVehicleRouteMob ? 'text-[#1b5e20]' : '' }}"></i>
<span>Data Kendaraan</span>
</div>
<i id="vehicleChevronMobile" class="fa-solid fa-chevron-down text-[11px] transition-transform duration-200 {{ $isVehicleRouteMob ? 'rotate-180 text-[#1b5e20]' : 'text-slate-400 group-hover:text-slate-600' }}"></i>
</button>
<a href="{{ route('qma.activity.summary') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('qma.activity.summary') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-chart-pie w-5 text-center"></i>
<span>Summary Aktivitas</span>
</a>
@endif
@if(auth()->user()->isPgAdmin() || auth()->user()->isAdmin())
<a href="{{ route('pg.dashboard') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('pg.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="14" width="7" height="7" rx="2"></rect>
<rect x="3" y="14" width="7" height="7" rx="2"></rect>
</svg>
<span>Dashboard</span>
</a>
<a href="{{ route('pg.guards.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('pg.guards.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-user-shield w-5 text-center"></i>
<span>Data Satpam</span>
</a>
<a href="{{ route('pg.logs.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('pg.logs.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-clock-rotate-left w-5 text-center"></i>
<span>Log Verifikasi Gerbang</span>
</a>
@endif
@if(auth()->user()->isGateOfficer())
<a href="{{ route('pg.gate.inspection') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('pg.gate.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-shield-halved w-5 text-center"></i>
<span>Verifikasi Pos Gerbang</span>
</a>
<div id="vehicleSubmenuMobile" class="{{ $isVehicleRouteMob ? '' : 'hidden' }} mt-1 pl-7 pr-1 space-y-1">
<a href="{{ route('qma.vehicles.lv') }}"
class="block px-3.5 py-2 text-xs rounded-xl transition {{ request()->routeIs('qma.vehicles.lv') ? 'bg-[#1b5e20] text-white font-bold shadow-sm' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100 font-medium' }}">
<span>Light Vehicle</span>
</a>
<a href="{{ route('qma.vehicles.support') }}"
class="block px-3.5 py-2 text-xs rounded-xl transition {{ request()->routeIs('qma.vehicles.support') ? 'bg-[#1b5e20] text-white font-bold shadow-sm' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100 font-medium' }}">
<span>Unit Support</span>
</a>
</div>
</div>
@php
$isActivityRouteMob = request()->routeIs('qma.activity.log') || request()->routeIs('qma.p2h.index') || request()->routeIs('qma.p2h.show');
@endphp
<div>
<button type="button"
onclick="toggleActivityMenu('mobile')"
class="w-full flex items-center justify-between px-3 py-2.5 text-sm rounded-xl transition group {{ $isActivityRouteMob ? 'bg-emerald-50/70 text-[#1b5e20] font-bold' : 'sidebar-item-inactive' }}">
<div class="flex items-center space-x-3">
<i class="fa-solid fa-clipboard-list w-5 text-center {{ $isActivityRouteMob ? 'text-[#1b5e20]' : '' }}"></i>
<span>Log Aktifitas</span>
</div>
<i id="activityChevronMobile" class="fa-solid fa-chevron-down text-[11px] transition-transform duration-200 {{ $isActivityRouteMob ? 'rotate-180 text-[#1b5e20]' : 'text-slate-400 group-hover:text-slate-600' }}"></i>
</button>
<div id="activitySubmenuMobile" class="{{ $isActivityRouteMob ? '' : 'hidden' }} mt-1 pl-7 pr-1 space-y-1">
<a href="{{ route('qma.activity.log') }}"
class="block px-3.5 py-2 text-xs rounded-xl transition {{ request()->routeIs('qma.activity.log') ? 'bg-[#1b5e20] text-white font-bold shadow-sm' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100 font-medium' }}">
<span>Timesheet LV</span>
</a>
<a href="{{ route('qma.p2h.index') }}"
class="block px-3.5 py-2 text-xs rounded-xl transition {{ request()->routeIs('qma.p2h.index') || request()->routeIs('qma.p2h.show') ? 'bg-[#1b5e20] text-white font-bold shadow-sm' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100 font-medium' }}">
<span>P2H Unit Support</span>
</a>
</div>
</div>
<a href="{{ route('qma.p2h.templates') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('qma.p2h.templates*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-layer-group w-5 text-center"></i>
<span>Master Template P2H</span>
</a>
@endif
@if(auth()->user()->isEmployee())
<a href="{{ route('employee.dashboard') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('employee.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="14" width="7" height="7" rx="2"></rect>
<rect x="3" y="14" width="7" height="7" rx="2"></rect>
</svg>
<span>Dashboard</span>
</a>
<a href="{{ route('p2h.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('p2h.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-clipboard-check w-5 text-center"></i>
<span>Pemeriksaan P2H</span>
</a>
<a href="{{ route('timesheet.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('timesheet.*') || request()->routeIs('mobilisasi.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-car w-5 text-center"></i>
<span>Timesheet</span>
</a>
@endif
@if(auth()->user()->isPgAdmin())
<a href="{{ route('pg.dashboard') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('pg.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="3" width="7" height="7" rx="2"></rect>
<rect x="14" y="14" width="7" height="7" rx="2"></rect>
<rect x="3" y="14" width="7" height="7" rx="2"></rect>
</svg>
<span>Dashboard</span>
</a>
<a href="{{ route('pg.guards.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('pg.guards.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-user-shield w-5 text-center"></i>
<span>Data Satpam</span>
</a>
<a href="{{ route('pg.logs.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('pg.logs.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-clock-rotate-left w-5 text-center"></i>
<span>Log Verifikasi Gerbang</span>
</a>
@endif
@if(auth()->user()->isGateOfficer())
<a href="{{ route('pg.gate.inspection') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('pg.gate.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-shield-halved w-5 text-center"></i>
<span>Verifikasi Pos Gerbang</span>
</a>
@endif
@endif
</div>
@@ -444,7 +596,11 @@
<i class="fa-solid fa-bars text-base"></i>
</button>
<h1 class="text-lg sm:text-xl font-bold text-slate-900 tracking-tight">
@if(request()->routeIs('hse.dashboard') || request()->routeIs('qma.dashboard'))
@if(request()->routeIs('superadmin.dashboard'))
Dashboard Admin
@elseif(request()->routeIs('superadmin.roles.*') || request()->routeIs('superadmin.users.*'))
Manajemen Role
@elseif(request()->routeIs('hse.dashboard') || request()->routeIs('qma.dashboard'))
Dashboard
@elseif(request()->routeIs('hse.employees.*'))
Data Simper
@@ -455,9 +611,15 @@
@elseif(request()->routeIs('qma.vehicles.*'))
Data Kendaraan
@elseif(request()->routeIs('qma.activity.log'))
Log Aktivitas Kendaraan
Timesheet LV
@elseif(request()->routeIs('qma.p2h.summary'))
Summary P2H Unit Support
@elseif(request()->routeIs('qma.p2h.templates*'))
Master Template P2H
@elseif(request()->routeIs('qma.p2h.*'))
P2H Unit Support
@elseif(request()->routeIs('qma.activity.summary'))
Summary Aktivitas
Summary Timesheet LV
@elseif(request()->routeIs('profile.*'))
Profil Saya
@elseif(request()->routeIs('pg.dashboard'))
@@ -468,6 +630,12 @@
Data Satpam
@elseif(request()->routeIs('pg.logs.*'))
Log Verifikasi Gerbang
@elseif(request()->routeIs('employee.dashboard'))
Dashboard
@elseif(request()->routeIs('p2h.*'))
Pemeriksaan P2H
@elseif(request()->routeIs('timesheet.*') || request()->routeIs('mobilisasi.*'))
Timesheet
@else
Dashboard
@endif
@@ -518,7 +686,7 @@
</header>
<!-- 4. KONTEN UTAMA DASHBOARD (ATURAN EMAS: WRAPPER MAX-WIDTH HANYA DI SATU TEMPAT) -->
<main class="md:ml-64 flex-1 min-h-[calc(100vh-4rem)]">
<main class="md:ml-64 flex-1 overflow-y-auto min-h-[calc(100vh-4rem)]">
<div class="p-4 md:p-8 max-w-[1400px] mx-auto w-full">
@yield('content')
</div>
@@ -792,6 +960,18 @@
}
}
// Toggle Dropdown Menu Log Aktifitas (Desktop & Mobile)
function toggleActivityMenu(target) {
const submenu = document.getElementById(target === 'desktop' ? 'activitySubmenuDesktop' : 'activitySubmenuMobile');
const chevron = document.getElementById(target === 'desktop' ? 'activityChevronDesktop' : 'activityChevronMobile');
if (submenu) {
submenu.classList.toggle('hidden');
}
if (chevron) {
chevron.classList.toggle('rotate-180');
}
}
// Toggle Dropdown Menu Profil Pengguna di Pojok Kanan Atas
function toggleProfileDropdown() {
const dropdown = document.getElementById('userProfileDropdownMenu');
+260
View File
@@ -0,0 +1,260 @@
@extends('layouts.app')
@section('title', 'Katalog Kendaraan Ringan (LV) - Mobilisasi Operasional')
@section('content')
<div class="w-full space-y-6">
<!-- Header Halaman Simple Kayak Satpam (Seamless, Tanpa Card Wrapper) -->
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-3 border-b border-slate-200/80">
<div class="min-w-0">
<div class="flex items-center flex-wrap gap-2.5">
<h1 class="text-lg sm:text-xl font-black text-slate-900 tracking-tight">
Timesheet Kendaraan Ringan
</h1>
<span class="px-2.5 py-1 rounded-lg text-xs font-black bg-emerald-50 text-emerald-800 border border-emerald-200">
Kendaraan Ringan (LV)
</span>
</div>
<div class="text-sm sm:text-base text-slate-600 font-medium truncate mt-1 flex items-center flex-wrap gap-1.5">
<span>Pengemudi: <strong class="text-slate-900 font-bold">{{ $employee ? $employee->name : auth()->user()->name }}</strong></span>
@if($employee && $employee->nik)
<span class="text-slate-500 font-mono text-xs sm:text-sm font-semibold">({{ $employee->nik }})</span>
@endif
@if($employee && $employee->hasValidSimper())
<span class="inline-flex items-center text-[10px] font-bold text-emerald-700 bg-emerald-100/80 px-2 py-0.5 rounded-md ml-1">
<i class="fa-solid fa-circle-check mr-1 text-emerald-600"></i> SIMPER Aktif
</span>
@elseif($employee)
<span class="inline-flex items-center text-[10px] font-bold text-rose-700 bg-rose-100/80 px-2 py-0.5 rounded-md ml-1">
<i class="fa-solid fa-circle-xmark mr-1 text-rose-600"></i> SIMPER Exp
</span>
@endif
</div>
</div>
</div>
<!-- Filter & Search Bar (Tanpa Card Wrapper, Format Referensi Sesuai Standar) -->
<form method="GET" action="{{ route('mobilisasi.index') }}" id="lvFilterForm" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-2.5 sm:gap-3">
<!-- Pencarian Cepat di Kiri -->
<div class="relative w-full 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>
</span>
<input type="text"
name="search"
id="lvSearchInput"
value="{{ request('search') }}"
placeholder="Cari kode unit (LV01), nopol, atau model..."
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-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 shadow-sm transition">
</div>
<!-- Tombol Reset Filter di Kanan -->
<div id="lvResetContainer" class="flex items-center justify-end">
@if(request()->filled('search'))
<a href="{{ route('mobilisasi.index') }}"
id="lvResetBtn"
class="text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center justify-center sm:justify-start space-x-1.5 transition whitespace-nowrap py-1 sm:py-0">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Reset Filter</span>
</a>
@endif
</div>
</form>
<!-- Grid Kartu Kendaraan Ringan (LV) -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4" id="lvCardsContainer">
@forelse($vehicles as $v)
<div class="lv-card bg-white rounded-2xl border border-slate-200 shadow-sm hover:shadow-md transition p-5 flex flex-col justify-between">
<div>
<!-- Badge Kategori & Status -->
<div class="flex items-center justify-between mb-3">
<span class="inline-flex items-center px-2.5 py-1 rounded-lg text-[11px] font-bold bg-emerald-50 text-emerald-800 border border-emerald-200">
Kendaraan Ringan (LV)
</span>
@php
$statusBadge = match($v->status) {
'Operation' => 'bg-emerald-50 text-emerald-700 border-emerald-200',
'Standby' => 'bg-amber-50 text-amber-700 border-amber-200',
'Breakdown' => 'bg-rose-50 text-rose-700 border-rose-200',
default => 'bg-slate-50 text-slate-700 border-slate-200',
};
$nextDir = $v->determineNextAllowedDirection();
@endphp
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-bold border {{ $statusBadge }}">
{{ $v->status }}
</span>
</div>
<!-- Kode & Nopol -->
<div class="flex items-baseline justify-between">
<h3 class="text-xl font-black text-slate-900 leading-tight">{{ $v->code }}</h3>
<span class="font-mono text-xs font-bold text-amber-700 bg-amber-50 border border-amber-200/80 px-2 py-0.5 rounded-md">
{{ $v->license_plate ?? 'Tanpa Plat' }}
</span>
</div>
<p class="text-xs text-slate-600 font-medium mt-1 line-clamp-1">{{ $v->brand_type }}</p>
<!-- Info Atribut -->
<div class="mt-4 space-y-1.5 text-xs text-slate-500 bg-slate-50 p-3 rounded-xl border border-slate-100">
<div class="flex items-center justify-between">
<span class="text-slate-400">Odometer Terakhir:</span>
<span class="font-extrabold text-slate-800">{{ number_format($v->current_km, 0, ',', '.') }} KM</span>
</div>
<div class="flex items-center justify-between">
<span class="text-slate-400">Penanggung Jawab:</span>
<span class="font-semibold text-slate-700 truncate max-w-[150px]">{{ $v->ownership ?? '-' }}</span>
</div>
<div class="flex items-center justify-between">
<span class="text-slate-400">Status Pergerakan:</span>
<span class="font-bold {{ $nextDir === 'Keluar' ? 'text-amber-700' : 'text-blue-700' }}">
Menunggu {{ $nextDir }}
</span>
</div>
</div>
</div>
<!-- Tombol Buka Form Mobilisasi -->
<div class="mt-5 pt-3 border-t border-slate-100">
@if($v->status === 'Breakdown')
<div class="w-full bg-rose-50 border border-rose-200 text-rose-700 font-bold py-2.5 px-4 rounded-xl text-center text-xs">
<i class="fa-solid fa-triangle-exclamation mr-1.5"></i>
<span>Unit Sedang Breakdown</span>
</div>
@else
<a href="{{ route('vehicle.activity.form', ['code' => $v->code]) }}" class="w-full bg-[#1b5e20] hover:bg-[#144918] active:scale-[0.99] text-white font-bold py-2.5 px-4 rounded-xl shadow-sm transition text-center block text-xs">
Isi Form Mobilisasi LV
</a>
@endif
</div>
</div>
@empty
<div id="lvServerEmptyCard" class="col-span-full bg-white rounded-2xl border border-slate-200 p-12 text-center">
<div class="w-16 h-16 rounded-full bg-slate-100 text-slate-400 flex items-center justify-center mx-auto mb-3">
<i class="fa-solid fa-magnifying-glass text-2xl"></i>
</div>
@if(request('search'))
<h3 class="text-base font-bold text-slate-800">
Data "<span class="text-rose-600 font-bold">{{ request('search') }}</span>" tidak ditemukan di tabel
</h3>
<p class="text-xs text-slate-500 mt-1">Pastikan kode unit atau nopol kendaraan yang dicari sudah benar.</p>
<div class="mt-4">
<a href="{{ route('mobilisasi.index') }}" class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</a>
</div>
@else
<h3 class="text-base font-bold text-slate-800">Kendaraan Ringan Tidak Ditemukan</h3>
<p class="text-xs text-slate-500 mt-1">Belum ada unit kendaraan LV yang terdaftar.</p>
@endif
</div>
@endforelse
</div>
<!-- Pagination -->
@if($vehicles->hasPages())
<div class="bg-white p-4 rounded-2xl border border-slate-200 shadow-sm" id="lvPaginationContainer">
{{ $vehicles->links() }}
</div>
@endif
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Search Real-Time Client-Side
const searchInput = document.getElementById('lvSearchInput');
const resetContainer = document.getElementById('lvResetContainer');
const cardsContainer = document.getElementById('lvCardsContainer');
const paginationContainer = document.getElementById('lvPaginationContainer');
const serverEmptyCard = document.getElementById('lvServerEmptyCard');
const hasServerFilters = {{ request()->filled('search') ? 'true' : 'false' }};
function escapeHtml(str) {
const div = document.createElement('div');
div.textContent = str;
return div.innerHTML;
}
searchInput?.addEventListener('input', function(e) {
const rawValue = e.target.value;
const query = rawValue.toLowerCase().trim();
const items = document.querySelectorAll('#lvCardsContainer .lv-card');
let visibleCount = 0;
items.forEach(item => {
const text = item.textContent.toLowerCase();
const match = text.includes(query);
item.style.display = match ? '' : 'none';
if (match) visibleCount++;
});
// Sembunyikan pesan SSR kosong saat mengetik
if (serverEmptyCard) {
serverEmptyCard.style.display = query.length > 0 ? 'none' : '';
}
// Hapus pesan kosong pencarian jika ada sebelumnya
const existingEmptyCard = document.getElementById('lvEmptySearchCard');
if (existingEmptyCard) {
existingEmptyCard.remove();
}
// Tampilkan pesan kosong jika tidak ada data yang cocok
if (visibleCount === 0 && query.length > 0) {
const emptyDiv = document.createElement('div');
emptyDiv.id = 'lvEmptySearchCard';
emptyDiv.className = 'col-span-full bg-white rounded-2xl border border-slate-200 p-12 text-center shadow-sm';
emptyDiv.innerHTML = `
<div class="w-16 h-16 rounded-full bg-rose-50 text-rose-500 flex items-center justify-center mx-auto mb-3">
<i class="fa-solid fa-magnifying-glass text-2xl"></i>
</div>
<h3 class="text-base font-bold text-slate-800">
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
</h3>
<p class="text-xs text-slate-500 mt-1">
Pastikan kode unit atau nopol kendaraan yang dicari sudah benar.
</p>
<div class="mt-4">
<button type="button"
onclick="const inp = document.getElementById('lvSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</button>
</div>
`;
cardsContainer?.appendChild(emptyDiv);
}
// Sembunyikan pagination saat client-side search aktif
if (paginationContainer) {
paginationContainer.style.display = query.length > 0 ? 'none' : '';
}
// Tampilkan / sembunyikan tombol Reset Filter (merah fa-rotate-left) secara real-time
let resetBtn = document.getElementById('lvResetBtn');
if (query.length > 0) {
if (!resetBtn && resetContainer) {
resetBtn = document.createElement('a');
resetBtn.id = 'lvResetBtn';
resetBtn.href = "{{ route('mobilisasi.index') }}";
resetBtn.className = "text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center justify-center sm:justify-start space-x-1.5 transition whitespace-nowrap py-1 sm:py-0";
const resetIcon = document.createElement('i');
resetIcon.className = "fa-solid fa-rotate-left text-[11px]";
const resetText = document.createElement('span');
resetText.textContent = "Reset Filter";
resetBtn.appendChild(resetIcon);
resetBtn.appendChild(resetText);
resetContainer.appendChild(resetBtn);
}
} else if (!hasServerFilters && resetBtn) {
resetBtn.remove();
}
});
});
</script>
@endsection
+425
View File
@@ -0,0 +1,425 @@
@extends('layouts.app')
@section('title', 'Form P2H Unit Support - ' . $vehicle->code)
@section('content')
<div class="max-w-3xl mx-auto space-y-4">
<!-- Navigasi Kembali & Logo -->
<div class="flex items-center justify-between pb-1">
<a href="{{ route('p2h.index') }}" class="inline-flex items-center space-x-1.5 text-xs font-bold text-slate-600 hover:text-[#1b5e20] transition bg-white px-3 py-1.5 rounded-xl border border-slate-200 shadow-sm">
<i class="fa-solid fa-arrow-left text-[11px]"></i>
<span>Kembali ke Katalog Unit</span>
</a>
<img src="{{ asset('images/logo-kerinci.png') }}" alt="Kerinci Hydropower" class="h-7 w-auto object-contain">
</div>
<!-- Header Info Unit Support (Readonly Card - Selaras dengan Form LV) -->
<div class="bg-gradient-to-r from-slate-800 to-slate-900 text-white p-5 rounded-2xl shadow-sm border border-slate-700">
<div class="flex items-center justify-between mb-3">
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-semibold bg-amber-500/20 text-amber-300 border border-amber-500/30">
Unit Support
</span>
<span class="text-xs text-slate-400 flex items-center">
<span class="w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse mr-1.5"></span>
Checksheet: <span class="text-emerald-300 font-bold ml-1">{{ $template->code ?? 'P2H' }}</span>
</span>
</div>
<h2 class="text-xl font-bold tracking-tight text-white mb-3">Pemeriksaan Pra-Harian (P2H) Unit Support</h2>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2 text-xs text-slate-300 bg-slate-800/80 p-3 rounded-xl border border-slate-700/80">
<div><span class="text-slate-400 font-medium">Kode Unit:</span> <span class="font-black text-white text-sm ml-1">{{ $vehicle->code }}</span></div>
<div><span class="text-slate-400 font-medium">Kategori Alat:</span> <span class="font-bold text-amber-300 text-sm ml-1">{{ $vehicle->unit_category ?? ($template->name ?? '-') }}</span></div>
<div class="col-span-1 sm:col-span-2"><span class="text-slate-400 font-medium">Merek / Tipe Model:</span> <span class="text-white ml-1 font-semibold">{{ $vehicle->brand_type }}</span></div>
<div><span class="text-slate-400 font-medium">Lokasi Operasi:</span> <span class="text-slate-200 ml-1">{{ $vehicle->location ?? '-' }}</span></div>
<div><span class="text-slate-400 font-medium">HM Terakhir:</span> <span class="font-bold text-emerald-400 text-sm ml-1">{{ number_format($vehicle->current_km, 1, ',', '.') }} HM</span></div>
</div>
</div>
<!-- Alert Jika Terjadi Masalah SIMPER atau Autentikasi -->
@if($simperError)
@if(auth()->user()->isQmaAdmin() || auth()->user()->isSuperAdmin())
<div class="p-4 sm:p-5 bg-blue-50 border border-blue-200 rounded-2xl text-blue-900 text-xs flex items-start space-x-3.5 shadow-sm">
<div class="w-9 h-9 rounded-xl bg-blue-100 text-blue-700 flex items-center justify-center font-bold text-base flex-shrink-0">
<i class="fa-solid fa-user-shield"></i>
</div>
<div class="flex-1">
<span class="font-bold block text-sm mb-1 text-blue-950">Wewenang Role: Admin QMA (Validator / Verifikator)</span>
<p class="leading-relaxed text-blue-800">{{ $simperError }}</p>
<div class="mt-3 flex items-center gap-2">
<a href="{{ route('qma.p2h.index') }}"
class="inline-flex items-center justify-center space-x-1.5 px-3 py-2 sm:px-3.5 sm:py-1.5 rounded-xl bg-[#1b5e20] text-white font-bold text-xs hover:bg-[#144919] transition shadow-xs flex-shrink-0"
title="Buka Verifikasi & Approval P2H di Menu QMA">
<i class="fa-solid fa-clipboard-check text-xs"></i>
<span class="hidden sm:inline">Buka Verifikasi & Approval P2H di Menu QMA</span>
</a>
<a href="{{ route('p2h.index') }}" class="inline-flex items-center justify-center space-x-1 px-3 py-2 sm:py-1.5 rounded-xl bg-white border border-blue-200 text-blue-700 font-semibold text-xs hover:bg-blue-100/50 transition">
<span>Kembali ke Katalog Unit</span>
</a>
</div>
</div>
</div>
@else
<div class="p-4 bg-rose-50 border border-rose-200 rounded-2xl text-rose-800 text-xs flex items-start space-x-3 shadow-sm">
<div class="w-8 h-8 rounded-xl bg-rose-100 text-rose-600 flex items-center justify-center font-bold text-base flex-shrink-0">
<i class="fa-solid fa-triangle-exclamation"></i>
</div>
<div class="flex-1">
<span class="font-bold block text-sm mb-0.5 text-rose-900">Akses Pengoperasian Tidak Diizinkan</span>
<p class="leading-relaxed">{{ $simperError }}</p>
<p class="mt-2 text-[11px] font-semibold text-rose-700">Hubungi Divisi HSE untuk pendaftaran atau perpanjangan lisensi SIMPER Anda.</p>
</div>
</div>
@endif
@endif
<!-- Card Operator Terverifikasi (Otomatis Terisi dari Akun Login) -->
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 p-4 sm:p-5 flex items-center justify-between gap-3">
<div class="flex items-center space-x-3 min-w-0">
@if(auth()->user()->isQmaAdmin() || auth()->user()->isSuperAdmin())
<div class="w-10 h-10 rounded-full bg-blue-100 text-blue-700 flex items-center justify-center font-bold text-base flex-shrink-0">
<i class="fa-solid fa-user-shield"></i>
</div>
<div class="min-w-0">
<div class="flex items-center space-x-2 flex-wrap">
<span class="text-sm font-bold text-slate-900">{{ auth()->user()->name }}</span>
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold bg-blue-100 text-blue-800">
<i class="fa-solid fa-shield-halved mr-1"></i> Admin QMA
</span>
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-medium bg-slate-100 text-slate-600">
<i class="fa-solid fa-lock text-slate-400 mr-1"></i> Akun Login Terverifikasi
</span>
</div>
<p class="text-xs text-slate-500 mt-0.5 truncate">
<span>Username: {{ auth()->user()->username }}</span> &bull;
<span>Departemen QMA</span> &bull;
<span class="text-blue-700 font-medium">Wewenang: Verifikator / Validator</span>
</p>
</div>
@else
<div class="w-10 h-10 rounded-full {{ $employee && $employee->hasValidSimper() ? 'bg-emerald-100 text-[#1b5e20]' : 'bg-rose-100 text-rose-700' }} flex items-center justify-center font-bold text-base flex-shrink-0">
<i class="fa-solid {{ $employee && $employee->hasValidSimper() ? 'fa-user-check' : 'fa-user-xmark' }}"></i>
</div>
<div class="min-w-0">
<div class="flex items-center space-x-2 flex-wrap">
<span class="text-sm font-bold text-slate-900">{{ $employee->name ?? auth()->user()->name }}</span>
@if($employee && $employee->hasValidSimper())
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold bg-emerald-100 text-emerald-800">
<i class="fa-solid fa-shield-check mr-1"></i> SIMPER Aktif
</span>
@else
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold bg-rose-100 text-rose-800">
<i class="fa-solid fa-circle-xmark mr-1"></i> SIMPER Tidak Aktif
</span>
@endif
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-medium bg-slate-100 text-slate-600">
<i class="fa-solid fa-lock text-slate-400 mr-1"></i> Akun Login Terverifikasi
</span>
</div>
<p class="text-xs text-slate-500 mt-0.5 truncate">
<span>NIK: {{ $employee->nik ?? auth()->user()->username }}</span> &bull;
<span>{{ $employee->division ?? 'Operasional' }}</span> &bull;
<span class="{{ $employee && $employee->hasValidSimper() ? 'text-emerald-700 font-medium' : 'text-rose-700 font-medium' }}">
Masa Berlaku: {{ $employee && $employee->simper_expired_at ? $employee->simper_expired_at->format('d/m/Y') : 'Tidak Ada' }}
</span>
</p>
</div>
@endif
</div>
</div>
<!-- Form Utama P2H Unit Support -->
<form action="{{ route('p2h.store', ['code' => $vehicle->code]) }}" method="POST" id="p2hForm" class="space-y-4">
@csrf
<input type="hidden" name="template_id" value="{{ $template->id }}">
<!-- Card Input Operasional (Hour Meter) -->
<input type="hidden" name="shift" value="Shift 1 (Siang)">
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 p-4 sm:p-5">
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
<div>
<label for="start_hm" class="block text-xs font-bold uppercase tracking-wider text-slate-700">
Hour Meter (HM) Saat Ini <span class="text-rose-500">*</span>
</label>
<p class="text-xs text-slate-400 mt-0.5">HM sebelumnya: <span class="font-semibold text-slate-600">{{ number_format($vehicle->current_km, 1, ',', '.') }} HM</span></p>
</div>
<div class="relative w-full sm:w-64">
<input type="number" step="0.1" name="start_hm" id="start_hm"
value="{{ old('start_hm', $vehicle->current_km) }}"
min="{{ $vehicle->current_km }}"
required
placeholder="0,00"
class="w-full rounded-xl border border-slate-300 bg-white pl-4 pr-12 py-2.5 text-sm text-slate-800 font-bold focus:border-emerald-500 focus:ring-4 focus:ring-emerald-500/10 transition">
<div class="absolute inset-y-0 right-0 pr-3.5 flex items-center pointer-events-none text-xs font-extrabold text-slate-400">
HM
</div>
</div>
</div>
</div>
@php
$sectionKeys = [];
foreach ($groupedItems as $sName => $sItems) {
$sectionKeys[] = 'sec_' . md5($sName);
}
@endphp
<!-- Section Kuesioner P2H dengan Format Tab Horizontal Kesamping -->
<div class="space-y-3">
<!-- Header Judul & Tombol Tandai Semua Baik -->
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-2.5 px-1">
<div>
<h3 class="font-extrabold text-slate-900 text-base">Checklist Pemeriksaan Kelaikan (P2H)</h3>
<p class="text-xs text-slate-500">Pilih opsi <strong>Baik</strong> jika kondisi normal, atau <strong>Rusak</strong> jika ada abnormalitas.</p>
</div>
<button type="button" onclick="setAllBaik()" class="text-xs font-bold text-[#1b5e20] hover:text-[#144918] bg-emerald-50 hover:bg-emerald-100 border border-emerald-200 px-3 py-1.5 rounded-xl transition flex items-center justify-center space-x-1.5 shadow-sm self-start sm:self-auto cursor-pointer">
<i class="fa-solid fa-check-double text-[11px]"></i>
<span>Tandai Semua Baik</span>
</button>
</div>
<!-- 1. Baris Section Horizontal (Dari Kiri ke Kanan Sesuai Format Master Template) -->
<div class="flex items-center gap-2 overflow-x-auto pb-2 scrollbar-thin" id="p2hTabsContainer">
@foreach($groupedItems as $sectionName => $itemsInSection)
@php
$secKey = 'sec_' . md5($sectionName);
$isFirst = $loop->first;
@endphp
<button type="button"
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' }}">
<span>{{ $sectionName }}</span>
</button>
@endforeach
</div>
<!-- 2. Panel Konten List Pertanyaan Berdasarkan Section yang Dipilih -->
<div id="p2hPanelsContainer" class="space-y-4">
@foreach($groupedItems as $sectionName => $itemsInSection)
@php
$secKey = 'sec_' . md5($sectionName);
$isFirst = $loop->first;
$prevKey = isset($sectionKeys[$loop->index - 1]) ? $sectionKeys[$loop->index - 1] : null;
$nextKey = isset($sectionKeys[$loop->index + 1]) ? $sectionKeys[$loop->index + 1] : null;
@endphp
<div class="p2h-section-content bg-white rounded-none sm:rounded-2xl border border-slate-200 shadow-sm overflow-hidden transition-all duration-200 {{ $isFirst ? '' : 'hidden' }}"
id="p2h-content-{{ $secKey }}">
<!-- Header Panel Section Aktif Sesuai Referensi Master Template -->
<div class="p-4 sm:p-5 border-b border-slate-100 flex items-center justify-between gap-3 bg-white">
<div class="min-w-0">
<div class="flex flex-wrap items-center gap-2 sm:gap-3">
<h3 class="font-bold text-slate-900 text-base sm:text-lg tracking-tight truncate">
{{ $sectionName }}
</h3>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-semibold bg-emerald-50 text-[#1b5e20] border border-emerald-200/80">
{{ count($itemsInSection) }} Pertanyaan
</span>
</div>
<p class="text-xs text-slate-400 mt-0.5 truncate hidden sm:block">
Daftar butir pertanyaan inspeksi pra-harian pada bagian ini.
</p>
</div>
</div>
<!-- List Pertanyaan di Bagian Ini -->
<div class="divide-y divide-slate-100 p-2 sm:p-4 space-y-1">
@foreach($itemsInSection as $item)
<div class="p-3 rounded-xl hover:bg-slate-50/70 transition space-y-2">
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
<div class="flex-1 pr-2">
<div class="flex items-start space-x-2">
<span class="text-xs font-bold text-slate-400 mt-0.5">{{ $item->sequence ?? $loop->iteration }}.</span>
<span class="text-xs font-semibold text-slate-800 leading-snug">{{ $item->title }}</span>
</div>
</div>
@if(in_array($item->question_type, ['choice', 'condition', 'Multiple choice: only one answer', 'Matrix']))
<!-- Opsi Jawaban Radio: Baik & Rusak -->
<div class="flex items-center space-x-2 flex-shrink-0">
<label class="cursor-pointer">
<input type="radio"
name="items[{{ $item->id }}][condition]"
value="baik"
checked
onchange="handleConditionChange({{ $item->id }}, 'baik')"
class="peer sr-only">
<span class="inline-flex items-center justify-center min-w-[62px] px-3.5 py-1.5 rounded-xl text-xs font-bold border border-slate-300 text-slate-600 bg-white peer-checked:bg-[#1b5e20] peer-checked:text-white peer-checked:border-[#1b5e20] peer-checked:shadow-sm transition">
<span>Baik</span>
</span>
</label>
<label class="cursor-pointer">
<input type="radio"
name="items[{{ $item->id }}][condition]"
value="rusak"
onchange="handleConditionChange({{ $item->id }}, 'rusak')"
class="peer sr-only">
<span class="inline-flex items-center justify-center space-x-1.5 min-w-[68px] px-3.5 py-1.5 rounded-xl text-xs font-bold border border-slate-300 text-slate-600 bg-white peer-checked:bg-rose-600 peer-checked:text-white peer-checked:border-rose-600 peer-checked:shadow-sm transition">
<i class="fa-solid fa-triangle-exclamation text-[11px]"></i>
<span>Rusak</span>
</span>
</label>
</div>
@elseif(in_array($item->question_type, ['multiple_choice', 'Multiple choice: multiple answers allowed']))
<!-- Checkbox Pilihan Ganda -->
<div class="flex items-center space-x-2 flex-shrink-0">
<label class="cursor-pointer inline-flex items-center space-x-1.5 px-3 py-1.5 rounded-xl text-xs font-bold border border-slate-300 text-slate-700 bg-white hover:bg-slate-50 transition">
<input type="checkbox"
name="items[{{ $item->id }}][answer]"
value="Sesuai"
class="rounded text-[#1b5e20] focus:ring-[#1b5e20]">
<span>Sesuai Standar</span>
</label>
</div>
@elseif(in_array($item->question_type, ['number', 'Numerical Value']))
<div class="sm:w-48 flex-shrink-0">
<input type="number" step="0.1" name="items[{{ $item->id }}][answer]" placeholder="Nilai angka..." class="w-full text-xs font-semibold px-3 py-1.5 rounded-xl border border-slate-300 focus:border-emerald-500">
</div>
@elseif(in_array($item->question_type, ['date', 'Date']))
<div class="sm:w-48 flex-shrink-0">
<input type="date" name="items[{{ $item->id }}][answer]" value="{{ date('Y-m-d') }}" class="w-full text-xs font-semibold px-3 py-1.5 rounded-xl border border-slate-300 focus:border-emerald-500">
</div>
@elseif(in_array($item->question_type, ['datetime', 'Datetime']))
<div class="sm:w-48 flex-shrink-0">
<input type="datetime-local" name="items[{{ $item->id }}][answer]" value="{{ date('Y-m-d\TH:i') }}" class="w-full text-xs font-semibold px-3 py-1.5 rounded-xl border border-slate-300 focus:border-emerald-500">
</div>
@elseif(in_array($item->question_type, ['textarea', 'Multiple Lines Text Box']))
<div class="sm:w-72 flex-shrink-0">
<textarea rows="2" name="items[{{ $item->id }}][answer]" placeholder="Catatan lengkap..." class="w-full text-xs px-3 py-1.5 rounded-xl border border-slate-300 focus:border-emerald-500"></textarea>
</div>
@else
<div class="sm:w-64 flex-shrink-0">
<input type="text" name="items[{{ $item->id }}][answer]" placeholder="Catatan singkat..." class="w-full text-xs px-3 py-1.5 rounded-xl border border-slate-300 focus:border-emerald-500">
</div>
@endif
</div>
<!-- Box Keterangan Tambahan Jika Rusak -->
<div id="notes_box_{{ $item->id }}" class="hidden mt-2 pt-2 border-t border-rose-100/80 transition-all">
<div class="relative flex items-center">
<span class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-rose-500 text-xs">
<i class="fa-solid fa-triangle-exclamation"></i>
</span>
<input type="text"
name="items[{{ $item->id }}][notes]"
placeholder="Jelaskan detail kerusakan pada bagian ini..."
class="w-full text-xs pl-10 pr-3.5 py-2 rounded-xl border border-rose-300 bg-rose-50/50 text-rose-900 placeholder:text-rose-400 focus:outline-none focus:border-rose-600 focus:ring-2 focus:ring-rose-500/20 shadow-2xs transition">
</div>
</div>
</div>
@endforeach
</div>
<!-- Navigasi Cepat Antar Section (Sebelumnya & Selanjutnya) -->
@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">
<i class="fa-solid fa-chevron-left text-[10px]"></i>
<span>Bagian Sebelumnya</span>
</button>
@else
<div></div>
@endif
@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>
<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>
@endif
</div>
@endif
</div>
@endforeach
</div>
</div>
<!-- Card Catatan Umum Operator -->
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 p-5 space-y-3">
<label for="general_notes" class="block text-xs font-bold uppercase tracking-wider text-slate-700">
Catatan Umum / Keterangan Tambahan Operator
</label>
<textarea name="general_notes" id="general_notes" rows="3" placeholder="Tuliskan temuan atau catatan umum lainnya mengenai kondisi unit support 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>
<button type="submit"
id="btnSubmitP2h"
{{ $simperError ? 'disabled' : '' }}
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 disabled:bg-slate-200 disabled:text-slate-400 disabled:cursor-not-allowed cursor-pointer">
<i class="fa-solid fa-paper-plane text-xs"></i>
<span>Kirim Formulir P2H ke QMA</span>
</button>
</div>
</form>
</div>
@endsection
@section('scripts')
<script>
function switchP2hSection(secKey) {
// 1. Update tab styling
const allTabs = document.querySelectorAll('.p2h-section-tab');
allTabs.forEach(tab => {
const key = tab.dataset.sectionKey;
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.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });
} 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';
}
});
// 2. Show active panel, hide others
const allPanels = document.querySelectorAll('.p2h-section-content');
allPanels.forEach(panel => {
if (panel.id === 'p2h-content-' + secKey) {
panel.classList.remove('hidden');
} else {
panel.classList.add('hidden');
}
});
}
function handleConditionChange(itemId, condition) {
const notesBox = document.getElementById('notes_box_' + itemId);
if (notesBox) {
if (condition === 'rusak') {
notesBox.classList.remove('hidden');
const input = notesBox.querySelector('input');
if (input) input.focus();
} else {
notesBox.classList.add('hidden');
}
}
}
function setAllBaik() {
const radiosBaik = document.querySelectorAll('input[type="radio"][value="baik"]');
radiosBaik.forEach(r => {
r.checked = true;
const match = r.name.match(/items\[(\d+)\]/);
if (match && match[1]) {
handleConditionChange(match[1], 'baik');
}
});
}
</script>
@endsection
+263
View File
@@ -0,0 +1,263 @@
@extends('layouts.app')
@section('title', 'Pemeriksaan Pra-Harian (P2H) Unit Support')
@section('content')
<div class="w-full space-y-6">
<!-- Header Halaman Simple Kayak Satpam (Seamless, Tanpa Card Wrapper) -->
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-3 border-b border-slate-200/80">
<div class="min-w-0">
<div class="flex items-center flex-wrap gap-2.5">
<h1 class="text-lg sm:text-xl font-black text-slate-900 tracking-tight">
Katalog Pemeriksaan Pra-Harian (P2H)
</h1>
<span class="px-2.5 py-1 rounded-lg text-xs font-black bg-amber-50 text-amber-800 border border-amber-200">
Unit Support
</span>
</div>
<div class="text-sm sm:text-base text-slate-600 font-medium truncate mt-1 flex items-center flex-wrap gap-1.5">
<span>Operator: <strong class="text-slate-900 font-bold">{{ $employee ? $employee->name : auth()->user()->name }}</strong></span>
@if($employee && $employee->nik)
<span class="text-slate-500 font-mono text-xs sm:text-sm font-semibold">({{ $employee->nik }})</span>
@endif
@if($employee && $employee->hasValidSimper())
<span class="inline-flex items-center text-[10px] font-bold text-emerald-700 bg-emerald-100/80 px-2 py-0.5 rounded-md ml-1">
<i class="fa-solid fa-circle-check mr-1 text-emerald-600"></i> SIMPER Aktif
</span>
@elseif($employee)
<span class="inline-flex items-center text-[10px] font-bold text-rose-700 bg-rose-100/80 px-2 py-0.5 rounded-md ml-1">
<i class="fa-solid fa-circle-xmark mr-1 text-rose-600"></i> SIMPER Exp
</span>
@endif
</div>
</div>
</div>
<!-- Filter & Search Bar (Tanpa Card Wrapper, Format Referensi Data Karyawan) -->
<form method="GET" action="{{ route('p2h.index') }}" id="p2hFilterForm" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-2.5 sm:gap-3">
<!-- Pencarian Cepat di Kiri -->
<div class="relative w-full 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>
</span>
<input type="text"
name="search"
id="p2hSearchInput"
value="{{ request('search') }}"
placeholder="Cari kode unit (EX01), model, atau lokasi..."
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-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 shadow-sm transition">
</div>
<!-- Filter Dropdown & Tombol di Kanan -->
<div class="flex flex-col sm:flex-row items-stretch sm:items-center justify-end gap-2 sm:gap-2.5 w-full sm:w-auto">
<div class="w-full sm:w-auto">
<select name="unit_category"
id="p2hCategorySelect"
onchange="this.form.submit()"
class="w-full sm:w-auto text-xs rounded-xl border border-slate-200 bg-white px-3 py-2.5 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 shadow-sm transition truncate">
<option value="">Semua Kategori Alat</option>
@foreach($categories as $cat)
<option value="{{ $cat }}" {{ request('unit_category') == $cat ? 'selected' : '' }}>{{ $cat }}</option>
@endforeach
</select>
</div>
<!-- Tombol Reset Filter (Merah / Rose Clean Text Persis Halaman Karyawan) -->
<div id="p2hResetContainer">
@if(request()->anyFilled(['search', 'unit_category']))
<a href="{{ route('p2h.index') }}"
id="p2hResetBtn"
class="text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center justify-center sm:justify-start space-x-1.5 transition whitespace-nowrap py-1 sm:py-0 sm:ml-2">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Reset Filter</span>
</a>
@endif
</div>
</div>
</form>
<!-- Grid Kartu Unit Support -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4" id="p2hCardsContainer">
@forelse($vehicles as $v)
<div class="p2h-card bg-white rounded-2xl border border-slate-200 shadow-sm hover:shadow-md transition p-5 flex flex-col justify-between">
<div>
<!-- Badge Kategori & Status -->
<div class="flex items-center justify-between mb-3">
<span class="inline-flex items-center px-2.5 py-1 rounded-lg text-[11px] font-bold bg-amber-50 text-amber-800 border border-amber-200">
{{ $v->unit_category ?? 'Unit Support' }}
</span>
@php
$statusBadge = match($v->status) {
'Operation' => 'bg-emerald-50 text-emerald-700 border-emerald-200',
'Standby' => 'bg-amber-50 text-amber-700 border-amber-200',
'Breakdown' => 'bg-rose-50 text-rose-700 border-rose-200',
default => 'bg-slate-50 text-slate-700 border-slate-200',
};
@endphp
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-bold border {{ $statusBadge }}">
{{ $v->status }}
</span>
</div>
<!-- Kode & Tipe Unit -->
<h3 class="text-lg font-black text-slate-900 leading-tight">{{ $v->code }}</h3>
<p class="text-xs text-slate-600 font-medium mt-0.5 line-clamp-1">{{ $v->brand_type }}</p>
<!-- Info Atribut -->
<div class="mt-4 space-y-1.5 text-xs text-slate-500 bg-slate-50 p-3 rounded-xl border border-slate-100">
<div class="flex items-center justify-between">
<span class="text-slate-400">Hour Meter (HM):</span>
<span class="font-extrabold text-slate-800">{{ number_format($v->current_km, 1, ',', '.') }} HM</span>
</div>
<div class="flex items-center justify-between">
<span class="text-slate-400">Lokasi Operasional:</span>
<span class="font-semibold text-slate-700 truncate max-w-[150px]">{{ $v->location ?? '-' }}</span>
</div>
<div class="flex items-center justify-between">
<span class="text-slate-400">Checksheet P2H:</span>
<span class="font-bold text-[#1b5e20] truncate max-w-[150px]">
{{ $v->p2hTemplate ? $v->p2hTemplate->name : ($v->unit_category ?? 'Standar') }}
</span>
</div>
</div>
</div>
<!-- Tombol Buka Form P2H -->
<div class="mt-5 pt-3 border-t border-slate-100">
<a href="{{ route('p2h.form', ['code' => $v->code]) }}" class="w-full bg-[#1b5e20] hover:bg-[#144918] active:scale-[0.99] text-white font-bold py-2.5 px-4 rounded-xl shadow-sm transition text-center block text-xs">
Isi Formulir P2H Unit
</a>
</div>
</div>
@empty
<div id="p2hServerEmptyCard" class="col-span-full bg-white rounded-2xl border border-slate-200 p-12 text-center">
<div class="w-16 h-16 rounded-full bg-slate-100 text-slate-400 flex items-center justify-center mx-auto mb-3">
<i class="fa-solid fa-magnifying-glass text-2xl"></i>
</div>
@if(request('search'))
<h3 class="text-base font-bold text-slate-800">
Data "<span class="text-rose-600 font-bold">{{ request('search') }}</span>" tidak ditemukan di tabel
</h3>
<p class="text-xs text-slate-500 mt-1">Pastikan kode unit atau kategori alat berat yang dicari sudah benar.</p>
<div class="mt-4">
<a href="{{ route('p2h.index') }}" class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</a>
</div>
@else
<h3 class="text-base font-bold text-slate-800">Unit Support Tidak Ditemukan</h3>
<p class="text-xs text-slate-500 mt-1">Coba sesuaikan kata kunci pencarian atau filter kategori alat berat Anda.</p>
@endif
</div>
@endforelse
</div>
<!-- Pagination -->
@if($vehicles->hasPages())
<div class="bg-white p-4 rounded-2xl border border-slate-200 shadow-sm" id="p2hPaginationContainer">
{{ $vehicles->links() }}
</div>
@endif
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Search Real-Time Client-Side
const searchInput = document.getElementById('p2hSearchInput');
const resetContainer = document.getElementById('p2hResetContainer');
const cardsContainer = document.getElementById('p2hCardsContainer');
const paginationContainer = document.getElementById('p2hPaginationContainer');
const serverEmptyCard = document.getElementById('p2hServerEmptyCard');
const hasServerFilters = {{ request()->anyFilled(['search', 'unit_category']) ? 'true' : 'false' }};
function escapeHtml(str) {
const div = document.createElement('div');
div.textContent = str;
return div.innerHTML;
}
searchInput?.addEventListener('input', function(e) {
const rawValue = e.target.value;
const query = rawValue.toLowerCase().trim();
// Pencarian multi-field ke kartu/baris unit
const items = document.querySelectorAll('#p2hCardsContainer .p2h-card, #p2hCardsContainer tr.p2h-row');
let visibleCount = 0;
items.forEach(item => {
const text = item.textContent.toLowerCase();
const match = text.includes(query);
item.style.display = match ? '' : 'none';
if (match) visibleCount++;
});
// Sembunyikan pesan SSR kosong saat mengetik
if (serverEmptyCard) {
serverEmptyCard.style.display = query.length > 0 ? 'none' : '';
}
// Hapus pesan kosong pencarian jika ada sebelumnya
const existingEmptyCard = document.getElementById('p2hEmptySearchCard');
if (existingEmptyCard) {
existingEmptyCard.remove();
}
// Tampilkan pesan kosong jika tidak ada data yang cocok
if (visibleCount === 0 && query.length > 0) {
const emptyDiv = document.createElement('div');
emptyDiv.id = 'p2hEmptySearchCard';
emptyDiv.className = 'col-span-full bg-white rounded-2xl border border-slate-200 p-12 text-center shadow-sm';
emptyDiv.innerHTML = `
<div class="w-16 h-16 rounded-full bg-rose-50 text-rose-500 flex items-center justify-center mx-auto mb-3">
<i class="fa-solid fa-magnifying-glass text-2xl"></i>
</div>
<h3 class="text-base font-bold text-slate-800">
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
</h3>
<p class="text-xs text-slate-500 mt-1">
Pastikan kode unit atau kategori alat berat yang dicari sudah benar.
</p>
<div class="mt-4">
<button type="button"
onclick="const inp = document.getElementById('p2hSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</button>
</div>
`;
cardsContainer?.appendChild(emptyDiv);
}
// Sembunyikan pagination saat client-side search aktif
if (paginationContainer) {
paginationContainer.style.display = query.length > 0 ? 'none' : '';
}
// Tampilkan/sembunyikan tombol Reset Filter (merah fa-rotate-left) secara real-time
let resetBtn = document.getElementById('p2hResetBtn');
if (query.length > 0) {
if (!resetBtn && resetContainer) {
resetBtn = document.createElement('a');
resetBtn.id = 'p2hResetBtn';
resetBtn.href = "{{ route('p2h.index') }}";
resetBtn.className = "text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center justify-center sm:justify-start space-x-1.5 transition whitespace-nowrap py-1 sm:py-0 sm:ml-2";
const resetIcon = document.createElement('i');
resetIcon.className = "fa-solid fa-rotate-left text-[11px]";
const resetText = document.createElement('span');
resetText.textContent = "Reset Filter";
resetBtn.appendChild(resetIcon);
resetBtn.appendChild(resetText);
resetContainer.appendChild(resetBtn);
}
} else if (!hasServerFilters && resetBtn) {
resetBtn.remove();
}
});
});
</script>
@endsection
+15 -4
View File
@@ -196,12 +196,12 @@
</td>
</tr>
@empty
<tr>
<tr id="serverGuardEmptyRow">
<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">
<span class="inline-block mr-1">🔍</span>Data "<span class="text-rose-600 font-bold">{{ request('search') }}</span>" tidak ditemukan di tabel
Data "<span class="text-rose-600 font-bold">{{ request('search') }}</span>" tidak ditemukan di tabel
</p>
<p class="text-xs text-slate-400 mt-1">Pastikan ejaan ID Satpam atau nama petugas yang dicari sudah benar.</p>
@elseif(request()->anyFilled(['team', 'gate_id']))
@@ -226,6 +226,12 @@
</tbody>
</table>
</div>
@if($guards->hasPages())
<div class="p-4 border-t border-slate-100 bg-white">
{{ $guards->links() }}
</div>
@endif
</div>
</div>
@@ -636,6 +642,11 @@
if (match) visibleCount++;
});
const serverEmptyRow = document.getElementById('serverGuardEmptyRow');
if (serverEmptyRow) {
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
}
// Hapus baris pesan kosong pencarian jika ada sebelumnya
const existingEmptyRow = document.getElementById('guardEmptySearchRow');
if (existingEmptyRow) {
@@ -643,14 +654,14 @@
}
// Tampilkan pesan jika tidak ada data yang cocok di tabel
if (rows.length > 0 && visibleCount === 0 && query.length > 0) {
if (visibleCount === 0 && query.length > 0) {
const emptyTr = document.createElement('tr');
emptyTr.id = 'guardEmptySearchRow';
emptyTr.innerHTML = `
<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>
<p class="text-sm font-semibold text-slate-700">
<span class="inline-block mr-1">🔍</span>Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
</p>
<p class="text-xs text-slate-400 mt-1">
Pastikan ejaan ID Satpam atau nama petugas yang dicari sudah benar.
@@ -366,7 +366,7 @@
</td>
</tr>
@empty
<tr>
<tr id="serverVerificationEmptyRow">
<td colspan="10" class="py-12 text-center text-slate-400">
<div class="flex flex-col items-center justify-center space-y-2">
<div class="w-12 h-12 rounded-full bg-slate-100 flex items-center justify-center text-slate-400 text-lg">
@@ -535,6 +535,11 @@
if (match) visibleCount++;
});
const serverEmptyRow = document.getElementById('serverVerificationEmptyRow');
if (serverEmptyRow) {
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
}
// Hapus baris pesan kosong pencarian jika ada sebelumnya
const existingEmptyRow = document.getElementById('verificationEmptySearchRow');
if (existingEmptyRow) {
@@ -542,7 +547,7 @@
}
// Tampilkan pesan instan jika tidak ada baris yang cocok di tabel
if (rows.length > 0 && visibleCount === 0 && query.length > 0) {
if (visibleCount === 0 && query.length > 0) {
const emptyTr = document.createElement('tr');
emptyTr.id = 'verificationEmptySearchRow';
emptyTr.innerHTML = `
@@ -4,8 +4,16 @@
@section('content')
<div class="max-w-2xl mx-auto space-y-4">
<!-- Logo Perusahaan KMH -->
<div class="flex items-center justify-center pb-1">
<!-- Navigasi Kembali & Logo Perusahaan KMH -->
<div class="flex items-center justify-between pb-1">
@if(auth()->check())
<a href="{{ route('mobilisasi.index') }}" class="inline-flex items-center space-x-1.5 text-xs font-bold text-slate-600 hover:text-[#1b5e20] transition bg-white px-3 py-1.5 rounded-xl border border-slate-200 shadow-sm">
<i class="fa-solid fa-arrow-left text-[11px]"></i>
<span>Kembali ke Katalog LV</span>
</a>
@else
<div></div>
@endif
<img src="{{ asset('images/logo-kerinci.png') }}" alt="Kerinci Hydropower" class="h-8 w-auto object-contain">
</div>
+76 -43
View File
@@ -1,6 +1,6 @@
@extends('layouts.app')
@section('title', 'Log Aktivitas Kendaraan QMA')
@section('title', 'Timesheet LV QMA')
@section('content')
<div class="w-full space-y-6">
@@ -15,12 +15,12 @@
<button type="button"
onclick="openGuideModal()"
class="w-3.5 h-3.5 rounded-full bg-slate-200/90 hover:bg-slate-300 text-slate-500 hover:text-slate-800 text-[8px] inline-flex items-center justify-center font-bold transition shadow-2xs cursor-pointer focus:outline-none"
title="Panduan Halaman Log Aktivitas Kendaraan">
title="Panduan Halaman Timesheet LV">
<i class="fa-solid fa-info"></i>
</button>
</div>
<h2 class="text-2xl sm:text-3xl font-extrabold text-slate-900 tracking-tight">
Log Aktivitas Kendaraan
Timesheet LV
</h2>
</div>
@@ -286,46 +286,48 @@
</td>
</tr>
@empty
<tr>
<tr id="serverActivityEmptyRow">
<td colspan="11" class="py-12 px-4 text-center">
<div class="flex flex-col items-center justify-center space-y-3">
<div class="w-14 h-14 rounded-full bg-slate-100 flex items-center justify-center text-slate-400 text-2xl">
<i class="fa-solid fa-route"></i>
<i class="fa-solid fa-magnifying-glass"></i>
</div>
<div class="text-sm font-bold text-slate-700">Belum Ada Data Log Aktivitas</div>
<p class="text-xs text-slate-400 max-w-sm">
Tidak ditemukan catatan aktivitas kendaraan yang sesuai dengan kriteria filter saat ini.
</p>
@if(request()->anyFilled(['search', 'start_date', 'end_date', 'gate_id', 'direction', 'status']))
<a href="{{ route('qma.activity.log') }}" class="mt-2 inline-flex items-center space-x-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold text-[#1b5e20] bg-emerald-50 border border-emerald-200 hover:bg-emerald-100 transition">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Reset Filter</span>
</a>
@if(request('search'))
<p class="text-sm font-semibold text-slate-700">
Data "<span class="text-rose-600 font-bold">{{ request('search') }}</span>" tidak ditemukan di tabel
</p>
<p class="text-xs text-slate-400 mt-1">
Pastikan kata kunci yang dicari sudah benar.
</p>
<div class="mt-4">
<a href="{{ route('qma.activity.log') }}" class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</a>
</div>
@else
<div class="text-sm font-bold text-slate-700">Belum Ada Data Log Aktivitas</div>
<p class="text-xs text-slate-400 max-w-sm">
Tidak ditemukan catatan aktivitas kendaraan yang sesuai dengan kriteria filter saat ini.
</p>
@if(request()->anyFilled(['start_date', 'end_date', 'gate_id', 'direction', 'status']))
<a href="{{ route('qma.activity.log') }}" class="mt-2 inline-flex items-center space-x-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold text-[#1b5e20] bg-emerald-50 border border-emerald-200 hover:bg-emerald-100 transition">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Reset Filter</span>
</a>
@endif
@endif
</div>
</td>
</tr>
@endforelse
<!-- Baris Hasil Pencarian Real-Time Kosong -->
<tr id="clientSearchEmptyRow" class="hidden">
<td colspan="11" class="py-12 px-4 text-center">
<div class="flex flex-col items-center justify-center space-y-2">
<div class="w-12 h-12 rounded-full bg-slate-100 flex items-center justify-center text-slate-400 text-xl">
<i class="fa-solid fa-magnifying-glass"></i>
</div>
<div class="text-sm font-bold text-slate-700">Tidak Ada Hasil Pencarian</div>
<p class="text-xs text-slate-400">Tidak ditemukan log aktivitas yang sesuai dengan kata kunci pencarian Anda.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Pagination -->
@if($activities->hasPages())
<div class="p-4 bg-slate-50 border-t border-slate-100">
<div id="activityPaginationContainer" class="p-4 bg-slate-50 border-t border-slate-100">
{{ $activities->links() }}
</div>
@endif
@@ -333,16 +335,24 @@
</div>
<script>
function escapeHtml(str) {
const div = document.createElement('div');
div.textContent = str;
return div.innerHTML;
}
document.addEventListener('DOMContentLoaded', function () {
const searchInput = document.getElementById('activityLogSearchInput');
const tableBody = document.getElementById('activityLogTableBody');
const resetContainer = document.getElementById('headerResetFilterContainer');
const emptyRow = document.getElementById('clientSearchEmptyRow');
const paginationContainer = document.getElementById('activityPaginationContainer');
const serverEmptyRow = document.getElementById('serverActivityEmptyRow');
const hasServerFilters = {{ request()->anyFilled(['start_date', 'end_date', 'gate_id', 'direction', 'status']) ? 'true' : 'false' }};
if (searchInput && tableBody) {
searchInput.addEventListener('input', function (e) {
const query = e.target.value.toLowerCase().trim();
const rawValue = e.target.value;
const query = rawValue.toLowerCase().trim();
const rows = tableBody.querySelectorAll('tr.activity-row');
let visibleCount = 0;
@@ -356,16 +366,42 @@ document.addEventListener('DOMContentLoaded', function () {
}
});
// Tampilkan pesan kosong jika tidak ada baris yang cocok secara instan
if (emptyRow) {
if (rows.length > 0 && visibleCount === 0) {
emptyRow.classList.remove('hidden');
} else {
emptyRow.classList.add('hidden');
}
if (paginationContainer) {
paginationContainer.style.display = query.length > 0 ? 'none' : '';
}
const existingEmptyRow = document.getElementById('clientSearchEmptyRow');
if (existingEmptyRow) existingEmptyRow.remove();
if (serverEmptyRow) {
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
}
if (visibleCount === 0 && query.length > 0) {
const emptyTr = document.createElement('tr');
emptyTr.id = 'clientSearchEmptyRow';
emptyTr.innerHTML = `
<td colspan="11" class="py-12 px-4 text-center">
<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">
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
</p>
<p class="text-xs text-slate-400 mt-1">
Pastikan kata kunci yang dicari sudah benar.
</p>
<div class="mt-4">
<button type="button"
onclick="const inp = document.getElementById('activityLogSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</button>
</div>
</td>
`;
tableBody.appendChild(emptyTr);
}
// Tampilkan atau sembunyikan tombol Reset Filter secara real-time
if (resetContainer) {
let resetBtn = document.getElementById('headerResetFilterBtn');
if (query.length > 0 || hasServerFilters) {
@@ -374,7 +410,6 @@ document.addEventListener('DOMContentLoaded', function () {
resetBtn.href = "{{ route('qma.activity.log') }}";
resetBtn.id = 'headerResetFilterBtn';
resetBtn.className = 'text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center space-x-1 transition';
const resetIcon = document.createElement('i');
resetIcon.className = 'fa-solid fa-rotate-left text-[11px]';
const resetText = document.createElement('span');
@@ -384,10 +419,8 @@ document.addEventListener('DOMContentLoaded', function () {
resetBtn.appendChild(resetText);
resetContainer.appendChild(resetBtn);
}
} else {
if (resetBtn && !hasServerFilters) {
resetBtn.remove();
}
} else if (!hasServerFilters && resetBtn) {
resetBtn.remove();
}
}
});
+75 -32
View File
@@ -307,26 +307,33 @@
</td>
</tr>
@empty
<tr>
<td colspan="9" class="py-10 text-center text-slate-400">
<i class="fa-solid fa-chart-simple text-3xl mb-2 block"></i>
Belum ada data aktivitas kendaraan untuk periode yang dipilih.
<tr id="serverSummaryEmptyRow">
<td colspan="9" class="py-12 px-4 text-center">
<div class="flex flex-col items-center justify-center space-y-3">
<div class="w-12 h-12 rounded-2xl bg-rose-50 text-rose-500 flex items-center justify-center text-xl shadow-xs">
<i class="fa-solid fa-magnifying-glass"></i>
</div>
@if(request('search'))
<h4 class="text-sm font-bold text-slate-800">
Data "<span class="text-rose-600 font-bold">{{ request('search') }}</span>" tidak ditemukan di tabel
</h4>
<p class="text-xs text-slate-400 max-w-sm">
Pastikan kata kunci yang dicari sudah benar atau gunakan filter lainnya.
</p>
<div class="mt-4">
<a href="{{ route('qma.activity.summary') }}" class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</a>
</div>
@else
<div class="text-sm font-bold text-slate-700">Belum Ada Data Rekapitulasi</div>
<p class="text-xs text-slate-400">Belum ada data aktivitas kendaraan untuk periode yang dipilih.</p>
@endif
</div>
</td>
</tr>
@endforelse
<!-- Baris Hasil Pencarian Real-Time Kosong -->
<tr id="clientSearchEmptyRow" class="hidden">
<td colspan="9" class="py-12 px-4 text-center">
<div class="flex flex-col items-center justify-center space-y-2">
<div class="w-12 h-12 rounded-full bg-slate-100 flex items-center justify-center text-slate-400 text-xl">
<i class="fa-solid fa-magnifying-glass"></i>
</div>
<div class="text-sm font-bold text-slate-700">Tidak Ada Hasil Pencarian</div>
<p class="text-xs text-slate-400">Tidak ditemukan armada yang sesuai dengan kata kunci pencarian Anda.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
@@ -517,32 +524,68 @@ document.addEventListener('DOMContentLoaded', function () {
const searchInput = document.getElementById('summarySearchInput');
const tableBody = document.getElementById('summaryTableBody');
const resetContainer = document.getElementById('headerResetFilterContainer');
const emptyRow = document.getElementById('clientSearchEmptyRow');
const serverEmptyRow = document.getElementById('serverSummaryEmptyRow');
const hasServerFilters = {{ request()->anyFilled(['start_date', 'end_date', 'type', 'gate_id']) ? 'true' : 'false' }};
function escapeHtml(str) {
const div = document.createElement('div');
div.textContent = str;
return div.innerHTML;
}
if (searchInput && tableBody) {
searchInput.addEventListener('input', function (e) {
const query = e.target.value.toLowerCase().trim();
const rawValue = e.target.value;
const query = rawValue.toLowerCase().trim();
const rows = tableBody.querySelectorAll('tr.summary-vehicle-row');
let visibleCount = 0;
rows.forEach(row => {
const text = row.textContent.toLowerCase();
if (text.includes(query)) {
row.style.display = '';
visibleCount++;
} else {
row.style.display = 'none';
}
const match = text.includes(query);
row.style.display = match ? '' : 'none';
if (match) visibleCount++;
});
// Tampilkan pesan kosong jika tidak ada baris yang cocok secara instan
if (emptyRow) {
if (rows.length > 0 && visibleCount === 0) {
emptyRow.classList.remove('hidden');
} else {
emptyRow.classList.add('hidden');
}
// Sembunyikan pesan SSR kosong saat user mengetik
if (serverEmptyRow) {
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
}
// Hapus baris pesan kosong pencarian client jika ada sebelumnya
const existingEmptyRow = document.getElementById('summaryClientEmptyRow');
if (existingEmptyRow) {
existingEmptyRow.remove();
}
// Tampilkan pesan jika tidak ada data yang cocok di tabel
if (visibleCount === 0 && query.length > 0) {
const emptyTr = document.createElement('tr');
emptyTr.id = 'summaryClientEmptyRow';
emptyTr.innerHTML = `
<td colspan="9" class="py-12 px-4 text-center">
<div class="flex flex-col items-center justify-center space-y-3">
<div class="w-12 h-12 rounded-2xl bg-rose-50 text-rose-500 flex items-center justify-center text-xl shadow-xs">
<i class="fa-solid fa-magnifying-glass"></i>
</div>
<h4 class="text-sm font-bold text-slate-800">
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
</h4>
<p class="text-xs text-slate-400 max-w-sm">
Pastikan kata kunci yang dicari sudah benar atau gunakan filter lainnya.
</p>
<div class="mt-4">
<button type="button"
onclick="const inp = document.getElementById('summarySearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</button>
</div>
</div>
</td>
`;
tableBody.appendChild(emptyTr);
}
// Tampilkan atau sembunyikan tombol Reset Filter secara real-time
+8 -1
View File
@@ -55,7 +55,14 @@
<a href="{{ route('qma.activity.log') }}"
class="inline-flex items-center space-x-2 bg-slate-800 hover:bg-slate-900 text-white font-bold text-xs py-3 px-5 rounded-xl shadow-md hover:shadow-lg transition">
<i class="fa-solid fa-clipboard-list"></i>
<span>Buka Log Aktivitas Kendaraan</span>
<span>Log Timesheet LV</span>
<i class="fa-solid fa-arrow-right text-[10px] ml-1"></i>
</a>
<a href="{{ route('qma.p2h.index') }}"
class="inline-flex items-center space-x-2 bg-amber-600 hover:bg-amber-700 text-white font-bold text-xs py-3 px-5 rounded-xl shadow-md hover:shadow-lg transition">
<i class="fa-solid fa-clipboard-check"></i>
<span>Log P2H Unit Support</span>
<i class="fa-solid fa-arrow-right text-[10px] ml-1"></i>
</a>
</div>
+415
View File
@@ -0,0 +1,415 @@
@extends('layouts.app')
@section('title', 'P2H Unit Support - Admin QMA')
@section('content')
<div class="w-full space-y-6">
<!-- Header Judul & Tombol Aksi (Tanpa Card Pembungkus Sesuai Panduan Desain QMA) -->
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4">
<div>
<div class="flex items-center space-x-1.5 mb-1">
<span class="text-xs font-bold uppercase tracking-wider text-[#1b5e20]">
MANAJEMEN SISTEM
</span>
<!-- Tombol Info Panduan Halaman Sejajar Kicker -->
<button type="button"
onclick="openGuideModal()"
class="w-3.5 h-3.5 rounded-full bg-slate-200/90 hover:bg-slate-300 text-slate-500 hover:text-slate-800 text-[8px] inline-flex items-center justify-center font-bold transition shadow-2xs cursor-pointer focus:outline-none"
title="Panduan Halaman P2H Unit Support">
<i class="fa-solid fa-info"></i>
</button>
</div>
<h2 class="text-2xl sm:text-3xl font-extrabold text-slate-900 tracking-tight">
P2H Unit Support
</h2>
</div>
<div class="flex items-center space-x-2.5 w-full sm:w-auto">
<a href="{{ route('qma.p2h.summary') }}" class="w-full sm:w-auto inline-flex items-center justify-center space-x-2 px-4 py-2.5 rounded-xl border border-slate-200 text-xs font-bold text-slate-700 bg-white hover:bg-slate-50 shadow-sm transition group">
<i class="fa-solid fa-chart-pie text-slate-400 group-hover:text-slate-700"></i>
<span>Summary Aktivitas</span>
</a>
</div>
</div>
<!-- Kotak Pencarian & Filter Status P2H (Tanpa Card Pembungkus Sesuai Gambar Referensi) -->
<form method="GET" action="{{ route('qma.p2h.index') }}" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
@if(request('date'))
<input type="hidden" name="date" value="{{ request('date') }}">
@endif
<!-- Sisi Kiri: Kotak Pencarian -->
<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>
</span>
<input type="text"
id="p2hSearchInput"
name="search"
value="{{ request('search') }}"
placeholder="Cari No. TRX, kode unit (EX01), nama/NIK operator..."
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>
<!-- Sisi Kanan: Filter Dropdown & Reset -->
<div class="flex flex-wrap items-center gap-2">
<!-- Filter Status Approval -->
<select name="validation_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] shadow-sm">
<option value="">Semua Status Approval</option>
<option value="pending" {{ request('validation_status') === 'pending' ? 'selected' : '' }}>Menunggu Approval</option>
<option value="approved" {{ request('validation_status') === 'approved' ? 'selected' : '' }}>Disetujui (Approved)</option>
<option value="rejected" {{ request('validation_status') === 'rejected' ? 'selected' : '' }}>Ditolak (Rejected)</option>
</select>
<!-- Filter Kondisi Fisik -->
<select name="summary_condition" 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] shadow-sm">
<option value="">Semua Kondisi Fisik</option>
<option value="good" {{ request('summary_condition') === 'good' ? 'selected' : '' }}>Semua Baik (Normal)</option>
<option value="has_defect" {{ request('summary_condition') === 'has_defect' ? 'selected' : '' }}>Ada Temuan Rusak</option>
</select>
<div id="p2hResetWrapper">
@if(request('search') || request('validation_status') || request('summary_condition') || request('date'))
<a id="p2hResetBtn" href="{{ route('qma.p2h.index') }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1" title="Reset Semua Filter">
<i class="fa-solid fa-rotate-left"></i>
<span>Reset</span>
</a>
@endif
</div>
</div>
</form>
<!-- Tabel Data Riwayat P2H -->
<div class="bg-white rounded-none sm:rounded-2xl border border-slate-200 shadow-sm overflow-hidden">
<div class="overflow-x-auto">
<table class="w-full text-left text-xs text-slate-600">
<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">Waktu Inspeksi</th>
<th class="py-3.5 px-4">No. Transaksi</th>
<th class="py-3.5 px-4">Unit Support</th>
<th class="py-3.5 px-4">Operator (SIMPER)</th>
<th class="py-3.5 px-4 text-center">Shift</th>
<th class="py-3.5 px-4 text-right">HM Operasi</th>
<th class="py-3.5 px-4 text-center">Kondisi Fisik</th>
<th class="py-3.5 px-4 text-center">Status QMA</th>
<th class="py-3.5 px-4 text-center w-24">Aksi</th>
</tr>
</thead>
<tbody id="p2hTableBody" class="divide-y divide-slate-100">
@forelse($records as $rec)
<tr class="p2h-row hover:bg-slate-50/80 transition">
<td class="py-3.5 px-4 text-center text-slate-400 font-medium">
{{ ($records->currentPage() - 1) * $records->perPage() + $loop->iteration }}
</td>
<td class="py-3.5 px-4 whitespace-nowrap">
<span class="font-bold text-slate-800">{{ $rec->inspected_at->format('d/m/Y') }}</span>
<span class="text-slate-400 block text-[10px]">{{ $rec->inspected_at->format('H:i') }} WIB</span>
</td>
<td class="py-3.5 px-4 whitespace-nowrap">
<span class="font-mono font-bold text-slate-700 bg-slate-100 px-2 py-0.5 rounded text-[11px]">{{ $rec->transaction_no }}</span>
</td>
<td class="py-3.5 px-4">
<div class="font-extrabold text-slate-900 text-sm leading-tight">{{ $rec->vehicle->code }}</div>
<div class="text-[11px] text-slate-500 truncate max-w-[160px]">{{ $rec->vehicle->brand_type }}</div>
</td>
<td class="py-3.5 px-4">
<div class="font-bold text-slate-800">{{ $rec->employee->name ?? '-' }}</div>
<div class="text-[10px] text-slate-400">NIK: {{ $rec->employee->nik ?? '-' }}</div>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
<span class="px-2 py-0.5 rounded-md text-[10px] font-semibold bg-slate-100 text-slate-700">
{{ Str::contains($rec->shift, '1') ? 'Shift 1' : 'Shift 2' }}
</span>
</td>
<td class="py-3.5 px-4 text-right whitespace-nowrap">
<span class="font-black text-slate-900">{{ number_format($rec->start_hm, 1, ',', '.') }}</span>
<span class="text-[10px] text-slate-400 font-bold ml-0.5">HM</span>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
@if($rec->hasDefects())
<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">
<i class="fa-solid fa-triangle-exclamation mr-1 text-rose-600"></i> {{ $rec->defect_count }} Item Rusak
</span>
@else
<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">
<i class="fa-solid fa-circle-check mr-1 text-emerald-600"></i> Normal (Baik)
</span>
@endif
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
@if($rec->isPending())
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-[10px] font-bold bg-amber-50 text-amber-800 border border-amber-200">
<span class="w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse mr-1.5"></span>
Menunggu Review
</span>
@elseif($rec->isApproved())
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-[10px] font-bold bg-emerald-50 text-emerald-800 border border-emerald-200">
<i class="fa-solid fa-check mr-1"></i> Disetujui QMA
</span>
@else
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-[10px] font-bold bg-rose-50 text-rose-800 border border-rose-200">
<i class="fa-solid fa-xmark mr-1"></i> Ditolak
</span>
@endif
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
<a href="{{ route('qma.p2h.show', $rec->id) }}" class="inline-flex items-center space-x-1 px-3 py-1.5 rounded-xl text-xs font-bold text-white bg-[#1b5e20] hover:bg-[#144918] shadow-sm transition">
<i class="fa-solid fa-magnifying-glass text-[10px]"></i>
<span>Review</span>
</a>
</td>
</tr>
@empty
<tr id="serverEmptyRow">
<td colspan="10" class="py-12 text-center text-slate-400">
@if(request('search'))
<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">
Data "<span class="text-rose-600 font-bold">{{ request('search') }}</span>" tidak ditemukan di tabel
</p>
<p class="text-xs text-slate-400 mt-1">
Pastikan kata kunci yang dicari sudah benar.
</p>
<div class="mt-4">
<a href="{{ route('qma.p2h.index') }}" class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</a>
</div>
@else
<i class="fa-solid fa-clipboard-question text-3xl mb-2 text-slate-300 block"></i>
<span class="font-bold text-slate-600">Belum ada catatan riwayat P2H Unit Support</span>
<p class="text-[11px] text-slate-400 mt-0.5">Form P2H yang dikirim oleh operator alat berat akan muncul pada daftar ini.</p>
@endif
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@if($records->hasPages())
<div id="p2hPaginationContainer" class="p-4 border-t border-slate-100">
{{ $records->links() }}
</div>
@endif
</div>
</div>
<!-- ========================================================================= -->
<!-- ========================================================================= -->
<!-- JAVASCRIPT: REAL-TIME CLIENT SEARCH & MODAL -->
<!-- ========================================================================= -->
<script>
function escapeHtml(str) {
const div = document.createElement('div');
div.textContent = str;
return div.innerHTML;
}
document.addEventListener('DOMContentLoaded', function () {
const searchInput = document.getElementById('p2hSearchInput');
const tableBody = document.getElementById('p2hTableBody');
const resetWrapper = document.getElementById('p2hResetWrapper');
const serverEmptyRow = document.getElementById('serverEmptyRow');
const paginationContainer = document.getElementById('p2hPaginationContainer');
const hasServerFilters = {{ request()->anyFilled(['validation_status', 'summary_condition', 'date']) ? 'true' : 'false' }};
if (searchInput && tableBody) {
searchInput.addEventListener('input', function (e) {
const rawValue = e.target.value;
const query = rawValue.toLowerCase().trim();
const rows = tableBody.querySelectorAll('tr.p2h-row');
let visibleCount = 0;
rows.forEach(row => {
const text = row.textContent.toLowerCase();
if (text.includes(query)) {
row.style.display = '';
visibleCount++;
} else {
row.style.display = 'none';
}
});
// Sembunyikan pagination saat client-side search aktif
if (paginationContainer) {
paginationContainer.style.display = query.length > 0 ? 'none' : '';
}
const existingEmptyRow = document.getElementById('clientSearchEmptyRow');
if (existingEmptyRow) existingEmptyRow.remove();
// Sembunyikan server empty row saat mengetik jika ada
if (serverEmptyRow) {
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
}
// Tampilkan pesan kosong jika tidak ada baris yang cocok
if (visibleCount === 0 && query.length > 0) {
const emptyTr = document.createElement('tr');
emptyTr.id = 'clientSearchEmptyRow';
emptyTr.innerHTML = `
<td colspan="10" 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">
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
</p>
<p class="text-xs text-slate-400 mt-1">
Pastikan kata kunci yang dicari sudah benar.
</p>
<div class="mt-4">
<button type="button"
onclick="const inp = document.getElementById('p2hSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</button>
</div>
</td>
`;
tableBody.appendChild(emptyTr);
}
// Tampilkan atau sembunyikan tombol Reset Filter secara real-time
if (resetWrapper) {
let resetBtn = document.getElementById('p2hResetBtn');
if (query.length > 0 || hasServerFilters) {
if (!resetBtn) {
resetBtn = document.createElement('a');
resetBtn.id = 'p2hResetBtn';
resetBtn.href = "{{ route('qma.p2h.index') }}";
resetBtn.className = 'text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1';
resetBtn.title = 'Reset Semua Filter';
const resetIcon = document.createElement('i');
resetIcon.className = 'fa-solid fa-rotate-left';
const resetText = document.createElement('span');
resetText.textContent = 'Reset';
resetBtn.appendChild(resetIcon);
resetBtn.appendChild(resetText);
resetWrapper.appendChild(resetBtn);
}
} else {
if (resetBtn && !hasServerFilters) {
resetBtn.remove();
}
}
}
});
}
});
function openGuideModal() {
const modal = document.getElementById('guideModal');
if (modal) {
modal.classList.remove('hidden');
document.documentElement.classList.add('modal-open');
document.body.classList.add('modal-open');
}
}
function closeGuideModal() {
const modal = document.getElementById('guideModal');
if (modal) {
modal.classList.add('hidden');
document.documentElement.classList.remove('modal-open');
document.body.classList.remove('modal-open');
}
}
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
closeGuideModal();
}
});
</script>
<!-- ========================================================================= -->
<!-- MODAL POPUP: PANDUAN HALAMAN (LOG P2H UNIT SUPPORT) -->
<!-- ========================================================================= -->
<div id="guideModal"
onclick="if(event.target === this) closeGuideModal()"
class="hidden fixed inset-0 z-50 bg-slate-900/60 backdrop-blur-sm 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 transform transition-all my-8">
<!-- Header Modal -->
<div class="flex items-center justify-between pb-4 border-b border-slate-100">
<div class="flex items-center space-x-3">
<div class="w-9 h-9 rounded-full bg-slate-100 text-slate-700 flex items-center justify-center font-bold text-sm border border-slate-200">
<i class="fa-solid fa-info"></i>
</div>
<div>
<h3 class="text-base font-bold text-slate-900 tracking-tight leading-tight">Panduan Halaman</h3>
<p class="text-xs text-slate-500">P2H Unit Support</p>
</div>
</div>
<button type="button"
onclick="closeGuideModal()"
class="text-slate-400 hover:text-slate-600 transition p-1.5 rounded-lg hover:bg-slate-100 cursor-pointer">
<i class="fa-solid fa-xmark text-lg"></i>
</button>
</div>
<div class="mt-4 space-y-4">
<p class="text-xs text-slate-600 leading-relaxed">
Halaman <strong>P2H Unit Support</strong> digunakan untuk memantau, memeriksa, dan memvalidasi riwayat pemeriksaan kelayakan operasi harian alat berat proyek yang diajukan oleh operator.
</p>
<div class="space-y-3">
<!-- Fitur 1 (Hijau) -->
<div class="bg-slate-50/70 border border-slate-100 rounded-2xl p-3.5 flex items-start space-x-3.5">
<div class="w-9 h-9 rounded-xl bg-emerald-100/70 text-emerald-700 flex items-center justify-center flex-shrink-0 mt-0.5 text-sm border border-emerald-200/50">
<i class="fa-solid fa-clipboard-check"></i>
</div>
<div class="min-w-0 flex-1">
<h4 class="text-xs font-bold text-slate-900">Review & Validasi Kelayakan</h4>
<p class="text-[11px] text-slate-500 mt-0.5 leading-relaxed">
Buka detail setiap pengajuan P2H untuk meninjau status checklist kelayakan alat dan beri persetujuan (Approve) atau penolakan (Reject).
</p>
</div>
</div>
<!-- Fitur 2 (Amber) -->
<div class="bg-slate-50/70 border border-slate-100 rounded-2xl p-3.5 flex items-start space-x-3.5">
<div class="w-9 h-9 rounded-xl bg-amber-100/70 text-amber-700 flex items-center justify-center flex-shrink-0 mt-0.5 text-sm border border-amber-200/50">
<i class="fa-solid fa-triangle-exclamation"></i>
</div>
<div class="min-w-0 flex-1">
<h4 class="text-xs font-bold text-slate-900">Deteksi Temuan Kerusakan</h4>
<p class="text-[11px] text-slate-500 mt-0.5 leading-relaxed">
Pantau kartu statistik 'Temuan Rusak' dan 'Menunggu QMA' untuk memprioritaskan unit yang membutuhkan perbaikan atau tindakan cepat.
</p>
</div>
</div>
<!-- Fitur 3 (Biru) -->
<div class="bg-slate-50/70 border border-slate-100 rounded-2xl p-3.5 flex items-start space-x-3.5">
<div class="w-9 h-9 rounded-xl bg-blue-100/70 text-blue-700 flex items-center justify-center flex-shrink-0 mt-0.5 text-sm border border-blue-200/50">
<i class="fa-solid fa-layer-group"></i>
</div>
<div class="min-w-0 flex-1">
<h4 class="text-xs font-bold text-slate-900">Master Checksheet P2H</h4>
<p class="text-[11px] text-slate-500 mt-0.5 leading-relaxed">
Akses daftar 28 standarisasi template checksheet pertanyaan P2H melalui tombol 'Master 28 Template' di bagian kanan atas.
</p>
</div>
</div>
</div>
</div>
<!-- Footer Tombol -->
<div class="pt-4 mt-5 border-t border-slate-100 flex items-center justify-end">
<button type="button"
onclick="closeGuideModal()"
class="px-6 py-2.5 rounded-xl bg-slate-100 hover:bg-slate-200 text-slate-700 font-bold text-xs transition cursor-pointer shadow-2xs">
Saya Mengerti
</button>
</div>
</div>
</div>
@endsection
+217
View File
@@ -0,0 +1,217 @@
@extends('layouts.app')
@section('title', 'Review P2H Unit ' . $record->vehicle->code . ' - ' . $record->transaction_no)
@section('content')
<div class="w-full space-y-6">
<!-- Top Action Bar -->
<div class="flex items-center justify-between pb-1">
<a href="{{ route('qma.p2h.index') }}" class="inline-flex items-center space-x-1.5 text-xs font-bold text-slate-600 hover:text-[#1b5e20] transition bg-white px-3 py-1.5 rounded-xl border border-slate-200 shadow-sm">
<i class="fa-solid fa-arrow-left text-[11px]"></i>
<span>Kembali ke P2H Unit Support</span>
</a>
<!-- Badge Status Validasi -->
<div>
@if($record->isPending())
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-bold bg-amber-50 text-amber-800 border border-amber-300">
<span class="w-2 h-2 rounded-full bg-amber-500 animate-pulse mr-2"></span>
Menunggu Approval QMA
</span>
@elseif($record->isApproved())
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-bold bg-emerald-50 text-emerald-800 border border-emerald-300">
<i class="fa-solid fa-check mr-1.5 text-emerald-600"></i> Disetujui (Approved)
</span>
@else
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-bold bg-rose-50 text-rose-800 border border-rose-300">
<i class="fa-solid fa-xmark mr-1.5 text-rose-600"></i> Ditolak (Rejected)
</span>
@endif
</div>
</div>
<!-- Header Transaksi & Metadata -->
<div class="bg-gradient-to-r from-slate-800 to-slate-900 text-white p-6 rounded-2xl shadow-sm border border-slate-700">
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 border-b border-slate-700 pb-4 mb-4">
<div>
<span class="text-xs font-semibold text-slate-400 uppercase tracking-wider block">LEMBAR PEMERIKSAAN PRA-HARIAN (P2H)</span>
<h1 class="text-2xl font-black text-white mt-0.5">{{ $record->transaction_no }}</h1>
</div>
<div class="text-left sm:text-right text-xs text-slate-300">
<span class="text-slate-400">Waktu Pemeriksaan:</span>
<span class="font-bold text-white block text-sm">{{ $record->inspected_at->format('d F Y, H:i') }} WIB</span>
</div>
</div>
<!-- 3 Kolom Info: Unit, Operator, Ringkasan HM -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 text-xs">
<!-- Kolom 1: Unit Support -->
<div class="bg-slate-800/80 p-3.5 rounded-xl border border-slate-700/80 space-y-1.5">
<span class="text-[10px] font-bold text-amber-400 uppercase tracking-wider block">UNIT SUPPORT</span>
<p class="text-base font-black text-white leading-tight">{{ $record->vehicle->code }}</p>
<p class="text-slate-300 font-medium">{{ $record->vehicle->brand_type }}</p>
<div class="pt-1 text-[11px] text-slate-400 border-t border-slate-700/60 flex items-center justify-between">
<span>Kategori:</span>
<span class="text-slate-200 font-semibold">{{ $record->vehicle->unit_category ?? ($record->template->name ?? '-') }}</span>
</div>
<div class="text-[11px] text-slate-400 flex items-center justify-between">
<span>Lokasi:</span>
<span class="text-slate-200 font-semibold">{{ $record->vehicle->location ?? '-' }}</span>
</div>
</div>
<!-- Kolom 2: Operator -->
<div class="bg-slate-800/80 p-3.5 rounded-xl border border-slate-700/80 space-y-1.5">
<span class="text-[10px] font-bold text-emerald-400 uppercase tracking-wider block">OPERATOR (HSE)</span>
<p class="text-base font-black text-white leading-tight">{{ $record->employee->name ?? '-' }}</p>
<p class="text-slate-300 font-medium">NIK: {{ $record->employee->nik ?? '-' }}</p>
<div class="pt-1 text-[11px] text-slate-400 border-t border-slate-700/60 flex items-center justify-between">
<span>Divisi:</span>
<span class="text-slate-200 font-semibold">{{ $record->employee->division ?? '-' }}</span>
</div>
<div class="text-[11px] text-slate-400 flex items-center justify-between">
<span>SIMPER:</span>
<span class="text-emerald-400 font-semibold">Aktif (s.d {{ $record->employee->simper_expired_at ? $record->employee->simper_expired_at->format('d/m/Y') : '-' }})</span>
</div>
</div>
<!-- Kolom 3: Operasional Shift & HM -->
<div class="bg-slate-800/80 p-3.5 rounded-xl border border-slate-700/80 space-y-1.5">
<span class="text-[10px] font-bold text-blue-400 uppercase tracking-wider block">OPERASIONAL SHIFT</span>
<p class="text-base font-black text-white leading-tight">{{ $record->shift }}</p>
<div class="pt-1 text-[11px] text-slate-400 border-t border-slate-700/60 flex items-center justify-between">
<span>Hour Meter (HM):</span>
<span class="text-emerald-300 font-extrabold text-sm">{{ number_format($record->start_hm, 1, ',', '.') }} HM</span>
</div>
<div class="text-[11px] text-slate-400 flex items-center justify-between">
<span>Kondisi Fisik:</span>
@if($record->hasDefects())
<span class="text-rose-400 font-bold">{{ $record->defect_count }} Item Rusak</span>
@else
<span class="text-emerald-400 font-bold">Semua Normal</span>
@endif
</div>
</div>
</div>
</div>
<!-- Catatan Umum Operator (Jika ada) -->
@if($record->general_notes)
<div class="bg-amber-50/60 border border-amber-200 rounded-2xl p-4 text-xs space-y-1 shadow-sm">
<span class="font-bold text-amber-900 block flex items-center space-x-1.5">
<i class="fa-solid fa-comment-dots text-amber-600"></i>
<span>Catatan Umum dari Operator:</span>
</span>
<p class="text-slate-700 leading-relaxed italic">"{{ $record->general_notes }}"</p>
</div>
@endif
<!-- Panel Keputusan Approval Admin QMA -->
<div class="bg-white rounded-2xl p-6 border border-slate-200 shadow-sm space-y-4">
<h3 class="font-bold text-slate-900 text-sm flex items-center space-x-2 border-b border-slate-100 pb-3">
<i class="fa-solid fa-stamp text-[#1b5e20]"></i>
<span>Verifikasi & Keputusan Approval Admin QMA</span>
</h3>
@if($record->isPending())
<!-- Form Aksi Approval / Reject -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<!-- Form Approve -->
<form action="{{ route('qma.p2h.approve', $record->id) }}" method="POST" class="bg-emerald-50/50 border border-emerald-200 p-4 rounded-xl space-y-3">
@csrf
<div>
<span class="font-bold text-emerald-900 text-xs block mb-1">Setujui Hasil Pemeriksaan</span>
<input type="text" name="validation_notes" placeholder="Catatan persetujuan (opsional)..." class="w-full text-xs px-3 py-2 rounded-xl border border-emerald-300 focus:border-emerald-600 bg-white">
</div>
<button type="submit" onclick="return confirm('Apakah Anda yakin ingin MENYETUJUI hasil P2H untuk unit ini?')" class="w-full bg-[#1b5e20] hover:bg-[#144918] text-white font-bold py-2 px-4 rounded-xl text-xs shadow-sm transition flex items-center justify-center space-x-2">
<i class="fa-solid fa-circle-check"></i>
<span>Setujui P2H (Approve)</span>
</button>
</form>
<!-- Form Reject -->
<form action="{{ route('qma.p2h.reject', $record->id) }}" method="POST" class="bg-rose-50/50 border border-rose-200 p-4 rounded-xl space-y-3">
@csrf
<div>
<span class="font-bold text-rose-900 text-xs block mb-1">Tolak Hasil Pemeriksaan <span class="text-rose-600">*</span></span>
<input type="text" name="validation_notes" required placeholder="Tuliskan alasan penolakan / instruksi perbaikan..." class="w-full text-xs px-3 py-2 rounded-xl border border-rose-300 focus:border-rose-600 bg-white">
</div>
<button type="submit" onclick="return confirm('Apakah Anda yakin ingin MENOLAK hasil P2H untuk unit ini?')" class="w-full bg-rose-600 hover:bg-rose-700 text-white font-bold py-2 px-4 rounded-xl text-xs shadow-sm transition flex items-center justify-center space-x-2">
<i class="fa-solid fa-circle-xmark"></i>
<span>Tolak P2H (Reject)</span>
</button>
</form>
</div>
@else
<!-- Info Hasil Validasi Sebelumnya -->
<div class="bg-slate-50 p-4 rounded-xl border border-slate-200 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 text-xs">
<div>
<span class="text-slate-400 block">Diverifikasi Oleh:</span>
<span class="font-bold text-slate-800 text-sm">{{ $record->validator->name ?? 'Admin QMA' }}</span>
<span class="text-slate-500 block text-[11px]">Pada {{ $record->validated_at ? $record->validated_at->format('d/m/Y H:i') . ' WIB' : '-' }}</span>
</div>
<div class="sm:text-right">
<span class="text-slate-400 block">Catatan Verifikator:</span>
<span class="font-medium text-slate-700">{{ $record->validation_notes ?? '-' }}</span>
</div>
</div>
@endif
</div>
<!-- Detail Hasil Cek Per Section (Checklist Butir Soal) -->
<div class="space-y-4">
<h3 class="font-extrabold text-slate-900 text-base px-1">Rincian Butir Pemeriksaan Pra-Harian</h3>
@foreach($groupedItems as $sectionName => $itemsInSection)
<div class="bg-white rounded-none sm:rounded-2xl shadow-sm border border-slate-200 overflow-hidden">
<div class="p-3.5 bg-slate-50 border-b border-slate-200 flex items-center justify-between">
<div class="flex items-center space-x-2">
<span class="w-2 h-2 rounded-full bg-[#1b5e20]"></span>
<h4 class="font-bold text-slate-800 text-xs uppercase tracking-wide">{{ $sectionName }}</h4>
</div>
<span class="text-[10px] font-semibold text-slate-500 bg-white border border-slate-200 px-2 py-0.5 rounded-full">
{{ count($itemsInSection) }} butir
</span>
</div>
<div class="divide-y divide-slate-100 p-2 sm:p-4 text-xs">
@foreach($itemsInSection as $item)
<div class="p-2.5 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 hover:bg-slate-50/60 rounded-xl transition">
<div class="flex items-start space-x-2 flex-1 pr-2">
<span class="font-bold text-slate-400">{{ $loop->iteration }}.</span>
<div>
<span class="font-semibold text-slate-800 leading-snug">{{ $item->title }}</span>
@if($item->notes)
<p class="text-[11px] text-rose-600 font-medium mt-0.5 flex items-center space-x-1">
<i class="fa-solid fa-circle-exclamation text-[10px]"></i>
<span>Catatan: {{ $item->notes }}</span>
</p>
@endif
</div>
</div>
<div class="flex-shrink-0">
@if(in_array($item->question_type, ['choice', 'condition', 'Multiple choice: only one answer', 'Matrix']) || !empty($item->condition_status))
@if($item->condition_status === 'rusak')
<span class="inline-flex items-center px-2.5 py-1 rounded-xl text-xs font-bold bg-rose-50 text-rose-700 border border-rose-200">
<i class="fa-solid fa-triangle-exclamation mr-1 text-rose-600"></i> Rusak
</span>
@else
<span class="inline-flex items-center px-2.5 py-1 rounded-xl text-xs font-bold bg-emerald-50 text-emerald-700 border border-emerald-200">
<i class="fa-solid fa-check mr-1 text-emerald-600"></i> Baik
</span>
@endif
@else
<span class="font-semibold text-slate-700 bg-slate-100 px-2.5 py-1 rounded-lg text-xs">
{{ $item->answer_value ?? '-' }}
</span>
@endif
</div>
</div>
@endforeach
</div>
</div>
@endforeach
</div>
</div>
@endsection
+527
View File
@@ -0,0 +1,527 @@
@extends('layouts.app')
@section('title', 'Summary P2H Unit Support - Admin QMA')
@section('content')
<div class="w-full space-y-6">
<!-- Header Halaman Summary P2H -->
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4">
<div>
<div class="flex items-center space-x-1.5 mb-1">
<span class="text-xs font-bold uppercase tracking-wider text-[#1b5e20]">
MANAJEMEN SISTEM
</span>
<!-- Tombol Info Panduan Halaman Sejajar Kicker -->
<button type="button"
onclick="openGuideModal()"
class="w-3.5 h-3.5 rounded-full bg-slate-200/90 hover:bg-slate-300 text-slate-500 hover:text-slate-800 text-[8px] inline-flex items-center justify-center font-bold transition shadow-2xs cursor-pointer focus:outline-none"
title="Panduan Halaman Summary P2H">
<i class="fa-solid fa-info"></i>
</button>
</div>
<h2 class="text-2xl sm:text-3xl font-extrabold text-slate-900 tracking-tight">
Summary P2H Unit Support
</h2>
</div>
<div class="grid grid-cols-2 gap-2.5 w-full sm:flex sm:items-center sm:gap-3 sm:w-auto">
<a href="{{ route('qma.p2h.index') }}" class="w-full sm:w-auto flex items-center justify-center space-x-2 px-3 sm:px-4 py-2.5 rounded-xl text-xs font-bold text-slate-700 bg-white border border-slate-200 hover:bg-slate-50 shadow-sm transition group">
<i class="fa-solid fa-clipboard-check text-slate-400 group-hover:text-slate-700"></i>
<span class="truncate">Detail P2H</span>
</a>
<a href="{{ route('qma.p2h.templates') }}" class="w-full sm:w-auto flex items-center justify-center space-x-2 px-3 sm:px-4 py-2.5 rounded-xl text-xs font-bold text-slate-700 bg-white border border-slate-200 hover:bg-slate-50 shadow-sm transition group">
<i class="fa-solid fa-layer-group text-slate-400 group-hover:text-slate-700"></i>
<span class="truncate">Master Template</span>
</a>
</div>
</div>
@php
$activeFilterCount = count(array_filter(request()->only(['search', 'start_date', 'end_date', 'vehicle_id', 'validation_status', 'shift'])));
$isFilterOpen = request()->anyFilled(['start_date', 'end_date', 'vehicle_id', 'validation_status', 'shift']);
@endphp
<!-- Form Filter & Pencarian Cepat -->
<form method="GET" action="{{ route('qma.p2h.summary') }}" class="space-y-3">
<!-- Baris Atas: Search Bar Mandiri di Luar Card Filter & Tombol Toggle -->
<div class="flex flex-col sm:flex-row items-stretch sm:items-center gap-3">
<!-- Search Bar Utama (Real-Time) -->
<div class="relative flex-1">
<div 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>
</div>
<input type="text"
name="search"
id="p2hSummarySearchInput"
value="{{ request('search') }}"
placeholder="Cari No. TRX, kode unit (EX01), model, nama operator..."
class="w-full text-xs rounded-xl border border-slate-200 bg-white hover:border-slate-300 focus:bg-white pl-9 pr-3.5 py-2.5 text-slate-800 placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition shadow-2xs">
</div>
<!-- Tombol Buka/Tutup Filter Card & Reset Filter -->
<div class="flex items-center gap-2.5 self-end sm:self-auto w-full sm:w-auto justify-between sm:justify-start">
<button type="button"
id="filterToggleBtn"
onclick="toggleFilterCard()"
class="inline-flex items-center justify-center px-4 py-2.5 rounded-xl text-xs font-bold text-slate-700 bg-white hover:bg-slate-50 border border-slate-200 shadow-2xs transition group cursor-pointer">
<i class="fa-solid fa-sliders text-slate-500 mr-2 group-hover:text-[#1b5e20] transition-colors"></i>
<span>Filter</span>
@if($activeFilterCount > 0)
<span class="ml-1.5 px-1.5 py-0.5 rounded-full text-[10px] font-extrabold bg-[#1b5e20] text-white">
{{ $activeFilterCount }}
</span>
@endif
<i id="filterChevron" class="fa-solid fa-chevron-down ml-2 text-[10px] text-slate-400 transition-transform duration-200 {{ $isFilterOpen ? 'rotate-180' : '' }}"></i>
</button>
<div id="p2hSummaryResetContainer">
@if(request()->anyFilled(['search', 'start_date', 'end_date', 'vehicle_id', 'validation_status', 'shift']))
<a href="{{ route('qma.p2h.summary') }}"
id="p2hSummaryResetBtn"
class="text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center space-x-1 transition px-3 py-2 rounded-xl hover:bg-rose-50 border border-transparent hover:border-rose-100">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Reset Filter</span>
</a>
@endif
</div>
</div>
</div>
<!-- Card Filter Lanjutan (Bisa Di Buka-Tutup / Collapsible) -->
<div id="collapsibleFilterCard" class="{{ $isFilterOpen ? '' : 'hidden ' }}bg-white rounded-2xl border border-slate-200 shadow-sm p-4 sm:p-5 transition-all">
<div class="flex items-center justify-between pb-3 border-b border-slate-100 mb-3.5">
<div class="flex items-center space-x-2">
<span class="text-slate-800 font-bold text-xs uppercase tracking-wider">
Opsi Filter Lanjutan
</span>
@if($activeFilterCount > 0)
<span class="text-[11px] text-slate-400 font-medium">({{ $activeFilterCount }} filter aktif)</span>
@endif
</div>
<button type="button"
onclick="toggleFilterCard()"
class="text-xs text-slate-400 hover:text-slate-600 transition flex items-center space-x-1 cursor-pointer">
<span>Tutup</span>
<i class="fa-solid fa-xmark text-[11px]"></i>
</button>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-3.5">
<!-- Mulai Tanggal -->
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">Mulai Tanggal</label>
<input type="date"
name="start_date"
value="{{ request('start_date', $startDate ?? now()->startOfMonth()->format('Y-m-d')) }}"
onchange="this.form.submit()"
class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3.5 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
</div>
<!-- Sampai Tanggal -->
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">Sampai Tanggal</label>
<input type="date"
name="end_date"
value="{{ request('end_date', $endDate ?? now()->format('Y-m-d')) }}"
onchange="this.form.submit()"
class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3.5 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
</div>
<!-- Unit Support -->
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">Unit Support</label>
<select name="vehicle_id" onchange="this.form.submit()" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3.5 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<option value="">Semua Unit Support</option>
@foreach($supportVehicles as $sv)
<option value="{{ $sv->id }}" {{ request('vehicle_id') == $sv->id ? 'selected' : '' }}>
{{ $sv->code }} - {{ $sv->brand_type }}
</option>
@endforeach
</select>
</div>
<!-- Status Validasi -->
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">Status Validasi</label>
<select name="validation_status" onchange="this.form.submit()" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3.5 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<option value="">Semua Status</option>
<option value="pending" {{ request('validation_status') === 'pending' ? 'selected' : '' }}>Menunggu Approval</option>
<option value="approved" {{ request('validation_status') === 'approved' ? 'selected' : '' }}>Disetujui (Approved)</option>
<option value="rejected" {{ request('validation_status') === 'rejected' ? 'selected' : '' }}>Ditolak (Rejected)</option>
</select>
</div>
<!-- Shift Kerja -->
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">Shift Kerja</label>
<select name="shift" onchange="this.form.submit()" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3.5 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<option value="">Semua Shift</option>
<option value="1" {{ request('shift') === '1' ? 'selected' : '' }}>Shift 1 (Pagi)</option>
<option value="2" {{ request('shift') === '2' ? 'selected' : '' }}>Shift 2 (Malam)</option>
</select>
</div>
</div>
</div>
</form>
<!-- 4 Kartu KPI Metrik Ringkasan P2H -->
<div class="grid grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4">
<!-- 1. Total Inspeksi P2H -->
<div class="bg-white rounded-2xl p-4 sm:p-5 border border-slate-200 shadow-sm flex flex-col justify-between">
<div>
<p class="text-[11px] sm:text-xs font-bold text-slate-400 uppercase tracking-wider">Total Inspeksi P2H</p>
<h3 class="text-xl sm:text-2xl font-black text-slate-900 mt-1">{{ number_format($totalInspections, 0, ',', '.') }}</h3>
</div>
<div class="flex flex-wrap items-center gap-1 sm:space-x-2 mt-2 text-[10px] sm:text-[11px]">
<span class="text-emerald-700 font-semibold"><i class="fa-solid fa-check mr-0.5"></i> {{ $totalApproved }} Disetujui</span>
<span class="text-slate-300 hidden sm:inline">•</span>
<span class="text-amber-600 font-semibold"><i class="fa-solid fa-hourglass-half mr-0.5"></i> {{ $totalPending }} Menunggu</span>
</div>
</div>
<!-- 2. Kondisi Fisik Alat Berat -->
<div class="bg-white rounded-2xl p-4 sm:p-5 border border-slate-200 shadow-sm flex flex-col justify-between">
<div>
<p class="text-[11px] sm:text-xs font-bold text-slate-400 uppercase tracking-wider">Kondisi Alat Berat</p>
<h3 class="text-xl sm:text-2xl font-black text-emerald-700 mt-1">
{{ $totalInspections > 0 ? round(($totalNormal / $totalInspections) * 100) : 0 }}% <span class="text-xs font-sans font-bold text-slate-500">Normal</span>
</h3>
</div>
<div class="flex flex-wrap items-center gap-1 sm:space-x-2 mt-2 text-[10px] sm:text-[11px]">
<span class="text-emerald-700 font-semibold">{{ $totalNormal }} Unit Baik</span>
<span class="text-slate-300 hidden sm:inline">•</span>
<span class="text-rose-600 font-semibold">{{ $totalDefects }} Ada Temuan Rusak</span>
</div>
</div>
<!-- 3. Status Penolakan / Tindak Lanjut -->
<div class="bg-white rounded-2xl p-4 sm:p-5 border border-slate-200 shadow-sm flex flex-col justify-between">
<div>
<p class="text-[11px] sm:text-xs font-bold text-slate-400 uppercase tracking-wider">Unit Ditolak / Reject</p>
<h3 class="text-xl sm:text-2xl font-black text-rose-600 mt-1">{{ number_format($totalRejected, 0, ',', '.') }}</h3>
</div>
<div class="flex flex-wrap items-center gap-1 sm:space-x-2 mt-2 text-[10px] sm:text-[11px]">
<span class="text-rose-600 font-semibold"><i class="fa-solid fa-triangle-exclamation mr-0.5"></i> {{ $totalRejected }} Perlu Perbaikan</span>
</div>
</div>
<!-- 4. Total Akumulasi Hour Meter (HM) -->
<div class="bg-white rounded-2xl p-4 sm:p-5 border border-slate-200 shadow-sm flex flex-col justify-between">
<div>
<p class="text-[11px] sm:text-xs font-bold text-slate-400 uppercase tracking-wider">Total HM Tercatat</p>
<h3 class="text-xl sm:text-2xl font-black text-slate-900 font-mono mt-1">
{{ number_format($totalHm, 1, ',', '.') }} <span class="text-xs font-sans font-bold text-slate-500">Jam</span>
</h3>
</div>
<div class="flex flex-wrap items-center gap-1 sm:space-x-2 mt-2 text-[10px] sm:text-[11px]">
<span class="text-slate-500 font-semibold"><i class="fa-solid fa-clock mr-0.5"></i> Hour Meter Operasi</span>
</div>
</div>
</div>
<!-- Tabel Rekapitulasi per Unit Support -->
<div class="bg-white rounded-none sm:rounded-2xl border border-slate-200 shadow-sm overflow-hidden">
<div class="px-5 py-4 border-b border-slate-100 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3">
<div>
<h3 class="text-sm font-bold text-slate-900">Rekapitulasi Pemeriksaan per Unit Support</h3>
<p class="text-xs text-slate-400 mt-0.5">Ringkasan kepatuhan dan status kelayakan inspeksi masing-masing unit alat berat.</p>
</div>
<span class="text-xs font-semibold px-2.5 py-1 rounded-full bg-slate-100 text-slate-600">
{{ $unitSummary->count() }} Unit Aktif
</span>
</div>
<div class="overflow-x-auto">
<table class="w-full text-left text-xs text-slate-600">
<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 Unit</th>
<th class="py-3.5 px-4">Model & Kategori</th>
<th class="py-3.5 px-4 text-center">Total P2H</th>
<th class="py-3.5 px-4 text-center">Disetujui</th>
<th class="py-3.5 px-4 text-center">Menunggu</th>
<th class="py-3.5 px-4 text-center">Ditolak</th>
<th class="py-3.5 px-4 text-center">Temuan Rusak</th>
<th class="py-3.5 px-4 text-right">HM Terakhir</th>
<th class="py-3.5 px-4 text-center">Terakhir Diperiksa</th>
</tr>
</thead>
<tbody id="p2hSummaryTableBody" class="divide-y divide-slate-100">
@forelse($unitSummary as $idx => $us)
<tr class="p2h-summary-row hover:bg-slate-50/80 transition">
<td class="py-3.5 px-4 text-center text-slate-400 font-medium">{{ $loop->iteration }}</td>
<td class="py-3.5 px-4 whitespace-nowrap">
<span class="font-bold text-slate-900">{{ $us['vehicle']->code ?? '-' }}</span>
</td>
<td class="py-3.5 px-4">
<span class="text-slate-800 font-semibold block">{{ $us['vehicle']->brand_type ?? '-' }}</span>
<span class="text-slate-400 text-[10px]">{{ $us['vehicle']->unit_category ?? 'Alat Berat' }}</span>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap font-bold text-slate-900">
{{ number_format($us['total']) }}
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap font-semibold text-emerald-700">
{{ number_format($us['approved']) }}
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap font-semibold text-amber-600">
{{ number_format($us['pending']) }}
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap font-semibold {{ $us['rejected'] > 0 ? 'text-rose-600' : 'text-slate-400' }}">
{{ number_format($us['rejected']) }}
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
@if($us['has_defect'] > 0)
<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">
{{ $us['has_defect'] }} Temuan
</span>
@else
<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">
Normal
</span>
@endif
</td>
<td class="py-3.5 px-4 text-right font-mono font-bold text-slate-800 whitespace-nowrap">
{{ $us['latest_hm'] ? number_format($us['latest_hm'], 1, ',', '.') : '-' }}
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap text-slate-500">
{{ $us['latest_inspection'] ? \Carbon\Carbon::parse($us['latest_inspection'])->format('d/m/Y H:i') : '-' }}
</td>
</tr>
@empty
<tr id="serverP2hSummaryEmptyRow">
<td colspan="10" class="py-12 px-4 text-center">
<div class="flex flex-col items-center justify-center space-y-3">
<div class="w-12 h-12 rounded-2xl bg-rose-50 text-rose-500 flex items-center justify-center text-xl shadow-xs">
<i class="fa-solid fa-magnifying-glass"></i>
</div>
@if(request('search'))
<h4 class="text-sm font-bold text-slate-800">
Data "<span class="text-rose-600 font-bold">{{ request('search') }}</span>" tidak ditemukan di tabel
</h4>
<p class="text-xs text-slate-400 max-w-sm">
Pastikan kata kunci yang dicari sudah benar atau gunakan filter lainnya.
</p>
<div class="mt-4">
<a href="{{ route('qma.p2h.summary') }}" class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</a>
</div>
@else
<div class="text-sm font-bold text-slate-700">Belum Ada Data Rekapitulasi</div>
<p class="text-xs text-slate-400">Tidak ada data rekapitulasi P2H untuk rentang tanggal yang dipilih.</p>
@endif
</div>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
<!-- ========================================================================= -->
<!-- JAVASCRIPT MODAL PANDUAN HALAMAN -->
<!-- ========================================================================= -->
<script>
document.addEventListener('DOMContentLoaded', function () {
const searchInput = document.getElementById('p2hSummarySearchInput');
const tableBody = document.getElementById('p2hSummaryTableBody');
const resetContainer = document.getElementById('p2hSummaryResetContainer');
const serverEmptyRow = document.getElementById('serverP2hSummaryEmptyRow');
const hasServerFilters = {{ request()->anyFilled(['start_date', 'end_date', 'vehicle_id', 'validation_status', 'shift']) ? 'true' : 'false' }};
function escapeHtml(str) {
const div = document.createElement('div');
div.textContent = str;
return div.innerHTML;
}
if (searchInput && tableBody) {
searchInput.addEventListener('input', function (e) {
const rawValue = e.target.value;
const query = rawValue.toLowerCase().trim();
const rows = tableBody.querySelectorAll('tr.p2h-summary-row');
let visibleCount = 0;
rows.forEach(row => {
const text = row.textContent.toLowerCase();
const match = text.includes(query);
row.style.display = match ? '' : 'none';
if (match) visibleCount++;
});
// Sembunyikan baris SSR jika user sedang mengetik
if (serverEmptyRow) {
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
}
// Hapus baris pesan kosong pencarian client jika ada sebelumnya
const existingEmptyRow = document.getElementById('p2hSummaryClientEmptyRow');
if (existingEmptyRow) {
existingEmptyRow.remove();
}
// Tampilkan pesan jika tidak ada data yang cocok di tabel
if (visibleCount === 0 && query.length > 0) {
const emptyTr = document.createElement('tr');
emptyTr.id = 'p2hSummaryClientEmptyRow';
emptyTr.innerHTML = `
<td colspan="10" class="py-12 px-4 text-center">
<div class="flex flex-col items-center justify-center space-y-3">
<div class="w-12 h-12 rounded-2xl bg-rose-50 text-rose-500 flex items-center justify-center text-xl shadow-xs">
<i class="fa-solid fa-magnifying-glass"></i>
</div>
<h4 class="text-sm font-bold text-slate-800">
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
</h4>
<p class="text-xs text-slate-400 max-w-sm">
Pastikan kata kunci yang dicari sudah benar atau gunakan filter lainnya.
</p>
<div class="mt-4">
<button type="button"
onclick="const inp = document.getElementById('p2hSummarySearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</button>
</div>
</div>
</td>
`;
tableBody.appendChild(emptyTr);
}
// Tampilkan atau sembunyikan tombol Reset Filter secara real-time
if (resetContainer) {
let resetBtn = document.getElementById('p2hSummaryResetBtn');
if (query.length > 0 || hasServerFilters) {
if (!resetBtn) {
resetBtn = document.createElement('a');
resetBtn.href = "{{ route('qma.p2h.summary') }}";
resetBtn.id = 'p2hSummaryResetBtn';
resetBtn.className = 'text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center space-x-1 transition px-3 py-2 rounded-xl hover:bg-rose-50 border border-transparent hover:border-rose-100';
const resetIcon = document.createElement('i');
resetIcon.className = 'fa-solid fa-rotate-left text-[11px]';
const resetText = document.createElement('span');
resetText.textContent = 'Reset Filter';
resetBtn.appendChild(resetIcon);
resetBtn.appendChild(resetText);
resetContainer.appendChild(resetBtn);
}
} else {
if (resetBtn && !hasServerFilters) {
resetBtn.remove();
}
}
}
});
}
});
function toggleFilterCard() {
const card = document.getElementById('collapsibleFilterCard');
const chevron = document.getElementById('filterChevron');
if (card) {
card.classList.toggle('hidden');
}
if (chevron) {
chevron.classList.toggle('rotate-180');
}
}
function openGuideModal() {
const modal = document.getElementById('guideModal');
if (modal) {
modal.classList.remove('hidden');
document.documentElement.classList.add('modal-open');
document.body.classList.add('modal-open');
}
}
function closeGuideModal() {
const modal = document.getElementById('guideModal');
if (modal) {
modal.classList.add('hidden');
document.documentElement.classList.remove('modal-open');
document.body.classList.remove('modal-open');
}
}
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
closeGuideModal();
}
});
</script>
<!-- ========================================================================= -->
<!-- MODAL POPUP: PANDUAN HALAMAN (SUMMARY P2H) -->
<!-- ========================================================================= -->
<div id="guideModal"
onclick="if(event.target === this) closeGuideModal()"
class="hidden fixed inset-0 z-50 bg-slate-900/60 backdrop-blur-sm 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 transform transition-all my-8">
<div class="flex items-center justify-between pb-4 border-b border-slate-100">
<div class="flex items-center space-x-3">
<div class="w-9 h-9 rounded-full bg-slate-100 text-slate-700 flex items-center justify-center font-bold text-sm border border-slate-200">
<i class="fa-solid fa-info"></i>
</div>
<div>
<h3 class="text-base font-bold text-slate-900 tracking-tight leading-tight">Panduan Halaman</h3>
<p class="text-xs text-slate-500">Summary P2H Unit Support</p>
</div>
</div>
<button type="button"
onclick="closeGuideModal()"
class="text-slate-400 hover:text-slate-600 transition p-1.5 rounded-lg hover:bg-slate-100 cursor-pointer">
<i class="fa-solid fa-xmark text-lg"></i>
</button>
</div>
<div class="mt-4 space-y-4">
<p class="text-xs text-slate-600 leading-relaxed">
Halaman <strong>Summary P2H Unit Support</strong> menampilkan rekapitulasi performa dan tingkat kelaikan operasi harian alat berat.
</p>
<div class="space-y-3">
<div class="bg-slate-50/70 border border-slate-100 rounded-2xl p-3.5 flex items-start space-x-3.5">
<div class="w-9 h-9 rounded-xl bg-emerald-100/70 text-emerald-700 flex items-center justify-center flex-shrink-0 mt-0.5 text-sm border border-emerald-200/50">
<i class="fa-solid fa-chart-pie"></i>
</div>
<div class="min-w-0 flex-1">
<h4 class="text-xs font-bold text-slate-900">Rekapitulasi per Unit Support</h4>
<p class="text-[11px] text-slate-500 mt-0.5 leading-relaxed">
Melihat total inspeksi, jumlah lolos persetujuan, unit dengan temuan kerusakan, serta catatan jam kerja (HM) setiap alat.
</p>
</div>
</div>
<div class="bg-slate-50/70 border border-slate-100 rounded-2xl p-3.5 flex items-start space-x-3.5">
<div class="w-9 h-9 rounded-xl bg-amber-100/70 text-amber-700 flex items-center justify-center flex-shrink-0 mt-0.5 text-sm border border-amber-200/50">
<i class="fa-solid fa-filter"></i>
</div>
<div class="min-w-0 flex-1">
<h4 class="text-xs font-bold text-slate-900">Filter Fleksibel</h4>
<p class="text-[11px] text-slate-500 mt-0.5 leading-relaxed">
Pilih rentang tanggal, filter berdasarkan unit spesifik, status approval, atau shift kerja.
</p>
</div>
</div>
</div>
</div>
<div class="pt-4 mt-5 border-t border-slate-100 flex items-center justify-end">
<button type="button"
onclick="closeGuideModal()"
class="px-6 py-2.5 rounded-xl bg-slate-100 hover:bg-slate-200 text-slate-700 font-bold text-xs transition cursor-pointer shadow-2xs">
Saya Mengerti
</button>
</div>
</div>
</div>
@endsection
File diff suppressed because it is too large Load Diff
+246
View File
@@ -0,0 +1,246 @@
@extends('layouts.app')
@section('title', 'Master Template P2H - Admin QMA')
@section('content')
<div class="w-full space-y-6">
<!-- Header Judul (Tanpa Card Pembungkus Sesuai Referensi) -->
<div>
<div class="flex items-center space-x-1.5 mb-1">
<span class="text-xs font-bold uppercase tracking-wider text-[#1b5e20]">
MANAJEMEN SISTEM
</span>
</div>
<h2 class="text-2xl sm:text-3xl font-extrabold text-slate-900 tracking-tight">
Master Template P2H Unit Support
</h2>
<p class="text-xs sm:text-sm text-slate-500 mt-1">
Daftar checksheet resmi pemeriksaan pra-harian untuk setiap kategori unit alat berat di proyek PLTA Merangin.
</p>
</div>
<!-- Kotak Pencarian & Reset Filter -->
<form method="GET" action="{{ route('qma.p2h.templates') }}" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
<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>
</span>
<input type="text"
id="templateSearchInput"
name="search"
value="{{ request('search') }}"
placeholder="Cari nama template alat (Excavator, Crane, Vibro) atau kode..."
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 id="templateResetContainer">
@if(request('search'))
<a href="{{ route('qma.p2h.templates') }}"
id="templateResetBtn"
class="text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center space-x-1 transition px-3 py-2 rounded-xl hover:bg-rose-50 border border-transparent hover:border-rose-100">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Reset Filter</span>
</a>
@endif
</div>
</form>
<!-- Tabel Master Template P2H Unit Support (Tampilan Tabel Bukan Card) -->
<div class="bg-white rounded-none sm:rounded-2xl border border-slate-200 shadow-sm overflow-hidden" id="templatesTableContainer">
<div class="overflow-x-auto">
<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 text-center w-32">KODE TEMPLATE</th>
<th class="py-3.5 px-4">NAMA TEMPLATE ALAT</th>
<th class="py-3.5 px-4 text-center">STATUS</th>
<th class="py-3.5 px-4 text-center">BUTIR CEK</th>
<th class="py-3.5 px-4 text-center">UNIT TERKAIT</th>
<th class="py-3.5 px-4 text-center">RIWAYAT P2H</th>
<th class="py-3.5 px-4 text-center w-52">AKSI</th>
</tr>
</thead>
<tbody id="templatesTableBody" class="divide-y divide-slate-100 text-slate-700 bg-white">
@forelse($templates as $index => $tmpl)
<tr class="template-row hover:bg-slate-50/70 transition">
<td class="py-3.5 px-4 text-center font-medium text-slate-400">
{{ $index + 1 }}
</td>
<td class="py-3.5 px-4 text-center 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-lg border border-blue-200">
{{ $tmpl->code }}
</span>
</td>
<td class="py-3.5 px-4">
<div class="font-bold text-slate-900 text-sm leading-snug">{{ $tmpl->name }}</div>
<div class="text-[11px] text-slate-400 mt-0.5 line-clamp-1 max-w-lg">{{ $tmpl->description }}</div>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
@if($tmpl->items_count > 0)
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-[10px] font-bold bg-emerald-50 text-emerald-700 border border-emerald-200">
<i class="fa-solid fa-circle-check mr-1 text-[9px]"></i> Aktif
</span>
@else
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-[10px] font-bold bg-amber-50 text-amber-700 border border-amber-200">
<i class="fa-solid fa-triangle-exclamation mr-1 text-[9px]"></i> Template Baru (Kosong)
</span>
@endif
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
<span class="inline-flex items-center px-2.5 py-1 rounded-lg text-xs font-bold {{ $tmpl->items_count > 0 ? 'bg-slate-100 text-slate-800 border border-slate-200' : 'bg-slate-50 text-slate-400' }}">
{{ $tmpl->items_count }} Butir
</span>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
<span class="font-bold text-slate-800">{{ $tmpl->vehicles_count }}</span>
<span class="text-[10px] text-slate-400">Unit</span>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
<span class="font-bold text-slate-800">{{ $tmpl->records_count }}</span>
<span class="text-[10px] text-slate-400">Laporan</span>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
<a href="{{ route('qma.p2h.templates.show', $tmpl->id) }}"
class="inline-flex items-center space-x-1.5 px-3 py-1.5 rounded-xl text-xs font-bold transition shadow-2xs {{ $tmpl->items_count > 0 ? 'bg-[#1b5e20] hover:bg-[#144919] text-white' : 'bg-emerald-50 hover:bg-emerald-100 text-[#1b5e20] border border-emerald-200' }}"
title="Buka & Kelola Pertanyaan Template {{ $tmpl->name }}">
<i class="fa-solid fa-list-check text-[11px]"></i>
<span>{{ $tmpl->items_count > 0 ? 'Lihat & Kelola Pertanyaan' : 'Kelola & Isi Pertanyaan' }}</span>
</a>
</td>
</tr>
@empty
<tr id="serverTemplateEmptyRow">
<td colspan="8" class="py-12 px-4 text-center text-slate-400">
<div class="w-12 h-12 rounded-2xl bg-rose-50 text-rose-500 flex items-center justify-center text-xl shadow-xs mx-auto mb-3">
<i class="fa-solid fa-magnifying-glass"></i>
</div>
@if(request('search'))
<h4 class="text-sm font-bold text-slate-800">
Data "<span class="text-rose-600 font-bold">{{ request('search') }}</span>" tidak ditemukan di tabel
</h4>
<p class="text-xs text-slate-400 max-w-sm mx-auto mt-1">
Pastikan kata kunci yang dicari sudah benar.
</p>
<div class="mt-4">
<a href="{{ route('qma.p2h.templates') }}" class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</a>
</div>
@else
<div class="text-sm font-bold text-slate-700">Belum Ada Template</div>
<p class="text-xs text-slate-400 mt-1">Belum ada template checksheet P2H yang terdaftar.</p>
@endif
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function () {
const searchInput = document.getElementById('templateSearchInput');
const tableBody = document.getElementById('templatesTableBody');
const resetContainer = document.getElementById('templateResetContainer');
const serverEmptyRow = document.getElementById('serverTemplateEmptyRow');
function escapeHtml(str) {
const div = document.createElement('div');
div.textContent = str;
return div.innerHTML;
}
if (searchInput && tableBody) {
searchInput.addEventListener('input', function (e) {
const rawValue = e.target.value;
const query = rawValue.toLowerCase().trim();
const rows = tableBody.querySelectorAll('tr.template-row');
let visibleCount = 0;
rows.forEach(row => {
const text = row.textContent.toLowerCase();
const match = text.includes(query);
row.style.display = match ? '' : 'none';
if (match) visibleCount++;
});
// Sembunyikan baris SSR empty jika sedang mengetik
if (serverEmptyRow) {
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
}
// Hapus baris empty client jika ada sebelumnya
const existingClientEmpty = document.getElementById('clientTemplateEmptyRow');
if (existingClientEmpty) {
existingClientEmpty.remove();
}
// Tampilkan pesan jika tidak ada data yang cocok
if (visibleCount === 0 && query.length > 0) {
const emptyTr = document.createElement('tr');
emptyTr.id = 'clientTemplateEmptyRow';
emptyTr.innerHTML = `
<td colspan="8" class="py-12 px-4 text-center text-slate-400">
<div class="w-12 h-12 rounded-2xl bg-rose-50 text-rose-500 flex items-center justify-center text-xl shadow-xs mx-auto mb-3">
<i class="fa-solid fa-magnifying-glass"></i>
</div>
<h4 class="text-sm font-bold text-slate-800">
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
</h4>
<p class="text-xs text-slate-400 max-w-sm mx-auto mt-1">
Pastikan kata kunci yang dicari sudah benar.
</p>
<div class="mt-4">
<button type="button"
onclick="const inp = document.getElementById('templateSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</button>
</div>
</td>
`;
tableBody.appendChild(emptyTr);
}
// Tampilkan atau sembunyikan tombol Reset Filter secara real-time
if (resetContainer) {
let resetBtn = document.getElementById('templateResetBtn');
if (query.length > 0) {
if (!resetBtn) {
resetBtn = document.createElement('a');
resetBtn.href = "{{ route('qma.p2h.templates') }}";
resetBtn.id = 'templateResetBtn';
resetBtn.className = 'text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center space-x-1 transition px-3 py-2 rounded-xl hover:bg-rose-50 border border-transparent hover:border-rose-100';
const resetIcon = document.createElement('i');
resetIcon.className = 'fa-solid fa-rotate-left text-[11px]';
const resetText = document.createElement('span');
resetText.textContent = 'Reset Filter';
resetBtn.appendChild(resetIcon);
resetBtn.appendChild(resetText);
resetContainer.appendChild(resetBtn);
}
} else {
if (resetBtn && !{{ request()->filled('search') ? 'true' : 'false' }}) {
resetBtn.remove();
}
}
}
});
}
});
</script>
@endsection
+129 -25
View File
@@ -26,19 +26,19 @@
</div>
<!-- Tombol Aksi Kanan -->
<div class="flex items-center space-x-3 w-full sm:w-auto">
<div class="grid grid-cols-2 gap-2.5 w-full sm:flex sm:items-center sm:gap-3 sm:w-auto">
<button type="button"
onclick="alert('Fitur ekspor spreadsheet Light Vehicle sedang disiapkan')"
class="border border-emerald-600/30 text-emerald-900 bg-white hover:bg-emerald-50/50 px-4 py-2.5 rounded-xl text-xs font-bold flex items-center space-x-2 transition shadow-sm">
class="w-full sm:w-auto flex items-center justify-center space-x-2 border border-emerald-600/30 text-emerald-900 bg-white hover:bg-emerald-50/50 px-3 sm:px-4 py-2.5 rounded-xl text-xs font-bold transition shadow-sm">
<i class="fa-regular fa-file-excel text-emerald-700 text-sm"></i>
<span>Ekspor Light Vehicle</span>
<span class="truncate">Ekspor LV</span>
<i class="fa-solid fa-chevron-down text-[9px] text-slate-400 ml-1"></i>
</button>
<button onclick="openAddModal()"
class="bg-[#1b5e20] hover:bg-[#144919] text-white px-4 py-2.5 rounded-xl text-xs font-bold flex items-center space-x-2 transition shadow-sm">
class="w-full sm:w-auto flex items-center justify-center space-x-2 bg-[#1b5e20] hover:bg-[#144919] text-white px-3 sm:px-4 py-2.5 rounded-xl text-xs font-bold transition shadow-sm cursor-pointer">
<i class="fa-solid fa-plus text-xs"></i>
<span>Tambah Light Vehicle</span>
<span class="truncate">Tambah LV</span>
</button>
</div>
</div>
@@ -46,19 +46,17 @@
<!-- Kotak Pencarian & Filter Status -->
<div class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
<form method="GET" action="{{ route('qma.vehicles.lv') }}" class="relative w-full max-w-sm sm:max-w-md">
@if(request('status'))
<input type="hidden" name="status" value="{{ request('status') }}">
@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>
</span>
<input type="text"
id="lvSearchInput"
name="search"
value="{{ request('search') }}"
placeholder="Cari kode LV, nopol, merek, tipe, atau pemilik..."
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">
</form>
</div>
<div class="flex items-center space-x-2">
<form method="GET" action="{{ route('qma.vehicles.lv') }}">
@@ -74,17 +72,19 @@
</select>
</form>
@if(request('search') || request('status'))
<a href="{{ route('qma.vehicles.lv') }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-2">
<i class="fa-solid fa-rotate-left"></i>
<span>Reset Filter</span>
</a>
@endif
<div id="lvResetWrapper" class="flex items-center">
@if(request('search') || request('status'))
<a id="lvResetBtn" href="{{ route('qma.vehicles.lv') }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-2">
<i class="fa-solid fa-rotate-left"></i>
<span>Reset Filter</span>
</a>
@endif
</div>
</div>
</div>
<!-- Tabel Data Light Vehicle (Header Navy Solid #06213f) -->
<div class="bg-white rounded-2xl border border-slate-200 shadow-sm overflow-hidden">
<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">
<thead class="bg-[#06213f] text-white font-bold text-[11px] uppercase tracking-wider">
@@ -101,9 +101,9 @@
<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">
<tbody id="lvTableBody" class="divide-y divide-slate-100 text-slate-700 bg-white">
@forelse($vehicles as $index => $v)
<tr class="hover:bg-slate-50/70 transition">
<tr class="lv-row hover:bg-slate-50/70 transition">
<td class="py-3.5 px-4 text-center font-medium text-slate-400">
{{ $vehicles->firstItem() + $index }}
</td>
@@ -119,12 +119,11 @@
<button type="button"
onclick="openQrModal('{{ $v->code }}', '{{ addslashes($v->brand_type ?? '') }}', '{{ addslashes($v->license_plate ?? '-') }}', '{{ addslashes($v->division ?? '-') }}', '{{ url('/gate-activity/' . $v->code) }}', this)"
data-qr-base64="{{ base64_encode(\SimpleSoftwareIO\QrCode\Facades\QrCode::size(240)->margin(1)->generate(url('/gate-activity/' . $v->code))) }}"
class="group inline-flex items-center space-x-1.5 px-2 py-1 rounded-xl bg-slate-50 hover:bg-emerald-50 border border-slate-200 hover:border-emerald-300 transition shadow-2xs cursor-pointer"
class="group inline-flex items-center justify-center p-1 rounded-xl bg-slate-50 hover:bg-emerald-50 border border-slate-200 hover:border-emerald-300 transition shadow-2xs cursor-pointer"
title="Klik untuk Lihat, Unduh & Cetak Stiker QR {{ $v->code }}">
<div class="w-7 h-7 bg-white rounded-lg border border-slate-200 group-hover:border-emerald-300 flex items-center justify-center p-0.5 overflow-hidden [&>svg]:w-full [&>svg]:h-full shadow-2xs">
{!! \SimpleSoftwareIO\QrCode\Facades\QrCode::size(24)->margin(0)->generate(url('/gate-activity/' . $v->code)) !!}
</div>
<i class="fa-solid fa-expand text-[10px] text-slate-400 group-hover:text-emerald-600"></i>
</button>
</td>
@@ -197,10 +196,26 @@
</td>
</tr>
@empty
<tr>
<tr id="serverLvEmptyRow">
<td colspan="10" class="py-12 text-center text-slate-400">
<i class="fa-solid fa-car text-3xl mb-2 block text-slate-300"></i>
Belum ada armada Light Vehicle yang sesuai dengan kriteria pencarian.
<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">
Data "<span class="text-rose-600 font-bold">{{ request('search') }}</span>" tidak ditemukan di tabel
</p>
<p class="text-xs text-slate-400 mt-1">
Pastikan kata kunci yang dicari sudah benar.
</p>
<div class="mt-4">
<a href="{{ route('qma.vehicles.lv') }}" class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</a>
</div>
@else
<p class="text-sm font-semibold text-slate-700">Belum ada armada Light Vehicle</p>
<p class="text-xs text-slate-400 mt-0.5">Belum ada data armada Light Vehicle yang sesuai dengan kriteria filter.</p>
@endif
</td>
</tr>
@endforelse
@@ -208,7 +223,7 @@
</table>
</div>
<div class="p-4 bg-slate-50 border-t border-slate-200">
<div id="lvPaginationContainer" class="p-4 bg-slate-50 border-t border-slate-200">
{{ $vehicles->links() }}
</div>
</div>
@@ -857,6 +872,95 @@
document.getElementById('deleteVehicleModal').classList.add('hidden');
}
// =========================================================================
// REAL-TIME CLIENT-SIDE SEARCH
// =========================================================================
function escapeHtml(str) {
const div = document.createElement('div');
div.textContent = str;
return div.innerHTML;
}
document.addEventListener('DOMContentLoaded', function () {
const searchInput = document.getElementById('lvSearchInput');
const tableBody = document.getElementById('lvTableBody');
const resetWrapper = document.getElementById('lvResetWrapper');
const paginationContainer = document.getElementById('lvPaginationContainer');
const serverEmptyRow = document.getElementById('serverLvEmptyRow');
const hasServerFilters = {{ request()->filled('status') ? 'true' : 'false' }};
if (searchInput && tableBody) {
searchInput.addEventListener('input', function (e) {
const rawValue = e.target.value;
const query = rawValue.toLowerCase().trim();
const rows = tableBody.querySelectorAll('tr.lv-row');
let visibleCount = 0;
rows.forEach(row => {
const text = row.textContent.toLowerCase();
if (text.includes(query)) {
row.style.display = '';
visibleCount++;
} else {
row.style.display = 'none';
}
});
if (paginationContainer) {
paginationContainer.style.display = query.length > 0 ? 'none' : '';
}
const existingEmptyRow = document.getElementById('clientLvEmptyRow');
if (existingEmptyRow) existingEmptyRow.remove();
if (serverEmptyRow) {
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
}
if (visibleCount === 0 && query.length > 0) {
const emptyTr = document.createElement('tr');
emptyTr.id = 'clientLvEmptyRow';
emptyTr.innerHTML = `
<td colspan="10" 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">
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
</p>
<p class="text-xs text-slate-400 mt-1">
Pastikan kata kunci yang dicari sudah benar.
</p>
<div class="mt-4">
<button type="button"
onclick="const inp = document.getElementById('lvSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</button>
</div>
</td>
`;
tableBody.appendChild(emptyTr);
}
if (resetWrapper) {
let resetBtn = document.getElementById('lvResetBtn');
if (query.length > 0 || hasServerFilters) {
if (!resetBtn) {
resetBtn = document.createElement('a');
resetBtn.id = 'lvResetBtn';
resetBtn.href = "{{ route('qma.vehicles.lv') }}";
resetBtn.className = 'text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-2';
resetBtn.innerHTML = '<i class="fa-solid fa-rotate-left"></i><span>Reset Filter</span>';
resetWrapper.appendChild(resetBtn);
}
} else if (!hasServerFilters && resetBtn) {
resetBtn.remove();
}
}
});
}
});
@if($errors->any())
document.addEventListener('DOMContentLoaded', function() {
openAddModal();
+293 -379
View File
@@ -26,19 +26,19 @@
</div>
<!-- Tombol Aksi Kanan -->
<div class="flex items-center space-x-3 w-full sm:w-auto">
<div class="grid grid-cols-2 gap-2.5 w-full sm:flex sm:items-center sm:gap-3 sm:w-auto">
<button type="button"
onclick="alert('Fitur ekspor spreadsheet Unit Support sedang disiapkan')"
class="border border-emerald-600/30 text-emerald-900 bg-white hover:bg-emerald-50/50 px-4 py-2.5 rounded-xl text-xs font-bold flex items-center space-x-2 transition shadow-sm">
class="w-full sm:w-auto flex items-center justify-center space-x-2 border border-emerald-600/30 text-emerald-900 bg-white hover:bg-emerald-50/50 px-3 sm:px-4 py-2.5 rounded-xl text-xs font-bold transition shadow-sm">
<i class="fa-regular fa-file-excel text-emerald-700 text-sm"></i>
<span>Ekspor Unit Support</span>
<span class="truncate">Ekspor Data</span>
<i class="fa-solid fa-chevron-down text-[9px] text-slate-400 ml-1"></i>
</button>
<button onclick="openAddModal()"
class="bg-[#1b5e20] hover:bg-[#144919] text-white px-4 py-2.5 rounded-xl text-xs font-bold flex items-center space-x-2 transition shadow-sm">
class="w-full sm:w-auto flex items-center justify-center space-x-2 bg-[#1b5e20] hover:bg-[#144919] text-white px-3 sm:px-4 py-2.5 rounded-xl text-xs font-bold transition shadow-sm cursor-pointer">
<i class="fa-solid fa-plus text-xs"></i>
<span>Tambah Unit Support</span>
<span class="truncate">Tambah Kategori</span>
</button>
</div>
</div>
@@ -46,22 +46,17 @@
<!-- Kotak Pencarian & Filter Kategori Alat Berat -->
<div class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
<form method="GET" action="{{ route('qma.vehicles.support') }}" class="relative w-full max-w-sm sm:max-w-md">
@if(request('status'))
<input type="hidden" name="status" value="{{ request('status') }}">
@endif
@if(request('unit_category'))
<input type="hidden" name="unit_category" value="{{ request('unit_category') }}">
@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>
</span>
<input type="text"
id="supportSearchInput"
name="search"
value="{{ request('search') }}"
placeholder="Cari kode unit, model, tipe, lokasi, dokumen..."
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">
</form>
</div>
<div class="flex flex-wrap items-center gap-2">
<!-- Filter Kategori Alat Berat -->
@@ -69,9 +64,6 @@
@if(request('search'))
<input type="hidden" name="search" value="{{ request('search') }}">
@endif
@if(request('status'))
<input type="hidden" name="status" value="{{ request('status') }}">
@endif
<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>
@foreach($availableCategories as $cat)
@@ -80,159 +72,121 @@
</select>
</form>
<!-- Filter Status Operasional -->
<form method="GET" action="{{ route('qma.vehicles.support') }}" class="flex items-center space-x-2">
@if(request('search'))
<input type="hidden" name="search" value="{{ request('search') }}">
<div id="supportResetWrapper" class="flex items-center">
@if(request('search') || request('unit_category'))
<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">
<i class="fa-solid fa-rotate-left"></i>
<span>Reset</span>
</a>
@endif
@if(request('unit_category'))
<input type="hidden" name="unit_category" value="{{ request('unit_category') }}">
@endif
<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 (Siap Kerja)</option>
<option value="Standby" {{ request('status') === 'Standby' ? 'selected' : '' }}>Standby</option>
<option value="Breakdown" {{ request('status') === 'Breakdown' ? 'selected' : '' }}>Breakdown</option>
<option value="Maintenance" {{ request('status') === 'Maintenance' ? 'selected' : '' }}>Maintenance</option>
</select>
</form>
@if(request('search') || request('status') || request('unit_category'))
<a 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">
<i class="fa-solid fa-rotate-left"></i>
<span>Reset</span>
</a>
@endif
</div>
</div>
</div>
<!-- Tabel Data Unit Support (Header Navy Solid #06213f) -->
<div class="bg-white rounded-2xl border border-slate-200 shadow-sm overflow-hidden">
<!-- Tabel Data Kategori Unit Support (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">
<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 UNIT</th>
<th class="py-3.5 px-4">KATEGORI & MODEL</th>
<th class="py-3.5 px-4">MEREK & SPESIFIKASI</th>
<th class="py-3.5 px-4">LOKASI KERJA</th>
<th class="py-3.5 px-4 text-right">ODOMETER (HM/KM)</th>
<th class="py-3.5 px-4 text-center">DOKUMEN IZIN</th>
<th class="py-3.5 px-4 text-center">STATUS</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">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 text-center">AKSI</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 text-slate-700 bg-white">
<tbody id="supportTableBody" class="divide-y divide-slate-100 text-slate-700 bg-white">
@forelse($vehicles as $index => $v)
<tr class="hover:bg-slate-50/70 transition">
<tr class="support-row hover:bg-slate-50/70 transition">
<td class="py-3.5 px-4 text-center font-medium text-slate-400">
{{ $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 py-0.5 rounded border border-blue-200">
<span class="bg-blue-50 text-blue-800 px-2.5 py-1 rounded border border-blue-200">
{{ $v->code }}
</span>
</td>
<td class="py-3.5 px-4 whitespace-nowrap">
<span class="font-bold text-slate-900 block">{{ $v->unit_category ?? 'Alat Berat' }}</span>
<span class="text-[10px] text-slate-500 font-mono">{{ $v->model_number ? "Model: {$v->model_number}" : '-' }}</span>
<span class="font-bold text-slate-900 block text-xs">{{ $v->unit_category ?? 'Alat Berat' }}</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">
<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>
<div class="flex items-center space-x-2 mt-0.5 text-[10px] text-slate-500">
@if($v->unit_type)
<span>{{ $v->unit_type }}</span>
@endif
@if($v->production_year)
<span>&bull; Thn {{ $v->production_year }}</span>
@endif
</div>
@if($v->model_number)
<div class="text-[10px] text-slate-500 font-mono mt-0.5">Model: {{ $v->model_number }}</div>
@endif
</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">
@if($v->location)
<i class="fa-solid fa-location-dot text-[9px] mr-1 text-rose-500"></i>{{ $v->location }}
@else
-
@endif
</div>
<span class="text-[10px] text-slate-400 block">{{ $v->division ?? '-' }}</span>
</td>
<td class="py-3.5 px-4 text-right font-mono font-bold text-slate-800 whitespace-nowrap">
{{ number_format($v->current_km, 0, ',', '.') }}
<span class="text-[10px] text-slate-400 font-sans font-normal">HM/KM</span>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
<div class="flex flex-col items-center space-y-1">
@if($v->silo_document)
<span class="inline-flex items-center px-2 py-0.5 rounded text-[10px] font-semibold bg-emerald-50 text-emerald-800 border border-emerald-200" title="SILO: {{ $v->silo_document }}">
<i class="fa-solid fa-certificate mr-1 text-[9px] text-emerald-600"></i> SILO Ada
</span>
@else
<span class="text-[10px] text-slate-400 italic">Tanpa SILO</span>
@endif
@if($v->kir_document)
<span class="inline-flex items-center px-1.5 py-0.2 rounded text-[9px] font-mono bg-slate-100 text-slate-600 border border-slate-200">
KIR: {{ $v->kir_document }}
</span>
@endif
</div>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
@if($v->status === 'Operation')
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-[10px] font-bold bg-emerald-50 text-emerald-700 border border-emerald-200">
<i class="fa-solid fa-circle-check mr-1 text-[9px]"></i> Operation
</span>
@elseif($v->status === 'Standby')
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-[10px] font-bold bg-amber-50 text-amber-700 border border-amber-200">
<i class="fa-solid fa-pause mr-1 text-[9px]"></i> Standby
</span>
@elseif($v->status === 'Breakdown')
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-[10px] font-bold bg-rose-50 text-rose-700 border border-rose-200">
<i class="fa-solid fa-screwdriver-wrench mr-1 text-[9px]"></i> Breakdown
</span>
@else
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-[10px] font-medium bg-slate-100 text-slate-600">
{{ $v->status }}
</span>
@endif
<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>
<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 Detail & Perizinan">
title="Lihat Spesifikasi Kategori">
<i class="fa-regular fa-eye text-sm"></i>
</button>
<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 Unit Support">
title="Edit Data Kategori">
<i class="fa-regular fa-pen-to-square text-sm"></i>
</button>
<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 Unit">
title="Hapus Kategori">
<i class="fa-regular fa-trash-can text-sm"></i>
</button>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="9" class="py-12 text-center text-slate-400">
<i class="fa-solid fa-tractor text-3xl mb-2 block text-slate-300"></i>
Belum ada unit alat berat yang sesuai dengan filter.
<tr id="serverSupportEmptyRow">
<td colspan="8" 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">
Data "<span class="text-rose-600 font-bold">{{ request('search') }}</span>" tidak ditemukan di tabel
</p>
<p class="text-xs text-slate-400 mt-1">
Pastikan kata kunci yang dicari sudah benar.
</p>
<div class="mt-4">
<a href="{{ route('qma.vehicles.support') }}" class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</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>
@endif
</td>
</tr>
@endforelse
@@ -240,7 +194,7 @@
</table>
</div>
<div class="p-4 bg-slate-50 border-t border-slate-200">
<div id="supportPaginationContainer" class="p-4 bg-slate-50 border-t border-slate-200">
{{ $vehicles->links() }}
</div>
</div>
@@ -252,39 +206,41 @@
<div id="addVehicleModal"
onclick="if(event.target === this) closeAddModal()"
class="hidden fixed inset-0 z-50 bg-slate-900/50 backdrop-blur-sm flex items-center justify-center p-4 overflow-y-auto no-scrollbar">
<div class="bg-white rounded-3xl shadow-2xl max-w-2xl w-full p-6 sm:p-7 border border-slate-100 max-h-[92vh] overflow-y-auto no-scrollbar">
<!-- Header Modal Bersih Tanpa Icon Box Sesuai Referensi Tambah Aset -->
<div class="bg-white rounded-3xl shadow-2xl max-w-xl w-full p-6 sm:p-7 border border-slate-100 max-h-[92vh] overflow-y-auto no-scrollbar">
<div class="flex items-center justify-between mb-4">
<h3 class="text-xl font-bold text-slate-900 tracking-tight">
Tambah Unit Support
</h3>
<div>
<h3 class="text-xl font-bold text-slate-900 tracking-tight">
Tambah Kategori Unit Support
</h3>
<p class="text-xs text-slate-500 mt-0.5">Mendaftarkan kategori/tipe master aset baru ke sistem.</p>
</div>
<button type="button" onclick="closeAddModal()" class="text-slate-400 hover:text-slate-600 transition p-1">
<i class="fa-solid fa-xmark text-lg"></i>
</button>
</div>
<form id="addVehicleForm" action="{{ route('qma.vehicles.store') }}" method="POST" class="space-y-3">
<form id="addVehicleForm" action="{{ route('qma.vehicles.store') }}" method="POST" class="space-y-3.5">
@csrf
<input type="hidden" name="category" value="unit_support">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div>
<label class="block text-xs font-bold text-slate-800 mb-1">Kode Unit <span class="text-rose-500">*</span></label>
<input type="text" name="code" id="addCodeInput" required placeholder="MISAL: EX01, CR01, DT05" value="{{ old('code') }}"
class="w-full text-xs px-3.5 py-2 rounded-xl border @error('code') border-rose-500 @else border-slate-200 @enderror bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition font-mono uppercase">
<label class="block text-xs font-bold text-slate-800 mb-1">Kode Kategori <span class="text-rose-500">*</span></label>
<input type="text" name="code" id="addCodeInput" required placeholder="MISAL: EX01, CR01, BL01" value="{{ old('code') }}"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border @error('code') border-rose-500 @else border-slate-200 @enderror bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition font-mono uppercase font-bold">
<p id="codeError" class="text-xs text-rose-600 font-semibold mt-1 flex items-center space-x-1.5 @if(!$errors->has('code')) hidden @endif">
<i class="fa-solid fa-circle-exclamation text-rose-500 text-xs"></i>
<span id="codeErrorText">{{ $errors->first('code') ?? 'Kode unit sudah ada, silakan gunakan kode lain.' }}</span>
</p>
<p id="codeHint" class="text-[11px] text-slate-400 mt-0.5 @if($errors->has('code')) hidden @endif">
* Kode unit unik dan tidak boleh sama dengan kode aset yang lain.
* Digunakan sebagai dasar kode unit fisik (contoh: BL01-001).
</p>
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1">Kategori Alat Berat <span class="text-rose-500">*</span></label>
<input type="text" name="unit_category" required placeholder="Contoh: Excavator / Mobile Crane / Dump Truck"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
<input type="text" name="unit_category" required placeholder="Contoh: Excavator / Mobile Crane / Boomlift"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition font-medium">
</div>
</div>
@@ -292,99 +248,47 @@
<div>
<label class="block text-xs font-bold text-slate-800 mb-1">Merek & Tipe Lengkap <span class="text-rose-500">*</span></label>
<input type="text" name="brand_type" required placeholder="Contoh: KOMATSU PC200-8 / KATO SR-250R"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 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 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1">Tipe / Model Khusus</label>
<input type="text" name="unit_type" placeholder="Contoh: Hydraulic Excavator / Rough Terrain"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3">
<div>
<label class="block text-xs font-bold text-slate-800 mb-1">Nomor Model</label>
<input type="text" name="model_number" placeholder="Contoh: PC200-8M0"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1">Tahun Produksi</label>
<input type="number" name="production_year" placeholder="Contoh: 2021"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1">Nopol (Jika ada)</label>
<input type="text" name="license_plate" placeholder="Contoh: BH 8412 AA"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition uppercase font-mono">
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div>
<label class="block text-xs font-bold text-slate-800 mb-1">Lokasi Kerja Lapangan</label>
<input type="text" name="location" placeholder="Contoh: Beringin Tunggal / CCR DAM / Tunnel"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
<label class="block text-xs font-bold text-slate-800 mb-1">Nomor Model</label>
<input type="text" name="model_number" placeholder="Contoh: PC200-8M0"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition font-mono">
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1">Divisi Penanggung Jawab</label>
<input type="text" name="division" placeholder="Contoh: Civil & Inviro / Mechanical"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
<label class="block text-xs font-bold text-slate-800 mb-1">Estimasi Konsumsi BBM (Liter/Jam)</label>
<input type="number" step="0.01" name="fuel_consumption" placeholder="Contoh: 18.5"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition font-mono">
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div>
<label class="block text-xs font-bold text-slate-800 mb-1">Kepemilikan Aset</label>
<input type="text" name="ownership" placeholder="Contoh: PT Kerinci Merangin Hidro"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1">Status Operasi <span class="text-rose-500">*</span></label>
<select name="status" required class="w-full text-xs px-3.5 py-2 rounded-xl 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="Operation">Operation (Siap Kerja)</option>
<option value="Standby">Standby</option>
<option value="Breakdown">Breakdown</option>
<option value="Maintenance">Maintenance</option>
<label class="block text-xs font-bold text-slate-800 mb-1">Divisi Penanggung Jawab</label>
<select name="division"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition font-medium">
<option value="">-- Pilih Divisi Penanggung Jawab --</option>
@foreach($availableDivisions as $div)
<option value="{{ $div }}" {{ old('division') === $div ? 'selected' : '' }}>{{ $div }}</option>
@endforeach
</select>
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1">Odometer Awal (HM/KM) <span class="text-rose-500">*</span></label>
<input type="number" step="0.01" name="current_km" required value="0"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition font-mono">
<label class="block text-xs font-bold text-slate-800 mb-1">Kepemilikan Aset</label>
<input type="text" name="ownership" placeholder="Contoh: PT Kerinci Merangin Hidro"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
</div>
<!-- Bagian Perizinan & Dokumen -->
<div class="p-3.5 rounded-2xl bg-slate-50 border border-slate-200 space-y-2.5">
<div class="flex items-center space-x-2 text-slate-800 font-bold text-xs">
<i class="fa-solid fa-file-contract text-emerald-600"></i>
<span>Dokumen Legalitas & Perizinan Kelayakan</span>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2.5">
<div>
<label class="block text-[11px] font-bold text-slate-700 mb-1">Nomor SILO (Surat Izin Layak Operasi)</label>
<input type="text" name="silo_document" placeholder="Contoh: SILO-KMH-2024/091"
class="w-full text-xs px-3 py-1.5 rounded-xl border border-slate-200 bg-white">
</div>
<div>
<label class="block text-[11px] font-bold text-slate-700 mb-1">Nomor Dokumen KIR</label>
<input type="text" name="kir_document" placeholder="Contoh: KIR-2026/08"
class="w-full text-xs px-3 py-1.5 rounded-xl border border-slate-200 bg-white">
</div>
<div>
<label class="block text-[11px] font-bold text-slate-700 mb-1">Nomor STNK</label>
<input type="text" name="stnk_document" placeholder="Contoh: STNK-BH-EX01"
class="w-full text-xs px-3 py-1.5 rounded-xl border border-slate-200 bg-white">
</div>
<div>
<label class="block text-[11px] font-bold text-slate-700 mb-1">Konsumsi BBM (Liter/Jam)</label>
<input type="number" step="0.01" name="fuel_consumption" placeholder="Contoh: 18.5"
class="w-full text-xs px-3 py-1.5 rounded-xl border border-slate-200 bg-white">
</div>
</div>
</div>
<!-- Footer Tombol Bersih Sesuai Referensi Tambah Aset -->
<!-- Footer Tombol -->
<div class="pt-3 flex items-center justify-end space-x-3">
<button type="button" onclick="closeAddModal()"
class="px-5 py-2.5 rounded-xl border border-slate-300 bg-white hover:bg-slate-50 text-slate-700 font-bold text-xs transition">
@@ -392,7 +296,7 @@
</button>
<button type="submit"
class="px-6 py-2.5 rounded-xl bg-[#1b5e20] hover:bg-[#144919] text-white font-bold text-xs transition shadow-sm">
Simpan Unit Support
Simpan Kategori
</button>
</div>
</form>
@@ -400,42 +304,44 @@
</div>
<!-- ========================================================================= -->
<!-- MODAL: EDIT UNIT SUPPORT -->
<!-- MODAL: EDIT KATEGORI UNIT SUPPORT -->
<!-- ========================================================================= -->
<div id="editVehicleModal"
onclick="if(event.target === this) closeEditModal()"
class="hidden fixed inset-0 z-50 bg-slate-900/50 backdrop-blur-sm flex items-center justify-center p-4 overflow-y-auto no-scrollbar">
<div class="bg-white rounded-3xl shadow-2xl max-w-2xl w-full p-6 sm:p-7 border border-slate-100 max-h-[92vh] overflow-y-auto no-scrollbar">
<!-- Header Modal Bersih Tanpa Icon Box Sesuai Referensi Tambah Aset -->
<div class="bg-white rounded-3xl shadow-2xl max-w-xl w-full p-6 sm:p-7 border border-slate-100 max-h-[92vh] overflow-y-auto no-scrollbar">
<div class="flex items-center justify-between mb-4">
<h3 class="text-xl font-bold text-slate-900 tracking-tight">
Edit Unit Support
</h3>
<div>
<h3 class="text-xl font-bold text-slate-900 tracking-tight">
Edit Kategori Unit Support
</h3>
<p class="text-xs text-slate-500 mt-0.5">Memperbarui informasi master kategori aset.</p>
</div>
<button type="button" onclick="closeEditModal()" class="text-slate-400 hover:text-slate-600 transition p-1">
<i class="fa-solid fa-xmark text-lg"></i>
</button>
</div>
<form id="editVehicleForm" action="" method="POST" class="space-y-4">
<form id="editVehicleForm" action="" method="POST" class="space-y-3.5">
@csrf
<input type="hidden" name="category" value="unit_support">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Kode Unit <span class="text-rose-500">*</span></label>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Kode Kategori <span class="text-rose-500">*</span></label>
<input type="text" name="code" id="editCode" required
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition font-mono uppercase">
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition font-mono uppercase font-bold">
<p id="editCodeError" class="text-xs text-rose-600 font-semibold mt-1.5 hidden flex items-center">
<i class="fa-solid fa-circle-exclamation mr-1.5 flex-shrink-0"></i>
<span id="editCodeErrorText">Kode unit sudah ada, silakan gunakan kode lain.</span>
</p>
<p id="editCodeHint" class="text-[11px] text-slate-400 mt-1">* Kode unit unik dan tidak boleh sama dengan kode aset yang lain.</p>
<p id="editCodeHint" class="text-[11px] text-slate-400 mt-1">* Jika diubah, kode seluruh unit fisik di bawahnya akan otomatis menyesuaikan.</p>
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Kategori Alat Berat <span class="text-rose-500">*</span></label>
<input type="text" name="unit_category" id="editUnitCategory" required
class="w-full text-xs px-3.5 py-2.5 rounded-xl 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 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition font-medium">
</div>
</div>
@@ -452,90 +358,38 @@
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3.5">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Nomor Model</label>
<input type="text" name="model_number" id="editModelNumber"
class="w-full text-xs px-3.5 py-2.5 rounded-xl 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 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition font-mono">
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Tahun Produksi</label>
<input type="number" name="production_year" id="editProductionYear"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Nopol (Jika ada)</label>
<input type="text" name="license_plate" id="editLicensePlate"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition uppercase font-mono">
<label class="block text-xs font-bold text-slate-800 mb-1.5">Konsumsi BBM Standar (L/Jam)</label>
<input type="number" step="0.01" name="fuel_consumption" id="editFuelConsumption"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition font-mono">
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Lokasi Kerja</label>
<input type="text" name="location" id="editLocation"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
<label class="block text-xs font-bold text-slate-800 mb-1.5">Divisi Penanggung Jawab</label>
<select name="division" id="editDivision"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition font-medium">
<option value="">-- Pilih Divisi Penanggung Jawab --</option>
@foreach($availableDivisions as $div)
<option value="{{ $div }}">{{ $div }}</option>
@endforeach
</select>
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Divisi</label>
<input type="text" name="division" id="editDivision"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3.5">
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Kepemilikan</label>
<input type="text" name="ownership" id="editOwnership"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Status Operasi <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 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
<option value="Operation">Operation (Siap Kerja)</option>
<option value="Standby">Standby</option>
<option value="Breakdown">Breakdown</option>
<option value="Maintenance">Maintenance</option>
</select>
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Odometer HM/KM <span class="text-rose-500">*</span></label>
<input type="number" step="0.01" name="current_km" id="editCurrentKm" required
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition font-mono">
</div>
</div>
<!-- Bagian Perizinan di Edit -->
<div class="p-4 rounded-2xl bg-slate-50 border border-slate-200 space-y-3">
<div class="flex items-center space-x-2 text-slate-800 font-bold text-xs">
<i class="fa-solid fa-file-contract text-emerald-600"></i>
<span>Dokumen Legalitas & Perizinan</span>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div>
<label class="block text-[11px] font-bold text-slate-700 mb-1">Nomor Dokumen SILO</label>
<input type="text" name="silo_document" id="editSiloDocument"
class="w-full text-xs px-3 py-2 rounded-xl border border-slate-200 bg-white">
</div>
<div>
<label class="block text-[11px] font-bold text-slate-700 mb-1">Nomor Dokumen KIR</label>
<input type="text" name="kir_document" id="editKirDocument"
class="w-full text-xs px-3 py-2 rounded-xl border border-slate-200 bg-white">
</div>
<div>
<label class="block text-[11px] font-bold text-slate-700 mb-1">Nomor STNK</label>
<input type="text" name="stnk_document" id="editStnkDocument"
class="w-full text-xs px-3 py-2 rounded-xl border border-slate-200 bg-white">
</div>
<div>
<label class="block text-[11px] font-bold text-slate-700 mb-1">Konsumsi BBM (L/Jam)</label>
<input type="number" step="0.01" name="fuel_consumption" id="editFuelConsumption"
class="w-full text-xs px-3 py-2 rounded-xl border border-slate-200 bg-white">
</div>
</div>
</div>
<!-- Footer Tombol Bersih Sesuai Referensi Tambah Aset -->
<!-- Footer Tombol -->
<div class="pt-4 flex items-center justify-end space-x-3">
<button type="button" onclick="closeEditModal()"
class="px-5 py-2.5 rounded-xl border border-slate-300 bg-white hover:bg-slate-50 text-slate-700 font-bold text-xs transition">
@@ -543,7 +397,7 @@
</button>
<button type="submit"
class="px-6 py-2.5 rounded-xl bg-[#1b5e20] hover:bg-[#144919] text-white font-bold text-xs transition shadow-sm">
Perbarui Data
Perbarui Kategori
</button>
</div>
</form>
@@ -551,15 +405,17 @@
</div>
<!-- ========================================================================= -->
<!-- MODAL: DETAIL UNIT SUPPORT -->
<!-- MODAL: DETAIL SPESIFIKASI KATEGORI UNIT SUPPORT -->
<!-- ========================================================================= -->
<div id="detailVehicleModal" onclick="if(event.target === this) closeDetailModal()" class="hidden fixed inset-0 z-50 bg-slate-900/50 backdrop-blur-sm flex items-center justify-center p-4 overflow-y-auto no-scrollbar">
<div class="bg-white rounded-3xl shadow-2xl max-w-2xl w-full p-6 sm:p-7 border border-slate-100 max-h-[92vh] overflow-y-auto no-scrollbar">
<!-- Header Modal Bersih Tanpa Icon Box Sesuai Referensi Card Tambah Data -->
<div class="bg-white rounded-3xl shadow-2xl max-w-xl w-full p-6 sm:p-7 border border-slate-100 max-h-[92vh] overflow-y-auto no-scrollbar">
<div class="flex items-center justify-between mb-4">
<h3 class="text-xl font-bold text-slate-900 tracking-tight">
Detail Unit Support
</h3>
<div>
<h3 class="text-xl font-bold text-slate-900 tracking-tight">
Detail Spesifikasi Kategori
</h3>
<p class="text-xs text-slate-500 mt-0.5">Informasi master kategori aset Unit Support.</p>
</div>
<button type="button" onclick="closeDetailModal()" class="text-slate-400 hover:text-slate-600 transition p-1">
<i class="fa-solid fa-xmark text-lg"></i>
</button>
@@ -568,15 +424,15 @@
<div class="space-y-4">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Kode Unit</label>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Kode Kategori</label>
<div class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono font-bold flex items-center">
<span id="detailCode" class="bg-blue-50 text-blue-800 px-2 py-0.5 rounded border border-blue-200">-</span>
<span id="detailCode" class="bg-blue-50 text-blue-800 px-2.5 py-0.5 rounded border border-blue-200">-</span>
</div>
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Kategori & Model</label>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Kategori Alat</label>
<div class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-bold flex items-center">
<span id="detailCategoryModel">-</span>
<span id="detailCategory">-</span>
</div>
</div>
</div>
@@ -589,89 +445,58 @@
</div>
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Nomor Polisi (Nopol)</label>
<div class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono font-bold flex items-center uppercase">
<span id="detailNopol">-</span>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Tipe / Model Khusus</label>
<div class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-medium flex items-center">
<span id="detailUnitType">-</span>
</div>
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3.5">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Tahun Produksi</label>
<div class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-medium flex items-center">
<span id="detailYear">-</span>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Nomor Model</label>
<div class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono flex items-center">
<span id="detailModelNumber">-</span>
</div>
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Lokasi Kerja</label>
<div class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-medium flex items-center">
<span id="detailLocation">-</span>
</div>
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Konsumsi BBM</label>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Konsumsi BBM Standar</label>
<div class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-medium flex items-center">
<span id="detailFuel">-</span>
</div>
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3.5">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Divisi & Kepemilikan</label>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Divisi Penanggung Jawab</label>
<div class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-medium flex items-center">
<span id="detailOwnerDiv">-</span>
<span id="detailDivision">-</span>
</div>
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Status Operasi</label>
<div class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white flex items-center">
<span id="detailStatusBadge" class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold bg-emerald-50 text-emerald-700 border border-emerald-200">
<span id="detailStatus">Operation</span>
</span>
</div>
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Odometer Saat Ini</label>
<div class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-blue-700 font-mono font-bold flex items-center">
<span id="detailKm">0 HM/KM</span>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Kepemilikan Aset</label>
<div class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-medium flex items-center">
<span id="detailOwnership">-</span>
</div>
</div>
</div>
<!-- Bagian Legalitas & Perizinan -->
<div class="p-4 rounded-2xl bg-slate-50 border border-slate-200 space-y-3">
<div class="flex items-center space-x-2 text-slate-800 font-bold text-xs">
<i class="fa-solid fa-file-contract text-emerald-600"></i>
<span>Dokumen Legalitas & Perizinan Kelayakan</span>
</div>
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3">
<div>
<span class="text-[11px] font-bold text-slate-700 block mb-1">Nomor Dokumen SILO</span>
<div class="text-xs px-3 py-2 rounded-xl border border-slate-200 bg-white font-mono font-semibold text-slate-800">
<span id="detailSilo">-</span>
</div>
</div>
<div>
<span class="text-[11px] font-bold text-slate-700 block mb-1">Nomor Dokumen KIR</span>
<div class="text-xs px-3 py-2 rounded-xl border border-slate-200 bg-white font-mono font-semibold text-slate-800">
<span id="detailKir">-</span>
</div>
</div>
<div>
<span class="text-[11px] font-bold text-slate-700 block mb-1">Nomor STNK</span>
<div class="text-xs px-3 py-2 rounded-xl border border-slate-200 bg-white font-mono font-semibold text-slate-800">
<span id="detailStnk">-</span>
</div>
</div>
<!-- Card Unit Fisik Terdaftar -->
<div class="p-4 rounded-2xl bg-emerald-50/70 border border-emerald-200/80 flex items-center justify-between">
<div>
<span class="text-xs font-bold text-emerald-950 block">Unit Fisik Terdaftar</span>
<span id="detailUnitCountText" class="text-xs text-emerald-800 font-medium">0 Unit Fisik</span>
</div>
<a id="detailManageUnitsBtn" href="#" class="px-4 py-2 rounded-xl bg-[#1b5e20] hover:bg-[#144919] text-white text-xs font-bold transition shadow-sm inline-flex items-center justify-center">
<span>Kelola Unit Fisik</span>
</a>
</div>
<!-- Footer Tombol Bersih Sesuai Referensi Tambah Aset -->
<div class="pt-4 flex items-center justify-end">
<!-- Footer Tombol Tutup -->
<div class="pt-2 flex items-center justify-end">
<button type="button" onclick="closeDetailModal()"
class="px-6 py-2.5 rounded-xl bg-slate-800 hover:bg-slate-900 text-white font-bold text-xs transition shadow-sm">
class="px-6 py-2.5 rounded-xl bg-slate-800 hover:bg-slate-900 text-white font-bold text-xs transition shadow-sm cursor-pointer">
Tutup
</button>
</div>
@@ -722,6 +547,95 @@
</div>
<script>
// =========================================================================
// REAL-TIME CLIENT-SIDE SEARCH
// =========================================================================
function escapeHtml(str) {
const div = document.createElement('div');
div.textContent = str;
return div.innerHTML;
}
document.addEventListener('DOMContentLoaded', function () {
const searchInput = document.getElementById('supportSearchInput');
const tableBody = document.getElementById('supportTableBody');
const resetWrapper = document.getElementById('supportResetWrapper');
const paginationContainer = document.getElementById('supportPaginationContainer');
const serverEmptyRow = document.getElementById('serverSupportEmptyRow');
const hasServerFilters = {{ request()->anyFilled(['status', 'unit_category']) ? 'true' : 'false' }};
if (searchInput && tableBody) {
searchInput.addEventListener('input', function (e) {
const rawValue = e.target.value;
const query = rawValue.toLowerCase().trim();
const rows = tableBody.querySelectorAll('tr.support-row');
let visibleCount = 0;
rows.forEach(row => {
const text = row.textContent.toLowerCase();
if (text.includes(query)) {
row.style.display = '';
visibleCount++;
} else {
row.style.display = 'none';
}
});
if (paginationContainer) {
paginationContainer.style.display = query.length > 0 ? 'none' : '';
}
const existingEmptyRow = document.getElementById('clientSupportEmptyRow');
if (existingEmptyRow) existingEmptyRow.remove();
if (serverEmptyRow) {
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
}
if (visibleCount === 0 && query.length > 0) {
const emptyTr = document.createElement('tr');
emptyTr.id = 'clientSupportEmptyRow';
emptyTr.innerHTML = `
<td colspan="8" 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">
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
</p>
<p class="text-xs text-slate-400 mt-1">
Pastikan kata kunci yang dicari sudah benar.
</p>
<div class="mt-4">
<button type="button"
onclick="const inp = document.getElementById('supportSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</button>
</div>
</td>
`;
tableBody.appendChild(emptyTr);
}
if (resetWrapper) {
let resetBtn = document.getElementById('supportResetBtn');
if (query.length > 0 || hasServerFilters) {
if (!resetBtn) {
resetBtn = document.createElement('a');
resetBtn.id = 'supportResetBtn';
resetBtn.href = "{{ route('qma.vehicles.support') }}";
resetBtn.className = 'text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1';
resetBtn.innerHTML = '<i class="fa-solid fa-rotate-left"></i><span>Reset</span>';
resetWrapper.appendChild(resetBtn);
}
} else if (!hasServerFilters && resetBtn) {
resetBtn.remove();
}
}
});
}
});
// Daftar semua kode kendaraan unit support yang sudah terdaftar di sistem
const existingVehicleCodes = @json($existingCodes ?? \App\Models\Vehicle::unitSupports()->pluck('code')->map(fn($c) => strtoupper(trim($c))));
@@ -878,16 +792,28 @@
document.getElementById('editBrandType').value = v.brand_type || '';
document.getElementById('editUnitType').value = v.unit_type || '';
document.getElementById('editModelNumber').value = v.model_number || '';
document.getElementById('editProductionYear').value = v.production_year || '';
document.getElementById('editLicensePlate').value = v.license_plate || '';
document.getElementById('editLocation').value = v.location || '';
document.getElementById('editDivision').value = v.division || '';
const divSelect = document.getElementById('editDivision');
if (divSelect) {
if (v.division) {
let found = false;
for (let i = 0; i < divSelect.options.length; i++) {
if (divSelect.options[i].value === v.division) {
found = true;
break;
}
}
if (!found) {
const newOpt = document.createElement('option');
newOpt.value = v.division;
newOpt.textContent = v.division;
divSelect.appendChild(newOpt);
}
divSelect.value = v.division;
} else {
divSelect.value = '';
}
}
document.getElementById('editOwnership').value = v.ownership || '';
document.getElementById('editStatus').value = v.status || 'Operation';
document.getElementById('editCurrentKm').value = v.current_km || 0;
document.getElementById('editSiloDocument').value = v.silo_document || '';
document.getElementById('editKirDocument').value = v.kir_document || '';
document.getElementById('editStnkDocument').value = v.stnk_document || '';
document.getElementById('editFuelConsumption').value = v.fuel_consumption || '';
}
function closeEditModal() {
@@ -898,31 +824,19 @@
function openDetailModal(v) {
document.getElementById('detailVehicleModal').classList.remove('hidden');
document.getElementById('detailCode').innerText = v.code || '-';
document.getElementById('detailCategory').innerText = v.unit_category || '-';
document.getElementById('detailBrand').innerText = v.brand_type || '-';
document.getElementById('detailCategoryModel').innerText = (v.unit_category || '-') + (v.model_number ? ` (${v.model_number})` : '');
document.getElementById('detailStatus').innerText = v.status || '-';
document.getElementById('detailLocation').innerText = v.location || '-';
document.getElementById('detailKm').innerText = Number(v.current_km || 0).toLocaleString('id-ID') + ' HM/KM';
document.getElementById('detailYear').innerText = v.production_year || '-';
document.getElementById('detailUnitType').innerText = v.unit_type || '-';
document.getElementById('detailModelNumber').innerText = v.model_number || '-';
document.getElementById('detailFuel').innerText = v.fuel_consumption ? `${v.fuel_consumption} L/Jam` : '-';
document.getElementById('detailOwnerDiv').innerText = (v.division || '-') + ' / ' + (v.ownership || '-');
document.getElementById('detailSilo').innerText = v.silo_document || '-';
document.getElementById('detailKir').innerText = v.kir_document || '-';
document.getElementById('detailStnk').innerText = v.stnk_document || '-';
document.getElementById('detailNopol').innerText = v.license_plate || '-';
document.getElementById('detailDivision').innerText = v.division || '-';
document.getElementById('detailOwnership').innerText = v.ownership || 'PT Kerinci Merangin Hidro';
const badge = document.getElementById('detailStatusBadge');
if (badge) {
badge.className = 'inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold border ';
if (v.status === 'Operation') {
badge.className += 'bg-emerald-50 text-emerald-700 border-emerald-200';
} else if (v.status === 'Standby') {
badge.className += 'bg-amber-50 text-amber-700 border-amber-200';
} else if (v.status === 'Breakdown') {
badge.className += 'bg-rose-50 text-rose-700 border-rose-200';
} else {
badge.className += 'bg-slate-100 text-slate-700 border-slate-200';
}
const count = v.units_count !== undefined ? v.units_count : 0;
document.getElementById('detailUnitCountText').innerText = count + ' Unit Fisik';
const manageBtn = document.getElementById('detailManageUnitsBtn');
if (manageBtn) {
manageBtn.href = `/qma/vehicles/unit-support/${v.id}/units`;
}
}
function closeDetailModal() {
@@ -0,0 +1,829 @@
@extends('layouts.app')
@section('title', 'Unit Fisik ' . $category->code . ' - Admin QMA | PT Kerinci Merangin Hidro')
@section('content')
<div class="w-full space-y-6">
<!-- Header Judul & Tombol Aksi (Pola justify-between antara judul kiri & grup tombol kanan) -->
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4">
<div>
<div class="flex items-center space-x-2 mb-1">
<span class="text-xs font-bold uppercase tracking-wider text-[#1b5e20]">
MANAJEMEN UNIT FISIK
</span>
</div>
<h2 class="text-2xl sm:text-3xl font-extrabold text-slate-900 tracking-tight">
{{ $category->unit_category ?? 'Alat Berat' }}
</h2>
<p class="text-xs text-slate-500 mt-1">
{{ $category->brand_type }}{{ $category->model_number ? ' • Model: ' . $category->model_number : '' }}
</p>
</div>
<!-- Tombol Aksi Kanan -->
<div class="grid grid-cols-2 gap-2.5 w-full sm:flex sm:items-center sm:gap-3 sm:w-auto">
<a href="{{ route('qma.vehicles.support') }}"
class="w-full sm:w-auto flex items-center justify-center space-x-2 text-xs font-bold text-slate-700 hover:text-slate-900 bg-white border border-gray-200 rounded-xl px-4 py-2.5 shadow-sm transition hover:bg-gray-50 cursor-pointer">
<i class="fa-solid fa-arrow-left text-xs text-slate-500"></i>
<span>Kembali</span>
</a>
<button onclick="openAddUnitModal()"
class="w-full sm:w-auto flex items-center justify-center space-x-2 bg-[#1b5e20] hover:bg-[#144919] text-white px-4 py-2.5 rounded-xl text-xs font-bold transition shadow-sm cursor-pointer">
<i class="fa-solid fa-plus text-xs"></i>
<span>Tambah Unit Baru</span>
</button>
</div>
</div>
{{-- Alert Error / Validasi Form (Pesan sukses telah ditangani oleh Toast Notification global di layout) --}}
@if(session('error'))
<div class="p-3.5 bg-rose-50 border border-rose-200 text-rose-800 rounded-xl text-xs flex items-center space-x-2">
<i class="fa-solid fa-circle-exclamation text-rose-600"></i>
<span class="font-semibold">{{ session('error') }}</span>
</div>
@endif
@if($errors->any())
<div class="p-3.5 bg-rose-50 border border-rose-200 text-rose-800 rounded-xl text-xs">
<div class="font-bold mb-1 flex items-center space-x-1">
<i class="fa-solid fa-triangle-exclamation"></i>
<span>Gagal memproses data:</span>
</div>
<ul class="list-disc pl-5 space-y-0.5">
@foreach($errors->all() as $err)
<li>{{ $err }}</li>
@endforeach
</ul>
</div>
@endif
<!-- Kotak Pencarian & Filter Status Unit Fisik -->
<div class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
<form method="GET" action="{{ route('qma.vehicles.support.units', $category->id) }}" class="relative w-full max-w-sm sm:max-w-md">
@if(request('status'))
<input type="hidden" name="status" value="{{ request('status') }}">
@endif
<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>
</span>
<input type="text"
id="unitSearchInput"
name="search"
value="{{ request('search') }}"
placeholder="Cari kode unit fisik, lokasi, SILO..."
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">
</form>
<div class="flex flex-wrap items-center gap-2">
<!-- Filter Status Dropdown -->
<form method="GET" action="{{ route('qma.vehicles.support.units', $category->id) }}" class="flex items-center space-x-2">
@if(request('search'))
<input type="hidden" name="search" value="{{ request('search') }}">
@endif
<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] shadow-sm cursor-pointer">
<option value="">Semua Status</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>
<option value="Maintenance" {{ request('status') === 'Maintenance' ? 'selected' : '' }}>Maintenance</option>
</select>
</form>
<div id="unitResetWrapper" class="flex items-center">
@if(request('search') || request('status'))
<a id="unitResetBtn" href="{{ route('qma.vehicles.support.units', $category->id) }}" 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 text-[11px]"></i>
<span>Reset Filter</span>
</a>
@endif
</div>
</div>
</div>
<!-- Tabel Data Unit Fisik (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">
<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 UNIT</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 text-center">NO. POLISI</th>
<th class="py-3.5 px-4">LOKASI KERJA</th>
<th class="py-3.5 px-4 text-right">ODOMETER (HM/KM)</th>
<th class="py-3.5 px-4 text-center">DOKUMEN IZIN</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 id="unitsTableBody" class="divide-y divide-slate-100 text-slate-700 bg-white">
@forelse($units as $index => $u)
<tr class="unit-row hover:bg-slate-50/70 transition">
<td class="py-3.5 px-4 text-center font-medium text-slate-400">
{{ $units->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-lg border border-blue-200 font-bold">
{{ $u->code }}
</span>
</td>
<td class="py-3.5 px-4 font-mono text-xs text-slate-700 whitespace-nowrap">
@if($u->serial_number)
<span class="font-semibold">{{ $u->serial_number }}</span>
@else
<span class="text-slate-300">-</span>
@endif
</td>
<td class="py-3.5 px-4 text-center text-xs text-slate-700 font-medium whitespace-nowrap">
@if($u->production_year)
<span>{{ $u->production_year }}</span>
@else
<span class="text-slate-300">-</span>
@endif
</td>
<td class="py-3.5 px-4 text-center font-mono text-xs whitespace-nowrap">
@if($u->license_plate)
<span class="bg-slate-100 text-slate-800 px-2 py-0.5 rounded border border-slate-200 font-semibold">{{ $u->license_plate }}</span>
@else
<span class="text-slate-300 font-sans font-normal">-</span>
@endif
</td>
<td class="py-3.5 px-4 text-slate-600">
<div class="font-medium text-slate-800">
@if($u->location)
<i class="fa-solid fa-location-dot text-[9px] mr-1 text-rose-500"></i>{{ $u->location }}
@else
<span class="text-slate-400 italic">Belum ditentukan</span>
@endif
</div>
</td>
<td class="py-3.5 px-4 text-right font-mono font-bold text-slate-800 whitespace-nowrap">
{{ number_format($u->current_km, 0, ',', '.') }}
<span class="text-[10px] text-slate-400 font-sans font-normal">HM/KM</span>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
<div class="flex flex-col items-center space-y-1">
@if($u->silo_document)
<span class="inline-flex items-center px-2.5 py-0.5 rounded text-[10px] font-semibold bg-emerald-50 text-emerald-800 border border-emerald-200" title="SILO: {{ $u->silo_document }}">
<i class="fa-solid fa-certificate mr-1 text-[9px] text-emerald-600"></i> SILO Ada
</span>
@else
<span class="text-[10px] text-slate-400 italic">Tanpa SILO</span>
@endif
@if($u->kir_document)
<span class="inline-flex items-center px-1.5 py-0.2 rounded text-[9px] font-mono bg-slate-100 text-slate-600 border border-slate-200">
KIR: {{ $u->kir_document }}
</span>
@endif
</div>
</td>
<td class="py-3.5 px-4 text-center whitespace-nowrap">
@if($u->status === 'Operation')
<span class="inline-flex items-center px-2.5 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.5 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.5 py-0.5 rounded-full text-[10px] font-bold bg-rose-50 text-rose-700 border border-rose-200">
Breakdown
</span>
@elseif($u->status === 'Maintenance')
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-[10px] font-bold bg-blue-50 text-blue-700 border border-blue-200">
Maintenance
</span>
@else
<span class="inline-flex items-center px-2.5 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">
<a href="{{ route('p2h.form', ['code' => $u->code]) }}"
target="_blank"
class="inline-flex items-center space-x-1 text-[#1b5e20] hover:text-[#144918] hover:bg-emerald-50 px-2 py-1 rounded-lg transition"
title="Buka Form P2H Unit Ini">
<i class="fa-solid fa-file-pen text-sm"></i>
</a>
<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>
<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>
<button type="button"
onclick="openDeleteModal('{{ $u->id }}', '{{ $u->code }}')"
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 Fisik">
<i class="fa-regular fa-trash-can text-sm"></i>
</button>
</div>
</td>
</tr>
@empty
<tr id="serverUnitEmptyRow">
<td colspan="10" class="py-12 px-4 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">
Data "<span class="text-rose-600 font-bold">{{ request('search') }}</span>" tidak ditemukan di tabel
</p>
<p class="text-xs text-slate-400 mt-1">
Pastikan kata kunci yang dicari sudah benar.
</p>
<div class="mt-4">
<a href="{{ route('qma.vehicles.support.units', array_merge(['id' => $category->id], request()->except('search', 'page'))) }}" class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</a>
</div>
@else
<div class="flex flex-col items-center justify-center">
<div class="w-12 h-12 rounded-full bg-slate-100 flex items-center justify-center text-slate-400 mb-3">
<i class="fa-solid fa-cubes text-xl"></i>
</div>
<p class="font-semibold text-slate-700 text-sm">Belum ada unit fisik untuk kategori ini</p>
<p class="text-xs text-slate-400 mt-1 max-w-sm">
Kategori ini belum memiliki armada fisik terdaftar. Silakan klik tombol di bawah untuk menambahkan unit fisik pertama.
</p>
<button onclick="openAddUnitModal()" class="mt-4 bg-[#1b5e20] hover:bg-[#144919] text-white px-4 py-2 rounded-xl text-xs font-bold transition inline-flex items-center space-x-2">
<i class="fa-solid fa-plus text-xs"></i>
<span>Tambah Unit Baru</span>
</button>
</div>
@endif
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div id="unitsPaginationContainer">
@if($units->hasPages())
<div class="px-6 py-4 border-t border-slate-200">
{{ $units->links() }}
</div>
@endif
</div>
</div>
</div>
<!-- Modal Tambah Unit Baru (Sesuai Referensi Gambar media_1792028135493_30b2da2e.png) -->
<div id="addUnitModal" class="fixed inset-0 z-50 hidden overflow-y-auto" aria-labelledby="modal-title" role="dialog" aria-modal="true">
<div class="flex items-center justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 transition-opacity bg-slate-900/60 backdrop-blur-xs" aria-hidden="true" onclick="closeAddUnitModal()"></div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
<div class="inline-block align-bottom bg-white rounded-2xl text-left overflow-hidden shadow-2xl transform transition-all sm:my-8 sm:align-middle sm:max-w-md sm:w-full border border-slate-200">
<div class="p-6">
<!-- Judul Modal -->
<h3 class="text-xl font-extrabold text-slate-900 tracking-tight mb-5" id="modal-title">
Tambah Unit Baru
</h3>
<form method="POST" action="{{ route('qma.vehicles.support.units.store', $category->id) }}" id="addUnitForm" class="space-y-4">
@csrf
<!-- Aset Induk (Readonly) Sesuai Mockup -->
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Aset Induk
</label>
<input type="text"
readonly
value="{{ $category->code }} - {{ $category->brand_type ?? $category->unit_category }}"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-slate-50 text-slate-600 font-medium focus:outline-none cursor-not-allowed">
</div>
<!-- Kode Unit * (Prefix Box + Input Urut Hijau Border Sesuai Mockup) -->
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Kode Unit <span class="text-rose-500">*</span>
</label>
<div class="flex rounded-xl overflow-hidden border-2 border-emerald-700 focus-within:ring-2 focus-within:ring-emerald-600/20 transition shadow-2xs">
<span class="inline-flex items-center px-3.5 py-2 bg-slate-100 text-slate-700 text-xs font-bold font-mono border-r border-slate-200 select-none">
{{ $category->code }}-
</span>
<input type="text"
name="unit_number"
id="unitNumberInput"
required
value="{{ $nextUnitNumber }}"
placeholder="Contoh: 001"
class="w-full text-xs px-3.5 py-2.5 bg-white text-slate-900 font-mono font-bold placeholder-slate-400 focus:outline-none">
</div>
<p class="text-[10px] text-slate-400 mt-1">
Kode lengkap: <span id="fullCodePreview" class="font-mono font-bold text-slate-700">{{ $nextUnitCode }}</span>
</p>
</div>
<!-- Nomor Seri / Rangka & Nomor Polisi / Plat -->
<div class="grid grid-cols-2 gap-3">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
No. Seri / Rangka
</label>
<input type="text"
name="serial_number"
placeholder="Contoh: VIN/SN12345"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono focus:outline-none focus:border-emerald-600">
</div>
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Nomor Polisi / Plat
</label>
<input type="text"
name="license_plate"
placeholder="Contoh: BH 1234 XX"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono uppercase focus:outline-none focus:border-emerald-600">
</div>
</div>
<!-- Tahun Produksi & Status Operasi Awal -->
<div class="grid grid-cols-2 gap-3">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Tahun Produksi
</label>
<input type="number"
name="production_year"
min="1980"
max="{{ date('Y') + 1 }}"
placeholder="Contoh: 2021"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-emerald-600">
</div>
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Status Operasional <span class="text-rose-500">*</span>
</label>
<select name="status" required class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-emerald-600">
<option value="Operation" selected>Operation (Siap Operasi)</option>
<option value="Standby">Standby (Tersedia)</option>
<option value="Breakdown">Breakdown (Rusak)</option>
<option value="Maintenance">Maintenance (Perawatan)</option>
</select>
</div>
</div>
<!-- Odometer Awal (HM/KM) -->
<div class="grid grid-cols-2 gap-3">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Odometer Awal (HM/KM)
</label>
<input type="number"
name="current_km"
step="0.01"
min="0"
value="0"
placeholder="0"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-emerald-600 font-mono">
</div>
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Lokasi Penempatan
</label>
<select name="location"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 font-medium focus:outline-none focus:border-emerald-600">
<option value="" disabled {{ empty($category->location) ? 'selected' : '' }}>-- Pilih Lokasi Penempatan --</option>
@foreach($masterLocations as $loc)
<option value="{{ $loc }}" {{ (old('location') ?? $category->location) === $loc ? 'selected' : '' }}>
{{ $loc }}
</option>
@endforeach
</select>
</div>
</div>
<!-- Dokumen SILO & KIR -->
<div class="grid grid-cols-2 gap-3">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
No Dokumen SILO
</label>
<input type="text"
name="silo_document"
placeholder="Nomor SILO (opsional)"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-emerald-600">
</div>
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">
No Dokumen KIR
</label>
<input type="text"
name="kir_document"
placeholder="Nomor KIR (opsional)"
class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-emerald-600">
</div>
</div>
<!-- Tombol Aksi Batal & Simpan Unit (Sesuai Desain Mockup) -->
<div class="pt-4 flex items-center justify-end space-x-3">
<button type="button"
onclick="closeAddUnitModal()"
class="px-5 py-2.5 text-xs font-bold text-slate-700 bg-white border border-slate-300 rounded-xl hover:bg-slate-50 transition cursor-pointer">
Batal
</button>
<button type="submit"
class="px-5 py-2.5 text-xs font-bold text-white bg-[#1b5e20] hover:bg-[#144919] rounded-xl transition shadow-sm cursor-pointer">
Simpan Unit
</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Modal Edit Data Unit Fisik -->
<div id="editModal" class="fixed inset-0 z-50 hidden overflow-y-auto" role="dialog" aria-modal="true">
<div class="flex items-center justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 transition-opacity bg-slate-900/60 backdrop-blur-xs" onclick="closeEditModal()"></div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen">&#8203;</span>
<div class="inline-block align-bottom bg-white rounded-2xl text-left overflow-hidden shadow-2xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full border border-slate-200">
<div class="p-6">
<h3 class="text-xl font-extrabold text-slate-900 tracking-tight mb-5">
Edit Data Unit Fisik
</h3>
<form id="editUnitForm" method="POST" action="" class="space-y-4">
@csrf
<input type="hidden" name="category" value="unit_support">
<input type="hidden" name="brand_type" id="edit_brand_type">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">Kode Unit <span class="text-rose-500">*</span></label>
<input type="text" name="code" id="edit_code" required class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-slate-100 text-slate-700 font-mono font-bold focus:outline-none" readonly>
</div>
<!-- Nomor Seri / Rangka & Nomor Polisi / Plat -->
<div class="grid grid-cols-2 gap-3">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">No. Seri / Rangka</label>
<input type="text" name="serial_number" id="edit_serial_number" placeholder="Contoh: VIN/SN12345" class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono focus:outline-none focus:border-emerald-600">
</div>
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">Nomor Polisi / Plat</label>
<input type="text" name="license_plate" id="edit_license_plate" placeholder="Contoh: BH 1234 XX" class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono uppercase focus:outline-none focus:border-emerald-600">
</div>
</div>
<!-- Tahun Produksi & Status Operasi -->
<div class="grid grid-cols-2 gap-3">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">Tahun Produksi</label>
<input type="number" name="production_year" id="edit_production_year" min="1980" max="{{ date('Y') + 1 }}" placeholder="Contoh: 2021" class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-emerald-600">
</div>
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">Status Operasi <span class="text-rose-500">*</span></label>
<select name="status" id="edit_status" required class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white font-semibold text-slate-800 focus:outline-none focus:border-emerald-600">
<option value="Operation">Operation</option>
<option value="Standby">Standby</option>
<option value="Breakdown">Breakdown</option>
<option value="Maintenance">Maintenance</option>
</select>
</div>
</div>
<div class="grid grid-cols-2 gap-3">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">Odometer (HM/KM) <span class="text-rose-500">*</span></label>
<input type="number" step="0.01" name="current_km" id="edit_current_km" required class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono focus:outline-none focus:border-emerald-600">
</div>
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">Lokasi Penempatan</label>
<select name="location" id="edit_location" class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 font-medium focus:outline-none focus:border-emerald-600">
<option value="">-- Pilih Lokasi Penempatan --</option>
@foreach($masterLocations as $loc)
<option value="{{ $loc }}">{{ $loc }}</option>
@endforeach
</select>
</div>
</div>
<div class="grid grid-cols-2 gap-3">
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">Dokumen SILO</label>
<input type="text" name="silo_document" id="edit_silo" class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-emerald-600">
</div>
<div>
<label class="block text-xs font-bold text-slate-700 mb-1.5">Dokumen KIR</label>
<input type="text" name="kir_document" id="edit_kir" class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-emerald-600">
</div>
</div>
<div class="pt-4 flex items-center justify-end space-x-3">
<button type="button" onclick="closeEditModal()" class="px-5 py-2.5 text-xs font-bold text-slate-700 bg-white border border-slate-300 rounded-xl hover:bg-slate-50 transition cursor-pointer">Batal</button>
<button type="submit" class="px-5 py-2.5 text-xs font-bold text-white bg-[#1b5e20] hover:bg-[#144919] rounded-xl transition shadow-sm cursor-pointer">Simpan Perubahan</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Modal Detail Unit Fisik -->
<div id="detailModal" class="fixed inset-0 z-50 hidden overflow-y-auto" role="dialog" aria-modal="true">
<div class="flex items-center justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 transition-opacity bg-slate-900/60 backdrop-blur-xs" onclick="closeDetailModal()"></div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen">&#8203;</span>
<div class="inline-block align-bottom bg-white rounded-2xl text-left overflow-hidden shadow-2xl transform transition-all sm:my-8 sm:align-middle sm:max-w-md sm:w-full border border-slate-200">
<div class="p-6">
<div class="flex items-center justify-between pb-3 border-b border-slate-100">
<div>
<span class="text-[10px] font-bold uppercase tracking-wider text-slate-400">DETAIL UNIT FISIK</span>
<h3 class="text-xl font-extrabold text-slate-900" id="detail_code">-</h3>
</div>
<button onclick="closeDetailModal()" class="text-slate-400 hover:text-slate-600">
<i class="fa-solid fa-xmark text-lg"></i>
</button>
</div>
<div class="py-4 space-y-3 text-xs">
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span class="text-slate-400">Kategori Induk:</span>
<span class="font-bold text-slate-800">{{ $category->code }} - {{ $category->unit_category }}</span>
</div>
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span class="text-slate-400">Merek & Tipe:</span>
<span class="font-semibold text-slate-800">{{ $category->brand_type }}</span>
</div>
@if($category->model_number)
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span class="text-slate-400">Nomor Model:</span>
<span class="font-mono font-medium text-slate-800">{{ $category->model_number }}</span>
</div>
@endif
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span class="text-slate-400">No. Seri / Rangka:</span>
<span id="detail_serial_number" class="font-mono font-medium text-slate-800">-</span>
</div>
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span class="text-slate-400">Nomor Polisi / Plat:</span>
<span id="detail_plate" class="font-mono font-medium text-slate-800">-</span>
</div>
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span class="text-slate-400">Tahun Produksi:</span>
<span id="detail_year" class="font-medium text-slate-800">-</span>
</div>
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span class="text-slate-400">Status Operasi:</span>
<span id="detail_status" class="font-bold">-</span>
</div>
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span class="text-slate-400">Odometer:</span>
<span id="detail_km" class="font-mono font-bold text-slate-800">-</span>
</div>
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span class="text-slate-400">Lokasi Kerja:</span>
<span id="detail_location" class="font-medium text-slate-800">-</span>
</div>
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span class="text-slate-400">Dokumen SILO:</span>
<span id="detail_silo" class="font-medium text-slate-800">-</span>
</div>
<div class="flex justify-between py-1.5 border-b border-slate-50">
<span class="text-slate-400">Dokumen KIR:</span>
<span id="detail_kir" class="font-medium text-slate-800">-</span>
</div>
</div>
<div class="pt-3 border-t border-slate-100 flex justify-end">
<button onclick="closeDetailModal()" class="px-5 py-2 text-xs font-bold text-slate-700 bg-slate-100 hover:bg-slate-200 rounded-xl transition">Tutup</button>
</div>
</div>
</div>
</div>
</div>
<!-- Modal Hapus Unit Fisik -->
<div id="deleteModal" class="fixed inset-0 z-50 hidden overflow-y-auto" role="dialog" aria-modal="true">
<div class="flex items-center justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 transition-opacity bg-slate-900/60 backdrop-blur-xs" onclick="closeDeleteModal()"></div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen">&#8203;</span>
<div class="inline-block align-bottom bg-white rounded-2xl text-left overflow-hidden shadow-2xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full border border-slate-200">
<div class="p-6 text-center">
<div class="w-12 h-12 rounded-full bg-rose-100 text-rose-600 flex items-center justify-center mx-auto mb-4">
<i class="fa-solid fa-triangle-exclamation text-xl"></i>
</div>
<h3 class="text-lg font-bold text-slate-900 mb-2">Hapus Unit Fisik?</h3>
<p class="text-xs text-slate-500 mb-6">
Apakah Anda yakin ingin menghapus unit <span id="deleteUnitCode" class="font-mono font-bold text-slate-800"></span>? Data yang sudah dihapus tidak dapat dipulihkan.
</p>
<form id="deleteForm" method="POST" action="">
@csrf
@method('DELETE')
<div class="flex items-center justify-center space-x-3">
<button type="button" onclick="closeDeleteModal()" class="px-5 py-2 text-xs font-bold text-slate-700 bg-white border border-slate-300 rounded-xl hover:bg-slate-50 transition cursor-pointer">Batal</button>
<button type="submit" class="px-5 py-2 text-xs font-bold text-white bg-rose-600 hover:bg-rose-700 rounded-xl transition shadow-sm cursor-pointer">Ya, Hapus Unit</button>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
const categoryCode = "{{ $category->code }}";
function openAddUnitModal() {
document.getElementById('addUnitModal').classList.remove('hidden');
document.getElementById('unitNumberInput').focus();
}
function closeAddUnitModal() {
document.getElementById('addUnitModal').classList.add('hidden');
}
// Live preview kode lengkap
document.getElementById('unitNumberInput')?.addEventListener('input', function(e) {
let val = e.target.value.trim();
if (val) {
document.getElementById('fullCodePreview').textContent = categoryCode + '-' + val;
} else {
document.getElementById('fullCodePreview').textContent = '-';
}
});
function openEditModal(unit) {
const form = document.getElementById('editUnitForm');
form.action = "{{ url('qma/vehicles') }}/" + unit.id;
document.getElementById('edit_code').value = unit.code;
document.getElementById('edit_brand_type').value = unit.brand_type || "{{ $category->brand_type }}";
document.getElementById('edit_serial_number').value = unit.serial_number || '';
document.getElementById('edit_license_plate').value = unit.license_plate || '';
document.getElementById('edit_production_year').value = unit.production_year || '';
document.getElementById('edit_status').value = unit.status || 'Operation';
document.getElementById('edit_current_km').value = unit.current_km || 0;
const locSelect = document.getElementById('edit_location');
if (locSelect) {
if (unit.location) {
let found = Array.from(locSelect.options).some(opt => opt.value === unit.location);
if (!found) {
const newOpt = document.createElement('option');
newOpt.value = unit.location;
newOpt.textContent = unit.location;
locSelect.appendChild(newOpt);
}
locSelect.value = unit.location;
} else {
locSelect.value = '';
}
}
document.getElementById('edit_silo').value = unit.silo_document || '';
document.getElementById('edit_kir').value = unit.kir_document || '';
document.getElementById('editModal').classList.remove('hidden');
}
function closeEditModal() {
document.getElementById('editModal').classList.add('hidden');
}
function openDetailModal(unit) {
document.getElementById('detail_code').textContent = unit.code;
document.getElementById('detail_serial_number').textContent = unit.serial_number || 'Tidak ada';
document.getElementById('detail_plate').textContent = unit.license_plate || 'Tidak ada';
document.getElementById('detail_year').textContent = unit.production_year || 'Tidak ada';
document.getElementById('detail_status').textContent = unit.status;
document.getElementById('detail_km').textContent = Number(unit.current_km).toLocaleString('id-ID') + ' HM/KM';
document.getElementById('detail_location').textContent = unit.location || '-';
document.getElementById('detail_silo').textContent = unit.silo_document || 'Tidak ada';
document.getElementById('detail_kir').textContent = unit.kir_document || 'Tidak ada';
document.getElementById('detailModal').classList.remove('hidden');
}
function closeDetailModal() {
document.getElementById('detailModal').classList.add('hidden');
}
function openDeleteModal(id, code) {
const form = document.getElementById('deleteForm');
form.action = "{{ url('qma/vehicles') }}/" + id;
document.getElementById('deleteUnitCode').textContent = code;
document.getElementById('deleteModal').classList.remove('hidden');
}
function closeDeleteModal() {
document.getElementById('deleteModal').classList.add('hidden');
}
// =========================================================================
// REAL-TIME CLIENT-SIDE SEARCH WITH MULTI-FIELD MATCHING & EMPTY STATE
// =========================================================================
function escapeHtml(str) {
const div = document.createElement('div');
div.textContent = str;
return div.innerHTML;
}
document.addEventListener('DOMContentLoaded', function () {
const searchInput = document.getElementById('unitSearchInput');
const tableBody = document.getElementById('unitsTableBody');
const resetWrapper = document.getElementById('unitResetWrapper');
const paginationContainer = document.getElementById('unitsPaginationContainer');
const serverEmptyRow = document.getElementById('serverUnitEmptyRow');
const hasServerFilters = {{ request()->anyFilled(['status']) ? 'true' : 'false' }};
if (searchInput && tableBody) {
searchInput.addEventListener('input', function (e) {
const rawValue = e.target.value;
const query = rawValue.toLowerCase().trim();
const rows = tableBody.querySelectorAll('tr.unit-row');
let visibleCount = 0;
rows.forEach(row => {
const text = row.textContent.toLowerCase();
if (text.includes(query)) {
row.style.display = '';
visibleCount++;
} else {
row.style.display = 'none';
}
});
if (paginationContainer) {
paginationContainer.style.display = query.length > 0 ? 'none' : '';
}
const existingEmptyRow = document.getElementById('clientUnitEmptyRow');
if (existingEmptyRow) existingEmptyRow.remove();
if (serverEmptyRow) {
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
}
if (visibleCount === 0 && query.length > 0) {
const emptyTr = document.createElement('tr');
emptyTr.id = 'clientUnitEmptyRow';
emptyTr.innerHTML = `
<td colspan="10" 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">
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
</p>
<p class="text-xs text-slate-400 mt-1">
Pastikan kata kunci yang dicari sudah benar.
</p>
<div class="mt-4">
<button type="button"
onclick="const inp = document.getElementById('unitSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
<i class="fa-solid fa-rotate-left text-[11px]"></i>
<span>Hapus Pencarian</span>
</button>
</div>
</td>
`;
tableBody.appendChild(emptyTr);
}
if (resetWrapper) {
let resetBtn = document.getElementById('unitResetBtn');
if (query.length > 0 || hasServerFilters) {
if (!resetBtn) {
resetBtn = document.createElement('a');
resetBtn.id = 'unitResetBtn';
resetBtn.href = "{{ route('qma.vehicles.support.units', $category->id) }}";
resetBtn.className = 'text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1';
resetBtn.innerHTML = '<i class="fa-solid fa-rotate-left text-[11px]"></i><span>Reset Filter</span>';
resetWrapper.appendChild(resetBtn);
}
} else if (!hasServerFilters && resetBtn) {
resetBtn.remove();
}
}
});
// Trigger saat awal memuat halaman jika ada nilai pencarian dari SSR
if (searchInput.value.trim() !== '') {
searchInput.dispatchEvent(new Event('input'));
}
}
});
</script>
@endsection
@@ -0,0 +1,39 @@
@extends('layouts.app')
@section('title', 'Dashboard Admin - Super Admin | PT Kerinci Merangin Hidro')
@section('content')
<div class="w-full space-y-6">
<!-- Header Judul Halaman -->
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4">
<div>
<h2 class="text-3xl sm:text-4xl font-extrabold text-slate-900 tracking-tight">
Dashboard Admin
</h2>
<p class="text-xs sm:text-sm text-slate-500 mt-1">
Pusat ikhtisar operasional dan analitik sistem terintegrasi PT Kerinci Merangin Hidro.
</p>
</div>
</div>
<!-- Konten Dashboard Kosong (Placeholder Persiapan Awal) -->
<div class="bg-white rounded-2xl border border-slate-200/80 p-12 sm:p-16 text-center shadow-xs">
<div class="w-16 h-16 mx-auto rounded-2xl bg-slate-100 text-slate-400 flex items-center justify-center text-2xl mb-4">
<i class="fa-solid fa-chart-pie"></i>
</div>
<h3 class="text-base sm:text-lg font-bold text-slate-800">
Halaman Dashboard Sedang Disiapkan
</h3>
<p class="text-xs sm:text-sm text-slate-400 max-w-md mx-auto mt-1 mb-6">
Komponen analitik, grafik metrik aktivitas, dan rekapitulasi data sistem saat ini masih dalam tahap perancangan awal.
</p>
<a href="{{ route('superadmin.roles.index') }}"
class="inline-flex items-center space-x-2 px-4 py-2.5 rounded-xl bg-[#1b5e20] hover:bg-[#144919] text-white text-xs font-bold transition shadow-sm">
<i class="fa-solid fa-users-gear text-xs"></i>
<span>Buka Manajemen Role</span>
</a>
</div>
</div>
@endsection
File diff suppressed because it is too large Load Diff