Autosave: 20260225-022606
This commit is contained in:
parent
a6faa425c0
commit
ad06129a7a
@ -378,6 +378,81 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.openTableSelectionModal = function() {
|
||||||
|
if (!tableSelectionModal) return;
|
||||||
|
fetchTables();
|
||||||
|
tableSelectionModal.show();
|
||||||
|
};
|
||||||
|
|
||||||
|
function fetchTables() {
|
||||||
|
const grid = document.getElementById("tables-grid");
|
||||||
|
if (!grid) return;
|
||||||
|
grid.innerHTML = "<div class=\"text-center py-5 w-100\"><div class=\"spinner-border text-primary\"></div></div>";
|
||||||
|
|
||||||
|
const outletId = CURRENT_OUTLET ? CURRENT_OUTLET.id : 1;
|
||||||
|
fetch(`api/tables.php?outlet_id=${outletId}`)
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(data => {
|
||||||
|
grid.innerHTML = "";
|
||||||
|
if (data.success && data.tables.length > 0) {
|
||||||
|
renderTables(data.tables);
|
||||||
|
} else {
|
||||||
|
grid.innerHTML = `<div class=\"p-4 text-center text-muted w-100">${_t("none")}</div>`;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
grid.innerHTML = `<div class=\"alert alert-danger w-100">${_t("error")}</div>`;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderTables(tables) {
|
||||||
|
const grid = document.getElementById("tables-grid");
|
||||||
|
if (!grid) return;
|
||||||
|
grid.innerHTML = "";
|
||||||
|
|
||||||
|
const areas = {};
|
||||||
|
tables.forEach(t => {
|
||||||
|
const area = t.area_name || "General";
|
||||||
|
if (!areas[area]) areas[area] = [];
|
||||||
|
areas[area].push(t);
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const area in areas) {
|
||||||
|
const areaHeader = document.createElement("div");
|
||||||
|
areaHeader.className = "col-12 mt-3";
|
||||||
|
areaHeader.innerHTML = `<h6 class=\"fw-bold text-muted text-uppercase small border-bottom pb-2">${area}</h6>`;
|
||||||
|
grid.appendChild(areaHeader);
|
||||||
|
|
||||||
|
areas[area].forEach(table => {
|
||||||
|
const col = document.createElement("div");
|
||||||
|
col.className = "col-3 col-sm-2";
|
||||||
|
const statusClass = table.is_occupied ? "btn-outline-danger" : "btn-outline-success";
|
||||||
|
col.innerHTML = `
|
||||||
|
<button class=\"btn ${statusClass} w-100 py-3 rounded-3 position-relative\" onclick=\"selectTable(${table.id}, '${table.name}')\">
|
||||||
|
<div class=\"fw-bold">${table.name}</div>
|
||||||
|
<div class=\"small\" style=\"font-size: 0.7rem;\">Cap: ${table.capacity}</div>
|
||||||
|
${table.is_occupied ? '<span class="position-absolute top-0 start-100 translate-middle p-1 bg-danger border border-light rounded-circle" title="Occupied"></span>' : ''}
|
||||||
|
</button>
|
||||||
|
`;
|
||||||
|
grid.appendChild(col);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.selectTable = function(id, name) {
|
||||||
|
currentTableId = id;
|
||||||
|
currentTableName = name;
|
||||||
|
const nameDisplay = document.getElementById("selected-table-name");
|
||||||
|
if (nameDisplay) nameDisplay.textContent = name;
|
||||||
|
if (tableSelectionModal) tableSelectionModal.hide();
|
||||||
|
|
||||||
|
const dineInInput = document.getElementById("ot-dine-in");
|
||||||
|
if (dineInInput) {
|
||||||
|
dineInInput.checked = true;
|
||||||
|
checkOrderType();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
window.checkOrderType = function() {
|
window.checkOrderType = function() {
|
||||||
const checked = document.querySelector('input[name="order_type"]:checked');
|
const checked = document.querySelector('input[name="order_type"]:checked');
|
||||||
if (!checked) return;
|
if (!checked) return;
|
||||||
@ -570,4 +645,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
} else showToast(data.error, 'danger');
|
} else showToast(data.error, 'danger');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.openRatingQRModal = function() {
|
||||||
|
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);
|
||||||
|
|
||||||
|
qrContainer.innerHTML = '<img src="' + qrCodeUrl + '" alt="Rating QR Code" class="img-fluid rounded-3 shadow-sm">';
|
||||||
|
|
||||||
|
const modal = new bootstrap.Modal(document.getElementById('qrRatingModal'));
|
||||||
|
modal.show();
|
||||||
|
};
|
||||||
});
|
});
|
||||||
27
index.php
27
index.php
@ -2,6 +2,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
require_once __DIR__ . '/db/config.php';
|
require_once __DIR__ . '/db/config.php';
|
||||||
$settings = get_company_settings();
|
$settings = get_company_settings();
|
||||||
|
$baseUrl = get_base_url();
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
@ -11,7 +12,7 @@ $settings = get_company_settings();
|
|||||||
<title><?= htmlspecialchars($settings['company_name']) ?> - Welcome</title>
|
<title><?= htmlspecialchars($settings['company_name']) ?> - Welcome</title>
|
||||||
<meta name="description" content="Welcome to <?= htmlspecialchars($settings['company_name']) ?> POS System. Manage your business efficiently.">
|
<meta name="description" content="Welcome to <?= htmlspecialchars($settings['company_name']) ?> POS System. Manage your business efficiently.">
|
||||||
<?php if (!empty($settings['favicon_url'])): ?>
|
<?php if (!empty($settings['favicon_url'])): ?>
|
||||||
<link rel="icon" href="<?= htmlspecialchars($settings['favicon_url']) ?>">
|
<link rel="icon" href="<?= $baseUrl . htmlspecialchars($settings['favicon_url']) ?>?v=<?= time() ?>">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet">
|
||||||
@ -67,7 +68,7 @@ $settings = get_company_settings();
|
|||||||
}
|
}
|
||||||
|
|
||||||
.hero-card {
|
.hero-card {
|
||||||
background: rgba(255, 255, 255, 0.8);
|
background: rgba(255, 255, 255, 0.9);
|
||||||
backdrop-filter: blur(12px);
|
backdrop-filter: blur(12px);
|
||||||
border-radius: 32px;
|
border-radius: 32px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.5);
|
border: 1px solid rgba(255, 255, 255, 0.5);
|
||||||
@ -78,9 +79,21 @@ $settings = get_company_settings();
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logo-wrapper {
|
||||||
|
background: #f1f5f9;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 1.5rem;
|
||||||
|
border-radius: 24px;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
.company-logo {
|
.company-logo {
|
||||||
max-height: 100px;
|
max-height: 120px;
|
||||||
margin-bottom: 1.5rem;
|
width: auto;
|
||||||
|
display: block;
|
||||||
filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
|
filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,13 +201,13 @@ $settings = get_company_settings();
|
|||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
<div class="hero-card">
|
<div class="hero-card">
|
||||||
|
|
||||||
|
<div class="logo-wrapper">
|
||||||
<?php if (!empty($settings['logo_url'])): ?>
|
<?php if (!empty($settings['logo_url'])): ?>
|
||||||
<img src="<?= htmlspecialchars($settings['logo_url']) ?>" alt="Logo" class="company-logo">
|
<img src="<?= $baseUrl . htmlspecialchars($settings['logo_url']) ?>?v=<?= time() ?>" alt="Logo" class="company-logo">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<div class="mb-4">
|
|
||||||
<i class="bi bi-grid-1x2-fill fs-1 text-primary"></i>
|
<i class="bi bi-grid-1x2-fill fs-1 text-primary"></i>
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h1 class="welcome-title"><?= htmlspecialchars($settings['company_name']) ?></h1>
|
<h1 class="welcome-title"><?= htmlspecialchars($settings['company_name']) ?></h1>
|
||||||
<p class="welcome-subtitle">Your all-in-one business management solution.</p>
|
<p class="welcome-subtitle">Your all-in-one business management solution.</p>
|
||||||
|
|||||||
42
pos.php
42
pos.php
@ -85,7 +85,7 @@ if (!$loyalty_settings) {
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title><?= htmlspecialchars($settings['company_name']) ?> - POS</title>
|
<title><?= htmlspecialchars($settings['company_name']) ?> - POS</title>
|
||||||
<?php if (!empty($settings['favicon_url'])): ?>
|
<?php if (!empty($settings['favicon_url'])): ?>
|
||||||
<link rel="icon" href="<?= htmlspecialchars($settings['favicon_url']) ?>">
|
<link rel="icon" href="<?= get_base_url() . htmlspecialchars($settings['favicon_url']) ?>?v=<?= time() ?>">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet">
|
||||||
@ -166,7 +166,7 @@ if (!$loyalty_settings) {
|
|||||||
<div class="container-fluid p-0">
|
<div class="container-fluid p-0">
|
||||||
<a class="navbar-brand fw-bold d-flex align-items-center" href="pos.php">
|
<a class="navbar-brand fw-bold d-flex align-items-center" href="pos.php">
|
||||||
<?php if (!empty($settings['logo_url'])): ?>
|
<?php if (!empty($settings['logo_url'])): ?>
|
||||||
<img src="<?= htmlspecialchars($settings['logo_url']) ?>" alt="Logo" height="28" class="me-2">
|
<img src="<?= get_base_url() . htmlspecialchars($settings['logo_url']) ?>?v=<?= time() ?>" alt="Logo" height="28" class="me-2">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<span class="d-none d-sm-inline" style="letter-spacing: -0.5px;"><?= htmlspecialchars($settings['company_name']) ?></span>
|
<span class="d-none d-sm-inline" style="letter-spacing: -0.5px;"><?= htmlspecialchars($settings['company_name']) ?></span>
|
||||||
<span class="badge bg-primary-subtle text-primary ms-2 fs-7 fw-semibold rounded-pill px-2 border border-primary-subtle"><?= htmlspecialchars($current_outlet_name) ?></span>
|
<span class="badge bg-primary-subtle text-primary ms-2 fs-7 fw-semibold rounded-pill px-2 border border-primary-subtle"><?= htmlspecialchars($current_outlet_name) ?></span>
|
||||||
@ -175,6 +175,7 @@ if (!$loyalty_settings) {
|
|||||||
<div class="ms-auto d-flex align-items-center gap-1 gap-sm-2">
|
<div class="ms-auto d-flex align-items-center gap-1 gap-sm-2">
|
||||||
<a href="kitchen.php" class="btn btn-outline-primary btn-sm rounded-pill px-2 px-sm-3 border-0"><i class="bi bi-fire me-1"></i> Kitchen</a>
|
<a href="kitchen.php" class="btn btn-outline-primary btn-sm rounded-pill px-2 px-sm-3 border-0"><i class="bi bi-fire me-1"></i> Kitchen</a>
|
||||||
<button class="btn btn-outline-warning btn-sm rounded-pill px-2 px-sm-3 border-0" onclick="openRecallOrderModal()"><i class="bi bi-arrow-counterclockwise me-1"></i> Recall Bill</button>
|
<button class="btn btn-outline-warning btn-sm rounded-pill px-2 px-sm-3 border-0" onclick="openRecallOrderModal()"><i class="bi bi-arrow-counterclockwise me-1"></i> Recall Bill</button>
|
||||||
|
<button class="btn btn-outline-info btn-sm rounded-pill px-2 px-sm-3 border-0" onclick="openRatingQRModal()"><i class="bi bi-qr-code me-1"></i> Rating QR</button>
|
||||||
|
|
||||||
<div class="vr mx-1 h-25 d-none d-sm-block"></div>
|
<div class="vr mx-1 h-25 d-none d-sm-block"></div>
|
||||||
|
|
||||||
@ -291,6 +292,12 @@ if (!$loyalty_settings) {
|
|||||||
<label class="btn btn-outline-primary py-2 rounded-end-pill" for="ot-delivery" style="font-weight: 700;">Delivery</label>
|
<label class="btn btn-outline-primary py-2 rounded-end-pill" for="ot-delivery" style="font-weight: 700;">Delivery</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="current-table-display" class="mt-2 text-center" style="display: none;">
|
||||||
|
<span class="badge bg-info-subtle text-info border border-info-subtle px-3 py-2 rounded-pill fw-bold" onclick="openTableSelectionModal()" style="cursor: pointer;">
|
||||||
|
<i class="bi bi-geo-alt-fill me-1"></i> <span id="selected-table-name">None</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="position-relative">
|
<div class="position-relative">
|
||||||
<div class="input-group input-group-touch">
|
<div class="input-group input-group-touch">
|
||||||
<span class="input-group-text bg-light border-0 rounded-start-pill ps-3"><i class="bi bi-person text-muted fs-5"></i></span>
|
<span class="input-group-text bg-light border-0 rounded-start-pill ps-3"><i class="bi bi-person text-muted fs-5"></i></span>
|
||||||
@ -345,6 +352,37 @@ if (!$loyalty_settings) {
|
|||||||
|
|
||||||
<!-- Modals -->
|
<!-- Modals -->
|
||||||
<div class="no-print">
|
<div class="no-print">
|
||||||
|
<!-- Table Selection Modal -->
|
||||||
|
<div class="modal fade" id="tableSelectionModal" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered modal-lg">
|
||||||
|
<div class="modal-content border-0 shadow-lg" style="border-radius: 20px;">
|
||||||
|
<div class="modal-header border-0 pb-0">
|
||||||
|
<h6 class="modal-title fw-bold">Select Table</h6>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body p-3">
|
||||||
|
<div id="table-areas-container"></div>
|
||||||
|
<div id="tables-grid" class="row g-3"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="qrRatingModal" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered modal-sm">
|
||||||
|
<div class="modal-content border-0 shadow-lg" style="border-radius: 20px;">
|
||||||
|
<div class="modal-header border-0 pb-0">
|
||||||
|
<h6 class="modal-title fw-bold">Scan to Rate</h6>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body p-4 text-center">
|
||||||
|
<div id="rating-qr-container" class="mb-3"></div>
|
||||||
|
<p class="small text-muted mb-0">Scan this QR code with your phone to rate our service and staff.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="modal fade" id="recallOrderModal" tabindex="-1" aria-hidden="true">
|
<div class="modal fade" id="recallOrderModal" tabindex="-1" aria-hidden="true">
|
||||||
<div class="modal-dialog modal-lg modal-dialog-centered">
|
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||||
<div class="modal-content border-0 shadow-lg" style="border-radius: 20px;">
|
<div class="modal-content border-0 shadow-lg" style="border-radius: 20px;">
|
||||||
|
|||||||
@ -46,7 +46,7 @@ foreach ($variants_raw as $v) {
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
||||||
<title><?= htmlspecialchars($settings['company_name']) ?> - Order Online</title>
|
<title><?= htmlspecialchars($settings['company_name']) ?> - Order Online</title>
|
||||||
<?php if (!empty($settings['favicon_url'])): ?>
|
<?php if (!empty($settings['favicon_url'])): ?>
|
||||||
<link rel="icon" href="<?= htmlspecialchars($settings['favicon_url']) ?>">
|
<link rel="icon" href="<?= get_base_url() . htmlspecialchars($settings['favicon_url']) ?>?v=<?= time() ?>">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet">
|
||||||
@ -95,7 +95,7 @@ foreach ($variants_raw as $v) {
|
|||||||
<header class="bg-white p-3 border-bottom d-flex align-items-center justify-content-between">
|
<header class="bg-white p-3 border-bottom d-flex align-items-center justify-content-between">
|
||||||
<div class="d-flex align-items-center gap-2">
|
<div class="d-flex align-items-center gap-2">
|
||||||
<?php if (!empty($settings['logo_url'])): ?>
|
<?php if (!empty($settings['logo_url'])): ?>
|
||||||
<img src="<?= htmlspecialchars($settings['logo_url']) ?>" alt="Logo" style="height: 32px;">
|
<img src="<?= get_base_url() . htmlspecialchars($settings['logo_url']) ?>?v=<?= time() ?>" alt="Logo" style="height: 32px;">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<span class="fw-bold"><?= htmlspecialchars($settings['company_name']) ?></span>
|
<span class="fw-bold"><?= htmlspecialchars($settings['company_name']) ?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
2
rate.php
2
rate.php
@ -252,7 +252,7 @@ $users = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($logoUrl): ?>
|
<?php if ($logoUrl): ?>
|
||||||
<img src="<?= htmlspecialchars($logoUrl) ?>" alt="Logo" class="logo">
|
<img src="<?= get_base_url() . htmlspecialchars($logoUrl) ?>?v=<?= time() ?>" alt="Logo" class="logo">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<h1 class="fw-bold"><?= htmlspecialchars($companyName) ?></h1>
|
<h1 class="fw-bold"><?= htmlspecialchars($companyName) ?></h1>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user