disable tow step confirmation
This commit is contained in:
@@ -22,18 +22,23 @@
|
||||
'dispatchEventMessage' => '',
|
||||
])
|
||||
|
||||
@php
|
||||
$settings = instanceSettings();
|
||||
$disableTwoStepConfirmation = $settings->disable_two_step_confirmation ?? false;
|
||||
@endphp
|
||||
|
||||
<div x-data="{
|
||||
modalOpen: false,
|
||||
step: {{ empty($checkboxes) ? 2 : 1 }},
|
||||
initialStep: {{ empty($checkboxes) ? 2 : 1 }},
|
||||
finalStep: {{ $confirmWithPassword ? 3 : 2 }},
|
||||
finalStep: {{ $confirmWithPassword && !$disableTwoStepConfirmation ? 3 : 2 }},
|
||||
deleteText: '',
|
||||
password: '',
|
||||
actions: @js($actions),
|
||||
confirmationText: @js($confirmationText),
|
||||
userConfirmationText: '',
|
||||
confirmWithText: @js($confirmWithText),
|
||||
confirmWithPassword: @js($confirmWithPassword),
|
||||
confirmWithText: @js($confirmWithText && !$disableTwoStepConfirmation),
|
||||
confirmWithPassword: @js($confirmWithPassword && !$disableTwoStepConfirmation),
|
||||
copied: false,
|
||||
submitAction: @js($submitAction),
|
||||
passwordError: '',
|
||||
@@ -41,6 +46,7 @@
|
||||
dispatchEvent: @js($dispatchEvent),
|
||||
dispatchEventType: @js($dispatchEventType),
|
||||
dispatchEventMessage: @js($dispatchEventMessage),
|
||||
disableTwoStepConfirmation: @js($disableTwoStepConfirmation),
|
||||
resetModal() {
|
||||
this.step = this.initialStep;
|
||||
this.deleteText = '';
|
||||
@@ -222,6 +228,7 @@
|
||||
</template>
|
||||
@endforeach
|
||||
</ul>
|
||||
@if (!$disableTwoStepConfirmation)
|
||||
@if ($confirmWithText)
|
||||
<div class="mb-4">
|
||||
<h4 class="mb-2 text-lg font-semibold">Confirm Actions</h4>
|
||||
@@ -259,9 +266,11 @@
|
||||
class="p-2 mt-1 w-full text-black rounded input">
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<!-- Step 3: Password confirmation -->
|
||||
@if (!$disableTwoStepConfirmation)
|
||||
<div x-show="step === 3 && confirmWithPassword">
|
||||
<div class="p-4 mb-4 text-white border-l-4 border-red-500 bg-error" role="alert">
|
||||
<p class="font-bold">Final Confirmation</p>
|
||||
@@ -282,6 +291,7 @@
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<!-- Navigation buttons -->
|
||||
<div class="flex flex-wrap gap-2 justify-between mt-4">
|
||||
@@ -304,8 +314,10 @@
|
||||
</template>
|
||||
|
||||
<template x-if="step === 2">
|
||||
<x-forms.button x-bind:disabled="confirmWithText && userConfirmationText !== confirmationText"
|
||||
class="w-auto" isError
|
||||
<x-forms.button
|
||||
x-bind:disabled="!disableTwoStepConfirmation && confirmWithText && userConfirmationText !== confirmationText"
|
||||
class="w-auto"
|
||||
isError
|
||||
@click="
|
||||
if (dispatchEvent) {
|
||||
$wire.dispatch(dispatchEventType, dispatchEventMessage);
|
||||
@@ -316,11 +328,14 @@
|
||||
modalOpen = false;
|
||||
resetModal();
|
||||
submitForm();
|
||||
}">
|
||||
<span x-text="step2ButtonText"></span>
|
||||
}
|
||||
"
|
||||
>
|
||||
<span x-text="disableTwoStepConfirmation ? 'Permanently Delete' : step2ButtonText"></span>
|
||||
</x-forms.button>
|
||||
</template>
|
||||
|
||||
@if (!$disableTwoStepConfirmation)
|
||||
<template x-if="step === 3 && confirmWithPassword">
|
||||
<x-forms.button x-bind:disabled="!password" class="w-auto" isError
|
||||
@click="
|
||||
@@ -339,6 +354,7 @@
|
||||
<span x-text="step3ButtonText"></span>
|
||||
</x-forms.button>
|
||||
</template>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user