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

Assignment Roster

Manage your deployment schedule 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) @php $pivot = $job->pivot; $hasStarted = !empty($pivot->actual_start_at); $hasCheckedIn = !empty($pivot->checkin_images); $hasCheckedOut = !empty($pivot->actual_end_at); $statusClasses = [ 'upcoming' => 'bg-blue-50 text-blue-700 border border-blue-100', 'today' => 'bg-amber-50 text-amber-700 border border-amber-100', 'completed' => 'bg-emerald-50 text-emerald-700 border border-emerald-100', 'missed' => 'bg-red-50 text-red-700 border border-red-100', 'cancelled' => 'bg-gray-100 text-gray-400 border border-gray-200 line-through', 'active' => 'bg-emerald-50 text-emerald-700 border border-emerald-100 animate-pulse', 'default' => 'bg-gray-100 text-gray-600 border border-gray-200' ]; $displayStatus = $job->status; if ($job->active && !in_array($job->status, ['completed', 'active', 'missed', 'cancelled'])) { if ($job->to_datetime->isPast()) { $displayStatus = 'missed'; } elseif ($job->from_datetime->isToday()) { $displayStatus = 'today'; } else { $displayStatus = 'upcoming'; } } $statusClass = $job->active ? ($statusClasses[$displayStatus] ?? $statusClasses['default']) : $statusClasses['default']; $checkinImages = !empty($pivot->checkin_images) ? json_decode($pivot->checkin_images, true) : []; $checkoutImages = !empty($pivot->checkout_images) ? json_decode($pivot->checkout_images, true) : []; @endphp id ? "true" : "false" }}, scanning: false, scanCode: "", jobCheckpoints: {!! $job->tourRoutes->flatMap->checkpoints->map(fn($c) => [ "code" => $c->checkpoint_id_code, "options" => is_string($c->extra_scan_options) ? json_decode($c->extra_scan_options, true) : $c->extra_scan_options ])->toJson() !!}, get activeCheckpoint() { return this.jobCheckpoints.find(cp => cp.code === this.scanCode); }, fileCount: 0, uploading: false, progress: 0, selectedParent: "", selectedChild: "", startUpload() { this.uploading = true; let interval = setInterval(() => { this.progress += 5; if(this.progress >= 90) clearInterval(interval); }, 100); }, relieverModal: false, reliever: null, loadingReliever: false, fetchReliever(scheduleId) { this.loadingReliever = true; this.relieverModal = true; fetch(`/employee/jobs/${scheduleId}/reliever`) .then(res => res.json()) .then(data => { this.reliever = data; this.loadingReliever = false; }) .catch(err => { console.error(err); this.loadingReliever = false; }); } }'> @empty @endforelse
Duty # Site Schedule Status Actions
#{{ $job->duty_number }}
{{ substr($job->site->name, 0, 1) }}
{{ $job->site->name }}
{{ $job->site->city }}
@php $currentEmployeeId = auth()->guard('employee')->id(); $companions = $job->employees->where('id', '!=', $currentEmployeeId); @endphp @if($companions->count() > 0)
@foreach($companions as $comp) {{ $comp->first_name }} @endforeach
@endif
{{ $job->from_datetime->format('M d, Y') }} {{ $job->from_datetime->format('H:i') }} - {{ $job->to_datetime->format('H:i') }} {{ number_format($job->from_datetime->diffInMinutes($job->to_datetime) / 60, 2) }}h Duration
{{ !$job->active ? 'Inactive' : $displayStatus }} @if($pivot->cancellation_requested_at)
Cancellation Pending
@endif
@if(in_array($displayStatus, ['upcoming', 'today']) && !$pivot->cancellation_requested_at) @endif @if(in_array($displayStatus, ['upcoming', 'missed', 'cancelled'])) View @endif @if(!$hasStarted) @if($displayStatus !== 'completed' && $displayStatus !== 'missed' && $displayStatus !== 'cancelled' && $displayStatus !== 'pending' && $job->active && $job->schedule_date->isToday())
@csrf
@endif @elseif(!$hasCheckedOut && $job->status !== 'completed')
@if(!$hasCheckedIn) @endif
@csrf
@else
Report
@endif

No assignments found

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