import { Calendar } from '@fullcalendar/core' import dayGridPlugin from '@fullcalendar/daygrid' import listPlugin from '@fullcalendar/list' document.addEventListener('DOMContentLoaded', function () { var el = document.getElementById('pa-calendar') if (!el) return var events try { events = JSON.parse(el.dataset.events || '[]') } catch (_) { events = [] } var cal = new Calendar(el, { plugins: [dayGridPlugin, listPlugin], initialView: 'dayGridMonth', firstDay: 1, events: events, headerToolbar: { left: 'prev,next today', center: 'title', right: 'dayGridMonth,listYear' }, eventClick: function (info) { if (info.event.url) { info.jsEvent.preventDefault() window.location.href = info.event.url } }, eventDidMount: function (info) { var parts = [info.event.title] var props = info.event.extendedProps || {} if (props.location) parts.push(props.location) info.el.title = parts.join(' — ') } }) cal.render() })