Invoice {{ $invoice->invoice_number }}

Download PDF @if($invoice->amount_due > 0) Collect Payment @endif @php $fmt = fn($v) => '₹' . number_format($v ?? 0, 2, '.', ','); $statusColor = match($invoice->status) { 'draft' => 'bg-gray-100 text-gray-500 border-gray-200', 'issued' => 'bg-blue-100 text-blue-700 border-blue-200', 'partially_paid' => 'bg-yellow-100 text-yellow-700 border-yellow-200', 'paid' => 'bg-green-100 text-green-700 border-green-200', 'cancelled' => 'bg-red-100 text-red-500 border-red-200', default => 'bg-gray-100 text-gray-500 border-gray-200', }; $accentColor = match($invoice->status) { 'paid' => 'bg-green-500', 'cancelled' => 'bg-red-400', 'issued', 'partially_paid' => 'bg-orange-500', default => 'bg-gray-300', }; @endphp
{{-- Invoice card --}}
{{-- Color accent bar --}}
{{-- Organization / From --}}

{{ $invoice->organization?->name ?? config('app.name') }}

{{ $invoice->branch?->name }}

{{ $invoice->organization?->email }}

{{-- Invoice meta --}}

{{ $invoice->invoice_number }}

{{ str_replace('_', ' ', $invoice->status) }}
{{-- Bill To --}}

Bill To

{{ $invoice->member?->name }}

{{ $invoice->member?->member_id }}

{{ $invoice->member?->phone }}

{{ $invoice->member?->email }}

{{-- Dates --}}

Invoice Date

{{ \Carbon\Carbon::parse($invoice->issued_at ?? $invoice->created_at)->format('M j, Y') }}

@if($invoice->due_date)

Due Date

{{ \Carbon\Carbon::parse($invoice->due_date)->format('M j, Y') }}

@endif
{{-- Amount summary --}}

Total Amount

{{ $fmt($invoice->total_amount) }}

@if($invoice->amount_due > 0)

{{ $fmt($invoice->amount_due) }} outstanding

@elseif($invoice->status === 'paid')

Paid in full

@endif
{{-- Line items --}}
@foreach($invoice->lineItems ?? [] as $line) @endforeach
Description Qty Unit Price Amount
{{ $line->description }} {{ number_format($line->quantity, 2) }} {{ $fmt($line->unit_price) }} {{ $fmt($line->quantity * $line->unit_price) }}
{{-- Totals block --}}
Subtotal{{ $fmt($invoice->subtotal ?? $invoice->total_amount) }}
@if(($invoice->discount_amount ?? 0) > 0)
Discount− {{ $fmt($invoice->discount_amount) }}
@endif @foreach($invoice->taxLines ?? [] as $tax)
{{ $tax->label }} ({{ $tax->rate }}%) {{ $fmt($tax->amount) }}
@endforeach
Total{{ $fmt($invoice->total_amount) }}
@if(($invoice->amount_paid ?? 0) > 0)
Paid− {{ $fmt($invoice->amount_paid) }}
Balance Due{{ $fmt($invoice->amount_due) }}
@endif
@if($invoice->notes)

Notes

{{ $invoice->notes }}

@endif
{{-- Left col: payments + credit note + edit --}}
{{-- Payments received --}}

Payments Received

@if(isset($invoice->payments) && $invoice->payments->count()) @foreach($invoice->payments as $pmt) @endforeach
Date Method Reference Amount
{{ \Carbon\Carbon::parse($pmt->paid_at ?? $pmt->created_at)->format('M j, Y') }} {{ $pmt->method }} {{ $pmt->reference ?? $pmt->transaction_id ?? '—' }} {{ $fmt($pmt->amount) }}
@else
No payments recorded yet.
@endif
{{-- Credit Note --}} @if($invoice->creditNote)

Credit Note Applied

{{ $invoice->creditNote->reason }}

{{ $fmt($invoice->creditNote->amount) }}

{{ \Carbon\Carbon::parse($invoice->creditNote->created_at)->format('M j, Y') }}

@else

Credit Note

@csrf
@error('amount')

{{ $message }}

@enderror
@error('reason')

{{ $message }}

@enderror
No credit note on this invoice.
@endif {{-- Edit Invoice Panel --}} @if(!in_array($invoice->status, ['paid', 'cancelled']))

Edit Invoice

@csrf @method('PUT') {{-- Line items --}}
@foreach($invoice->lineItems ?? [] as $i => $line)
@endforeach
@endif
{{-- Right sidebar --}}
{{-- Invoice details card --}}

Invoice Details

Status {{ str_replace('_', ' ', $invoice->status) }}
Issued {{ \Carbon\Carbon::parse($invoice->issued_at ?? $invoice->created_at)->format('M j, Y') }}
@if($invoice->due_date)
Due {{ \Carbon\Carbon::parse($invoice->due_date)->format('M j, Y') }}
@endif
Total {{ $fmt($invoice->total_amount) }}
Paid {{ $fmt($invoice->amount_paid ?? 0) }}
Due {{ $fmt($invoice->amount_due ?? 0) }}
{{-- Quick actions --}}

Quick Actions

Download PDF @if($invoice->amount_due > 0) Collect Payment @endif @if($invoice->status !== 'cancelled')
@csrf @method('PATCH')
@endif
{{-- Member quick info --}}

Member

{{ strtoupper(substr($invoice->member?->name ?? '?', 0, 1)) }}
{{ $invoice->member?->name }}

{{ $invoice->member?->member_id }}