@php $companyName = $company?->name ?? 'Echt Solutions Inc'; $companyEmail = $company?->email ?? 'info@echtsolutions.com'; $sv = $statusValue; $statusColors = [ 'unpaid' => ['bg' => '#fffbeb', 'text' => '#d97706'], 'partial' => ['bg' => '#eff6ff', 'text' => '#1d4ed8'], 'paid' => ['bg' => '#f0fdf4', 'text' => '#15803d'], ]; $sc = $statusColors[$sv] ?? ['bg' => '#f1f5f9', 'text' => '#64748b']; $statusLabel = match($sv) { 'unpaid' => 'Unpaid', 'partial' => 'Partial Payment', 'paid' => 'Paid in Full', default => ucfirst($sv), }; $isPaid = $sv === 'paid'; $isPartial = $sv === 'partial'; $hasPayments = $paymentsList->isNotEmpty(); @endphp {{-- 1. HEADER --}}
{{ $companyName }}
Digital Solutions & Web Development
Gujranwala, Pakistan
{{ $companyEmail }}
INVOICE
Invoice #   {{ $invoice->invoice_number }}
Date Issued   {{ $invoice->created_at->format('d M Y') }}
Due Date   {{ $invoice->due_date->format('d M Y') }}
{{ $statusLabel }}
{{-- 2. THICK DIVIDER --}}
{{-- 3. BILL TO + PROJECT --}}
{{ $invoice->client->name }}
{{ $invoice->client->email }}
@if ($invoice->client->phone)
{{ $invoice->client->phone }}
@endif
{{ $invoice->project->title }}
@if ($invoice->proposal)
Linked Proposal: PROP-{{ str_pad($invoice->proposal->id, 5, '0', STR_PAD_LEFT) }}
@endif
{{-- 4. REGULAR DIVIDER --}}
{{-- 5. INVOICE ITEMS TABLE --}} {{-- SECURITY: All user-supplied values use {{ }} (htmlspecialchars). number_format() wraps a (float) cast of a controlled decimal string — safe for display only, not arithmetic. --}} @if ($hasPayments && !$isPaid) @endif
Description Amount
@if ($invoice->proposal && $invoice->proposal->scope) {{ substr($invoice->proposal->scope, 0, 200) }} @else {{ $invoice->project->title }} @endif {{ $currencySymbol }} {{ number_format((float) $invoice->amount, 2) }}
Subtotal {{ $currencySymbol }} {{ number_format((float) $invoice->amount, 2) }}
Amount Paid {{ $currencySymbol }} {{ number_format((float) $totalPaid, 2) }}
Balance Due {{ $currencySymbol }} {{ number_format((float) $remaining, 2) }}
{{-- 6. PAYMENT HISTORY --}} @if ($hasPayments)
Payment History
@foreach ($paymentsList as $pm) @endforeach
Date Method Amount Notes
{{ $pm['paid_at']->format('d M Y') }} {{ $pm['method_label'] }} {{ $pm['symbol'] }} {{ number_format((float) $pm['amount'], 2) }} {{ $pm['notes'] ?? '—' }}
Total Paid {{ $currencySymbol }} {{ number_format((float) $totalPaid, 2) }}
@endif {{-- 7. FINANCIAL SUMMARY BOX --}}
Financial Summary
Invoice Total {{ $currencySymbol }} {{ number_format((float) $invoice->amount, 2) }}
Total Paid {{ $currencySymbol }} {{ number_format((float) $totalPaid, 2) }}
Balance Due {{ $currencySymbol }} {{ number_format((float) $remaining, 2) }}
Status {{ $statusLabel }}
{{-- 8. PAYMENT INSTRUCTIONS --}}
Payment Methods Accepted
Please quote invoice number {{ $invoice->invoice_number }} when making payment.
For queries: info@echtsolutions.com
{{-- 9. REGULAR DIVIDER --}}
{{-- 10. FOOTER --}}