@extends('reports._shell') @php /** * Render helpers for the PDF. Keeps the Blade above light and never prints * raw legacy tokens (e.g. "27|16:30|18:30") or ISO timestamps. */ $to12h = function ($t) { if (!$t) return ''; if (!preg_match('/^(\d{1,2}):(\d{2})/', $t, $m)) return $t; $h = (int) $m[1]; $mm = $m[2]; $suffix = $h >= 12 ? 'PM' : 'AM'; $h = $h % 12; if ($h === 0) $h = 12; return "{$h}:{$mm} {$suffix}"; }; $modeLabel = fn ($m) => strcasecmp((string) $m, 'Offline') === 0 ? 'In Person' : ($m ?: '—'); $statusLabel = fn ($s) => $s === 'Added' ? 'Active' : ($s ?: '—'); $fmtDate = function ($d) { if (!$d) return ''; try { return \Carbon\Carbon::parse($d)->format('M j, Y'); } catch (\Throwable $e) { return $d; } }; $gradeLabel = fn ($g) => (ctype_digit((string) $g) ? "Grade $g" : (string) $g); @endphp @section('summary')
| Student | Class | Grade & Subject | Staff | Day | Time | Mode | Location | From | To | Status |
|---|---|---|---|---|---|---|---|---|---|---|
|
{{ $r['student_name'] ?? '—' }} ID {{ $r['reference_id'] ?: $r['student_id'] }}@if($r['school_grade']) · {{ $gradeLabel($r['school_grade']) }}@endif |
{{ $r['class_name'] ?: ('Class ' . $r['class_id']) }} {{ $r['class_code'] ?: 'Class ID ' . $r['class_id'] }} |
{{ is_array($r['class_grades']) ? implode(', ', array_map($gradeLabel, $r['class_grades'])) : $r['class_grades'] }} {{ is_array($r['class_subjects']) ? implode(', ', $r['class_subjects']) : $r['class_subjects'] }} |
{{ $r['staff_name'] ?? '—' }} | {{ $r['day'] ?? '—' }} | {{ $r['start_time'] ? $to12h($r['start_time']) . '–' . $to12h($r['end_time']) : '—' }} | {{ $modeLabel($r['study_mode']) }} | {{ $r['location'] ?? 'Not assigned' }} | {{ $fmtDate($r['start_date']) ?: '—' }} | {{ $fmtDate($r['end_date']) ?: 'Ongoing' }} | @php $label = $statusLabel($r['assignment_status']); @endphp @if($label === 'Active') Active @elseif(in_array($label, ['Removed', 'Cancelled'])) {{ $label }} @else {{ $label }} @endif |
| No records match the current filters. | ||||||||||