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