2023-04-26 08:02:19 +00:00
|
|
|
<script>
|
|
|
|
document.addEventListener('alpine:init', () => {
|
|
|
|
Alpine.data('confirmModal', () => ({
|
|
|
|
open: false,
|
2023-05-04 13:45:53 +00:00
|
|
|
confirmAction: null,
|
2023-04-26 08:02:19 +00:00
|
|
|
message: 'Are you sure?',
|
2023-05-04 13:45:53 +00:00
|
|
|
toggleConfirmModal(customMessage, confirmAction) {
|
|
|
|
this.confirmAction = confirmAction
|
2023-04-26 08:02:19 +00:00
|
|
|
this.message = customMessage
|
|
|
|
this.open = !this.open
|
|
|
|
},
|
2023-05-04 13:45:53 +00:00
|
|
|
confirmed() {
|
|
|
|
this.open = false
|
|
|
|
this.$dispatch(this.confirmAction)
|
|
|
|
}
|
2023-04-26 08:02:19 +00:00
|
|
|
}))
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
<div x-cloak x-show="open" x-transition.opacity class="fixed inset-0 bg-slate-900/75"></div>
|
|
|
|
<div x-cloak x-show="open" x-transition class="fixed inset-0 z-50 flex pt-10">
|
|
|
|
<div @click.away="open = false" class="w-screen h-20 max-w-xl mx-auto bg-black rounded-lg">
|
|
|
|
<div class="flex flex-col items-center justify-center h-full">
|
2024-03-24 15:00:25 +00:00
|
|
|
<div class="pb-5 dark:text-white" x-text="message"></div>
|
2023-04-26 08:02:19 +00:00
|
|
|
<div>
|
2023-05-25 12:05:44 +00:00
|
|
|
<x-forms.button x-on:click='confirmed()'>Confirm</x-forms.button>
|
|
|
|
<x-forms.button x-on:click="open = false">Cancel</x-forms.button>
|
2023-04-26 08:02:19 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|