@php use App\Models\Currency; $fmt = fn ($minor, $cur) => Currency::symbolFor((string) $cur) . number_format(((int) $minor) / 100, 2); $agBuckets = $aging['buckets'] ?? []; @endphp
{{ __('Money') }}

{{ __('Payment') }} {{ __('ledger') }}

{{ __('Record money received, track what is outstanding, and see the aging of unpaid invoices.') }}

@if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif {{-- KPIs + aging --}}
{{ __('Collected (30d)') }}
{{ $fmt($collected30, $currency) }}
{{ __('Outstanding') }}
{{ $fmt($aging['total_outstanding_minor'] ?? 0, $aging['currency'] ?? $currency) }}
{{ $aging['count'] ?? 0 }} {{ __('invoices') }}
{{ __('Aging') }} {{ __('(days since issue)') }}
@foreach (['0-30','31-60','61-90','90+'] as $b)
{{ $b }}
{{ $fmt($agBuckets[$b] ?? 0, $aging['currency'] ?? $currency) }}
@endforeach
{{-- Ledger --}}
{{ __('Recent payments') }}
@forelse ($payments as $p) @empty @endforelse
{{ __('Date') }} {{ __('From') }} {{ __('Method') }} {{ __('Invoice') }} {{ __('Amount') }}
{{ optional($p->paid_at)->format('d M Y') ?: '—' }} {{ $p->company?->name ?: ($p->contact?->name ?: '—') }} {{ $p->method }} {{ $p->invoice?->invoice_number ?: '—' }} {{ $p->amount_display }}
{{ __('No payments recorded yet.') }}
{{-- Outstanding --}}
{{ __('Outstanding invoices') }}
@forelse ($outstanding as $inv)
{{ $inv->invoice_number }}
{{ __('due') }} {{ $fmt($inv->outstanding_minor, $inv->currency) }}
@empty
{{ __('Nothing outstanding. Nice.') }}
@endforelse
{{-- Record-payment modal --}}