override always_show_required_fields with is_subscription

This commit is contained in:
Benjamin Beganović 2024-05-09 00:53:45 +02:00
parent f343debeef
commit f3ffc3d4d5

View File

@ -190,6 +190,8 @@ class RequiredClientInfo extends Component
public $db; public $db;
public bool $is_subscription = false;
public function mount() public function mount()
{ {
MultiDB::setDb($this->db); MultiDB::setDb($this->db);
@ -230,12 +232,11 @@ class RequiredClientInfo extends Component
$this->invoice_terms = $invoice->terms; $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(); $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; $this->show_form = true;
} }
#[Computed] #[Computed]
@ -371,7 +372,7 @@ class RequiredClientInfo extends Component
public function checkFields() public function checkFields()
{ {
MultiDB::setDb($this->db); MultiDB::setDb($this->db);
$_contact = ClientContact::withTrashed()->find($this->contact_id); $_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( $this->dispatch(
'passed-required-fields-check', 'passed-required-fields-check',
client_postal_code: $this->contact->client->postal_code client_postal_code: $this->contact->client->postal_code