Skip to content

Commit

Permalink
Prevent planning modal duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
cconard96 committed Dec 18, 2023
1 parent d1b9d4f commit dfe8ec3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
4 changes: 4 additions & 0 deletions js/glpi_dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ var glpi_html_dialog = function({
// call close event
close(event);

if ($('div.modal.show').length === 0) {
$('div.modal-backdrop').remove();
}

// remove html on modal close
$('#'+id).remove();
});
Expand Down
32 changes: 19 additions & 13 deletions js/planning.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,19 +591,25 @@ var GLPIPlanning = {
var start = info.start;
var end = info.end;

glpi_ajax_dialog({
url: CFG_GLPI.root_doc+"/ajax/planning.php",
params: {
action: 'add_event_fromselect',
begin: start.toISOString(),
end: end.toISOString(),
res_itemtype: itemtype,
res_items_id: items_id,
},
dialogclass: 'modal-lg',
title: __('Add an event'),
bs_focus: false
});
if ($('div.modal.planning-modal').length === 0) {
glpi_ajax_dialog({
url: CFG_GLPI.root_doc + "/ajax/planning.php",
params: {
action: 'add_event_fromselect',
begin: start.toISOString(),
end: end.toISOString(),
res_itemtype: itemtype,
res_items_id: items_id,
},
dialogclass: 'modal-lg planning-modal',
title: __('Add an event'),
bs_focus: false
});
GLPIPlanning.calendar.setOption('selectable', false);
window.setTimeout(function() {
GLPIPlanning.calendar.setOption('selectable', true);
}, 500);
}

GLPIPlanning.calendar.unselect();
}
Expand Down

0 comments on commit dfe8ec3

Please sign in to comment.