Minor fixes for required fields logic

This commit is contained in:
David Bomba 2024-11-02 18:38:14 +11:00
parent 1441127b29
commit 9615830e6b
2 changed files with 12 additions and 9 deletions

View File

@ -159,10 +159,6 @@ class InvoicePay extends Component
$this->setContext('fields', $fields); // $this->context['fields'] = $fields; $this->setContext('fields', $fields); // $this->context['fields'] = $fields;
if ($company_gateway->always_show_required_fields) {
return $this->required_fields = true;
}
/** @var \App\Models\ClientContact $contact */ /** @var \App\Models\ClientContact $contact */
$contact = $this->getContext()['contact']; $contact = $this->getContext()['contact'];
@ -185,6 +181,10 @@ class InvoicePay extends Component
} }
} }
if ($company_gateway->always_show_required_fields) {
return $this->required_fields = true;
}
return $this->required_fields = false; return $this->required_fields = false;
} }

View File

@ -96,13 +96,16 @@ class RequiredFields extends Component
/** @var \App\Models\ClientContact $contact */ /** @var \App\Models\ClientContact $contact */
$rff->check($contact); $rff->check($contact);
if ($rff->unfilled_fields === 0) { if ($rff->unfilled_fields === 0 && !$this->company_gateway->always_show_required_fields)
$this->dispatch('required-fields'); $this->dispatch('required-fields');
} else
if ($rff->unfilled_fields > 0) {
$this->is_loading = false; $this->is_loading = false;
}
// }
// if ($rff->unfilled_fields > 0) {
// $this->is_loading = false;
// }
} }
public function handleSubmit(array $data) public function handleSubmit(array $data)