Download the PHP package marshmallow/filament-fullcalendar without Composer
On this page you can find all versions of the php package marshmallow/filament-fullcalendar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download marshmallow/filament-fullcalendar
More information about marshmallow/filament-fullcalendar
Files in marshmallow/filament-fullcalendar
Package filament-fullcalendar
Short Description A fork of The Most Popular JavaScript Calendar integrated with Filament 💛
License MIT
Homepage https://github.com/marshmallow-packages/filament-fullcalendar
Informations about the package filament-fullcalendar
The Most Popular JavaScript Calendar as a Filament Widget 💛
Features
- Accepts all configurations from FullCalendar
- Event click and drop events
- Modals for creating and editing events New in v1.0
Support Filament
Table of contents
- Installation
- Usage
- Configuration
- Styling
- Listening for events
- Creating and Editing events with modals.
- Creating Events
- Editing Events
- Authorizing actions
- Listening for cancelled modal
- Refreshing calendar events
- Filtering events based on the calendar view
Installation
You can install the package via composer:
You can publish the config file with:
Usage
Since the package does not automatically add the FullCalendarWidget
widget to your Filament panel, you are free to extend the widget and customise it yourself.
- First, create a Filament Widget:
This will create a new
App\Filament\Widgets\CalendarWidget
class in your project.
- Your newly created widget should extends the
Saade\FilamentFullCalendar\Widgets\FullCalendarWidget
class of this package
Warning
Don't forget to remove
protected static string $view
from the generated class!Warning
You should use
getViewData
to display initial data, andfetchEvents
to fetch new events while paginating the calendar.Both methods should retun an array of EventObject.
Configuration
This is the contents of the default config file.
You can use any property that FullCalendar uses on its root object. Please refer to: FullCalendar Docs to see the available options. It supports most of them.
Styling
If you're building a custom Filament theme, you need one more step to make the calendar theme match your custom theme.
Add this line to your resources/css/filament.css
file (or whatever file you're using).
the final contents of this file should look simmilar to this
Listening for events
The only event-related events supported right now are: EventClick and EventDrop
They're commented out by default so livewire does not spam requests without they being used. You are free to paste them in your CalendarWidget
class. See: FiresEvents
Since v1.0.0 we use onEventClick
to open the edit modal.
If you need to hook up into this event, be sure to call the original method using parent::onEventClick()
to keep the modal opening as it should.
Creating and Editing events with modals.
Since v1.0.0 you can create and edit events using a modal.
To customise the modal, override the following properties in your widget:
protected string $modalWidth
protected string $modalLabel
The process of saving and editing the event is up to you, since this plugin does not rely on a Model to save the calendar events.
Creating Events
Events can be created in two ways.
- Clicking on a day (default)
- Selecting a date range (click and drag across calendar days) (you need to opt-in for this, set
selectable => true
in the config file.)
This will open the Create Event modal.
When the create form gets submitted, it will call the createEvent
function on your widget. Be sure to add the snippet below to your calendar class.
If the default form does not fullfills your needs, you can override the getCreateEventFormSchema
and use it like a normal Filament form.
You can override the getCreateEventModalTitle()
method to change the modal title to a custom one:
You can override the getCreateEventModalSubmitButtonLabel()
and getCreateEventModalCloseButtonLabel()
methods to change the modal button labels to custom labels:
Editing Events
Events can be edited by clicking on an event on the calendar.
This will open the Edit Event modal.
When the edit form gets submitted, it will call the editEvent
function on your widget. Be sure to add the snippet below to your calendar class.
If the default form does not fullfills your needs, you can override the getEditEventFormSchema
and use it like a normal Filament form.
You can override the getEditEventModalTitle()
method to change the modal title to a custom one:
You can override the getEditEventModalSubmitButtonLabel()
and getEditEventModalCloseButtonLabel()
methods to change the modal button labels to custom labels:
Authorizing actions
If you want to authorize the view
action, you can override the default authorization methods that comes with this package.
If you want to authorize the edit
or create
action, you can override the default authorization methods that comes with this package.
If you want to disable all actions or keep the calendar as it was before v1.0.0, you can return false for all the methods above, or use the convenient concern CantManageEvents
. It will disable all calendar modals.
Listening for cancelled modal
If you want to know when a modal has been cancelled, you can add for the following Livewire events to your widgets $listener
array:
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.
Filtering events based on the calendar view
If you want to filter your events based on the days that are currently shown in the calendar, you can implement the fetchInfo()
method from the CanFetchEvents trait. Add the following code to your calendar widget:
you can filter events based on the timespan $fetchInfo['start']
and $fetchInfo['end']
.
example:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Saade
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of filament-fullcalendar with dependencies
filament/filament Version ^2.0
illuminate/contracts Version ^9.0|^10.0
spatie/laravel-package-tools Version ^1.11