diff --git a/README.md b/README.md
index 7e3f280..01c8421 100644
--- a/README.md
+++ b/README.md
@@ -311,6 +311,17 @@ class CalendarWidget extends FullCalendarWidget
+## Listening for cancelled modal
+
+If you want to know when a modal has been cancelled, you can add for the following [Livewire events](https://laravel-livewire.com/docs/2.x/events#event-listeners) to your widgets `$listener` array:
+
+```php
+ protected $listeners = [
+ 'cancelledFullcalendarCreateEventModal' => 'onCreateEventCancelled',
+ 'cancelledFullcalendarEditEventModal' => 'onEditEventCancelled',
+ ];
+```
+
# Refreshing calendar events
If you want to refresh the calendar events, you can call `$this->refreshEvents()` inside your widget class. This will call `getViewData()` and re-render the events on the calendar.
diff --git a/resources/views/components/create-event-modal.blade.php b/resources/views/components/create-event-modal.blade.php
index 9350b0c..e920d63 100644
--- a/resources/views/components/create-event-modal.blade.php
+++ b/resources/views/components/create-event-modal.blade.php
@@ -6,6 +6,10 @@
+ @if($this->isListeningCancelledCreateModal())
+
+ @endif
+
{{ $this->createEventForm }}
@@ -13,9 +17,15 @@
{{ __('filament::resources/pages/create-record.form.actions.create.label') }}
-
- {{ __('filament::resources/pages/create-record.form.actions.cancel.label') }}
-
+ @if($this->isListeningCancelledCreateModal())
+
+ {{ __('filament::resources/pages/create-record.form.actions.cancel.label') }}
+
+ @else
+
+ {{ __('filament::resources/pages/create-record.form.actions.cancel.label') }}
+
+ @endif
diff --git a/resources/views/components/edit-event-modal.blade.php b/resources/views/components/edit-event-modal.blade.php
index 2b69708..3952768 100644
--- a/resources/views/components/edit-event-modal.blade.php
+++ b/resources/views/components/edit-event-modal.blade.php
@@ -6,6 +6,10 @@
+ @if($this->isListeningCancelledEditModal())
+
+ @endif
+
{{ $this->editEventForm }}
@@ -13,9 +17,15 @@
{{ __('filament::resources/pages/edit-record.form.actions.save.label') }}
-
- {{ __('filament::resources/pages/edit-record.form.actions.cancel.label') }}
-
+ @if($this->isListeningCancelledEditModal())
+
+ {{ __('filament::resources/pages/edit-record.form.actions.cancel.label') }}
+
+ @else
+
+ {{ __('filament::resources/pages/edit-record.form.actions.cancel.label') }}
+
+ @endif
diff --git a/src/Widgets/Concerns/CanManageModals.php b/src/Widgets/Concerns/CanManageModals.php
index 4f1834a..c532a6f 100644
--- a/src/Widgets/Concerns/CanManageModals.php
+++ b/src/Widgets/Concerns/CanManageModals.php
@@ -17,4 +17,14 @@ protected function getModalWidth(): string
{
return $this->modalWidth;
}
+
+ public function isListeningCancelledEditModal(): bool
+ {
+ return in_array('cancelledFullcalendarEditEventModal', $this->getEventsBeingListenedFor());
+ }
+
+ public function isListeningCancelledCreateModal(): bool
+ {
+ return in_array('cancelledFullcalendarCreateEventModal', $this->getEventsBeingListenedFor());
+ }
}