@if ($search || $requestToFilter)

{{ $jobServiceRequests->total() }} results found @if ($search) for "{{ $search }}" @endif @if ($requestToFilter) for "{{ $requestToFilter }}" @endif

Clear all filters
@endif
@forelse($jobServiceRequests as $jobServiceRequest) @empty @endforelse
ID @if ($sortBy === 'id') @endif Requested By Detail Priority Work Category Status @if ($sortBy === 'req_status') @endif Created At @if ($sortBy === 'created_at') @endif Solved At @if ($sortBy === 'solved_at') @endif Duration Actions
#{{ $jobServiceRequest->id }}
{{ $jobServiceRequest->user->name ?? 'N/A' }}
{{ $jobServiceRequest->requested_by ?? 'N/A' }}
{{ $jobServiceRequest->detail }}
@php $relatedAssets = is_string($jobServiceRequest->related_assets) ? json_decode($jobServiceRequest->related_assets, true) : $jobServiceRequest->related_assets; @endphp @if (!empty($relatedAssets))
@foreach ($relatedAssets as $asset) {{ $asset['name'] ?? '-' }} @endforeach
@endif
@php $pc = $jobServiceRequest->priority ?? 'Low'; $pClass = match ($pc) { 'Critical' => 'bg-red-100 text-red-800', 'High' => 'bg-orange-100 text-orange-800', 'Medium' => 'bg-blue-100 text-blue-800', 'Low' => 'bg-green-100 text-green-800', default => 'bg-gray-100 text-gray-800', }; @endphp {{ $pc }} @if ($jobServiceRequest->work_category) @php $wc = $jobServiceRequest->work_category; $wcClass = match ($wc) { 'Corrective' => 'bg-red-100 text-red-800', 'Improvement' => 'bg-green-100 text-green-800', 'Inspection' => 'bg-blue-100 text-blue-800', 'Installation' => 'bg-purple-100 text-purple-800', 'Preventive' => 'bg-teal-100 text-teal-800', 'Relocation' => 'bg-amber-100 text-amber-800', default => 'bg-gray-100 text-gray-800', }; @endphp {{ $wc }} @else - @endif @if ($jobServiceRequest->problem_category)
{{ $jobServiceRequest->problem_category }}
@endif
@php $status = $jobServiceRequest->req_status === 'In process' && !empty($jobServiceRequest->work_status) ? $jobServiceRequest->work_status : $jobServiceRequest->req_status; $statusLabel = match ($status) { 'Initiated' => 'Pending', 'Approved' => 'Completed', default => $status, }; $isPendingForRating = $jobServiceRequest->assigned_to !== null && $jobServiceRequest->rating === null; if ($isPendingForRating) { $statusLabel = $jobServiceRequest->problem_analysis === null ? 'Start Working' : 'Pending for Rating'; } @endphp $status === 'Initiated' && !$isPendingForRating, 'bg-yellow-50 text-yellow-700 ring-1 ring-yellow-200' => ($status === 'In process' || $status === 'Start Working') && !$isPendingForRating, 'bg-purple-50 text-purple-700 ring-1 ring-purple-200' => $status === 'Need Requisition' && !$isPendingForRating, 'bg-green-50 text-green-700 ring-1 ring-green-200' => $status === 'Approved' && !$isPendingForRating, 'bg-red-50 text-red-700 ring-1 ring-red-200' => $status === 'Rejected' && !$isPendingForRating, 'bg-orange-50 text-orange-700 ring-1 ring-orange-200' => $isPendingForRating, 'bg-gray-50 text-gray-700 ring-1 ring-gray-200' => !$isPendingForRating && !in_array($status, ['Initiated', 'In process', 'Start Working', 'Need Requisition', 'Approved', 'Rejected']), ])> {{ $statusLabel }} @if ($jobServiceRequest->assigned_to_name)
{{ strtoupper(substr($jobServiceRequest->assigned_to_name, 0, 1)) }} {{ $jobServiceRequest->assigned_to_name }}
@endif
{{ $jobServiceRequest->created_at->format('d/m/y') }}
{{ $jobServiceRequest->created_at->format('H:i') }}
@if ($jobServiceRequest->solved_at)
{{ $jobServiceRequest->solved_at->format('d/m/y') }}
{{ $jobServiceRequest->solved_at->format('H:i') }}
@else - @endif
@php $duration = null; if ($isPendingForRating) { // Not fully closed yet — still ongoing until rated $duration = $jobServiceRequest->created_at->diff($jobServiceRequest->solved_at); } elseif ($jobServiceRequest->solved_at && $status === 'Approved') { // Completed: duration from creation to resolution $duration = $jobServiceRequest->created_at->diff($jobServiceRequest->solved_at); } elseif (!$jobServiceRequest->solved_at && in_array($status, ['Initiated', 'In process', 'Start Working', 'Need Requisition'])) { // Not yet solved: duration from creation until now (still running) $duration = $jobServiceRequest->created_at->diff(now()); } if ($duration) { $parts = []; if ($duration->days > 0) $parts[] = $duration->days . 'd'; if ($duration->h > 0) $parts[] = $duration->h . 'h'; $parts[] = $duration->i . 'm'; $durationText = implode(' ', $parts); } @endphp @if ($duration) {{ $durationText }}
{{ ($status === 'Approved' && !$isPendingForRating) ? 'Resolved' : 'Ongoing' }}
@else - @endif
@php $targetDepts = match ($jobServiceRequest->request_to) { 'IT' => [53, 54, 70], 'Engineering' => [75, 45, 34, 26, 25, 24, 13], 'Project' => [55], default => [], }; $userDeptId = auth()->user()->department_id ?? null; $canPickUp = $jobServiceRequest->assigned_to === null && $jobServiceRequest->req_status === 'Initiated' && (in_array($userDeptId, [75, 45, 34, 26, 25, 24, 13]) || in_array($userDeptId, $targetDepts)); @endphp @if ($canPickUp) @elseif($jobServiceRequest->user_id === Auth::user()->id && $jobServiceRequest->req_status === 'Rejected') Edit @else - @endif

No service requests found.

Create your first service request →
{{ $jobServiceRequests->links() }}