Merge pull request #9511 from beganovich/1390-terms-2.0

Fixes for gateway fields override
This commit is contained in:
David Bomba 2024-05-09 09:37:16 +10:00 committed by GitHub
commit c7058c6af9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 8 deletions

View File

@ -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]
@ -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

View File

@ -10,6 +10,6 @@
@endif
<div>
@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])
</div>
</div>

View File

@ -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'])
<div class="container mx-auto grid grid-cols-12 opacity-25 pointer-events-none" data-ref="gateway-container">
<div class="col-span-12 lg:col-span-6 lg:col-start-4 bg-white shadow rounded-lg">