@extends('layouts.app') @section('title', 'Расписание преподавателя') {{-- Ports app/Views/schedule/teacher.php (legacy) — see the Phase 45 plan. Grid match is start-time-only (compares only the slot's start time against each schedule item's begin_time), not the full "HH:00 - HH:50" exact-string match TeacherController::show() uses (Phase 42) — a more lenient match, preserved verbatim. $timeSlots is also irregular (an initial "8:00 - 9:00" slot, then 50-minute slots) — not normalized. --}} @section('content')

Расписание преподавателя

@foreach ($daysOfWeek as $day) @endforeach @foreach ($timeSlots as $timeSlot) @foreach ($daysOfWeek as $index => $day) @endforeach @endforeach
Время{{ $day }}
{{ $timeSlot }} @php $isScheduled = false; $cellParts = []; foreach ($teacherInfo as $group) { foreach ($group['schedule'] as $scheduleItem) { $weekdaysValue = $scheduleItem['weekdays']; if (($weekdaysValue & (1 << $index)) !== 0) { $scheduleStart = date('H:i', strtotime($scheduleItem['begin_time'])); $slotStart = explode(' - ', $timeSlot)[0]; if ($scheduleStart == $slotStart) { $isScheduled = true; $text = $group['group_name']; if (! empty($scheduleItem['classroom_name'])) { $text .= ' ('.$scheduleItem['classroom_name'].')'; } $cellParts[] = $text; } } } } @endphp @if ($isScheduled) @foreach ($cellParts as $part) {{ $part }}
@endforeach @else   @endif
@endsection