mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-22 16:02:54 +03:00
Appointment management modal is not updated after appointment duration resize (#155).
This commit is contained in:
parent
62b74e8e75
commit
7aae2f359b
1 changed files with 17 additions and 7 deletions
|
@ -374,12 +374,19 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var $calendar = $('#calendar');
|
||||||
|
|
||||||
if ($('#notification').is(':visible')) {
|
if ($('#notification').is(':visible')) {
|
||||||
$('#notification').hide('bind');
|
$('#notification').hide('bind');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.data.is_unavailable == false) {
|
if (event.data.is_unavailable == false) {
|
||||||
// Prepare appointment data.
|
// Prepare appointment data.
|
||||||
|
event.data.end_datetime = Date.parseExact(
|
||||||
|
event.data.end_datetime, 'yyyy-MM-dd HH:mm:ss')
|
||||||
|
.add({days: delta.days(), hours: delta.hours(), minutes: delta.minutes()})
|
||||||
|
.toString('yyyy-MM-dd HH:mm:ss');
|
||||||
|
|
||||||
var appointment = GeneralFunctions.clone(event.data);
|
var appointment = GeneralFunctions.clone(event.data);
|
||||||
|
|
||||||
// Must delete the following because only appointment data should be provided to the AJAX call.
|
// Must delete the following because only appointment data should be provided to the AJAX call.
|
||||||
|
@ -387,11 +394,6 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
delete appointment.provider;
|
delete appointment.provider;
|
||||||
delete appointment.service;
|
delete appointment.service;
|
||||||
|
|
||||||
appointment.end_datetime = Date.parseExact(
|
|
||||||
appointment.end_datetime, 'yyyy-MM-dd HH:mm:ss')
|
|
||||||
.add({days: delta.days(), hours: delta.hours(), minutes: delta.minutes()})
|
|
||||||
.toString('yyyy-MM-dd HH:mm:ss');
|
|
||||||
|
|
||||||
// Success callback
|
// Success callback
|
||||||
var successCallback = function (response) {
|
var successCallback = function (response) {
|
||||||
if (response.exceptions) {
|
if (response.exceptions) {
|
||||||
|
@ -410,7 +412,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
|
|
||||||
// Display success notification to user.
|
// Display success notification to user.
|
||||||
var undoFunction = function () {
|
var undoFunction = function () {
|
||||||
appointment.end_datetime = Date.parseExact(
|
appointment.end_datetime = event.data.end_datetime = Date.parseExact(
|
||||||
appointment.end_datetime, 'yyyy-MM-dd HH:mm:ss')
|
appointment.end_datetime, 'yyyy-MM-dd HH:mm:ss')
|
||||||
.add({days: -delta.days(), hours: -delta.hours(), minutes: -delta.minutes()})
|
.add({days: -delta.days(), hours: -delta.hours(), minutes: -delta.minutes()})
|
||||||
.toString('yyyy-MM-dd HH:mm:ss');
|
.toString('yyyy-MM-dd HH:mm:ss');
|
||||||
|
@ -435,6 +437,9 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
$('#footer').css('position', 'static'); // Footer position fix.
|
$('#footer').css('position', 'static'); // Footer position fix.
|
||||||
|
|
||||||
|
// Update the event data for later use.
|
||||||
|
$calendar.fullCalendar('updateEvent', event);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update appointment data.
|
// Update appointment data.
|
||||||
|
@ -448,6 +453,8 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
id_users_provider: event.data.id_users_provider
|
id_users_provider: event.data.id_users_provider
|
||||||
};
|
};
|
||||||
|
|
||||||
|
event.data.end_datetime = unavailable.end_datetime;
|
||||||
|
|
||||||
// Define success callback function.
|
// Define success callback function.
|
||||||
var successCallback = function (response) {
|
var successCallback = function (response) {
|
||||||
if (response.exceptions) {
|
if (response.exceptions) {
|
||||||
|
@ -466,7 +473,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
|
|
||||||
// Display success notification to user.
|
// Display success notification to user.
|
||||||
var undoFunction = function () {
|
var undoFunction = function () {
|
||||||
unavailable.end_datetime = Date.parseExact(
|
unavailable.end_datetime = event.data.end_datetime = Date.parseExact(
|
||||||
unavailable.end_datetime, 'yyyy-MM-dd HH:mm:ss')
|
unavailable.end_datetime, 'yyyy-MM-dd HH:mm:ss')
|
||||||
.add({minutes: -delta.minutes()})
|
.add({minutes: -delta.minutes()})
|
||||||
.toString('yyyy-MM-dd HH:mm:ss');
|
.toString('yyyy-MM-dd HH:mm:ss');
|
||||||
|
@ -491,6 +498,9 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$('#footer').css('position', 'static'); // Footer position fix.
|
$('#footer').css('position', 'static'); // Footer position fix.
|
||||||
|
|
||||||
|
// Update the event data for later use.
|
||||||
|
$calendar.fullCalendar('updateEvent', event);
|
||||||
};
|
};
|
||||||
|
|
||||||
BackendCalendarApi.saveUnavailable(unavailable, successCallback);
|
BackendCalendarApi.saveUnavailable(unavailable, successCallback);
|
||||||
|
|
Loading…
Reference in a new issue