Fix modal display issue - add debugging and async/await

- Made print button handler async and await handleQZTrayPrint
- Added console.log debugging to track modal element and class changes
- This should fix the modal not appearing during print operations
This commit is contained in:
2025-10-02 18:06:32 +03:00
parent dc337b6505
commit 6a184ce191

View File

@@ -38,7 +38,7 @@
/* Print Progress Modal Styles */
.print-progress-modal {
display: none;
display: none !important;
position: fixed;
z-index: 9999;
left: 0;
@@ -54,6 +54,7 @@
display: flex !important;
}
.print-progress-content {
background-color: white;
padding: 30px;
@@ -1444,6 +1445,10 @@ async function handleQZTrayPrint(selectedRow) {
const reprintBtn = document.getElementById('reprint-last-btn');
const cancelBtn = document.getElementById('cancel-print-btn');
// Debug: Check if modal exists
console.log('🔍 Modal element:', modal);
console.log('🔍 Modal classList before:', modal ? modal.classList.toString() : 'MODAL NOT FOUND');
// Reset controller state
printController = {
isPaused: false,
@@ -1493,7 +1498,11 @@ async function handleQZTrayPrint(selectedRow) {
console.log(`🖨️ Printing ${quantity} labels via QZ Tray to ${selectedPrinter}`);
// Show modal with show class for proper display
console.log('👉 Adding show class to modal...');
modal.classList.add('show');
console.log('🔍 Modal classList after:', modal.classList.toString());
console.log('🔍 Modal computed display:', window.getComputedStyle(modal).display);
log.innerHTML = '';
addLogEntry(`Starting print job: ${quantity} labels`, 'info');
addLogEntry(`Printer: ${selectedPrinter}`, 'info');
@@ -1674,7 +1683,7 @@ async function handleQZTrayPrint(selectedRow) {
}
// Print Button Handler - Routes to appropriate print method
document.getElementById('print-label-btn').addEventListener('click', function(e) {
document.getElementById('print-label-btn').addEventListener('click', async function(e) {
e.preventDefault();
// Get selected order
@@ -1688,7 +1697,7 @@ document.getElementById('print-label-btn').addEventListener('click', function(e)
const printMethod = document.querySelector('input[name="printMethod"]:checked').value;
if (printMethod === 'qztray') {
handleQZTrayPrint(selectedRow);
await handleQZTrayPrint(selectedRow);
} else {
handlePDFGeneration(selectedRow);
}