@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. Styled to match admin/schedule/index.blade.php: discipline-coloured cells, badge-styled group link, classroom as the subtext line (where the admin grid shows the teacher), fixed-height centred cells, and the same html2canvas export button. The discipline colour map is its own copy of the one in the admin view's JS — keep the two in sync. --}} @push('styles') @endpush @section('content') @php $colors = [ 'Математика' => '#90EE90', 'Физика' => '#ADD8E6', 'Химия' => '#F08080', 'Казахский язык' => '#FFFFE0', 'История' => '#FFB6C1', 'Биология' => '#D3D3D3', 'Английский язык' => '#FFFFE0', 'География' => '#FFA500', 'Русский язык' => '#008000', 'Информатика' => '#FF0000', 'Всемирная история' => '#FFA500', ]; // Build grid[slotStart][dayIndex] = [lesson, ...] once, instead of // rescanning every group for every cell. $grid = []; foreach ($teacherInfo as $group) { foreach ($group['schedule'] as $scheduleItem) { $scheduleStart = date('H:i', strtotime($scheduleItem['begin_time'])); foreach ($daysOfWeek as $index => $day) { if (($scheduleItem['weekdays'] & (1 << $index)) !== 0) { $grid[$scheduleStart][$index][] = [ 'group_id' => $group['id'], 'group_name' => $group['group_name'], 'discipline_name' => $group['discipline_name'] ?? '', 'classroom_name' => $scheduleItem['classroom_name'] ?? '', ]; } } } } // ISO weekday: Monday = 1 … Sunday = 7, matching $daysOfWeek's 0-based order. $todayIndex = (int) date('N') - 1; @endphp
| Время | @foreach ($daysOfWeek as $index => $day)$index === $todayIndex])>{{ $day }} | @endforeach
|---|---|
| {{ $timeSlot }} | @foreach ($daysOfWeek as $index => $day) @php $lessons = $grid[$slotStart][$index] ?? []; $cellColor = $lessons ? ($colors[$lessons[0]['discipline_name']] ?? '#ffffff') : null; @endphp
@foreach ($lessons as $lesson)
{{ $lesson['group_name'] }}
@if ($lesson['classroom_name'] !== '')
{{ $lesson['classroom_name'] }}
@endif
@endforeach
|
@endforeach