@extends('layouts.app') @section('title', $invoice->invoice_number) @section('content')
← Back to invoices

{{ $invoice->invoice_number }}

Issued {{ $invoice->invoice_date->format('d M Y') }} · {{ $invoice->customer?->full_name_en ?? $invoice->company?->name_en ?? 'General account' }}

{{ str_replace('_', ' ', $invoice->status) }} {{ str_replace('_', ' ', $invoice->workflow_status) }} · V{{ $invoice->version }}
@foreach([ ['Subtotal', $invoice->subtotal, 'text-slate-950'], ['VAT', $invoice->vat_amount, 'text-violet-600'], ['Paid', $invoice->paid_amount, 'text-emerald-600'], ['Balance', $invoice->balance_due, 'text-rose-600'], ] as [$label, $amount, $color])

{{ $label }}

AED {{ number_format((float) $amount, 2) }}

@endforeach

Invoice fee classification

Government/pass-through money is separated from company revenue and VAT.

@foreach($invoice->items as $item) @endforeach @if((float) $invoice->discount_amount > 0)@endif
DescriptionClassificationAmount

{{ $item->description }}

{{ str_replace('_', ' ', $item->fee_type) }} · Qty {{ $item->quantity }} · VAT {{ number_format((float)($item->vat_rate ?? 0),2) }}%

{{ str_replace('_', ' ', $item->revenue_classification) }}AED {{ number_format((float) $item->total_amount + (float)$item->vat_amount, 2) }}
Approved service-revenue discount− AED {{ number_format((float) $invoice->discount_amount, 2) }}
Invoice totalAED {{ number_format((float) $invoice->total_amount, 2) }}

Payment history

@forelse($invoice->payments as $payment)

{{ $payment->payment_number }}

{{ $payment->created_at->format('d M Y, H:i') }} · {{ $payment->components->pluck('payment_method')->map(fn($v) => str_replace('_', ' ', $v))->join(' + ') }}

AED {{ number_format((float) $payment->amount, 2) }}

@if($payment->receipt)Receipt {{ $payment->receipt->receipt_number }}@endif
@empty
No payments collected yet.
@endforelse

Revision history

Immutable snapshots, changes, user and reason.

{{ $invoice->revisions->count() }} version record(s)
@forelse($invoice->revisions as $revision)

Version {{ $revision->version }} · {{ $revision->actor?->name }}

{{ $revision->created_at->format('d M Y, H:i') }} · {{ $revision->reason }}

AED {{ number_format((float)data_get($revision->snapshot,'invoice.total_amount',0),2) }}
@if($revision->changes)
@foreach($revision->changes as $field=>$change)
{{ str_replace('_',' ',$field) }}
Old: {{ is_array($change['old']??null)?'line snapshot':($change['old']??'—') }}
New: {{ is_array($change['new']??null)?'line snapshot':($change['new']??'—') }}
@endforeach
@endif
@empty
No revision snapshots recorded for this legacy invoice.
@endforelse
@endsection