@if($isCreateMode) Create New Duty @else Super Admin Editor @endif {{ $duty_code }}

@if($isCreateMode) Create New Duty & Shift Dispatch @else Duty Details & Telemetry Override @endif

Back to Control Center
Report Telemetry Status

@if($tourId) Linked to Vehicle Tour #{{ $tourId }} — Changes update live municipal sweeping reports, certificates, and tour playback. @else No Tour linked yet. A synchronized Vehicle Tour will be generated automatically when saving. @endif

Photos: {{ $photos->count() }}
Incidents: {{ $alerts->count() }}
1. Duty Identification & Shift Master
Core Dispatch Parameters
@error('duty_code') {{ $message }} @enderror
@error('duty_date') {{ $message }} @enderror
@php $selectedShift = $shifts->firstWhere('id', $duty_shift_id); @endphp

Changing shift auto-fills start & end times below

@php $statuses = [ 'completed' => ['label' => 'Completed', 'color' => 'bg-emerald-500'], 'in_progress' => ['label' => 'In Progress', 'color' => 'bg-blue-500'], 'scheduled' => ['label' => 'Scheduled', 'color' => 'bg-indigo-500'], 'upcoming' => ['label' => 'Upcoming', 'color' => 'bg-cyan-500'], 'assigned' => ['label' => 'Assigned', 'color' => 'bg-purple-500'], 'cancelled' => ['label' => 'Cancelled', 'color' => 'bg-rose-500'], 'missed' => ['label' => 'Missed', 'color' => 'bg-amber-500'], ]; $currStatus = $statuses[$duty_status] ?? ['label' => ucfirst($duty_status), 'color' => 'bg-slate-500']; @endphp
@error('duty_status') {{ $message }} @enderror
2. Fleet & Personnel Allocation
Assigned Resources
@php $selectedVeh = $vehicles->firstWhere('id', $duty_vehicle_id); @endphp
@error('duty_vehicle_id') {{ $message }} @enderror
@php $selectedEmp = $employees->firstWhere('id', $duty_employee_id); @endphp
@error('duty_employee_id') {{ $message }} @enderror
@php $selectedRoute = $routes->firstWhere('id', $duty_route_id); @endphp
@error('duty_route_id') {{ $message }} @enderror
3. Official Municipal Report Metrics & Shift Timings
Printed on PDF Certificates
KM

Directly drives Sweeping Report & Tour PDF Certificate

@error('duty_actual_distance_km') {{ $message }} @enderror

Recorded shift commencement

@error('duty_start_time') {{ $message }} @enderror

Recorded shift conclusion

@error('duty_end_time') {{ $message }} @enderror
4. GPS Coordinates & Geofence Compliance
Map Routing Boundary
@php $geofenceStatuses = [ 'verified' => ['label' => 'Verified (Compliant)', 'desc' => 'Within designated corridor GPS boundaries', 'dot' => 'bg-emerald-500'], 'inside' => ['label' => 'Inside Boundary', 'desc' => 'Operating within municipal boundary limits', 'dot' => 'bg-teal-500'], 'outside' => ['label' => 'Outside Corridor', 'desc' => 'GPS deviation or off-route telemetry detected', 'dot' => 'bg-rose-500'], 'pending' => ['label' => 'Pending Audit', 'desc' => 'Awaiting geofence supervisor validation', 'dot' => 'bg-amber-500'], ]; $currGeo = $geofenceStatuses[$duty_geofence_status] ?? $geofenceStatuses['verified']; @endphp
Tool:
@if($duty_route_id) @endif
Start Point
End Point
Followed Trajectory Nodes · Seg ( Gaps) ( KM)
Click map to place Origin / Start Point (or drag green pin) Click map to place Destination / End Point (or drag red pin)
Origin:
Node:
Spacing:
⏳ Auto-detecting street...
Click road to append Waypoints ⏳ Tracing...
✂️ Click any waypoint node along route to toggle a clear gap (break point)
Select Road Path: Click road after . ⏳ Tracing Road...
Start / Origin Pin (Draggable)
End / Destination Pin (Draggable)
Followed Tour Route (Draggable Nodes)
Auto-Cover Street (~m) Highlighted Road Selection Line
Break Gap (Pause ⏸ / Resume ▶)
@if($duty_route_id)
Assigned Route Corridor Reference
@endif
💡 Tip: With "Auto-Cover Street", click along any road to automatically detect the road curve and populate waypoints covering the entire street.
5. Supervisor Remarks & Compliance Notes

