feat(waiter): English-first texts, part a: shell, sign-in, tables, settings, venues (platform-v2 step 4.5a)

- @xenia/i18n: new `waiter` namespace (en + el); the waiter's Greek texts become keys
  with English written fresh (Greek kept as the translation).
- App gates, side drawer / nav bars / notifications, user menu, login, table list and
  cards, settings, venues + pairing errors, install dialog, lock screen, update banners,
  QR scanner, favourites setup.
- Money and times through useFormat() (venue time, the language's number format):
  table cards, quick table view, user menu, notifications.
- waiter i18n.js: tw() for code outside components (pairing errors).
- The table-list's FavoritesSetupPage `.map(t => …)` renamed so it doesn't shadow t.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 03:50:33 +02:00
co-authored by Claude Opus 5.5
parent 8e0a786bbc
commit 37155c0457
20 changed files with 1229 additions and 375 deletions
+22 -16
View File
@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom'
import { useProductCache } from '../hooks/useProductCache'
import useWaiterFavoritesStore from '../store/waiterFavoritesStore'
import { assetUrl } from '../config/server'
import { useFormat, useTranslation } from '@xenia/i18n'
// ── Heart icon ────────────────────────────────────────────────────────────────
function Heart({ filled, size = 22 }) {
@@ -87,6 +88,7 @@ function AttrSection({ title, items, favIds, onToggle }) {
}
function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
const { t } = useTranslation('waiter')
// Local state: { quick: id[], ingredients: id[], options: id[], prefs: id[] }
// Start from waiter overrides if they exist, otherwise seed from manager's is_favorite flags
function seedFromManager() {
@@ -164,7 +166,7 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
{product.name}
</div>
<div style={{ fontSize: 12, color: 'var(--muted)' }}>
{waiterAttrFavs ? 'Προσωπικές ρυθμίσεις ενεργές' : 'Χρήση ρυθμίσεων διαχειριστή'}
{waiterAttrFavs ? t('favSetup.personalOn') : t('favSetup.managerDefaults')}
</div>
</div>
<button
@@ -179,22 +181,22 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
<div style={{ flex: 1, overflowY: 'auto', padding: '16px 16px 0' }}>
{!hasAnything ? (
<p style={{ color: 'var(--muted)', fontSize: 14, textAlign: 'center', padding: '32px 0' }}>
Αυτό το προϊόν δεν έχει επιλογές, υλικά ή προτιμήσεις.
{t('favSetup.noOptions')}
</p>
) : (
<>
<p style={{ fontSize: 13, color: 'var(--muted)', marginBottom: 16, lineHeight: 1.5 }}>
Επίλεξε ποιες επιλογές θα εμφανίζονται στην καρτέλα <strong style={{ color: '#ef4444' }}>♥ Αγαπημένα</strong> για αυτό το προϊόν. Αν δεν επιλέξεις τίποτα, θα χρησιμοποιηθούν οι ρυθμίσεις του διαχειριστή.
{t('favSetup.pickIntro')} <strong style={{ color: '#ef4444' }}>♥ {t('settings.tabs.favorites')}</strong>. {t('favSetup.pickOutro')}
</p>
<AttrSection
title="Γρήγορες Επιλογές"
title={t('drawer.tabs.quick')}
items={product.quick_options}
favIds={local.quick || []}
onToggle={id => toggle('quick', id)}
/>
<AttrSection
title="Υλικά"
title={t('drawer.tabs.ingredients')}
items={product.ingredients}
favIds={local.ingredients || []}
onToggle={id => toggle('ingredients', id)}
@@ -206,7 +208,7 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
onToggle={id => toggle('options', id)}
/>
<AttrSection
title="Προτιμήσεις"
title={t('drawer.tabs.prefs')}
items={product.preference_sets}
favIds={local.prefs || []}
onToggle={id => toggle('prefs', id)}
@@ -231,7 +233,7 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
fontSize: 13, fontWeight: 600, cursor: 'pointer',
}}
>
Επαναφορά
{t('settings.reset.title')}
</button>
)}
<button
@@ -243,7 +245,7 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
fontSize: 15, fontWeight: 700, cursor: 'pointer',
}}
>
{totalSelected > 0 ? `Αποθήκευση (${totalSelected} επιλογές)` : 'Αποθήκευση'}
{totalSelected > 0 ? t('favSetup.saveCount', { count: totalSelected }) : t('common.save')}
</button>
</div>
</div>
@@ -253,6 +255,8 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
// ── Product row (ALL tab) ─────────────────────────────────────────────────────
function ProductRow({ product, isFav, hasAttrOverride, onToggleFav, onEditAttrs }) {
const { t } = useTranslation('waiter')
const { formatMoney } = useFormat()
const hasAttrs = (
(product.quick_options || []).length > 0 ||
(product.ingredients || []).length > 0 ||
@@ -281,7 +285,7 @@ function ProductRow({ product, isFav, hasAttrOverride, onToggleFav, onEditAttrs
)}
</div>
<div style={{ fontSize: 12, color: hasAttrs ? 'var(--accent)' : 'var(--muted)' }}>
{hasAttrs ? 'Επιλογές αγαπημένων →' : `${Number(product.base_price).toFixed(2)} €`}
{hasAttrs ? `${t('favSetup.options')} →` : formatMoney(Number(product.base_price))}
</div>
</div>
@@ -298,6 +302,7 @@ function ProductRow({ product, isFav, hasAttrOverride, onToggleFav, onEditAttrs
// ── Draggable favorites list (pointer-events — works on touch + mouse) ─────────
function FavoritesList({ items, products, onReorder }) {
const { t } = useTranslation('waiter')
const [dragging, setDragging] = useState(null)
const [dropIndex, setDropIndex] = useState(null)
const containerRef = useRef(null)
@@ -355,7 +360,7 @@ function FavoritesList({ items, products, onReorder }) {
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
</svg>
<p style={{ fontSize: 14, color: 'var(--muted)', textAlign: 'center', lineHeight: 1.6 }}>
Δεν έχεις προσθέσει αγαπημένα ακόμα.<br />Πήγαινε στην καρτέλα ΌΛΑ και πάτα την καρδιά δίπλα στα προϊόντα.
{t('favSetup.none')}<br />{t('favSetup.noneHow')}
</p>
</div>
)
@@ -417,6 +422,7 @@ function FavoritesList({ items, products, onReorder }) {
// ── Main page ─────────────────────────────────────────────────────────────────
export default function FavoritesSetupPage() {
const { t } = useTranslation('waiter')
const navigate = useNavigate()
const { products, categories } = useProductCache()
const { favorites, toggleFavorite, reorderFavorites, itemFavorites, setItemFavorites } = useWaiterFavoritesStore()
@@ -430,19 +436,19 @@ export default function FavoritesSetupPage() {
{/* Header */}
<header className="top-bar">
<button className="icon-btn" onClick={() => navigate(-1)}>←</button>
<span className="top-bar__title">Ρύθμιση Αγαπημένων</span>
<span className="top-bar__title">{t('settings.fav.setup')}</span>
<div style={{ width: 40 }} />
</header>
{/* Tabs */}
<div style={{ display: 'flex', borderBottom: '1px solid var(--border)', flexShrink: 0, background: 'var(--bg)' }}>
{[
{ key: 'all', label: 'ΌΛΑ' },
{ key: 'favorites', label: `ΑΓΑΠΗΜΈΝΑ (${favorites.length})` },
].map(t => (
{ key: 'all', label: t('favSetup.all') },
{ key: 'favorites', label: t('favSetup.favorites', { count: favorites.length }) },
].map(tb => (
<button
key={t.key}
onClick={() => setTab(t.key)}
key={tb.key}
onClick={() => setTab(tb.key)}
style={{
flex: 1, padding: '12px 8px',
background: 'none', border: 'none', cursor: 'pointer',
+18 -18
View File
@@ -1,6 +1,7 @@
import { useCallback, useEffect, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { useAccess } from '@xenia/access'
import { useTranslation } from '@xenia/i18n'
import PinPad from '../components/PinPad'
import useAuthStore from '../store/authStore'
import client from '../api/client'
@@ -20,6 +21,7 @@ function initialsOf(waiter) {
}
function WaiterCard({ waiter, onClick }) {
const { t } = useTranslation('waiter')
return (
<button
onClick={onClick}
@@ -70,7 +72,7 @@ function WaiterCard({ waiter, onClick }) {
background: '#22c55e',
flexShrink: 0,
boxShadow: '0 0 6px #22c55e88',
}} title="Σε βάρδια" />
}} title={t('login.onShift')} />
)}
<span style={{ color: 'var(--muted)', fontSize: 18, flexShrink: 0 }}>›</span>
@@ -89,6 +91,7 @@ function WaiterCard({ waiter, onClick }) {
// are shown in the user's language.
export default function LoginPage() {
const { t } = useTranslation('waiter')
const { login, savedUsername } = useAuthStore()
const { login: modes } = useAccess()
const mode = modes?.waiter_mode || 'pin'
@@ -137,7 +140,7 @@ export default function LoginPage() {
login({ id: data.user.id, username: data.user.username, role: data.user.role }, data.access_token)
navigate('/tables', { replace: true })
} catch (err) {
setError(apiError(err, mode === 'password' ? 'Λανθασμένος κωδικός' : 'Λανθασμένο PIN'))
setError(apiError(err, mode === 'password' ? t('login.wrongPassword') : t('login.wrongPin')))
setPassword('')
setAttempt(a => a + 1)
} finally {
@@ -150,7 +153,7 @@ export default function LoginPage() {
onClick={() => navigate('/venues')}
style={{ marginTop: 10, background: 'none', border: 'none', color: 'var(--muted)', fontSize: 13, cursor: 'pointer' }}
>
🏪 {getActiveVenue()?.name} · <span style={{ color: 'var(--accent)' }}>Αλλαγή</span>
🏪 {getActiveVenue()?.name} · <span style={{ color: 'var(--accent)' }} data-testid="venue-change">{t('common.change')}</span>
</button>
)
@@ -161,9 +164,7 @@ export default function LoginPage() {
<div className="login-box" style={{ textAlign: 'center' }} data-testid="login-tap-only">
<h1 className="app-title">XeniaPOS</h1>
<p style={{ color: 'var(--text)', fontSize: 15, lineHeight: 1.5 }}>
Σε αυτό το κατάστημα οι σερβιτόροι συνδέονται πατώντας το όνομά τους στις συνδεδεμένες οθόνες.
Από κινητό δεν γίνεται σύνδεση με αυτόν τον τρόπο — ζητήστε από τον διαχειριστή να αλλάξει
τον τρόπο σύνδεσης σε PIN ή κωδικό.
{t('login.tapOnly')}
</p>
{venueSwitch}
</div>
@@ -184,7 +185,7 @@ export default function LoginPage() {
{/* Static header — never scrolls */}
<div style={{ flexShrink: 0, padding: '40px 16px 20px', textAlign: 'center' }}>
<h1 className="app-title" style={{ marginBottom: 10 }}>Xenia POS</h1>
<p className="app-subtitle">Ποιος είσαι;</p>
<p className="app-subtitle">{t('login.whoAreYou')}</p>
{venueSwitch}
</div>
@@ -192,21 +193,20 @@ export default function LoginPage() {
<div style={{ flex: 1, overflowY: 'auto', padding: '4px 16px 40px' }}>
<div style={{ maxWidth: 480, margin: '0 auto' }}>
{loadingWaiters ? (
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: 32 }}>Φόρτωση…</p>
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: 32 }}>{t('common.loading')}</p>
) : serverUnreachable ? (
<div style={{ textAlign: 'center', padding: 32 }}>
<div style={{ fontSize: 48, marginBottom: 16 }}>🔌</div>
<p style={{ fontSize: 17, fontWeight: 700, color: '#ef4444', marginBottom: 8 }}>
Δεν βρέθηκε ο Server
{t('login.serverNotFound')}
</p>
<p style={{ fontSize: 14, color: 'var(--muted)', lineHeight: 1.6, marginBottom: 24 }}>
Δεν είναι δυνατή η σύνδεση με τον Manager.<br />
Δεν μπορεί να ξεκινήσει βάρδια χωρίς σύνδεση.
{t('login.serverNotFoundBody')}
</p>
<button className="btn btn--secondary" onClick={loadWaiters}>⟳ Επανάληψη</button>
<button className="btn btn--secondary" onClick={loadWaiters}>⟳ {t('common.retry')}</button>
</div>
) : waiters.length === 0 ? (
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: 32 }}>Δεν βρέθηκαν σερβιτόροι</p>
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: 32 }}>{t('login.noWaiters')}</p>
) : (
<div style={{ display: 'flex', flexDirection: 'column', gap: 10, alignItems: 'stretch' }}>
{sorted.map(w => (
@@ -260,7 +260,7 @@ export default function LoginPage() {
onClick={() => { setSelectedWaiter(null); setError(''); setPassword('') }}
style={{ background: 'none', border: 'none', color: 'var(--muted)', cursor: 'pointer', fontSize: 13, padding: '4px 8px' }}
>
Αλλαγή
{t('common.change')}
</button>
</div>
) : (
@@ -269,7 +269,7 @@ export default function LoginPage() {
<input
value={username}
onChange={e => setUsername(e.target.value)}
placeholder="Όνομα χρήστη"
placeholder={t('login.username')}
autoComplete="username"
autoCapitalize="none"
style={{ ...inputStyle, marginTop: 8 }}
@@ -287,7 +287,7 @@ export default function LoginPage() {
type="password"
value={password}
onChange={e => setPassword(e.target.value)}
placeholder="Κωδικός"
placeholder={t('login.password')}
autoComplete="current-password"
style={inputStyle}
data-testid="login-password"
@@ -298,12 +298,12 @@ export default function LoginPage() {
disabled={loading || !password || (!w && !username.trim())}
data-testid="login-submit"
>
{loading ? '…' : 'Σύνδεση'}
{loading ? '…' : t('login.signIn')}
</button>
</form>
) : (
<>
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '10px 0 12px' }}>Εισάγετε PIN</p>
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '10px 0 12px' }}>{t('login.enterPin')}</p>
<PinPad key={attempt} onSubmit={pin => signIn({ pin })} loading={loading} />
</>
)}
+127 -121
View File
@@ -6,22 +6,23 @@ import useNotificationSettingsStore from '../store/notificationSettingsStore'
import useOrderingSettingsStore from '../store/orderingSettingsStore'
import usePaymentSettingsStore from '../store/paymentSettingsStore'
import useWaiterFavoritesStore from '../store/waiterFavoritesStore'
import { useTranslation } from '@xenia/i18n'
const CHIP_STYLE_OPTIONS = [
{ key: 'full', label: 'Πλήρες κείμενο', example: 'Εκκρεμούν' },
{ key: 'short', label: 'Σύντομο κείμενο', example: 'PND' },
{ key: 'icon_full', label: 'Εικονίδιο + πλήρες', example: '⏳ Εκκρεμούν' },
{ key: 'icon_short', label: 'Εικονίδιο + σύντομο', example: '⏳ PND' },
{ key: 'icon', label: 'Μόνο εικονίδιο', example: '⏳' },
{ key: 'full', label: 'settings.chips.full', example: 'orders.chips.pending' },
{ key: 'short', label: 'settings.chips.short', example: 'orders.chips.pendingShort' },
{ key: 'icon_full', label: 'settings.chips.iconFull', example: 'settings.chips.exIconFull' },
{ key: 'icon_short', label: 'settings.chips.iconShort', example: 'settings.chips.exIconShort' },
{ key: 'icon', label: 'settings.chips.icon', example: '⏳' },
]
// ─── Tab definitions (stub future tabs here) ──────────────────────────────────
const TABS = [
{ key: 'layout', label: 'Εμφάνιση' },
{ key: 'leitourgia', label: 'Λειτουργία' },
{ key: 'ploigisi', label: 'Πλοήγηση' },
{ key: 'personalize', label: 'Αγαπημένα' },
{ key: 'layout', label: 'settings.tabs.layout' },
{ key: 'leitourgia', label: 'settings.tabs.operation' },
{ key: 'ploigisi', label: 'shell.navigation' },
{ key: 'personalize', label: 'settings.tabs.favorites' },
]
// ─── Density option data ──────────────────────────────────────────────────────
@@ -30,37 +31,37 @@ const DENSITY_OPTIONS = [
{
key: '1x1',
label: '1×1',
desc: '4 ανά σειρά — μόνο όνομα',
desc: 'settings.density.d1x1',
preview: <Grid4 />,
},
{
key: '2x1',
label: '2×1',
desc: '2 ανά σειρά — όνομα + κατάσταση',
desc: 'settings.density.d2x1',
preview: <Grid2H />,
},
{
key: '2x2',
label: '2×2',
desc: '2 ανά σειρά — συμπαγής κάρτα',
desc: 'settings.density.d2x2',
preview: <Grid2 />,
},
{
key: '4x1',
label: '4×1',
desc: '1 ανά σειρά — οριζόντια λίστα',
desc: 'settings.density.d4x1',
preview: <Grid1H />,
},
{
key: '4x2',
label: '4×2',
desc: '1 ανά σειρά — πλήρης κάρτα',
desc: 'settings.density.d4x2',
preview: <Grid1 />,
},
{
key: '4x3',
label: '4×3',
desc: '1 ανά σειρά — κάρτα με λίστα παραγγελίας',
desc: 'settings.density.d4x3',
preview: <Grid1Detail />,
},
]
@@ -153,22 +154,23 @@ function Grid1Detail() {
const ORDER_ITEM_LAYOUT_OPTIONS = [
{
key: 'compact',
label: 'Compact',
desc: 'Μία γραμμή — συμπαγής εμφάνιση, λιγότερο ύψος',
label: 'settings.itemLayout.compact',
desc: 'settings.itemLayout.compactDesc',
},
{
key: 'expanded',
label: 'Expanded',
desc: 'Δύο γραμμές — όνομα + KDS πάνω, τιμολόγηση κάτω',
label: 'settings.itemLayout.expanded',
desc: 'settings.itemLayout.expandedDesc',
},
{
key: 'fully_detailed',
label: 'Fully Detailed',
desc: 'Πλήρης ανάλυση — όνομα, τιμές, σερβιτόρος, ώρα, options',
label: 'settings.itemLayout.full',
desc: 'settings.itemLayout.fullDesc',
},
]
function LayoutTab() {
const { t } = useTranslation('waiter')
const { density, setDensity, chipStyle, setChipStyle, kdsDisplayStyle, setKdsDisplayStyle, orderItemLayout, setOrderItemLayout, mergePersist, setMergePersist } = useTableViewStore()
const { dark, toggle } = useThemeStore()
@@ -177,8 +179,8 @@ function LayoutTab() {
{/* Chip style */}
<section>
<h2 style={sectionTitle}>Εμφάνιση chips παραγγελιών</h2>
<p style={sectionSub}>Πώς εμφανίζονται τα φίλτρα στη σελίδα Παραγγελίες.</p>
<h2 style={sectionTitle}>{t('settings.chips.title')}</h2>
<p style={sectionSub}>{t('settings.chips.sub')}</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}>
{CHIP_STYLE_OPTIONS.map(opt => {
const active = (chipStyle || 'icon_short') === opt.key
@@ -197,9 +199,9 @@ function LayoutTab() {
>
<div style={{ flex: 1 }}>
<div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}>
{opt.label}
{t(opt.label)}
</div>
<div style={{ fontSize: 12, color: 'var(--muted)' }}>{opt.example}</div>
<div style={{ fontSize: 12, color: 'var(--muted)' }}>{t(opt.example)}</div>
</div>
{active && (
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" style={{ flexShrink: 0, color: 'var(--accent)' }}>
@@ -215,8 +217,8 @@ function LayoutTab() {
{/* Card density */}
<section>
<h2 style={sectionTitle}>Κάρτες τραπεζιών</h2>
<p style={sectionSub}>Επίλεξε πόσα στοιχεία εμφανίζονται σε κάθε κάρτα.</p>
<h2 style={sectionTitle}>{t('settings.density.title')}</h2>
<p style={sectionSub}>{t('settings.density.sub')}</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: 10, marginTop: 14 }}>
{DENSITY_OPTIONS.map(opt => {
@@ -252,10 +254,10 @@ function LayoutTab() {
color: active ? 'var(--accent)' : 'var(--text)',
marginBottom: 2,
}}>
{opt.label}
{t(opt.label)}
</div>
<div style={{ fontSize: 13, color: 'var(--muted)', lineHeight: 1.4 }}>
{opt.desc}
{t(opt.desc)}
</div>
</div>
@@ -274,12 +276,12 @@ function LayoutTab() {
{/* KDS status display */}
<section>
<h2 style={sectionTitle}>Εμφάνιση Κατάστασης KDS</h2>
<p style={sectionSub}>Πώς εμφανίζεται η κατάσταση KDS σε κάθε αντικείμενο παραγγελίας.</p>
<h2 style={sectionTitle}>{t('settings.kds.title')}</h2>
<p style={sectionSub}>{t('settings.kds.sub')}</p>
<div style={{ display: 'flex', gap: 10, marginTop: 14 }}>
{[
{ key: 'badge', label: 'Badge', desc: 'Κείμενο σε chip (ΕΚΚΡΕΜΕΙ, READY…)' },
{ key: 'icon', label: 'Εικονίδιο', desc: 'Μικρό χρωματιστό εικονίδιο — λιγότερος χώρος' },
{ key: 'badge', label: 'settings.kds.badge', desc: 'settings.kds.badgeDesc' },
{ key: 'icon', label: 'settings.kds.icon', desc: 'settings.kds.iconDesc' },
].map(opt => {
const active = (kdsDisplayStyle || 'badge') === opt.key
return (
@@ -295,8 +297,8 @@ function LayoutTab() {
transition: 'border-color 0.12s, background 0.12s',
}}
>
<span style={{ fontSize: 13, fontWeight: 800, color: active ? 'var(--accent)' : 'var(--text)' }}>{opt.label}</span>
<span style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.4 }}>{opt.desc}</span>
<span style={{ fontSize: 13, fontWeight: 800, color: active ? 'var(--accent)' : 'var(--text)' }}>{t(opt.label)}</span>
<span style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.4 }}>{t(opt.desc)}</span>
</button>
)
})}
@@ -305,8 +307,8 @@ function LayoutTab() {
{/* Order item layout */}
<section>
<h2 style={sectionTitle}>Layout Αντικειμένων Παραγγελίας</h2>
<p style={sectionSub}>Πώς εμφανίζεται κάθε αντικείμενο στη λίστα παραγγελίας ενός τραπεζιού.</p>
<h2 style={sectionTitle}>{t('settings.itemLayout.title')}</h2>
<p style={sectionSub}>{t('settings.itemLayout.sub')}</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}>
{ORDER_ITEM_LAYOUT_OPTIONS.map(opt => {
const active = (orderItemLayout || 'compact') === opt.key
@@ -325,9 +327,9 @@ function LayoutTab() {
>
<div style={{ flex: 1 }}>
<div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}>
{opt.label}
{t(opt.label)}
</div>
<div style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.4 }}>{opt.desc}</div>
<div style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.4 }}>{t(opt.desc)}</div>
</div>
{active && (
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" style={{ flexShrink: 0, color: 'var(--accent)' }}>
@@ -343,13 +345,13 @@ function LayoutTab() {
{/* Merge view persistence */}
<section>
<h2 style={sectionTitle}>Διατήρηση Προβολής Συγχώνευσης</h2>
<p style={sectionSub}>Πόσο διατηρείται η επιλεγμένη προβολή συγχώνευσης αντικειμένων.</p>
<h2 style={sectionTitle}>{t('settings.merge.title')}</h2>
<p style={sectionSub}>{t('settings.merge.sub')}</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}>
{[
{ key: 'off', label: 'OFF', desc: 'Επαναφορά στην αρχική κατά την πλοήγηση' },
{ key: 'per_order', label: 'ΔΙΑΤΗΡΗΣΗ ΑΝΑ ΠΑΡΑΓΓΕΛΙΑ', desc: 'Διατηρείται μέχρι το κλείσιμο της παραγγελίας' },
{ key: 'global', label: 'ΔΙΑΤΗΡΗΣΗ ΠΑΝΤΑ', desc: 'Ίδια ρύθμιση για όλα τα τραπέζια, πάντα' },
{ key: 'off', label: 'settings.merge.off', desc: 'settings.merge.offDesc' },
{ key: 'per_order', label: 'settings.merge.perOrder', desc: 'settings.merge.perOrderDesc' },
{ key: 'global', label: 'settings.merge.global', desc: 'settings.merge.globalDesc' },
].map(opt => {
const active = (mergePersist || 'off') === opt.key
return (
@@ -366,8 +368,8 @@ function LayoutTab() {
}}
>
<div style={{ flex: 1 }}>
<div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}>{opt.label}</div>
<div style={{ fontSize: 12, color: 'var(--muted)' }}>{opt.desc}</div>
<div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}>{t(opt.label)}</div>
<div style={{ fontSize: 12, color: 'var(--muted)' }}>{t(opt.desc)}</div>
</div>
{active && (
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" style={{ flexShrink: 0, color: 'var(--accent)' }}>
@@ -383,12 +385,12 @@ function LayoutTab() {
{/* Theme */}
<section>
<h2 style={sectionTitle}>Θέμα</h2>
<h2 style={sectionTitle}>{t('settings.theme.title')}</h2>
<div style={{ display: 'flex', gap: 10, marginTop: 14 }}>
{[
{ key: false, icon: '☀️', label: 'Φωτεινό' },
{ key: true, icon: '🌙', label: 'Σκοτεινό' },
{ key: false, icon: '☀️', label: 'settings.theme.light' },
{ key: true, icon: '🌙', label: 'settings.theme.dark' },
].map(opt => {
const active = dark === opt.key
return (
@@ -410,7 +412,7 @@ function LayoutTab() {
<span style={{
fontSize: 14, fontWeight: 600,
color: active ? 'var(--accent)' : 'var(--muted)',
}}>{opt.label}</span>
}}>{t(opt.label)}</span>
</button>
)
})}
@@ -428,23 +430,23 @@ const sectionSub = {
fontSize: 14, color: 'var(--muted)', lineHeight: 1.5,
}
// ─── Λειτουργία tab ──────────────────────────────────────────────────────────
// ─── Operation tab ──────────────────────────────────────────────────────────
const POPUP_MODE_OPTIONS = [
{
key: 'all',
label: 'Popup Everything',
desc: 'Εμφανίζεται popup για κάθε ειδοποίηση (KDS, μηνύματα, κλπ.)',
label: 'settings.popup.all',
desc: 'settings.popup.allDesc',
},
{
key: 'manager_only',
label: 'Popup μόνο για μηνύματα διαχειριστή',
desc: 'KDS ειδοποιήσεις αποθηκεύονται στο κουδούνι χωρίς popup.',
label: 'settings.popup.manager',
desc: 'settings.popup.managerDesc',
},
{
key: 'never',
label: 'Never Popup',
desc: 'Καμία αναδυόμενη ειδοποίηση. Ανοίξτε το κουδούνι για να τις δείτε — και θα σβηστούν αυτόματα.',
label: 'settings.popup.never',
desc: 'settings.popup.neverDesc',
},
]
@@ -482,22 +484,23 @@ function ToggleRow({ label, desc, checked, onChange }) {
const PAYMENT_SAFETY_OPTIONS = [
{
key: 'off',
label: 'Απενεργοποιημένο',
desc: 'Η πληρωμή επιβεβαιώνεται με ένα απλό πάτημα.',
label: 'settings.paySafety.off',
desc: 'settings.paySafety.offDesc',
},
{
key: 'second_confirm',
label: 'Δεύτερη Επιβεβαίωση',
desc: 'Μετά την επιβεβαίωση πληρωμής, εμφανίζεται ένα επιπλέον παράθυρο ασφαλείας πριν ολοκληρωθεί η πληρωμή.',
label: 'settings.paySafety.second',
desc: 'settings.paySafety.secondDesc',
},
{
key: 'long_press',
label: 'Παρατεταμένο Πάτημα',
desc: 'Για να επιβεβαιωθεί η πληρωμή, πρέπει να κρατήσετε πατημένο το κουμπί για ~1 δευτερόλεπτο.',
label: 'settings.paySafety.hold',
desc: 'settings.paySafety.holdDesc',
},
]
function LeitourgiaTab() {
const { t } = useTranslation('waiter')
const { popupMode, persistentPopup, setPopupMode, setPersistentPopup } = useNotificationSettingsStore()
const { summaryBeforeSend, setSummaryBeforeSend } = useOrderingSettingsStore()
const { paymentSafety, setPaymentSafety } = usePaymentSettingsStore()
@@ -507,8 +510,8 @@ function LeitourgiaTab() {
{/* Popup mode */}
<section>
<h2 style={sectionTitle}>Στυλ ειδοποιήσεων</h2>
<p style={sectionSub}>Πότε εμφανίζονται αναδυόμενα banners κατά την παραλαβή ειδοποίησης.</p>
<h2 style={sectionTitle}>{t('settings.popup.title')}</h2>
<p style={sectionSub}>{t('settings.popup.sub')}</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}>
{POPUP_MODE_OPTIONS.map(opt => {
const active = popupMode === opt.key
@@ -527,9 +530,9 @@ function LeitourgiaTab() {
>
<div style={{ flex: 1 }}>
<div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}>
{opt.label}
{t(opt.label)}
</div>
<div style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.4 }}>{opt.desc}</div>
<div style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.4 }}>{t(opt.desc)}</div>
</div>
{active && (
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" style={{ flexShrink: 0, color: 'var(--accent)' }}>
@@ -545,16 +548,16 @@ function LeitourgiaTab() {
{/* Persistent popup */}
<section>
<h2 style={sectionTitle}>Επιμονή Popup</h2>
<h2 style={sectionTitle}>{t('settings.persist.title')}</h2>
<p style={sectionSub}>
{persistentPopup
? 'Τα popups παραμένουν μέχρι να πατήσετε OK.'
: 'Τα popups κλείνουν αυτόματα μετά από 3 δευτερόλεπτα και η ειδοποίηση σβήνεται αμέσως κατά την παραλαβή.'}
? t('settings.persist.on')
: t('settings.persist.off')}
</p>
<div style={{ marginTop: 14 }}>
<ToggleRow
label="Persistent Popup"
desc={persistentPopup ? 'Ενεργό — απαιτεί χειροκίνητο κλείσιμο' : 'Ανενεργό — αυτόματο κλείσιμο σε 3 δευτ.'}
label={t('settings.persist.label')}
desc={persistentPopup ? t('settings.persist.onDesc') : t('settings.persist.offDesc')}
checked={persistentPopup}
onChange={() => setPersistentPopup(!persistentPopup)}
/>
@@ -563,14 +566,14 @@ function LeitourgiaTab() {
{/* Summary before send */}
<section>
<h2 style={sectionTitle}>Σύνοψη πριν την Αποστολή</h2>
<h2 style={sectionTitle}>{t('settings.summary.title')}</h2>
<p style={sectionSub}>
Αντί για απευθείας αποστολή, εμφανίζεται πρώτα σελίδα επισκόπησης με όλα τα προϊόντα, τις επιλογές, και τη σημείωση παραγγελίας.
{t('settings.summary.sub')}
</p>
<div style={{ marginTop: 14 }}>
<ToggleRow
label="Σύνοψη + Αποστολή"
desc={summaryBeforeSend ? 'Ενεργό — εμφανίζεται modal επισκόπησης πριν την αποστολή' : 'Ανενεργό — άμεση αποστολή'}
label={t('settings.summary.label')}
desc={summaryBeforeSend ? t('settings.summary.onDesc') : t('settings.summary.offDesc')}
checked={summaryBeforeSend}
onChange={() => setSummaryBeforeSend(!summaryBeforeSend)}
/>
@@ -579,9 +582,9 @@ function LeitourgiaTab() {
{/* Payment safety switch */}
<section>
<h2 style={sectionTitle}>Ασφάλεια Πληρωμών</h2>
<h2 style={sectionTitle}>{t('settings.paySafety.title')}</h2>
<p style={sectionSub}>
Προσθέτει ένα επιπλέον βήμα επιβεβαίωσης για να αποφύγετε τυχαίες πληρωμές. Ακόμα κι αν κάνετε λάθος, ο διαχειριστής μπορεί να ενεργοποιήσει την αναίρεση πληρωμής.
{t('settings.paySafety.sub')}
</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}>
{PAYMENT_SAFETY_OPTIONS.map(opt => {
@@ -601,9 +604,9 @@ function LeitourgiaTab() {
>
<div style={{ flex: 1 }}>
<div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}>
{opt.label}
{t(opt.label)}
</div>
<div style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.4 }}>{opt.desc}</div>
<div style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.4 }}>{t(opt.desc)}</div>
</div>
{active && (
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" style={{ flexShrink: 0, color: 'var(--accent)' }}>
@@ -621,9 +624,10 @@ function LeitourgiaTab() {
)
}
// ─── Προσωπικά tab ────────────────────────────────────────────────────────────
// ─── Personal tab ────────────────────────────────────────────────────────────
function PersonalizeTab() {
const { t } = useTranslation('waiter')
const navigate = useNavigate()
const { favorites, resetAll } = useWaiterFavoritesStore()
const [confirmReset, setConfirmReset] = useState(false)
@@ -639,11 +643,11 @@ function PersonalizeTab() {
{/* Favorites setup */}
<section>
<h2 style={sectionTitle}>Αγαπημένα Προϊόντα</h2>
<h2 style={sectionTitle}>{t('settings.fav.title')}</h2>
<p style={sectionSub}>
{favorites.length > 0
? `${favorites.length} αγαπημένα ενεργά — εμφανίζονται ως πρώτη κατηγορία στο ProductPicker.`
: 'Δεν έχεις ορίσει αγαπημένα ακόμα. Πάτα παρακάτω για να ξεκινήσεις.'}
? t('settings.fav.count', { count: favorites.length })
: t('settings.fav.none')}
</p>
<div style={{ marginTop: 14 }}>
<button
@@ -660,8 +664,8 @@ function PersonalizeTab() {
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
</svg>
<div style={{ flex: 1 }}>
<div style={{ fontSize: 15, fontWeight: 700, color: 'var(--accent)' }}>Ρύθμιση Αγαπημένων</div>
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>Επίλεξε προϊόντα και άλλαξε σειρά εμφάνισης</div>
<div style={{ fontSize: 15, fontWeight: 700, color: 'var(--accent)' }}>{t('settings.fav.setup')}</div>
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>{t('settings.fav.setupSub')}</div>
</div>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" style={{ color: 'var(--accent)', flexShrink: 0 }}>
<path d="M9 18l6-6-6-6" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"/>
@@ -672,11 +676,11 @@ function PersonalizeTab() {
{/* Reset all */}
<section>
<h2 style={sectionTitle}>Επαναφορά</h2>
<h2 style={sectionTitle}>{t('settings.reset.title')}</h2>
<p style={sectionSub}>
{confirmReset
? 'Είσαι σίγουρος; Αυτή η ενέργεια δεν μπορεί να αναιρεθεί.'
: 'Διαγράφει όλα τα αγαπημένα και επαναφέρει τις προτιμήσεις στις εργοστασιακές τιμές.'}
? t('settings.reset.sure')
: t('settings.reset.sub')}
</p>
<div style={{ marginTop: 14 }}>
<button
@@ -696,9 +700,9 @@ function PersonalizeTab() {
</svg>
<div style={{ flex: 1 }}>
<div style={{ fontSize: 15, fontWeight: 700, color: confirmReset ? 'var(--danger)' : 'var(--text)' }}>
{confirmReset ? 'Πάτα ξανά για επιβεβαίωση' : 'Επαναφορά Όλων'}
{confirmReset ? t('settings.reset.again') : t('settings.reset.all')}
</div>
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>Αγαπημένα & ρυθμίσεις</div>
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>{t('settings.reset.allSub')}</div>
</div>
</button>
</div>
@@ -708,12 +712,12 @@ function PersonalizeTab() {
)
}
// ─── Πλοήγηση tab ─────────────────────────────────────────────────────────────
// ─── Navigation tab ─────────────────────────────────────────────────────────────
const ALL_NAV_ITEMS = [
{
key: 'tables',
label: 'Τραπέζια',
label: 'nav.tables',
icon: (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
<rect x="3" y="3" width="7" height="7" rx="1.5" fill="currentColor"/>
@@ -725,7 +729,7 @@ const ALL_NAV_ITEMS = [
},
{
key: 'orders',
label: 'Παραγγελίες',
label: 'nav.orders',
icon: (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
<path d="M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/>
@@ -735,7 +739,7 @@ const ALL_NAV_ITEMS = [
},
{
key: 'messages',
label: 'Chat',
label: 'nav.chat',
icon: (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
@@ -744,7 +748,7 @@ const ALL_NAV_ITEMS = [
},
{
key: 'standalone',
label: 'Takeaway',
label: 'nav.takeaway',
icon: (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
<path d="M5 12H3l9-9 9 9h-2" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
@@ -755,7 +759,7 @@ const ALL_NAV_ITEMS = [
},
{
key: 'shift-overview',
label: 'Βάρδια',
label: 'nav.shift',
icon: (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
<circle cx="12" cy="12" r="9" stroke="currentColor" strokeWidth="2"/>
@@ -765,7 +769,7 @@ const ALL_NAV_ITEMS = [
},
{
key: 'order-log',
label: 'Αρχείο',
label: 'nav.log',
icon: (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
<path d="M6 9V2h12v7" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
@@ -806,6 +810,7 @@ function Checkbox({ checked }) {
}
function PloigisiTab() {
const { t } = useTranslation('waiter')
const { navStyle, setNavStyle, navItems, setNavItems, tripleItems, setTripleItems } = useTableViewStore()
const NAV_MAP = Object.fromEntries(ALL_NAV_ITEMS.map(i => [i.key, i]))
@@ -917,12 +922,12 @@ function PloigisiTab() {
{/* Nav style picker */}
<section>
<h2 style={sectionTitle}>Στυλ γραμμής πλοήγησης</h2>
<p style={sectionSub}>Πώς εμφανίζεται η γραμμή πλοήγησης στο κάτω μέρος της οθόνης.</p>
<h2 style={sectionTitle}>{t('settings.navStyle.title')}</h2>
<p style={sectionSub}>{t('settings.navStyle.sub')}</p>
<div style={{ display: 'flex', gap: 10, marginTop: 14 }}>
{[
{ key: 'triple', label: 'Triple Pill', desc: 'Σταθερά 3 κουμπιά με εικονίδιο + κείμενο σε pill μορφή' },
{ key: 'icon_navbar', label: 'Icon Navbar', desc: 'Android-style με 1–5 εικονίδια που μπορείτε να διαμορφώσετε' },
{ key: 'triple', label: 'settings.navStyle.triple', desc: 'settings.navStyle.tripleDesc' },
{ key: 'icon_navbar', label: 'settings.navStyle.icons', desc: 'settings.navStyle.iconsDesc' },
].map(opt => {
const active = navStyle === opt.key
return (
@@ -939,8 +944,8 @@ function PloigisiTab() {
transition: 'border-color 0.12s, background 0.12s',
}}
>
<span style={{ fontSize: 13, fontWeight: 800, color: active ? 'var(--accent)' : 'var(--text)' }}>{opt.label}</span>
<span style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.4 }}>{opt.desc}</span>
<span style={{ fontSize: 13, fontWeight: 800, color: active ? 'var(--accent)' : 'var(--text)' }}>{t(opt.label)}</span>
<span style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.4 }}>{t(opt.desc)}</span>
</button>
)
})}
@@ -950,8 +955,8 @@ function PloigisiTab() {
{/* Triple Pill item editor */}
{navStyle === 'triple' && (
<section>
<h2 style={sectionTitle}>Στοιχεία Triple Pill</h2>
<p style={sectionSub}>Επίλεξε ακριβώς 3 κουμπιά και σύρε για να αλλάξεις τη σειρά τους.</p>
<h2 style={sectionTitle}>{t('settings.triple.title')}</h2>
<p style={sectionSub}>{t('settings.triple.sub')}</p>
<div
style={{ display: 'flex', flexDirection: 'column', gap: 0, marginTop: 14 }}
@@ -986,7 +991,7 @@ function PloigisiTab() {
>
<DragHandle />
<span style={{ color: 'var(--accent)', flexShrink: 0 }}>{item.icon}</span>
<span style={{ flex: 1, fontSize: 15, fontWeight: 700, color: 'var(--accent)' }}>{item.label}</span>
<span style={{ flex: 1, fontSize: 15, fontWeight: 700, color: 'var(--accent)' }}>{t(item.label)}</span>
<button
onClick={() => toggleTripleItem(item.key)}
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 0 }}
@@ -1010,7 +1015,7 @@ function PloigisiTab() {
<div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '4px 0', margin: '4px 0 8px' }}>
<div style={{ flex: 1, height: 1, background: 'var(--border)' }} />
<span style={{ fontSize: 11, color: 'var(--muted)', fontWeight: 700, textTransform: 'uppercase', letterSpacing: 0.8 }}>
Διαθέσιμα
{t('settings.available')}
</span>
<div style={{ flex: 1, height: 1, background: 'var(--border)' }} />
</div>
@@ -1026,7 +1031,7 @@ function PloigisiTab() {
>
<span style={{ width: 20, flexShrink: 0 }} />
<span style={{ color: 'var(--muted)', flexShrink: 0 }}>{item.icon}</span>
<span style={{ flex: 1, fontSize: 15, fontWeight: 700, color: 'var(--text)' }}>{item.label}</span>
<span style={{ flex: 1, fontSize: 15, fontWeight: 700, color: 'var(--text)' }}>{t(item.label)}</span>
<button
onClick={() => toggleTripleItem(item.key)}
style={{ background: 'none', border: 'none', cursor: tripleItems.length >= 3 ? 'not-allowed' : 'pointer', padding: 0, opacity: tripleItems.length >= 3 ? 0.4 : 1 }}
@@ -1039,8 +1044,8 @@ function PloigisiTab() {
)}
<p style={{ fontSize: 12, color: 'var(--muted)', marginTop: 4, lineHeight: 1.5 }}>
{tripleItems.length}/3 κουμπιά ενεργά
{tripleItems.length >= 3 ? ' — μέγιστο' : ''}
{t('settings.triple.count', { count: tripleItems.length })}
{tripleItems.length >= 3 ? ` — ${t('settings.max')}` : ''}
</p>
</section>
)}
@@ -1048,8 +1053,8 @@ function PloigisiTab() {
{/* Icon navbar item editor */}
{navStyle === 'icon_navbar' && (
<section>
<h2 style={sectionTitle}>Στοιχεία Icon Navbar</h2>
<p style={sectionSub}>Επίλεξε ποια εικονίδια εμφανίζονται (1–5). Σύρε για να αλλάξεις τη σειρά.</p>
<h2 style={sectionTitle}>{t('settings.icons.title')}</h2>
<p style={sectionSub}>{t('settings.icons.sub')}</p>
<div
style={{ display: 'flex', flexDirection: 'column', gap: 0, marginTop: 14 }}
@@ -1088,7 +1093,7 @@ function PloigisiTab() {
>
<DragHandle />
<span style={{ color: 'var(--accent)', flexShrink: 0 }}>{item.icon}</span>
<span style={{ flex: 1, fontSize: 15, fontWeight: 700, color: 'var(--accent)' }}>{item.label}</span>
<span style={{ flex: 1, fontSize: 15, fontWeight: 700, color: 'var(--accent)' }}>{t(item.label)}</span>
<button
onClick={() => toggleItem(item.key)}
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 0 }}
@@ -1112,7 +1117,7 @@ function PloigisiTab() {
<div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '4px 0', marginBottom: 8 }}>
<div style={{ flex: 1, height: 1, background: 'var(--border)' }} />
<span style={{ fontSize: 11, color: 'var(--muted)', fontWeight: 700, textTransform: 'uppercase', letterSpacing: 0.8 }}>
Διαθέσιμα
{t('settings.available')}
</span>
<div style={{ flex: 1, height: 1, background: 'var(--border)' }} />
</div>
@@ -1131,7 +1136,7 @@ function PloigisiTab() {
>
<span style={{ width: 20, flexShrink: 0 }} />
<span style={{ color: 'var(--muted)', flexShrink: 0 }}>{item.icon}</span>
<span style={{ flex: 1, fontSize: 15, fontWeight: 700, color: 'var(--text)' }}>{item.label}</span>
<span style={{ flex: 1, fontSize: 15, fontWeight: 700, color: 'var(--text)' }}>{t(item.label)}</span>
<button
onClick={() => toggleItem(item.key)}
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 0 }}
@@ -1143,8 +1148,8 @@ function PloigisiTab() {
</div>
<p style={{ fontSize: 12, color: 'var(--muted)', marginTop: 4, lineHeight: 1.5 }}>
{navItems.length}/5 εικονίδια ενεργά
{navItems.length >= 5 ? ' — μέγιστο' : ''}
{t('settings.icons.count', { count: navItems.length })}
{navItems.length >= 5 ? ` — ${t('settings.max')}` : ''}
</p>
</section>
)}
@@ -1156,6 +1161,7 @@ function PloigisiTab() {
// ─── Main page ────────────────────────────────────────────────────────────────
export default function SettingsPage() {
const { t } = useTranslation('waiter')
const navigate = useNavigate()
const [activeTab, setActiveTab] = useState('layout')
@@ -1175,9 +1181,9 @@ export default function SettingsPage() {
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
<path d="M12.5 15l-5-5 5-5" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"/>
</svg>
Πίσω
{t('common.back')}
</button>
<span className="top-bar__title" style={{ textAlign: 'center' }}>Ρυθμίσεις</span>
<span className="top-bar__title" style={{ textAlign: 'center' }}>{t('nav.settings')}</span>
{/* spacer to balance the back button */}
<div style={{ width: 72 }} />
</header>
@@ -1208,7 +1214,7 @@ export default function SettingsPage() {
transition: 'color 0.12s',
}}
>
{tab.label}
{t(tab.label)}
</button>
))}
</div>
+80 -71
View File
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState, useCallback } from 'react'
import { useAllowed } from '@xenia/access'
import { useFormat, useTranslation } from '@xenia/i18n'
import { useNavigate, useSearchParams } from 'react-router-dom'
import TableCard from '../components/TableCard'
import useAuthStore from '../store/authStore'
@@ -11,7 +12,6 @@ import { getVenueSettings } from '../api/venueSettings'
import db from '../db/posdb'
import { FlagsIcon, TransferIcon, MergeIcon, PrintIcon, WaiterIcon } from '../components/Icons'
function fmtPrice(v) { return Number(v || 0).toFixed(2) + ' €' }
const _UNIT_LABELS = { kg: 'kg', liter: 'L', gram: 'g', ml: 'mL' }
function fmtItemQty(qty, unitType) {
@@ -44,14 +44,16 @@ function CheckIcon({ width = 18, height = 18 }) {
}
const QUICK_ACTIONS = [
{ Icon: FlagsIcon, label: 'Ενδείξεις Τραπεζιού', key: 'flags', color: '#fac823', iconBg: 'rgba(251,191,36,0.15)' },
{ Icon: TransferIcon, label: 'Μεταφορά', key: 'transfer', color: '#6099db', iconBg: 'rgba(96,165,250,0.15)' },
{ Icon: MergeIcon, label: 'Συγχώνευση', key: 'merge', color: '#6099db', iconBg: 'rgba(96,165,250,0.15)' },
{ Icon: PrintIcon, label: 'Εκτύπωση Σύνοψης', key: 'print_synopsis', color: '#cbd5e1', iconBg: 'rgba(148,163,184,0.15)' },
{ Icon: WaiterIcon, label: 'Ανάθεση Σερβιτόρου', key: 'assign_waiter', color: '#39b861', iconBg: 'rgba(34,197,94,0.15)' },
{ Icon: FlagsIcon, label: 'tables.actions.flags', key: 'flags', color: '#fac823', iconBg: 'rgba(251,191,36,0.15)' },
{ Icon: TransferIcon, label: 'tables.actions.transfer', key: 'transfer', color: '#6099db', iconBg: 'rgba(96,165,250,0.15)' },
{ Icon: MergeIcon, label: 'tables.actions.merge', key: 'merge', color: '#6099db', iconBg: 'rgba(96,165,250,0.15)' },
{ Icon: PrintIcon, label: 'tables.actions.printSynopsis', key: 'print_synopsis', color: '#cbd5e1', iconBg: 'rgba(148,163,184,0.15)' },
{ Icon: WaiterIcon, label: 'tables.actions.assignWaiter', key: 'assign_waiter', color: '#39b861', iconBg: 'rgba(34,197,94,0.15)' },
]
function TableQuickModal({ table, order, flags, onClose, onNavigate, onAction, onCancelOrder, onMarkAllServed, canCancel }) {
const { t } = useTranslation('waiter')
const { formatMoney: fmtPrice } = useFormat()
const tableName = table.label || `T${table.number}`
const activeItems = order?.items?.filter(i => i.status === 'active') || []
const total = activeItems.reduce((s, i) => s + i.unit_price * i.quantity, 0)
@@ -59,8 +61,8 @@ function TableQuickModal({ table, order, flags, onClose, onNavigate, onAction, o
const due = Math.max(0, total - paid)
const statusLabel = {
open: 'Ανοιχτό', partially_paid: 'Μερικώς πληρωμένο', paid: 'Πληρωμένο',
}[order?.status] || 'Ελεύθερο'
open: t('tables.status.open'), partially_paid: t('tables.status.partlyPaid'), paid: t('tables.status.paid'),
}[order?.status] || t('tables.status.free')
return (
<div className="modal-overlay" onClick={onClose}>
@@ -74,22 +76,22 @@ function TableQuickModal({ table, order, flags, onClose, onNavigate, onAction, o
{order ? (
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, marginBottom: 12 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 14 }}>
<span style={{ color: 'var(--muted)' }}>Σύνολο</span>
<span style={{ color: 'var(--muted)' }}>{t('common.total')}</span>
<span style={{ fontWeight: 600, color: 'var(--text)' }}>{fmtPrice(total)}</span>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 14 }}>
<span style={{ color: 'var(--muted)' }}>Πληρωμένο</span>
<span style={{ color: 'var(--muted)' }}>{t('tables.quick.paid')}</span>
<span style={{ fontWeight: 600, color: '#22c55e' }}>{fmtPrice(paid)}</span>
</div>
{due > 0 && (
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 14 }}>
<span style={{ color: 'var(--muted)' }}>Υπόλοιπο</span>
<span style={{ color: 'var(--muted)' }}>{t('tables.quick.due')}</span>
<span style={{ fontWeight: 700, color: '#f59e0b' }}>{fmtPrice(due)}</span>
</div>
)}
</div>
) : (
<p style={{ fontSize: 13, color: 'var(--muted)', marginBottom: 12 }}>Δεν υπάρχει ενεργή παραγγελία</p>
<p style={{ fontSize: 13, color: 'var(--muted)', marginBottom: 12 }}>{t('tables.quick.noOrder')}</p>
)}
{flags.length > 0 && (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
@@ -107,7 +109,7 @@ function TableQuickModal({ table, order, flags, onClose, onNavigate, onAction, o
</div>
)}
<button className="btn btn--primary" style={{ width: '100%', marginTop: 14 }} onClick={() => { onClose(); onNavigate() }}>
Άνοιγμα τραπεζιού
{t('tables.quick.openTable')}
</button>
</div>
<div style={{ background: 'var(--bg2)', borderRadius: '0 0 16px 16px', padding: '8px 20px 24px', borderTop: '2px solid var(--border)' }}>
@@ -126,7 +128,7 @@ function TableQuickModal({ table, order, flags, onClose, onNavigate, onAction, o
<span style={{ width: 36, height: 36, borderRadius: 9, flexShrink: 0, background: a.iconBg, display: 'flex', alignItems: 'center', justifyContent: 'center', color: a.color }}>
<a.Icon width="18" height="18" />
</span>
<span style={{ fontSize: 15, fontWeight: 600, color: a.color }}>{a.label}</span>
<span style={{ fontSize: 15, fontWeight: 600, color: a.color }}>{t(a.label)}</span>
{!disabled && <span style={{ marginLeft: 'auto', color: 'var(--muted)', fontSize: 18 }}>›</span>}
</button>
)
@@ -149,7 +151,7 @@ function TableQuickModal({ table, order, flags, onClose, onNavigate, onAction, o
<span style={{ width: 36, height: 36, borderRadius: 9, flexShrink: 0, background: 'rgba(34,197,94,0.12)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#4ade80' }}>
<CheckIcon width="18" height="18" />
</span>
<span style={{ fontSize: 15, fontWeight: 600, color: '#4ade80' }}>Σήμανση Όλων ως Παραδοθέντα</span>
<span style={{ fontSize: 15, fontWeight: 600, color: '#4ade80' }}>{t('tables.quick.markAllServed')}</span>
</button>
)
})()}
@@ -173,7 +175,7 @@ function TableQuickModal({ table, order, flags, onClose, onNavigate, onAction, o
<circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/>
</svg>
</span>
<span style={{ fontSize: 15, fontWeight: 600, color: colour }}>Ακύρωση Παραγγελίας</span>
<span style={{ fontSize: 15, fontWeight: 600, color: colour }}>{t('tables.quick.cancelOrder')}</span>
</button>
)
})()}
@@ -187,6 +189,7 @@ function TableQuickModal({ table, order, flags, onClose, onNavigate, onAction, o
// ─── Filters modal ────────────────────────────────────────────────────────────
function FiltersModal({ groups, onClose }) {
const { t } = useTranslation('waiter')
const {
ownerFilter, statusFilter, zoneFilter,
setOwnerFilter, setStatusFilter, setZoneFilter,
@@ -214,22 +217,22 @@ function FiltersModal({ groups, onClose }) {
<div className="modal-handle" />
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<span style={{ fontSize: 17, fontWeight: 700, color: 'var(--text)' }}>Φίλτρα</span>
<span style={{ fontSize: 17, fontWeight: 700, color: 'var(--text)' }}>{t('tables.filter.title')}</span>
{hasActiveFilters && (
<button
onClick={() => { clearFilters(); onClose() }}
style={{ fontSize: 13, fontWeight: 600, color: 'var(--danger)', background: 'none', border: 'none', cursor: 'pointer', padding: '4px 8px' }}
>
Καθαρισμός
{t('common.clear')}
</button>
)}
</div>
{/* Owner: ALL | MINE */}
<div>
<p style={sectionLabel}>Ανάθεση</p>
<p style={sectionLabel}>{t('tables.filter.owner')}</p>
<div style={segmentedWrap}>
{[['all', 'Όλα'], ['mine', 'Δικά μου']].map(([key, lbl]) => (
{[['all', t('tables.filter.all')], ['mine', t('tables.filter.mine')]].map(([key, lbl]) => (
<button key={key} onClick={() => setOwnerFilter(key)} style={segBtn(ownerFilter === key)}>{lbl}</button>
))}
</div>
@@ -237,9 +240,9 @@ function FiltersModal({ groups, onClose }) {
{/* Status: ALL | FREE | OPEN | PAID */}
<div>
<p style={sectionLabel}>Κατάσταση</p>
<p style={sectionLabel}>{t('tables.filter.status')}</p>
<div style={{ ...segmentedWrap, display: 'grid', gridTemplateColumns: '1fr 1fr' }}>
{[['all', 'Όλα'], ['free', 'Ελεύθερα'], ['open', 'Ανοιχτά'], ['paid', 'Πληρωμένα']].map(([key, lbl]) => (
{[['all', t('tables.filter.all')], ['free', t('tables.filter.free')], ['open', t('tables.filter.open')], ['paid', t('tables.filter.paid')]].map(([key, lbl]) => (
<button key={key} onClick={() => setStatusFilter(key)} style={{ ...segBtn(statusFilter === key), borderRadius: 10 }}>{lbl}</button>
))}
</div>
@@ -248,7 +251,7 @@ function FiltersModal({ groups, onClose }) {
{/* Zones: multi-select, one segmented container per zone */}
{groups.length > 0 && (
<div>
<p style={sectionLabel}>Ζώνες {zoneFilter.length > 0 ? `(${zoneFilter.length} επιλεγμένες)` : ''}</p>
<p style={sectionLabel}>{zoneFilter.length > 0 ? t('tables.filter.zonesSelected', { count: zoneFilter.length }) : t('tables.filter.zones')}</p>
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 6 }}>
{groups.map(g => {
const active = zoneFilter.includes(g.id)
@@ -277,7 +280,7 @@ function FiltersModal({ groups, onClose }) {
</div>
)}
<button className="btn btn--secondary" style={{ width: '100%' }} onClick={onClose}>Εντάξει</button>
<button className="btn btn--secondary" style={{ width: '100%' }} onClick={onClose}>{t('common.ok')}</button>
</div>
</div>
)
@@ -298,6 +301,7 @@ function segBtn(active) {
// ─── Main page ────────────────────────────────────────────────────────────────
export default function TableListPage() {
const { t } = useTranslation('waiter')
const { user } = useAuthStore()
const { status: connStatus } = useConnectionStore()
const isOffline = connStatus !== 'online'
@@ -663,7 +667,7 @@ export default function TableListPage() {
borderBottom: '1px solid var(--border)',
overflowX: 'auto', scrollbarWidth: 'none',
}}>
<ZoneTab label="Όλα" active={effectiveZoneTab === 'all'} onClick={() => setActiveZoneTab('all')} />
<ZoneTab label={t('tables.filter.all')} active={effectiveZoneTab === 'all'} onClick={() => setActiveZoneTab('all')} />
{visibleGroups.map(g => (
<ZoneTab key={g.id} label={g.name} color={g.color}
active={effectiveZoneTab === g.id}
@@ -690,14 +694,14 @@ export default function TableListPage() {
color: 'var(--muted)', fontSize: 13, fontWeight: 600,
overflow: 'hidden', transition: pulling ? 'none' : 'height 0.2s',
}}>
{refreshing ? '⟳ Ανανέωση…' : pullY >= PULL_THRESHOLD ? '↑ Αφήστε για ανανέωση' : '↓ Τραβήξτε για ανανέωση'}
{refreshing ? `⟳ ${t('tables.pull.refreshing')}` : pullY >= PULL_THRESHOLD ? `↑ ${t('tables.pull.release')}` : `↓ ${t('tables.pull.pull')}`}
</div>
)}
{isOffline && tables.length === 0 && (
<div style={{ textAlign: 'center', padding: '48px 24px', color: 'var(--muted)' }}>
<div style={{ fontSize: 36, marginBottom: 12 }}>📡</div>
<p style={{ fontWeight: 700, fontSize: 16, color: 'var(--text)', marginBottom: 6 }}>Offline — δεν υπάρχουν αποθηκευμένα δεδομένα</p>
<p style={{ fontSize: 13, lineHeight: 1.5 }}>Συνδέσου στο δίκτυο μια φορά για να αποθηκευτούν τα δεδομένα τοπικά.</p>
<p style={{ fontWeight: 700, fontSize: 16, color: 'var(--text)', marginBottom: 6 }}>{t('tables.offlineNoData')}</p>
<p style={{ fontSize: 13, lineHeight: 1.5 }}>{t('tables.offlineNoDataBody')}</p>
</div>
)}
<div style={{
@@ -810,11 +814,11 @@ export default function TableListPage() {
<div className="modal-overlay" onClick={() => setCancelConfirm(null)}>
<div style={{ width: '100%', maxWidth: 400, margin: '0 auto', background: 'var(--bg2)', borderRadius: '16px 16px 0 0', padding: '24px 20px 32px' }} onClick={e => e.stopPropagation()}>
<div className="modal-handle" style={{ marginBottom: 16 }} />
<p style={{ fontSize: 18, fontWeight: 700, color: 'var(--text)', marginBottom: 8 }}>Ακύρωση Παραγγελίας;</p>
<p style={{ fontSize: 14, color: 'var(--muted)', marginBottom: 20 }}>Όλα τα ενεργά αντικείμενα θα ακυρωθούν και θα εκτυπωθεί απόδειξη ακύρωσης.</p>
<p style={{ fontSize: 18, fontWeight: 700, color: 'var(--text)', marginBottom: 8 }}>{t('tables.cancelConfirmTitle')}</p>
<p style={{ fontSize: 14, color: 'var(--muted)', marginBottom: 20 }}>{t('tables.cancelConfirmBody')}</p>
<div style={{ display: 'flex', gap: 10 }}>
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setCancelConfirm(null)}>Ακύρωση</button>
<button className="btn" style={{ flex: 1, background: '#ef4444', color: '#fff' }} onClick={() => executeCancelOrder(cancelConfirm.orderId)}>Επιβεβαίωση</button>
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setCancelConfirm(null)}>{t('common.cancel')}</button>
<button className="btn" style={{ flex: 1, background: '#ef4444', color: '#fff' }} onClick={() => executeCancelOrder(cancelConfirm.orderId)}>{t('common.confirm')}</button>
</div>
</div>
</div>
@@ -829,7 +833,7 @@ export default function TableListPage() {
const KDS_FILTER_CHIPS = [
{
key: 'all',
full: 'Όλες', short: 'All',
full: 'orders.chips.all', short: 'orders.chips.allShort',
icon: (
<svg width="14" height="14" viewBox="0 0 24 24" fill="none">
<rect x="3" y="3" width="7" height="7" rx="1.5" fill="currentColor"/>
@@ -842,7 +846,7 @@ const KDS_FILTER_CHIPS = [
},
{
key: 'pending',
full: 'Εκκρεμούν', short: 'PND',
full: 'orders.chips.pending', short: 'orders.chips.pendingShort',
icon: (
<svg width="14" height="14" viewBox="0 0 24 24" fill="none">
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67V7z" fill="currentColor"/>
@@ -852,7 +856,7 @@ const KDS_FILTER_CHIPS = [
},
{
key: 'preparing',
full: 'Σε Προετοιμασία', short: 'PRP',
full: 'orders.chips.preparing', short: 'orders.chips.preparingShort',
icon: (
<svg width="14" height="14" viewBox="0 0 24 24" fill="none">
<path d="M13.5 0.67s.74 2.65.74 4.8c0 2.06-1.35 3.73-3.41 3.73-2.07 0-3.63-1.67-3.63-3.73l.03-.36C5.21 7.51 4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 17.41 3.8 13.5.67zM11.71 19c-1.78 0-3.22-1.4-3.22-3.14 0-1.62 1.05-2.76 2.81-3.12 1.77-.36 3.6-1.21 4.62-2.58.39 1.29.59 2.65.59 4.04 0 2.65-2.15 4.8-4.8 4.8z" fill="currentColor"/>
@@ -862,7 +866,7 @@ const KDS_FILTER_CHIPS = [
},
{
key: 'ready',
full: 'Έτοιμες', short: 'RDY',
full: 'orders.chips.ready', short: 'orders.chips.readyShort',
icon: (
<svg width="14" height="14" viewBox="0 0 24 24" fill="none">
<circle cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="2"/>
@@ -873,7 +877,7 @@ const KDS_FILTER_CHIPS = [
},
{
key: 'ready_items',
full: 'Μερικώς Έτοιμες', short: 'PRT',
full: 'orders.chips.partly', short: 'orders.chips.partlyShort',
icon: (
<svg width="14" height="14" viewBox="0 0 24 24" fill="none">
<path d="M12 2a10 10 0 0 1 0 20V2z" fill="currentColor" opacity="0.5"/>
@@ -885,9 +889,9 @@ const KDS_FILTER_CHIPS = [
]
const KDS_ITEM_COLORS = {
pending: { textColor: '#f59e0b', label: 'ΕΚΚΡΕΜΕΙ' },
preparing: { textColor: '#60a5fa', label: 'ΕΤΟΙΜΑΖΕΤΑΙ' },
done: { textColor: '#4ade80', label: 'READY' },
pending: { textColor: '#f59e0b', label: 'kds.pending' },
preparing: { textColor: '#60a5fa', label: 'kds.preparing' },
done: { textColor: '#4ade80', label: 'kds.ready' },
served: { textColor: null, label: null },
}
@@ -896,13 +900,14 @@ const KDS_ITEM_COLORS = {
// ─── Orders filter drawer ─────────────────────────────────────────────────────
function OrdersFilterDrawer({ myOnly, setMyOnly, sortBy, setSortBy, filter, setFilter, onClose }) {
const { t } = useTranslation('waiter')
const hasActive = myOnly || sortBy !== 'time' || filter !== 'all'
const STATUS_OPTIONS = [
{ key: 'all', label: 'Όλες' },
{ key: 'pending', label: 'PEND' },
{ key: 'preparing', label: 'PREP' },
{ key: 'ready', label: 'READY' },
{ key: 'all', label: t('orders.chips.all') },
{ key: 'pending', label: t('orders.chips.pendingShort') },
{ key: 'preparing', label: t('orders.chips.preparingShort') },
{ key: 'ready', label: t('orders.chips.readyShort') },
]
function toggleStatus(key) {
@@ -920,22 +925,22 @@ function OrdersFilterDrawer({ myOnly, setMyOnly, sortBy, setSortBy, filter, setF
<div className="modal-handle" />
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<span style={{ fontSize: 17, fontWeight: 700, color: 'var(--text)' }}>Φίλτρα Παραγγελιών</span>
<span style={{ fontSize: 17, fontWeight: 700, color: 'var(--text)' }}>{t('orders.filter.title')}</span>
{hasActive && (
<button
onClick={() => { setMyOnly(false); setSortBy('time'); setFilter('all'); onClose() }}
style={{ fontSize: 13, fontWeight: 600, color: 'var(--danger)', background: 'none', border: 'none', cursor: 'pointer', padding: '4px 8px' }}
>
Καθαρισμός
{t('common.clear')}
</button>
)}
</div>
{/* View filter */}
<div>
<p style={sectionLabel}>Προβολή</p>
<p style={sectionLabel}>{t('orders.filter.view')}</p>
<div style={segmentedWrap}>
{[['false', 'Όλες'], ['true', 'Δικές μου']].map(([val, lbl]) => (
{[['false', t('orders.chips.all')], ['true', t('orders.filter.mine')]].map(([val, lbl]) => (
<button key={val} onClick={() => setMyOnly(val === 'true')} style={segBtn(String(myOnly) === val)}>{lbl}</button>
))}
</div>
@@ -943,12 +948,12 @@ function OrdersFilterDrawer({ myOnly, setMyOnly, sortBy, setSortBy, filter, setF
{/* Sort method */}
<div>
<p style={sectionLabel}>Ταξινόμηση</p>
<p style={sectionLabel}>{t('orders.filter.sort')}</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
{[
['time', 'Κατά ώρα παραγγελίας'],
['latest_change', 'Κατά τελευταία αλλαγή'],
['kds_priority', 'Ready → Prep → Pend'],
['time', t('orders.sort.time')],
['latest_change', t('orders.sort.latest')],
['kds_priority', t('orders.sort.kds')],
].map(([key, lbl]) => (
<div key={key} style={segmentedWrap}>
<button onClick={() => setSortBy(key)} style={segBtn(sortBy === key)}>{lbl}</button>
@@ -959,7 +964,7 @@ function OrdersFilterDrawer({ myOnly, setMyOnly, sortBy, setSortBy, filter, setF
{/* Status filter (multi-select: ALL selects all 3) */}
<div>
<p style={sectionLabel}>Κατάσταση</p>
<p style={sectionLabel}>{t('tables.filter.status')}</p>
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 6 }}>
{STATUS_OPTIONS.map(({ key, label }) => (
<div key={key} style={segmentedWrap}>
@@ -974,13 +979,14 @@ function OrdersFilterDrawer({ myOnly, setMyOnly, sortBy, setSortBy, filter, setF
</div>
</div>
<button className="btn btn--secondary" style={{ width: '100%' }} onClick={onClose}>Εντάξει</button>
<button className="btn btn--secondary" style={{ width: '100%' }} onClick={onClose}>{t('common.ok')}</button>
</div>
</div>
)
}
function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setMyOnly, sortBy, setSortBy, showFilters, setShowFilters, onNavigate, onMarkAllServed, onRefresh }) {
const { t } = useTranslation('waiter')
const { chipStyle } = useTableViewStore()
const [expandedOrders, setExpandedOrders] = useState({})
const [refreshing, setRefreshing] = useState(false)
@@ -1032,10 +1038,10 @@ function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setM
const preparing = items.filter(i => kds(i.kds_status) === 'preparing').length
const done = items.filter(i => kds(i.kds_status) === 'done').length
const total = items.length
if (done === total) return { label: 'READY', color: '#4ade80', bg: 'rgba(34,197,94,0.15)' }
if (preparing > 0) return { label: 'ΕΤΟΙΜΑΖΕΤΑΙ', color: '#60a5fa', bg: 'rgba(96,165,250,0.15)' }
if (pending === total) return { label: 'ΕΚΚΡΕΜΕΙ', color: '#f59e0b', bg: 'rgba(245,158,11,0.15)' }
return { label: `${done}/${total} READY`, color: '#4ade80', bg: 'rgba(34,197,94,0.12)' }
if (done === total) return { label: t('kds.ready'), color: '#4ade80', bg: 'rgba(34,197,94,0.15)' }
if (preparing > 0) return { label: t('kds.preparing'), color: '#60a5fa', bg: 'rgba(96,165,250,0.15)' }
if (pending === total) return { label: t('kds.pending'), color: '#f59e0b', bg: 'rgba(245,158,11,0.15)' }
return { label: t('kds.someReady', { done, total }), color: '#4ade80', bg: 'rgba(34,197,94,0.12)' }
}
// Count per filter for badge
@@ -1071,7 +1077,7 @@ function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setM
const cs = chipStyle || 'icon_short'
const showIcon = cs === 'icon' || cs === 'icon_short' || cs === 'icon_full'
const showText = cs !== 'icon'
const textLabel = (cs === 'full' || cs === 'icon_full') ? chip.full : chip.short
const textLabel = t((cs === 'full' || cs === 'icon_full') ? chip.full : chip.short)
return (
<button
key={chip.key}
@@ -1116,12 +1122,12 @@ function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setM
color: 'var(--muted)', fontSize: 13, fontWeight: 600,
overflow: 'hidden', transition: pulling ? 'none' : 'height 0.2s',
}}>
{refreshing ? '⟳ Ανανέωση…' : pullY >= PULL_THRESHOLD ? '↑ Αφήστε για ανανέωση' : '↓ Τραβήξτε για ανανέωση'}
{refreshing ? `⟳ ${t('tables.pull.refreshing')}` : pullY >= PULL_THRESHOLD ? `↑ ${t('tables.pull.release')}` : `↓ ${t('tables.pull.pull')}`}
</div>
)}
{orders.length === 0 && (
<div style={{ textAlign: 'center', padding: '40px 0', color: 'var(--muted)', fontSize: 14 }}>
Δεν υπάρχουν παραγγελίες
{t('orders.none')}
</div>
)}
{orders.map(o => {
@@ -1168,7 +1174,7 @@ function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setM
{/* Item count */}
<span style={{ fontSize: 12, color: 'var(--muted)', marginLeft: 2 }}>
{visibleItems.length} είδη
{t('orders.items', { count: visibleItems.length })}
</span>
<span style={{ marginLeft: 'auto', color: 'var(--muted)', fontSize: 16, transition: 'transform 0.2s', display: 'inline-block', transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)' }}>▾</span>
@@ -1199,7 +1205,7 @@ function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setM
fontSize: 9, fontWeight: 800, color: kdsC.textColor,
borderRadius: 3, padding: '1px 5px',
border: `1px solid ${kdsC.textColor}60`,
}}>{kdsC.label}</span>
}}>{t(kdsC.label)}</span>
)}
</div>
)
@@ -1213,7 +1219,7 @@ function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setM
background: 'var(--bg3)', color: 'var(--text)',
fontSize: 13, fontWeight: 600, cursor: 'pointer',
}}
>Άνοιγμα</button>
>{t('orders.open')}</button>
{o.items?.some(i => kds(i.kds_status) === 'done') && (
<button
onClick={() => onMarkAllServed(o.id)}
@@ -1222,7 +1228,7 @@ function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setM
background: 'rgba(34,197,94,0.15)', color: '#4ade80',
fontSize: 13, fontWeight: 700, cursor: 'pointer',
}}
>Σήμανση Παραδοθέντων</button>
>{t('orders.markServed')}</button>
)}
</div>
</div>
@@ -1278,6 +1284,8 @@ function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setM
// ─── Standalone order card (takeaway / delivery) ──────────────────────────────
function StandaloneOrderCard({ order, onClick }) {
const { t } = useTranslation('waiter')
const { formatMoney } = useFormat()
const isDelivery = order.order_type === 'delivery'
const activeItems = (order.items || []).filter(i => i.status === 'active')
const paidItems = (order.items || []).filter(i => i.status === 'paid')
@@ -1334,7 +1342,7 @@ function StandaloneOrderCard({ order, onClick }) {
background: `${statusColor}22`, color: statusColor,
border: `1px solid ${statusColor}44`,
}}>
{{ open: 'ΑΝΟΙΧΤΟ', partially_paid: 'ΜΕΡ. ΠΛΗΡΩΜ.', paid: 'ΠΛΗΡΩΜΕΝΟ' }[order.status] || order.status.toUpperCase()}
{{ open: t('card.open'), partially_paid: t('card.partlyPaid'), paid: t('card.paid') }[order.status] || order.status.toUpperCase()}
</span>
{kds !== 'served' && (
<span style={{
@@ -1343,15 +1351,15 @@ function StandaloneOrderCard({ order, onClick }) {
background: `${kdsColor}22`, color: kdsColor,
border: `1px solid ${kdsColor}44`,
}}>
{{ pending: 'ΕΚΚΡΕΜΕΙ', preparing: 'ΕΤΟΙΜΑΖΕΤΑΙ', done: 'READY' }[kds] || kds.toUpperCase()}
{{ pending: t('kds.pending'), preparing: t('kds.preparing'), done: t('kds.ready') }[kds] || kds.toUpperCase()}
</span>
)}
</div>
{/* Total + item count */}
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', marginTop: 'auto' }}>
<span style={{ fontSize: 11, color: 'var(--muted)' }}>{activeItems.length + paidItems.length} είδη</span>
<span style={{ fontSize: 14, fontWeight: 700, color: 'var(--text)' }}>{total.toFixed(2)} €</span>
<span style={{ fontSize: 11, color: 'var(--muted)' }}>{t('orders.items', { count: activeItems.length + paidItems.length })}</span>
<span style={{ fontSize: 14, fontWeight: 700, color: 'var(--text)' }}>{formatMoney(total)}</span>
</div>
</div>
)
@@ -1386,6 +1394,7 @@ function NewStandaloneCard({ label, color, icon, onClick }) {
// ─── Standalone page view ─────────────────────────────────────────────────────
function StandaloneView({ orders, gridCols, navigate }) {
const { t } = useTranslation('waiter')
const standaloneOrders = orders
.filter(o => o.order_type === 'takeaway' || o.order_type === 'delivery')
.sort((a, b) => new Date(a.opened_at || 0) - new Date(b.opened_at || 0))
@@ -1401,13 +1410,13 @@ function StandaloneView({ orders, gridCols, navigate }) {
}}>
{/* Fixed action cards always at top */}
<NewStandaloneCard
label="+ Νέο Takeaway"
label={t('orders.newTakeaway')}
color="#f59e0b"
icon="🥡"
onClick={() => navigate('/standalone/takeaway/add?new=1')}
/>
<NewStandaloneCard
label="+ Νέα Delivery"
label={t('orders.newDelivery')}
color="#60a5fa"
icon="🛵"
onClick={() => navigate('/standalone/delivery/add?new=1')}
+13 -12
View File
@@ -3,6 +3,7 @@ import useThemeStore from '../store/themeStore'
import QrScannerModal from '../components/QrScannerModal'
import { pairWith } from '../native/pairing'
import { getActiveVenue, listVenues, removeVenue, switchVenue } from '../config/server'
import { useTranslation } from '@xenia/i18n'
/**
* Native app: pair with a venue server and switch between paired venues.
@@ -12,6 +13,7 @@ import { getActiveVenue, listVenues, removeVenue, switchVenue } from '../config/
* screen, the user menu and the offline screen.
*/
export default function VenuesPage({ firstRun = false }) {
const { t } = useTranslation('waiter')
const dark = useThemeStore(s => s.dark)
const [venues, setVenues] = useState(listVenues)
const [address, setAddress] = useState('')
@@ -33,15 +35,15 @@ export default function VenuesPage({ firstRun = false }) {
const venue = await pairWith(raw)
switchVenue(venue.siteId) // reloads the app into the venue
} catch (e) {
setError(e.message || 'Αποτυχία σύνδεσης.')
setError(e.message || t('venues.failed'))
setBusy(false)
}
}, [])
function handleRemove(venue) {
const msg = venue.siteId === active?.siteId
? `Αφαίρεση του ενεργού καταστήματος «${venue.name}»; Θα χρειαστεί νέα σύνδεση.`
: `Αφαίρεση του καταστήματος «${venue.name}» από αυτό το κινητό;`
? t('venues.removeActive', { name: venue.name })
: t('venues.remove', { name: venue.name })
if (!window.confirm(msg)) return
removeVenue(venue.siteId)
if (venue.siteId === active?.siteId) {
@@ -58,18 +60,17 @@ export default function VenuesPage({ firstRun = false }) {
onClick={() => window.history.length > 1 ? window.history.back() : window.location.replace('/')}
style={{ alignSelf: 'flex-start', background: 'none', border: 'none', color: 'var(--muted)', fontSize: 15, cursor: 'pointer', padding: 0 }}
>
← Πίσω
← {t('common.back')}
</button>
)}
<div style={{ textAlign: 'center' }}>
<div style={{ fontSize: 44, marginBottom: 8 }}>🏪</div>
<h1 style={{ fontSize: 22, fontWeight: 700, color: 'var(--text)', marginBottom: 6 }}>
{firstRun ? 'Σύνδεση με κατάστημα' : 'Καταστήματα'}
{firstRun ? t('venues.connectTitle') : t('venues.title')}
</h1>
<p style={{ fontSize: 14, color: 'var(--muted)', lineHeight: 1.5 }}>
Σαρώστε το QR από τον διαχειριστή ή πληκτρολογήστε τη διεύθυνση του server.
Το κινητό πρέπει να είναι στο WiFi του καταστήματος.
{t('venues.intro')}
</p>
</div>
@@ -91,14 +92,14 @@ export default function VenuesPage({ firstRun = false }) {
<div style={{ fontSize: 16, fontWeight: 600, color: 'var(--text)' }}>
{v.name}
{isActive && (
<span style={{ marginLeft: 8, fontSize: 11, fontWeight: 700, color: 'var(--accent)' }}>ΕΝΕΡΓΟ</span>
<span style={{ marginLeft: 8, fontSize: 11, fontWeight: 700, color: 'var(--accent)' }}>{t('venues.active')}</span>
)}
</div>
<div style={{ fontSize: 12, color: 'var(--muted)', fontFamily: 'monospace' }}>{v.baseUrl}</div>
</button>
<button
onClick={() => handleRemove(v)}
aria-label="Αφαίρεση"
aria-label={t('venues.removeLabel')}
style={{ background: 'none', border: 'none', color: 'var(--muted)', fontSize: 22, cursor: 'pointer', padding: 4 }}
>
×
@@ -111,7 +112,7 @@ export default function VenuesPage({ firstRun = false }) {
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
<button className="btn btn--accent btn--lg" onClick={() => { setError(null); setScanning(true) }} disabled={busy}>
📷 Σάρωση QR
📷 {t('venues.scan')}
</button>
<div style={{ display: 'flex', gap: 8 }}>
@@ -119,7 +120,7 @@ export default function VenuesPage({ firstRun = false }) {
value={address}
onChange={e => setAddress(e.target.value)}
onKeyDown={e => e.key === 'Enter' && address && connect(address)}
placeholder="π.χ. 192.168.1.50"
placeholder={t('venues.placeholder')}
inputMode="url"
autoCapitalize="off"
autoCorrect="off"
@@ -131,7 +132,7 @@ export default function VenuesPage({ firstRun = false }) {
/>
<button className="btn btn--secondary" onClick={() => connect(address)} disabled={busy || !address}
style={{ height: 52, padding: '0 18px' }}>
{busy ? 'Έλεγχος…' : 'Σύνδεση'}
{busy ? t('venues.checking') : t('venues.connect')}
</button>
</div>