@extends('layouts.app') @section('title', __('Оплаты')) @section('content')

{{ __('Оплаты') }}

@php $extraParams = http_build_query(array_filter([ 'search' => $search, 'amount_min' => $amountMin, 'amount_max' => $amountMax, ], fn ($v) => $v !== '')); @endphp
←
—
→
{{ number_format($totalAmount, 0, ',', ' ') }} ₸
{{ __('Всего оплачено за период') }} • {{ $payments->total() }} {{ __('платежей') }}
@if ($search || $amountMin !== '' || $amountMax !== '') × @endif
@if ($payments->isNotEmpty())
@foreach ($payments as $p) @endforeach
# {{ __('Ученик') }} {{ __('Тип') }} {{ __('Сумма') }} {{ __('Дата') }} {{ __('Описание') }}
{{ $p->id }} {{ $p->student->last_name }} {{ $p->student->first_name }} @if ($p->student->phone)
{{ $p->student->phone }} @endif
@if ($p->id == $p->first_payment_id) {{ __('Новый') }} @else {{ __('Повторный') }} @endif {{ number_format($p->amount, 0, ',', ' ') }} ₸ {{ $p->payment_date }} {{ $p->description ?? '—' }} {{-- Laravel-native CSRF since Phase 9 — /delete_payment.php now has its own route+handler in PaymentController@destroy, no longer shared with any not-yet-migrated legacy page. --}}
@csrf
{{ __('Итого') }} {{ number_format($totalAmount, 0, ',', ' ') }} ₸
@else
{{ __('Платежей за выбранный период нет.') }}
@endif {{ $payments->withQueryString()->links('pagination::bootstrap-5') }}
{{-- Add payment. Posts to the same /add_payment.php as the student profile page's own modal; the only difference is that the student isn't known from the URL here, so it's picked with the /search_students.php autocomplete, and redirect_to brings us back to this filtered list instead of the student's profile. The layout renders flash messages but not $errors, so the validation errors PaymentController@store redirects back with are rendered here (and the modal reopened) rather than silently swallowed — this is the only form on the page that validates. --}} @endsection @push('scripts') @endpush