@section('page-title', $invoice->getTypeLabel() . ' ' . $invoice->invoice_number) {{-- ============================================================ TOP ACTION BAR (matches screenshot design) ============================================================ --}}
{{ strtoupper($invoice->getTypeLabel()) }} {{ $invoice->invoice_number }}
{{ $invoice->invoice_date->format('d M Y') }} · Due {{ $invoice->due_date->format('d M Y') }}
Back
{{-- Row 1: Main Actions (mockup layout) --}}
{{-- Edit Invoice --}} Edit Invoice {{-- Make Payment --}} @if($invoice->status !== 'paid' && $invoice->status !== 'cancelled') Make Payment @endif {{-- Email --}} {{-- SMS --}} {{-- Print --}} {{-- Preview --}} Preview {{-- Change Status --}} {{-- Cancel --}}
@csrf @method('PATCH')
{{-- Row 2: Extra Options & Custom Layouts --}}
{{-- Extra Options --}} {{-- POS Print --}} {{-- WhatsApp --}} @php $waNumber = preg_replace('/[^0-9]/', '', $invoice->client->whatsapp ?? $invoice->client->phone ?? ''); $waMsg = urlencode("Dear {$invoice->client->name},\n\nYour {$invoice->getTypeLabel()} {$invoice->invoice_number} is ready.\nTotal: " . number_format($invoice->total, 2) . " {$invoice->currency}\nDue: " . $invoice->due_date->format('d M Y') . "\n\nThank you."); @endphp @if($waNumber) WhatsApp @endif
@if(session('success')) @endif
{{-- Invoice Document --}}
{{-- Watermark for proforma --}} @if($invoice->invoice_type === 'proforma')
PROFORMA
@endif {{-- Header (Matching Reference Image) --}}
@php $logo = \App\Models\Setting::get('company_logo'); $companyName = \App\Models\Setting::get('company_name', 'JointaSoft'); @endphp @if(!empty($logo)) Logo @else
JointaSoft
ICT Technologies & Supplies
@endif
{{ $companyName }}

{{ \App\Models\Setting::get('company_address', 'P.O Box 80058, Dar es Salaam') }}

Ph. {{ \App\Models\Setting::get('company_phone', '+255 763 586 306') }}

Email: {{ \App\Models\Setting::get('company_email', 'info@jointasoft.com') }}

TIN: 123-536-517


{{-- Billed To & Dates (Matching Reference Image) --}}

Bill To

{{ $invoice->client->name }}
@if($invoice->client->company_name)

{{ $invoice->client->company_name }}

@endif @if($invoice->client->tax_number)

VRN: {{ $invoice->client->tax_number }}

@endif

{{ $invoice->client->email }}

@if($invoice->client->phone)

{{ $invoice->client->phone }}

@endif @if($invoice->client->address)

{{ $invoice->client->address }}{{ $invoice->client->city ? ', '.$invoice->client->city : '' }}

@endif

INVOICE {{ $invoice->invoice_number }}

Invoice Date: {{ $invoice->invoice_date->format('d-m-Y') }}

Invoice Due Date: {{ $invoice->due_date->format('d-m-Y') }}

@if($invoice->status === 'paid') PAID @elseif($invoice->status === 'due') DUE @elseif($invoice->status === 'partial') PARTIAL @elseif($invoice->status === 'pending') PENDING @else CANCELLED @endif
{{-- Line Items --}}
@foreach($invoice->items as $i => $item) @endforeach @if($invoice->tax > 0) @endif
# Description Product Price Qty Sub Total
{{ $i + 1 }} {{ $item->description }} {{ number_format($item->amount, 2) }} {{ $invoice->currency }} 1.00 {{ number_format($item->amount, 2) }} {{ $invoice->currency }}
Sub Total {{ number_format($invoice->subtotal, 2) }} {{ $invoice->currency }}
Total Tax {{ number_format($invoice->tax, 2) }} {{ $invoice->currency }}
Grand Total {{ number_format($invoice->total, 2) }} {{ $invoice->currency }}
Thank you for choosing JointaSoft.

Email: {{ \App\Models\Setting::get('company_email', 'info@jointasoft.com') }} | Website: {{ \App\Models\Setting::get('company_website', 'www.jointasoft.com') }}

This invoice was generated electronically by JointaSoft.

{{-- Terms and Bank Details (Matching Reference Image) --}} @if(\App\Models\Setting::get('bank_account_number'))
Terms & Conditions:

{{ \App\Models\Setting::get('terms_conditions', 'Payments should be made through bank Account') }}

Account number: {{ \App\Models\Setting::get('bank_account_number') }} | Account Name: {{ \App\Models\Setting::get('bank_account_name') }} | Branch: {{ \App\Models\Setting::get('bank_branch') }} | Bank: {{ \App\Models\Setting::get('bank_name') }} | SWIFT code: {{ \App\Models\Setting::get('bank_swift_code') }}

@if(\App\Models\Setting::get('bank_account_number_2'))

Account number 2: {{ \App\Models\Setting::get('bank_account_number_2') }} | Account Name 2: {{ \App\Models\Setting::get('bank_account_name_2') }} | Branch 2: {{ \App\Models\Setting::get('bank_branch_2') }} | Bank 2: {{ \App\Models\Setting::get('bank_name_2') }} | SWIFT code 2: {{ \App\Models\Setting::get('bank_swift_code_2') }}

@endif
@php $qrData = "Bank: " . \App\Models\Setting::get('bank_name', 'Mkombozi Commercial Bank Plc') . "\nAccount Number: " . \App\Models\Setting::get('bank_account_number', '00120308317601') . "\nAccount Name: " . \App\Models\Setting::get('bank_account_name', 'JointaSoft') . "\nAmount: " . number_format($invoice->total, 2) . " " . $invoice->currency; $qrUrl = "https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=" . urlencode($qrData); @endphp
Scan & Pay
QR Code
@endif @if($invoice->notes)

NOTES

{{ $invoice->notes }}

@endif
{{-- Payments Received --}}
Payments Received
@if($invoice->payments->isEmpty())

No payments recorded yet.

@else @foreach($invoice->payments as $payment) @endforeach
DateMethodReferenceAmount
{{ $payment->payment_date->format('d M Y') }} {{ str_replace('_', ' ', $payment->payment_method) }} {{ $payment->reference_number ?? '—' }} {{ number_format($payment->amount, 2) }} {{ $payment->currency }}
@csrf @method('DELETE')
Total Paid {{ number_format($invoice->payments->sum('amount'), 2) }} {{ $invoice->currency }}
@endif
{{-- Side Panel --}}
{{-- Outstanding Balance --}}

OUTSTANDING BALANCE

@php $balance = max(0, $invoice->total - $invoice->payments->sum('amount')); @endphp

{{ number_format($balance, 2) }} {{ $invoice->currency }}

@if($balance <= 0) Fully Paid @endif
{{-- Record Payment Form --}} @if($invoice->status !== 'paid' && $invoice->status !== 'cancelled')
Record Payment
@csrf
@endif {{-- Quick Links --}}
@section('scripts') @endsection