Automatically reload backend calendar events (#301).

This commit is contained in:
Alex Tselegidis 2020-03-18 20:30:15 +01:00
parent d828a7a8d2
commit 71f9892ace
1 changed files with 19 additions and 1 deletions

View File

@ -827,7 +827,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
filter_type: filterType
};
$.post(url, data, function (response) {
return $.post(url, data, function (response) {
if (!GeneralFunctions.handleAjaxExceptions(response)) {
return;
}
@ -1439,6 +1439,24 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
if (window.innerHeight < 700) {
$('#footer').css('position', 'static');
}
// Automatically refresh the calendar page every 10 seconds (without loading animation).
var $loading = $('#loading');
var $calendar = $('#calendar');
var $selectFilterItem = $('#select-filter-item');
setInterval(function () {
$loading.css('visibility', 'hidden');
_refreshCalendarAppointments(
$calendar,
$selectFilterItem.val(),
$selectFilterItem.find('option:selected').attr('type'),
$calendar.fullCalendar('getView').start,
$calendar.fullCalendar('getView').end)
.always(function () {
$loading.css('visibility', '')
});
}, 10000);
};
})(window.BackendCalendarDefaultView);