-
-
Notifications
You must be signed in to change notification settings - Fork 57
[Bug]: #147
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
Hello,
I found some issues when trying to drag & drop events on a dayGridWeek view, and traced the issues to enum CalendarViewType missing this view type. I'm not sure if this impacts anywhere else, otherwise I can make a PR.
Error was:
Cannot assign null to property Guava\Calendar\ValueObjects\CalendarView::$type of type Guava\Calendar\Enums\CalendarViewType
#file: "vendor\guava\calendar\src\ValueObjects\CalendarView.php"
#line: 33
How to reproduce the bug
use Filament\Notifications\Notification;
use Filament\Widgets\Concerns\InteractsWithPageFilters;
use Guava\Calendar\Enums\CalendarViewType;
use Guava\Calendar\Filament\Actions\DeleteAction;
use Guava\Calendar\Filament\Actions\EditAction;
use Guava\Calendar\Filament\CalendarWidget;
use Guava\Calendar\ValueObjects\EventDropInfo;
use Guava\Calendar\ValueObjects\FetchInfo;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\HtmlString;
class CalendarioWidget extends CalendarWidget
{
use InteractsWithPageFilters;
protected bool $useFilamentTimezone = false;
protected bool $eventClickEnabled = true;
protected CalendarViewType $calendarView = CalendarViewType::DayGridMonth;
protected ?string $defaultEventClickAction = 'edit';
protected bool $eventDragEnabled = true;
protected string | HtmlString | null | bool $heading = null;
protected function getEvents(FetchInfo $info): Collection | array | Builder
{
...
}
protected function onEventDrop(EventDropInfo $info, Model | Evento $event): bool
{
try {
$event->update([
'start' => $info->event->getStart(),
'end' => $info->event->getEnd(),
]);
} catch (\Throwable $th) {
Notification::make()
->danger()
->title('Error al modificar el evento')
->body($th->getMessage())
->send();
return false;
}
return true;
}
public function getOptions(): array
{
return [
'headerToolbar' => [
'start' => 'title',
'center' => 'dayGridMonth,dayGridWeek,listDay',
'end' => 'today prev,next',
],
];
}
}Change calendar view to dayGridWeek and move any event around.
Package Version
3.1.0
PHP Version
8.4.19
Laravel Version
12.56.0
Which operating systems does with happen with?
No response
Notes
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working