Close action modal with event
I have a table action which open a livewire component, I that livewire there is one more table action which open a modal(blade file)
I want to close the livewire component when blade modal is open or close both blade modal and livewire component when blade modal is close
I tried giving id to livewire modal and dispatch close-modal event from second table action but it didn't worked
I want to close the livewire component when blade modal is open or close both blade modal and livewire component when blade modal is close
Action::make('link payment')
->disabled(fn ()=>$this->policies())
->label('Link Payment')
->extraModalWindowAttributes(['id' => 'orphan-payment-modal'])
->form([
Grid::make(6)
->schema([
])
->extraAttributes(['class' => 'orphan-payment-details']),
View::make("livewire.payment-search-render-helper")
->extraAttributes(['class' => 'contact-search-table'])
])Action::make('link payment')
->disabled(fn ()=>$this->policies())
->label('Link Payment')
->extraModalWindowAttributes(['id' => 'orphan-payment-modal'])
->form([
Grid::make(6)
->schema([
])
->extraAttributes(['class' => 'orphan-payment-details']),
View::make("livewire.payment-search-render-helper")
->extraAttributes(['class' => 'contact-search-table'])
])I tried giving id to livewire modal and dispatch close-modal event from second table action but it didn't worked
Action::make("Link Payment")
->label('')
->form(
function ($record) {
$this->contact = $record;
$this->invoiceGeneration();
$this->dispatchFormEvent('close-modal', ['id' => 'orphan-payment-modal']);
$this->dispatch('link-payment');
info('dispatch');
return [
$this->orphanPaymentDetails(),
$this->status ? View::make('filament.pages.payment-link-success-modal') : View::make('filament.pages.payment-link-failed-modal')
];
}
)Action::make("Link Payment")
->label('')
->form(
function ($record) {
$this->contact = $record;
$this->invoiceGeneration();
$this->dispatchFormEvent('close-modal', ['id' => 'orphan-payment-modal']);
$this->dispatch('link-payment');
info('dispatch');
return [
$this->orphanPaymentDetails(),
$this->status ? View::make('filament.pages.payment-link-success-modal') : View::make('filament.pages.payment-link-failed-modal')
];
}
)