@extends('admin.layouts.app') @section('title', 'Class Schedule') @section('breadcrumb') @endsection @section('content')
@if(request('class_id'))
@php $days = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; $grouped = $schedules->groupBy('day_of_week'); @endphp
@foreach($days as $day) @endforeach @php // Collect all unique time slots $times = $schedules->map(fn($s) => $s->start_time)->unique()->sort()->values(); @endphp @forelse($times as $time) @foreach($days as $day) @php $slot = ($grouped[$day] ?? collect())->firstWhere('start_time', $time); @endphp @endforeach @empty @endforelse
Time / Day{{ $day }}
{{ date('h:i A', strtotime($time)) }} @if($slot)
{{ $slot->subject?->name }}
{{ $slot->employee?->user?->name }}
@if($slot->room)
{{ $slot->room }}
@endif
@csrf @method('DELETE')
@endif
No schedule slots yet. Add slots using the button above.
@endif @endsection