@extends('layouts.app') @php $pageTitle = match ($tab) { 'hours' => 'Subject Hours', 'readiness' => 'Scheduling Readiness', default => 'Teacher Load', }; $hours = fn ($value) => number_format((float) $value, 2); $tabs = [ 'load' => ['Teacher Load', 'bi-speedometer2'], 'hours' => ['Subject Hours', 'bi-clock-history'], 'readiness' => ['Readiness', 'bi-clipboard-check'], ]; @endphp @section('content') @if (!$term)
No active School Year and Term is set, so there is nothing to show yet.
@else
@foreach ($tabs as $key => [$label, $icon]) {{ $label }} @endforeach
{{ $schoolYear?->name ?? 'Not Set' }} {{ $term->name }}
@if ($tab === 'hours')
@foreach ($gradeLevels as $gradeLevel) {{ $gradeLevel->name }} @endforeach @forelse ($sections as $section) {{ $section->name }} @empty No active sections under this grade level. @endforelse
@endif
{{-- TEACHER LOAD --}} @if ($tab === 'load') @if (count($load['rows'] ?? []) > 0)
@foreach ($load['rows'] as $row) @foreach (['monday', 'tuesday', 'wednesday', 'thursday', 'friday'] as $day) @endforeach @endforeach
Teacher Weekly Load Mon Tue Wed Thu Fri Entries
{{ $row['teacher']->full_name }} {{ $hours($row['assigned_hours']) }}{{ $hours($row['daily_hours'][$day]) }}{{ $row['total_schedule_entries'] }}
@else
No teacher load data is available for this term.
@endif {{-- SUBJECT HOURS --}} @elseif ($tab === 'hours') @if (!empty($tracker) && $tracker->isNotEmpty())
@foreach ($tracker as $row) @endforeach
Subject Hours/Week Scheduled Remaining Status
{{ $row['subject']->name }} {{ $row['subject']->code }} {{ $hours($row['weekly_hours']) }} {{ $hours($row['scheduled_hours']) }} {{ $hours($row['remaining_hours']) }} {{ ucfirst($row['status']) }}
@else
No required subjects for this section in this term.
@endif {{-- READINESS --}} @else @php $summary = $readiness['summary'] ?? null; $roomRow = $readiness['roomRow'] ?? null; $blockedReasons = [ 'no_teacher' => 'no qualified teacher', 'teacher_conflict' => 'teachers busy elsewhere', 'no_space' => 'not enough grid time', ]; $ok = ''; $bad = ''; @endphp @if ($summary)
{{ $summary['is_ready'] ? 'No blocking readiness issues detected for this term.' : 'One or more readiness issues were found below.' }}
Subject Teacher Coverage
@forelse ($readiness['subjectRows'] as $row) @empty @endforelse
Subject Sections Demand Available Hrs Needed Teachers More Needed Status
{{ $row['subject']->name }} {{ $row['sections_needing'] }} {{ $hours($row['demand_hours']) }} {{ $hours($row['available_hours']) }} {{ $hours($row['needed_more_hours']) }} {{ $row['qualified_teacher_count'] }} {{ $row['teachers_needed_more'] }} {!! $row['status'] === 'ok' && $row['teachers_needed_more'] === 0 ? $ok : $bad !!}
No required subjects found for this term.
Specialized Room Capacity
Demand Supply Ceiling Specialized Rooms Status
{{ $hours($roomRow['demand_hours']) }} {{ $hours($roomRow['supply_hours']) }} {{ $roomRow['specialized_room_count'] }} {!! $roomRow['status'] === 'ok' ? $ok : $bad !!}
Section Grid Capacity
@forelse ($readiness['gridRows'] as $row) @empty @endforelse
Section Required Available Schedulable Unschedulable Blocked Subjects Status
{{ $row['section']->name }} {{ $hours($row['required_hours']) }} {{ $hours($row['available_hours']) }} {{ $hours($row['schedulable_hours']) }} {{ $hours($row['short_hours']) }} @forelse ($row['blocked_subjects'] as $blocked)
{{ $blocked['subject']->name }} ({{ $blockedReasons[$blocked['reason']] ?? $blocked['reason'] }})
@empty - @endforelse
{!! $row['status'] === 'ok' ? $ok : $bad !!}
No active sections found for this year.
@else
No readiness data is available for this term.
@endif @endif
@endif @include('reports.partials._program-styles') @endsection