Display the company working plan when browsing the "all" filter item

This commit is contained in:
Alex Tselegidis 2022-07-27 02:19:42 +03:00
parent 2f289b48cb
commit dcc5084807
2 changed files with 197 additions and 198 deletions

View file

@ -123,6 +123,7 @@ class Calendar extends EA_Controller {
'date_format' => setting('date_format'),
'time_format' => setting('time_format'),
'first_weekday' => setting('first_weekday'),
'company_working_plan' => setting('company_working_plan'),
'timezones' => $this->timezones->to_array(),
'privileges' => $privileges,
'calendar_view' => $calendar_view,

View file

@ -1120,17 +1120,16 @@ App.Utils.CalendarDefaultView = (function () {
const calendarView = fullCalendar.view;
if (filterType === FILTER_TYPE_PROVIDER && calendarView.type !== 'dayGridMonth') {
if (calendarView.type === 'dayGridMonth') {
return;
}
const provider = vars('available_providers').find(
(availableProvider) => Number(availableProvider.id) === Number(recordId)
);
if (!provider) {
throw new Error('Provider was not found.');
}
const workingPlan = JSON.parse(provider.settings.working_plan);
const workingPlanExceptions = JSON.parse(provider.settings.working_plan_exceptions);
const workingPlan = JSON.parse(provider ? provider.settings.working_plan : vars('company_working_plan'));
const workingPlanExceptions = JSON.parse(provider ? provider.settings.working_plan_exceptions : '{}');
let unavailabilityEvent;
let viewStart;
let viewEnd;
@ -1409,7 +1408,6 @@ App.Utils.CalendarDefaultView = (function () {
break;
}
}
})
.always(() => {
$('#loading').css('visibility', '');