@php $tenant = \App\Support\Facades\Tenancy::get(); $brandStyle = $tenant->brand_primary_color ? ":root { --color-brand-600: {$tenant->brand_primary_color}; } .dark { --color-brand-600: {$tenant->brand_primary_color}; }" : null; // Same grid shape as the Timetable Builder page: rows are the distinct start-time // bands actually defined, columns are the days that have at least one slot — // rotated to start from the school's own week-start day (Tenant::week_start_day, // set in Branding settings) rather than always Monday, so e.g. a Sat–Thu week // shows Sat first instead of Mon. $weekStartDay = $tenant->week_start_day ?? 1; $daysPresent = $slots->pluck('day_of_week')->unique()->values() ->sortBy(fn ($day) => ($day - $weekStartDay + 7) % 7) ->values(); $timeBands = $slots->pluck('start_time')->map(fn ($t) => $t->format('H:i'))->unique()->sort()->values(); @endphp @php $reopenEdit = $errors->any() && old('_test_slot_id'); $generateResult = session('status') && str_contains(session('status'), 'slot(s) generated') ? session('status') : null; @endphp
any() ? "'form'" : 'null') }}, editing: {{ $reopenEdit ? Illuminate\Support\Js::from(['id' => old('_test_slot_id')]) : 'null' }} }"> @if($shifts->isEmpty())
Create a shift first before adding timetable slots.
@elseif($shifts->count() > 1) @endif @if($slots->isEmpty())
{{ $selectedShiftId ? 'No timetable slots yet for this shift.' : 'No timetable slots yet.' }}
@else
@foreach($daysPresent as $day) @endforeach @foreach($timeBands as $band) @foreach($daysPresent as $day) @php $slot = $slots->first(fn ($s) => $s->day_of_week === $day && $s->start_time->format('H:i') === $band); @endphp @endforeach @endforeach
Time{{ \App\Models\TimetableSlot::DAYS[$day] }}
{{ $band }} @if($slot)
@if($slot->isBreak()) @endif

{{ $slot->label ?? $slot->dayName().' '.$band }}

{{ $slot->start_time->format('H:i') }} – {{ $slot->end_time->format('H:i') }}

@unless($slot->isBreak())

{{ $slot->shift->name }} ({{ $slot->shift->branch->name }})

@endunless
@else — @endif
@endif @if($generateResult) @php preg_match('/(\d+) slot\(s\) generated/', $generateResult, $createdMatch); preg_match('/(\d+) skipped/', $generateResult, $skippedMatch); $createdCount = (int) ($createdMatch[1] ?? 0); $skippedCount = (int) ($skippedMatch[1] ?? 0); @endphp

{{ $createdCount > 0 ? $createdCount.' slot(s) generated' : 'No new slots generated' }}

@if($skippedCount > 0) {{ $createdCount }} slot(s) were created. {{ $skippedCount }} were skipped because they overlapped a slot that already existed for that shift and day. @else {{ $createdCount }} slot(s) were created for the days and shift you picked. @endif

@endif
@csrf @error('start_time')

{{ $message }}

@enderror
@csrf

Fills in every period and break for the days you pick, so you don't have to add each one by hand. Existing slots that would overlap are skipped automatically.

Just reorders the days below to match how your school's week runs — doesn't change what gets generated.

Regular Day

No break will be added — there aren't enough periods to reach period . Lower this number or increase the period count.

This schedule runs past midnight. If you meant a morning start time, double-check your time picker didn't select PM instead of AM.

No break will be added — there aren't enough periods to reach period . Lower this number or increase the period count.

Generate these slots?

Heads up: this schedule runs past midnight — double-check your Start Time is really AM if you meant morning.