@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: see the comment above the «Расписание преподавателя» card. --}} @section('content')

{{ $teacher['teacher_name'] }}

@if (\App\Support\SessionAuth::role() === 'admin' && in_array($teacher['role'] ?? null, \App\Support\Permissions::EDITABLE_ROLES, true)) {{ __('Права') }} @endif @can('teachers.edit')
@csrf
@endcan

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

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

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

@can('teachers.edit') @endcan
{{-- «Ставки»: per-group rate overriding the default «Ставка» above for lessons this teacher conducts in that group (teacher_group_rates). Blank = use the default. Saved via _action=update_group_rates. Only where MODULE_TEACHER_GROUP_RATES is on (Nomad) — $groupRates is null everywhere else. --}} @if ($groupRates !== null)
{{ __('Ставки') }}

{{ __('Ставка за урок в каждой группе. Пустое поле — используется основная ставка (:price_value).', ['price_value' => $teacher['price_value'] !== null ? $teacher['price_value'].__(' тг') : __('не указана')]) }}

@if (empty($groupRates))

{{ __('У преподавателя нет групп.') }}

@else
@csrf
@foreach ($groupRates as $gr) @endforeach
{{ __('Группа') }} {{ __('Ставка (тг)') }}
{{ $gr['group_name'] }} @if ((int) $gr['is_active'] !== 1) {{ __('неактивна') }} @endif
@can('teachers.edit') @endcan
@endif
@endif
@php $activeGroups = array_values(array_filter($groups, fn ($g) => (int) $g['is_active'] === 1)); @endphp
{{ __('Группы преподавателя') }}
@if (! empty($reassignTeachers) && ! empty($activeGroups)) @endif @if (\App\Support\SessionAuth::role() === 'admin' && ! empty($activeGroups)) @endif
    @foreach ($groups as $group)
  • {{ __('Группа:') }} {{ $group['group_name'] }} @if ((int) $group['is_active'] !== 1) {{ __('неактивна') }} @endif
    {{ __('Предмет:') }} {{ $group['discipline_name'] }}
    {{ __('Уровень:') }} {{ $group['class_name'] }}
    {{ __('Тип обучения:') }} {{ $group['learning_type_name'] }}
  • @endforeach
{{-- Same grid as schedule/teacher.blade.php and the student profile's _schedule_grid: discipline-coloured cells, group badge linking to the group, classroom underneath, today's column highlighted. Matched on start time only (like those two), so a lesson that doesn't start on a timetable slot still shows. Rows are trimmed to the span between the first and last occupied slot, so a teacher with two evening lessons doesn't get a screen of empty morning rows. Own copy of the discipline colour map — keep in sync with the other grids. --}} @php $scheduleColors = [ 'Математика' => '#90EE90', 'Физика' => '#ADD8E6', 'Химия' => '#F08080', 'Казахский язык' => '#FFFFE0', 'История' => '#FFB6C1', 'Биология' => '#D3D3D3', 'Английский язык' => '#FFFFE0', 'География' => '#FFA500', 'Русский язык' => '#008000', 'Информатика' => '#FF0000', 'Всемирная история' => '#FFA500', ]; $scheduleGrid = []; $weeklyLessons = 0; foreach ($groups as $group) { foreach ($group['schedule'] as $scheduleItem) { $slotStart = date('H:i', strtotime($scheduleItem['begin_time'])); foreach ($daysOfWeek as $index => $day) { if (((int) $scheduleItem['weekdays'] & (1 << $index)) !== 0) { $scheduleGrid[$slotStart][$index][] = [ 'group_id' => $group['id'], 'group_name' => $group['group_name'], 'discipline_name' => $group['discipline_name'] ?? '', 'classroom_name' => $scheduleItem['classroom_name'] ?? '', ]; $weeklyLessons++; } } } } // Slot starts that aren't on the timetable still need a row. $slotLabels = []; foreach ($timeSlots as $timeSlot) { $slotLabels[explode(' - ', $timeSlot)[0]] = $timeSlot; } foreach (array_keys($scheduleGrid) as $slotStart) { $slotLabels[$slotStart] ??= $slotStart; } ksort($slotLabels); $occupied = array_keys(array_filter( array_keys($slotLabels), fn ($s) => isset($scheduleGrid[$s]) )); $visibleSlots = $occupied ? array_slice($slotLabels, min($occupied), max($occupied) - min($occupied) + 1, true) : []; $todayIndex = (int) date('N') - 1; @endphp @push('styles') @endpush
{{ __('Расписание преподавателя') }} @if ($weeklyLessons > 0) {{ __('Уроков в неделю: :n', ['n' => $weeklyLessons]) }} @endif
@if ($weeklyLessons > 0) @endif
@if (empty($visibleSlots))
{{ __('Расписание не назначено.') }}
@else {{-- Wrapper is required, not cosmetic: the layout sets body { overflow-x: hidden }, so without a scrollable ancestor the later days are clipped on a phone. --}}
@foreach ($daysOfWeek as $index => $day) @endforeach @foreach ($visibleSlots as $slotStart => $slotLabel) @foreach ($daysOfWeek as $index => $day) @php $lessons = $scheduleGrid[$slotStart][$index] ?? []; $cellColor = $lessons ? ($scheduleColors[$lessons[0]['discipline_name']] ?? '#ffffff') : null; @endphp @endforeach @endforeach
{{ __('Время') }} $index === $todayIndex])>{{ $day }}
{{ $slotLabel }} $lessons, 'ax-today-col' => $index === $todayIndex]) @if ($cellColor) style="background-color: {{ $cellColor }}" @endif> @foreach ($lessons as $lesson)
{{ $lesson['group_name'] }} @if ($lesson['classroom_name'] !== '' && $lesson['classroom_name'] !== null) {{ $lesson['classroom_name'] }} @endif
@endforeach
@endif
@if ($weeklyLessons > 0) @push('scripts') @endpush @endif {{-- Revenue, rent and pay for this teacher's groups: the same figures as «Финансы по группам», so the same key. --}} @if ($financials !== null) @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
@endif
{{-- «Передать группы» — _action=reassign_groups. Only active groups are offered, all ticked; past lessons stay with whoever conducted them. --}} @if (! empty($reassignTeachers) && ! empty($activeGroups)) @endif {{-- «Уволен / ушёл» — _action=teacher_left, admin only. Every active group closes on the picked date (TeacherController::teacherLeftAction() → GroupDeactivation); the teacher's account itself isn't touched. --}} @if (\App\Support\SessionAuth::role() === 'admin' && ! empty($activeGroups)) @endif @endsection