@php $name = $profile['full_name'] ?? 'Student'; $upsi = $profile['upsi_id'] ?? '-'; $faculty = $profile['faculty'] ?? $profile['department'] ?? 'UPSI'; $rolePath = 'student'; // STUDENT DEFAULT ALLOCATION = RM100 $defaultTotal = 100; $total = (float)($allocation['total_amount'] ?? $defaultTotal); $used = (float)($allocation['used_amount'] ?? 0); // kalau balance_amount kosong/null, kira sendiri $balance = isset($allocation['balance_amount']) ? (float)$allocation['balance_amount'] : max($total - $used, 0); $percent = $total > 0 ? min(100, round(($used / $total) * 100)) : 0; $remainingPercent = $total > 0 ? min(100, ($balance / $total) * 100) : 0; $mainAppt = $appointment ?? null; $queueNo = $mainAppt['queue_number'] ?? null; $roomNo = $mainAppt['room_number'] ?? ($queueNo ? preg_replace('/\d{3}$/', '', $queueNo) : '-'); $apptDate = $mainAppt['appointment_date'] ?? null; $apptTime = $mainAppt['appointment_time'] ?? null; $apptType = $mainAppt['appointment_type'] ?? 'Dental Check-Up'; $totalVisits = count($treatments ?? []); @endphp

Dashboard

— Student Portal
{{ now()->format('D, d M Y') }}
🔔 ⚙️

WELCOME BACK👋

{{ $name }}

Student ID: {{ $upsi }} · {{ $faculty }}

ANNUAL ALLOCATION

RM{{ number_format($balance,2) }}

of RM{{ number_format($total,2) }} remaining

NEXT APPOINTMENT

{{ $mainAppt ? date('d M, g:i A', strtotime($apptDate.' '.$apptTime)) : '-' }}

{{ $mainAppt ? $apptType.' · Room '.$roomNo : 'No appointment' }}

QUEUE NUMBER

{{ $queueNo ?? '-' }}

{{ $mainAppt ? 'Room '.$roomNo.' · '.ucfirst($mainAppt['status'] ?? 'Waiting') : 'No queue' }}

TOTAL VISITS

{{ $totalVisits }}

Annual record

QUICK ACTIONS

Book Appointment

Book a dental appointment

Walk-In

Check same-day availability

Live Queue

View current queue status

Upcoming Appointments

View All →
@forelse($appointments as $appt) @php $date = $appt['appointment_date'] ?? null; $month = $date ? strtoupper(date('M', strtotime($date))) : '-'; $day = $date ? date('d', strtotime($date)) : '-'; $q = $appt['queue_number'] ?? '-'; $r = $appt['room_number'] ?? ($q !== '-' ? preg_replace('/\d{3}$/', '', $q) : '-'); @endphp
{{ $month }}{{ $day }}

{{ $appt['appointment_type'] ?? 'Dental Check-Up' }}

{{ $date ? date('d M Y', strtotime($date)) : '-' }} · {{ isset($appt['appointment_time']) ? date('g:i A', strtotime($appt['appointment_time'])) : '-' }} · Room {{ $r }}

{{ $q }} {{ ucfirst($appt['status'] ?? 'Upcoming') }}
@empty
No upcoming appointment yet.
@endforelse

Queue Status

View Queue →
{{ $queueNo ?? '-' }}
{{ $queueNo ? 'Room '.$roomNo : 'No Active Queue' }}

{{ $queueNo ? 'Queue number will be active after check-in at PKU counter.' : 'Queue will appear after appointment check-in at PKU counter.' }}

Open Live Queue

Allocation Usage Overview

View Details →

{{ $percent ?? 0 }}%

Used

Used RM{{ number_format($used ?? 0, 2) }}

Remaining RM{{ number_format($balance ?? 0, 2) }}

Total Allocation

RM{{ number_format($total ?? 0, 2) }}

Clinic Announcements

View All →

Clinic Notice

Please check appointment availability before visiting the dental counter.

● ○ ○ ○