@extends('teacher.teacher_dashboard') @section('admin')

Class Routine For - {{ $teacher->name ?? '--' }}

@php // শনিবার থেকে শুরু করে দিনের নাম $days = ['Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']; @endphp @if($routineTypes->count() > 0) @foreach($routineTypes as $routineType) @php // Group time slots by shift for this routine type $routineTimeSlots = $timeSlots->where('routine_type_id', $routineType->id); $shifts = $routineTimeSlots->groupBy(function($slot) { return $slot->shift ? $slot->shift->name : 'No Shift'; }); @endphp
{{ $routineType->name }}
@foreach($shifts as $shiftName => $shiftSlots)
Shift: {{ $shiftName }}
@foreach($shiftSlots as $slot) @endforeach @foreach($days as $dayIndex => $dayName) @foreach($shiftSlots as $slot) @php $routine = null; if ( isset($routines[$routineType->id]) && isset($routines[$routineType->id][$dayIndex+1]) && isset($routines[$routineType->id][$dayIndex+1][$slot->id]) && is_array($routines[$routineType->id][$dayIndex+1][$slot->id]) && count($routines[$routineType->id][$dayIndex+1][$slot->id]) > 0 ) { $routine = $routines[$routineType->id][$dayIndex+1][$slot->id][0]; } @endphp @endforeach @endforeach
Day {{ $slot->name }}
{{ date('h:i A', strtotime($slot->start_time)) }} - {{ date('h:i A', strtotime($slot->end_time)) }}
{{ substr($dayName,0,3) }} @if($routine) {{ optional($routine->class)->name ?? '' }} {{ optional($routine->section)->name ?? '' }}
{{ optional($routine->subject)->name ?? 'N/A' }} @else Empty @endif
@endforeach @endforeach @else
No active routine types available
@endif
@endsection