@php /** * Helper to handle image rendering in both PDF and Web views. * For PDFs, it converts images (including WebP) to base64 JPEGs * to ensure compatibility with DomPDF. */ $renderJobImage = function ($img, $isPdf) { if (!$isPdf) { return asset('storage/' . $img); } $fullPath = public_path('storage/' . $img); if (!file_exists($fullPath)) { return ''; } $extension = strtolower(pathinfo($fullPath, PATHINFO_EXTENSION)); try { // DomPDF doesn't natively support WebP. Convert to JPEG if GD is available. if ($extension === 'webp' && function_exists('imagecreatefromwebp')) { $image = @imagecreatefromwebp($fullPath); if ($image) { ob_start(); imagejpeg($image, null, 70); // Compress slightly for PDF size $data = ob_get_clean(); imagedestroy($image); return 'data:image/jpeg;base64,' . base64_encode($data); } } // For other formats or fallback, use base64 encoded original $mime = 'image/' . ($extension === 'jpg' ? 'jpeg' : $extension); return 'data:' . $mime . ';base64,' . base64_encode(file_get_contents($fullPath)); } catch (\Exception $e) { return ''; } }; @endphp

Comprehensive Job Log

Deployment #{{ $schedule->duty_number }} | Site: {{ $schedule->site->name }}

Operative Intelligence
Operative {{ $employee->first_name }} {{ $employee->last_name }} (#{{ $employee->employee_id }})
Duty Status {{ strtoupper($schedule->status) }}
Latitude and Longitude Coordinates & Timings
Scheduled Shift {{ \Carbon\Carbon::parse($schedule->from_datetime)->format('Y-m-d H:i') }} - {{ \Carbon\Carbon::parse($schedule->to_datetime)->format('H:i') }}
Infiltration (Start)
Time: {{ $pivot->actual_start_at ? \Carbon\Carbon::parse($pivot->actual_start_at)->format('Y-m-d H:i') : 'N/A' }}
Coords: [{{ $pivot->start_lat ?? 'N/A' }}, {{ $pivot->start_lng ?? 'N/A' }}]
Extraction (End)
Time: {{ $pivot->actual_end_at ? \Carbon\Carbon::parse($pivot->actual_end_at)->format('Y-m-d H:i') : 'N/A' }}
Coords: [{{ $pivot->end_lat ?? 'N/A' }}, {{ $pivot->end_lng ?? 'N/A' }}]
Remarks / Comments @if(!empty($schedule->remarks)) {{ $schedule->remarks }} @else No remarks recorded. @endif
Field Intelligence & Report Incidents
@forelse($schedule->incidents as $incident)
{{ $incident->subject }}
{{ $incident->description }}
@if(!empty($incident->images) && is_array($incident->images))
@foreach($incident->images as $img)
@endforeach
@endif
Filed at: {{ $incident->created_at->format('Y-m-d H:i') }}
@empty

No tactical incidents reported during this deployment.

@endforelse
Consolidated Evidence Gallery
@php $inImages = json_decode($pivot->checkin_images, true) ?? []; $outImages = json_decode($pivot->checkout_images, true) ?? []; @endphp @if(count($inImages) > 0)
CHECK-IN IMAGES
@foreach($inImages as $img)
@endforeach
@endif @if(count($outImages) > 0)
CHECKOUT IMAGES
@foreach($outImages as $img)
@endforeach
@endif