@extends('layouts.app')
@section('title', __('Информация о студенте'))
{{--
Ports app/Views/student/show.php (legacy, 1716 lines) + the render()
payload from App\Controllers\StudentController::show()
(app/Controllers/StudentController.php:756-959) — see the Phase 8 plan.
Every write form on this page is Laravel-native (@csrf) as of Phase 14 —
payments/charges (PaymentController, Phases 9-10/12), frozen days
(Phase 11), student edit/responsibles (Phase 13), and status
change/tariff assignment (Phase 14) each moved once their last legacy
caller was confirmed gone. The lessonStatusModal's fetch() still has no
CSRF field at all, matching legacy LessonController::updateStudentStatus(),
which never called verifyCsrf() either — its endpoint moved to
LessonAttendanceController::updateStudentStatus() in Phase 27 (the JS
here is unchanged, still posts the same JSON to the same URL).
Role gating below mirrors the legacy view's per-section
in_array($role, [...]) checks exactly — the page itself has no
page-level role restriction (only SessionAuth::check()), which is a
pre-existing gap flagged (not fixed) in the Phase 8 plan.
--}}
@php
$attColorClass = $attendancePct < 50 ? 'ax-metric-value--danger' : ($attendancePct < 80 ? 'ax-metric-value--warning' : 'ax-metric-value--success');
$latenessColorClass = $latenessCount > 0 ? 'ax-metric-value--danger' : '';
$absencesColorClass = $absences > 0 ? 'ax-metric-value--danger' : '';
@endphp
@section('content')
{{-- Shown exactly once, right after StudentProfileController::sendTempPassword():
a one-request flash, and only the hash is stored. An alert, not a toast,
so it doesn't vanish before staff have copied it down. --}}
@if (session('temp_password'))
{{ __('Одноразовый пароль ученика — показывается только сейчас') }}
{{ __('Передайте ученику лично. Пароль действует :value дней и только для первого входа — после входа ученик придумает свой. Если пароль потерялся, создайте новый.', ['value' => \App\Services\StudentTempPassword::TTL_DAYS]) }}
{{--
Удаление ученика — admin only, and only for a student with no
history behind them. StudentProfileController::destroyStudent()
re-checks both server-side and refuses with a message naming
what blocked it; this modal just states the rule up front so an
admin isn't surprised by the refusal.
The two links at the bottom are the escape hatches for a student
who DOES have history (StudentRemovalController): transfer it
to the other row of the same person, or wipe it. Both go
through their own full-page confirm screen, so this modal is
only step 1 for them.
--}}
@if ($can['students.delete'])
{{-- The student fills these in themself (hero page); staff can
only take them down — StudentAboutController::clear(). --}}
@if (in_array($role, ['admin', 'adviser'], true)
&& (! empty($studentInfo->nickname) || ! empty($studentInfo->description) || ! empty($studentInfo->avatar_path)))
@endif
{{ __('Геймификация пока не настроена для этого студента.') }}
@endif
{{-- Payment schedule (lessons per day), plus the student's group/individual
tariffs and loyalty discount (moved here from the finance section and
«Общая информация»). The schedule itself drives only the next-payment-date projection
(App\Services\PaymentScheduleService), not charge calculation. --}}
@if ($can['students.payment_schedule.edit'])
{{ __('График оплаты (уроки по дням)') }}
{{ __('Сколько уроков у студента в каждый день недели — отдельно групповых и индивидуальных: они оплачиваются по разным тарифам (групповой и индивидуальный, указаны в каждой таблице). По каждому графику и количеству уроков в его тарифе считается своя дата следующей оплаты, независимо от начислений выше.') }}
{{-- Same for both kinds: payments carry no tariff of their own. --}}
@php
$cycleStart = $paymentSchedules['group']['cycle_start'] ?? null;
$fromPeriodEnd = $paymentSchedules['group']['from_period_end'] ?? false;
@endphp
@include('students._billing_changes', ['billingChanges' => $billingChanges ?? []])
{{-- Packet: a tariff paid for a fixed period entered by hand —
no lesson schedule and no day counting. --}}
@forelse ($attempt['sections'] as $section)
{{ $section['name'] }}: {{ $entFmt($section['score']) }}/{{ $entFmt($section['max_score']) }}
@empty
{{-- Rows entered before ent_scores.section_id existed have no subject. --}}
{{ __('без разбивки по предметам') }}
@endforelse
{{ $attempt['note'] ?: '—' }}
@endforeach
@endif
@endif
{{-- Frozen days --}}
@if ($can['students.frozen_days.manage'])
{{ __('Замороженные дни') }}
@if ($frozenDays)
{{ __('С') }}
{{ __('По') }}
{{ __('Причина') }}
{{ __('Действие') }}
@foreach ($frozenDays as $freeze)
{{ $freeze->date_from }}
{{ $freeze->date_to }}
{!! nl2br(e($freeze->reason)) !!}
{{-- A plain submit, not js-ajax-form: removing a freeze
recolours lessons and adds charges all over the
page, so it reloads rather than just dropping the row. --}}
@endforeach
@else
{{ __('Нет замороженных дней.') }}
@endif
{{ __('Добавить заморозку') }}
@endif
{{-- Status history --}}
@if ($can['students.status_history.view'])
{{-- Both tables below carry the student's full history (no row cap), so
this filter is what keeps an old account readable: it hides rows by
year client-side and re-totals what's left. --}}