6. Field Photos & Live Camera Verification

Employee on-duty photo proof uploads and inspection stages

Total Photos: {{ $photos->count() }}
@if($newPhoto)
Preview
{{ str_replace('_', ' ', $photoStage) }} Photo Staged & Ready

{{ $photoCaption ?: 'Field verification photo staged. Will be saved and attached when you save this duty.' }}

@endif
Attach New Field Verification Photo
@if(! $dutyId) ⚡ Saves simultaneously with Duty @endif
@php $photoStages = [ 'completed' => ['label' => 'Shift Completed / Final Verification', 'dot' => 'bg-emerald-500'], 'start' => ['label' => 'Shift Start / Initial Inspection', 'dot' => 'bg-sky-500'], 'checkpoint' => ['label' => 'Route Sweeping / Checkpoint', 'dot' => 'bg-teal-500'], 'in_progress' => ['label' => 'Work In Progress', 'dot' => 'bg-amber-500'], ]; $currPhotoStage = $photoStages[$photoStage] ?? $photoStages['completed']; @endphp
@error('photoTakenAt') {{ $message }} @enderror
@error('newPhoto') {{ $message }} @enderror

Attached Photos Gallery ({{ $photos->count() }})

@forelse($photos as $photo)
Duty Photo {{ str_replace('_', ' ', $photo->stage) }}
{{ $photo->caption ?: 'Field verification photo' }}
{{ $photo->taken_at ? $photo->taken_at->format('d M Y, h:i A') : $photo->created_at?->format('d M Y, h:i A') }}
@empty
No verification photos attached to this duty yet. Use the upload box above to attach proof images.
@endforelse

7. Telematics Alerts & Field Incident Logging

Log route deviations, speed violations, breakdowns, or road obstructions

Total Incidents: {{ $alerts->count() }}
@if($attachIncidentAlert) 🚨 Incident Alert Active & Staged @endif
Log New Field Telematics Incident
@php $alertCategories = [ 'traffic_obstruction' => ['label' => 'Traffic Obstruction / Road Block', 'icon' => 'exclamation-circle', 'color' => 'text-amber-600'], 'vehicle_breakdown' => ['label' => 'Vehicle Breakdown / Mechanical', 'icon' => 'wrench-screwdriver', 'color' => 'text-rose-600'], 'speed_deviation' => ['label' => 'Speed Deviation Exceeded', 'icon' => 'bolt', 'color' => 'text-orange-600'], 'path_deviation' => ['label' => 'Route Deviation', 'icon' => 'arrow-trending-up', 'color' => 'text-indigo-600'], 'off_route' => ['label' => 'Off-Route Boundary Warning', 'icon' => 'exclamation-triangle', 'color' => 'text-rose-600'], 'geofence' => ['label' => 'Geofence Boundary Breach', 'icon' => 'shield-exclamation', 'color' => 'text-red-700'], 'time_deviation' => ['label' => 'Shift Time Delay', 'icon' => 'clock', 'color' => 'text-yellow-600'], 'maintenance' => ['label' => 'Maintenance Required', 'icon' => 'cog-6-tooth', 'color' => 'text-slate-600'], ]; $currAlertCat = $alertCategories[$alertType] ?? $alertCategories['traffic_obstruction']; @endphp
@php $severities = [ 'low' => ['label' => 'Low (Advisory)', 'dot' => 'bg-sky-500', 'badge' => 'text-sky-700'], 'medium' => ['label' => 'Medium (Moderate)', 'dot' => 'bg-amber-500', 'badge' => 'text-amber-700'], 'high' => ['label' => 'High (Urgent Attention)', 'dot' => 'bg-orange-500', 'badge' => 'text-orange-700'], 'critical' => ['label' => 'Critical (Immediate Danger)', 'dot' => 'bg-rose-500', 'badge' => 'text-rose-700'], ]; $currSev = $severities[$alertSeverity] ?? $severities['medium']; @endphp
@php $alertStatuses = [ 'resolved' => ['label' => 'Resolved', 'dot' => 'bg-emerald-500', 'badge' => 'text-emerald-700'], 'new' => ['label' => 'New (Unreviewed)', 'dot' => 'bg-indigo-500', 'badge' => 'text-indigo-700'], 'acknowledged' => ['label' => 'Acknowledged', 'dot' => 'bg-amber-500', 'badge' => 'text-amber-700'], 'in_progress' => ['label' => 'In Progress', 'dot' => 'bg-blue-500', 'badge' => 'text-blue-700'], 'dismissed' => ['label' => 'Dismissed', 'dot' => 'bg-slate-400', 'badge' => 'text-slate-600'], ]; $currAlertSt = $alertStatuses[$alertStatus] ?? $alertStatuses['resolved']; @endphp
@error('alertTriggeredAt') {{ $message }} @enderror
@error('alertTitle') {{ $message }} @enderror

