mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-25 09:23:08 +03:00
Fix the calendar drop and resize "undo" functionality
This commit is contained in:
parent
a5aa7da361
commit
171623c6a0
2 changed files with 11 additions and 7 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue