@php // Student attendance PDF — Dompdf-compatible: no external assets, // no flexbox, tables + fixed widths. $fmt = fn ($d) => $d ? \Carbon\Carbon::parse($d)->format('M j, Y') : '—'; $fmtTime = fn ($t) => $t ? \Carbon\Carbon::parse($t)->format('g:i A') : ''; $statusPill = function ($status, $lateMin = 0, $earlyMin = 0) { $status = strtolower((string) $status); $lateMin = (int) $lateMin; $earlyMin = (int) $earlyMin; if ($status === 'present' && ($lateMin >= 60 || $earlyMin >= 60)) { [$label, $bg, $fg] = ['Half Day', '#fef3c7', '#92400e']; } elseif ($status === 'late') { [$label, $bg, $fg] = ['Late', '#dbeafe', '#1d4ed8']; } elseif ($status === 'absent') { [$label, $bg, $fg] = ['Absent', '#fee2e2', '#991b1b']; } elseif ($status === 'excused') { [$label, $bg, $fg] = ['Excused', '#e5e7eb', '#4b5563']; } elseif ($status === 'present') { [$label, $bg, $fg] = ['Present', '#dcfce7', '#166534']; } else { [$label, $bg, $fg] = ['—', '#f1f5f9', '#475569']; } return '' . $label . ''; }; @endphp Attendance Report — {{ $student['name'] }}
@php $__brand = trim((string) (config('company.legal') ?: config('company.name', ''))); $__addr1 = trim((string) config('company.address.line1', '')); $__addr2 = trim((string) config('company.address.line2', '')); $__phone = trim((string) config('company.phone', '')); $__brandLn = trim(implode(' · ', array_filter([trim($__addr1 . ' ' . $__addr2), $__phone !== '' ? 'Tel: ' . $__phone : null]))); @endphp
{{ $__brand }}
{{ $__brandLn }}
Attendance Report
Generated {{ $generatedAt }} · By {{ $generatedBy }}
Student {{ $student['name'] }} Grade {{ $student['grade'] ?? '—' }}
Student ID #{{ $student['id'] }} Period {{ $periodLabel }}
Attendance{{ $summary['percentage'] }}% Present {{ $summary['present'] }} Late {{ $summary['late'] }} Absent {{ $summary['absent'] }} Half Day {{ $summary['half_day'] }} Early {{ $summary['early_going'] }}
@if(count($rows) === 0)
No attendance records for this period.
Records will appear here once classes have been marked.
@else @foreach($rows as $r) @endforeach
Date Time Class Status Notes
{{ $fmt($r->date) }} {{ $fmtTime($r->startTime) }} – {{ $fmtTime($r->endTime) }} {{ $r->subject_name ?? '—' }} {!! $statusPill($r->status, $r->lateMinutes ?? 0, $r->earlyLeaveMinutes ?? 0) !!} {{ $r->notes ?? '' }}
@endif @php $__legal = trim((string) (config('company.legal') ?: config('company.name', ''))); $__short = trim((string) (config('company.short') ?: config('company.name', ''))); @endphp