Fleet & Routes

Sanitation Routes

Configure sanitation routes, municipal ward assignments, multi-lane stretches, and GPS coordinates.

Total Routes
{{ number_format($totalRoutes) }} Configured
Active for Dispatch
{{ number_format($activeRoutes) }} Active
Ward & Hierarchy
State → City → Ward Linked
@if($search) @endif
@if($search || $statusFilter || $filterCityId || $filterWardId) @endif
@forelse($routes as $route) @empty @endforelse
# Route Details Municipal Ward & Zone Operating Days Distance & Lanes Duties Status Actions
{{ $loop->iteration }}
{{ $route->name }} {{ $route->code ?? 'N/A' }}
@if($route->description)

{{ $route->description }}

@endif
@if($route->ward)
ward->ward_number}" }}: {{ $route->ward->name }}"> {{ preg_match('/^ward/i', $route->ward->ward_number) ? $route->ward->ward_number : "Ward {$route->ward->ward_number}" }}: {{ $route->ward->name }}
@if($route->ward->zone_name) {{ $route->ward->zone_name }} @endif @if($route->ward->zone_name && $route->ward->constituency) @endif @if($route->ward->constituency) {{ $route->ward->constituency->name }} @endif
@elseif($route->city)
{{ $route->city->name }}
Ward not assigned
@else
Location Unassigned
@endif
{{ $route->formatted_operating_days }}
{{ number_format((float) $route->total_distance_km, 2) }} KM
@if($route->hasDefinedGeofence()) {{ $route->geofence_radius_meters }}m Geofence @else No Pin @endif
@if($route->duties_count > 0) {{ $route->duties_count }} Duties @else @endif

No routes found.

Click "Add Route" above to define your first sanitation route.

@forelse($routes as $route)
{{ $loop->iteration }}

{{ $route->name }}

{{ $route->code ?? 'N/A' }}
@if($route->description)

{{ $route->description }}

@endif
@if($route->ward)
{{ preg_match('/^ward/i', $route->ward->ward_number) ? $route->ward->ward_number : "Ward {$route->ward->ward_number}" }}: {{ $route->ward->name }}
@if($route->ward->zone_name || $route->ward->constituency)
@if($route->ward->zone_name) {{ $route->ward->zone_name }} @endif @if($route->ward->zone_name && $route->ward->constituency) @endif @if($route->ward->constituency) {{ $route->ward->constituency->name }} @endif
@endif
@elseif($route->city)
{{ $route->city->name }} Ward not assigned
@else
Location Unassigned
@endif
{{ $route->formatted_operating_days }}
{{ number_format((float) $route->total_distance_km, 2) }} KM
@if($route->hasDefinedGeofence()) {{ $route->geofence_radius_meters }}m @else No Pin @endif
@if($route->duties_count > 0) {{ $route->duties_count }} Duties @else @endif
@empty

No routes found.

Click "Add Route" above to define your first sanitation route.

@endforelse
@if($routes->hasPages())
{{ $routes->links() }}
@endif
@if($showForm)
{{ $editingId ? 'Edit Route' : 'New Route' }}

{{ $editingId ? 'Edit Sanitation Route & Lanes' : 'Add Sanitation Route & Lanes' }}

Municipal Ward & Location Mapping

Assign this route to a Municipal Ward for targeted duty scheduling, inspection, and route auditing.

Top-Down Hierarchy
1. State
@error('state_id') {{ $message }} @enderror
2. City
@error('city_id') {{ $message }} @enderror
3. Assembly Constituency
@error('constituency_id') {{ $message }} @enderror
4. Municipal Ward (Assigned)
@error('ward_id') {{ $message }} @enderror
@if($selectedWard)
{{ preg_match('/^ward/i', $selectedWard->ward_number) ? $selectedWard->ward_number : "Ward {$selectedWard->ward_number}" }}: {{ $selectedWard->name }} @if($selectedWard->zone_name) {{ $selectedWard->zone_name }} @endif {{ $selectedWard->code }}
{{ $selectedWard->constituency?->name }} {{ $selectedWard->city?->name }}, {{ $selectedWard->state?->name }}
@endif
@error('name') {{ $message }} @enderror
@error('code') {{ $message }} @enderror
@error('description') {{ $message }} @enderror
Operating Days of Week * Select active sweeping days or use quick presets
@foreach([ 'monday' => ['Mon', 'Monday'], 'tuesday' => ['Tue', 'Tuesday'], 'wednesday' => ['Wed', 'Wednesday'], 'thursday' => ['Thu', 'Thursday'], 'friday' => ['Fri', 'Friday'], 'saturday' => ['Sat', 'Saturday'], 'sunday' => ['Sun', 'Sunday'], ] as $dayKey => [$dayShort, $dayFull]) @php $isSelected = in_array($dayKey, $operating_days); $isWeekend = in_array($dayKey, ['saturday', 'sunday']); @endphp @endforeach
@error('operating_days') {{ $message }} @enderror

