Autosave: 20260224-174017

This commit is contained in:
Flatlogic Bot 2026-02-24 17:40:17 +00:00
parent 6e5310e4dc
commit 0c612d04a8
3 changed files with 66 additions and 215 deletions

View File

@ -31,8 +31,8 @@ if (isset($_GET['lang'])) {
exit;
}
$currentLang = $_SESSION['lang'] ?? 'en';
$isRTL = ($currentLang === 'ar');
$currentLang = "en";
$isRTL = false;
// Require login for all admin pages
if (function_exists('require_login')) {
@ -592,18 +592,6 @@ function can_view($module) {
<!-- Top Header -->
<header class="d-flex justify-content-end align-items-center mb-4 pb-3 border-bottom">
<div class="d-flex align-items-center gap-3">
<!-- Language Switcher -->
<div class="dropdown">
<button class="btn btn-link text-decoration-none dropdown-toggle d-flex align-items-center gap-2" type="button" id="topLangDropdown" data-bs-toggle="dropdown" aria-expanded="false" style="color: var(--text-primary);">
<i class="bi bi-translate"></i>
<span class="d-none d-sm-inline"><?= t('language') ?></span>
</button>
<ul class="dropdown-menu dropdown-menu-end shadow border-0" aria-labelledby="topLangDropdown">
<li><h6 class="dropdown-header"><?= t('select_language') ?></h6></li>
<li><a class="dropdown-item d-flex align-items-center gap-2" href="?lang=en"><?= t('english') ?></a></li>
<li><a class="dropdown-item d-flex align-items-center gap-2" href="?lang=ar"><?= t('arabic') ?></a></li>
</ul>
</div>
<!-- Theme Switcher -->
<div class="dropdown">

View File

@ -1,17 +1,19 @@
<?php
// Simple translation helper
function t($key, $lang = null) {
if (!$lang) {
$lang = $_SESSION['lang'] ?? 'en';
}
// User requested "No translations in all app" except for specific areas
// which are handled independently (qorder, rate).
// So we force 'en' here for all general UI labels.
$lang = 'en';
$translations = [
'en' => [
'dashboard' => 'Dashboard',
'pos_operations' => 'POS & Operations',
'pos_terminal' => 'POS Terminal',
'orders_pos' => 'Orders (POS)',
'kitchen_view' => 'Kitchen View',
'orders_pos' => 'Orders',
'kitchen_view' => 'Kitchen',
'waiter_view' => 'Waiter',
'ads_management' => 'Ads Management',
'menu_management' => 'Menu Management',
'products' => 'Products',
@ -100,103 +102,14 @@ function t($key, $lang = null) {
'dine_in' => 'Dine-In',
'delivery' => 'Delivery',
'auto_translate' => 'Auto-translate',
],
'ar' => [
'dashboard' => 'لوحة القيادة',
'pos_operations' => 'نقطة البيع والعمليات',
'pos_terminal' => 'جهاز نقطة البيع',
'orders_pos' => 'الطلبات (نقطة البيع)',
'kitchen_view' => 'عرض المطبخ',
'ads_management' => 'إدارة الإعلانات',
'menu_management' => 'إدارة القائمة',
'products' => 'المنتجات',
'categories' => 'الفئات',
'restaurant_setup' => 'إعداد المطعم',
'outlets' => 'المنافذ',
'areas' => 'المناطق',
'tables' => 'الطاولات',
'people_partners' => 'الأشخاص والشركاء',
'customers' => 'العملاء',
'suppliers' => 'الموردين',
'loyalty' => 'الولاء',
'financials' => 'المالية',
'purchases' => 'المشتريات',
'expenses' => 'المصاريف',
'expense_categories' => 'فئات المصاريف',
'reports_analytics' => 'التقارير والتحليلات',
'daily_reports' => 'التقارير اليومية',
'user_management' => 'إدارة المستخدمين',
'users' => 'المستخدمين',
'roles_groups' => 'الأدوار / المجموعات',
'attendance' => 'الحضور',
'staff_ratings' => 'تقييمات الموظفين',
'settings' => 'الإعدادات',
'payment_types' => 'أنواع الدفع',
'integrations' => 'التكاملات',
'company' => 'الشركة',
'backup_restore' => 'النسخ الاحتياطي والاستعادة',
'view_site' => 'عرض الموقع',
'theme' => 'المظهر',
'language' => 'اللغة',
'logout' => 'تسجيل الخروج',
'my_profile' => 'ملفي الشخصي',
'company_settings' => 'إعدادات الشركة',
'signed_in_as' => 'تم تسجيل الدخول بصفتك',
'welcome_back' => 'مرحباً بعودتك',
'select_theme' => 'اختر المظهر',
'select_language' => 'اختر اللغة',
'default' => 'الافتراضي',
'dark' => 'داكن',
'ocean' => 'محيط',
'forest' => 'غابة',
'grape' => 'عنب',
'english' => 'الإنجليزية',
'arabic' => 'العربية',
'search' => 'بحث',
'filter' => 'تصفية',
'add' => 'إضافة',
'edit' => 'تعديل',
'delete' => 'حذف',
'save' => 'حفظ',
'cancel' => 'إلغاء',
'close' => 'إغلاق',
'actions' => 'إجراءات',
'name' => 'الاسم',
'arabic_name' => 'الاسم بالعربية',
'description' => 'الوصف',
'status' => 'الحالة',
'active' => 'نشط',
'inactive' => 'غير نشط',
'all' => 'الكل',
'none' => 'لا يوجد',
'price' => 'السعر',
'quantity' => 'الكمية',
'total' => 'الإجمالي',
'date' => 'التاريخ',
'customer' => 'العميل',
'phone' => 'الهاتف',
'email' => 'البريد الإلكتروني',
'address' => 'العنوان',
'points' => 'النقاط',
'stock' => 'المخزون',
'category' => 'الفئة',
'variant' => 'النوع',
'table' => 'الطاولة',
'outlet' => 'المنفذ',
'order_no' => 'رقم الطلب',
'payment' => 'الدفع',
'type' => 'النوع',
'commission' => 'العمولة',
'preparing' => 'قيد التحضير',
'ready' => 'جاهز',
'completed' => 'مكتمل',
'cancelled' => 'ملغي',
'takeaway' => 'سفري',
'dine_in' => 'محلي',
'delivery' => 'توصيل',
'auto_translate' => 'ترجمة تلقائية',
'quick_pay' => 'QUICK PAY',
'save_bill' => 'SAVE BILL',
'recall' => 'Recall Bill',
'orders' => 'Orders',
'kitchen' => 'Kitchen',
'switch' => 'Switch',
]
];
return $translations[$lang][$key] ?? $translations['en'][$key] ?? $key;
return $translations['en'][$key] ?? $key;
}

148
pos.php
View File

@ -8,24 +8,10 @@ if (session_status() === PHP_SESSION_NONE) {
session_start();
}
// Handle language switching
if (isset($_GET['lang'])) {
$allowed_langs = ['en', 'ar'];
if (in_array($_GET['lang'], $allowed_langs)) {
$_SESSION['lang'] = $_GET['lang'];
}
$current_url = strtok($_SERVER["REQUEST_URI"], '?');
$query = $_GET;
unset($query['lang']);
if (count($query) > 0) {
$current_url .= '?' . http_build_query($query);
}
header("Location: $current_url");
exit;
}
$currentLang = $_SESSION['lang'] ?? 'en';
$isRTL = ($currentLang === 'ar');
// User requested no translations in all app except for QR order and rating.
// Force English for POS.
$currentLang = 'en';
$isRTL = false;
require_permission('pos_view');
@ -80,7 +66,7 @@ $order_type = $_GET['order_type'] ?? 'takeaway';
$current_outlet_name = 'Unknown Outlet';
foreach ($outlets as $o) {
if ($o['id'] == $outlet_id) {
$current_outlet_name = ($isRTL && !empty($o['name_ar'])) ? $o['name_ar'] : $o['name'];
$current_outlet_name = $o['name'];
break;
}
}
@ -93,7 +79,7 @@ if (!$loyalty_settings) {
}
?>
<!doctype html>
<html lang="<?= $currentLang ?>" dir="<?= $isRTL ? 'rtl' : 'ltr' ?>">
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
@ -109,18 +95,18 @@ if (!$loyalty_settings) {
<link rel="stylesheet" href="assets/css/custom.css?v=<?= time() ?>">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style>
body { height: 100vh; overflow: hidden; font-family: 'Inter', 'Noto Sans Arabic', sans-serif; background: #f4f7f6; }
body { height: 100vh; overflow: hidden; font-family: 'Inter', sans-serif; background: #f4f7f6; }
.scrollable-y { overflow-y: auto; height: 100%; scrollbar-width: thin; }
.pos-layout { height: calc(100vh - 60px); }
.pos-categories { background: #fff; height: 100%; border-<?= $isRTL ? 'left' : 'right' ?>: 1px solid #e0e0e0; }
.pos-categories { background: #fff; height: 100%; border-right: 1px solid #e0e0e0; }
.pos-products { background: #f8fafc; height: 100%; display: flex; flex-direction: column; }
.pos-cart { background: #fff; height: 100%; border-<?= $isRTL ? 'right' : 'left' ?>: 1px solid #e0e0e0; display: flex; flex-direction: column; }
.pos-cart { background: #fff; height: 100%; border-left: 1px solid #e0e0e0; display: flex; flex-direction: column; }
.product-card { transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); cursor: pointer; border: 1px solid transparent !important; background: #fff; }
.product-card:active { transform: scale(0.95); }
.product-card:hover { border-color: #0d6efd !important; box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important; }
.category-btn { text-align: <?= $isRTL ? 'right' : 'left' ?>; border: none; background: none; padding: 10px 12px; width: 100%; display: flex; align-items: center; gap: 10px; border-radius: 12px; color: #64748b; font-weight: 700; transition: all 0.2s; }
.category-btn { text-align: left; border: none; background: none; padding: 10px 12px; width: 100%; display: flex; align-items: center; gap: 10px; border-radius: 12px; color: #64748b; font-weight: 700; transition: all 0.2s; }
.category-btn:hover { background-color: #f1f5f9; color: #0f172a; }
.category-btn.active { background-color: #0d6efd; color: white; box-shadow: 0 4px 6px -1px rgba(13, 110, 253, 0.3); }
.search-dropdown { position: absolute; width: 100%; z-index: 1000; max-height: 200px; overflow-y: auto; display: none; }
@ -152,7 +138,6 @@ if (!$loyalty_settings) {
body { overflow: visible !important; height: auto !important; }
}
.print-only { display: none; }
.dropdown-menu { <?= $isRTL ? 'text-align: right;' : '' ?> }
</style>
</head>
<body>
@ -170,33 +155,11 @@ if (!$loyalty_settings) {
<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>
</a>
<div class="ms-auto d-flex align-items-center gap-2">
<!-- Language Switcher -->
<div class="dropdown me-1">
<button class="btn btn-outline-secondary btn-sm rounded-pill px-3 border-0 bg-light" type="button" data-bs-toggle="dropdown">
<i class="bi bi-translate me-1"></i> <span class="d-none d-sm-inline"><?= $isRTL ? 'العربية' : 'English' ?></span>
</button>
<ul class="dropdown-menu dropdown-menu-end shadow border-0 mt-2">
<li><a class="dropdown-item" href="?lang=en">English</a></li>
<li><a class="dropdown-item" href="?lang=ar">العربية</a></li>
</ul>
</div>
<?php if (count($outlets) > 1): ?>
<div class="dropdown me-1 d-none d-md-block">
<button class="btn btn-outline-secondary btn-sm rounded-pill px-3 border-0 bg-light" type="button" data-bs-toggle="dropdown">
<i class="bi bi-shop me-1"></i> <?= t('switch') ?>
</button>
<ul class="dropdown-menu dropdown-menu-end shadow border-0 mt-2">
<?php foreach ($outlets as $o): ?>
<li><a class="dropdown-item <?= $o['id'] == $outlet_id ? 'active' : '' ?>" href="?outlet_id=<?= $o['id'] ?>&order_type=<?= $order_type ?>"><?= htmlspecialchars(($isRTL && !empty($o['name_ar'])) ? $o['name_ar'] : $o['name']) ?></a></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<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> <?= t('kitchen_view') ?></a>
<a href="admin/orders.php" class="btn btn-outline-secondary btn-sm rounded-pill px-2 px-sm-3 border-0"><i class="bi bi-receipt me-1"></i> <?= t('orders_pos') ?></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> <?= t('recall') ?></button>
<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="pos.php?order_type=dine-in" class="btn btn-outline-info btn-sm rounded-pill px-2 px-sm-3 border-0"><i class="bi bi-person-badge me-1"></i> Waiter</a>
<a href="admin/orders.php" class="btn btn-outline-secondary btn-sm rounded-pill px-2 px-sm-3 border-0"><i class="bi bi-receipt me-1"></i> Orders</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>
<div class="vr mx-1 h-25 d-none d-sm-block"></div>
@ -207,12 +170,12 @@ if (!$loyalty_settings) {
<ul class="dropdown-menu dropdown-menu-end shadow border-0 mt-2">
<li class="px-3 py-2 border-bottom">
<div class="fw-bold small"><?= htmlspecialchars($currentUser['username']) ?></div>
<div class="text-muted" style="font-size: 0.7rem;"><?= t('signed_in_as') ?> <?= htmlspecialchars($currentUser['group_name'] ?? 'User') ?></div>
<div class="text-muted" style="font-size: 0.7rem;">Signed in as <?= htmlspecialchars($currentUser['group_name'] ?? 'User') ?></div>
</li>
<?php if (has_permission('dashboard_view')): ?>
<li><a class="dropdown-item py-2" href="admin/index.php"><i class="bi bi-speedometer2 me-2"></i> <?= t('dashboard') ?></a></li>
<li><a class="dropdown-item py-2" href="admin/index.php"><i class="bi bi-speedometer2 me-2"></i> Dashboard</a></li>
<?php endif; ?>
<li><a class="dropdown-item py-2 text-danger" href="logout.php"><i class="bi bi-box-arrow-right me-2"></i> <?= t('logout') ?></a></li>
<li><a class="dropdown-item py-2 text-danger" href="logout.php"><i class="bi bi-box-arrow-right me-2"></i> Logout</a></li>
</ul>
</div>
</div>
@ -224,7 +187,7 @@ if (!$loyalty_settings) {
<div class="col-md-2 col-auto pos-categories scrollable-y p-2" style="max-width: 170px;">
<button class="category-btn active mb-2" data-category="all">
<i class="bi bi-grid fs-5 text-inherit"></i>
<span style="font-size: 0.85rem; font-weight: 700;"><?= t('all') ?></span>
<span style="font-size: 0.85rem; font-weight: 700;">All</span>
</button>
<?php foreach ($categories as $cat): ?>
<button class="category-btn mb-2" data-category="<?= $cat['id'] ?>">
@ -233,7 +196,7 @@ if (!$loyalty_settings) {
<?php else: ?>
<i class="bi bi-tag fs-5 text-inherit"></i>
<?php endif; ?>
<span class="text-truncate" style="font-size: 0.85rem; font-weight: 700;"><?= htmlspecialchars(($isRTL && !empty($cat['name_ar'])) ? $cat['name_ar'] : $cat['name']) ?></span>
<span class="text-truncate" style="font-size: 0.85rem; font-weight: 700;"><?= htmlspecialchars($cat['name']) ?></span>
</button>
<?php endforeach; ?>
</div>
@ -248,14 +211,14 @@ if (!$loyalty_settings) {
<span class="position-absolute top-50 start-0 translate-middle-y ms-3 text-muted">
<i class="bi bi-search small"></i>
</span>
<input type="text" id="product-search" class="form-control form-control-sm ps-5 border-0 bg-light rounded-3" placeholder="<?= t('search') ?>...">
<input type="text" id="product-search" class="form-control form-control-sm ps-5 border-0 bg-light rounded-3" placeholder="Search...">
</div>
</div>
<?php if (count($outlets) > 1): ?>
<div class="col-auto">
<select class="form-select form-select-sm border-0 bg-light rounded-3 fw-bold text-primary" style="min-width: 120px;" onchange="location.href='?outlet_id=' + this.value + '&order_type=<?= $order_type ?>'">
<?php foreach ($outlets as $o): ?>
<option value="<?= $o['id'] ?>" <?= $o['id'] == $outlet_id ? 'selected' : '' ?>><?= htmlspecialchars(($isRTL && !empty($o['name_ar'])) ? $o['name_ar'] : $o['name']) ?></option>
<option value="<?= $o['id'] ?>" <?= $o['id'] == $outlet_id ? 'selected' : '' ?>><?= htmlspecialchars($o['name']) ?></option>
<?php endforeach; ?>
</select>
</div>
@ -271,7 +234,6 @@ if (!$loyalty_settings) {
<div class="col product-item"
data-category="<?= $product['category_id'] ?>"
data-name="<?= htmlspecialchars(strtolower($product['name'])) ?>"
data-name-ar="<?= htmlspecialchars(strtolower($product['name_ar'] ?? '')) ?>"
data-sku="<?= htmlspecialchars(strtolower($product['sku'] ?? '')) ?>"
onclick="handleProductClick(<?= htmlspecialchars(json_encode($product), ENT_QUOTES) ?>, <?= htmlspecialchars(json_encode($variants_by_product[$product['id']] ?? []), ENT_QUOTES) ?>)">
<div class="card h-100 border-0 shadow-sm product-card rounded-3 overflow-hidden">
@ -291,12 +253,7 @@ if (!$loyalty_settings) {
</div>
<div class="card-body p-1 text-center d-flex flex-column justify-content-between">
<div>
<h6 class="card-title product-title mb-0"><?= htmlspecialchars(($isRTL && !empty($product['name_ar'])) ? $product['name_ar'] : $product['name']) ?></h6>
<?php if ($isRTL && !empty($product['name'])): ?>
<div class="text-muted product-cat-name text-truncate" style="margin-top: -2px;"><?= htmlspecialchars($product['name']) ?></div>
<?php elseif (!$isRTL && !empty($product['name_ar'])): ?>
<div class="text-primary product-cat-name text-truncate" dir="rtl" style="margin-top: -2px;"><?= htmlspecialchars($product['name_ar']) ?></div>
<?php endif; ?>
<h6 class="card-title product-title mb-0"><?= htmlspecialchars($product['name']) ?></h6>
</div>
<div class="product-price-tag mt-1"><?= format_currency((float)$product['price']) ?></div>
</div>
@ -312,19 +269,19 @@ if (!$loyalty_settings) {
<div class="p-2 border-bottom bg-white">
<div class="btn-group w-100 mb-2" role="group">
<input type="radio" class="btn-check" name="order_type" id="ot-takeaway" value="takeaway" <?= $order_type === 'takeaway' ? 'checked' : '' ?>>
<label class="btn btn-outline-primary btn-sm py-1 rounded-start-pill" for="ot-takeaway" style="font-size: 0.75rem; font-weight: 700;"><?= t('takeaway') ?></label>
<label class="btn btn-outline-primary btn-sm py-1 rounded-start-pill" for="ot-takeaway" style="font-size: 0.75rem; font-weight: 700;">Takeaway</label>
<input type="radio" class="btn-check" name="order_type" id="ot-dine-in" value="dine-in" <?= $order_type === 'dine-in' ? 'checked' : '' ?>>
<label class="btn btn-outline-primary btn-sm py-1" for="ot-dine-in" style="font-size: 0.75rem; font-weight: 700;"><?= t('dine_in') ?></label>
<label class="btn btn-outline-primary btn-sm py-1" for="ot-dine-in" style="font-size: 0.75rem; font-weight: 700;">Dine-In</label>
<input type="radio" class="btn-check" name="order_type" id="ot-delivery" value="delivery" <?= $order_type === 'delivery' ? 'checked' : '' ?>>
<label class="btn btn-outline-primary btn-sm py-1 rounded-end-pill" for="ot-delivery" style="font-size: 0.75rem; font-weight: 700;"><?= t('delivery') ?></label>
<label class="btn btn-outline-primary btn-sm py-1 rounded-end-pill" for="ot-delivery" style="font-size: 0.75rem; font-weight: 700;">Delivery</label>
</div>
<div class="position-relative">
<div class="input-group input-group-sm">
<span class="input-group-text bg-light border-0 rounded-<?= $isRTL ? 'end' : 'start' ?>-pill ps-3"><i class="bi bi-person text-muted"></i></span>
<input type="text" class="form-control border-0 bg-light ps-1" id="customer-search" placeholder="<?= t('customer') ?>..." autocomplete="off" style="font-weight: 600;">
<span class="input-group-text bg-light border-0 rounded-start-pill ps-3"><i class="bi bi-person text-muted"></i></span>
<input type="text" class="form-control border-0 bg-light ps-1" id="customer-search" placeholder="Customer..." autocomplete="off" style="font-weight: 600;">
<button class="btn btn-light border-0 d-none" type="button" id="clear-customer"><i class="bi bi-x"></i></button>
<button class="btn btn-light border-0 rounded-<?= $isRTL ? 'start' : 'end' ?>-pill pe-3 text-primary" type="button" data-bs-toggle="modal" data-bs-target="#addCustomerModal"><i class="bi bi-plus-lg"></i></button>
<button class="btn btn-light border-0 rounded-end-pill pe-3 text-primary" type="button" data-bs-toggle="modal" data-bs-target="#addCustomerModal"><i class="bi bi-plus-lg"></i></button>
</div>
<div class="list-group shadow border-0 search-dropdown" id="customer-results" style="border-radius: 12px; margin-top: 5px;"></div>
<input type="hidden" id="selected-customer-id">
@ -334,24 +291,24 @@ if (!$loyalty_settings) {
<div class="flex-grow-1 overflow-auto p-2 bg-white" id="cart-items">
<div class="text-center text-muted mt-5 opacity-50">
<i class="bi bi-basket3 fs-1 d-block mb-2"></i>
<p class="small"><?= t('none') ?></p>
<p class="small">No Items</p>
</div>
</div>
<div class="p-3 border-top bg-light mt-auto rounded-top-4">
<div class="d-flex justify-content-between mb-1">
<span class="text-muted small"><?= t('total') ?></span>
<span class="text-muted small">Subtotal</span>
<span class="fw-bold small" id="cart-subtotal"><?= format_currency(0) ?></span>
</div>
<div class="d-flex justify-content-between mb-3">
<span class="fs-6 fw-bold"><?= t('total') ?></span>
<span class="fs-6 fw-bold">Total</span>
<span class="fs-5 fw-bold text-primary" id="cart-total-price"><?= format_currency(0) ?></span>
</div>
<button class="btn btn-link text-danger w-100 py-0 fw-semibold mb-3 btn-sm text-decoration-none" onclick="clearCart()" style="font-size: 0.75rem;"><?= t('close') ?></button>
<button class="btn btn-link text-danger w-100 py-0 fw-semibold mb-3 btn-sm text-decoration-none" onclick="clearCart()" style="font-size: 0.75rem;">Clear Cart</button>
<div class="d-flex gap-2">
<button class="btn btn-primary w-50 btn-sm shadow-sm fw-bold py-2 rounded-3" id="quick-order-btn" disabled><?= t('save') ?></button>
<button class="btn btn-outline-warning w-50 btn-sm shadow-sm fw-bold py-2 rounded-3" id="place-order-btn" disabled><?= t('save') ?></button>
<button class="btn btn-primary w-50 btn-sm shadow-sm fw-bold py-2 rounded-3" id="quick-order-btn" disabled>QUICK PAY</button>
<button class="btn btn-outline-warning w-50 btn-sm shadow-sm fw-bold py-2 rounded-3" id="place-order-btn" disabled>PLACE ORDER</button>
</div>
</div>
</div>
@ -364,7 +321,7 @@ if (!$loyalty_settings) {
<div class="modal-dialog modal-lg modal-dialog-centered">
<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"><?= t('recall') ?></h6>
<h6 class="modal-title fw-bold">Recall Bill</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body p-3"><div id="recall-orders-list" class="list-group list-group-flush"></div></div>
@ -376,7 +333,7 @@ if (!$loyalty_settings) {
<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" id="variantModalTitle"><?= t('variant') ?></h6>
<h6 class="modal-title fw-bold" id="variantModalTitle">Select Variant</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body p-3"><div id="variant-list" class="list-group list-group-flush"></div></div>
@ -388,19 +345,19 @@ if (!$loyalty_settings) {
<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"><?= t('add') ?> <?= t('customer') ?></h6>
<h6 class="modal-title fw-bold">Add Customer</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body p-3">
<div class="mb-2">
<label class="small text-muted mb-1"><?= t('name') ?></label>
<label class="small text-muted mb-1">Name</label>
<input type="text" class="form-control form-control-sm rounded-3" id="new-customer-name">
</div>
<div class="mb-3">
<label class="small text-muted mb-1"><?= t('phone') ?></label>
<label class="small text-muted mb-1">Phone</label>
<input type="text" class="form-control form-control-sm rounded-3" id="new-customer-phone">
</div>
<button type="button" class="btn btn-primary btn-sm w-100 py-2 rounded-3" id="save-new-customer"><?= t('add') ?></button>
<button type="button" class="btn btn-primary btn-sm w-100 py-2 rounded-3" id="save-new-customer">Add Customer</button>
</div>
</div>
</div>
@ -410,7 +367,7 @@ if (!$loyalty_settings) {
<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"><?= t('payment') ?></h6>
<h6 class="modal-title fw-bold">Payment Method</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body p-3"><div class="row g-2" id="payment-methods-container"></div></div>
@ -428,27 +385,20 @@ if (!$loyalty_settings) {
const CURRENT_OUTLET = { id: <?= $outlet_id ?>, name: '<?= addslashes($current_outlet_name) ?>' };
const CURRENT_USER = { id: <?= $currentUser['id'] ?>, name: '<?= addslashes($currentUser['username']) ?>' };
const LOYALTY_SETTINGS = <?= json_encode($loyalty_settings) ?>;
const LANG = '<?= $currentLang ?>';
const LANG = 'en';
// JS Translations
const translations = {
'en': {
'cart_empty': 'Cart is empty',
'cart_empty': 'No Items in Cart',
'remove': 'Remove',
'order_placed': 'Order Placed',
'order_success': 'Order processed successfully!',
'order_placed': 'Order Placed!',
'order_success': 'Order saved successfully',
'error': 'Error',
'quick_pay': 'QUICK PAY',
'save_bill': 'SAVE BILL'
},
'ar': {
'cart_empty': 'السلة فارغة',
'remove': 'إزالة',
'order_placed': 'تم تقديم الطلب',
'order_success': 'تم معالجة الطلب بنجاح!',
'error': 'خطأ',
'quick_pay': 'دفع سريع',
'save_bill': 'حفظ الفاتورة'
'save_bill': 'PLACE ORDER',
'variant': 'Variant',
'none': 'None'
}
};
const t = (key) => translations[LANG][key] || key;