Merge pull request #3372 from artoscinote/ma_SCI_5789

Fix issue with submit event binding multiple times [SCI-5789]
This commit is contained in:
artoscinote 2021-06-08 15:19:48 +02:00 committed by GitHub
commit 2ae8f4a2a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -226,26 +226,24 @@
clearDropdownResultsCallback(INVENTORY_PICKER);
}
function initializeSubmitAction() {
$('#content-reports-index').on('click', '#savePDFtoInventorySubmit', function() {
animateSpinner();
$.ajax({
url: $('#savePDFtoInventorySubmit').data('target-url'),
data: SELECTED_IDS,
type: 'POST',
success: function(data) {
animateSpinner(null, false);
HelperModule.flashAlertMsg(data.message, 'success');
$('#savePDFtoInventory').modal('hide');
},
error: function(xhr) {
animateSpinner(null, false);
HelperModule.flashAlertMsg(xhr.responseJSON.message, 'danger');
$('#savePDFtoInventory').modal('hide');
}
});
$('#content-reports-index').on('click', '#savePDFtoInventorySubmit', function() {
animateSpinner();
$.ajax({
url: $('#savePDFtoInventorySubmit').data('target-url'),
data: SELECTED_IDS,
type: 'POST',
success: function(data) {
animateSpinner(null, false);
HelperModule.flashAlertMsg(data.message, 'success');
$('#savePDFtoInventory').modal('hide');
},
error: function(xhr) {
animateSpinner(null, false);
HelperModule.flashAlertMsg(xhr.responseJSON.message, 'danger');
$('#savePDFtoInventory').modal('hide');
}
});
}
});
/*
* INITIALIZERS
@ -254,7 +252,6 @@
function initializeSavePDFtoInventoryModal() {
$('#content-reports-index').on('shown.bs.modal', '#savePDFtoInventory', function() {
initInventoriesSelectPicker();
initializeSubmitAction();
clearErrors();
// refresh the dropdown state
$('#selectInventory').parent().find('input').trigger('keyup');