From ae74f5a9d8ebc76cfeb414fe30d8cc85d1b019ca Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 15 May 2021 17:14:31 +1000 Subject: [PATCH] Fixes for client portal PDF display --- app/Models/Credit.php | 6 ++---- app/Models/Invoice.php | 5 ++--- app/Models/Quote.php | 6 +++--- resources/views/portal/ninja2020/credits/show.blade.php | 2 +- .../portal/ninja2020/invoices/show-fullscreen.blade.php | 2 +- resources/views/portal/ninja2020/invoices/show.blade.php | 4 ++-- .../views/portal/ninja2020/quotes/show-fullscreen.blade.php | 2 +- resources/views/portal/ninja2020/quotes/show.blade.php | 4 ++-- .../views/themes/ninja2020/view_entity/index.blade.php | 4 ++-- 9 files changed, 16 insertions(+), 19 deletions(-) diff --git a/app/Models/Credit.php b/app/Models/Credit.php index 0f50a65a4fe8..72b8dd0674ac 100644 --- a/app/Models/Credit.php +++ b/app/Models/Credit.php @@ -251,7 +251,7 @@ class Credit extends BaseModel $this->save(); } - public function pdf_file_path($invitation = null, string $type = 'url') + public function pdf_file_path($invitation = null, string $type = 'path') { if (! $invitation) { @@ -267,13 +267,11 @@ class Credit extends BaseModel if(!$invitation) throw new \Exception('Hard fail, could not create an invitation - is there a valid contact?'); - $file_path = CreateEntityPdf::dispatchNow($invitation); - return Storage::disk('public')->path($file_path); + return Storage::disk('public')->{$type}($file_path); } - public function markInvitationsSent() { $this->invitations->each(function ($invitation) { diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index d46a36ca9f32..6011f93e46c0 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -392,7 +392,7 @@ class Invoice extends BaseModel return $invoice_calc->build(); } - public function pdf_file_path($invitation = null, string $type = 'url') + public function pdf_file_path($invitation = null, string $type = 'path') { if (! $invitation) { @@ -408,10 +408,9 @@ class Invoice extends BaseModel if(!$invitation) throw new \Exception('Hard fail, could not create an invitation - is there a valid contact?'); - $file_path = CreateEntityPdf::dispatchNow($invitation); - return Storage::disk('public')->path($file_path); + return Storage::disk('public')->{$type}($file_path); } public function markInvitationsSent() diff --git a/app/Models/Quote.php b/app/Models/Quote.php index 18df2d3b5d80..c2a11d9986aa 100644 --- a/app/Models/Quote.php +++ b/app/Models/Quote.php @@ -207,7 +207,7 @@ class Quote extends BaseModel } - public function pdf_file_path($invitation = null, string $type = 'url') + public function pdf_file_path($invitation = null, string $type = 'path') { if (! $invitation) { @@ -223,13 +223,13 @@ class Quote extends BaseModel if(!$invitation) throw new \Exception('Hard fail, could not create an invitation - is there a valid contact?'); - $file_path = CreateEntityPdf::dispatchNow($invitation); - return Storage::disk('public')->path($file_path); + return Storage::disk('public')->{$type}($file_path); } + /** * @param int $status * @return string diff --git a/resources/views/portal/ninja2020/credits/show.blade.php b/resources/views/portal/ninja2020/credits/show.blade.php index 077dd45601e5..32f15ae58472 100644 --- a/resources/views/portal/ninja2020/credits/show.blade.php +++ b/resources/views/portal/ninja2020/credits/show.blade.php @@ -2,7 +2,7 @@ @section('meta_title', ctrans('texts.entity_number_placeholder', ['entity' => ctrans('texts.credit'), 'entity_number' => $credit->number])) @push('head') - + @endpush diff --git a/resources/views/portal/ninja2020/invoices/show-fullscreen.blade.php b/resources/views/portal/ninja2020/invoices/show-fullscreen.blade.php index 8b1bb3b8da23..d1f3c80d6831 100644 --- a/resources/views/portal/ninja2020/invoices/show-fullscreen.blade.php +++ b/resources/views/portal/ninja2020/invoices/show-fullscreen.blade.php @@ -1,2 +1,2 @@ - diff --git a/resources/views/portal/ninja2020/invoices/show.blade.php b/resources/views/portal/ninja2020/invoices/show.blade.php index 845bd1f0b591..d998ff1ba914 100644 --- a/resources/views/portal/ninja2020/invoices/show.blade.php +++ b/resources/views/portal/ninja2020/invoices/show.blade.php @@ -2,7 +2,7 @@ @section('meta_title', ctrans('texts.view_invoice')) @push('head') - + @@ -174,7 +174,7 @@ - +
diff --git a/resources/views/portal/ninja2020/quotes/show-fullscreen.blade.php b/resources/views/portal/ninja2020/quotes/show-fullscreen.blade.php index 0c1d9597545e..c927cb641a98 100644 --- a/resources/views/portal/ninja2020/quotes/show-fullscreen.blade.php +++ b/resources/views/portal/ninja2020/quotes/show-fullscreen.blade.php @@ -1,2 +1,2 @@ - diff --git a/resources/views/portal/ninja2020/quotes/show.blade.php b/resources/views/portal/ninja2020/quotes/show.blade.php index c8f0f14e826c..e1450ee7a05b 100644 --- a/resources/views/portal/ninja2020/quotes/show.blade.php +++ b/resources/views/portal/ninja2020/quotes/show.blade.php @@ -2,7 +2,7 @@ @section('meta_title', ctrans('texts.entity_number_placeholder', ['entity' => ctrans('texts.quote'), 'entity_number' => $quote->number])) @push('head') - + @@ -78,7 +78,7 @@
- + @include('portal.ninja2020.invoices.includes.terms', ['entities' => [$quote], 'entity_type' => ctrans('texts.quote')]) @include('portal.ninja2020.invoices.includes.signature') diff --git a/resources/views/themes/ninja2020/view_entity/index.blade.php b/resources/views/themes/ninja2020/view_entity/index.blade.php index 574a04668be6..cd88399d9b34 100644 --- a/resources/views/themes/ninja2020/view_entity/index.blade.php +++ b/resources/views/themes/ninja2020/view_entity/index.blade.php @@ -1,7 +1,7 @@ @extends('portal.ninja2020.layout.clean') @push('head') - + @endpush @@ -39,7 +39,7 @@