Correct delta prop name and rename calendar-event related callback methods.

This commit is contained in:
Alex Tselegidis 2022-01-18 17:40:43 +01:00
parent e636ec2986
commit 76f5324901
1 changed files with 15 additions and 15 deletions

View File

@ -340,7 +340,7 @@ App.Utils.CalendarDefaultView = (function () {
* *
* @param {Object} info * @param {Object} info
*/ */
function calendarEventClick(info) { function onEventClick(info) {
const $target = $(info.el); const $target = $(info.el);
$calendarPage.find('.popover').popover('dispose'); // Close all open popovers. $calendarPage.find('.popover').popover('dispose'); // Close all open popovers.
@ -724,7 +724,7 @@ App.Utils.CalendarDefaultView = (function () {
* *
* @param {Object} info * @param {Object} info
*/ */
function calendarEventResize(info) { function onEventResize(info) {
if (vars('privileges').appointments.edit === false) { if (vars('privileges').appointments.edit === false) {
info.revert(); info.revert();
App.Layouts.Backend.displayNotification(lang('no_privileges_edit_appointments')); App.Layouts.Backend.displayNotification(lang('no_privileges_edit_appointments'));
@ -740,7 +740,7 @@ App.Utils.CalendarDefaultView = (function () {
if (!info.event.extendedProps.data.is_unavailability) { if (!info.event.extendedProps.data.is_unavailability) {
// Prepare appointment data. // Prepare appointment data.
info.event.extendedProps.data.end_datetime = moment(info.event.extendedProps.data.end_datetime) info.event.extendedProps.data.end_datetime = moment(info.event.extendedProps.data.end_datetime)
.add({days: info.delta.days, milliseconds: info.delta.milliseconds}) .add({days: info.endDelta.days, milliseconds: info.endDelta.milliseconds})
.format('YYYY-MM-DD HH:mm:ss'); .format('YYYY-MM-DD HH:mm:ss');
const appointment = {...info.event.extendedProps.data}; const appointment = {...info.event.extendedProps.data};
@ -759,7 +759,7 @@ App.Utils.CalendarDefaultView = (function () {
appointment.end_datetime = info.event.extendedProps.data.end_datetime = moment( appointment.end_datetime = info.event.extendedProps.data.end_datetime = moment(
appointment.end_datetime appointment.end_datetime
) )
.add({days: -info.delta.days, milliseconds: -info.delta.milliseconds}) .add({days: -info.endDelta.days, milliseconds: -info.endDelta.milliseconds})
.format('YYYY-MM-DD HH:mm:ss'); .format('YYYY-MM-DD HH:mm:ss');
App.Http.Calendar.saveAppointment(appointment).done(() => { App.Http.Calendar.saveAppointment(appointment).done(() => {
@ -838,7 +838,7 @@ App.Utils.CalendarDefaultView = (function () {
* *
* @see getCalendarHeight() * @see getCalendarHeight()
*/ */
function calendarWindowResize() { function onWindowResize() {
fullCalendar.setOption('height', getCalendarHeight()); fullCalendar.setOption('height', getCalendarHeight());
} }
@ -850,7 +850,7 @@ App.Utils.CalendarDefaultView = (function () {
* *
* @param {Object} info * @param {Object} info
*/ */
function calendarDateClick(info) { function onDateClick(info) {
if (info.allDay) { if (info.allDay) {
fullCalendar.changeView('timeGridDay'); fullCalendar.changeView('timeGridDay');
fullCalendar.gotoDate(info.date); fullCalendar.gotoDate(info.date);
@ -865,7 +865,7 @@ App.Utils.CalendarDefaultView = (function () {
* *
* @param {Object} info * @param {Object} info
*/ */
function calendarEventDrop(info) { function onEventDrop(info) {
if (vars('privileges').appointments.edit === false) { if (vars('privileges').appointments.edit === false) {
info.revert(); info.revert();
App.Layouts.Backend.displayNotification(lang('no_privileges_edit_appointments')); App.Layouts.Backend.displayNotification(lang('no_privileges_edit_appointments'));
@ -988,7 +988,7 @@ App.Utils.CalendarDefaultView = (function () {
* Whenever the calendar changes or refreshes its view certain actions need to be made, in order to * Whenever the calendar changes or refreshes its view certain actions need to be made, in order to
* display proper information to the user. * display proper information to the user.
*/ */
function calendarDatesRender() { function onDatesSet() {
if ($selectFilterItem.val() === null) { if ($selectFilterItem.val() === null) {
return; return;
} }
@ -1522,18 +1522,18 @@ App.Utils.CalendarDefaultView = (function () {
}, },
// Calendar events need to be declared on initialization. // Calendar events need to be declared on initialization.
windowResize: calendarWindowResize, windowResize: onWindowResize,
datesRender: calendarDatesRender, datesSet: onDatesSet,
dateClick: calendarDateClick, dateClick: onDateClick,
eventClick: calendarEventClick, eventClick: onEventClick,
eventResize: calendarEventResize, eventResize: onEventResize,
eventDrop: calendarEventDrop eventDrop: onEventDrop
}); });
fullCalendar.render(); fullCalendar.render();
// Trigger once to set the proper footer position after calendar initialization. // Trigger once to set the proper footer position after calendar initialization.
calendarWindowResize(); onWindowResize();
// Fill the select list boxes of the page. // Fill the select list boxes of the page.
if (vars('available_providers').length > 0) { if (vars('available_providers').length > 0) {