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

Introduce the methods to fetch resources from the livewire component … #216

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion dist/filament-fullcalendar.js

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion resources/js/filament-fullcalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default function fullcalendar({
'center': 'title',
'right': 'dayGridMonth,dayGridWeek,dayGridDay',
},
refetchResourcesOnNavigate: true,
plugins: plugins.map(plugin => availablePlugins[plugin]),
locale,
schedulerLicenseKey,
Expand Down Expand Up @@ -87,11 +88,16 @@ export default function fullcalendar({
if (!selectable) return;
this.$wire.onDateSelect(startStr, endStr, allDay, view, resource)
},
resources: (fetchInfo, successCallback, failureCallback) => {
this.$wire.fetchResources(fetchInfo)
.then(successCallback)
.catch(failureCallback);
},
})

calendar.render()

window.addEventListener('filament-fullcalendar--refresh', () => calendar.refetchEvents())
window.addEventListener('filament-fullcalendar--refresh', () => { calendar.refetchEvents(); calendar.refetchResources() } )
window.addEventListener('filament-fullcalendar--prev', () => calendar.prev())
window.addEventListener('filament-fullcalendar--next', () => calendar.next())
window.addEventListener('filament-fullcalendar--today', () => calendar.today())
Expand Down
5 changes: 5 additions & 0 deletions src/Widgets/FullCalendarWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function fetchEvents(array $info): array
return [];
}

public function fetchResources(array $info): array
{
return [];
}

public function getFormSchema(): array
{
return [];
Expand Down