diff --git a/assets/js/main.js b/assets/js/main.js index e769b68..d57339c 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -125,7 +125,7 @@ document.addEventListener('DOMContentLoaded', () => { }); } - window.filterCategory = function(categoryId, btnElement) { + function filterCategory(categoryId, btnElement) { window.filterCategory = filterCategory; currentCategory = categoryId; document.querySelectorAll('.category-btn').forEach(btn => btn.classList.remove('active')); if (btnElement) { @@ -150,7 +150,7 @@ document.addEventListener('DOMContentLoaded', () => { }); } - window.openRecallOrderModal = function() { + function openRecallOrderModal() { window.openRecallOrderModal = openRecallOrderModal; if (!recallModal) return; fetchRecallOrders(); recallModal.show(); @@ -416,7 +416,7 @@ document.addEventListener('DOMContentLoaded', () => { }); } - window.openTableSelectionModal = function() { + function openTableSelectionModal() { window.openTableSelectionModal = openTableSelectionModal; if (!tableSelectionModal) return; fetchTables(); tableSelectionModal.show(); @@ -477,7 +477,7 @@ document.addEventListener('DOMContentLoaded', () => { } } - window.selectTable = function(id, name) { + function selectTable(id, name) { window.selectTable = selectTable; currentTableId = id; currentTableName = 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'); if (!checked) return; const selected = checked.value; @@ -507,7 +507,7 @@ document.addEventListener('DOMContentLoaded', () => { input.addEventListener('change', checkOrderType); }); - window.handleProductClick = function(product, variants) { + function handleProductClick(product, variants) { window.handleProductClick = handleProductClick; if (variants && variants.length > 0) { openVariantModal(product, variants); } else { @@ -549,14 +549,14 @@ document.addEventListener('DOMContentLoaded', () => { 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); if (existing) existing.quantity++; else cart.push({...product}); updateCart(); }; - window.changeQuantity = function(index, delta) { + function changeQuantity(index, delta) { window.changeQuantity = changeQuantity; if (cart[index]) { cart[index].quantity += delta; 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); updateCart(); }; - window.clearCart = function() { + function clearCart() { window.clearCart = clearCart; if (cart.length === 0) return; cart = []; 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 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; 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)); }; - window.printThermalReceipt = function(data) { + function printThermalReceipt(data) { window.printThermalReceipt = printThermalReceipt; let iframe = document.getElementById('print-iframe'); if (!iframe) { iframe = document.createElement('iframe'); @@ -931,7 +931,7 @@ document.addEventListener('DOMContentLoaded', () => { iframe.contentWindow.print(); }; - window.openRatingQRModal = function() { + function openRatingQRModal() { window.openRatingQRModal = openRatingQRModal; const qrContainer = document.getElementById('rating-qr-container'); const ratingUrl = BASE_URL + '/rate.php'; const qrCodeUrl = "https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=" + encodeURIComponent(ratingUrl);