Merge pull request #4479 from okriuchykhin/ok_SCI_7271

Fix label printing status modal [SCI-7271]
This commit is contained in:
Alex Kriuchykhin 2022-10-06 15:46:36 +02:00 committed by GitHub
commit 07d470b2ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 9 deletions

View file

@ -1,9 +1,15 @@
(function() {
var PrintProgressModal = (function() {
'use strict';
function updateProgressModal() {
var modal = $('.label-printing-progress-modal');
if (modal.length === 0) return;
$(document).on('click', '.label-printing-progress-modal .close', function() {
$(this).closest('.label-printing-progress-modal').remove();
});
$.getJSON(
modal.data('progress-url'), function(data) {
modal.replaceWith(data.html);
@ -15,11 +21,7 @@
);
}
$(document).on('click', '.label-printing-progress-modal .close', function() {
$(this).closest('.label-printing-progress-modal').remove();
});
$(document).on('ajax:success', '.print-label-form', function(e, data) {
function initialize(data) {
var modal = $('.label-printing-progress-modal');
if (modal.length) {
modal.replaceWith(data.html);
@ -27,7 +29,10 @@
$('body').append($(data.html));
}
updateProgressModal();
$('#modal-print-repository-row-label').modal('hide');
setTimeout(updateProgressModal, 3000);
}
return Object.freeze({
init: initialize
});
}());

View file

@ -234,8 +234,10 @@
label_printer_id: this.selectedPrinter.id,
label_template_id: this.selectedTemplate.id,
copies: this.copies
}, () => {
}, (data) => {
$(this.$refs.modal).modal('hide');
this.$emit('close');
PrintProgressModal.init(data);
})
}
},