Do not display the working plan exception option if no direct provider is selected
This commit is contained in:
parent
bea53207d9
commit
ffb19f113a
4 changed files with 29 additions and 18 deletions
|
@ -50,6 +50,7 @@ define('DB_SLUG_PROVIDER', 'provider');
|
|||
define('DB_SLUG_ADMIN', 'admin');
|
||||
define('DB_SLUG_SECRETARY', 'secretary');
|
||||
|
||||
define('FILTER_TYPE_ALL', 'all');
|
||||
define('FILTER_TYPE_PROVIDER', 'provider');
|
||||
define('FILTER_TYPE_SERVICE', 'service');
|
||||
|
||||
|
|
|
@ -629,7 +629,7 @@ class Calendar extends EA_Controller {
|
|||
|
||||
$filter_type = request('filter_type');
|
||||
|
||||
if ( ! $filter_type && $record_id !== 'all')
|
||||
if ( ! $filter_type && $record_id !== FILTER_TYPE_ALL)
|
||||
{
|
||||
json_response([
|
||||
'appointments' => [],
|
||||
|
|
|
@ -26,7 +26,7 @@ App.Pages.Calendar = (function () {
|
|||
$calendarPage.on('click', '#toggle-fullscreen', (event) => {
|
||||
const $toggleFullscreen = $(event.target);
|
||||
const element = document.documentElement;
|
||||
const isFullScreen = document.fullScreenElement || document.mozFullScreen || document.webkitIsFullScreen;
|
||||
const isFullScreen = document.fullScreenElement || document.mozFullScreen || document.webkitIsFullScreen || false;
|
||||
|
||||
if (isFullScreen) {
|
||||
// Exit fullscreen mode.
|
||||
|
@ -59,6 +59,10 @@ App.Pages.Calendar = (function () {
|
|||
$insertWorkingPlanException.on('click', () => {
|
||||
const providerId = $('#select-filter-item').val();
|
||||
|
||||
if (providerId === App.Utils.CalendarDefaultView.FILTER_TYPE_ALL) {
|
||||
return;
|
||||
}
|
||||
|
||||
const provider = vars('available_providers').find((availableProvider) => {
|
||||
return Number(availableProvider.id) === Number(providerId);
|
||||
});
|
||||
|
@ -105,8 +109,6 @@ App.Pages.Calendar = (function () {
|
|||
* 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.
|
||||
*
|
||||
* @param {String} view Optional (default), the calendar view to be loaded.
|
||||
*/
|
||||
function initialize() {
|
||||
// Load and initialize the calendar view.
|
||||
|
|
|
@ -27,6 +27,7 @@ App.Utils.CalendarDefaultView = (function () {
|
|||
const $footer = $('#footer');
|
||||
const $notification = $('#notification');
|
||||
const $calendarToolbar = $('#calendar-toolbar');
|
||||
const FILTER_TYPE_ALL = 'all';
|
||||
const FILTER_TYPE_PROVIDER = 'provider';
|
||||
const FILTER_TYPE_SERVICE = 'service';
|
||||
let fullCalendar = null;
|
||||
|
@ -311,6 +312,8 @@ App.Utils.CalendarDefaultView = (function () {
|
|||
$('#enable-sync span').text(lang('enable_sync'));
|
||||
$('#google-sync').prop('disabled', true);
|
||||
}
|
||||
|
||||
$('#insert-working-plan-exception').toggle(providerId !== App.Utils.CalendarDefaultView.FILTER_TYPE_ALL);
|
||||
}
|
||||
|
||||
$reloadAppointments.trigger('click');
|
||||
|
@ -1594,7 +1597,9 @@ App.Utils.CalendarDefaultView = (function () {
|
|||
// Trigger once to set the proper footer position after calendar initialization.
|
||||
onWindowResize();
|
||||
|
||||
$selectFilterItem.append(new Option(lang('all'), 'all', true, true));
|
||||
$selectFilterItem.append(new Option(lang('all'), FILTER_TYPE_ALL, true, true));
|
||||
|
||||
$('#insert-working-plan-exception').hide();
|
||||
|
||||
// Fill the select list boxes of the page.
|
||||
if (vars('available_providers').length > 0) {
|
||||
|
@ -1709,6 +1714,9 @@ App.Utils.CalendarDefaultView = (function () {
|
|||
}
|
||||
|
||||
return {
|
||||
initialize
|
||||
initialize,
|
||||
FILTER_TYPE_ALL,
|
||||
FILTER_TYPE_PROVIDER,
|
||||
FILTER_TYPE_SERVICE
|
||||
};
|
||||
})();
|
||||
|
|
Loading…
Reference in a new issue