Skip to content

Commit

Permalink
Use vars to save actions and use isDisabled to condition that
Browse files Browse the repository at this point in the history
  • Loading branch information
whoisnegrello committed Oct 21, 2024
1 parent a7c360d commit 23fbacf
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 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
@@ -262,11 +264,12 @@ class="h-full w-full text-gray-200 dark:text-white/5 rtl:rotate-180"
'mt-6' => ! $isContained,
])
>
<span x-cloak x-on:click="
if (!$el.querySelector('button').disabled){
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()">
@@ -275,18 +278,18 @@ class="h-full w-full text-gray-200 dark:text-white/5 rtl:rotate-180"

<span
x-cloak
x-on:click="
if (!$el.querySelector('button').disabled){
$wire.dispatchFormEvent(
'wizard::nextStep',
'{{ $statePath }}',
getStepIndex(step),
)
}
"
@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()">

0 comments on commit 23fbacf

Please sign in to comment.