feat(modal): add dispatchAction property to confirmation modal
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
'buttonFullWidth' => false,
|
'buttonFullWidth' => false,
|
||||||
'customButton' => null,
|
'customButton' => null,
|
||||||
'disabled' => false,
|
'disabled' => false,
|
||||||
|
'dispatchAction' => false,
|
||||||
'submitAction' => 'delete',
|
'submitAction' => 'delete',
|
||||||
'content' => null,
|
'content' => null,
|
||||||
'checkboxes' => [],
|
'checkboxes' => [],
|
||||||
@@ -42,6 +43,7 @@
|
|||||||
confirmWithText: @js($confirmWithText && !$disableTwoStepConfirmation),
|
confirmWithText: @js($confirmWithText && !$disableTwoStepConfirmation),
|
||||||
confirmWithPassword: @js($confirmWithPassword && !$disableTwoStepConfirmation),
|
confirmWithPassword: @js($confirmWithPassword && !$disableTwoStepConfirmation),
|
||||||
submitAction: @js($submitAction),
|
submitAction: @js($submitAction),
|
||||||
|
dispatchAction: @js($dispatchAction),
|
||||||
passwordError: '',
|
passwordError: '',
|
||||||
selectedActions: @js(collect($checkboxes)->pluck('id')->filter(fn($id) => $this->$id)->values()->all()),
|
selectedActions: @js(collect($checkboxes)->pluck('id')->filter(fn($id) => $this->$id)->values()->all()),
|
||||||
dispatchEvent: @js($dispatchEvent),
|
dispatchEvent: @js($dispatchEvent),
|
||||||
@@ -72,6 +74,10 @@
|
|||||||
return Promise.resolve(this.passwordError);
|
return Promise.resolve(this.passwordError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.dispatchAction) {
|
||||||
|
$wire.dispatch(this.submitAction);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const methodName = this.submitAction.split('(')[0];
|
const methodName = this.submitAction.split('(')[0];
|
||||||
const paramsMatch = this.submitAction.match(/\((.*?)\)/);
|
const paramsMatch = this.submitAction.match(/\((.*?)\)/);
|
||||||
|
Reference in New Issue
Block a user