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
1 changed files with 4 additions and 4 deletions

View File

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