From 1e8a82fd29affdf92c14776d6ea2bfdfeb299483 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 14 Nov 2024 10:02:58 +1100 Subject: [PATCH] Refactor for livewire components --- app/Livewire/CreditsTable.php | 6 +- app/Livewire/DocumentsTable.php | 47 ++++---- app/Livewire/InvoicesTable.php | 6 +- app/Livewire/PayNowDropdown.php | 6 +- app/Livewire/PaymentMethodsTable.php | 12 +- app/Livewire/PaymentsTable.php | 6 +- app/Livewire/PdfSlot.php | 114 ++++++++++-------- .../EDocument/Gateway/Storecove/Storecove.php | 2 +- .../Gateway/Storecove/StorecoveAdapter.php | 3 + .../Validation/Peppol/EntityLevel.php | 2 +- .../Validation/XsltDocumentValidator.php | 4 +- .../ninja2020/components/pdf-viewer.blade.php | 3 +- .../portal/ninja2020/credits/show.blade.php | 4 +- .../ninja2020/invoices/payment.blade.php | 2 +- .../portal/ninja2020/invoices/show.blade.php | 4 +- .../ninja2020/invoices/show_smooth.blade.php | 3 +- .../ninja2020/purchase_orders/show.blade.php | 2 +- .../portal/ninja2020/quotes/show.blade.php | 2 +- 18 files changed, 114 insertions(+), 114 deletions(-) diff --git a/app/Livewire/CreditsTable.php b/app/Livewire/CreditsTable.php index 27bd6e3258..2b5c2561af 100644 --- a/app/Livewire/CreditsTable.php +++ b/app/Livewire/CreditsTable.php @@ -26,8 +26,6 @@ class CreditsTable extends Component public int $per_page = 10; - public Company $company; - public string $db; public int $company_id; @@ -36,13 +34,13 @@ class CreditsTable extends Component { MultiDB::setDb($this->db); - $this->company = Company::find($this->company_id); } public function render() { + $query = Credit::query() - ->where('company_id', $this->company->id) + ->where('company_id', auth()->guard('contact')->user()->company_id) ->where('client_id', auth()->guard('contact')->user()->client_id) ->where('status_id', '<>', Credit::STATUS_DRAFT) ->where('is_deleted', 0) diff --git a/app/Livewire/DocumentsTable.php b/app/Livewire/DocumentsTable.php index 2215f646be..054c71c3c2 100644 --- a/app/Livewire/DocumentsTable.php +++ b/app/Livewire/DocumentsTable.php @@ -12,31 +12,28 @@ namespace App\Livewire; -use App\Libraries\MultiDB; +use App\Models\Task; +use App\Models\Quote; use App\Models\Client; -use App\Models\Company; use App\Models\Credit; -use App\Models\Document; +use App\Models\Company; use App\Models\Expense; use App\Models\Invoice; use App\Models\Payment; use App\Models\Project; -use App\Models\Quote; -use App\Models\RecurringInvoice; -use App\Models\Task; -use App\Utils\Traits\WithSorting; use Livewire\Component; +use App\Models\Document; +use App\Libraries\MultiDB; use Livewire\WithPagination; +use App\Models\RecurringInvoice; +use App\Utils\Traits\WithSorting; +use Livewire\Attributes\Computed; class DocumentsTable extends Component { use WithPagination; use WithSorting; - public Company $company; - - public Client $client; - public int $client_id; public int $per_page = 10; @@ -51,13 +48,15 @@ class DocumentsTable extends Component { MultiDB::setDb($this->db); - $this->client = Client::query()->withTrashed()->with('company')->find($this->client_id); - - $this->company = $this->client->company; - $this->query = $this->documents(); } + #[Computed()] + public function client() + { + return Client::withTrashed()->find($this->client_id); + } + public function render() { $this->updateResources(request()->tab ?: $this->tab); @@ -119,7 +118,7 @@ class DocumentsTable extends Component protected function documents() { - return $this->client->documents() + return $this->client()->documents() ->where('is_public', true); } @@ -128,7 +127,7 @@ class DocumentsTable extends Component return Document::query() ->where('is_public', true) ->whereHasMorph('documentable', [Credit::class], function ($query) { - $query->where('client_id', $this->client->id); + $query->where('client_id', $this->client()->id); }); } @@ -137,7 +136,7 @@ class DocumentsTable extends Component return Document::query() ->where('is_public', true) ->whereHasMorph('documentable', [Expense::class], function ($query) { - $query->where('client_id', $this->client->id); + $query->where('client_id', $this->client()->id); }); } @@ -146,7 +145,7 @@ class DocumentsTable extends Component return Document::query() ->where('is_public', true) ->whereHasMorph('documentable', [Invoice::class], function ($query) { - $query->where('client_id', $this->client->id); + $query->where('client_id', $this->client()->id); }); } @@ -155,7 +154,7 @@ class DocumentsTable extends Component return Document::query() ->where('is_public', true) ->whereHasMorph('documentable', [Payment::class], function ($query) { - $query->where('client_id', $this->client->id); + $query->where('client_id', $this->client()->id); }); } @@ -164,7 +163,7 @@ class DocumentsTable extends Component return Document::query() ->where('is_public', true) ->whereHasMorph('documentable', [Project::class], function ($query) { - $query->where('client_id', $this->client->id); + $query->where('client_id', $this->client()->id); }); } @@ -173,7 +172,7 @@ class DocumentsTable extends Component return Document::query() ->where('is_public', true) ->whereHasMorph('documentable', [Quote::class], function ($query) { - $query->where('client_id', $this->client->id); + $query->where('client_id', $this->client()->id); }); } @@ -182,7 +181,7 @@ class DocumentsTable extends Component return Document::query() ->where('is_public', true) ->whereHasMorph('documentable', [RecurringInvoice::class], function ($query) { - $query->where('client_id', $this->client->id); + $query->where('client_id', $this->client()->id); }); } @@ -191,7 +190,7 @@ class DocumentsTable extends Component return Document::query() ->where('is_public', true) ->whereHasMorph('documentable', [Task::class], function ($query) { - $query->where('client_id', $this->client->id); + $query->where('client_id', $this->client()->id); }); } } diff --git a/app/Livewire/InvoicesTable.php b/app/Livewire/InvoicesTable.php index 849f812280..2034b893a6 100644 --- a/app/Livewire/InvoicesTable.php +++ b/app/Livewire/InvoicesTable.php @@ -29,8 +29,6 @@ class InvoicesTable extends Component public array $status = []; - public Company $company; - public int $company_id; public string $db; @@ -39,8 +37,6 @@ class InvoicesTable extends Component { MultiDB::setDb($this->db); - $this->company = Company::find($this->company_id); - $this->sort_asc = false; $this->sort_field = 'date'; @@ -51,7 +47,7 @@ class InvoicesTable extends Component $local_status = []; $query = Invoice::query() - ->where('company_id', $this->company->id) + ->where('company_id', auth()->guard('contact')->user()->company_id) ->where('is_deleted', false) ->where('is_proforma', false) ->with('client.gateway_tokens', 'client.contacts') diff --git a/app/Livewire/PayNowDropdown.php b/app/Livewire/PayNowDropdown.php index d6276ee41d..718019c60b 100644 --- a/app/Livewire/PayNowDropdown.php +++ b/app/Livewire/PayNowDropdown.php @@ -21,11 +21,13 @@ class PayNowDropdown extends Component public $methods; - public $company; + public $db; + + public $company_id; public function mount() { - MultiDB::setDb($this->company->db); + MultiDB::setDb($this->db); $this->methods = auth()->guard('contact')->user()->client->service()->getPaymentMethods($this->total); } diff --git a/app/Livewire/PaymentMethodsTable.php b/app/Livewire/PaymentMethodsTable.php index d3d70c79a5..938626fb46 100644 --- a/app/Livewire/PaymentMethodsTable.php +++ b/app/Livewire/PaymentMethodsTable.php @@ -17,10 +17,6 @@ class PaymentMethodsTable extends Component public $per_page = 10; - public Client $client; - - public Company $company; - public int $client_id; public string $db; @@ -28,18 +24,14 @@ class PaymentMethodsTable extends Component public function mount() { MultiDB::setDb($this->db); - - $this->client = Client::withTrashed()->with('company')->find($this->client_id); - - $this->company = $this->client->company; } public function render() { $query = ClientGatewayToken::query() ->with('gateway_type') - ->where('company_id', $this->company->id) - ->where('client_id', $this->client->id) + ->where('company_id', auth()->guard('contact')->user()->company_id) + ->where('client_id', auth()->guard('contact')->user()->client_id) ->whereHas('gateway', function ($query) { $query->where('is_deleted', 0) ->where('deleted_at', null); diff --git a/app/Livewire/PaymentsTable.php b/app/Livewire/PaymentsTable.php index 0f6de382e0..e2613082c0 100644 --- a/app/Livewire/PaymentsTable.php +++ b/app/Livewire/PaymentsTable.php @@ -26,8 +26,6 @@ class PaymentsTable extends Component public int $per_page = 10; - public Company $company; - public int $company_id; public string $db; @@ -35,15 +33,13 @@ class PaymentsTable extends Component public function mount() { MultiDB::setDb($this->db); - - $this->company = Company::find($this->company_id); } public function render() { $query = Payment::query() ->with('type', 'client', 'invoices') - ->where('company_id', $this->company->id) + ->where('company_id', auth()->guard('contact')->user()->company_id) ->where('client_id', auth()->guard('contact')->user()->client_id) ->whereIn('status_id', [Payment::STATUS_FAILED, Payment::STATUS_COMPLETED, Payment::STATUS_PENDING, Payment::STATUS_REFUNDED, Payment::STATUS_PARTIALLY_REFUNDED]) ->orderBy($this->sort_field, $this->sort_asc ? 'desc' : 'asc') diff --git a/app/Livewire/PdfSlot.php b/app/Livewire/PdfSlot.php index 66edfade66..1714294abf 100644 --- a/app/Livewire/PdfSlot.php +++ b/app/Livewire/PdfSlot.php @@ -12,28 +12,31 @@ namespace App\Livewire; -use App\Jobs\EDocument\CreateEDocument; +use App\Utils\Number; +use Livewire\Component; +use App\Utils\HtmlEngine; use App\Libraries\MultiDB; +use Illuminate\Support\Str; +use App\Models\QuoteInvitation; +use App\Utils\VendorHtmlEngine; use App\Models\CreditInvitation; use App\Models\InvoiceInvitation; +use Livewire\Attributes\Computed; +use Illuminate\Support\Facades\Cache; +use App\Jobs\EDocument\CreateEDocument; use App\Models\PurchaseOrderInvitation; -use App\Models\QuoteInvitation; use App\Models\RecurringInvoiceInvitation; use App\Services\PdfMaker\Designs\Utilities\DesignHelpers; -use App\Utils\HtmlEngine; -use App\Utils\Number; -use App\Utils\VendorHtmlEngine; -use Illuminate\Support\Facades\Cache; -use Illuminate\Support\Str; -use Livewire\Component; class PdfSlot extends Component { - public $invitation; + public $invitation_id; public $db; - public $entity; + public $entity_id; + + public $class; public $pdf; @@ -65,25 +68,36 @@ class PdfSlot extends Component { MultiDB::setDb($this->db); - if(!$this->invitation) { - $this->entity->service()->createInvitations(); - $this->invitation = $this->entity->invitations()->first(); + if(!$this->invitation_id) { + $this->entity()->service()->createInvitations(); } } + #[Computed] + public function entity() + { + return $this->class::withTrashed()->find($this->entity_id); + } + + #[Computed] + public function invitation() + { + return $this->entity()->invitations()->first(); + } + public function getPdf() { - if(!$this->invitation) { - $this->entity->service()->createInvitations(); - $this->invitation = $this->entity->invitations()->first(); - } + // if(!$this->invitation) { + // $this->entity()->service()->createInvitations(); + // $this->invitation = $this->entity()->invitations()->first(); + // } $blob = [ 'entity_type' => $this->resolveEntityType(), - 'entity_id' => $this->entity->id, - 'invitation_id' => $this->invitation->id, + 'entity_id' => $this->entity()->id, + 'invitation_id' => $this->invitation()->id, 'download' => false, ]; @@ -98,9 +112,9 @@ class PdfSlot extends Component public function downloadPdf() { - $file_name = $this->entity->numberFormatter().'.pdf'; + $file_name = $this->entity()->numberFormatter().'.pdf'; - $file = (new \App\Jobs\Entity\CreateRawPdf($this->invitation))->handle(); + $file = (new \App\Jobs\Entity\CreateRawPdf($this->invitation()))->handle(); $headers = ['Content-Type' => 'application/pdf']; @@ -113,9 +127,9 @@ class PdfSlot extends Component public function downloadEDocument() { - $file_name = $this->entity->numberFormatter().'.xml'; + $file_name = $this->entity()->numberFormatter().'.xml'; - $file = (new CreateEDocument($this->entity))->handle(); + $file = (new CreateEDocument($this->entity()))->handle(); $headers = ['Content-Type' => 'application/xml']; @@ -129,10 +143,10 @@ class PdfSlot extends Component { $this->entity_type = $this->resolveEntityType(); - $this->entity_calc = $this->entity->calc(); + $this->entity_calc = $this->entity()->calc(); - $this->settings = $this->entity->client ? $this->entity->client->getMergedSettings() : $this->entity->company->settings; - $this->html_entity_option = $this->entity->client ? $this->entity->client->getSetting('show_pdfhtml_on_mobile') : $this->entity->company->getSetting('show_pdfhtml_on_mobile'); + $this->settings = $this->entity()->client ? $this->entity()->client->getMergedSettings() : $this->entity()->company->settings; + $this->html_entity_option = $this->entity()->client ? $this->entity()->client->getSetting('show_pdfhtml_on_mobile') : $this->entity()->company->getSetting('show_pdfhtml_on_mobile'); $this->show_cost = in_array('$product.unit_cost', $this->settings->pdf_variables->product_columns); $this->show_line_total = in_array('$product.line_total', $this->settings->pdf_variables->product_columns); @@ -145,24 +159,24 @@ class PdfSlot extends Component } $this->html_variables = $this->entity_type == 'purchase_order' ? - (new VendorHtmlEngine($this->invitation))->generateLabelsAndValues() : - (new HtmlEngine($this->invitation))->generateLabelsAndValues(); + (new VendorHtmlEngine($this->invitation()))->generateLabelsAndValues() : + (new HtmlEngine($this->invitation()))->generateLabelsAndValues(); - $this->entity->terms = $this->entity->parseHtmlVariables('terms', $this->html_variables); - $this->entity->public_notes = $this->entity->parseHtmlVariables('public_notes', $this->html_variables); + $this->entity()->terms = $this->entity()->parseHtmlVariables('terms', $this->html_variables); + $this->entity()->public_notes = $this->entity()->parseHtmlVariables('public_notes', $this->html_variables); return render('components.livewire.pdf-slot', [ - 'invitation' => $this->invitation, - 'entity' => $this->entity, + 'invitation' => $this->invitation(), + 'entity' => $this->entity(), 'settings' => $this->settings, - 'data' => $this->invitation->company->settings, + 'data' => $this->invitation()->company->settings, 'entity_type' => $this->entity_type, 'products' => $this->getProducts(), 'services' => $this->getServices(), - 'amount' => Number::formatMoney($this->entity->amount, $this->entity->client ?: $this->entity->vendor), - 'balance' => Number::formatMoney($this->entity->balance, $this->entity->client ?: $this->entity->vendor), - 'discount' => $this->entity_calc->getTotalDiscount() > 0 ? Number::formatMoney($this->entity_calc->getTotalDiscount(), $this->entity->client ?: $this->entity->vendor) : false, - 'taxes' => $this->entity_calc->getTotalTaxes() > 0 ? Number::formatMoney($this->entity_calc->getTotalTaxes(), $this->entity->client ?: $this->entity->vendor) : false, + 'amount' => Number::formatMoney($this->entity()->amount, $this->entity()->client ?: $this->entity()->vendor), + 'balance' => Number::formatMoney($this->entity()->balance, $this->entity()->client ?: $this->entity()->vendor), + 'discount' => $this->entity_calc->getTotalDiscount() > 0 ? Number::formatMoney($this->entity_calc->getTotalDiscount(), $this->entity()->client ?: $this->entity()->vendor) : false, + 'taxes' => $this->entity_calc->getTotalTaxes() > 0 ? Number::formatMoney($this->entity_calc->getTotalTaxes(), $this->entity()->client ?: $this->entity()->vendor) : false, 'company_details' => $this->getCompanyDetails(), 'company_address' => $this->getCompanyAddress(), 'entity_details' => $this->getEntityDetails(), @@ -269,7 +283,7 @@ class PdfSlot extends Component private function getProducts() { - $product_items = collect($this->entity->line_items)->filter(function ($item) { + $product_items = collect($this->entity()->line_items)->filter(function ($item) { return $item->type_id == 1 || $item->type_id == 6 || $item->type_id == 5; })->map(function ($item) { @@ -277,9 +291,9 @@ class PdfSlot extends Component return [ 'quantity' => $item->quantity, - 'cost' => Number::formatMoney($item->cost, $this->entity->client ?: $this->entity->vendor), - 'notes' => $this->invitation->company->markdown_enabled ? DesignHelpers::parseMarkdownToHtml($notes) : $notes, - 'line_total' => Number::formatMoney($item->line_total, $this->entity->client ?: $this->entity->vendor), + 'cost' => Number::formatMoney($item->cost, $this->entity()->client ?: $this->entity()->vendor), + 'notes' => $this->invitation()->company->markdown_enabled ? DesignHelpers::parseMarkdownToHtml($notes) : $notes, + 'line_total' => Number::formatMoney($item->line_total, $this->entity()->client ?: $this->entity()->vendor), ]; }); @@ -288,14 +302,14 @@ class PdfSlot extends Component private function getServices() { - $task_items = collect($this->entity->line_items)->filter(function ($item) { + $task_items = collect($this->entity()->line_items)->filter(function ($item) { return $item->type_id == 2; })->map(function ($item) { return [ 'quantity' => $item->quantity, - 'cost' => Number::formatMoney($item->cost, $this->entity->client ?: $this->entity->vendor), - 'notes' => $this->invitation->company->markdown_enabled ? DesignHelpers::parseMarkdownToHtml($item->notes) : $item->notes, - 'line_total' => Number::formatMoney($item->line_total, $this->entity->client ?: $this->entity->vendor), + 'cost' => Number::formatMoney($item->cost, $this->entity()->client ?: $this->entity()->vendor), + 'notes' => $this->invitation()->company->markdown_enabled ? DesignHelpers::parseMarkdownToHtml($item->notes) : $item->notes, + 'line_total' => Number::formatMoney($item->line_total, $this->entity()->client ?: $this->entity()->vendor), ]; }); @@ -305,16 +319,16 @@ class PdfSlot extends Component private function resolveEntityType(): string { - if ($this->invitation instanceof InvoiceInvitation) { + if ($this->invitation() instanceof InvoiceInvitation) { return 'invoice'; - } elseif ($this->invitation instanceof QuoteInvitation) { + } elseif ($this->invitation() instanceof QuoteInvitation) { $this->is_quote = true; return 'quote'; - } elseif ($this->invitation instanceof CreditInvitation) { + } elseif ($this->invitation() instanceof CreditInvitation) { return 'credit'; - } elseif ($this->invitation instanceof RecurringInvoiceInvitation) { + } elseif ($this->invitation() instanceof RecurringInvoiceInvitation) { return 'recurring_invoice'; - } elseif ($this->invitation instanceof PurchaseOrderInvitation) { + } elseif ($this->invitation() instanceof PurchaseOrderInvitation) { $this->route_entity = 'vendor'; return 'purchase_order'; } diff --git a/app/Services/EDocument/Gateway/Storecove/Storecove.php b/app/Services/EDocument/Gateway/Storecove/Storecove.php index 55e19cc485..b65f17fc7b 100644 --- a/app/Services/EDocument/Gateway/Storecove/Storecove.php +++ b/app/Services/EDocument/Gateway/Storecove/Storecove.php @@ -504,7 +504,7 @@ class Storecove * Remove the entity from the network * * @param int $legal_entity_id - * @return bool + * @return array|\Illuminate\Http\Client\Response */ public function deleteIdentifier(int $legal_entity_id): array|\Illuminate\Http\Client\Response { diff --git a/app/Services/EDocument/Gateway/Storecove/StorecoveAdapter.php b/app/Services/EDocument/Gateway/Storecove/StorecoveAdapter.php index 56855a06fb..5edfb4b03a 100644 --- a/app/Services/EDocument/Gateway/Storecove/StorecoveAdapter.php +++ b/app/Services/EDocument/Gateway/Storecove/StorecoveAdapter.php @@ -439,6 +439,9 @@ class StorecoveAdapter if($code == 'O' && $this->ninja_invoice->client->classification == 'government') return 'exempt'; + // elseif($code == 'K' && $this->ninja_invoice->company->getSetting('classification') == 'individual') + // return 'reverse_charge'; + return match($code){ 'S' => 'standard', 'Z' => 'zero_rated', diff --git a/app/Services/EDocument/Standards/Validation/Peppol/EntityLevel.php b/app/Services/EDocument/Standards/Validation/Peppol/EntityLevel.php index bc860c80d7..fcf451f39d 100644 --- a/app/Services/EDocument/Standards/Validation/Peppol/EntityLevel.php +++ b/app/Services/EDocument/Standards/Validation/Peppol/EntityLevel.php @@ -159,7 +159,7 @@ class EntityLevel } //If not an individual, you MUST have a VAT number - if ($client->classification != 'individual' && !$this->validString($client->vat_number)) { + if (!in_array($client->classification, ['government','individual']) && !$this->validString($client->vat_number)) { $errors[] = ['field' => 'vat_number', 'label' => ctrans("texts.vat_number")]; } diff --git a/app/Services/EDocument/Standards/Validation/XsltDocumentValidator.php b/app/Services/EDocument/Standards/Validation/XsltDocumentValidator.php index 7f4a94529c..1811d32cff 100644 --- a/app/Services/EDocument/Standards/Validation/XsltDocumentValidator.php +++ b/app/Services/EDocument/Standards/Validation/XsltDocumentValidator.php @@ -76,9 +76,9 @@ class XsltDocumentValidator } } - catch(\Exception $e){ + catch(\Throwable $th){ - $this->errors['general'][] = $e->getMessage(); + $this->errors['general'][] = $th->getMessage(); } return $this; diff --git a/resources/views/portal/ninja2020/components/pdf-viewer.blade.php b/resources/views/portal/ninja2020/components/pdf-viewer.blade.php index 307f4ea33f..ebd301ac7a 100644 --- a/resources/views/portal/ninja2020/components/pdf-viewer.blade.php +++ b/resources/views/portal/ninja2020/components/pdf-viewer.blade.php @@ -46,11 +46,10 @@ -@livewire('pdf-slot', ['entity' => $entity, 'invitation' => $invitation, 'db' => $entity->company->db]) +@livewire('pdf-slot', ['class' => get_class($entity), 'entity' => $entity, 'invitation' => $invitation, 'db' => $entity->company->db]) @if($mobile) @push('footer') - {{-- @vite('resources/js/clients/shared/pdf.js') --}} @endpush @endif diff --git a/resources/views/portal/ninja2020/credits/show.blade.php b/resources/views/portal/ninja2020/credits/show.blade.php index 4c4d8f8255..1a870448d3 100644 --- a/resources/views/portal/ninja2020/credits/show.blade.php +++ b/resources/views/portal/ninja2020/credits/show.blade.php @@ -15,8 +15,8 @@ @include('portal.ninja2020.components.entity-documents', ['entity' => $credit]) -@livewire('pdf-slot', ['entity' => $credit, 'invitation' => $invitation, 'db' => $credit->company->db]) - +@livewire('pdf-slot', ['class' => get_class($credit), 'entity_id' => $credit->id, 'invitation_id' => $invitation->id ?? false, 'db' => $credit->company->db]) + @endsection @section('footer') diff --git a/resources/views/portal/ninja2020/invoices/payment.blade.php b/resources/views/portal/ninja2020/invoices/payment.blade.php index 2142c23a8f..1cdc9d6c80 100644 --- a/resources/views/portal/ninja2020/invoices/payment.blade.php +++ b/resources/views/portal/ninja2020/invoices/payment.blade.php @@ -29,7 +29,7 @@
- @livewire('pay-now-dropdown', ['total' => $total, 'company' => $company]) + @livewire('pay-now-dropdown', ['total' => $total, 'company_id' => $company->id, 'db' => $company->db])
diff --git a/resources/views/portal/ninja2020/invoices/show.blade.php b/resources/views/portal/ninja2020/invoices/show.blade.php index 94b50ab5c3..a7a91a3e08 100644 --- a/resources/views/portal/ninja2020/invoices/show.blade.php +++ b/resources/views/portal/ninja2020/invoices/show.blade.php @@ -66,7 +66,7 @@ @if($settings->client_portal_allow_under_payment || $settings->client_portal_allow_over_payment) @else - @livewire('pay-now-dropdown', ['total' => $invoice->getPayableAmount(), 'company' => $company]) + @livewire('pay-now-dropdown', ['total' => $invoice->getPayableAmount(), 'company_id' => $company->id, 'db' => $company->db]) @endif
@@ -93,7 +93,7 @@ @endif @include('portal.ninja2020.components.entity-documents', ['entity' => $invoice]) - @livewire('pdf-slot', ['entity' => $invoice, 'invitation' => $invitation, 'db' => $invoice->company->db]) + @livewire('pdf-slot', ['class' => get_class($invoice), 'entity_id' => $invoice->id, 'invitation_id' => $invitation->id ?? false, 'db' => $invoice->company->db]) @endsection diff --git a/resources/views/portal/ninja2020/invoices/show_smooth.blade.php b/resources/views/portal/ninja2020/invoices/show_smooth.blade.php index f1b1df892f..dd2ce431e2 100644 --- a/resources/views/portal/ninja2020/invoices/show_smooth.blade.php +++ b/resources/views/portal/ninja2020/invoices/show_smooth.blade.php @@ -4,7 +4,8 @@ @section('body') @if(Route::is('client.invoice.show')) - @livewire('pdf-slot', ['entity' => $invoice, 'invitation' => $invitation, 'db' => $invoice->company->db, 'with_close_button' => 'dialog#dialogPdf']) + @livewire('pdf-slot', ['class' => get_class($invoice), 'entity_id' => $invoice->id, 'invitation_id' => $invitation->id ?? false, 'db' => $invoice->company->db, 'with_close_button' => 'dialog#dialogPdf']) +
diff --git a/resources/views/portal/ninja2020/purchase_orders/show.blade.php b/resources/views/portal/ninja2020/purchase_orders/show.blade.php index f29b055f65..4767ee2160 100644 --- a/resources/views/portal/ninja2020/purchase_orders/show.blade.php +++ b/resources/views/portal/ninja2020/purchase_orders/show.blade.php @@ -37,7 +37,7 @@ @endif @include('portal.ninja2020.components.entity-documents', ['entity' => $purchase_order]) - @livewire('pdf-slot', ['entity' => $purchase_order, 'invitation' => $invitation, 'db' => $purchase_order->company->db]) + @livewire('pdf-slot', ['class' => get_class($purchase_order), 'entity_id' => $purchase_order->id, 'invitation_id' => $invitation->id ?? false, 'db' => $purchase_order->company->db]) @endsection diff --git a/resources/views/portal/ninja2020/quotes/show.blade.php b/resources/views/portal/ninja2020/quotes/show.blade.php index 67071d37de..e57c748956 100644 --- a/resources/views/portal/ninja2020/quotes/show.blade.php +++ b/resources/views/portal/ninja2020/quotes/show.blade.php @@ -72,7 +72,7 @@ @endif @include('portal.ninja2020.components.entity-documents', ['entity' => $quote]) - @livewire('pdf-slot', ['entity' => $quote, 'invitation' => $invitation, 'db' => $quote->company->db]) + @livewire('pdf-slot', ['class' => get_class($quote), 'entity_id' => $quote->id, 'invitation_id' => $invitation->id ?? false, 'db' => $quote->company->db]) @endsection