extend('layout/main_layout') ?> section('content') ?>

Class Attendance

0) { $currentSunday = $sundayDates[count($sundayDates) - 1]; } $historyDates = array_slice($sundayDates, 0, max(0, count($sundayDates) - 1)); $historyDates = array_pad($historyDates, 2, ''); $no_school_days = isset($no_school_days) && is_array($no_school_days) ? $no_school_days : []; $isNoSchoolToday = $currentSunday !== '' && !empty($no_school_days[$currentSunday]); $canEditToday = $canEdit && !$isNoSchoolToday; $btnDisabledAttr = $canEditToday ? '' : ' disabled="disabled"'; $lockedByStudent = isset($locked_by_student) && is_array($locked_by_student) ? $locked_by_student : []; // Derive a header label showing the actual recent dates (instead of generic text) $formatDateLabel = function ($value) { if (!$value) return '—'; $value = (string)$value; if (preg_match('/^(\\d{4})-(\\d{2})-(\\d{2})/', $value, $m)) { return $m[2] . '-' . $m[3] . '-' . $m[1]; } try { return local_date($value, 'm-d-Y'); } catch (Throwable $e) { return $value; } }; $recentHeaderLabel = $currentSunday ? $formatDateLabel($currentSunday) : 'Last Sunday'; // Teacher columns follow the computed Sunday dates (oldest → newest) $teacherDateColumns = $sundayDates; // unified badge rendering function renderStatusBadge($status) { $status = strtolower(trim((string)$status)); if ($status === 'present') return 'Present'; if ($status === 'late') return 'Late'; if ($status === 'absent') return 'Absent'; if ($status === 'no school') return 'No School'; return ''; } // blue tint for entire column $noSchoolClass = fn($date) => $date && !empty($no_school_days[$date]) ? ' style="background-color:#cff4fc;"' : ''; ?>
Teacher Attendance
# Name Role Today Reason
>
> style="font-size:.9rem; padding:4px 6px; width:100%;">
No teachers assigned.
Students Attendance
false,'source'=>null,'reason'=>null,'status'=>$a['today'] ?? null]; $isLocked = !empty($lockInfo['locked']); $lockSource = $lockInfo['source'] ?? ''; $lockLabel = $lockSource === 'parent' ? 'Parent submitted' : ($lockSource === 'admin' ? 'Admin submitted' : 'Locked'); $todayStatus = $lockInfo['status'] ?? ($a['today'] ?? null); ?>
# School ID First Name Last Name Today Reason
> No data
>
style="font-size:.875rem; padding:4px 6px; width:100%;">
No students found
endSection() ?> section('scripts') ?> endSection() ?>