From 6190ddbeee1d5fe8189639cf194165a0c4968dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Thu, 9 May 2024 00:53:21 +0200 Subject: [PATCH 1/3] pass is_subscriptions in the rff --- resources/views/billing-portal/v3/rff.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/billing-portal/v3/rff.blade.php b/resources/views/billing-portal/v3/rff.blade.php index 0017d27967ac..f24da0e533c8 100644 --- a/resources/views/billing-portal/v3/rff.blade.php +++ b/resources/views/billing-portal/v3/rff.blade.php @@ -10,6 +10,6 @@ @endif
- @livewire('required-client-info', ['db' => $company->db, 'fields' => method_exists($gateway, 'getClientRequiredFields') ? $gateway->getClientRequiredFields() : [], 'contact_id' => auth()->guard('contact')->user()->id, 'countries' => $countries, 'company_id' => $company->id, 'company_gateway_id' => $gateway->company_gateway ? $gateway->company_gateway->id : $gateway->id, 'form_only' => true]) + @livewire('required-client-info', ['db' => $company->db, 'fields' => method_exists($gateway, 'getClientRequiredFields') ? $gateway->getClientRequiredFields() : [], 'contact_id' => auth()->guard('contact')->user()->id, 'countries' => $countries, 'company_id' => $company->id, 'company_gateway_id' => $gateway->company_gateway ? $gateway->company_gateway->id : $gateway->id, 'form_only' => true, 'is_subscription' => true])
From f343debeef72c55382a80f3a73fe59f5f60aea1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Thu, 9 May 2024 00:53:29 +0200 Subject: [PATCH 2/3] pass is_subscriptions in the payments widget --- resources/views/portal/ninja2020/layout/payments.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/portal/ninja2020/layout/payments.blade.php b/resources/views/portal/ninja2020/layout/payments.blade.php index 5c5177d0dacb..0102fd8a98bf 100644 --- a/resources/views/portal/ninja2020/layout/payments.blade.php +++ b/resources/views/portal/ninja2020/layout/payments.blade.php @@ -11,7 +11,7 @@ @endpush @section('body') - @livewire('required-client-info', ['db' => $company->db, 'fields' => method_exists($gateway, 'getClientRequiredFields') ? $gateway->getClientRequiredFields() : [], 'contact_id' => auth()->guard('contact')->user()->id, 'countries' => $countries, 'company_id' => $company->id, 'company_gateway_id' => $gateway->company_gateway ? $gateway->company_gateway->id : $gateway->id]) + @livewire('required-client-info', ['db' => $company->db, 'fields' => method_exists($gateway, 'getClientRequiredFields') ? $gateway->getClientRequiredFields() : [], 'contact_id' => auth()->guard('contact')->user()->id, 'countries' => $countries, 'company_id' => $company->id, 'company_gateway_id' => $gateway->company_gateway ? $gateway->company_gateway->id : $gateway->id, 'is_subscription' => request()->query('source') == 'subscriptions'])
@@ -72,7 +72,7 @@ }); }); - + document.addEventListener('DOMContentLoaded', function() { let toggleWithToken = document.querySelector('.toggle-payment-with-token'); let toggleWithCard = document.querySelector('#toggle-payment-with-credit-card'); From f3ffc3d4d5540026b1c407cf3f6d665e1c69fa7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Thu, 9 May 2024 00:53:45 +0200 Subject: [PATCH 3/3] override always_show_required_fields with is_subscription --- app/Livewire/RequiredClientInfo.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Livewire/RequiredClientInfo.php b/app/Livewire/RequiredClientInfo.php index a4327f95faa4..361338b33a90 100644 --- a/app/Livewire/RequiredClientInfo.php +++ b/app/Livewire/RequiredClientInfo.php @@ -190,6 +190,8 @@ class RequiredClientInfo extends Component public $db; + public bool $is_subscription = false; + public function mount() { MultiDB::setDb($this->db); @@ -230,12 +232,11 @@ class RequiredClientInfo extends Component $this->invoice_terms = $invoice->terms; } - if(!$this->company_gateway->always_show_required_fields) + if(!$this->company_gateway->always_show_required_fields || $this->is_subscription) $this->checkFields(); - if($this->unfilled_fields > 0 || $this->company_gateway->always_show_required_fields) + if($this->unfilled_fields > 0 || ($this->company_gateway->always_show_required_fields || $this->is_subscription)) $this->show_form = true; - } #[Computed] @@ -371,7 +372,7 @@ class RequiredClientInfo extends Component public function checkFields() { - + MultiDB::setDb($this->db); $_contact = ClientContact::withTrashed()->find($this->contact_id); @@ -398,7 +399,7 @@ class RequiredClientInfo extends Component } } - if ($this->unfilled_fields === 0 && !$this->company_gateway->always_show_required_fields) { + if ($this->unfilled_fields === 0 && (!$this->company_gateway->always_show_required_fields || $this->is_subscription)) { $this->dispatch( 'passed-required-fields-check', client_postal_code: $this->contact->client->postal_code