@extends('layouts.app') @section('title', 'Информация о преподавателе') {{-- Ports app/Views/admin/teachers/show.php (legacy) + the render() payload from App\Controllers\TeacherController::show() — see the Phase 42 plan. All 4 write actions (update_info/update_price/update_password/delete) post to this same URL with a hidden _action field, dispatched server-side by TeacherController::dispatchAction() — mirroring the legacy closure route exactly. None of the three edit modals repopulate old input on a validation failure (confirmed: legacy's own view never references Old:: for these fields) — only a plain flash message is shown, matching legacy exactly. Schedule grid is rendered server-side with the exact same PHP loop logic as legacy, including its exact-string match on a computed "HH:00 - HH:50" range — a non-hour-aligned begin_time silently never appears in the grid. getGroupsWithSchedule() also has no end_date filter, so stale/expired schedule slots can still render here (both preserved, not fixed). --}} @section('content')

{{ $teacher['teacher_name'] }}

@csrf

Email: {{ $teacher['email'] }}

ИИН: {{ $teacher['iin'] ?? '' }}

Ставка: {{ $teacher['price_value'] !== null ? $teacher['price_value'].' тг' : 'Не указана' }}

Группы преподавателя
    @foreach ($groups as $group)
  • Группа: {{ $group['group_name'] }}
    Предмет: {{ $group['discipline_name'] }}
    Уровень: {{ $group['class_name'] }}
    Тип обучения: {{ $group['learning_type_name'] }}
  • @endforeach
Расписание преподавателя
@foreach ($daysOfWeek as $day) @endforeach @foreach ($timeSlots as $timeSlot) @foreach ($daysOfWeek as $index => $day) @endforeach @endforeach
Время{{ $day }}
{{ $timeSlot }} @php $isScheduled = false; $cellGroupNames = []; foreach ($groups as $group) { foreach ($group['schedule'] as $scheduleItem) { $weekdaysValue = $scheduleItem['weekdays']; if (($weekdaysValue & (1 << $index)) !== 0) { $scheduleTime = $scheduleItem['begin_time']; $scheduleTimeFormatted = date('H:i', strtotime($scheduleTime)) . ' - ' . date('H:i', strtotime('+50 minutes', strtotime($scheduleTime))); if ($scheduleTimeFormatted == $timeSlot) { $isScheduled = true; $cellGroupNames[] = $group['group_name']; } } } } @endphp @if ($isScheduled) @foreach ($cellGroupNames as $gn) {{ $gn }}
@endforeach @else   @endif
@php $finTotalRevenue = array_sum(array_column($financials, 'revenue')); $finTotalRent = array_sum(array_column($financials, 'rent_total')); $finTotalTeacher = array_sum(array_map( fn($r) => ($r['teacher_price'] ?? 0) * $r['lessons_count'], $financials )); $finTotalCosts = $finTotalTeacher + $finTotalRent; $finTotalProfit = $finTotalRevenue - $finTotalCosts; $prevMonth = $finMonth === 1 ? 12 : $finMonth - 1; $prevYear = $finMonth === 1 ? $finYear - 1 : $finYear; $nextMonth = $finMonth === 12 ? 1 : $finMonth + 1; $nextYear = $finMonth === 12 ? $finYear + 1 : $finYear; $baseUrl = "/admin/teacher_admin_info.php?teacher_id={$teacherId}"; @endphp
Финансы по группам
@if (empty($financials))

Нет данных за выбранный период.

@else
Начислено
{{ number_format($finTotalRevenue, 0, ',', ' ') }} ₸
Зарплата (группы)
{{ number_format($finTotalTeacher, 0, ',', ' ') }} ₸
Аренда
{{ number_format($finTotalRent, 0, ',', ' ') }} ₸
Прибыль
{{ number_format($finTotalProfit, 0, ',', ' ') }} ₸
@foreach ($financials as $r) @php $tCost = ($r['teacher_price'] ?? 0) * $r['lessons_count']; $rent = (float) $r['rent_total']; $profit = (float) $r['revenue'] - $tCost - $rent; $margin = (float) $r['revenue'] > 0 ? round(($profit / (float) $r['revenue']) * 100, 1) : 0; @endphp @endforeach
Группа Уроков Студентов Начислено Зарплата Аренда Прибыль Маржа
{{ $r['group_name'] }} {{ $r['lessons_count'] }} {{ $r['student_count'] }} {{ number_format($r['revenue'], 0, ',', ' ') }} {{ number_format($tCost, 0, ',', ' ') }} {{ number_format($rent, 0, ',', ' ') }} {{ number_format($profit, 0, ',', ' ') }} {{ $margin }}%
Итого {{ number_format($finTotalRevenue, 0, ',', ' ') }} {{ number_format($finTotalTeacher, 0, ',', ' ') }} {{ number_format($finTotalRent, 0, ',', ' ') }} {{ number_format($finTotalProfit, 0, ',', ' ') }} {{ $finTotalRevenue > 0 ? round($finTotalProfit / $finTotalRevenue * 100, 1) : 0 }}%
@endif
@endsection