@extends('layouts.staff_dashboard') @section('title', 'Attendance Register') @section('content') @php $totalStudentsCount = $students->count(); $markedHoursList = array_keys($markedHours ?? []); sort($markedHoursList, SORT_NUMERIC); $markedHoursCount = count($markedHoursList); $displayDate = !empty($currentDate) ? \Carbon\Carbon::parse($currentDate)->format('M d, Y') : date('M d, Y'); @endphp
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif
Attendance Register

{{ $courseName ?? 'Course Attendance' }}

Click any hour cell to instantly toggle P ↔ A (right-click for Leave / options), or click an hour header (H1, H2...) to view/clear that hour.

{{ $displayDate }} @if(!empty($departmentName)) {{ $departmentName }} @endif @if(!empty($batchName)) {{ $batchName }} @endif
{{ $totalStudentsCount }}
Total Students
{{ $totalHours ?? 0 }}
Course Hours
{{ $markedHoursCount }}
Marked Hours @if($markedHoursCount > 0) · {{ implode(', ', array_map(fn($h) => 'H'.$h, array_slice($markedHoursList, 0, 4))) }}{{ $markedHoursCount > 4 ? '...' : '' }} @endif
P Present A Absent L Leave - Unmarked
@csrf
@if($students->isEmpty() || empty($totalHours))

No Attendance Records to Display

@if(empty($totalHours)) This course has 0 hours configured. @else No students match your current search criteria. @endif

@else
@for($h = 1; $h <= $totalHours; $h++) @php $isMarked = !empty($markedHours[$h]); @endphp @endfor @foreach($students as $student) @for($h = 1; $h <= $totalHours; $h++) @php $status = $attendanceRecords[$student->id][$h] ?? null; $attDate = isset($attendanceDates[$student->id][$h]) ? $attendanceDates[$student->id][$h] : $currentDate; $cellClass = 'att-cell-none'; $cellLabel = '-'; if ($status === 'Present') { $cellClass = 'att-cell-p'; $cellLabel = 'P'; } elseif ($status === 'Absent') { $cellClass = 'att-cell-a'; $cellLabel = 'A'; } elseif ($status === 'Leave') { $cellClass = 'att-cell-l'; $cellLabel = 'L'; } elseif (!empty($status)) { $cellClass = 'att-cell-p'; $cellLabel = '✓'; } @endphp @endfor @endforeach
Student Name Reg No H{{ $h }}
{{ $student->name }} {{ $student->regno }}
@endif

Update Attendance

- Hour - -

Hour - Summary

{{ $courseName ?? 'Course' }} Total: {{ $totalStudentsCount }}
0
Present (0%)
0
Absent (0%)
0
Unmarked (0%)
@endsection