printing error

This commit is contained in:
Flatlogic Bot 2026-02-28 13:37:08 +00:00
parent b0479e299c
commit 2772970659

View File

@ -125,7 +125,7 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
} }
window.filterCategory = function(categoryId, btnElement) { function filterCategory(categoryId, btnElement) { window.filterCategory = filterCategory;
currentCategory = categoryId; currentCategory = categoryId;
document.querySelectorAll('.category-btn').forEach(btn => btn.classList.remove('active')); document.querySelectorAll('.category-btn').forEach(btn => btn.classList.remove('active'));
if (btnElement) { if (btnElement) {
@ -150,7 +150,7 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
} }
window.openRecallOrderModal = function() { function openRecallOrderModal() { window.openRecallOrderModal = openRecallOrderModal;
if (!recallModal) return; if (!recallModal) return;
fetchRecallOrders(); fetchRecallOrders();
recallModal.show(); recallModal.show();
@ -416,7 +416,7 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
} }
window.openTableSelectionModal = function() { function openTableSelectionModal() { window.openTableSelectionModal = openTableSelectionModal;
if (!tableSelectionModal) return; if (!tableSelectionModal) return;
fetchTables(); fetchTables();
tableSelectionModal.show(); tableSelectionModal.show();
@ -477,7 +477,7 @@ document.addEventListener('DOMContentLoaded', () => {
} }
} }
window.selectTable = function(id, name) { function selectTable(id, name) { window.selectTable = selectTable;
currentTableId = id; currentTableId = id;
currentTableName = name; currentTableName = name;
const nameDisplay = document.getElementById("selected-table-name"); const nameDisplay = document.getElementById("selected-table-name");
@ -491,7 +491,7 @@ document.addEventListener('DOMContentLoaded', () => {
} }
}; };
window.checkOrderType = function() { function checkOrderType() { window.checkOrderType = checkOrderType;
const checked = document.querySelector('input[name="order_type"]:checked'); const checked = document.querySelector('input[name="order_type"]:checked');
if (!checked) return; if (!checked) return;
const selected = checked.value; const selected = checked.value;
@ -507,7 +507,7 @@ document.addEventListener('DOMContentLoaded', () => {
input.addEventListener('change', checkOrderType); input.addEventListener('change', checkOrderType);
}); });
window.handleProductClick = function(product, variants) { function handleProductClick(product, variants) { window.handleProductClick = handleProductClick;
if (variants && variants.length > 0) { if (variants && variants.length > 0) {
openVariantModal(product, variants); openVariantModal(product, variants);
} else { } else {
@ -549,14 +549,14 @@ document.addEventListener('DOMContentLoaded', () => {
variantSelectionModal.show(); variantSelectionModal.show();
} }
window.addToCart = function(product) { function addToCart(product) { window.addToCart = addToCart;
const existing = cart.find(item => item.id === product.id && item.variant_id === product.variant_id); const existing = cart.find(item => item.id === product.id && item.variant_id === product.variant_id);
if (existing) existing.quantity++; if (existing) existing.quantity++;
else cart.push({...product}); else cart.push({...product});
updateCart(); updateCart();
}; };
window.changeQuantity = function(index, delta) { function changeQuantity(index, delta) { window.changeQuantity = changeQuantity;
if (cart[index]) { if (cart[index]) {
cart[index].quantity += delta; cart[index].quantity += delta;
if (cart[index].quantity <= 0) cart.splice(index, 1); if (cart[index].quantity <= 0) cart.splice(index, 1);
@ -564,12 +564,12 @@ document.addEventListener('DOMContentLoaded', () => {
} }
}; };
window.removeFromCart = function(index) { function removeFromCart(index) { window.removeFromCart = removeFromCart;
cart.splice(index, 1); cart.splice(index, 1);
updateCart(); updateCart();
}; };
window.clearCart = function() { function clearCart() { window.clearCart = clearCart;
if (cart.length === 0) return; if (cart.length === 0) return;
cart = []; cart = [];
currentOrderId = null; currentOrderId = null;
@ -670,7 +670,7 @@ document.addEventListener('DOMContentLoaded', () => {
} }
} }
window.processOrder = function(paymentTypeId, paymentTypeName) { function processOrder(paymentTypeId, paymentTypeName) { window.processOrder = processOrder;
const orderTypeInput = document.querySelector('input[name="order_type"]:checked'); const orderTypeInput = document.querySelector('input[name="order_type"]:checked');
const orderType = orderTypeInput ? orderTypeInput.value : 'takeaway'; const orderType = orderTypeInput ? orderTypeInput.value : 'takeaway';
@ -766,7 +766,7 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
}; };
window.triggerNetworkPrint = function(orderId, type) { function triggerNetworkPrint(orderId, type) { window.triggerNetworkPrint = triggerNetworkPrint;
if (!orderId) return; if (!orderId) return;
const printerIp = (type === 'kitchen') ? CURRENT_OUTLET.kitchen_printer_ip : CURRENT_OUTLET.cashier_printer_ip; const printerIp = (type === 'kitchen') ? CURRENT_OUTLET.kitchen_printer_ip : CURRENT_OUTLET.cashier_printer_ip;
@ -789,7 +789,7 @@ document.addEventListener('DOMContentLoaded', () => {
.catch(err => console.error(`Network Print Fetch Error (${type}):`, err)); .catch(err => console.error(`Network Print Fetch Error (${type}):`, err));
}; };
window.printThermalReceipt = function(data) { function printThermalReceipt(data) { window.printThermalReceipt = printThermalReceipt;
let iframe = document.getElementById('print-iframe'); let iframe = document.getElementById('print-iframe');
if (!iframe) { if (!iframe) {
iframe = document.createElement('iframe'); iframe = document.createElement('iframe');
@ -931,7 +931,7 @@ document.addEventListener('DOMContentLoaded', () => {
iframe.contentWindow.print(); iframe.contentWindow.print();
}; };
window.openRatingQRModal = function() { function openRatingQRModal() { window.openRatingQRModal = openRatingQRModal;
const qrContainer = document.getElementById('rating-qr-container'); const qrContainer = document.getElementById('rating-qr-container');
const ratingUrl = BASE_URL + '/rate.php'; const ratingUrl = BASE_URL + '/rate.php';
const qrCodeUrl = "https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=" + encodeURIComponent(ratingUrl); const qrCodeUrl = "https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=" + encodeURIComponent(ratingUrl);