@extends('layouts.app')
@section('title', __('Аналитика'))
{{--
Ports app/Views/analytics/index.php (legacy) — see the Phase 49 plan.
The ЕНТ score entry form uses Laravel's own $errors/old() — confirmed
safe since the legacy view genuinely repopulates old input here (via
Old::get()/Old::hasError()/Old::error()).
--}}
@push('styles')
@endpush
@section('content')
{{ __('Период применяется к метрикам за месяц. Отдельные показатели помечены как «на данный момент».') }}
@if ($overview)
{{ __('Обзор') }}
{{ $overview['active_students_asof'] }}
{{ __('Активных на дату') }}
{{ $overview['avg_group_size'] }}
{{ __('Средняя заполняемость группы') }}
{{ $overview['avg_disciplines'] }}
{{ __('Ср. предметов на ученика') }}
{{ $overview['capacity_utilization'] }}%
{{ __('Загрузка мощностей') }}
@isset($overview['overdue_count'])
{{ $overview['overdue_count'] }}
{{ __('Просрочки (сейчас)') }}
@endisset
@endif
@if ($trends)
{{ __('Тренды за 6 месяцев') }}
{{ __('Активных учеников') }}
@isset($trends['revenue'])
@endisset
@isset($trends['renewal_after_first'])
{{-- The two renewal tiles from "Оплаты и выручка", month by month: the
chart carries the rates, the table under it the counts behind
them. A month with nobody in the base (no first-time payers, or
nobody paid the month before) has no rate — shown as a gap in
the line and "—" in the table, not as a 0 %. --}}
{{ __('Продление, %') }}
|
@foreach ($trends['labels'] as $label)
{{ $label }} |
@endforeach
| {{ __('После 1-й оплаты') }} |
@foreach ($trends['renewal_after_first'] as $point)
@if ($point['first_time_payers'] > 0)
{{ $point['rate'] }}%
{{ __(':renewed из :first_time_payers', ['renewed' => $point['renewed'], 'first_time_payers' => $point['first_time_payers']]) }}
@else
—
@endif
|
@endforeach
@isset($trends['period_retention'])
| {{ __('В целом') }} |
@foreach ($trends['period_retention'] as $point)
@if ($point['prev_payers'] > 0)
{{ $point['rate'] }}%
{{ __(':retained из :prev_payers', ['retained' => $point['retained'], 'prev_payers' => $point['prev_payers']]) }}
@else
—
@endif
|
@endforeach
@endisset
@endisset
@endif
@if ($atRisk && (!empty($atRisk['overdue']) || !empty($atRisk['low_nps'])))
@php $atRiskCount = count($atRisk['overdue']) + count($atRisk['low_nps']); @endphp
{{ __('Ученики группы риска') }}
{{ $atRiskCount }}
{{ __('Ученики группы риска') }}
{{ __('Показать список') }} →
@endif
@if ($payments)
{{ __('Оплаты и выручка') }}
{{ number_format($payments['new_student_arpu'], 0, ',', ' ') }} ₸
{{ __('Средний чек новых учеников • :new_student_count новых оплат', ['new_student_count' => $payments['new_student_count']]) }}
@isset($payments['overall_arpu'])
{{ number_format($payments['overall_arpu'], 0, ',', ' ') }} ₸
{{ __('Общий средний чек') }}
@endisset
@isset($payments['all_time_arpu'])
{{ number_format($payments['all_time_arpu'], 0, ',', ' ') }} ₸
{{ __('Средний чек за всё время') }}
@endisset
@isset($payments['avg_study_duration_months'])
{{ __(':avg_study_duration_months мес.', ['avg_study_duration_months' => $payments['avg_study_duration_months']]) }}
{{ __('Средняя длительность учёбы') }}
@endisset
{{ $payments['renewal_after_first']['rate'] }}%
{{ __('% продления после 1-й оплаты • :renewed из :first_time_payers', ['renewed' => $payments['renewal_after_first']['renewed'], 'first_time_payers' => $payments['renewal_after_first']['first_time_payers']]) }}
@isset($payments['period_retention'])
{{ $payments['period_retention']['rate'] }}%
{{ __('% продления в целом • :retained из :prev_payers (пред. период)', ['retained' => $payments['period_retention']['retained'], 'prev_payers' => $payments['period_retention']['prev_payers']]) }}
@endisset
@isset($payments['charges_total'])
{{ number_format($payments['charges_total'], 0, ',', ' ') }} ₸
{{ __('Начисления за месяц') }}
@endisset
@isset($payments['renewal_cohorts'])
@php
$rc = $payments['renewal_cohorts'];
$rcMonths = ['Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'];
@endphp
{{ $rc['total']['second_rate'] !== null ? $rc['total']['second_rate'] . '%' : '—' }}
{{ __('продлили на 2-й месяц • :n из :of', ['n' => $rc['total']['second'], 'of' => $rc['total']['new_2']]) }}
{{ $rc['total']['third_rate'] !== null ? $rc['total']['third_rate'] . '%' : '—' }}
{{ __('продлили на 3-й месяц • :n из :of', ['n' => $rc['total']['third'], 'of' => $rc['total']['new_3']]) }}
| {{ __('Месяц первой оплаты') }} |
{{ __('Новых') }} |
{{ __('2-й месяц') }} |
{{ __('3-й месяц') }} |
{{ __('3-й из продливших') }} |
@foreach (array_reverse($rc['cohorts']) as $c)
| {{ __($rcMonths[(int) substr($c['month'], 5, 2) - 1]) }} {{ substr($c['month'], 0, 4) }} |
{{ $c['new'] }} |
@if ($c['second_rate'] !== null)
{{ $c['second'] }} ({{ $c['second_rate'] }}%)
@elseif ($c['new'] > 0)
{{ $c['second'] }} · {{ __('рано') }}
@else
—
@endif
|
@if ($c['third_rate'] !== null)
{{ $c['third'] }} ({{ $c['third_rate'] }}%)
@elseif ($c['new'] > 0)
{{ $c['third'] }} · {{ __('рано') }}
@else
—
@endif
|
{{ $c['third_of_second'] !== null ? $c['third_of_second'] . '%' : '—' }} |
@endforeach
@endisset
@endif
@if ($finance)
{{ __('Финансы') }}
{{ number_format($finance['net_profit'], 0, ',', ' ') }} ₸
{{ __('Чистая прибыль за месяц') }}
{{ number_format($finance['cac'], 0, ',', ' ') }} ₸
{{ __('CAC (стоимость клиента) • маркетинг :marketing_spend ₸', ['marketing_spend' => number_format($finance['marketing_spend'], 0, ',', ' ')]) }}
@if (empty($finance['expenses_by_category']))
{{ __('Нет расходов за этот период.') }}
@else
@endif
@if (empty($finance['revenue_by_discipline']))
{{ __('Нет начислений за этот период.') }}
@else
@endif
@if (empty($finance['revenue_by_ent']))
{{ __('Нет начислений за этот период.') }}
@else
@endif
@if (empty($finance['revenue_by_learning_type']))
{{ __('Нет начислений за этот период.') }}
@else
@endif
@endif
@if ($teachers)
{{ __('Преподаватели, замены, кураторы') }}
@isset($teachers['substitutions_count'])
{{ $teachers['substitutions_count'] }}
{{ __('Замен за период') }}
@endisset
{{ ($teachers['ent_progress']['avg_delta'] >= 0 ? '+' : '') . $teachers['ent_progress']['avg_delta'] }}
{{ __('Ср. прогресс по ЕНТ • :count учеников с 2+ результатами', ['count' => $teachers['ent_progress']['count']]) }}
{{ $teachers['nps_latest'] }}
{{ __('NPS (последний)') }}
@php $cc = $teachers['curator_completion']; $ccOverall = $cc['overall'] ?? $cc; @endphp
{{ $ccOverall['rate'] }}%
{{ __('Выполнение задач куратором • :resolved из :total', ['resolved' => $ccOverall['resolved'], 'total' => $ccOverall['total']]) }}
@isset($teachers['total_salary'])
@endisset
@if (!empty($teachers['substitutions_by_teacher']))
| {{ __('Преподаватель') }} | {{ __('Заменил') }} | {{ __('Заменился') }} |
@foreach ($teachers['substitutions_by_teacher'] as $row)
| {{ $row['teacher_name'] }} |
{{ $row['covered_for_others'] }} |
{{ $row['was_covered'] }} |
@endforeach
@endif
@if (!empty($teachers['performance']))
| {{ __('Учитель') }} |
{{ __('Уроков') }} |
{{ __('Часы') }} |
{{ __('Заработок') }} |
{{ __('Выручка группы') }} |
{{ __('Посещаемость') }} |
{{ __('Ср. ДЗ') }} |
{{ __('Ср. КР') }} |
{{ __('Замены') }} |
@foreach ($teachers['performance'] as $row)
| {{ $row['teacher_name'] }} |
{{ (int) $row['lessons_count'] }} |
{{ number_format((float) $row['hours'], 1, ',', ' ') }} |
{{ number_format((float) $row['earnings'], 0, ',', ' ') }} ₸ |
{{ number_format((float) $row['revenue'], 0, ',', ' ') }} ₸ |
{{ $row['attendance_pct'] !== null ? (int) $row['attendance_pct'] . '%' : '—' }} |
{{ $row['avg_dz'] ?? '—' }} |
{{ $row['avg_kr'] ?? '—' }} |
{{ $row['covered_for_others'] }} / {{ $row['was_covered'] }} |
@endforeach
@endif
@if (!empty($teachers['ent_by_teacher']))
@php
$entFmt = fn ($v) => rtrim(rtrim(number_format((float) $v, 1, '.', ' '), '0'), '.');
$entSigned = fn ($v) => $v === null ? '—' : (($v > 0 ? '+' : ($v < 0 ? '−' : '')) . $entFmt(abs($v)));
@endphp
| {{ __('Учитель') }} |
{{ __('Предмет') }} |
{{ __('Учеников') }} |
{{ __('Сравнимо') }} |
{{ __('Было → стало') }} |
{{ __('Ср. прогресс') }} |
{{ __('% от макс.') }} |
{{ __('Улучшили') }} |
{{ __('Ср. последний') }} |
@foreach ($teachers['ent_by_teacher'] as $t)
@foreach ($t['subjects'] as $i => $s)
@if ($i === 0)
| {{ $t['teacher_name'] }} |
@endif
{{ $s['name'] }} / {{ $entFmt($s['max_score']) }} |
{{ $s['students'] }} |
{{ $s['compared'] }} |
{{ $s['avg_from'] !== null ? $entFmt($s['avg_from']) . ' → ' . $entFmt($s['avg_to']) : '—' }} |
{{ $entSigned($s['avg_delta']) }} |
{{ $s['avg_delta_pct'] !== null ? $entSigned($s['avg_delta_pct']) . '%' : '—' }} |
{{ $s['compared'] > 0 ? $s['improved'] . ' / ' . $s['compared'] : '—' }} |
{{ $entFmt($s['avg_latest']) }} |
@endforeach
@if (count($t['subjects']) > 1)
| {{ __('Итого') }} |
{{ $t['students'] }} |
{{ $t['compared'] }} |
— |
{{ $entSigned($t['avg_delta']) }} |
{{ $t['avg_delta_pct'] !== null ? $entSigned($t['avg_delta_pct']) . '%' : '—' }} |
{{ $t['compared'] > 0 ? $t['improved'] . ' / ' . $t['compared'] : '—' }} |
— |
@endif
@endforeach
@endif
@if (isset($cc['by_curator']) && !empty($cc['by_curator']))
| {{ __('Куратор') }} | {{ __('Выполнено') }} | {{ __('Всего') }} | % |
@foreach ($cc['by_curator'] as $row)
| {{ $row['curator_name'] }} |
{{ $row['resolved'] }} |
{{ $row['total'] }} |
{{ $row['rate'] }}% |
@endforeach
@endif
@if (isset($teachers['nps_detail']) && !empty($teachers['nps_detail']))
| {{ __('Ученик') }} | {{ __('Оценка') }} | {{ __('Комментарий') }} | {{ __('Дата') }} |
@foreach ($teachers['nps_detail'] as $row)
| {{ $row['first_name'] . ' ' . $row['last_name'] }} |
{{ (int) $row['score'] }} |
{{ $row['comment'] ?? '—' }} |
{{ $row['created_at'] }} |
@endforeach
@endif
@endif
@endsection
@push('scripts')
@if ($trends)
@endif
@if ($finance && !empty($finance['expenses_by_category']))
@endif
@if ($finance && !empty($finance['revenue_by_discipline']))
@endif
@if ($finance && !empty($finance['revenue_by_ent']))
@endif
@if ($finance && !empty($finance['revenue_by_learning_type']))
@endif
@endpush