Fix vue print modal component initialization [SCI-7469] (#4616)

This commit is contained in:
ajugo 2022-11-14 10:42:51 +01:00 committed by GitHub
parent e4673f67ba
commit 4e77174e52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 33 deletions

View file

@ -59,12 +59,14 @@
$(document).on('click', '.print-label-button', function() {
var selectedRows = $(this).data('rows');
PrintModalComponent.showModal = true;
if (selectedRows.length) {
$('#modal-info-repository-row').modal('hide');
PrintModalComponent.row_ids = selectedRows;
} else {
PrintModalComponent.row_ids = RepositoryDatatable.selectedRows();
if (typeof PrintModalComponent !== 'undefined') {
PrintModalComponent.showModal = true;
if (selectedRows.length) {
$('#modal-info-repository-row').modal('hide');
PrintModalComponent.row_ids = selectedRows;
} else {
PrintModalComponent.row_ids = RepositoryDatatable.selectedRows();
}
}
});
}());

View file

@ -7,35 +7,37 @@ Vue.prototype.i18n = window.I18n;
function initPrintModalComponent() {
const container = $('.print-label-modal-container');
window.PrintModalComponent = new Vue({
el: '.print-label-modal-container',
name: 'PrintModalComponent',
components: {
'print-modal-container': PrintModalContainer
},
data() {
return {
showModal: false,
row_ids: [],
zebraEnabled: container.data('zebra-enabled'),
urls: {
print: container.data('print-url'),
zebraProgress: container.data('zebra-progress-url'),
printers: container.data('printers-url'),
labelTemplates: container.data('label-templates-url'),
rows: container.data('rows-url'),
fluicsInfo: container.data('fluics-info-url'),
printValidation: container.data('print-validation-url'),
labelPreview: container.data('label-preview-url')
if (container.length) {
window.PrintModalComponent = new Vue({
el: '.print-label-modal-container',
name: 'PrintModalComponent',
components: {
'print-modal-container': PrintModalContainer
},
data() {
return {
showModal: false,
row_ids: [],
zebraEnabled: container.data('zebra-enabled'),
urls: {
print: container.data('print-url'),
zebraProgress: container.data('zebra-progress-url'),
printers: container.data('printers-url'),
labelTemplates: container.data('label-templates-url'),
rows: container.data('rows-url'),
fluicsInfo: container.data('fluics-info-url'),
printValidation: container.data('print-validation-url'),
labelPreview: container.data('label-preview-url')
}
};
},
methods: {
closeModal() {
this.showModal = false;
}
};
},
methods: {
closeModal() {
this.showModal = false;
}
}
});
});
}
}
initPrintModalComponent();