Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

feat(modal): add dispatchAction property to confirmation modal

Andras Bacsaie97cf2db3a98
diff --git a/resources/views/components/modal-confirmation.blade.php b/resources/views/components/modal-confirmation.blade.php
index 24282dd891..626d553290 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(/\((.*?)\)/);