From 216a07327f42161bc72f17fcf670b4a075abd05f Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 23 Oct 2023 11:05:00 +0200 Subject: [PATCH] Fix the event drop functionality for the table view --- assets/js/utils/calendar_table_view.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/assets/js/utils/calendar_table_view.js b/assets/js/utils/calendar_table_view.js index 9aa4bc28..65f7a1f6 100755 --- a/assets/js/utils/calendar_table_view.js +++ b/assets/js/utils/calendar_table_view.js @@ -1571,13 +1571,15 @@ App.Utils.CalendarTableView = (function () { delete appointment.service; appointment.start_datetime = moment(appointment.start_datetime) - .add({days: info.endDelta.days(), hours: info.endDelta.hours(), minutes: info.endDelta.minutes()}) + .add({days: info.delta.days, millisecond: info.delta.milliseconds}) .format('YYYY-MM-DD HH:mm:ss'); appointment.end_datetime = moment(appointment.end_datetime) - .add({days: info.endDelta.days(), hours: info.endDelta.hours(), minutes: info.endDelta.minutes()}) + .add({days: info.delta.days, millisecond: info.delta.milliseconds}) .format('YYYY-MM-DD HH:mm:ss'); + appointment.is_unavailability = Number(appointment.is_unavailability); + info.event.extendedProps.data.start_datetime = appointment.start_datetime; info.event.extendedProps.data.end_datetime = appointment.end_datetime; @@ -1586,11 +1588,14 @@ App.Utils.CalendarTableView = (function () { // Define the undo function, if the user needs to reset the last change. const undoFunction = () => { appointment.start_datetime = moment(appointment.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'); appointment.end_datetime = moment(appointment.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'); info.event.extendedProps.data.start_datetime = appointment.start_datetime;