diff --git a/app/Livewire/Flow2/PaymentMethod.php b/app/Livewire/Flow2/PaymentMethod.php index d849b738a91a..2014159e98be 100644 --- a/app/Livewire/Flow2/PaymentMethod.php +++ b/app/Livewire/Flow2/PaymentMethod.php @@ -30,7 +30,7 @@ class PaymentMethod extends Component public $amount = 0; - public function placeholder() + public function placeholder() { return <<<'HTML'
@@ -42,9 +42,20 @@ class PaymentMethod extends Component HTML; } + public function handleSelect(string $company_gateway_id, string $gateway_type_id, string $amount) + { + $this->isLoading = true; + + $this->dispatch( + event: 'payment-method-selected', + company_gateway_id: $company_gateway_id, + gateway_type_id: $gateway_type_id, + amount: $amount, + ); + } + public function mount() { - $this->variables = $this->getContext()['variables']; $this->amount = array_sum(array_column($this->getContext()['payable_invoices'], 'amount')); @@ -52,10 +63,9 @@ class PaymentMethod extends Component $this->methods = $this->getContext()['invitation']->contact->client->service()->getPaymentMethods($this->amount); - if(count($this->methods) == 1) { + if (count($this->methods) == 1) { $this->dispatch('singlePaymentMethodFound', company_gateway_id: $this->methods[0]['company_gateway_id'], gateway_type_id: $this->methods[0]['gateway_type_id'], amount: $this->amount); - } - else { + } else { $this->isLoading = false; $this->dispatch('loadingCompleted'); } diff --git a/app/Livewire/Flow2/RequiredFields.php b/app/Livewire/Flow2/RequiredFields.php index de07a1c9bfc6..161319b5f757 100644 --- a/app/Livewire/Flow2/RequiredFields.php +++ b/app/Livewire/Flow2/RequiredFields.php @@ -103,6 +103,8 @@ class RequiredFields extends Component public function handleSubmit(array $data) { + $this->is_loading = true; + $rff = new RFFService( fields: $this->fields, database: $this->getContext()['db'], diff --git a/resources/views/portal/ninja2020/flow2/payment-method.blade.php b/resources/views/portal/ninja2020/flow2/payment-method.blade.php index 7b8c3c60053a..a1b8ecb2ebdd 100644 --- a/resources/views/portal/ninja2020/flow2/payment-method.blade.php +++ b/resources/views/portal/ninja2020/flow2/payment-method.blade.php @@ -1,26 +1,28 @@
- +

{{ ctrans('texts.payment_methods') }} +

+ + -

{{ ctrans('texts.payment_methods') }} -

- -
- @foreach($methods as $index => $method) - - @endforeach -
+ @unless($isLoading) +
+ @foreach($methods as $index => $method) + + @endforeach +
+ @endunless @script