@extends('layouts.portal') @php $status = $invoice->status; $eff = $invoice->effectiveStatus(); $bal = $invoice->balance(); $pct = (float) $invoice->total > 0 ? min(100, round($invoice->amount_paid / $invoice->total * 100)) : 0; $isVoid = $status === 'void'; $canPay = ! $isVoid && $bal > 0; $enr = $invoice->enrollment; $thr = rtrim(rtrim(number_format($threshold, 2), '0'), '.'); $pendingPay = $invoice->payments->where('status', 'pending'); $payLink = route('invoices.show', $invoice->token); @endphp @section('title', 'Invoice '.$invoice->number) @section('subtitle', $invoice->customer_name.($invoice->company ? ' · '.$invoice->company : '').' · due '.($invoice->due_date?->format('d M Y') ?? '—')) @section('actions') All invoices Download PDF @endsection @section('content')
@if($isVoid)
This invoice is void. It no longer counts towards billed or outstanding totals and cannot take payments.
@elseif($invoice->isOverdue())
Overdue by {{ $invoice->due_date->diffForHumans(null, true) }}. {{ money2($bal) }} was due on {{ $invoice->due_date->format('d M Y') }}. Send a reminder from the panel on the right.
@elseif($status === 'draft')
Draft — not sent yet. The customer's pay link stays offline until you send the invoice.
@endif @if($pendingPay->count())
{{ $pendingPay->count() }} payment proof{{ $pendingPay->count() === 1 ? '' : 's' }} waiting for verification ({{ money2($pendingPay->sum('amount')) }}). Approve or reject them in the list below.
@endif @include('admin.billing._document', ['doc' => $invoice, 'kind' => 'invoice', 'payMethods' => $payMethods])

Payments on this invoice

{{ $invoice->payments->count() }} record{{ $invoice->payments->count() === 1 ? '' : 's' }}
@forelse($invoice->payments->sortByDesc('id') as $p)
{{ $p->receipt_no ?: $p->reference }}
{{ ($p->paid_at ?? $p->created_at)->format('d M Y') }} · {{ $methods[$p->method] ?? ucfirst(str_replace('_', ' ', (string) $p->method)) }}@if($p->transaction_ref) · Ref {{ $p->transaction_ref }}@endif · {{ $p->receiver ? 'recorded by '.$p->receiver->name : 'submitted by customer' }}
{{ money2($p->amount) }}
@if($p->proof_path) Proof@endif @if($p->status === 'pending')
@csrf
@elseif($p->status === 'paid') Receipt
@csrf
@endif
@empty
No payments yet. Record money received using the form on the right.
@endforelse
@if(! $isVoid && (float) $invoice->amount_paid <= 0) @endif @foreach($invoice->payments as $p) @if($p->status === 'pending') @elseif($p->status === 'paid') @endif @endforeach @endsection