ok
Direktori : /home2/selectio/www/thedentalpark.com/appointment/admin/assets/js/ |
Current File : /home2/selectio/www/thedentalpark.com/appointment/admin/assets/js/fullcalendar.init.js |
document.addEventListener('DOMContentLoaded', function () { var Calendar = FullCalendar.Calendar; var Draggable = FullCalendar.Draggable; var containerEl = document.getElementById('external-events'); var calendarEl = document.getElementById('calendar'); var checkbox = document.getElementById('drop-remove'); // initialize the external events // ----------------------------------------------------------------- new Draggable(containerEl, { itemSelector: '.fc-event', eventData: function (eventEl) { return { title: eventEl.innerText }; } }); // initialize the calendar // ----------------------------------------------------------------- var calendar = new Calendar(calendarEl, { headerToolbar: { left: 'prev,next today addEventButton', center: 'title', right: 'dayGridMonth,timeGridWeek,timeGridDay', }, businessHours: true, // display business hours editable: true, events: [ { title: 'Business Lunch', start: '2022-04-03T13:00:00', constraint: 'businessHours' }, { title: 'Meeting', start: '2022-04-13T11:00:00', constraint: 'availableForMeeting', // defined below color: '#53c797' }, { title: 'Conference', start: '2022-04-18', end: '2022-04-20' }, { title: 'Party', start: '2022-04-29T20:00:00' }, ], customButtons: { addEventButton: { text: 'Add Event', click: function () { var dateStr = prompt('Enter a date in YYYY-MM-DD format'); var date = new Date(dateStr + 'T00:00:00'); // will be in local time if (!isNaN(date.valueOf())) { // valid? calendar.addEvent({ title: 'dynamic event', start: date, allDay: true }); alert('Great. Now, update your database...'); } else { alert('Invalid date.'); } } } }, editable: true, droppable: true, // this allows things to be dropped onto the calendar drop: function (info) { // is the "remove after drop" checkbox checked? if (checkbox.checked) { // if so, remove the element from the "Draggable Events" list info.draggedEl.parentNode.removeChild(info.draggedEl); } } }); calendar.render(); });