{{-- 🎈 Background Decor --}}
πŸ“…
⭐
{{-- ⚑ HERO HEADER: Presence Power --}}

Presence Tracker ⚑

You've conquered {{ $daysPresent }} classes this month! Keep it up!

Presence Power {{ number_format($attendanceRate, 0) }}%
Running Late {{ $daysLate }}
Missed Days {{ $daysAbsent }}
{{-- πŸ—ΊοΈ LEFT: DISCOVERY CALENDAR --}}
{{-- Navigation --}}

Adventure Map

⬅️ {{ $currentMonth }} @if($canGoNext) ➑️ @else ➑️ @endif
{{-- Day Headers --}}
@foreach(['Mon','Tue','Wed','Thu','Fri','Sat','Sun'] as $day)
{{ $day }}
@endforeach
{{-- Calendar Grid --}} @php // Safely calculate correct calendar days and Monday-start padding using Carbon $calMonth = \Carbon\Carbon::create($prevMonth->year, $prevMonth->month, 1)->addMonth(); $totalDays = $calMonth->daysInMonth; // dayOfWeekIso is 1 for Mon, 7 for Sun. We subtract 1 to get 0-6 padding blocks. $padDays = $calMonth->dayOfWeekIso - 1; // Map records by day to ensure missing days don't collapse the calendar grid layout $mappedRecords = []; foreach($attendanceRecords as $rec) { $mappedRecords[(int)$rec['day']] = $rec; } @endphp
{{-- Render empty offset tiles for correct start day --}} @for($i = 0; $i < $padDays; $i++)
@endfor {{-- Loop through every chronological day of the month --}} @for($dayNum = 1; $dayNum <= $totalDays; $dayNum++) @php $hasRecord = isset($mappedRecords[$dayNum]); $record = $hasRecord ? $mappedRecords[$dayNum] : null; $status = $record['status'] ?? null; // Fallback securely if the record wasn't provided for this day $isToday = $record['is_today'] ?? $calMonth->copy()->day($dayNum)->isToday(); $isFuture = $record['is_future'] ?? $calMonth->copy()->day($dayNum)->isFuture(); $isAuto = $record['is_auto'] ?? false; $tileClass = 'bg-slate-50 dark:bg-slate-900 text-slate-300'; $emoji = ''; if($isFuture) { $tileClass = 'bg-slate-50/50 dark:bg-slate-900/50 text-slate-200 border-2 border-dashed border-slate-100 dark:border-slate-800'; } elseif($status === 'present') { $tileClass = 'bg-emerald-500 text-white shadow-lg shadow-emerald-200 dark:shadow-none'; $emoji = 'βœ…'; } elseif($status === 'late') { $tileClass = 'bg-amber-400 text-white shadow-lg shadow-amber-200'; $emoji = 'πŸƒ'; } elseif($status === 'absent') { $tileClass = 'bg-rose-500 text-white shadow-lg shadow-rose-200'; $emoji = '❌'; } @endphp
{{ $dayNum }} {{ $emoji }} @if($isAuto)
@endif
@endfor
{{-- Legend --}}
Present
Late
Missed
{{-- πŸ“Š RIGHT: SUBJECT SKILL BARS --}}

πŸ“ˆ Skill Presence

@forelse($subjectAttendance as $subject)
{{ $subject['name'] }} {{ $subject['rate'] }}%
@empty

Start attending classes to level up your skills!

@endforelse
{{-- πŸ“œ RECENT ACTIVITY LOG --}}
πŸ“œ

πŸ•’ Activity Log

@foreach(array_slice($recentAttendanceLogs, 0, 5) as $log)

{{ $log['subject'] }}

{{ $log['date'] }}

@if($log['status'] === 'present') βœ… @elseif($log['status'] === 'late') πŸƒ @else ❌ @endif
@endforeach