From a7c360db6a83af32db82e456983aede47436e71f Mon Sep 17 00:00:00 2001 From: Lucio Negrello Date: Thu, 17 Oct 2024 20:45:11 -0300 Subject: [PATCH 1/3] Have next and previous functions disabled when their actions are disabled --- .../resources/views/components/wizard.blade.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/forms/resources/views/components/wizard.blade.php b/packages/forms/resources/views/components/wizard.blade.php index 31baa81ae44..5b14b78e985 100644 --- a/packages/forms/resources/views/components/wizard.blade.php +++ b/packages/forms/resources/views/components/wizard.blade.php @@ -262,7 +262,10 @@ class="h-full w-full text-gray-200 dark:text-white/5 rtl:rotate-180" 'mt-6' => ! $isContained, ]) > - + {{ $getAction('previous') }} @@ -273,11 +276,13 @@ class="h-full w-full text-gray-200 dark:text-white/5 rtl:rotate-180" From 23fbacf5c22a952bf2c591976f172229d6e90264 Mon Sep 17 00:00:00 2001 From: Lucio Negrello Date: Mon, 21 Oct 2024 16:37:59 -0300 Subject: [PATCH 2/3] Use vars to save actions and use isDisabled to condition that --- .../views/components/wizard.blade.php | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/packages/forms/resources/views/components/wizard.blade.php b/packages/forms/resources/views/components/wizard.blade.php index 5b14b78e985..494d3dc0e1c 100644 --- a/packages/forms/resources/views/components/wizard.blade.php +++ b/packages/forms/resources/views/components/wizard.blade.php @@ -1,6 +1,8 @@ @php $isContained = $isContained(); $statePath = $getStatePath(); + $previousAction = $getAction('previous'); + $nextAction = $getAction('next'); @endphp
! $isContained, ]) > - - {{ $getAction('previous') }} + isDisabled()) + x-on:click="previousStep" + @endif + x-show="! isFirstStep()"> + {{ $previousAction }} @@ -275,18 +278,18 @@ class="h-full w-full text-gray-200 dark:text-white/5 rtl:rotate-180" isDisabled()) + x-on:click=" + $wire.dispatchFormEvent( + 'wizard::nextStep', + '{{ $statePath }}', + getStepIndex(step), + ) + " + @endif x-show="! isLastStep()" > - {{ $getAction('next') }} + {{ $nextAction }} From 378cbf31288070b0380d9216a5e86a6dfa87e73e Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Tue, 22 Oct 2024 10:04:07 +0100 Subject: [PATCH 3/3] Update wizard.blade.php --- .../views/components/wizard.blade.php | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/forms/resources/views/components/wizard.blade.php b/packages/forms/resources/views/components/wizard.blade.php index 494d3dc0e1c..48204ea6af4 100644 --- a/packages/forms/resources/views/components/wizard.blade.php +++ b/packages/forms/resources/views/components/wizard.blade.php @@ -264,11 +264,13 @@ class="h-full w-full text-gray-200 dark:text-white/5 rtl:rotate-180" 'mt-6' => ! $isContained, ]) > - isDisabled()) - x-on:click="previousStep" - @endif - x-show="! isFirstStep()"> + isDisabled()) + x-on:click="previousStep" + @endif + x-show="! isFirstStep()" + > {{ $previousAction }} @@ -278,14 +280,12 @@ class="h-full w-full text-gray-200 dark:text-white/5 rtl:rotate-180" isDisabled()) - x-on:click=" - $wire.dispatchFormEvent( - 'wizard::nextStep', - '{{ $statePath }}', - getStepIndex(step), - ) - " + @if (! $nextAction->isDisabled()) + x-on:click="$wire.dispatchFormEvent( + 'wizard::nextStep', + '{{ $statePath }}', + getStepIndex(step), + )" @endif x-show="! isLastStep()" >