feat: display employee and LV photos on gate inspection and pass cards

This commit is contained in:
Ray1111-aa
2026-10-20 19:31:16 +07:00
parent cd3ce0c191
commit 21452b62f3
7 changed files with 271 additions and 37 deletions
@@ -92,6 +92,42 @@
</div>
</div>
{{-- Visual Foto Mobil LV & Foto Driver --}}
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<!-- Foto Unit Kendaraan (LV) -->
<div class="flex items-center space-x-3 bg-white/95 p-3 rounded-xl border border-amber-200/80 shadow-2xs">
@if($pendingActivity->vehicle && $pendingActivity->vehicle->photo_url)
<img src="{{ $pendingActivity->vehicle->photo_url }}" alt="{{ $pendingActivity->vehicle->brand_type }}" class="w-14 h-14 rounded-xl object-cover ring-2 ring-blue-500/20 shadow-2xs flex-shrink-0">
@else
<div class="w-14 h-14 rounded-xl bg-blue-50 text-blue-700 flex items-center justify-center text-xl flex-shrink-0 ring-1 ring-blue-200">
<i class="fa-solid fa-car"></i>
</div>
@endif
<div class="min-w-0">
<span class="text-[10px] font-bold uppercase tracking-wider text-slate-400 block">Unit Kendaraan:</span>
<p class="text-xs font-black text-slate-900 truncate">{{ $pendingActivity->vehicle->brand_type }}</p>
<p class="text-[11px] font-mono font-bold text-amber-800">{{ $pendingActivity->vehicle->code }} &bull; {{ $pendingActivity->vehicle->license_plate ?? 'Tanpa Plat' }}</p>
</div>
</div>
<!-- Foto Pengemudi / Driver -->
<div class="flex items-center space-x-3 bg-white/95 p-3 rounded-xl border border-amber-200/80 shadow-2xs">
@php $driverPhoto = $pendingActivity->driver?->photo_url ?: auth()->user()->photo_url; @endphp
@if($driverPhoto)
<img src="{{ $driverPhoto }}" alt="{{ $pendingActivity->driver->name }}" class="w-14 h-14 rounded-xl object-cover ring-2 ring-emerald-500/20 shadow-2xs flex-shrink-0">
@else
<div class="w-14 h-14 rounded-xl bg-emerald-50 text-[#1b5e20] flex items-center justify-center text-lg font-black flex-shrink-0 ring-1 ring-emerald-200">
{{ strtoupper(substr($pendingActivity->driver->name ?? 'D', 0, 1)) }}
</div>
@endif
<div class="min-w-0">
<span class="text-[10px] font-bold uppercase tracking-wider text-slate-400 block">Driver Terverifikasi:</span>
<p class="text-xs font-black text-slate-900 truncate">{{ $pendingActivity->driver->name }}</p>
<p class="text-[11px] text-slate-500 truncate">NIK: {{ $pendingActivity->driver->nik ?? '-' }} &bull; {{ $pendingActivity->driver->division ?? 'Operasional' }}</p>
</div>
</div>
</div>
{{-- Grid Rincian Tiket --}}
<div class="grid grid-cols-2 sm:grid-cols-4 gap-3 bg-white/90 p-4 rounded-xl border border-amber-200/70 text-xs shadow-xs">
<div>
+8 -4
View File
@@ -88,10 +88,14 @@
@forelse($recentActivities as $act)
<div class="flex items-start justify-between py-2.5 border-b border-slate-50 last:border-b-0">
<div class="flex items-start space-x-3.5 min-w-0">
<!-- Avatar Inisial Bulat Hijau Pastel -->
<div class="w-9 h-9 rounded-full bg-[#eef7ee] text-[#1b5e20] font-bold text-xs flex items-center justify-center flex-shrink-0 mt-0.5">
{{ strtoupper(substr($act->driver->name ?? 'G', 0, 1)) }}
</div>
<!-- Avatar Profil Driver / Inisial Bulat Hijau Pastel -->
@if($act->driver && $act->driver->photo_url)
<img src="{{ $act->driver->photo_url }}" alt="{{ $act->driver->name }}" class="w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5 border border-slate-200 shadow-2xs">
@else
<div class="w-9 h-9 rounded-full bg-[#eef7ee] text-[#1b5e20] font-bold text-xs flex items-center justify-center flex-shrink-0 mt-0.5">
{{ strtoupper(substr($act->driver->name ?? 'G', 0, 1)) }}
</div>
@endif
<div class="min-w-0">
<p class="text-xs font-bold text-slate-900 leading-tight truncate">
@@ -410,5 +410,37 @@
// Jalankan sync antrean realtime setiap 3 detik secara senyap di background
setInterval(syncLiveQueue, 3000);
// Modal Lightbox Foto Driver & Mobil LV
function openImageLightbox(url, title) {
const modal = document.getElementById('imageLightboxModal');
const img = document.getElementById('lightboxImage');
const titleEl = document.getElementById('lightboxTitle');
if (modal && img) {
img.src = url;
if (titleEl) titleEl.textContent = title || 'Pratinjau Foto';
modal.classList.remove('hidden');
}
}
function closeImageLightbox() {
const modal = document.getElementById('imageLightboxModal');
if (modal) modal.classList.add('hidden');
}
</script>
<!-- MODAL LIGHTBOX PRATINJAU FOTO DRIVER & MOBIL LV -->
<div id="imageLightboxModal" class="fixed inset-0 z-50 hidden bg-slate-900/80 backdrop-blur-xs flex items-center justify-center p-4" onclick="closeImageLightbox()">
<div class="bg-white rounded-2xl max-w-lg w-full overflow-hidden shadow-2xl p-4 space-y-3" onclick="event.stopPropagation()">
<div class="flex items-center justify-between pb-2 border-b border-slate-100">
<h4 id="lightboxTitle" class="text-xs font-bold text-slate-800 truncate">Pratinjau Foto</h4>
<button type="button" onclick="closeImageLightbox()" class="text-slate-400 hover:text-slate-600 p-1">
<i class="fa-solid fa-xmark text-sm"></i>
</button>
</div>
<div class="rounded-xl overflow-hidden bg-slate-950 flex items-center justify-center max-h-[70vh]">
<img id="lightboxImage" src="" alt="Pratinjau" class="max-h-[68vh] w-auto max-w-full object-contain">
</div>
</div>
</div>
@endsection
@@ -29,38 +29,64 @@
</div>
</div>
<!-- Baris 2: Rincian Driver, Mobil, dan Odometer (Tanpa Highlight Berlebihan) -->
<!-- Baris 2: Rincian Visual Driver, Kendaraan LV, dan Odometer -->
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3 pt-3">
<!-- Pengemudi -->
<div class="flex items-center space-x-2.5 bg-slate-50/70 p-2.5 rounded-xl border border-slate-100">
<div class="w-8 h-8 rounded-lg bg-emerald-100 text-[#1b5e20] flex items-center justify-center text-xs flex-shrink-0">
<i class="fa-solid fa-user"></i>
</div>
<div class="min-w-0">
<!-- Pengemudi (Driver) -->
<div class="flex items-center space-x-3 bg-slate-50/80 p-2.5 rounded-xl border border-slate-200/80">
@if($act->driver && $act->driver->photo_url)
<div class="relative group/pic flex-shrink-0">
<img src="{{ $act->driver->photo_url }}"
alt="{{ $act->driver->name }}"
onclick="openImageLightbox('{{ $act->driver->photo_url }}', 'Foto Driver: {{ addslashes($act->driver->name) }} ({{ $act->driver->nik ?? '' }})')"
class="w-12 h-12 rounded-xl object-cover ring-2 ring-emerald-500/30 shadow-2xs cursor-pointer hover:opacity-90 transition"
title="Klik untuk memperbesar foto driver">
<span class="absolute -bottom-1 -right-1 bg-emerald-600 text-white text-[9px] w-4 h-4 rounded-full flex items-center justify-center shadow-xs pointer-events-none" title="Foto Driver">
<i class="fa-solid fa-id-badge"></i>
</span>
</div>
@else
<div class="w-12 h-12 rounded-xl bg-emerald-100 text-[#1b5e20] flex items-center justify-center font-black text-sm flex-shrink-0 ring-1 ring-emerald-200">
{{ strtoupper(substr($act->driver->name ?? 'D', 0, 1)) }}
</div>
@endif
<div class="min-w-0 flex-1">
<span class="text-[10px] text-slate-400 font-bold uppercase tracking-wider block">Pengemudi:</span>
<span class="text-xs font-bold text-slate-900 truncate block">{{ $act->driver->name }}</span>
<span class="text-[10px] text-slate-500 block truncate">{{ $act->driver->division ?? 'Umum' }}</span>
<span class="text-[10px] text-slate-500 block truncate">{{ $act->driver->division ?? 'Umum' }} @if($act->driver->nik) &bull; {{ $act->driver->nik }} @endif</span>
</div>
</div>
<!-- Tipe Unit Mobil -->
<div class="flex items-center space-x-2.5 bg-slate-50/70 p-2.5 rounded-xl border border-slate-100">
<div class="w-8 h-8 rounded-lg bg-blue-100 text-blue-700 flex items-center justify-center text-xs flex-shrink-0">
<i class="fa-solid fa-car-side"></i>
</div>
<div class="min-w-0">
<span class="text-[10px] text-slate-400 font-bold uppercase tracking-wider block">Kendaraan:</span>
<!-- Tipe Unit Mobil (LV) -->
<div class="flex items-center space-x-3 bg-slate-50/80 p-2.5 rounded-xl border border-slate-200/80">
@if($act->vehicle && $act->vehicle->photo_url)
<div class="relative group/pic flex-shrink-0">
<img src="{{ $act->vehicle->photo_url }}"
alt="{{ $act->vehicle->brand_type }}"
onclick="openImageLightbox('{{ $act->vehicle->photo_url }}', 'Foto Unit Kendaraan: {{ addslashes($act->vehicle->brand_type . ' (' . ($act->vehicle->license_plate ?? $act->vehicle->code) . ')') }}')"
class="w-12 h-12 rounded-xl object-cover ring-2 ring-blue-500/30 shadow-2xs cursor-pointer hover:opacity-90 transition"
title="Klik untuk memperbesar foto unit kendaraan">
<span class="absolute -bottom-1 -right-1 bg-blue-600 text-white text-[9px] w-4 h-4 rounded-full flex items-center justify-center shadow-xs pointer-events-none" title="Foto LV">
<i class="fa-solid fa-car"></i>
</span>
</div>
@else
<div class="w-12 h-12 rounded-xl bg-blue-100 text-blue-700 flex items-center justify-center text-base flex-shrink-0 ring-1 ring-blue-200">
<i class="fa-solid fa-car-side"></i>
</div>
@endif
<div class="min-w-0 flex-1">
<span class="text-[10px] text-slate-400 font-bold uppercase tracking-wider block">Kendaraan (LV):</span>
<span class="text-xs font-bold text-slate-900 truncate block">{{ $act->vehicle->brand_type }}</span>
<span class="text-[10px] text-slate-500 block truncate">{{ $act->vehicle->ownership ?? 'Operasional Proyek' }}</span>
<span class="text-[10px] text-slate-500 block truncate">{{ $act->vehicle->code }} @if($act->vehicle->ownership) &bull; {{ $act->vehicle->ownership }} @endif</span>
</div>
</div>
<!-- Odometer / Spedometer KM (Tanpa Highlight) -->
<div class="flex items-center space-x-2.5 bg-slate-50/70 p-2.5 rounded-xl border border-slate-100">
<div class="w-8 h-8 rounded-lg bg-slate-200/80 text-slate-700 flex items-center justify-center text-xs flex-shrink-0">
<div class="flex items-center space-x-3 bg-slate-50/80 p-2.5 rounded-xl border border-slate-200/80">
<div class="w-12 h-12 rounded-xl bg-slate-200/80 text-slate-700 flex items-center justify-center text-base flex-shrink-0 ring-1 ring-slate-300">
<i class="fa-solid fa-gauge-high"></i>
</div>
<div class="min-w-0">
<div class="min-w-0 flex-1">
<span class="text-[10px] text-slate-400 font-bold uppercase tracking-wider block">Spedometer / KM:</span>
<span class="text-xs font-bold font-mono text-slate-900 truncate block">
{{ number_format($act->current_km, 0, ',', '.') }} KM
+32 -10
View File
@@ -308,11 +308,22 @@
<!-- Kendaraan -->
<td class="py-3 px-4">
@if($item->vehicle)
<div class="font-bold text-slate-900">
{{ $item->vehicle->license_plate }}
</div>
<div class="text-[11px] text-slate-500">
{{ $item->vehicle->brand_type }}
<div class="flex items-center space-x-2.5">
@if($item->vehicle->photo_url)
<img src="{{ $item->vehicle->photo_url }}" alt="{{ $item->vehicle->brand_type }}" class="w-8 h-8 rounded-lg object-cover border border-slate-200 shadow-2xs flex-shrink-0">
@else
<div class="w-8 h-8 rounded-lg bg-blue-50 text-blue-700 flex items-center justify-center text-xs flex-shrink-0">
<i class="fa-solid fa-car"></i>
</div>
@endif
<div class="min-w-0">
<div class="font-bold text-slate-900 truncate">
{{ $item->vehicle->license_plate }}
</div>
<div class="text-[11px] text-slate-500 truncate">
{{ $item->vehicle->brand_type }} ({{ $item->vehicle->code }})
</div>
</div>
</div>
@else
<span class="text-slate-400">-</span>
@@ -322,11 +333,22 @@
<!-- Driver / Pengemudi -->
<td class="py-3 px-4">
@if($item->driver)
<div class="font-bold text-slate-900">
{{ $item->driver->name }}
</div>
<div class="text-[11px] text-slate-500 font-mono">
{{ $item->driver->nik }}
<div class="flex items-center space-x-2.5">
@if($item->driver->photo_url)
<img src="{{ $item->driver->photo_url }}" alt="{{ $item->driver->name }}" class="w-8 h-8 rounded-full object-cover border border-slate-200 shadow-2xs flex-shrink-0">
@else
<div class="w-8 h-8 rounded-full bg-emerald-100 text-[#1b5e20] font-black text-xs flex items-center justify-center flex-shrink-0">
{{ strtoupper(substr($item->driver->name, 0, 1)) }}
</div>
@endif
<div class="min-w-0">
<div class="font-bold text-slate-900 truncate">
{{ $item->driver->name }}
</div>
<div class="text-[11px] text-slate-500 font-mono truncate">
{{ $item->driver->nik }}
</div>
</div>
</div>
@else
<span class="text-slate-400">-</span>
@@ -29,7 +29,15 @@
</span>
</div>
<h2 class="text-xl font-bold tracking-tight text-white mb-3">Input Timesheet Unit</h2>
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-3">
<div>
<h2 class="text-xl font-bold tracking-tight text-white">Input Timesheet Unit</h2>
<p class="text-xs text-slate-400 mt-0.5">Pemeriksaan & Mobilisasi Kendaraan Pos Gerbang</p>
</div>
@if($vehicle->photo_url)
<img src="{{ $vehicle->photo_url }}" alt="{{ $vehicle->brand_type }}" class="w-16 h-16 rounded-xl object-cover ring-2 ring-emerald-500/30 shadow-sm flex-shrink-0">
@endif
</div>
<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-bold text-white text-sm ml-1">{{ $vehicle->code }}</span></div>
@@ -79,9 +87,13 @@
<!-- Header Driver Terverifikasi (Kompak, Bersih & Profesional) -->
<div class="p-4 sm:p-5 bg-gradient-to-r from-emerald-50/70 via-slate-50 to-white border-b border-slate-100 flex items-center justify-between gap-3">
<div class="flex items-center space-x-3 min-w-0">
<div class="w-10 h-10 rounded-full bg-emerald-100 text-[#1b5e20] flex items-center justify-center font-bold text-base flex-shrink-0">
<i class="fa-solid fa-user-check"></i>
</div>
@if($verifiedDriver && $verifiedDriver->photo_url)
<img src="{{ $verifiedDriver->photo_url }}" alt="{{ $verifiedDriver->name }}" class="w-11 h-11 rounded-full object-cover ring-2 ring-emerald-500/40 shadow-xs flex-shrink-0">
@else
<div class="w-11 h-11 rounded-full bg-emerald-100 text-[#1b5e20] flex items-center justify-center font-bold text-base flex-shrink-0 ring-1 ring-emerald-200">
{{ strtoupper(substr($verifiedDriver->name ?? 'D', 0, 1)) }}
</div>
@endif
<div class="min-w-0">
<div class="flex items-center space-x-2 flex-wrap">
<span class="text-sm font-bold text-slate-900" id="verifiedDriverName">{{ $verifiedDriver->name ?? '' }}</span>