diff --git a/customer-display.php b/customer-display.php index a39ec4f..3e9437e 100644 --- a/customer-display.php +++ b/customer-display.php @@ -311,7 +311,62 @@ if (empty($slides)) { } // Debug info -... + const items = data.items || []; + document.getElementById('debugInfo').innerText = 'Items: ' + items.length; + + // Show/Hide screens + if (items.length > 0) { + document.getElementById('welcomeScreen').style.display = 'none'; + document.getElementById('activeCart').style.display = 'flex'; + document.getElementById('debugInfo').style.display = 'block'; + } else { + document.getElementById('welcomeScreen').style.display = 'flex'; + document.getElementById('activeCart').style.display = 'none'; + document.getElementById('debugInfo').style.display = 'none'; + return; // Stop if empty + } + + // Update Customer Name if available + if (data.customerName || data.customer_name) { + document.getElementById('customerName').innerText = data.customerName || data.customer_name; + } else { + document.getElementById('customerName').innerText = 'Welcome'; + } + + // Render Items + const list = document.getElementById('itemsList'); + list.innerHTML = ''; + + items.forEach(item => { + const div = document.createElement('div'); + div.className = 'cart-item'; + + const qty = parseFloat(item.quantity || item.qty) || 0; + const price = parseFloat(item.price) || 0; + // If total is not provided, calculate it: qty * price + let total = item.total ? parseFloat(item.total) : (qty * price); + + let details = `${qty} x ${formatMoney(price)}`; + const itemDiscount = parseFloat(item.discount) || 0; + if (itemDiscount > 0) { + details += ` (Disc: ${formatMoney(itemDiscount)})`; + } + + div.innerHTML = ` +
+
${item.name}
+
${details}
+
+
+ ${formatMoney(total)} +
+ `; + list.appendChild(div); + }); + + // Scroll to bottom + list.scrollTop = list.scrollHeight; + // Update Totals const vat = parseFloat(data.vat) || 0; const subtotal = parseFloat(data.subtotal) || 0; diff --git a/index.php b/index.php index b906a2e..c1974df 100644 --- a/index.php +++ b/index.php @@ -51,6 +51,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { require_once 'db/config.php'; require_once 'includes/SimpleXLSX.php'; require_once 'includes/stock_helper.php'; +require_once 'db/BackupService.php'; // Helper for current outlet if (!function_exists('current_outlet_id')) { @@ -4115,11 +4116,11 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System'; + + Manage Outlets - - diff --git a/post_debug.log b/post_debug.log index c918099..118a8a4 100644 --- a/post_debug.log +++ b/post_debug.log @@ -116,3 +116,5 @@ 2026-03-19 09:22:58 - POST: {"action":"save_theme","theme":"default"} 2026-03-19 09:23:00 - POST: {"action":"save_theme","theme":"dracula"} 2026-03-19 09:23:02 - POST: {"action":"save_theme","theme":"sunset"} +2026-03-19 13:46:44 - POST: {"create_backup":""} +2026-03-19 13:48:49 - POST: {"open_register":"1","register_id":"3","opening_balance":"0"}