added id check to modal closed event

This commit is contained in:
Alperen Ersoy
2025-05-01 21:42:53 +03:00
parent 811ee353c8
commit 1dbbf6549a
2 changed files with 22 additions and 2 deletions
@@ -27,6 +27,10 @@
:wire:key="$action ? $this->getId() . '.actions.' . $action->getName() . '.modal' : null"
x-on:closed-form-component-action-modal.window="if (($event.detail.id === '{{ $this->getId() }}') && $wire.mountedActions.length) open()"
x-on:modal-closed.stop="
if ($event.detail.id !== '{{ $this->getId() }}-action') {
return
}
const mountedActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedActionShouldOpenModal(mountedAction: $action)) }}
if (! mountedActionShouldOpenModal) {
@@ -89,6 +93,10 @@
:wire:key="$action ? $this->getId() . '.table.actions.' . $action->getName() . '.modal' : null"
x-on:closed-form-component-action-modal.window="if (($event.detail.id === '{{ $this->getId() }}') && $wire.mountedTableActions.length) open()"
x-on:modal-closed.stop="
if ($event.detail.id !== '{{ $this->getId() }}-table-action') {
return
}
const mountedTableActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedTableActionShouldOpenModal(mountedAction: $action)) }}
if (! mountedTableActionShouldOpenModal) {
@@ -145,6 +153,10 @@
:wire:key="$action ? $this->getId() . '.table.bulk-actions.' . $action->getName() . '.modal' : null"
x-on:closed-form-component-action-modal.window="if (($event.detail.id === '{{ $this->getId() }}') && $wire.mountedTableBulkAction) open()"
x-on:modal-closed.stop="
if ($event.detail.id !== '{{ $this->getId() }}-table-bulk-action') {
return
}
const mountedTableBulkActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedTableBulkActionShouldOpenModal(mountedBulkAction: $action)) }}
if (! mountedTableBulkActionShouldOpenModal) {
@@ -207,6 +219,10 @@
:wire:key="$action ? $this->getId() . '.infolist.actions.' . $action->getName() . '.modal' : null"
x-on:closed-form-component-action-modal.window="if (($event.detail.id === '{{ $this->getId() }}') && $wire.mountedInfolistActions.length) open()"
x-on:modal-closed.stop="
if ($event.detail.id !== '{{ $this->getId() }}-infolist-action') {
return
}
const mountedInfolistActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedInfolistActionShouldOpenModal(mountedAction: $action)) }}
if (! mountedInfolistActionShouldOpenModal) {
@@ -268,6 +284,10 @@
:width="$action?->getModalWidth()"
:wire:key="$action ? $this->getId() . '.' . $action->getComponent()->getStatePath() . '.actions.' . $action->getName() . '.modal' : null"
x-on:modal-closed.stop="
if ($event.detail.id !== '{{ $this->getId() }}-form-component-action') {
return
}
const mountedFormComponentActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedFormComponentActionShouldOpenModal()) }}
if (mountedFormComponentActionShouldOpenModal) {
@@ -72,7 +72,7 @@
this.isOpen = false
this.$refs.modalContainer.dispatchEvent(
new CustomEvent('modal-closed', { id: '{{ $id }}' }),
new CustomEvent('modal-closed', { detail: { id: '{{ $id }}' } }),
)
},
@@ -85,7 +85,7 @@
@endif
this.$refs.modalContainer.dispatchEvent(
new CustomEvent('modal-opened', { id: '{{ $id }}' }),
new CustomEvent('modal-opened', { detail: { id: '{{ $id }}' } }),
)
})
},