Disable button and add loader when importing inventory items [SCI-10240]

This commit is contained in:
Martin Artnik 2024-02-20 10:58:09 +01:00
parent 230f283aec
commit 102caffe01
2 changed files with 7 additions and 0 deletions

View file

@ -17,6 +17,8 @@
var formGroup = $('#form-records-file').find('.form-group');
formGroup.addClass('has-error');
formGroup.find('.help-block').remove();
$('#form-records-file input[type="submit"]').removeAttr('disabled');
$('#parse-sheet-loader').addClass('hidden');
formGroup.append(
'<span class="help-block">' + XHR.responseJSON.message + '</span>'
);
@ -24,6 +26,8 @@
}
function handleSuccessfulSubmit(data) {
$('#form-records-file input[type="submit"]').removeAttr('disabled');
$('#parse-sheet-loader').addClass('hidden');
$('#modal-import-records').modal('hide');
$(data.html).appendTo('body').promise().done(function() {
$('#parse-records-modal').modal('show');
@ -54,6 +58,8 @@
submitBtn.on('click', function(event) {
var data = new FormData();
submitBtn.attr('disabled', true);
$('#parse-sheet-loader').removeClass('hidden');
event.preventDefault();
event.stopPropagation();
data.append('file', document.getElementById('file').files[0]);

View file

@ -19,6 +19,7 @@
<span class="sn-icon sn-icon-info alert-icon"></span>
<span><%= t('repositories.modal_import.limit_description_html') %></span>
</div>
<div id="parse-sheet-loader" class="sci-loader mt-4 hidden"></div>
</div>
<div class="modal-footer">