@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 --}}
{{-- 2. THICK DIVIDER --}}
{{-- 3. BILL TO + PROJECT --}}
Bill To
{{ $invoice->client->name }}
{{ $invoice->client->email }}
@if ($invoice->client->phone)
{{ $invoice->client->phone }}
@endif
Project
{{ $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. --}}
| 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) }} |
@if ($hasPayments && !$isPaid)
| Amount Paid |
{{ $currencySymbol }} {{ number_format((float) $totalPaid, 2) }} |
| Balance Due |
{{ $currencySymbol }} {{ number_format((float) $remaining, 2) }} |
@endif
{{-- 6. PAYMENT HISTORY --}}
@if ($hasPayments)
Payment History
| Date |
Method |
Amount |
Notes |
@foreach ($paymentsList as $pm)
| {{ $pm['paid_at']->format('d M Y') }} |
{{ $pm['method_label'] }} |
{{ $pm['symbol'] }} {{ number_format((float) $pm['amount'], 2) }} |
{{ $pm['notes'] ?? '—' }} |
@endforeach
| 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
- Bank Transfer
- Wise
- Payoneer
- JazzCash
- EasyPaisa
- PayPal
Please quote invoice number {{ $invoice->invoice_number }} when making payment.
For queries: info@echtsolutions.com
{{-- 9. REGULAR DIVIDER --}}
{{-- 10. FOOTER --}}