@extends('layouts.employee') @section('title', 'Patrol Duty Schedule') @section('content')

Patrol Roaster

Manage your patrol routes and operational status.

@php $tabs = [ 'all' => 'All Operations', 'active' => 'Active', 'today' => 'Today', 'upcoming' => 'Upcoming', 'completed' => 'Completed', 'missed' => 'Missed', 'cancelled' => 'Cancelled', 'pending' => 'Pending' ]; @endphp @foreach($tabs as $key => $label) {{ $label }} {{ $counts[$key] ?? 0 }} @endforeach
@forelse($jobs as $job) {{-- ... existing PHP block for calculations ... --}} @php $statusClass = $job->status_classes; $statusLabel = ucfirst($job->calculated_status); $isCompleted = in_array($job->job_status, ['completed', 'auto_ended']); @endphp @empty @endforelse
Duty # Route Schedule Timings Actual Timings Status Actions
#{{ $job->duty_number }}
R
{{ $job->route->name ?? 'Unknown Route' }}
{{ $job->route->sites->count() ?? 0 }} Sites
Start Time {{ $job->from_time->format('M d, Y') }} {{ $job->from_time->format('h:i A') }}
End Time {{ $job->to_time->format('M d, Y') }} {{ $job->to_time->format('h:i A') }}
{{ number_format($job->from_time->diffInMinutes($job->to_time) / 60, 2) }} Hrs Duration
@if(($job->job_status === 'completed' || $job->job_status === 'auto_ended') && $job->job_started_at)
{{ $job->job_started_at->format('M d, Y') }} {{ $job->job_started_at->format('H:i') }} - {{ $job->job_ended_at ? $job->job_ended_at->format('H:i') : '?' }} @if($job->job_ended_at) {{ number_format($job->job_started_at->diffInMinutes($job->job_ended_at) / 60, 2) }}h Actual @endif
@else - @endif
{{ $statusLabel }} @php $pivot = $job->employees->where('id', auth()->guard('employee')->id())->first()->pivot; @endphp @if($pivot->cancellation_status === 'pending')
Cancellation Pending
@elseif($pivot->cancellation_status === 'rejected')
Cancellation Declined
@endif
@if(!$isCompleted) @if(in_array($job->calculated_status, ['upcoming', 'today']) && (!$pivot->cancellation_requested_at || $pivot->cancellation_status === 'rejected')) @endif {{ $job->job_status === 'in_progress' ? 'Continue Patrol' : 'Open Console' }} @if($job->job_status === 'in_progress') @endif @else
Report
@endif

No patrol assignments found

@if($jobs->hasPages())
{{ $jobs->links() }}
@endif
@endsection