From 6a184ce1918bce1bfcd622c616e31197cb939855 Mon Sep 17 00:00:00 2001 From: Scheianu Ionut Date: Thu, 2 Oct 2025 18:06:32 +0300 Subject: [PATCH] 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 --- py_app/app/templates/print_module.html | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/py_app/app/templates/print_module.html b/py_app/app/templates/print_module.html index 576e359..a2551af 100644 --- a/py_app/app/templates/print_module.html +++ b/py_app/app/templates/print_module.html @@ -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); }