@extends('layouts.app') @section('title', $invoice->invoice_number) @section('content') @php $statusColors = [ 'Draft' => 'secondary', 'Sent' => 'info', 'Paid' => 'success', 'Partially Paid' => 'warning', 'Overdue' => 'danger', 'Cancelled' => 'dark', ]; @endphp

{{ $invoice->invoice_number }}

{{ $invoice->status }}
Invoice for {{ $invoice->customer->name }}
← Back PDF @if($canEdit && $invoice->status !== 'Paid') Edit @endif
@if(session('success'))
{{ session('success') }}
@endif
{{-- Invoice Items --}}
Line Items
@foreach($invoice->items as $idx => $item) @endforeach
# Product Qty Unit Price GST Line Total
{{ $idx + 1 }}
{{ $item->product->brand_name ?? '—' }}
{{ $item->product->composition ?? '' }}
{{ $item->quantity }} ₹{{ number_format($item->price, 2) }} {{ $item->product->gst_rate ?? 0 }}% ₹{{ number_format($item->total, 2) }}
@if($invoice->discount_amount > 0) @endif
Subtotal ₹{{ number_format($invoice->subtotal, 2) }}
GST Total ₹{{ number_format($invoice->tax_amount, 2) }}
Discount -₹{{ number_format($invoice->discount_amount, 2) }}
Total ₹{{ number_format($invoice->total_amount, 2) }}
Paid ₹{{ number_format($invoice->total_paid, 2) }}
Balance Due ₹{{ number_format($invoice->balance_due, 2) }}
{{-- Notes & Terms --}} @if($invoice->notes || $invoice->terms)
@if($invoice->notes)
Notes

{{ $invoice->notes }}

@endif @if($invoice->terms)
Terms & Conditions

{{ $invoice->terms }}

@endif
@endif {{-- Payment History --}}
Payment History
@if($invoice->payments->isEmpty())

No payments recorded yet.

@else
@foreach($invoice->payments as $payment) @endforeach
Date Method Amount
{{ $payment->payment_date->format('d M Y') }} {{ $payment->payment_method }} ₹{{ number_format($payment->amount, 2) }}
@endif
{{-- Right Sidebar --}}
{{-- Customer Info --}}
Customer
{{ $invoice->customer->name }}
{{ $invoice->customer->phone }}
@if($invoice->customer->email)
{{ $invoice->customer->email }}
@endif @if($invoice->customer->address)
{{ $invoice->customer->address }}
@endif
{{-- Record Payment --}} @if($canPayment && $invoice->balance_due > 0 && !in_array($invoice->status, ['Cancelled', 'Paid']))
Record Payment
@csrf
Balance due: ₹{{ number_format($invoice->balance_due, 2) }}
@endif {{-- Invoice Meta --}}
Details
Invoice Date {{ $invoice->invoice_date->format('d M Y') }}
Created At {{ $invoice->created_at->format('d M Y') }}
Status {{ $invoice->status }}
@endsection