Custom confirmation modal
Hello Community !
Could anyone advise me the best ‘filament way’ to have a custom confirmation in my case ?
I have a calendar showing events which are linked to resources, like “teacher” or “classroom”.
There are different ways to create or modify the events :
Case #1 can use requiresConfirmation() logic, this one is obvious.
But for #2 and #3, I don’t see the ‘right’ way to do it…
And of course, I’d like to have something that can be used in all the cases.
Any ideas ?
Thanks for your time
Could anyone advise me the best ‘filament way’ to have a custom confirmation in my case ?
I have a calendar showing events which are linked to resources, like “teacher” or “classroom”.
There are different ways to create or modify the events :
- A classic form with a save action
- The same form, but the user can click in the calendar to create the event on that day (not actual code for clarity)```html<div x-on:click="$wire.onDayClick( {{$timestamp}} )" ... />``````php#[On('onDayClick')]public function onDayClick($day){$this->validate();$f=$this->getFormValuesAsArray();$f['date'] = Carbon::createFromTimestamp($day)->toDateString();// Ask confirmation if needed$event = Event::create($f);…}```
- Moving an event (drag & drop) between days```javascriptonEnd: function(evt) { const eventId = evt.item.id; const toDate = evt.to.dataset.statusId; @this.dispatch('onEventDropped', { eventId: eventId, toDate: toDate });}``````php#[On(' onEventDropped ')]public function onEventDropped($eventId, $toDate){ $day=Carbon::createFromTimestamp($toDate); $event=Event::find($eventId); // Ask confirmation if needed $event->update(['date' => $day]);}```
Case #1 can use requiresConfirmation() logic, this one is obvious.
But for #2 and #3, I don’t see the ‘right’ way to do it…
And of course, I’d like to have something that can be used in all the cases.
Any ideas ?
Thanks for your time