@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'))
{{ __('Одноразовый пароль ученика — показывается только сейчас') }}
{{ __('Логин:') }} {{ session('temp_password')['login'] }}
{{ __('Пароль:') }} {{ session('temp_password')['password'] }}
{{ __('Передайте ученику лично. Пароль действует :value дней и только для первого входа — после входа ученик придумает свой. Если пароль потерялся, создайте новый.', ['value' => \App\Services\StudentTempPassword::TTL_DAYS]) }}
@endif @if (!$studentInfo)
{{ __('Информация о студенте не найдена.') }}
@else {{-- SECTION 1 — Main info --}}
{{ __('Общая информация') }}
@if (\App\Support\Modules::enabled('student_password'))
@csrf
@endif @can('students.streak_freeze.grant') {{-- StudentProfileController::grantStreakFreeze(). --}}
@csrf
@endcan @can('students.reward') @endcan @if ($can['students.delete']) @endif
{{-- Удаление ученика — 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']) @endif
@if ($avatarUrl = \App\Support\StudentAvatar::url((int) $studentInfo->id, $studentInfo->avatar_path ?? null)) @else {{ mb_strtoupper(mb_substr($studentInfo->last_name, 0, 1).mb_substr($studentInfo->first_name, 0, 1)) }} @endif

{{ trim($studentInfo->last_name.' '.$studentInfo->first_name.' '.($studentInfo->middle_name ?? '')) }} @if (! empty($studentInfo->nickname)) «{{ $studentInfo->nickname }}» @endif

@if (!empty($studentInfo->status_name)) {{ $studentInfo->status_name }} @endif
{{ __('Фамилия') }}
{{ $studentInfo->last_name ?: '—' }}
{{ __('Имя') }}
{{ $studentInfo->first_name ?: '—' }}
{{ __('Класс') }}
{{ $studentInfo->class_name ?? '—' }}
{{ __('Язык обучения') }}
{{ $studentInfo->language_name ?? '—' }}
{{ __('Формат обучения') }}
{{ $studentInfo->learning_type_name ?? '—' }}
{{ __('Цель') }}
—
{{ __('Статус') }}
{{ $studentInfo->status_name ?? '—' }}
{{ __('Кол-во договоров') }}
—
{{ __('Никнейм') }}
{{ $studentInfo->nickname ?? '—' }}
{{ __('О себе') }}
{!! nl2br(e($studentInfo->description ?? '—')) !!}
{{-- 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)))
@csrf {{ __('Сбросить профиль ученика:') }} @foreach (['nickname' => __('никнейм'), 'description' => __('описание'), 'avatar_path' => __('фото')] as $field => $label) @if (! empty($studentInfo->{$field}))
@endif @endforeach
@endif
{{-- SECTION 2 — Contacts --}}
{{ __('Контакты') }} @if ($can['students.responsibles.edit']) @endif
{{ __('Телефон студента') }}
{{ $studentInfo->phone ?? '—' }}
@if (\App\Support\Modules::enabled('student_iin'))
{{ __('ИИН') }}
{{ $studentInfo->iin ?? '—' }}
@endif
{{ __('Email для входа') }}
{{ $studentInfo->login_email ?? '—' }}
@if (\App\Support\Modules::enabled('student_agreement_number'))
{{ __('Номер договора') }}
{{ $studentInfo->agreement_number ?? '—' }}
@endif
{{ __('Цель') }}
{!! nl2br(e($studentInfo->goal ?? '—')) !!}
{{ __('Фамилия родителя') }}
{{ $studentInfo->agent_last_name ?? '—' }}
{{ __('Имя родителя') }}
{{ $studentInfo->agent_first_name ?? '—' }}
{{ __('Телефон родителя') }}
{{ $studentInfo->agent_phone_number ?? '—' }}
@if ($can['students.responsibles.edit'])
{{ __('Куратор') }}
{{ trim($responsibles->curator_fullname ?? '—') }}
{{ __('Менеджер') }}
{{ trim($responsibles->manager_fullname ?? '—') }}
@endif
{{-- SECTION 3 — Indicators --}}
{{ __('Показатели') }}
{{ __('Дата добавления') }}
{{ $studentInfo->created_at ? date('d.m.Y', strtotime($studentInfo->created_at)) : '—' }}
{{ __('Последний урок') }}
{{ $lastLessonDate ? date('d.m.Y', strtotime($lastLessonDate)) : '—' }}
{{ __('Часов в :value', ['value' => config('app.name')]) }}
{{ $hoursInAxioma }}
{{ __('Посещаемость') }}
{{ $attendancePct }}%
{{ __('Опозданий') }}
{{ $latenessCount }}
{{ __('Пропусков') }}
{{ $absences }}
{{ __('Средний балл КР/ДЗ') }}
{{ $avgKrDz ?? '—' }}
{{ __('Средний балл тестов') }}
{{ $avgTestScore ?? '—' }}
{{-- SECTION 4 — Finance & Gamification (admin only) --}} @if ($can['payments.view']) @php $totalPaid = (float) ($balance->total_paid ?? 0); $totalCharged = (float) ($balance->total_charged ?? 0); $net = $totalPaid - $totalCharged; if ($net >= 0) { $payStatusLabel = __('Оплачено'); $payStatusClass = 'success'; } elseif ($net > -5000) { $payStatusLabel = __('Частично'); $payStatusClass = 'warning'; } else { $payStatusLabel = __('Долг'); $payStatusClass = 'danger'; } @endphp
{{ __('Финансы и геймификация') }}
@can('payments.create') @endcan @can('charges.create') @endcan
{{ __('Финансы') }}
{{ __('Оплачено (всё время)') }}
{{ number_format($totalPaid, 0, ',', ' ') }} ₸
{{ __('Долг за год') }}
{{ number_format(abs($annualDebt), 0, ',', ' ') }} ₸
{{ __('Статус оплаты') }}
{{ $payStatusLabel }}

{{ __('Жалобы и похвалы') }}
{{ __('Похвалы') }}
{{ $praiseCount }}
{{ __('Жалобы') }}
{{ $complaintCount }}

{{ __('Геймификация') }}
{{ __('Имя героя') }}
—
{{ __('Опыт (XP)') }}
—
{{ __('Монеты') }}
—

{{ __('Геймификация пока не настроена для этого студента.') }}

@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

{{ __('Отсчёт с:') }} {{ $cycleStart ? date('d.m.Y', strtotime($cycleStart)) : '—' }} {{ $fromPeriodEnd ? __('(конец оплаченного периода)') : __('(дата последней оплаты)') }}

{{ __('Скидка за лояльность:') }} {{ $studentInfo->discount_percent > 0 ? $studentInfo->discount_percent.'%' : __('Без скидки') }}
@csrf @foreach (\App\Models\StudentLessonSchedule::KINDS as $kind => $kindLabel) @php $schedule = $paymentSchedules[$kind]; // students.general_tariff_* / individual_tariff_* — the tariff // this table's lessons are measured against. $tp = $kind === 'group' ? 'general' : 'individual'; $tariffName = $studentInfo->{$tp.'_tariff_name'} ?? null; $tariffPrice = (float) ($studentInfo->{$tp.'_tariff_price'} ?? 0); $tariffLessons = (int) ($studentInfo->{$tp.'_tariff_lessons_count'} ?? 0); @endphp
{{ $kindLabel }}
@if (!empty($tariffName))
{{ __(':kind тариф:', ['kind' => $kind === 'group' ? __('Групповой') : __('Индивидуальный')]) }} {{ preg_replace('/^\[manual\]\s*/', '', $tariffName) }}  ·  {{ number_format($tariffPrice, 0, ',', ' ') }} ₸ / {{ __(':n уроков', ['n' => $tariffLessons]) }} @if ($tariffLessons > 0) {{ __('(:tariffprice ₸/ур.)', ['tariffprice' => number_format($tariffPrice / $tariffLessons, 0, ',', ' ')]) }} @endif
@else {{ __(':kind тариф не назначен', ['kind' => $kind === 'group' ? __('Групповой') : __('Индивидуальный')]) }} @endif {{-- type="button": this sits inside the schedule form now, and a default submit button would post the schedule instead. --}}
{{ __('Уроков по :kind тарифу', ['kind' => $kind === 'group' ? __('общему') : __('индивидуальному')]) }}
{{ $schedule['quota'] ?? '—' }}
{{ __('Следующая оплата') }}
{{ $schedule['next_due_date'] ? date('d.m.Y', strtotime($schedule['next_due_date'])) : '—' }}
@foreach ($weekdayBits as $bit => $label) @endforeach @foreach ($weekdayBits as $bit => $label) @endforeach
{{ $label }}
@endforeach
@include('students._billing_effective_date')
@include('students._billing_changes', ['billingChanges' => $billingChanges ?? []]) {{-- Packet: a tariff paid for a fixed period entered by hand — no lesson schedule and no day counting. --}}
{{ __('Пакет') }}
@if (!empty($studentInfo->packet_tariff_name))
{{ __('Пакетный тариф:') }} {{ $studentInfo->packet_tariff_name }}  ·  {{ number_format((float) $studentInfo->packet_tariff_price, 0, ',', ' ') }} ₸  ·  {{ __('с') }} {{ $studentInfo->packet_start_date ? date('d.m.Y', strtotime($studentInfo->packet_start_date)) : '—' }} {{ __('по') }} {{ $studentInfo->packet_end_date ? date('d.m.Y', strtotime($studentInfo->packet_end_date)) : '—' }}
@else {{ __('Пакетный тариф не назначен') }} @endif
@endif {{-- SCHEDULE --}} @include('students._schedule_grid') {{-- GROUPS --}}
{{ __('Группы студента') }}
@if ($can['groups.members.manage']) @endif
@if (!empty($groupInfo['active']) || !empty($groupInfo['inactive'])) @foreach ($groupInfo['active'] as $group) @include('students._group_card', ['group' => $group]) @endforeach @if (!empty($groupInfo['inactive']))
@foreach ($groupInfo['inactive'] as $group) @include('students._group_card', ['group' => $group]) @endforeach
@endif @else
{{ __('Студент не состоит ни в одной группе.') }}
@endif {{-- Weekly test results --}} @if ($can['students.weekly_tests.view'])
{{ __('Результаты еженедельных тестов') }}
@if (!empty($weeklyResults))
@foreach ($weeklyResults as $res) @php $scoreText = $res->score !== null ? "{$res->score}/{$res->max_score}" : __('не сдавал'); $passed = $res->score !== null && $res->score >= ($res->max_score / 2); $bgColor = $res->score === null ? '#6c757d' : ($passed ? '#28a745' : '#dc3545'); $tooltip = __('Дата: ').date('d.m.Y', strtotime($res->lesson_date ?? '')). "\n".__('Учитель:').' '.($res->teacher_name ?? '—'). "\n".__('Результат:').' '.$scoreText; @endphp
{{ $scoreText }}
@endforeach
@else

{{ __('Нет результатов тестов.') }}

@endif
@endif {{-- ЕНТ results: null when the viewer isn't admin/adviser or the instance doesn't enter ЕНТ scores (MODULE_ADMIN_ENT_SCORES) — see show(). Same numbers and formatting as /teacher/ent_results.php, for one student. --}} @if ($entResults !== null) @php $entFmt = fn ($value) => rtrim(rtrim(number_format((float) $value, 1, '.', ' '), '0'), '.'); $entSigned = fn ($value) => ($value >= 0 ? '+' : '−') . $entFmt(abs($value)); $entTone = fn ($value) => $value === null ? 'ax-metric-value--dummy' : ($value >= 0 ? 'text-success' : 'text-danger'); @endphp
{{ __('Результаты ЕНТ') }}
@if (empty($entResults['attempts']))

{{ __('Нет результатов ЕНТ.') }}

@else
{{ __('Попыток') }}
{{ count($entResults['attempts']) }}
{{ __('Последний') }}
{{ $entFmt($entResults['latest']['total']) }}
{{ date('d.m.Y', strtotime($entResults['latest']['date'])) }}
Δ {{ __('к предыдущему') }}
{{ $entResults['delta'] === null ? '—' : $entSigned($entResults['delta']) }}
{{ __('С первой попытки') }}
{{ $entResults['total_delta'] === null ? '—' : $entSigned($entResults['total_delta']) }}
{{ __('Ср. прогресс') }}
{{ $entResults['avg_delta'] === null ? '—' : $entSigned($entResults['avg_delta']) }}
{{ __('Лучший') }}
{{ $entFmt($entResults['best']) }}
@foreach ($entResults['attempts'] as $attempt) @endforeach
{{ __('Дата') }} {{ __('Итого') }} Δ {{ __('По предметам') }} {{ __('Заметка') }}
{{ date('d.m.Y', strtotime($attempt['date'])) }} {{ $entFmt($attempt['total']) }} @if ($attempt['max_total'] > 0) / {{ $entFmt($attempt['max_total']) }} @endif @if ($attempt['delta'] === null) — @else {{ $entSigned($attempt['delta']) }} @endif @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'] ?: '—' }}
@endif
@endif {{-- Frozen days --}} @if ($can['students.frozen_days.manage'])
{{ __('Замороженные дни') }}
@if ($frozenDays)
@foreach ($frozenDays as $freeze) @endforeach
{{ __('С') }}{{ __('По') }}{{ __('Причина') }}{{ __('Действие') }}
{{ $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. --}}
@csrf
@else

{{ __('Нет замороженных дней.') }}

@endif
{{ __('Добавить заморозку') }}
@csrf
@endif {{-- Status history --}} @if ($can['students.status_history.view'])
{{ __('История статусов') }}
@if ($statusHistory)
@foreach ($statusHistory as $change) @endforeach
{{ __('Дата и время') }}{{ __('Было') }}{{ __('Стало') }}{{ __('Причина') }}{{ __('Кто изменил') }}
{{ date('d.m.Y H:i', strtotime($change->created_at)) }} @if ($change->old_status_name) {{ $change->old_status_name }} @else — @endif @if ($change->new_status_name) {{ $change->new_status_name }} @else — @endif {{ $change->reason_name ?? '—' }} {{ $change->changed_by_name ?? '—' }}
@else

{{ __('Изменений статуса ещё не было.') }}

@endif
@endif {{ __('Вернуться на панель') }} @endif {{-- end $studentInfo check --}}
{{-- MODALS --}} @can('students.reward') {{-- StudentRewardController::store(). --}} @endcan @if (\App\Support\Modules::enabled('student_password')) @endif @if ($can['payments.view']) @endif @if ($can['students.responsibles.edit']) @endif @if ($can['payments.create']) @endif @if ($can['charges.create']) @endif @if ($can['groups.members.manage']) @endif @if ($can['students.tariffs.edit']) @endif @endsection @push('scripts') @endpush