alfasix / alfakit-calendar
FullCalendar widgets for AlfaKit panels: month, week, day and list views, event actions, drag and drop.
Requires
- php: ^8.3
- alfasix/alfakit: ^0.1|@dev
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
by Alfa Six
FullCalendar widgets for AlfaKit panels: month, week, day and list views, actions on events, range selection and drag and drop, all running through AlfaKit's authorised action endpoint. The API follows saade/filament-fullcalendar.
Installation
composer require alfasix/alfakit-calendar
The FullCalendar packages ship with @alfakit/react, @alfakit/vue and @alfakit/svelte; nothing to install on the frontend.
Register
use AlfaSix\AlfakitCalendar\CalendarPlugin; $panel->plugin(CalendarPlugin::make()->editable());
Usage
use AlfaSix\AlfakitCalendar\Event; use AlfaSix\AlfakitCalendar\Widgets\CalendarWidget; class MeetingsCalendar extends CalendarWidget { protected static ?string $model = Meeting::class; protected static ?string $startAttribute = 'starts_at'; protected static ?string $endAttribute = 'ends_at'; public function fetchEvents(array $info): array { return Meeting::query() ->whereBetween('starts_at', [$info['start'], $info['end']]) ->get() ->map(fn (Meeting $meeting) => Event::make($meeting) ->title($meeting->subject) ->start($meeting->starts_at) ->end($meeting->ends_at)) ->all(); } public function getFormSchema(): array { return [ TextInput::make('subject')->required(), DateTimePicker::make('starts_at')->required(), DateTimePicker::make('ends_at'), ]; } }
Add the widget to a dashboard with ->widgets([MeetingsCalendar::class]). Clicking an event opens a view modal (with edit and delete), selecting a range opens a create modal, and with editable() dragging or resizing an event saves its dates.
See the documentation for every option.
License
MIT. See LICENSE.md.