2015-07-20 22:41:24 +03:00
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* Easy!Appointments - Open Source Web Scheduler
|
2015-10-06 00:30:56 +03:00
|
|
|
*
|
2015-07-20 22:41:24 +03:00
|
|
|
* @package EasyAppointments
|
|
|
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
2020-03-11 12:10:59 +03:00
|
|
|
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
2015-10-06 00:30:56 +03:00
|
|
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
2015-07-20 22:41:24 +03:00
|
|
|
* @link http://easyappointments.org
|
|
|
|
* @since v1.0.0
|
|
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
|
2013-06-12 18:31:16 +03:00
|
|
|
/**
|
2016-04-02 13:25:29 +03:00
|
|
|
* Backend Calendar
|
|
|
|
*
|
2016-07-17 14:46:38 +03:00
|
|
|
* This module contains functions that are used by the backend calendar page.
|
2015-10-06 00:30:56 +03:00
|
|
|
*
|
2016-07-17 14:46:38 +03:00
|
|
|
* @module BackendCalendar
|
2013-06-12 18:31:16 +03:00
|
|
|
*/
|
2016-04-02 13:25:29 +03:00
|
|
|
window.BackendCalendar = window.BackendCalendar || {};
|
2015-10-06 00:30:56 +03:00
|
|
|
|
2018-01-23 12:08:37 +03:00
|
|
|
(function (exports) {
|
2015-10-06 00:30:56 +03:00
|
|
|
|
2016-04-02 13:25:29 +03:00
|
|
|
'use strict';
|
2015-10-06 00:30:56 +03:00
|
|
|
|
2016-07-24 14:26:20 +03:00
|
|
|
/**
|
|
|
|
* Bind common event handlers.
|
|
|
|
*/
|
2020-05-06 20:23:49 +03:00
|
|
|
function bindEventHandlers() {
|
2018-01-23 12:08:37 +03:00
|
|
|
var $calendarPage = $('#calendar-page');
|
2016-07-24 14:26:20 +03:00
|
|
|
|
2018-01-23 12:08:37 +03:00
|
|
|
$calendarPage.on('click', '#toggle-fullscreen', function () {
|
2020-05-06 20:15:11 +03:00
|
|
|
var $toggleFullscreen = $(this);
|
2018-01-23 12:08:37 +03:00
|
|
|
var element = document.documentElement;
|
2020-05-06 20:15:11 +03:00
|
|
|
var isFullScreen = document.fullScreenElement || document.mozFullScreen || document.webkitIsFullScreen;
|
2018-01-23 12:08:37 +03:00
|
|
|
|
|
|
|
if (isFullScreen) {
|
2020-03-11 12:10:59 +03:00
|
|
|
// Exit fullscreen mode.
|
2020-05-06 20:15:11 +03:00
|
|
|
if (document.exitFullscreen) {
|
2016-07-24 14:26:20 +03:00
|
|
|
document.exitFullscreen();
|
2020-05-06 20:15:11 +03:00
|
|
|
} else if (document.msExitFullscreen) {
|
2016-07-24 14:26:20 +03:00
|
|
|
document.msExitFullscreen();
|
2020-05-06 20:15:11 +03:00
|
|
|
} else if (document.mozCancelFullScreen) {
|
2016-07-24 14:26:20 +03:00
|
|
|
document.mozCancelFullScreen();
|
2020-05-06 20:15:11 +03:00
|
|
|
} else if (document.webkitExitFullscreen) {
|
2016-10-10 19:29:48 +03:00
|
|
|
document.webkitExitFullscreen();
|
2020-05-06 20:15:11 +03:00
|
|
|
}
|
2016-07-24 14:26:20 +03:00
|
|
|
|
2020-05-06 20:15:11 +03:00
|
|
|
$toggleFullscreen
|
2016-07-24 14:26:20 +03:00
|
|
|
.removeClass('btn-success')
|
2020-06-19 14:09:22 +03:00
|
|
|
.addClass('btn-light');
|
2016-07-24 14:26:20 +03:00
|
|
|
} else {
|
|
|
|
// Switch to fullscreen mode.
|
2020-05-06 20:15:11 +03:00
|
|
|
if (element.requestFullscreen) {
|
2016-07-24 14:26:20 +03:00
|
|
|
element.requestFullscreen();
|
2020-05-06 20:15:11 +03:00
|
|
|
} else if (element.msRequestFullscreen) {
|
2016-07-24 14:26:20 +03:00
|
|
|
element.msRequestFullscreen();
|
2020-05-06 20:15:11 +03:00
|
|
|
} else if (element.mozRequestFullScreen) {
|
2016-07-24 14:26:20 +03:00
|
|
|
element.mozRequestFullScreen();
|
2020-05-06 20:15:11 +03:00
|
|
|
} else if (element.webkitRequestFullscreen) {
|
2016-07-24 14:26:20 +03:00
|
|
|
element.webkitRequestFullscreen();
|
2020-05-06 20:15:11 +03:00
|
|
|
}
|
|
|
|
$toggleFullscreen
|
2020-06-19 14:09:22 +03:00
|
|
|
.removeClass('btn-light')
|
2016-07-24 14:26:20 +03:00
|
|
|
.addClass('btn-success');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-04-02 13:25:29 +03:00
|
|
|
/**
|
2016-05-15 14:05:28 +03:00
|
|
|
* Initialize Module
|
|
|
|
*
|
|
|
|
* This function makes the necessary initialization for the default backend calendar page. If this module
|
|
|
|
* is used in another page then this function might not be needed.
|
2016-04-02 13:25:29 +03:00
|
|
|
*
|
2016-07-17 14:46:38 +03:00
|
|
|
* @param {String} view Optional (default), the calendar view to be loaded.
|
2016-04-02 13:25:29 +03:00
|
|
|
*/
|
2018-01-23 12:08:37 +03:00
|
|
|
exports.initialize = function (view) {
|
2020-09-07 10:51:46 +03:00
|
|
|
BackendCalendarGoogleSync.initialize();
|
|
|
|
BackendCalendarAppointmentsModal.initialize();
|
|
|
|
BackendCalendarUnavailabilitiesModal.initialize();
|
2020-09-23 12:24:42 +03:00
|
|
|
BackendCalendarCustomAvailabilityPeriodsModal.initialize();
|
2020-09-07 10:51:46 +03:00
|
|
|
|
2020-03-11 12:10:59 +03:00
|
|
|
// Load and initialize the calendar view.
|
2016-07-17 14:46:38 +03:00
|
|
|
if (view === 'table') {
|
2018-01-23 12:08:37 +03:00
|
|
|
BackendCalendarTableView.initialize();
|
2016-07-17 14:46:38 +03:00
|
|
|
} else {
|
|
|
|
BackendCalendarDefaultView.initialize();
|
2016-04-02 13:25:29 +03:00
|
|
|
}
|
|
|
|
|
2020-05-06 20:23:49 +03:00
|
|
|
bindEventHandlers();
|
2016-04-02 13:25:29 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
})(window.BackendCalendar);
|