@forelse($requests as $request) @php $items = []; if (isset($request->items)) { $items = is_array($request->items) ? $request->items : (is_string($request->items) ? json_decode($request->items, true) : []); } @endphp @empty @endforelse
Title Branch Unit Category Request Type Urgency Status Current Approver Actions
{{ $request->title }} {{ ucfirst($request->branch) }} @if(isset($request->unit) && $request->unit !== null && $request->unit !== '') {{ $request->unit }} @else - @endif {{ $request->category }} {{ $request->request_type }} @if($request->urgency == 'High') High @elseif($request->urgency == 'Medium') Medium @elseif($request->urgency == 'Low') Low @else {{ $request->urgency }} @endif @if($request->status == 'rejected') Rejected @elseif($request->status == 'completed') Completed @elseif($request->status == 'escalated') Approved & Escalated @elseif($request->status == 'approved') Approved @elseif($request->status == 'pending') Pending @else {{ ucfirst($request->status) }} @endif @php // Show initial/current approver by ID if relationship is missing $approver = $request->currentApprover ?? null; if (!$approver && !empty($request->current_approver_id)) { $approver = \App\Models\User::find($request->current_approver_id); } @endphp @if($approver) {{ $approver->name }} ({{ $approver->designation ?? $approver->role ?? '' }}) @else - @endif {{-- Only show action buttons for requests where the current user is the approver and status is pending or escalated --}} @if(auth()->user()->id == $request->current_approver_id && in_array($request->status, ['pending', 'escalated'])) @php $allowedActions = $request->getAllowedActions(auth()->user()); $validTargets = $request->getValidEscalationTargets(auth()->user()); $escalationInstruction = $request->getEscalationInstruction(auth()->user()); @endphp {{-- Separate forms for approve/reject (no escalation dropdown needed) --}} @if(in_array('approve', $allowedActions))
@csrf
@endif @if(in_array('reject', $allowedActions))
@csrf
@endif {{-- Separate form for escalation (includes dropdown) --}} @if(in_array('escalate', $allowedActions) || in_array('escalate_to_approver', $allowedActions) || in_array('escalate_to_pmo', $allowedActions))
@csrf
@endif
{{ $request->getWorkflowDescription() }} @else View @if(auth()->user()->id == $request->user_id)
@csrf @method('DELETE')
@endif @endif
No requests found.