diff --git a/application/controllers/Backend_api.php b/application/controllers/Backend_api.php index da14e19c..89f6e43d 100755 --- a/application/controllers/Backend_api.php +++ b/application/controllers/Backend_api.php @@ -777,6 +777,7 @@ class Backend_api extends CI_Controller { ->set_output(json_encode(AJAX_SUCCESS)); } + $response = AJAX_SUCCESS; } catch (Exception $exception) { diff --git a/application/models/Appointments_model.php b/application/models/Appointments_model.php index 539a6e18..bf8d60fe 100644 --- a/application/models/Appointments_model.php +++ b/application/models/Appointments_model.php @@ -545,6 +545,7 @@ class Appointments_Model extends CI_Model { ->select('count(*) AS attendants_number') ->from('appointments') ->group_start() + ->group_start() ->where('start_datetime <=', $slot_start->format('Y-m-d H:i:s')) ->where('end_datetime >', $slot_start->format('Y-m-d H:i:s')) ->group_end() @@ -552,6 +553,7 @@ class Appointments_Model extends CI_Model { ->where('start_datetime <', $slot_end->format('Y-m-d H:i:s')) ->where('end_datetime >=', $slot_end->format('Y-m-d H:i:s')) ->group_end() + ->group_end() ->where('id_services', $service_id) ->get() ->row() diff --git a/assets/js/backend_calendar_default_view.js b/assets/js/backend_calendar_default_view.js index fc46dd3b..698515a5 100755 --- a/assets/js/backend_calendar_default_view.js +++ b/assets/js/backend_calendar_default_view.js @@ -270,6 +270,21 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; return (result > 500) ? result : 500; // Minimum height is 500px } + /** + * Get the event notes for the popup widget. + * + * @param {Event} event + */ + function getEventNotes(event) { + if (!event.data || !event.data.notes) { + return '-'; + } + + var notes = event.data.notes; + + return notes.length > 100 ? notes.substring(0, 100) + '...' : notes; + } + /** * Calendar Event "Click" Callback * @@ -296,11 +311,6 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; && GlobalVariables.user.privileges.appointments.delete === true) ? 'mr-2' : 'd-none'; // Same value at the time. - var notes = ''; - if (event.data) { // Only custom unavailable periods have notes. - notes = 'Notes ' + event.data.notes; - } - $html = $('
', { 'html': [ $('', { @@ -321,8 +331,11 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; }), $('
'), + $('', { + 'text': EALang.notes + }), $('', { - 'text': notes + 'text': getEventNotes(event) }), $('
'), @@ -502,6 +515,14 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; }), $('
'), + $('', { + 'text': EALang.notes + }), + $('', { + 'text': getEventNotes(event) + }), + $('
'), + $('
'), $('
', { diff --git a/assets/js/backend_calendar_table_view.js b/assets/js/backend_calendar_table_view.js index c409b9c3..74061040 100755 --- a/assets/js/backend_calendar_table_view.js +++ b/assets/js/backend_calendar_table_view.js @@ -997,6 +997,21 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; } } + /** + * Get the event notes for the popup widget. + * + * @param {Event} event + */ + function getEventNotes(event) { + if (!event.data || !event.data.notes) { + return '-'; + } + + var notes = event.data.notes; + + return notes.length > 100 ? notes.substring(0, 100) + '...' : notes; + } + /** * Calendar Event "Click" Callback * @@ -1023,11 +1038,6 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; && GlobalVariables.user.privileges.appointments.delete === true) ? 'mr-2' : 'd-none'; // Same value at the time. - var notes = ''; - if (event.data) { // Only custom unavailable periods have notes. - notes = 'Notes ' + event.data.notes; - } - $html = $('
', { 'html': [ $('', { @@ -1046,8 +1056,11 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; }), $('
'), + $('', { + 'text': EALang.notes + }), $('', { - 'text': notes + 'text': getEventNotes(event) }), $('
'), @@ -1212,6 +1225,14 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; }), $('
'), + $('', { + 'text': EALang.notes + }), + $('', { + 'text': getEventNotes(event) + }), + $('
'), + $('
'), $('
', { diff --git a/assets/js/backend_calendar_unavailabilities_modal.js b/assets/js/backend_calendar_unavailabilities_modal.js index 47307b77..353db3a6 100755 --- a/assets/js/backend_calendar_unavailabilities_modal.js +++ b/assets/js/backend_calendar_unavailabilities_modal.js @@ -58,7 +58,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili unavailable.id = $dialog.find('#unavailable-id').val(); } - var successCallback = function (response) { + var successCallback = function () { // Display success message to the user. Backend.displayNotification(EALang.unavailable_saved); @@ -68,15 +68,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili $('#select-filter-item').trigger('change'); }; - var errorCallback = function (jqXHR, textStatus, errorThrown) { - GeneralFunctions.displayMessageBox('Communication Error', 'Unfortunately ' + - 'the operation could not complete due to server communication errors.'); - - $dialog.find('.modal-message').txt(EALang.service_communication_error); - $dialog.find('.modal-message').addClass('alert-danger').removeClass('d-none'); - }; - - BackendCalendarApi.saveUnavailable(unavailable, successCallback, errorCallback); + BackendCalendarApi.saveUnavailable(unavailable, successCallback, GeneralFunctions.ajaxFailureHandler); }); /** diff --git a/assets/js/installation.js b/assets/js/installation.js index 6a677861..ec62dcd2 100644 --- a/assets/js/installation.js +++ b/assets/js/installation.js @@ -51,7 +51,7 @@ $(function () { $alert .text('Easy!Appointments has been successfully installed!') .addClass('alert-success') - .show(); + .removeClass('hidden'); setTimeout(function () { window.location.href = GlobalVariables.baseUrl + '/index.php/backend'; @@ -71,7 +71,7 @@ $(function () { try { $alert .removeClass('alert-danger') - .hide(); + .addClass('hidden'); $('input').closest('.form-group').removeClass('has-error'); // Check for empty fields. @@ -116,7 +116,7 @@ $(function () { $alert .addClass('alert-danger') .text(error.message) - .show(); + .removeClass('hidden'); return false; }