diff --git a/assets/js/utils/calendar_default_view.js b/assets/js/utils/calendar_default_view.js index 85a67166..a02cc737 100755 --- a/assets/js/utils/calendar_default_view.js +++ b/assets/js/utils/calendar_default_view.js @@ -865,7 +865,7 @@ App.Utils.CalendarDefaultView = (function () { unavailability.end_datetime = info.event.extendedProps.data.end_datetime = moment( unavailability.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'); App.Http.Calendar.saveUnavailability(unavailability).done(() => { @@ -955,7 +955,7 @@ App.Utils.CalendarDefaultView = (function () { .add({days: info.delta.days, millisecond: info.delta.milliseconds}) .format('YYYY-MM-DD HH:mm:ss'); - appointment.is_unavailability = Number(appointment.is_unavailability); + appointment.is_unavailability = 0; info.event.extendedProps.data.start_datetime = appointment.start_datetime; info.event.extendedProps.data.end_datetime = appointment.end_datetime; @@ -1014,7 +1014,7 @@ App.Utils.CalendarDefaultView = (function () { .add({days: -info.delta.days, milliseconds: -info.delta.milliseconds}) .format('YYYY-MM-DD HH:mm:ss'); - unavailability.is_unavailability = Number(unavailability.is_unavailability); + unavailability.is_unavailability = 1; info.event.extendedProps.data.start_datetime = unavailability.start_datetime; info.event.extendedProps.data.end_datetime = unavailability.end_datetime; diff --git a/assets/js/utils/calendar_table_view.js b/assets/js/utils/calendar_table_view.js index 0f1e9490..f2ab0bcf 100755 --- a/assets/js/utils/calendar_table_view.js +++ b/assets/js/utils/calendar_table_view.js @@ -1514,6 +1514,8 @@ App.Utils.CalendarTableView = (function () { const appointment = {...info.event.extendedProps.data}; + appointment.is_unavailability = 0; + // Must delete the following because only appointment data should be provided to the AJAX call. delete appointment.customer; delete appointment.provider; @@ -1546,7 +1548,7 @@ App.Utils.CalendarTableView = (function () { $footer.css('position', 'static'); // Footer position fix. // Update the event data for later use. - info.event.setProp('data', event.extendedProps.data); + info.event.setProp('data', info.event.extendedProps.data); }; // Update appointment data. @@ -1634,7 +1636,7 @@ App.Utils.CalendarTableView = (function () { .add({days: info.delta.days, millisecond: info.delta.milliseconds}) .format('YYYY-MM-DD HH:mm:ss'); - appointment.is_unavailability = Number(appointment.is_unavailability); + appointment.is_unavailability = 0; info.event.extendedProps.data.start_datetime = appointment.start_datetime; info.event.extendedProps.data.end_datetime = appointment.end_datetime; @@ -1688,13 +1690,15 @@ App.Utils.CalendarTableView = (function () { successCallback = () => { const undoFunction = () => { unavailability.start_datetime = moment(unavailability.start_datetime) - .add({days: -info.endDelta.days, milliseconds: -info.endDelta.milliseconds}) + .add({days: -info.delta.days, milliseconds: -info.delta.milliseconds}) .format('YYYY-MM-DD HH:mm:ss'); unavailability.end_datetime = moment(unavailability.end_datetime) - .add({days: -info.endDelta.days, milliseconds: -info.endDelta.milliseconds}) + .add({days: -info.delta.days, milliseconds: -info.delta.milliseconds}) .format('YYYY-MM-DD HH:mm:ss'); + unavailability.is_unavailability = 1; + info.event.extendedProps.data.start_datetime = unavailability.start_datetime; info.event.extendedProps.data.end_datetime = unavailability.end_datetime;