@extends('layouts.student_dashboard') @section('title', 'Attendance Details') @push('styles') @endpush @section('content') @php $hasCourse = isset($attendanceSummary['selected_course']); $courseName = $hasCourse ? ($attendanceSummary['selected_course']->coursename ?? 'Course') : 'Attendance'; $totalHours = (int) ($attendanceSummary['total_hours'] ?? 0); $markedHours = (int) ($attendanceSummary['total_marked_hours'] ?? 0); $presentHours = (int) ($attendanceSummary['present_hours'] ?? 0); $absentHours = (int) ($attendanceSummary['absent_hours'] ?? 0); $attPct = (float) ($attendanceSummary['attendance_percentage'] ?? 0); $presentOfMarked = $markedHours > 0 ? number_format(($presentHours / $markedHours) * 100, 1) : '0.0'; $absentOfMarked = $markedHours > 0 ? number_format(($absentHours / $markedHours) * 100, 1) : '0.0'; $gaugeRadius = 25; $gaugeCircum = 2 * M_PI * $gaugeRadius; $gaugeDashOffset = $gaugeCircum * (1 - (max(0, min(100, $attPct)) / 100)); if ($attPct >= 75) { $gaugeColor = '#22c55e'; $statusClass = 'good'; $statusText = 'Superstar Attendance!'; $statusIcon = 'fa-star'; } elseif ($attPct >= 50) { $gaugeColor = '#f59e0b'; $statusClass = 'warn'; $statusText = 'Keep Showing Up!'; $statusIcon = 'fa-bolt'; } else { $gaugeColor = '#fb7185'; $statusClass = 'low'; $statusText = $markedHours === 0 ? 'Waiting for First Class' : 'Let\'s Catch Up!'; $statusIcon = $markedHours === 0 ? 'fa-clock' : 'fa-heart'; } @endphp
{{-- 1. HERO OVERVIEW BANNER --}}
Change Course

{{ $courseName }}

{{ $studentName ?? 'N/A' }} {{ $studentRegNo ?? 'N/A' }} {{ $markedHours }} / {{ $totalHours }} Hours Marked
{{ $attPct }}%
My Attendance {{ $statusText }}
@if($hasCourse) {{-- 2. KPI SUMMARY CARDS --}}
Total Hours {{ $totalHours }} Planned class hours
Marked Hours {{ $markedHours }} {{ $totalHours > 0 ? round(($markedHours / $totalHours) * 100) : 0 }}% of total hours
Present Stamps {{ $presentHours }} {{ $presentOfMarked }}% of marked
Missed Hours {{ $absentHours }} {{ $absentOfMarked }}% of marked
{{-- 3. COLLECTIBLE STAMP BOARD (HOUR-WISE ATTENDANCE) --}}

My Class Stamp Board

Tap a filter pill to spot your Present, Missed, or upcoming classes

@if($totalHours > 0)
@for($hour = 1; $hour <= $totalHours; $hour++) @php $present = 0; $absent = 0; foreach ($attendanceSummary['monthly_attendance'] as $day) { if (($day[$hour] ?? '') === 'Present') $present++; if (($day[$hour] ?? '') === 'Absent') $absent++; } if ($present === 0 && $absent === 0) { $state = 'unmarked'; $mark = '—'; $tip = "Hour {$hour}: Not Marked"; } elseif ($present > 0 && $absent > 0) { $state = 'mixed'; $mark = 'M'; $tip = "Hour {$hour}: Present ({$present}) / Absent ({$absent})"; } elseif ($absent > 0) { $state = 'absent'; $mark = 'A'; $tip = "Hour {$hour}: Absent"; } else { $state = 'present'; $mark = 'P'; $tip = "Hour {$hour}: Present"; } @endphp
{{ $mark }} H{{ $hour }}
@endfor
@else

No Course Hours Yet

Total course hours are not set up for this course yet.

@endif
@endif
@endsection