@extends('admin.layouts.app') @section('page-title', 'Edit Invoice') @section('content')
{{-- Invoice Overview --}}

Invoice Overview

@include('admin.popup_invoice', ['invoice' => $invoice, 'shipment' => $shipment])
{{-- Edit Invoice Header --}}

Edit Invoice Details

@csrf
{{-- Invoice Date --}}
{{-- Due Date --}}
{{-- Final Amount (With GST) – Charge Groups Total --}}
{{-- Status --}}
{{-- Notes --}}
@php $totalPaid = $invoice->totalPaid(); $remaining = $invoice->remainingAmount(); // Mixed tax type label from charge groups $taxTypes = $invoice->chargeGroups ? $invoice->chargeGroups->pluck('tax_type')->filter()->unique()->values() : collect([]); $taxTypeLabel = 'None'; if ($taxTypes->count() === 1) { if ($taxTypes[0] === 'gst') { $taxTypeLabel = 'GST (CGST + SGST)'; } elseif ($taxTypes[0] === 'igst') { $taxTypeLabel = 'IGST'; } else { $taxTypeLabel = strtoupper($taxTypes[0]); } } elseif ($taxTypes->count() > 1) { $parts = []; if ($taxTypes->contains('gst')) { $parts[] = 'GST (CGST + SGST)'; } if ($taxTypes->contains('igst')) { $parts[] = 'IGST'; } $taxTypeLabel = implode(' + ', $parts); } @endphp {{-- Amount Breakdown --}}
Amount Breakdown
Tax Type {{ $taxTypeLabel }}
GST Amount ₹{{ number_format($invoice->gst_amount, 2) }}
Grand Total (Charges + GST) ₹{{ number_format($invoice->grand_total_with_charges, 2) }}
Total Paid ₹{{ number_format($totalPaid, 2) }}
Remaining ₹{{ number_format(max(0, $remaining), 2) }}
{{-- Summary cards --}}
₹{{ number_format($invoice->grand_total_with_charges, 2) }}
Grand Total (Charges + GST)
₹{{ number_format(max(0, $remaining), 2) }}
Remaining
{{-- Installment Management --}}

Installment Payments

@if($remaining > 0) @endif
{{-- Installment Form --}}

Add New Installment

@csrf
{{-- Installment History --}}
Installment History
No installments found. Click Add Installment to create one.
@foreach($invoice->installments as $i) @endforeach
# Date Payment Method Reference No Amount Action
{{ $loop->iteration }} {{ $i->installment_date }} {{ strtoupper($i->payment_method) }} @if($i->reference_no) {{ $i->reference_no }} @else - @endif ₹{{ number_format($i->amount, 2) }}
@endsection