@extends('layout.layout') @section('content') @include('components.alert') @php $statusPillMap = [ 'pending' => 'warn', 'assigned' => 'info', 'in_progress' => 'info', 'resolved' => 'success', 'closed' => 'neutral', 'rejected' => 'danger', ]; $activeFilters = collect([ request('search'), request('from_department_id'), request('to_department_id'), request('status'), request('assigned_to'), request('created_by'), request('date_from'), request('date_to'), request('sort'), request('direction') && request('direction') !== 'desc' ? request('direction') : null, request()->boolean('unassigned_only') ? 'unassigned' : null, request()->boolean('assigned_to_me') ? 'mine' : null, ])->filter()->count(); $canEditEscalation = function ($item) use ($staff) { return $staff && (int) $item->to_department_id === (int) $staff->department_id && ( (int) $item->toDepartment?->department_head_id === (int) $staff->id || (int) optional($staff->jobTitle)->sort === 1 ); }; $requestMeta = function ($item) use ($academicStudentRequestsUrl, $hrRequestsUrl) { if ($item->studentRequest) { $studentName = $item->studentRequest->student?->full_name ?: trim(($item->studentRequest->student?->first_name ?? '') . ' ' . ($item->studentRequest->student?->last_name ?? '')); return [ 'type' => 'Student Request', 'url' => $academicStudentRequestsUrl . '/' . $item->studentRequest->id, 'id' => $item->studentRequest->id, 'title' => $studentName ?: 'Student #' . $item->studentRequest->created_by, 'description' => $item->studentRequest->subject ?: 'No subject', ]; } if ($item->hrRequest) { $hrCreatorName = $item->hrRequest->creator?->full_name ?: trim(($item->hrRequest->creator?->first_name ?? '') . ' ' . ($item->hrRequest->creator?->last_name ?? '')); $hrTitle = $item->hrRequest->requestType?->name ?: 'Staff Request #' . $item->hrRequest->id; $departmentLine = $item->hrRequest->department?->name ?? 'No department'; if ($hrCreatorName) { $departmentLine .= ' - ' . $hrCreatorName; } return [ 'type' => 'Staff Request', 'url' => $hrRequestsUrl . '/' . $item->hrRequest->id, 'id' => $item->hrRequest->id, 'title' => $hrTitle, 'description' => $item->hrRequest->details ? \Illuminate\Support\Str::limit($item->hrRequest->details, 80) : ucfirst($item->hrRequest->status ?? 'pending'), 'meta' => $departmentLine, ]; } return null; }; $statusValueFor = function ($status) { return $status instanceof \App\Enums\EscalationRequestStatus ? $status->value : (string) $status; }; $statusLabelFor = function ($status) { if ($status instanceof \App\Enums\EscalationRequestStatus) { return $status->label(); } return ucfirst(str_replace('_', ' ', (string) $status)); }; @endphp
Create Request
Filters

Filter by department, assignee, status, dates, or keyword.

{{ $activeFilters }} active
Visible Requests {{ $escalationRequests->total() }}
This Page {{ $escalationRequests->count() }}
Unassigned {{ $escalationRequests->whereNull('assigned_to')->count() }}
Active Filters {{ $activeFilters }}
Request List

Visible requests are limited to your department context and assignments.

Page {{ $escalationRequests->currentPage() }} of {{ $escalationRequests->lastPage() }}
@forelse ($escalationRequests as $item) @php $statusValue = $statusValueFor($item->status); $statusLabel = $statusLabelFor($item->status); $statusPill = $statusPillMap[$statusValue] ?? 'neutral'; $linkedRequest = $requestMeta($item); @endphp @empty @endforelse
Title Route Linked Request Assigned To Status Created By Created Date Actions
{{ $item->title }}
{{ \Illuminate\Support\Str::limit($item->description, 90) }}
{{ $item->fromDepartment?->name ?? 'N/A' }} to {{ $item->toDepartment?->name ?? 'N/A' }}
@if ($linkedRequest)
{{ $linkedRequest['type'] }}
#{{ $linkedRequest['id'] }} - {{ $linkedRequest['title'] }}
@if (!empty($linkedRequest['meta']))
{{ $linkedRequest['meta'] }}
@endif
{{ $linkedRequest['description'] }}
@else Not linked @endif
{{ $item->assignedTo?->full_name ?: 'Unassigned' }} {{ $statusLabel }} {{ $item->creator?->full_name ?: 'N/A' }} {{ $item->created_at?->format('Y-m-d H:i') }}
View @if ($canEditEscalation($item)) Edit @endif
No escalation requests found.
@forelse ($escalationRequests as $item) @php $statusValue = $statusValueFor($item->status); $statusLabel = $statusLabelFor($item->status); $statusPill = $statusPillMap[$statusValue] ?? 'neutral'; $linkedRequest = $requestMeta($item); @endphp
{{ $item->title }}
{{ \Illuminate\Support\Str::limit($item->description, 120) }}
{{ $statusLabel }}
From {{ $item->fromDepartment?->name ?? 'N/A' }}
To {{ $item->toDepartment?->name ?? 'N/A' }}
Assigned To {{ $item->assignedTo?->full_name ?: 'Unassigned' }}
Created {{ $item->created_at?->format('Y-m-d H:i') }}
Linked Request @if ($linkedRequest)
{{ $linkedRequest['title'] }}
{{ $linkedRequest['description'] }}
@else Not linked @endif
View @if ($canEditEscalation($item)) Edit @endif
@empty
No escalation requests found.
@endforelse
{{ $escalationRequests->links('pagination::bootstrap-5') }}
@endsection