diff --git a/resources/views/employee/dashboard.blade.php b/resources/views/employee/dashboard.blade.php index 0319925..f714ba7 100644 --- a/resources/views/employee/dashboard.blade.php +++ b/resources/views/employee/dashboard.blade.php @@ -92,6 +92,42 @@ + {{-- Visual Foto Mobil LV & Foto Driver --}} +
+ +
+ @if($pendingActivity->vehicle && $pendingActivity->vehicle->photo_url) + {{ $pendingActivity->vehicle->brand_type }} + @else +
+ +
+ @endif +
+ Unit Kendaraan: +

{{ $pendingActivity->vehicle->brand_type }}

+

{{ $pendingActivity->vehicle->code }} • {{ $pendingActivity->vehicle->license_plate ?? 'Tanpa Plat' }}

+
+
+ + +
+ @php $driverPhoto = $pendingActivity->driver?->photo_url ?: auth()->user()->photo_url; @endphp + @if($driverPhoto) + {{ $pendingActivity->driver->name }} + @else +
+ {{ strtoupper(substr($pendingActivity->driver->name ?? 'D', 0, 1)) }} +
+ @endif +
+ Driver Terverifikasi: +

{{ $pendingActivity->driver->name }}

+

NIK: {{ $pendingActivity->driver->nik ?? '-' }} • {{ $pendingActivity->driver->division ?? 'Operasional' }}

+
+
+
+ {{-- Grid Rincian Tiket --}}
diff --git a/resources/views/pg/dashboard.blade.php b/resources/views/pg/dashboard.blade.php index 68aedb9..b637241 100644 --- a/resources/views/pg/dashboard.blade.php +++ b/resources/views/pg/dashboard.blade.php @@ -88,10 +88,14 @@ @forelse($recentActivities as $act)
- -
- {{ strtoupper(substr($act->driver->name ?? 'G', 0, 1)) }} -
+ + @if($act->driver && $act->driver->photo_url) + {{ $act->driver->name }} + @else +
+ {{ strtoupper(substr($act->driver->name ?? 'G', 0, 1)) }} +
+ @endif

diff --git a/resources/views/pg/gate_inspection.blade.php b/resources/views/pg/gate_inspection.blade.php index 888004b..074df9e 100644 --- a/resources/views/pg/gate_inspection.blade.php +++ b/resources/views/pg/gate_inspection.blade.php @@ -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'); + } + + +

@endsection diff --git a/resources/views/pg/partials/queue_cards.blade.php b/resources/views/pg/partials/queue_cards.blade.php index 5544df1..8cb5a47 100644 --- a/resources/views/pg/partials/queue_cards.blade.php +++ b/resources/views/pg/partials/queue_cards.blade.php @@ -29,38 +29,64 @@
- +
- -
-
- -
-
+ +
+ @if($act->driver && $act->driver->photo_url) +
+ {{ $act->driver->name }} + + + +
+ @else +
+ {{ strtoupper(substr($act->driver->name ?? 'D', 0, 1)) }} +
+ @endif +
Pengemudi: {{ $act->driver->name }} - {{ $act->driver->division ?? 'Umum' }} + {{ $act->driver->division ?? 'Umum' }} @if($act->driver->nik) • {{ $act->driver->nik }} @endif
- -
-
- -
-
- Kendaraan: + +
+ @if($act->vehicle && $act->vehicle->photo_url) +
+ {{ $act->vehicle->brand_type }} + + + +
+ @else +
+ +
+ @endif +
+ Kendaraan (LV): {{ $act->vehicle->brand_type }} - {{ $act->vehicle->ownership ?? 'Operasional Proyek' }} + {{ $act->vehicle->code }} @if($act->vehicle->ownership) • {{ $act->vehicle->ownership }} @endif
-
-
+
+
-
+
Spedometer / KM: {{ number_format($act->current_km, 0, ',', '.') }} KM diff --git a/resources/views/pg/verification_logs.blade.php b/resources/views/pg/verification_logs.blade.php index 48bab18..ac7ed94 100644 --- a/resources/views/pg/verification_logs.blade.php +++ b/resources/views/pg/verification_logs.blade.php @@ -308,11 +308,22 @@ @if($item->vehicle) -
- {{ $item->vehicle->license_plate }} -
-
- {{ $item->vehicle->brand_type }} +
+ @if($item->vehicle->photo_url) + {{ $item->vehicle->brand_type }} + @else +
+ +
+ @endif +
+
+ {{ $item->vehicle->license_plate }} +
+
+ {{ $item->vehicle->brand_type }} ({{ $item->vehicle->code }}) +
+
@else - @@ -322,11 +333,22 @@ @if($item->driver) -
- {{ $item->driver->name }} -
-
- {{ $item->driver->nik }} +
+ @if($item->driver->photo_url) + {{ $item->driver->name }} + @else +
+ {{ strtoupper(substr($item->driver->name, 0, 1)) }} +
+ @endif +
+
+ {{ $item->driver->name }} +
+
+ {{ $item->driver->nik }} +
+
@else - diff --git a/resources/views/public/vehicle_activity_form.blade.php b/resources/views/public/vehicle_activity_form.blade.php index 8b8b313..31c1381 100644 --- a/resources/views/public/vehicle_activity_form.blade.php +++ b/resources/views/public/vehicle_activity_form.blade.php @@ -29,7 +29,15 @@
-

Input Timesheet Unit

+
+
+

Input Timesheet Unit

