Refactor for livewire components

This commit is contained in:
David Bomba 2024-11-14 10:02:58 +11:00
parent 320021dc6e
commit 1e8a82fd29
18 changed files with 114 additions and 114 deletions

View File

@ -26,8 +26,6 @@ class CreditsTable extends Component
public int $per_page = 10; public int $per_page = 10;
public Company $company;
public string $db; public string $db;
public int $company_id; public int $company_id;
@ -36,13 +34,13 @@ class CreditsTable extends Component
{ {
MultiDB::setDb($this->db); MultiDB::setDb($this->db);
$this->company = Company::find($this->company_id);
} }
public function render() public function render()
{ {
$query = Credit::query() $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('client_id', auth()->guard('contact')->user()->client_id)
->where('status_id', '<>', Credit::STATUS_DRAFT) ->where('status_id', '<>', Credit::STATUS_DRAFT)
->where('is_deleted', 0) ->where('is_deleted', 0)

View File

@ -12,31 +12,28 @@
namespace App\Livewire; namespace App\Livewire;
use App\Libraries\MultiDB; use App\Models\Task;
use App\Models\Quote;
use App\Models\Client; use App\Models\Client;
use App\Models\Company;
use App\Models\Credit; use App\Models\Credit;
use App\Models\Document; use App\Models\Company;
use App\Models\Expense; use App\Models\Expense;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\Payment; use App\Models\Payment;
use App\Models\Project; 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 Livewire\Component;
use App\Models\Document;
use App\Libraries\MultiDB;
use Livewire\WithPagination; use Livewire\WithPagination;
use App\Models\RecurringInvoice;
use App\Utils\Traits\WithSorting;
use Livewire\Attributes\Computed;
class DocumentsTable extends Component class DocumentsTable extends Component
{ {
use WithPagination; use WithPagination;
use WithSorting; use WithSorting;
public Company $company;
public Client $client;
public int $client_id; public int $client_id;
public int $per_page = 10; public int $per_page = 10;
@ -51,13 +48,15 @@ class DocumentsTable extends Component
{ {
MultiDB::setDb($this->db); MultiDB::setDb($this->db);
$this->client = Client::query()->withTrashed()->with('company')->find($this->client_id);
$this->company = $this->client->company;
$this->query = $this->documents(); $this->query = $this->documents();
} }
#[Computed()]
public function client()
{
return Client::withTrashed()->find($this->client_id);
}
public function render() public function render()
{ {
$this->updateResources(request()->tab ?: $this->tab); $this->updateResources(request()->tab ?: $this->tab);
@ -119,7 +118,7 @@ class DocumentsTable extends Component
protected function documents() protected function documents()
{ {
return $this->client->documents() return $this->client()->documents()
->where('is_public', true); ->where('is_public', true);
} }
@ -128,7 +127,7 @@ class DocumentsTable extends Component
return Document::query() return Document::query()
->where('is_public', true) ->where('is_public', true)
->whereHasMorph('documentable', [Credit::class], function ($query) { ->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() return Document::query()
->where('is_public', true) ->where('is_public', true)
->whereHasMorph('documentable', [Expense::class], function ($query) { ->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() return Document::query()
->where('is_public', true) ->where('is_public', true)
->whereHasMorph('documentable', [Invoice::class], function ($query) { ->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() return Document::query()
->where('is_public', true) ->where('is_public', true)
->whereHasMorph('documentable', [Payment::class], function ($query) { ->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() return Document::query()
->where('is_public', true) ->where('is_public', true)
->whereHasMorph('documentable', [Project::class], function ($query) { ->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() return Document::query()
->where('is_public', true) ->where('is_public', true)
->whereHasMorph('documentable', [Quote::class], function ($query) { ->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() return Document::query()
->where('is_public', true) ->where('is_public', true)
->whereHasMorph('documentable', [RecurringInvoice::class], function ($query) { ->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() return Document::query()
->where('is_public', true) ->where('is_public', true)
->whereHasMorph('documentable', [Task::class], function ($query) { ->whereHasMorph('documentable', [Task::class], function ($query) {
$query->where('client_id', $this->client->id); $query->where('client_id', $this->client()->id);
}); });
} }
} }

View File

@ -29,8 +29,6 @@ class InvoicesTable extends Component
public array $status = []; public array $status = [];
public Company $company;
public int $company_id; public int $company_id;
public string $db; public string $db;
@ -39,8 +37,6 @@ class InvoicesTable extends Component
{ {
MultiDB::setDb($this->db); MultiDB::setDb($this->db);
$this->company = Company::find($this->company_id);
$this->sort_asc = false; $this->sort_asc = false;
$this->sort_field = 'date'; $this->sort_field = 'date';
@ -51,7 +47,7 @@ class InvoicesTable extends Component
$local_status = []; $local_status = [];
$query = Invoice::query() $query = Invoice::query()
->where('company_id', $this->company->id) ->where('company_id', auth()->guard('contact')->user()->company_id)
->where('is_deleted', false) ->where('is_deleted', false)
->where('is_proforma', false) ->where('is_proforma', false)
->with('client.gateway_tokens', 'client.contacts') ->with('client.gateway_tokens', 'client.contacts')

View File

@ -21,11 +21,13 @@ class PayNowDropdown extends Component
public $methods; public $methods;
public $company; public $db;
public $company_id;
public function mount() public function mount()
{ {
MultiDB::setDb($this->company->db); MultiDB::setDb($this->db);
$this->methods = auth()->guard('contact')->user()->client->service()->getPaymentMethods($this->total); $this->methods = auth()->guard('contact')->user()->client->service()->getPaymentMethods($this->total);
} }

View File

@ -17,10 +17,6 @@ class PaymentMethodsTable extends Component
public $per_page = 10; public $per_page = 10;
public Client $client;
public Company $company;
public int $client_id; public int $client_id;
public string $db; public string $db;
@ -28,18 +24,14 @@ class PaymentMethodsTable extends Component
public function mount() public function mount()
{ {
MultiDB::setDb($this->db); MultiDB::setDb($this->db);
$this->client = Client::withTrashed()->with('company')->find($this->client_id);
$this->company = $this->client->company;
} }
public function render() public function render()
{ {
$query = ClientGatewayToken::query() $query = ClientGatewayToken::query()
->with('gateway_type') ->with('gateway_type')
->where('company_id', $this->company->id) ->where('company_id', auth()->guard('contact')->user()->company_id)
->where('client_id', $this->client->id) ->where('client_id', auth()->guard('contact')->user()->client_id)
->whereHas('gateway', function ($query) { ->whereHas('gateway', function ($query) {
$query->where('is_deleted', 0) $query->where('is_deleted', 0)
->where('deleted_at', null); ->where('deleted_at', null);

View File

@ -26,8 +26,6 @@ class PaymentsTable extends Component
public int $per_page = 10; public int $per_page = 10;
public Company $company;
public int $company_id; public int $company_id;
public string $db; public string $db;
@ -35,15 +33,13 @@ class PaymentsTable extends Component
public function mount() public function mount()
{ {
MultiDB::setDb($this->db); MultiDB::setDb($this->db);
$this->company = Company::find($this->company_id);
} }
public function render() public function render()
{ {
$query = Payment::query() $query = Payment::query()
->with('type', 'client', 'invoices') ->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) ->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]) ->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') ->orderBy($this->sort_field, $this->sort_asc ? 'desc' : 'asc')

View File

@ -12,28 +12,31 @@
namespace App\Livewire; namespace App\Livewire;
use App\Jobs\EDocument\CreateEDocument; use App\Utils\Number;
use Livewire\Component;
use App\Utils\HtmlEngine;
use App\Libraries\MultiDB; use App\Libraries\MultiDB;
use Illuminate\Support\Str;
use App\Models\QuoteInvitation;
use App\Utils\VendorHtmlEngine;
use App\Models\CreditInvitation; use App\Models\CreditInvitation;
use App\Models\InvoiceInvitation; 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\PurchaseOrderInvitation;
use App\Models\QuoteInvitation;
use App\Models\RecurringInvoiceInvitation; use App\Models\RecurringInvoiceInvitation;
use App\Services\PdfMaker\Designs\Utilities\DesignHelpers; 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 class PdfSlot extends Component
{ {
public $invitation; public $invitation_id;
public $db; public $db;
public $entity; public $entity_id;
public $class;
public $pdf; public $pdf;
@ -65,25 +68,36 @@ class PdfSlot extends Component
{ {
MultiDB::setDb($this->db); MultiDB::setDb($this->db);
if(!$this->invitation) { if(!$this->invitation_id) {
$this->entity->service()->createInvitations(); $this->entity()->service()->createInvitations();
$this->invitation = $this->entity->invitations()->first();
} }
} }
#[Computed]
public function entity()
{
return $this->class::withTrashed()->find($this->entity_id);
}
#[Computed]
public function invitation()
{
return $this->entity()->invitations()->first();
}
public function getPdf() public function getPdf()
{ {
if(!$this->invitation) { // if(!$this->invitation) {
$this->entity->service()->createInvitations(); // $this->entity()->service()->createInvitations();
$this->invitation = $this->entity->invitations()->first(); // $this->invitation = $this->entity()->invitations()->first();
} // }
$blob = [ $blob = [
'entity_type' => $this->resolveEntityType(), 'entity_type' => $this->resolveEntityType(),
'entity_id' => $this->entity->id, 'entity_id' => $this->entity()->id,
'invitation_id' => $this->invitation->id, 'invitation_id' => $this->invitation()->id,
'download' => false, 'download' => false,
]; ];
@ -98,9 +112,9 @@ class PdfSlot extends Component
public function downloadPdf() 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']; $headers = ['Content-Type' => 'application/pdf'];
@ -113,9 +127,9 @@ class PdfSlot extends Component
public function downloadEDocument() 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']; $headers = ['Content-Type' => 'application/xml'];
@ -129,10 +143,10 @@ class PdfSlot extends Component
{ {
$this->entity_type = $this->resolveEntityType(); $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->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->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_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); $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' ? $this->html_variables = $this->entity_type == 'purchase_order' ?
(new VendorHtmlEngine($this->invitation))->generateLabelsAndValues() : (new VendorHtmlEngine($this->invitation()))->generateLabelsAndValues() :
(new HtmlEngine($this->invitation))->generateLabelsAndValues(); (new HtmlEngine($this->invitation()))->generateLabelsAndValues();
$this->entity->terms = $this->entity->parseHtmlVariables('terms', $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); $this->entity()->public_notes = $this->entity()->parseHtmlVariables('public_notes', $this->html_variables);
return render('components.livewire.pdf-slot', [ return render('components.livewire.pdf-slot', [
'invitation' => $this->invitation, 'invitation' => $this->invitation(),
'entity' => $this->entity, 'entity' => $this->entity(),
'settings' => $this->settings, 'settings' => $this->settings,
'data' => $this->invitation->company->settings, 'data' => $this->invitation()->company->settings,
'entity_type' => $this->entity_type, 'entity_type' => $this->entity_type,
'products' => $this->getProducts(), 'products' => $this->getProducts(),
'services' => $this->getServices(), 'services' => $this->getServices(),
'amount' => Number::formatMoney($this->entity->amount, $this->entity->client ?: $this->entity->vendor), 'amount' => Number::formatMoney($this->entity()->amount, $this->entity()->client ?: $this->entity()->vendor),
'balance' => Number::formatMoney($this->entity->balance, $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, '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, 'taxes' => $this->entity_calc->getTotalTaxes() > 0 ? Number::formatMoney($this->entity_calc->getTotalTaxes(), $this->entity()->client ?: $this->entity()->vendor) : false,
'company_details' => $this->getCompanyDetails(), 'company_details' => $this->getCompanyDetails(),
'company_address' => $this->getCompanyAddress(), 'company_address' => $this->getCompanyAddress(),
'entity_details' => $this->getEntityDetails(), 'entity_details' => $this->getEntityDetails(),
@ -269,7 +283,7 @@ class PdfSlot extends Component
private function getProducts() 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; return $item->type_id == 1 || $item->type_id == 6 || $item->type_id == 5;
})->map(function ($item) { })->map(function ($item) {
@ -277,9 +291,9 @@ class PdfSlot extends Component
return [ return [
'quantity' => $item->quantity, 'quantity' => $item->quantity,
'cost' => Number::formatMoney($item->cost, $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, 'notes' => $this->invitation()->company->markdown_enabled ? DesignHelpers::parseMarkdownToHtml($notes) : $notes,
'line_total' => Number::formatMoney($item->line_total, $this->entity->client ?: $this->entity->vendor), 'line_total' => Number::formatMoney($item->line_total, $this->entity()->client ?: $this->entity()->vendor),
]; ];
}); });
@ -288,14 +302,14 @@ class PdfSlot extends Component
private function getServices() 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; return $item->type_id == 2;
})->map(function ($item) { })->map(function ($item) {
return [ return [
'quantity' => $item->quantity, 'quantity' => $item->quantity,
'cost' => Number::formatMoney($item->cost, $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, '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), '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 private function resolveEntityType(): string
{ {
if ($this->invitation instanceof InvoiceInvitation) { if ($this->invitation() instanceof InvoiceInvitation) {
return 'invoice'; return 'invoice';
} elseif ($this->invitation instanceof QuoteInvitation) { } elseif ($this->invitation() instanceof QuoteInvitation) {
$this->is_quote = true; $this->is_quote = true;
return 'quote'; return 'quote';
} elseif ($this->invitation instanceof CreditInvitation) { } elseif ($this->invitation() instanceof CreditInvitation) {
return 'credit'; return 'credit';
} elseif ($this->invitation instanceof RecurringInvoiceInvitation) { } elseif ($this->invitation() instanceof RecurringInvoiceInvitation) {
return 'recurring_invoice'; return 'recurring_invoice';
} elseif ($this->invitation instanceof PurchaseOrderInvitation) { } elseif ($this->invitation() instanceof PurchaseOrderInvitation) {
$this->route_entity = 'vendor'; $this->route_entity = 'vendor';
return 'purchase_order'; return 'purchase_order';
} }

View File

@ -504,7 +504,7 @@ class Storecove
* Remove the entity from the network * Remove the entity from the network
* *
* @param int $legal_entity_id * @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 public function deleteIdentifier(int $legal_entity_id): array|\Illuminate\Http\Client\Response
{ {

View File

@ -439,6 +439,9 @@ class StorecoveAdapter
if($code == 'O' && $this->ninja_invoice->client->classification == 'government') if($code == 'O' && $this->ninja_invoice->client->classification == 'government')
return 'exempt'; return 'exempt';
// elseif($code == 'K' && $this->ninja_invoice->company->getSetting('classification') == 'individual')
// return 'reverse_charge';
return match($code){ return match($code){
'S' => 'standard', 'S' => 'standard',
'Z' => 'zero_rated', 'Z' => 'zero_rated',

View File

@ -159,7 +159,7 @@ class EntityLevel
} }
//If not an individual, you MUST have a VAT number //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")]; $errors[] = ['field' => 'vat_number', 'label' => ctrans("texts.vat_number")];
} }

View File

@ -76,9 +76,9 @@ class XsltDocumentValidator
} }
} }
catch(\Exception $e){ catch(\Throwable $th){
$this->errors['general'][] = $e->getMessage(); $this->errors['general'][] = $th->getMessage();
} }
return $this; return $this;

View File

@ -46,11 +46,10 @@
</section> </section>
</div> </div>
@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) @if($mobile)
@push('footer') @push('footer')
<!-- <script src="{{ asset('js/clients/shared/pdf.js') }}" defer></script> -->
{{-- @vite('resources/js/clients/shared/pdf.js') --}} {{-- @vite('resources/js/clients/shared/pdf.js') --}}
@endpush @endpush
@endif @endif

View File

@ -15,7 +15,7 @@
</div> </div>
@include('portal.ninja2020.components.entity-documents', ['entity' => $credit]) @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 @endsection

View File

@ -29,7 +29,7 @@
<div class="col-span-6 md:col-start-2 md:col-span-4"> <div class="col-span-6 md:col-start-2 md:col-span-4">
<div class="flex justify-end"> <div class="flex justify-end">
<div class="flex justify-end mb-2"> <div class="flex justify-end mb-2">
@livewire('pay-now-dropdown', ['total' => $total, 'company' => $company]) @livewire('pay-now-dropdown', ['total' => $total, 'company_id' => $company->id, 'db' => $company->db])
</div> </div>
</div> </div>

View File

@ -66,7 +66,7 @@
@if($settings->client_portal_allow_under_payment || $settings->client_portal_allow_over_payment) @if($settings->client_portal_allow_under_payment || $settings->client_portal_allow_over_payment)
<button class="button button-primary bg-primary">{{ ctrans('texts.pay_now') }}</button> <button class="button button-primary bg-primary">{{ ctrans('texts.pay_now') }}</button>
@else @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 @endif
</div> </div>
</div> </div>
@ -93,7 +93,7 @@
@endif @endif
@include('portal.ninja2020.components.entity-documents', ['entity' => $invoice]) @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 @endsection

View File

@ -4,7 +4,8 @@
@section('body') @section('body')
@if(Route::is('client.invoice.show')) @if(Route::is('client.invoice.show'))
<dialog class="w-full bg-white rounded-lg px-4 pt-5 pb-4 shadow-xl transform transition-all sm:p-6" id="dialogPdf"> <dialog class="w-full bg-white rounded-lg px-4 pt-5 pb-4 shadow-xl transform transition-all sm:p-6" id="dialogPdf">
@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'])
</dialog> </dialog>
<div class="px-2"> <div class="px-2">

View File

@ -37,7 +37,7 @@
@endif @endif
@include('portal.ninja2020.components.entity-documents', ['entity' => $purchase_order]) @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 @endsection

View File

@ -72,7 +72,7 @@
@endif @endif
@include('portal.ninja2020.components.entity-documents', ['entity' => $quote]) @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 @endsection