From e97cf2db3a988cdb8ae8bd6fee2912d93fa22e16 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Thu, 15 May 2025 22:21:34 +0200 Subject: [PATCH] feat(modal): add dispatchAction property to confirmation modal --- resources/views/components/modal-confirmation.blade.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/views/components/modal-confirmation.blade.php b/resources/views/components/modal-confirmation.blade.php index 24282dd89..626d55329 100644 --- a/resources/views/components/modal-confirmation.blade.php +++ b/resources/views/components/modal-confirmation.blade.php @@ -6,6 +6,7 @@ 'buttonFullWidth' => false, 'customButton' => null, 'disabled' => false, + 'dispatchAction' => false, 'submitAction' => 'delete', 'content' => null, 'checkboxes' => [], @@ -42,6 +43,7 @@ confirmWithText: @js($confirmWithText && !$disableTwoStepConfirmation), confirmWithPassword: @js($confirmWithPassword && !$disableTwoStepConfirmation), submitAction: @js($submitAction), + dispatchAction: @js($dispatchAction), passwordError: '', selectedActions: @js(collect($checkboxes)->pluck('id')->filter(fn($id) => $this->$id)->values()->all()), dispatchEvent: @js($dispatchEvent), @@ -72,6 +74,10 @@ return Promise.resolve(this.passwordError); } } + if (this.dispatchAction) { + $wire.dispatch(this.submitAction); + return true; + } const methodName = this.submitAction.split('(')[0]; const paramsMatch = this.submitAction.match(/\((.*?)\)/);