Skip to content

Commit

Permalink
Merge pull request filamentphp#14558 from whoisnegrello/3.x
Browse files Browse the repository at this point in the history
Have next and previous functions disabled when their actions are disabled in the Wizard component
  • Loading branch information
danharrin authored Oct 22, 2024
2 parents db262da + 378cbf3 commit 349aa8e
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions packages/forms/resources/views/components/wizard.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@php
$isContained = $isContained();
$statePath = $getStatePath();
$previousAction = $getAction('previous');
$nextAction = $getAction('next');
@endphp

<div
Expand Down Expand Up @@ -262,8 +264,14 @@ class="h-full w-full text-gray-200 dark:text-white/5 rtl:rotate-180"
'mt-6' => ! $isContained,
])
>
<span x-cloak x-on:click="previousStep" x-show="! isFirstStep()">
{{ $getAction('previous') }}
<span
x-cloak
@if (! $previousAction->isDisabled())
x-on:click="previousStep"
@endif
x-show="! isFirstStep()"
>
{{ $previousAction }}
</span>

<span x-show="isFirstStep()">
Expand All @@ -272,16 +280,16 @@ class="h-full w-full text-gray-200 dark:text-white/5 rtl:rotate-180"

<span
x-cloak
x-on:click="
$wire.dispatchFormEvent(
@if (! $nextAction->isDisabled())
x-on:click="$wire.dispatchFormEvent(
'wizard::nextStep',
'{{ $statePath }}',
getStepIndex(step),
)
"
)"
@endif
x-show="! isLastStep()"
>
{{ $getAction('next') }}
{{ $nextAction }}
</span>

<span x-show="isLastStep()">
Expand Down

0 comments on commit 349aa8e

Please sign in to comment.