From afdae80ec975d1f9acd6b2be901c5ec98e3d74c2 Mon Sep 17 00:00:00 2001 From: "Joseph.Rawlings" Date: Sun, 1 Mar 2026 16:29:55 -0500 Subject: [PATCH] feat: styled PDF invoice export with download button --- resources/views/pdf/invoice.blade.php | 364 ++++++++++++++---- themes/lucentui/views/invoices/show.blade.php | 4 +- 2 files changed, 281 insertions(+), 87 deletions(-) diff --git a/resources/views/pdf/invoice.blade.php b/resources/views/pdf/invoice.blade.php index 58cf50755..7f9d877c9 100644 --- a/resources/views/pdf/invoice.blade.php +++ b/resources/views/pdf/invoice.blade.php @@ -3,153 +3,347 @@ - {{ __('invoices.invoice', ['id' => $invoice->number]) }} - @if(config('settings.logo')) -
- {{ config('app.name') }} -
- @endif - - -
- {{ __('invoices.status') }}: - {{ ucfirst($invoice->status) }} - -
- - + +
- -
- {{ __('invoices.issued_to') }}
- {{ $invoice->user->name }}
- @foreach($invoice->user->properties()->with('parent_property')->whereHas('parent_property', function - ($query) { - $query->where('show_on_invoice', true); - })->get() as $property) - {{ $property->value }}
- @endforeach +
+ @if(config('settings.logo')) + {{ config('app.name') }} + @endif +
+ {{ __('invoices.invoice', ['id' => $invoice->number]) }} +
+
- {{ strtoupper(__('invoices.bill_to')) }}
- {{ config('settings.company_name') }}
- {{ config('settings.company_address') }} {{ config('settings.company_address2') }}
- {{ config('settings.company_zip') }} {{ config('settings.company_city') }}
- {{ config('settings.company_state') }} {{ config('settings.company_country') }}
- {{ config('settings.company_tax_id') }}
- {{ config('settings.company_id') }}
+
+ + {{ $invoice->status == 'paid' ? __('invoices.paid') : __('invoices.payment_pending') }} +
-

{{ __('invoices.invoice_date') }}: {{ $invoice->created_at->format('d/m/Y') }}

-

{{ __('invoices.invoice_no') }}: {{ $invoice->number }}

- + +
+ + + + + +
+
{{ __('invoices.issued_to') }}
+
{{ $invoice->user->properties->where('parent_property.name', 'Company Name (Include Registration Number)')->first()?->value }}
+
+ Attention: {{ $invoice->user->first_name }} {{ $invoice->user->last_name }}
+ {{ $invoice->user->properties->where('parent_property.name', 'Property Number/House Name')->first()?->value }} + {{ $invoice->user->properties->where('parent_property.name', 'Street Name')->first()?->value }}
+ {{ $invoice->user->properties->where('parent_property.name', 'City')->first()?->value }} + {{ $invoice->user->properties->where('parent_property.name', 'State/Province/Region')->first()?->value }} + {{ $invoice->user->properties->where('parent_property.name', 'Full Postal Code')->first()?->value }}
+ {{ $invoice->user->properties->where('parent_property.name', 'Country')->first()?->value }} +
+
+
{{ __('invoices.bill_to') }}
+
{{ config('settings.company_name') }}
+
+ {{ config('settings.company_address') }} {{ config('settings.company_address2') }}
+ {{ config('settings.company_city') }} {{ config('settings.company_state') }} {{ config('settings.company_zip') }}
+ {{ \Locale::getDisplayRegion('-' . config('settings.company_country')) }} +
+
+
Invoice Details
+ + + + + + + + + +
{{ __('invoices.invoice_date') }}{{ $invoice->created_at->format('d M Y') }}
{{ __('invoices.invoice_no') }}#{{ $invoice->number }}
+
+ + +
Invoice Items
+ - - + + @foreach($invoice->items as $item) - - + + @endforeach
{{ __('invoices.item') }}{{ __('invoices.quantity') }}{{ __('invoices.unit_price') }}{{ __('invoices.price') }}{{ __('invoices.quantity') }} {{ __('invoices.total') }}
{{ $item->description }}{{ $item->quantity }}{{ $item->description }} {{ $item->formattedPrice }}{{ $item->quantity }} {{ $item->formattedTotal }}
- @if($invoice->transactions->count() > 0) - + +
+
+ @if ($invoice->formattedTotal->tax > 0) + + + + + + + + + @endif + + + + +
{{ __('invoices.subtotal') }}{{ $invoice->formattedTotal->format($invoice->formattedTotal->price - $invoice->formattedTotal->tax) }}
{{ \App\Classes\Settings::tax()->name }}{{ $invoice->formattedTotal->formatted->tax }}
{{ __('invoices.total') }}{{ $invoice->formattedTotal }}
+ + + + @if($invoice->transactions->isNotEmpty()) +
{{ __('invoices.transactions') }}
+ + - + - @foreach($invoice->transactions as $transaction) + - + - @endforeach
{{ __('invoices.date') }} {{ __('invoices.transaction_id') }}{{ __('invoices.payment_date') }}{{ __('invoices.gateway') }} {{ __('invoices.amount') }}{{ __('invoices.payment_method') }}
{{ $transaction->created_at->format('d M Y H:i') }} {{ $transaction->transaction_id }}{{ $transaction->created_at->format('d/m/Y') }}{{ $transaction->gateway?->name }} {{ $transaction->formattedAmount }}{{ $transaction->gateway ? $transaction->gateway->name : '' }}
@endif + + + \ No newline at end of file diff --git a/themes/lucentui/views/invoices/show.blade.php b/themes/lucentui/views/invoices/show.blade.php index 043b711ab..87b8b71b7 100644 --- a/themes/lucentui/views/invoices/show.blade.php +++ b/themes/lucentui/views/invoices/show.blade.php @@ -46,10 +46,10 @@ @endif - +