2021-11-29 11:01:02 +03:00
|
|
|
/* ----------------------------------------------------------------------------
|
2022-01-18 15:05:42 +03:00
|
|
|
* Easy!Appointments - Online Appointment Scheduler
|
2021-11-29 11:01:02 +03:00
|
|
|
*
|
|
|
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
2021-12-18 19:43:45 +03:00
|
|
|
* @copyright Copyright (c) Alex Tselegidis
|
|
|
|
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
|
|
|
|
* @link https://easyappointments.org
|
2021-11-29 11:01:02 +03:00
|
|
|
* @since v1.5.0
|
|
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
|
2022-01-14 11:26:44 +03:00
|
|
|
/**
|
|
|
|
* App global namespace object.
|
|
|
|
*
|
|
|
|
* This script should be loaded before the other modules in order to define the global application namespace.
|
|
|
|
*/
|
2021-11-29 11:01:02 +03:00
|
|
|
window.App = (function () {
|
2022-02-10 22:54:05 +03:00
|
|
|
function onAjaxError(event, jqXHR, textStatus, errorThrown) {
|
|
|
|
console.error('Unexpected HTTP Error: ', jqXHR, textStatus, errorThrown);
|
|
|
|
|
|
|
|
let response;
|
|
|
|
|
|
|
|
try {
|
|
|
|
response = JSON.parse(jqXHR.responseText); // JSON response
|
|
|
|
} catch (error) {
|
|
|
|
response = {message: jqXHR.responseText}; // String response
|
|
|
|
}
|
|
|
|
|
2022-03-29 11:48:55 +03:00
|
|
|
if (!response || !response.message) {
|
2022-02-10 22:54:05 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (App.Utils.Message) {
|
|
|
|
App.Utils.Message.show(lang('unexpected_issues'), lang('unexpected_issues_message'));
|
|
|
|
|
|
|
|
$('<div/>', {
|
|
|
|
'class': 'card',
|
|
|
|
'html': [
|
|
|
|
$('<div/>', {
|
2022-03-29 11:49:15 +03:00
|
|
|
'class': 'card-body overflow-auto',
|
2022-03-29 11:48:55 +03:00
|
|
|
'html': response.message
|
2022-02-10 22:54:05 +03:00
|
|
|
})
|
|
|
|
]
|
2023-05-04 18:51:06 +03:00
|
|
|
}).appendTo('#message-modal .modal-body');
|
2022-02-10 22:54:05 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ajaxError(onAjaxError);
|
|
|
|
|
2021-11-29 11:01:02 +03:00
|
|
|
return {
|
|
|
|
Components: {},
|
|
|
|
Http: {},
|
|
|
|
Layouts: {},
|
|
|
|
Pages: {},
|
2022-01-18 10:18:22 +03:00
|
|
|
Utils: {}
|
2021-11-29 11:01:02 +03:00
|
|
|
};
|
|
|
|
})();
|