@extends('layout.layout') @section('content') @include('components.alert')
Back to List @php $creatorName = trim(($studentRequest->creator->first_name ?? '') . ' ' . ($studentRequest->creator->last_name ?? '')); $creatorInitials = strtoupper(substr($studentRequest->creator->first_name ?? 'S', 0, 1) . substr($studentRequest->creator->last_name ?? '', 0, 1)); $courseAssignedAdmin = $studentRequest->course?->admin_assigned_students ?->firstWhere('student_id', $studentRequest->created_by) ?->admin; $displayAdmin = $studentRequest->admin ?? $courseAssignedAdmin; $instructorName = $studentRequest->instructor?->full_name ?? trim(($studentRequest->instructor->first_name ?? '') . ' ' . ($studentRequest->instructor->last_name ?? '')) ?: ($studentRequest->course?->staff?->full_name ?? trim(($studentRequest->course?->staff?->first_name ?? '') . ' ' . ($studentRequest->course?->staff?->last_name ?? ''))); $supervisorName = $studentRequest->supervisor?->full_name ?? trim(($studentRequest->supervisor?->first_name ?? '') . ' ' . ($studentRequest->supervisor?->last_name ?? '')) ?: ($studentRequest->course?->staff?->manager?->full_name ?? trim(($studentRequest->course?->staff?->manager?->first_name ?? '') . ' ' . ($studentRequest->course?->staff?->manager?->last_name ?? ''))); $teamLeaderName = $displayAdmin?->staff?->manager?->full_name ?? trim(($displayAdmin?->staff?->manager?->first_name ?? '') . ' ' . ($displayAdmin?->staff?->manager?->last_name ?? '')); $relatedToLabel = $studentRequest->related_to ? ucfirst($studentRequest->related_to) : ($studentRequest->type === 'refund' ? ($studentRequest->course?->course_name_en ?? $studentRequest->course?->course_name_ar ?? 'Course') : 'N/A'); $priorityClass = match ($studentRequest->priority) { 'high' => 'ui-pill--danger', 'medium' => 'ui-pill--warn', 'low' => 'ui-pill--success', default => 'ui-pill--neutral', }; $escalationStatusClass = static function (?string $status) { return match ($status) { 'pending' => 'ui-pill--warn', 'assigned', 'in_progress' => 'ui-pill--info', 'resolved', 'closed' => 'ui-pill--success', 'rejected' => 'ui-pill--danger', default => 'ui-pill--neutral', }; }; @endphp
{{ $creatorInitials ?: 'SR' }}
Request #{{ $studentRequest->id }}

{{ $studentRequest->subject }}

Created by {{ $creatorName ?: 'N/A' }}

{{ ucfirst($studentRequest->type) }} {{ $relatedToLabel }} {{ ucfirst($studentRequest->priority) }}
Main Information

Request owner, instructor, type, category, and priority.

Requester Name
{{ $creatorName ?: 'N/A' }}
Instructor
{{ $instructorName ?: 'N/A' }}
Supervisor
{{ $supervisorName ?: 'N/A' }}
Team Leader
{{ $teamLeaderName ?: 'N/A' }}
Admin
{{ $displayAdmin?->full_name ?: 'N/A' }}
Request Type
{{ ucfirst($studentRequest->type) }}
Related To
{{ $relatedToLabel }}
Priority
{{ ucfirst($studentRequest->priority) }}
@if ($studentRequest->course_id || $studentRequest->admin_id || $studentRequest->session_id)
{{ $studentRequest->type === 'refund' ? 'Refund Details' : 'Complaint Related Details' }}

{{ $studentRequest->type === 'refund' ? 'Refund and course information connected to this request.' : 'Course, admin, and session information connected to this request.' }}

@if ($studentRequest->course)
Course
{{ $studentRequest->course->course_name_en ?? $studentRequest->course->course_name_ar ?? 'N/A' }}
@endif @if ($displayAdmin)
Admin
{{ $displayAdmin->full_name ?? 'N/A' }}
@endif @if ($studentRequest->sessionDetails)
Session
Session {{ $studentRequest->sessionDetails->session_number ?? 'N/A' }} - {{ $studentRequest->sessionDetails?->session_date ? date('d/m/Y', strtotime($studentRequest->sessionDetails->session_date)) : '' }} @if ($studentRequest->sessionDetails->start_time) {{ substr($studentRequest->sessionDetails->start_time, 0, 5) }} @endif
@endif
@endif @if ($studentRequest->activity_type == 'gift_call' && $studentRequest->schedules->count())
Suggested Gift Call Schedules

Available days and times suggested for the gift call.

@foreach ($studentRequest->schedules as $schedule)
{{ $schedule->day }}
{{ date('h:i A', strtotime($schedule->time)) }}
@endforeach
@endif
Request Content

Subject and full description submitted with this request.

Subject
{{ $studentRequest->subject }}
Description
{!! nl2br(e($studentRequest->description)) !!}
Status Note
{{ $studentRequest->status_note ?: '-' }}
@if ($studentRequest->escalationRequests->isNotEmpty())
Escalations

Escalation status, routed departments, and replies shared with the student.

@foreach ($studentRequest->escalationRequests as $escalation)
{{ $escalation->title ?: 'Escalation #' . $escalation->id }}
{{ $escalation->fromDepartment?->name ?? 'N/A' }} to {{ $escalation->toDepartment?->name ?? 'N/A' }} • {{ $escalation->created_at?->format('d M Y, h:i A') }}
{{ ucfirst(str_replace('_', ' ', $escalation->status)) }}
@if ($escalation->description)
{!! nl2br(e($escalation->description)) !!}
@endif @if ($escalation->notes->isNotEmpty())
@foreach ($escalation->notes as $note)
{{ $note->staff?->full_name ?? trim(($note->staff?->first_name ?? '') . ' ' . ($note->staff?->last_name ?? '')) ?: 'Staff' }} {{ $note->created_at?->format('d M Y, h:i A') }}
{!! nl2br(e($note->content)) !!}
@endforeach
@else
No student-visible escalation notes yet.
@endif
@endforeach
@endif @if ($studentRequest->attachments && count($studentRequest->attachments))
Attachments

Files attached to this request.

@foreach ($studentRequest->attachments as $file) @php $extension = strtolower(pathinfo($file->file_path, PATHINFO_EXTENSION)); $isImage = in_array($extension, ['jpg', 'jpeg', 'png', 'gif', 'webp']); @endphp
@if ($isImage) {{ $file->original_name }} @else
@endif
{{ $file->original_name }}
Download
@endforeach
@endif
@endsection @push('styles') @endpush