+

Pemeriksaan & Mobilisasi Kendaraan Pos Gerbang

+
+ @if($vehicle->photo_url) + {{ $vehicle->brand_type }} + @endif +
Kode Unit: {{ $vehicle->code }}
@@ -79,9 +87,13 @@
-
- -
+ @if($verifiedDriver && $verifiedDriver->photo_url) + {{ $verifiedDriver->name }} + @else +
+ {{ strtoupper(substr($verifiedDriver->name ?? 'D', 0, 1)) }} +
+ @endif
{{ $verifiedDriver->name ?? '' }} diff --git a/tests/Feature/PhotoUploadAndCompressionTest.php b/tests/Feature/PhotoUploadAndCompressionTest.php index bfab3dc..4d6e132 100644 --- a/tests/Feature/PhotoUploadAndCompressionTest.php +++ b/tests/Feature/PhotoUploadAndCompressionTest.php @@ -3,8 +3,11 @@ namespace Tests\Feature; use App\Models\Employee; +use App\Models\Gate; +use App\Models\SecurityGuard; use App\Models\User; use App\Models\Vehicle; +use App\Models\VehicleActivity; use Database\Seeders\RolePermissionSeeder; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Http\UploadedFile; @@ -330,4 +333,103 @@ class PhotoUploadAndCompressionTest extends TestCase $indexResponse->assertOk(); $indexResponse->assertSee($newUser->photo_url, false); } + + public function test_gate_inspection_card_and_active_ticket_render_employee_and_lv_photos(): void + { + Storage::fake('public'); + + $gate = Gate::create([ + 'code' => 'GATE-MAIN', + 'name' => 'Pos Gerbang Utama', + 'is_active' => true, + ]); + + $guardUser = User::factory()->create([ + 'username' => 'satpam_test', + 'role' => 'gate_officer', + 'gate_id' => $gate->id, + ]); + $guardUser->assignRole('gate_officer'); + + $guard = SecurityGuard::create([ + 'badge_id' => 'SEC-99', + 'name' => 'Satpam Penguji', + 'team' => 1, + 'gate_id' => $gate->id, + 'user_id' => $guardUser->id, + 'is_active' => true, + ]); + + // Kendaraan LV dengan foto + $vehicle = Vehicle::create([ + 'code' => 'LV-GATE-01', + 'category' => 'light_vehicle', + 'brand_type' => 'Toyota Hilux 4x4', + 'license_plate' => 'BH 1234 XY', + 'status' => 'Operation', + 'current_km' => 1000, + 'photo_path' => 'vehicles/hilux_test.jpg', + ]); + + // Karyawan Driver dengan foto + $driverUser = User::factory()->create([ + 'username' => 'driver_test', + 'name' => 'Ahmad Supir', + 'role' => 'employee', + 'photo_path' => 'employees/ahmad_test.jpg', + ]); + $driverUser->assignRole('employee'); + + $driver = Employee::create([ + 'user_id' => $driverUser->id, + 'nik' => 'driver_test', + 'name' => 'Ahmad Supir', + 'unit_kerja' => 'Operasional', + 'division' => 'Logistik', + 'position' => 'Driver Operasional', + 'is_operator' => true, + 'simper_expired_at' => now()->addYear(), + 'photo_path' => 'employees/ahmad_test.jpg', + ]); + + // Buat aktivitas perlintasan gerbang berstatus pending + $activity = VehicleActivity::create([ + 'transaction_no' => 'TRX-GATE-001', + 'vehicle_id' => $vehicle->id, + 'driver_id' => $driver->id, + 'gate_id' => $gate->id, + 'direction' => 'out', + 'previous_km' => 1000, + 'current_km' => 1050, + 'distance' => 50, + 'purpose' => 'Antar Logistik Proyek', + 'recorded_at' => now(), + 'validation_status' => 'pending', + ]); + + // 1. Verifikasi kartu antrean Satpam di Pos Gerbang merender foto driver dan mobil LV + $gateResponse = $this->actingAs($guardUser)->get(route('pg.gate.inspection')); + $gateResponse->assertOk(); + $gateResponse->assertSee($vehicle->photo_url, false); + $gateResponse->assertSee($driver->photo_url, false); + + // 2. Verifikasi live queue JSON endpoint juga membawa foto dalam HTML antrean + $liveQueueResponse = $this->actingAs($guardUser)->get(route('pg.gate.live_queue')); + $liveQueueResponse->assertOk(); + $liveQueueJson = $liveQueueResponse->json(); + $this->assertStringContainsString($vehicle->photo_url, $liveQueueJson['html']); + $this->assertStringContainsString($driver->photo_url, $liveQueueJson['html']); + + // 3. Verifikasi tiket aktif pada dashboard karyawan driver juga merender foto mobil LV dan foto supir + $driverDashboardResponse = $this->actingAs($driverUser)->get(route('employee.dashboard')); + $driverDashboardResponse->assertOk(); + $driverDashboardResponse->assertSee($vehicle->photo_url, false); + $driverDashboardResponse->assertSee($driver->photo_url, false); + + // 4. Verifikasi halaman scan QR mobil juga merender foto mobil LV dan foto supir terverifikasi + $formResponse = $this->actingAs($driverUser)->get(route('vehicle.activity.form', ['code' => $vehicle->code])); + $formResponse->assertOk(); + $formResponse->assertSee($vehicle->photo_url, false); + $formResponse->assertSee($driver->photo_url, false); + } }