Allow working plan exceptions to be defined as non-working days (#1383).

This commit is contained in:
Alex Tselegidis 2023-07-10 08:22:55 +02:00
parent 81e8b8824e
commit 5473544258
38 changed files with 207 additions and 59 deletions

View file

@ -444,6 +444,11 @@ class Calendar extends EA_Controller {
$working_plan_exception = request('working_plan_exception');
if ( ! $working_plan_exception)
{
$working_plan_exception = NULL;
}
$provider_id = request('provider_id');
$this->providers_model->save_working_plan_exception($provider_id, $date, $working_plan_exception);

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Kliknite za prebacivanje';
$lang['week_short'] = 'Tjed';
$lang['scroll_to_increment'] = 'Skrolajte za inkrementaciju';
$lang['year'] = 'Godina';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Cliquez pour basculer';
$lang['week_short'] = 'Se';
$lang['scroll_to_increment'] = 'Faire défiler pour incrémenter';
$lang['year'] = 'Année';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Klicken Sie zum Umschalten';
$lang['week_short'] = 'Wo';
$lang['scroll_to_increment'] = 'Scrollen Sie zu Inkrement';
$lang['year'] = 'Jahr';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Нажмите для переключения';
$lang['week_short'] = 'Нед';
$lang['scroll_to_increment'] = 'Прокрутка для увеличения';
$lang['year'] = 'Год';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -434,4 +434,6 @@ $lang['click_to_toggle'] = 'Click To Toggle';
$lang['week_short'] = 'Wk';
$lang['scroll_to_increment'] = 'Scroll To Increment';
$lang['year'] = 'Year';
$lang['make_non_working_day'] = 'This provider will not be available for work on the selected day.';
$lang['no_breaks'] = 'No Breaks';
// End

View file

@ -582,7 +582,7 @@ class Providers_model extends EA_Model {
* @throws InvalidArgumentException
* @throws Exception
*/
public function save_working_plan_exception(int $provider_id, string $date, array $working_plan_exception)
public function save_working_plan_exception(int $provider_id, string $date, array $working_plan_exception = NULL)
{
// Validate the working plan exception data.
$start = date('H:i', strtotime($working_plan_exception['start']));
@ -610,7 +610,7 @@ class Providers_model extends EA_Model {
// Store the working plan exception.
$working_plan_exceptions = json_decode($provider['settings']['working_plan_exceptions'], TRUE);
if ( ! isset($working_plan_exception['breaks']))
if ( is_array($working_plan_exception) && ! isset($working_plan_exception['breaks']))
{
$working_plan_exception['breaks'] = [];
}
@ -643,7 +643,7 @@ class Providers_model extends EA_Model {
unset($working_plan_exceptions[$date]);
$provider['settings']['working_plan_exceptions'] = empty($working_plan_exceptions) ? new stdClass() : $working_plan_exceptions;
$provider['settings']['working_plan_exceptions'] = empty($working_plan_exceptions) ? '{}' : $working_plan_exceptions;
$this->update($provider);
}

View file

@ -1,5 +1,5 @@
<div class="modal" id="working-plan-exceptions-modal">
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><?= lang('working_plan_exception') ?></h5>
@ -11,15 +11,28 @@
<input class="form-control" id="working-plan-exceptions-date">
</div>
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" id="working-plan-exceptions-is-non-working-day">
<label class="form-check-label" for="working-plan-exceptions-is-non-working-day">
<?= lang('make_non_working_day') ?>
</label>
</div>
<div class="row">
<div class="col-sm-6">
<div class="mb-3">
<label class="form-label" for="working-plan-exceptions-start"><?= lang('start') ?></label>
<input class="form-control" id="working-plan-exceptions-start">
</div>
</div>
<div class="col-sm-6">
<div class="mb-3">
<label class="form-label" for="working-plan-exceptions-end"><?= lang('end') ?></label>
<input class="form-control" id="working-plan-exceptions-end">
</div>
</div>
</div>
<h3><?= lang('breaks') ?></h3>
@ -28,7 +41,7 @@
</p>
<div>
<button type="button" class="btn btn-primary working-plan-exceptions-add-break">
<button type="button" class="btn btn-outline-primary btn-sm working-plan-exceptions-add-break">
<i class="fas fa-plus-square me-2"></i>
<?= lang('add_break') ?>
</button>

View file

@ -22,6 +22,10 @@ App.Components.WorkingPlanExceptionsModal = (function () {
const $breaks = $('#working-plan-exceptions-breaks');
const $save = $('#working-plan-exceptions-save');
const $addBreak = $('.working-plan-exceptions-add-break');
const $isNonWorkingDay = $('#working-plan-exceptions-is-non-working-day');
const moment = window.moment;
let deferred = null;
let enableSubmit = false;
let enableCancel = false;
@ -34,7 +38,35 @@ App.Components.WorkingPlanExceptionsModal = (function () {
$date.val('');
$start.val('');
$end.val('');
$breaks.find('tbody').empty();
$breaks.find('tbody').html(renderNoBreaksRow());
$isNonWorkingDay.prop('checked', false);
toggleFieldsByNonWorkingDay(false);
}
/**
* Render a single table row as a placeholder to empty breaks table.
*/
function renderNoBreaksRow() {
return $(`
<tr>
<td colspan="3" class="text-center">
${lang('no_breaks')}
</td>
</tr>
`);
}
/**
* Toggle the state of the fields depending on the non-working day checkbox value.
*
* @param {Boolean} isNonWorkingDay
*/
function toggleFieldsByNonWorkingDay(isNonWorkingDay) {
$start.prop('disabled', isNonWorkingDay).toggleClass('text-decoration-line-through', isNonWorkingDay);
$end.prop('disabled', isNonWorkingDay).toggleClass('text-decoration-line-through', isNonWorkingDay);
$addBreak.prop('disabled', isNonWorkingDay);
$breaks.find('button').prop('disabled', isNonWorkingDay);
$breaks.toggleClass('text-decoration-line-through', isNonWorkingDay)
}
/**
@ -124,7 +156,9 @@ App.Components.WorkingPlanExceptionsModal = (function () {
const date = moment($date[0]._flatpickr.selectedDates[0]).format('YYYY-MM-DD');
const workingPlanException = {
const isNonWorkingDay = $isNonWorkingDay.prop('checked');
const workingPlanException = isNonWorkingDay ? null : {
start: moment($start[0]._flatpickr.selectedDates[0]).format('HH:mm'),
end: moment($end[0]._flatpickr.selectedDates[0]).format('HH:mm'),
breaks: getBreaks()
@ -133,6 +167,7 @@ App.Components.WorkingPlanExceptionsModal = (function () {
deferred.resolve(date, workingPlanException);
$modal.modal('hide');
resetModal();
}
@ -187,6 +222,10 @@ App.Components.WorkingPlanExceptionsModal = (function () {
$start[0]._flatpickr.setDate(moment('08:00', 'HH:mm').toDate());
$end[0]._flatpickr.setDate(moment('20:00', 'HH:mm').toDate());
$isNonWorkingDay.prop('checked', false);
$breaks.find('tbody').html(renderNoBreaksRow());
$modal.modal('show');
return deferred.promise();
@ -203,10 +242,18 @@ App.Components.WorkingPlanExceptionsModal = (function () {
function edit(date, workingPlanException) {
deferred = $.Deferred();
const isNonWorkingDay = !Boolean(workingPlanException);
$date[0]._flatpickr.setDate(moment(date, 'YYYY-MM-DD').toDate());
if (isNonWorkingDay === false) {
$start[0]._flatpickr.setDate(moment(workingPlanException.start, 'HH:mm').toDate());
$end[0]._flatpickr.setDate(moment(workingPlanException.end, 'HH:mm').toDate());
if (!workingPlanException.breaks) {
$breaks.find('tbody').html(renderNoBreaksRow());
}
workingPlanException.breaks.forEach((workingPlanExceptionBreak) => {
renderBreakRow(workingPlanExceptionBreak).appendTo($breaks.find('tbody'));
});
@ -214,6 +261,15 @@ App.Components.WorkingPlanExceptionsModal = (function () {
editableTimeCell(
$breaks.find('tbody .working-plan-exceptions-break-start, tbody .working-plan-exceptions-break-end')
);
} else {
$start[0]._flatpickr.setDate(moment('08:00', 'HH:mm').toDate());
$end[0]._flatpickr.setDate(moment('20:00', 'HH:mm').toDate());
$breaks.find('tbody').html(renderNoBreaksRow());
}
$isNonWorkingDay.prop('checked', isNonWorkingDay);
toggleFieldsByNonWorkingDay(isNonWorkingDay);
$modal.modal('show');
@ -388,6 +444,15 @@ App.Components.WorkingPlanExceptionsModal = (function () {
$addBreak.prop('disabled', false);
}
/**
* Event: Is Non Working Day "Change"
*/
function onIsNonWorkingDayChange() {
const isNonWorkingDay = $isNonWorkingDay.prop('checked');
toggleFieldsByNonWorkingDay(isNonWorkingDay);
}
/**
* Initialize the module.
*/
@ -405,6 +470,8 @@ App.Components.WorkingPlanExceptionsModal = (function () {
.on('click', '.working-plan-exceptions-cancel-break', onCancelBreakClick);
$save.on('click', onSaveClick);
$isNonWorkingDay.on('change', onIsNonWorkingDayChange);
}
document.addEventListener('DOMContentLoaded', initialize);

View file

@ -87,7 +87,9 @@ App.Utils.CalendarDefaultView = (function () {
let startMoment;
let endMoment;
if (lastFocusedEventData.extendedProps.data.workingPlanException) {
const data = lastFocusedEventData.extendedProps.data;
if (data.hasOwnProperty('workingPlanException')) {
const date = lastFocusedEventData.extendedProps.data.date;
const workingPlanException = lastFocusedEventData.extendedProps.data.workingPlanException;
const provider = lastFocusedEventData.extendedProps.data.provider;
@ -466,6 +468,10 @@ App.Utils.CalendarDefaultView = (function () {
displayDelete =
$target.hasClass('fc-custom') && vars('privileges').appointments.delete === true ? 'me-2' : 'd-none';
const {date, workingPlanException, provider} = info.event.extendedProps.data;
const startTime = workingPlanException?.start;
const endTime = workingPlanException?.end;
$html = $('<div/>', {
'html': [
$('<strong/>', {
@ -473,11 +479,7 @@ App.Utils.CalendarDefaultView = (function () {
'text': lang('provider')
}),
$('<span/>', {
'text': info.event.extendedProps.data
? info.event.extendedProps.data.provider.first_name +
' ' +
info.event.extendedProps.data.provider.last_name
: '-'
'text': `${provider.first_name} ${provider.last_name}`
}),
$('<br/>'),
@ -486,14 +488,11 @@ App.Utils.CalendarDefaultView = (function () {
'text': lang('start')
}),
$('<span/>', {
'text': App.Utils.Date.format(
info.event.extendedProps.data.date +
' ' +
info.event.extendedProps.data.workingPlanException.start,
'text': startTime ? App.Utils.Date.format(`${date} ${startTime}`,
vars('date_format'),
vars('time_format'),
true
)
) : '-'
}),
$('<br/>'),
@ -502,14 +501,11 @@ App.Utils.CalendarDefaultView = (function () {
'text': lang('end')
}),
$('<span/>', {
'text': App.Utils.Date.format(
info.event.extendedProps.data.date +
' ' +
info.event.extendedProps.data.workingPlanException.end,
'text': endTime ? App.Utils.Date.format(`${date} ${endTime}`,
vars('date_format'),
vars('time_format'),
true
)
) : '-'
}),
$('<br/>'),
@ -518,7 +514,7 @@ App.Utils.CalendarDefaultView = (function () {
'text': lang('timezone')
}),
$('<span/>', {
'text': vars('timezones')[info.event.extendedProps.data.provider.timezone]
'text': startTime ? vars('timezones')[provider.timezone] : '-'
}),
$('<br/>'),
@ -1273,12 +1269,14 @@ App.Utils.CalendarDefaultView = (function () {
weekdayDate = calendarDate.format('YYYY-MM-DD');
// Add working plan exception event.
if (workingPlanExceptions && workingPlanExceptions[weekdayDate]) {
if (workingPlanExceptions && workingPlanExceptions.hasOwnProperty(weekdayDate)) {
sortedWorkingPlan[weekdayName] = workingPlanExceptions[weekdayDate];
workingPlanExceptionStart =
weekdayDate + ' ' + sortedWorkingPlan[weekdayName].start;
workingPlanExceptionEnd = weekdayDate + ' ' + sortedWorkingPlan[weekdayName].end;
const startTime = sortedWorkingPlan[weekdayName]?.start || '00:00';
const endTime = sortedWorkingPlan[weekdayName]?.end || '00:00';
workingPlanExceptionStart = `${weekdayDate} ${startTime}`;
workingPlanExceptionEnd = `${weekdayDate} ${endTime}`;
workingPlanExceptionEvent = {
title: lang('working_plan_exception'),
@ -1543,16 +1541,16 @@ App.Utils.CalendarDefaultView = (function () {
.prop('selected', true);
}
const localSelectFilterItemValue = window.localStorage.getItem('EasyAppointments.SelectFilterItem');
if (localSelectFilterItemValue && $selectFilterItem.find(`option[value="${localSelectFilterItemValue}"]`).length) {
$selectFilterItem.val(localSelectFilterItemValue);
}
// Add the page event listeners.
addEventListeners();
const localSelectFilterItemValue = window.localStorage.getItem('EasyAppointments.SelectFilterItem');
if (localSelectFilterItemValue && $selectFilterItem.find(`option[value="${localSelectFilterItemValue}"]`).length) {
$selectFilterItem.val(localSelectFilterItemValue).trigger('change');
} else {
$reloadAppointments.trigger('click');
}
// Display the edit dialog if an appointment hash is provided.
if (vars('edit_appointment')) {
@ -1613,8 +1611,6 @@ App.Utils.CalendarDefaultView = (function () {
fullCalendar.view.currentEnd
);
}, 60000);
$reloadAppointments.trigger('click');
}
return {

View file

@ -302,6 +302,9 @@ App.Utils.WorkingPlan = (function () {
renderWorkingPlanExceptionRow(date, workingPlanException) {
const timeFormat = vars('time_format') === 'regular' ? 'h:mm a' : 'HH:mm';
const start = workingPlanException?.start;
const end = workingPlanException?.end;
return $('<tr/>', {
'data': {
'date': date,
@ -314,11 +317,11 @@ App.Utils.WorkingPlan = (function () {
}),
$('<td/>', {
'class': 'working-plan-exception--start',
'text': moment(workingPlanException.start, 'HH:mm').format(timeFormat).toLowerCase()
'text': start ? moment(start, 'HH:mm').format(timeFormat).toLowerCase() : '-'
}),
$('<td/>', {
'class': 'working-plan-exception--end',
'text': moment(workingPlanException.end, 'HH:mm').format(timeFormat).toLowerCase()
'text': end ? moment(end, 'HH:mm').format(timeFormat).toLowerCase() : '-'
}),
$('<td/>', {
'html': [