Corrected working plan exception removal issue on table view

This commit is contained in:
Alex Tselegidis 2022-03-08 16:45:01 +01:00
parent 803f4e4e7e
commit 1bc02e11c0

View file

@ -245,23 +245,23 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
var data;
// If id_role parameter exists the popover is an working plan exception.
if (lastFocusedEventData.data.hasOwnProperty('id_roles')) {
if (lastFocusedEventData.data.workingPlanException) {
// Do not display confirmation prompt.
url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_working_plan_exception';
data = {
csrfToken: GlobalVariables.csrfToken,
working_plan_exception: lastFocusedEventData.start.format('YYYY-MM-DD'),
provider_id: lastFocusedEventData.data.id
provider_id: lastFocusedEventData.data.provider.id
};
$.post(url, data)
.done(function () {
$('#message-box').dialog('close');
var workingPlanExceptions = JSON.parse(lastFocusedEventData.data.settings.working_plan_exceptions);
var workingPlanExceptions = JSON.parse(lastFocusedEventData.data.provider.settings.working_plan_exceptions);
delete workingPlanExceptions[lastFocusedEventData.start.format('YYYY-MM-DD')];
lastFocusedEventData.data.settings.working_plan_exceptions = JSON.stringify(workingPlanExceptions);
lastFocusedEventData.data.provider.settings.working_plan_exceptions = JSON.stringify(workingPlanExceptions);
// Refresh calendar event items.
$('#select-filter-item').trigger('change');