Route Lanes & Stretches (Sub-routes)

Add individual lanes with distance (KM), GPS coordinates, and lane photos.

Calculated Total Distance {{ number_format($this->totalDistance, 2) }} KM

Interactive Lane Mapping & Geofencing

Visual Map

Click anywhere on the map to set lane coordinates. Drivers must be within the defined radius to start duty.

{{ $is_geofence_enforced ? 'Geofence Enforced' : 'Geofence Disabled' }} {{ $is_geofence_enforced ? 'Active' : 'Off' }}
{{ $is_geofence_enforced ? 'Duty start constrained to radius' : 'Start allowed anywhere' }}
@if($is_geofence_enforced)
Geofence Radius:
@foreach([ 100 => '100m', 200 => '200m (Standard)', 300 => '300m', 500 => '500m', 1000 => '1 km', 2000 => '2 km', 5000 => '5 km' ] as $rVal => $rLabel) @endforeach
50m
5 km
m
@endif
Target Lane: @foreach($lanes as $lIdx => $lItem) @endforeach
Pin Point:
Target: | Click map to pin • Drag pins to move | Radius:
@foreach($lanes as $index => $lane)
{{ $index + 1 }}
@error("lanes.{$index}.lane_name") {{ $message }} @enderror
KM
@error("lanes.{$index}.distance_km") {{ $message }} @enderror
@if(count($lanes) > 1) @endif
Starting Point (A)
Ending Point (B)
Duty start permitted when driver is at the selected point(s).
@if(isset($lane['image']) && $lane['image']) Preview @elseif(!empty($lane['existing_image_path'])) Saved Image @else @endif
@endforeach
@endif @if($showLanesModal && $selectedRouteForLanes)
Route Lanes & Geofence Breakdown

{{ $selectedRouteForLanes->name }}

Route Code {{ $selectedRouteForLanes->code ?? 'N/A' }}
Municipal Ward @if($selectedRouteForLanes->ward) {{ preg_match('/^ward/i', $selectedRouteForLanes->ward->ward_number) ? $selectedRouteForLanes->ward->ward_number : "Ward {$selectedRouteForLanes->ward->ward_number}" }}: {{ $selectedRouteForLanes->ward->name }} @if($selectedRouteForLanes->ward->zone_name) Zone: {{ $selectedRouteForLanes->ward->zone_name }} @endif @else Not assigned @endif
Geofence Radius @if($selectedRouteForLanes->is_geofence_enforced) Within {{ $selectedRouteForLanes->geofence_radius_meters ?? 200 }}m @else Enforcement Off @endif
Total Route Distance {{ number_format((float) $selectedRouteForLanes->total_distance_km, 2) }} KM
@php $mappedLanes = $selectedRouteForLanes->lanes->filter(fn($l) => (!is_null($l->start_latitude) && !is_null($l->start_longitude)) || (!is_null($l->latitude) && !is_null($l->longitude)) || (!is_null($l->end_latitude) && !is_null($l->end_longitude)) )->values(); @endphp @if($mappedLanes->count() > 0)
Route Lane Markers & Geofence Preview
@endif

Configured Lanes & Stretches ({{ $selectedRouteForLanes->lanes->count() }})

@forelse($selectedRouteForLanes->lanes as $lane)
@if($lane->image_url) {{ $lane->lane_name }} @else
@endif
{{ $lane->lane_name }}
@php $sLat = $lane->start_latitude ?? $lane->latitude; $sLng = $lane->start_longitude ?? $lane->longitude; @endphp @if($sLat && $sLng) Start: {{ number_format($sLat, 5) }}°, {{ number_format($sLng, 5) }}° @endif @if($lane->end_latitude && $lane->end_longitude) End: {{ number_format($lane->end_latitude, 5) }}°, {{ number_format($lane->end_longitude, 5) }}° @endif @if(!$sLat && !$lane->end_latitude) No GPS coordinates set @endif | Geofence: @if($lane->geofence_point_type === 'start') Start Point Only @elseif($lane->geofence_point_type === 'end') End Point Only @else Start & End @endif
{{ number_format((float) $lane->distance_km, 2) }} KM
@empty
No lanes configured for this route.
@endforelse
@endif