editing customer display
This commit is contained in:
parent
e6e204908d
commit
71282f7fc3
@ -311,7 +311,62 @@ if (empty($slides)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Debug info
|
// 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 = `
|
||||||
|
<div>
|
||||||
|
<div class="item-name">${item.name}</div>
|
||||||
|
<div class="item-details">${details}</div>
|
||||||
|
</div>
|
||||||
|
<div class="item-price">
|
||||||
|
${formatMoney(total)}
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
list.appendChild(div);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Scroll to bottom
|
||||||
|
list.scrollTop = list.scrollHeight;
|
||||||
|
|
||||||
// Update Totals
|
// Update Totals
|
||||||
const vat = parseFloat(data.vat) || 0;
|
const vat = parseFloat(data.vat) || 0;
|
||||||
const subtotal = parseFloat(data.subtotal) || 0;
|
const subtotal = parseFloat(data.subtotal) || 0;
|
||||||
|
|||||||
@ -51,6 +51,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
require_once 'db/config.php';
|
require_once 'db/config.php';
|
||||||
require_once 'includes/SimpleXLSX.php';
|
require_once 'includes/SimpleXLSX.php';
|
||||||
require_once 'includes/stock_helper.php';
|
require_once 'includes/stock_helper.php';
|
||||||
|
require_once 'db/BackupService.php';
|
||||||
|
|
||||||
// Helper for current outlet
|
// Helper for current outlet
|
||||||
if (!function_exists('current_outlet_id')) {
|
if (!function_exists('current_outlet_id')) {
|
||||||
@ -4115,11 +4116,11 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System';
|
|||||||
<i class="fas fa-desktop"></i> <span><?= __('customer_display') ?></span>
|
<i class="fas fa-desktop"></i> <span><?= __('customer_display') ?></span>
|
||||||
</a>
|
</a>
|
||||||
<a href="index.php?page=backups" class="nav-link <?= $page === 'backups' ? 'active' : '' ?>">
|
<a href="index.php?page=backups" class="nav-link <?= $page === 'backups' ? 'active' : '' ?>">
|
||||||
|
<i class="fas fa-database"></i> <span><?= __('backups') ?></span>
|
||||||
|
</a>
|
||||||
<a href="index.php?page=outlets" class="nav-link <?= $page === 'outlets' ? 'active' : '' ?>">
|
<a href="index.php?page=outlets" class="nav-link <?= $page === 'outlets' ? 'active' : '' ?>">
|
||||||
<i class="fas fa-shop"></i> <span>Manage Outlets</span>
|
<i class="fas fa-shop"></i> <span>Manage Outlets</span>
|
||||||
</a>
|
</a>
|
||||||
<i class="fas fa-database"></i> <span><?= __('backups') ?></span>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|||||||
@ -116,3 +116,5 @@
|
|||||||
2026-03-19 09:22:58 - POST: {"action":"save_theme","theme":"default"}
|
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:00 - POST: {"action":"save_theme","theme":"dracula"}
|
||||||
2026-03-19 09:23:02 - POST: {"action":"save_theme","theme":"sunset"}
|
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"}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user