Recorded Incidents ({{ $alerts->count() }})

@forelse($alerts as $alert) @php $severityColor = match($alert->severity) { 'critical' => 'bg-rose-100 text-rose-800 border-rose-200', 'high' => 'bg-amber-100 text-amber-900 border-amber-200', 'medium' => 'bg-blue-50 text-blue-800 border-blue-200', default => 'bg-slate-100 text-slate-700 border-slate-200', }; @endphp
{{ $alert->severity }} {{ $alert->alert_code }} {{ $alert->title }} {{ str_replace('_', ' ', $alert->status) }}

{{ $alert->description }}

Location: {{ $alert->location_name ?? 'Corridor Route' }} {{ $alert->triggered_at ? $alert->triggered_at->format('d M Y, h:i A') : $alert->created_at?->format('d M Y, h:i A') }}
@empty
No telematics incident alerts recorded on this duty.
@endforelse
Cancel
@if($showConflictModal && !empty($pendingConflicts))

Scheduling Conflict Warning

{{ count($pendingConflicts) }} {{ count($pendingConflicts) === 1 ? 'Conflict' : 'Conflicts' }} Detected

The vehicle or operator is already assigned to another duty during this shift window. Please review the details below.

@foreach($pendingConflicts as $conflict)
{{ $conflict['title'] }}
{{ $conflict['badge_label'] }}
Conflicting Resource {{ $conflict['resource_name'] }} ({{ $conflict['resource_subtext'] }})
Duty Date {{ $conflict['duty_date'] }}
Existing Duty in System {{ $conflict['status'] }}
{{ $conflict['duty_code'] }} @if(!empty($conflict['duty_id'])) (Inspect) @endif
{{ $conflict['driver_name'] }} @if(!empty($conflict['driver_code'])) ({{ $conflict['driver_code'] }}) @endif
📍 {{ $conflict['route_name'] }}
⏱ Shift Window: {{ $conflict['conflicting_window'] }}
Your Updated Duty {{ $duty_status }}
{{ $duty_code }}
{{ $duty?->employee?->full_name ?? ($duty_employee_id ? \App\Models\Employee::find($duty_employee_id)?->full_name : 'Selected Driver') }}
📍 {{ $duty?->route?->name ?? ($duty_route_id ? \App\Models\Route::find($duty_route_id)?->name : 'Selected Route') }}
⏱ Proposed Window: {{ $conflict['new_window'] }}
@endforeach
Are you sure you still want to continue and override this schedule?
@endif