{{-- Staff Timetable — All Staff Compact PDF. One combined document, single top header, no per-staff summary cards, no admin review, days-with-classes only. --}} {{ $title }} @php $to12h = function ($t) { if (!$t) return ''; try { return \Carbon\Carbon::parse($t)->format('g:i A'); } catch (\Throwable $e) { return $t; } }; $fmtDate = function ($d) { if (!$d) return ''; try { return \Carbon\Carbon::parse($d)->format('D, M j, Y'); } catch (\Throwable $e) { return $d; } }; $fmtDayShort = function ($d) { if (!$d) return ''; try { return \Carbon\Carbon::parse($d)->format('l, M j'); } catch (\Throwable $e) { return $d; } }; $locFilter = $filters['location_ids'] ?? ($filters['location_id'] ?? null); $locSummary = 'All permitted locations'; if (is_array($locFilter) && !empty($locFilter)) { $names = \Illuminate\Support\Facades\DB::table('location_tables') ->whereIn('id', $locFilter)->pluck('location_name')->all(); if (!empty($names)) { $locSummary = count($names) === 1 ? ('Location: ' . $names[0]) : ('Locations: ' . implode(', ', $names)); } } $rangeText = $fmtDate($data['range']['from'] ?? null) . ' – ' . $fmtDate($data['range']['to'] ?? null); $includeIds = !empty($includeIds); @endphp
STEP UP ACADEMY OF LEARNING
ALL STAFF WEEKLY TIMETABLE
Week: {{ $rangeText }}
{{ $locSummary }}
Generated: {{ $generatedAt }}
@if(empty($data['staff']))

No staff/classes match the current filters.

@endif @foreach($data['staff'] as $idx => $st) @php $daysWithClasses = array_values(array_filter($st['days'], fn($d) => !empty($d['classes']))); @endphp @continue(empty($daysWithClasses))
{{ strtoupper($st['staff_name']) }}
@php $locs = $st['summary']['locations'] ?? []; $sub = !empty($locs) ? implode(', ', $locs) : ''; @endphp @if($sub !== '')
{{ $sub }}
@endif @php $first = $daysWithClasses[0]; @endphp
{{ $fmtDayShort($first['date']) }}
@foreach($first['classes'] as $c)
☐ {{ $to12h($c['start_time']) }} – {{ $to12h($c['end_time']) }} · {{ $c['mode'] ?: '—' }} · {{ $c['location'] ?: 'Not assigned' }} · {{ $c['enrolled_count'] }}/{{ $c['capacity'] ?? '—' }} @if($includeIds) Class {{ $c['class_id'] }} · Occ {{ $c['occurrence_id'] }} @endif
@if(empty($c['students']))
⚠ No students assigned
@else
@foreach($c['students'] as $s)
☐ {{ $s['student_name'] }} @if(!empty($s['grade'])) — GR {{ $s['grade'] }}@endif @if(!empty($s['subject'])) — {{ $s['subject'] }}@endif @php $b = $s['billing'] ?? null; @endphp @if($b && ($b['type'] ?? null)) — {{ $b['label'] }} — {{ $b['formatted_amount'] ? ($b['formatted_amount'] . ($b['frequency_label'] ?? '')) : 'Amount not set' }} @elseif($b) — Billing not configured @endif
@endforeach
@endif
@endforeach
@for($i = 1; $i < count($daysWithClasses); $i++) @php $day = $daysWithClasses[$i]; @endphp
{{ $fmtDayShort($day['date']) }}
@foreach($day['classes'] as $c)
☐ {{ $to12h($c['start_time']) }} – {{ $to12h($c['end_time']) }} · {{ $c['mode'] ?: '—' }} · {{ $c['location'] ?: 'Not assigned' }} · {{ $c['enrolled_count'] }}/{{ $c['capacity'] ?? '—' }} @if($includeIds) Class {{ $c['class_id'] }} · Occ {{ $c['occurrence_id'] }} @endif
@if(empty($c['students']))
⚠ No students assigned
@else
@foreach($c['students'] as $s)
☐ {{ $s['student_name'] }} @if(!empty($s['grade'])) — GR {{ $s['grade'] }}@endif @if(!empty($s['subject'])) — {{ $s['subject'] }}@endif @php $b = $s['billing'] ?? null; @endphp @if($b && ($b['type'] ?? null)) — {{ $b['label'] }} — {{ $b['formatted_amount'] ? ($b['formatted_amount'] . ($b['frequency_label'] ?? '')) : 'Amount not set' }} @elseif($b) — Billing not configured @endif
@endforeach
@endif
@endforeach @endfor
@endforeach