From e3e19208a46a227a08633fa706181029133645e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Fri, 15 Mar 2024 01:58:17 +0100 Subject: [PATCH] Fixes for skipping --- app/Livewire/RequiredClientInfo.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/Livewire/RequiredClientInfo.php b/app/Livewire/RequiredClientInfo.php index 1fe94cdbd95a..3d045ef81f4c 100644 --- a/app/Livewire/RequiredClientInfo.php +++ b/app/Livewire/RequiredClientInfo.php @@ -231,15 +231,6 @@ class RequiredClientInfo extends Component ? $this->checkFields() : $this->show_form = false; - if (count($this->fields) === 0) { - $this->show_form = false; - - $this->dispatch( - 'passed-required-fields-check', - client_postal_code: $this->contact->client->postal_code - ); - } - if (request()->query('source') === 'subscriptions') { $this->show_form = false; @@ -406,6 +397,17 @@ $_contact->push(); } } } + + $left = collect($this->fields) + ->filter(fn ($field) => !array_key_exists('filled', $field)) + ->count(); + + if ($left === 0) { + $this->dispatch( + 'passed-required-fields-check', + client_postal_code: $this->contact->client->postal_code + ); + } } public function showCopyBillingCheckbox(): bool