@php $role = session('login_role'); $rolePath = $role === 'staff' ? 'staff' : 'student'; $portal = $role === 'staff' ? 'STAFF PORTAL' : 'STUDENT PORTAL'; $filter = request('status', 'all'); $roomsById = []; foreach ($rooms ?? [] as $room) { $roomsById[$room['id']] = $room['room_name']; } $dependentsById = []; foreach ($dependents ?? [] as $dep) { $dependentsById[$dep['id']] = $dep['full_name']; } $filteredAppointments = collect($appointments ?? [])->filter(function($appt) use ($filter) { $status = strtolower($appt['status'] ?? 'confirmed'); if ($filter === 'all') return true; if ($filter === 'upcoming') return in_array($status, ['confirmed', 'pending', 'upcoming']); if ($filter === 'completed') return in_array($status, ['completed', 'attended']); if ($filter === 'cancelled') return $status === 'cancelled'; return true; })->values(); @endphp My Appointments - PKU Dental

My Appointments

{{ now()->format('D, d M Y') }}

My Appointments

Manage all your dental appointments

@if(count($filteredAppointments) > 0) @foreach($filteredAppointments as $appt) @php $apptDate = $appt['appointment_date'] ?? null; $apptTime = $appt['appointment_time'] ?? null; $status = strtolower($appt['status'] ?? 'confirmed'); $ref = $apptDate ? 'PKU-' . date('Ymd', strtotime($apptDate)) . '-' . strtoupper(substr($appt['id'], 0, 4)) : '-'; $roomName = $roomsById[$appt['room_id'] ?? ''] ?? '-'; $patient = $profile['full_name'] ?? '-'; if (!empty($appt['dependent_id']) && isset($dependentsById[$appt['dependent_id']])) { $patient = $dependentsById[$appt['dependent_id']]; } $treatment = $appt['reason'] ?? 'Dental Check-Up'; $isFollowUp = !empty($appt['follow_up_id']) || strtolower($treatment) === 'follow-up appointment'; @endphp @endforeach
REF NO. DATE & TIME PATIENT TREATMENT ROOM QUEUE STATUS ACTION
{{ $ref }} {{ $apptDate ? date('d M Y', strtotime($apptDate)) : '-' }}
{{ $apptTime ? date('g:i A', strtotime($apptTime)) : '-' }}
{{ $patient }}
{{ $treatment }} @if($isFollowUp) @endif
{{ $roomName }} {{ $appt['queue_number'] ?? '-' }} {{ ucfirst($status) }} View →
@else
No appointments found.
@endif