Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ResourceTimeGridPlugin #158

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions dist/filament-fullcalendar.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions resources/js/filament-fullcalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import adaptivePlugin from '@fullcalendar/adaptive'
import resourcePlugin from '@fullcalendar/resource'
import resourceDayGridPlugin from '@fullcalendar/resource-daygrid'
import resourceTimelinePlugin from '@fullcalendar/resource-timeline'
import resourceTimeGridPlugin from '@fullcalendar/resource-timegrid'
import rrulePlugin from '@fullcalendar/rrule'
import momentPlugin from '@fullcalendar/moment'
import momentTimezonePlugin from '@fullcalendar/moment-timezone'
Expand Down Expand Up @@ -56,8 +57,8 @@ export default function fullcalendar({

this.$wire.onEventClick(event)
},
eventDrop: async ({ event, oldEvent, relatedEvents, delta, revert }) => {
const shouldRevert = await this.$wire.onEventDrop(event, oldEvent, relatedEvents, delta)
eventDrop: async ({ event, oldEvent, relatedEvents, delta, revert, oldResource, newResource }) => {
const shouldRevert = await this.$wire.onEventDrop(event, oldEvent, relatedEvents, delta, oldResource, newResource)

if (typeof shouldRevert === 'boolean' && shouldRevert) {
revert()
Expand Down Expand Up @@ -99,6 +100,7 @@ const availablePlugins = {
'resource': resourcePlugin,
'resourceDayGrid': resourceDayGridPlugin,
'resourceTimeline': resourceTimelinePlugin,
'resourceTimeGrid': resourceTimeGridPlugin,
'rrule': rrulePlugin,
'moment': momentPlugin,
'momentTimezone': momentTimezonePlugin,
Expand Down
8 changes: 6 additions & 2 deletions src/Widgets/Concerns/InteractsWithEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ public function onEventClick(array $event): void
* @param array $oldEvent An Event Object that holds information about the event before the drop.
* @param array $relatedEvents An array of other related Event Objects that were also dropped. An event might have other recurring event instances or might be linked to other events with the same groupId
* @param array $delta A Duration Object that represents the amount of time the event was moved by.
* @return bool Wether to revert the drop action.
* @param array|null $oldResource If the resource has changed, this is the Resource Object the event came from. If the resource has not changed, this will be undefined. For use with the resource plugins only.
* @param array|null $newResource If the resource has changed, this is the Resource Object the event went to. If the resource has not changed, this will be undefined. For use with the resource plugins only.
* @return bool Whether to revert the drop action.
*/
public function onEventDrop(array $event, array $oldEvent, array $relatedEvents, array $delta): bool
public function onEventDrop(array $event, array $oldEvent, array $relatedEvents, array $delta, ?array $oldResource, ?array $newResource): bool
{
if ($this->getModel()) {
$this->record = $this->resolveRecord($event['id']);
Expand All @@ -44,6 +46,8 @@ public function onEventDrop(array $event, array $oldEvent, array $relatedEvents,
'oldEvent' => $oldEvent,
'relatedEvents' => $relatedEvents,
'delta' => $delta,
'oldResource' => $oldResource,
'newResource' => $newResource,
]);

return false;
Expand Down