Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8d91e7fae | ||
|
|
2c4f78af47 | ||
|
|
37155c0457 |
@@ -178,6 +178,8 @@ Routers are mounted from the module manifests (`local_backend/modules/<key>/mani
|
||||
Use `core.access.deps.require("<module>.<area>.<action>")` (or `require_any`, `public()`, `require_device(app)`), or `Depends(get_current_user)` for "any signed-in user". The guard `tests/guards/test_route_access.py` fails a route with no marker or with an unknown key. New keys are declared as `Perm(...)` in the owning manifest, with their default roles. A role's defaults are the manifests' plus the venue's changes (`role_permissions`, Settings → Operation → "What each role may do"): create users with `apply_role_template(user, db)`, and a **new key added to a role later must be granted to existing users of that role in its Alembic revision** (keys are copied at creation; see 0024). In endpoints a waiter can reach, check keys with `authorize(request, db, user, key)` (module, device scope, key, manager approval → `access.denied` / `access.override_possible`); the apps read `permissions` and `approvable` from bootstrap (`useAllowed(key)` → `yes` / `approve` / `no`), never a venue switch for what a person may do. Inside code use `core.access.check.holds(user, key)` / `can(user, key)`, never role names or `perm_*` attributes (`tests/guards/test_no_perm_reads.py`). The v1 booleans are gone (step 2.99): `UserOut` carries only `permissions` (keys).
|
||||
|
||||
**Apps never send a price (step 4.4).** Order lines go by id (`services/pos_cart.py`'s line: product, quick add-ons, extras with sub-choices, preferences, removed ingredients) to `POST /api/orders/{id}/items` (the waiter, the manager's ordering tab) or the counter's `/api/pos/*`; the server prices them through `orders.add_priced_items`, the one function that writes order items with prices. A line carrying prices or `selected_options` is refused (`order.line.client_price`), so is the shape before 4.4 (`items` → `order.lines_required`); a by-hand change (`price_adjustment`) needs `ordering.prices.modify` or a manager's approval. Totals before sending come from `POST /api/orders/quote` (the counter: `/api/pos/quote`), the same code; offline an app may show its menu's prices only as an estimate. Apps whose cart keeps the stored `selected_options` shape build lines with `@xenia/api` `wireLine` / `lineFromOptions` (an option no longer on the menu throws `LineError`, never dropped). A preference set left out of a line takes its default, and a set at its free default isn't stored (tickets show only what differs).
|
||||
|
||||
**Waiter texts (step 4.5).** The waiter app has no text of its own: every label is a key in `packages/i18n/locales/{en,el}/waiter.json` (English first, Greek as the translation), read with `useTranslation('waiter')` in components and `tw('key')` (`waiter_pwa/src/i18n.js`) outside them; money with `useFormat().formatMoney` or `money()` from the same file, times with `useFormat()` (venue clock). `waiter_pwa/tests/no-greek.test.mjs` fails on any Greek letter in `waiter_pwa/src` (a Greek word the code must recognise is written with `\u` escapes). Don't name a variable `t` in a component that translates. The language is per person (user menu, saved with `PATCH /api/auth/me`), else the venue's. The e2e suites run the waiter in English (the test venue's language).
|
||||
Paired devices (D-8, `routers/devices.py`, `core/access/context.py`) send `X-Xenia-Device: <token>` (on the WebSocket: `device` in the first frame); a device may only use keys matching its app's `DeviceApp.scope` (plus `<app>.*`) and only reach routes of those modules. A new device app with user logins must declare `<app>.access`. Per-device settings are `ConfigField`s in `DeviceApp.config` (validated by `core/modules/device_config.py`, rendered by the manager's `DeviceConfigFields`), each with texts `modules:<app>.config.<key>.label` (+ `.choices.<value>`), never free JSON. Device-only endpoints use `require_device("<app>")`; users log in on a device with `POST /api/auth/login {client: "terminal"}`, and that session only works together with the device's header.
|
||||
Manager override (D-10, `core/access/override.py`): mark a key `Perm(..., overridable=True)` and a user without it gets `access.override_possible`; the client gets a manager's one-time token from `POST /api/access/override {key, username, pin}` and retries with `X-Xenia-Override`. `require()` routes handle it in `check()`; an endpoint with its own rule calls `require_override(request, db, key, target="order:12")` where the rule says no, **after** its other checks (a used token is spent).
|
||||
|
||||
|
||||
@@ -0,0 +1,773 @@
|
||||
{
|
||||
"common": {
|
||||
"loading": "Φόρτωση…",
|
||||
"refresh": "Ανανέωση",
|
||||
"signOut": "Αποσύνδεση",
|
||||
"close": "Κλείσιμο",
|
||||
"minutesShort": "{{m}}λ",
|
||||
"hoursShort": "{{h}}ω",
|
||||
"hoursMinutesShort": "{{h}}ω {{m}}λ",
|
||||
"change": "Αλλαγή",
|
||||
"retry": "Επανάληψη",
|
||||
"total": "Σύνολο",
|
||||
"clear": "Καθαρισμός",
|
||||
"ok": "Εντάξει",
|
||||
"cancel": "Άκυρο",
|
||||
"confirm": "Επιβεβαίωση",
|
||||
"back": "Πίσω",
|
||||
"save": "Αποθήκευση",
|
||||
"apply": "Εφαρμογή",
|
||||
"sure": "Είσαι σίγουρος;"
|
||||
},
|
||||
"gate": {
|
||||
"closedTitle": "Εστιατόριο κλειστό",
|
||||
"closedBody": "Δεν υπάρχει ενεργή ημέρα λειτουργίας.\nΖητήστε από τον διαχειριστή να ανοίξει την ημέρα.",
|
||||
"waitingTitle": "Αναμονή για έναρξη βάρδιας",
|
||||
"waitingBody": "Ζητήστε από τον διαχειριστή να ξεκινήσει τη βάρδια σας.",
|
||||
"startFailed": "Σφάλμα εκκίνησης βάρδιας",
|
||||
"welcome": "Καλώς ήρθες, {{name}}!",
|
||||
"startQuestion": "Θέλεις να ξεκινήσεις τη βάρδια σου;",
|
||||
"startingCash": "Αρχικά μετρητά (προαιρετικό)",
|
||||
"starting": "Εκκίνηση…",
|
||||
"startShift": "Έναρξη Βάρδιας"
|
||||
},
|
||||
"nav": {
|
||||
"tables": "Τραπέζια",
|
||||
"activeOrders": "Ενεργές Παραγγελίες",
|
||||
"orders": "Παραγγελίες",
|
||||
"messages": "Μηνύματα",
|
||||
"takeaway": "Takeaway",
|
||||
"shift": "Βάρδια",
|
||||
"log": "Αρχείο",
|
||||
"takeawayDelivery": "Takeaway / Delivery",
|
||||
"shiftSummary": "Σύνοψη Βάρδιας",
|
||||
"orderLog": "Αρχείο Παραγγελιών",
|
||||
"settings": "Ρυθμίσεις",
|
||||
"installApp": "Εγκατάσταση εφαρμογής",
|
||||
"chat": "Chat"
|
||||
},
|
||||
"shell": {
|
||||
"notifications": "Ειδοποιήσεις",
|
||||
"noNotifications": "Δεν υπάρχουν ειδοποιήσεις",
|
||||
"notificationTables": "Τραπέζι: {{tables}}",
|
||||
"posSystem": "Σύστημα POS",
|
||||
"navigation": "Πλοήγηση"
|
||||
},
|
||||
"menu": {
|
||||
"title": "Μενού χρήστη",
|
||||
"endShiftConfirm": "Να τελειώσει η βάρδια σου;",
|
||||
"shiftActive": "Βάρδια ενεργή",
|
||||
"since": "Από {{time}}",
|
||||
"startingCash": "Αρχικά: {{amount}}",
|
||||
"onBreakSince": "Σε διάλειμμα από {{time}}",
|
||||
"endBreak": "Τέλος Διαλείμματος",
|
||||
"break": "Διάλειμμα",
|
||||
"endShift": "Τέλος Βάρδιας",
|
||||
"askManagerToEnd": "Ζητήστε από τον διαχειριστή να κλείσει τη βάρδια",
|
||||
"venue": "Κατάστημα: {{name}}",
|
||||
"lightTheme": "Φωτεινό θέμα",
|
||||
"darkTheme": "Σκοτεινό θέμα",
|
||||
"lock": "Κλείδωμα",
|
||||
"languageNotSaved": "Η γλώσσα άλλαξε σε αυτό το κινητό, αλλά δεν αποθηκεύτηκε στο προφίλ σας."
|
||||
},
|
||||
"login": {
|
||||
"onShift": "Σε βάρδια",
|
||||
"wrongPassword": "Λανθασμένος κωδικός",
|
||||
"wrongPin": "Λανθασμένο PIN",
|
||||
"tapOnly": "Σε αυτό το κατάστημα οι σερβιτόροι συνδέονται πατώντας το όνομά τους στις συνδεδεμένες οθόνες. Από κινητό δεν γίνεται σύνδεση με αυτόν τον τρόπο — ζητήστε από τον διαχειριστή να αλλάξει τον τρόπο σύνδεσης σε PIN ή κωδικό.",
|
||||
"whoAreYou": "Ποιος είσαι;",
|
||||
"serverNotFound": "Δεν βρέθηκε ο Server",
|
||||
"serverNotFoundBody": "Δεν είναι δυνατή η σύνδεση με τον Manager. Δεν μπορεί να ξεκινήσει βάρδια χωρίς σύνδεση.",
|
||||
"noWaiters": "Δεν βρέθηκαν σερβιτόροι",
|
||||
"username": "Όνομα χρήστη",
|
||||
"password": "Κωδικός",
|
||||
"signIn": "Σύνδεση",
|
||||
"enterPin": "Εισάγετε PIN"
|
||||
},
|
||||
"card": {
|
||||
"freeLower": "Ελεύθερο",
|
||||
"noItems": "Κανένα είδος",
|
||||
"free": "ΕΛΕΥΘΕΡΟ",
|
||||
"open": "ΑΝΟΙΧΤΟ",
|
||||
"mine": "ΔΙΚΟ ΜΟΥ",
|
||||
"paid": "ΠΛΗΡΩΜΕΝΟ",
|
||||
"partlyPaid": "ΜΕΡ. ΠΛΗΡ.",
|
||||
"waiters_one": "{{count}} σερβιτόρος",
|
||||
"waiters_other": "{{count}} σερβιτόροι",
|
||||
"allReady": "Όλα Έτοιμα για Παράδοση",
|
||||
"preparingCount": "{{count}} Ετοιμάζεται",
|
||||
"readyCount": "{{count}} Έτοιμα",
|
||||
"more": "+{{count}} ακόμα…"
|
||||
},
|
||||
"tables": {
|
||||
"quick": {
|
||||
"paid": "Πληρωμένο",
|
||||
"due": "Υπόλοιπο",
|
||||
"noOrder": "Δεν υπάρχει ενεργή παραγγελία",
|
||||
"openTable": "Άνοιγμα τραπεζιού",
|
||||
"markAllServed": "Σήμανση Όλων ως Παραδοθέντα",
|
||||
"cancelOrder": "Ακύρωση Παραγγελίας"
|
||||
},
|
||||
"filter": {
|
||||
"title": "Φίλτρα",
|
||||
"owner": "Ανάθεση",
|
||||
"status": "Κατάσταση",
|
||||
"all": "Όλα",
|
||||
"mine": "Δικά μου",
|
||||
"free": "Ελεύθερα",
|
||||
"open": "Ανοιχτά",
|
||||
"paid": "Πληρωμένα",
|
||||
"zones": "Ζώνες",
|
||||
"zonesSelected": "Ζώνες ({{count}} επιλεγμένες)"
|
||||
},
|
||||
"offlineNoData": "Offline — δεν υπάρχουν αποθηκευμένα δεδομένα",
|
||||
"offlineNoDataBody": "Συνδέσου στο δίκτυο μια φορά για να αποθηκευτούν τα δεδομένα τοπικά.",
|
||||
"cancelConfirmTitle": "Ακύρωση Παραγγελίας;",
|
||||
"cancelConfirmBody": "Όλα τα ενεργά αντικείμενα θα ακυρωθούν και θα εκτυπωθεί απόδειξη ακύρωσης.",
|
||||
"actions": {
|
||||
"flags": "Ενδείξεις Τραπεζιού",
|
||||
"transfer": "Μεταφορά",
|
||||
"merge": "Συγχώνευση",
|
||||
"printSynopsis": "Εκτύπωση Σύνοψης",
|
||||
"assignWaiter": "Ανάθεση Σερβιτόρου"
|
||||
},
|
||||
"status": {
|
||||
"open": "Ανοιχτό",
|
||||
"partlyPaid": "Μερικώς πληρωμένο",
|
||||
"paid": "Πληρωμένο",
|
||||
"free": "Ελεύθερο"
|
||||
},
|
||||
"pull": {
|
||||
"refreshing": "Ανανέωση…",
|
||||
"release": "Αφήστε για ανανέωση",
|
||||
"pull": "Τραβήξτε για ανανέωση"
|
||||
}
|
||||
},
|
||||
"orders": {
|
||||
"filter": {
|
||||
"title": "Φίλτρα Παραγγελιών",
|
||||
"view": "Προβολή",
|
||||
"sort": "Ταξινόμηση",
|
||||
"mine": "Δικές μου"
|
||||
},
|
||||
"none": "Δεν υπάρχουν παραγγελίες",
|
||||
"open": "Άνοιγμα",
|
||||
"markServed": "Σήμανση Παραδοθέντων",
|
||||
"newTakeaway": "+ Νέο Takeaway",
|
||||
"newDelivery": "+ Νέα Delivery",
|
||||
"chips": {
|
||||
"all": "Όλες",
|
||||
"allShort": "Όλες",
|
||||
"pending": "Εκκρεμούν",
|
||||
"pendingShort": "ΕΚΚΡ",
|
||||
"preparing": "Σε Προετοιμασία",
|
||||
"preparingShort": "ΠΡΟΕΤ",
|
||||
"ready": "Έτοιμες",
|
||||
"readyShort": "ΕΤΟΙΜΕΣ",
|
||||
"partly": "Μερικώς Έτοιμες",
|
||||
"partlyShort": "ΜΕΡΙΚ"
|
||||
},
|
||||
"sort": {
|
||||
"time": "Κατά ώρα παραγγελίας",
|
||||
"latest": "Κατά τελευταία αλλαγή",
|
||||
"kds": "Έτοιμα → Προετοιμασία → Εκκρεμούν"
|
||||
},
|
||||
"items_one": "{{count}} είδος",
|
||||
"items_other": "{{count}} είδη"
|
||||
},
|
||||
"kds": {
|
||||
"pending": "ΕΚΚΡΕΜΕΙ",
|
||||
"preparing": "ΕΤΟΙΜΑΖΕΤΑΙ",
|
||||
"ready": "ΕΤΟΙΜΟ",
|
||||
"someReady": "{{done}}/{{total}} ΕΤΟΙΜΑ"
|
||||
},
|
||||
"settings": {
|
||||
"chips": {
|
||||
"title": "Εμφάνιση chips παραγγελιών",
|
||||
"sub": "Πώς εμφανίζονται τα φίλτρα στη σελίδα Παραγγελίες.",
|
||||
"full": "Πλήρες κείμενο",
|
||||
"short": "Σύντομο κείμενο",
|
||||
"iconFull": "Εικονίδιο + πλήρες",
|
||||
"iconShort": "Εικονίδιο + σύντομο",
|
||||
"icon": "Μόνο εικονίδιο",
|
||||
"exIconFull": "⏳ Εκκρεμούν",
|
||||
"exIconShort": "⏳ PND"
|
||||
},
|
||||
"density": {
|
||||
"title": "Κάρτες τραπεζιών",
|
||||
"sub": "Επίλεξε πόσα στοιχεία εμφανίζονται σε κάθε κάρτα.",
|
||||
"d1x1": "4 ανά σειρά — μόνο όνομα",
|
||||
"d2x1": "2 ανά σειρά — όνομα + κατάσταση",
|
||||
"d2x2": "2 ανά σειρά — συμπαγής κάρτα",
|
||||
"d4x1": "1 ανά σειρά — οριζόντια λίστα",
|
||||
"d4x2": "1 ανά σειρά — πλήρης κάρτα",
|
||||
"d4x3": "1 ανά σειρά — κάρτα με λίστα παραγγελίας"
|
||||
},
|
||||
"kds": {
|
||||
"title": "Εμφάνιση Κατάστασης KDS",
|
||||
"sub": "Πώς εμφανίζεται η κατάσταση KDS σε κάθε αντικείμενο παραγγελίας.",
|
||||
"badge": "Badge",
|
||||
"badgeDesc": "Κείμενο σε chip (ΕΚΚΡΕΜΕΙ, READY…)",
|
||||
"icon": "Εικονίδιο",
|
||||
"iconDesc": "Μικρό χρωματιστό εικονίδιο — λιγότερος χώρος"
|
||||
},
|
||||
"itemLayout": {
|
||||
"title": "Layout Αντικειμένων Παραγγελίας",
|
||||
"sub": "Πώς εμφανίζεται κάθε αντικείμενο στη λίστα παραγγελίας ενός τραπεζιού.",
|
||||
"compact": "Compact",
|
||||
"compactDesc": "Μία γραμμή — συμπαγής εμφάνιση, λιγότερο ύψος",
|
||||
"expanded": "Expanded",
|
||||
"expandedDesc": "Δύο γραμμές — όνομα + KDS πάνω, τιμολόγηση κάτω",
|
||||
"full": "Fully Detailed",
|
||||
"fullDesc": "Πλήρης ανάλυση — όνομα, τιμές, σερβιτόρος, ώρα, options"
|
||||
},
|
||||
"merge": {
|
||||
"title": "Διατήρηση Προβολής Συγχώνευσης",
|
||||
"sub": "Πόσο διατηρείται η επιλεγμένη προβολή συγχώνευσης αντικειμένων.",
|
||||
"off": "OFF",
|
||||
"offDesc": "Επαναφορά στην αρχική κατά την πλοήγηση",
|
||||
"perOrder": "ΔΙΑΤΗΡΗΣΗ ΑΝΑ ΠΑΡΑΓΓΕΛΙΑ",
|
||||
"perOrderDesc": "Διατηρείται μέχρι το κλείσιμο της παραγγελίας",
|
||||
"global": "ΔΙΑΤΗΡΗΣΗ ΠΑΝΤΑ",
|
||||
"globalDesc": "Ίδια ρύθμιση για όλα τα τραπέζια, πάντα"
|
||||
},
|
||||
"theme": {
|
||||
"title": "Θέμα",
|
||||
"light": "Φωτεινό",
|
||||
"dark": "Σκοτεινό"
|
||||
},
|
||||
"popup": {
|
||||
"title": "Στυλ ειδοποιήσεων",
|
||||
"sub": "Πότε εμφανίζονται αναδυόμενα banners κατά την παραλαβή ειδοποίησης.",
|
||||
"all": "Popup Everything",
|
||||
"allDesc": "Εμφανίζεται popup για κάθε ειδοποίηση (KDS, μηνύματα, κλπ.)",
|
||||
"manager": "Popup μόνο για μηνύματα διαχειριστή",
|
||||
"managerDesc": "KDS ειδοποιήσεις αποθηκεύονται στο κουδούνι χωρίς popup.",
|
||||
"never": "Never Popup",
|
||||
"neverDesc": "Καμία αναδυόμενη ειδοποίηση. Ανοίξτε το κουδούνι για να τις δείτε — και θα σβηστούν αυτόματα."
|
||||
},
|
||||
"persist": {
|
||||
"title": "Επιμονή Popup",
|
||||
"on": "Τα popups παραμένουν μέχρι να πατήσετε OK.",
|
||||
"off": "Τα popups κλείνουν αυτόματα μετά από 3 δευτερόλεπτα και η ειδοποίηση σβήνεται αμέσως κατά την παραλαβή.",
|
||||
"label": "Persistent Popup",
|
||||
"onDesc": "Ενεργό — απαιτεί χειροκίνητο κλείσιμο",
|
||||
"offDesc": "Ανενεργό — αυτόματο κλείσιμο σε 3 δευτ."
|
||||
},
|
||||
"summary": {
|
||||
"title": "Σύνοψη πριν την Αποστολή",
|
||||
"sub": "Αντί για απευθείας αποστολή, εμφανίζεται πρώτα σελίδα επισκόπησης με όλα τα προϊόντα, τις επιλογές, και τη σημείωση παραγγελίας.",
|
||||
"label": "Σύνοψη + Αποστολή",
|
||||
"onDesc": "Ενεργό — εμφανίζεται modal επισκόπησης πριν την αποστολή",
|
||||
"offDesc": "Ανενεργό — άμεση αποστολή"
|
||||
},
|
||||
"paySafety": {
|
||||
"title": "Ασφάλεια Πληρωμών",
|
||||
"sub": "Προσθέτει ένα επιπλέον βήμα επιβεβαίωσης για να αποφύγετε τυχαίες πληρωμές. Ακόμα κι αν κάνετε λάθος, ο διαχειριστής μπορεί να ενεργοποιήσει την αναίρεση πληρωμής.",
|
||||
"off": "Απενεργοποιημένο",
|
||||
"offDesc": "Η πληρωμή επιβεβαιώνεται με ένα απλό πάτημα.",
|
||||
"second": "Δεύτερη Επιβεβαίωση",
|
||||
"secondDesc": "Μετά την επιβεβαίωση πληρωμής, εμφανίζεται ένα επιπλέον παράθυρο ασφαλείας πριν ολοκληρωθεί η πληρωμή.",
|
||||
"hold": "Παρατεταμένο Πάτημα",
|
||||
"holdDesc": "Για να επιβεβαιωθεί η πληρωμή, πρέπει να κρατήσετε πατημένο το κουμπί για ~1 δευτερόλεπτο."
|
||||
},
|
||||
"fav": {
|
||||
"title": "Αγαπημένα Προϊόντα",
|
||||
"none": "Δεν έχεις ορίσει αγαπημένα ακόμα. Πάτα παρακάτω για να ξεκινήσεις.",
|
||||
"setup": "Ρύθμιση Αγαπημένων",
|
||||
"setupSub": "Επίλεξε προϊόντα και άλλαξε σειρά εμφάνισης",
|
||||
"count_one": "{{count}} αγαπημένο ενεργό — εμφανίζεται ως πρώτη κατηγορία στην παραγγελία.",
|
||||
"count_other": "{{count}} αγαπημένα ενεργά — εμφανίζονται ως πρώτη κατηγορία στην παραγγελία."
|
||||
},
|
||||
"reset": {
|
||||
"title": "Επαναφορά",
|
||||
"sure": "Είσαι σίγουρος; Αυτή η ενέργεια δεν μπορεί να αναιρεθεί.",
|
||||
"sub": "Διαγράφει όλα τα αγαπημένα και επαναφέρει τις προτιμήσεις στις εργοστασιακές τιμές.",
|
||||
"again": "Πάτα ξανά για επιβεβαίωση",
|
||||
"all": "Επαναφορά Όλων",
|
||||
"allSub": "Αγαπημένα & ρυθμίσεις"
|
||||
},
|
||||
"navStyle": {
|
||||
"title": "Στυλ γραμμής πλοήγησης",
|
||||
"sub": "Πώς εμφανίζεται η γραμμή πλοήγησης στο κάτω μέρος της οθόνης.",
|
||||
"triple": "Triple Pill",
|
||||
"tripleDesc": "Σταθερά 3 κουμπιά με εικονίδιο + κείμενο σε pill μορφή",
|
||||
"icons": "Icon Navbar",
|
||||
"iconsDesc": "Android-style με 1–5 εικονίδια που μπορείτε να διαμορφώσετε"
|
||||
},
|
||||
"triple": {
|
||||
"title": "Στοιχεία Triple Pill",
|
||||
"sub": "Επίλεξε ακριβώς 3 κουμπιά και σύρε για να αλλάξεις τη σειρά τους.",
|
||||
"count": "{{count}}/3 κουμπιά ενεργά"
|
||||
},
|
||||
"available": "Διαθέσιμα",
|
||||
"icons": {
|
||||
"title": "Στοιχεία Icon Navbar",
|
||||
"sub": "Επίλεξε ποια εικονίδια εμφανίζονται (1–5). Σύρε για να αλλάξεις τη σειρά.",
|
||||
"count": "{{count}}/5 εικονίδια ενεργά"
|
||||
},
|
||||
"tabs": {
|
||||
"layout": "Εμφάνιση",
|
||||
"operation": "Λειτουργία",
|
||||
"favorites": "Αγαπημένα"
|
||||
},
|
||||
"max": "μέγιστο"
|
||||
},
|
||||
"venues": {
|
||||
"active": "ΕΝΕΡΓΟ",
|
||||
"removeLabel": "Αφαίρεση",
|
||||
"placeholder": "π.χ. 192.168.1.50",
|
||||
"failed": "Αποτυχία σύνδεσης.",
|
||||
"removeActive": "Αφαίρεση του ενεργού καταστήματος «{{name}}»; Θα χρειαστεί νέα σύνδεση.",
|
||||
"remove": "Αφαίρεση του καταστήματος «{{name}}» από αυτό το κινητό;",
|
||||
"connectTitle": "Σύνδεση με κατάστημα",
|
||||
"title": "Καταστήματα",
|
||||
"intro": "Σαρώστε το QR από τον διαχειριστή ή πληκτρολογήστε τη διεύθυνση του server. Το κινητό πρέπει να είναι στο WiFi του καταστήματος.",
|
||||
"scan": "Σάρωση QR",
|
||||
"checking": "Έλεγχος…",
|
||||
"connect": "Σύνδεση"
|
||||
},
|
||||
"install": {
|
||||
"title": "Εφαρμογή Xenia",
|
||||
"download": "Λήψη εφαρμογής",
|
||||
"later": "Όχι τώρα",
|
||||
"fast": "Ανοίγει αμέσως",
|
||||
"fastText": "Χωρίς φόρτωση από τον browser, σαν κανονική εφαρμογή.",
|
||||
"wifi": "Αντέχει στο WiFi",
|
||||
"wifiText": "Συνεχίζει να δουλεύει όταν χάνεται για λίγο η σύνδεση.",
|
||||
"secure": "Ασφαλής σύνδεση",
|
||||
"secureText": "Κρυπτογραφημένη επικοινωνία με τον server του καταστήματος.",
|
||||
"noSetup": "Χωρίς ρυθμίσεις",
|
||||
"noSetupText": "Βρίσκει μόνη της τον server και ενημερώνεται αυτόματα.",
|
||||
"step1": "Πατήστε «Λήψη εφαρμογής».",
|
||||
"step2": "Ανοίξτε το αρχείο και επιτρέψτε την εγκατάσταση.",
|
||||
"step3": "Ανοίξτε το Xenia και σαρώστε ξανά το QR του καταστήματος.",
|
||||
"intro": "Εγκαταστήστε την εφαρμογή για γρηγορότερη και πιο σταθερή λειτουργία."
|
||||
},
|
||||
"lock": {
|
||||
"locked": "Κλειδωμένο",
|
||||
"unlock": "Ξεκλείδωμα",
|
||||
"signOutOther": "Αποσύνδεση (άλλος σερβιτόρος)"
|
||||
},
|
||||
"update": {
|
||||
"available": "Νέα έκδοση διαθέσιμη",
|
||||
"update": "Ενημέρωση",
|
||||
"needsNewerApp": "Ο server του καταστήματος χρειάζεται νεότερη έκδοση της εφαρμογής."
|
||||
},
|
||||
"qr": {
|
||||
"aim": "Σκοπεύστε το QR από τον διαχειριστή (Ρυθμίσεις → Γενικά → Σερβιτόροι WiFi)",
|
||||
"denied": "Δεν δόθηκε άδεια κάμερας. Επιτρέψτε την από τις ρυθμίσεις του κινητού ή πληκτρολογήστε τη διεύθυνση.",
|
||||
"noCamera": "Δεν ήταν δυνατή η ενεργοποίηση της κάμερας. Πληκτρολογήστε τη διεύθυνση."
|
||||
},
|
||||
"favSetup": {
|
||||
"noOptions": "Αυτό το προϊόν δεν έχει επιλογές, υλικά ή προτιμήσεις.",
|
||||
"all": "ΌΛΑ",
|
||||
"favorites": "ΑΓΑΠΗΜΕΝΑ ({{count}})",
|
||||
"personalOn": "Προσωπικές ρυθμίσεις ενεργές",
|
||||
"managerDefaults": "Χρήση ρυθμίσεων διαχειριστή",
|
||||
"pickIntro": "Επίλεξε ποιες επιλογές θα εμφανίζονται για αυτό το προϊόν στην καρτέλα",
|
||||
"pickOutro": "Αν δεν επιλέξεις τίποτα, θα χρησιμοποιηθούν οι ρυθμίσεις του διαχειριστή.",
|
||||
"saveCount": "Αποθήκευση ({{count}} επιλογές)",
|
||||
"options": "Επιλογές αγαπημένων",
|
||||
"none": "Δεν έχεις προσθέσει αγαπημένα ακόμα.",
|
||||
"noneHow": "Πήγαινε στην καρτέλα ΌΛΑ και πάτα την καρδιά δίπλα στα προϊόντα."
|
||||
},
|
||||
"drawer": {
|
||||
"tabs": {
|
||||
"quick": "Γρήγορες Επιλογές",
|
||||
"ingredients": "Υλικά",
|
||||
"prefs": "Προτιμήσεις",
|
||||
"extrasTitle": "Extras",
|
||||
"note": "Σημείωση",
|
||||
"quickShort": "Γρήγορες",
|
||||
"extras": "Έξτρα",
|
||||
"options": "Επιλογές",
|
||||
"price": "Τιμή",
|
||||
"summary": "Σύνοψη",
|
||||
"quantity": "Ποσότητα ({{unit}})"
|
||||
},
|
||||
"choose": "Επιλογή",
|
||||
"chooseMany": "Επιλογή (πολλαπλή)",
|
||||
"removed": "Αφαιρέθηκε",
|
||||
"remove": "Αφαίρεση",
|
||||
"required": "Απαιτείται",
|
||||
"choiceRequired": "— απαιτείται επιλογή",
|
||||
"empty": {
|
||||
"favorites": "Δεν υπάρχουν αγαπημένα για αυτό το προϊόν.",
|
||||
"quick": "Δεν υπάρχουν γρήγορες επιλογές.",
|
||||
"extras": "Δεν υπάρχουν extras.",
|
||||
"ingredients": "Δεν υπάρχουν υλικά.",
|
||||
"prefs": "Δεν υπάρχουν προτιμήσεις."
|
||||
},
|
||||
"qty": {
|
||||
"quickPick": "ΓΡΗΓΟΡΗ ΕΠΙΛΟΓΗ",
|
||||
"quickAdd": "ΓΡΗΓΟΡΗ ΠΡΟΣΘΗΚΗ"
|
||||
},
|
||||
"price": {
|
||||
"intro": "Αλλαγή τιμής μόνο για αυτό το αντικείμενο. Δεν επηρεάζει άλλες παραγγελίες.",
|
||||
"base": "Βάση: {{price}}"
|
||||
},
|
||||
"notes": {
|
||||
"placeholder": "π.χ. Χωρίς αλάτι, κόψτε στη μέση...",
|
||||
"quickTitle": "Γρήγορες σημειώσεις",
|
||||
"noSalt": "Χωρίς αλάτι",
|
||||
"quick": "Βγάλτε γρήγορα",
|
||||
"allergy": "Αλλεργία!",
|
||||
"smallPieces": "Κόψτε σε μικρά κομμάτια",
|
||||
"napkins": "Έξτρα χαρτοπετσέτες"
|
||||
},
|
||||
"summary": {
|
||||
"empty": "Δεν έχει γίνει καμία προσαρμογή. Χρησιμοποιήστε τις καρτέλες για να διαμορφώσετε το προϊόν.",
|
||||
"removed": "Αφαιρέθηκαν"
|
||||
},
|
||||
"included": "Περιλαμβάνεται",
|
||||
"selectedCount": "{{count}} επιλεγμένα",
|
||||
"each": "το ένα",
|
||||
"without": "Χωρίς {{name}}"
|
||||
},
|
||||
"pairing": {
|
||||
"empty": "Συμπληρώστε τη διεύθυνση του server.",
|
||||
"invalid": "Μη έγκυρη διεύθυνση. Παράδειγμα: 192.168.1.50",
|
||||
"noServer": "Δεν βρέθηκε server σε αυτή τη διεύθυνση. Ελέγξτε ότι το κινητό είναι στο ίδιο WiFi με το κατάστημα.",
|
||||
"refused": "Ο server αρνήθηκε τη σύνδεση. Το κινητό πρέπει να είναι στο WiFi του καταστήματος.",
|
||||
"notXenia": "Η διεύθυνση δεν ανήκει σε server Xenia.",
|
||||
"incompatible": "Ο server (έκδοση {{version}}) δεν είναι συμβατός με αυτή την εφαρμογή. Ενημερώστε την εφαρμογή ή τον server.",
|
||||
"otherVenue": "Σε αυτή τη διεύθυνση απαντά διαφορετικό κατάστημα από αυτό του QR. Ζητήστε νέο QR από τον διαχειριστή.",
|
||||
"wrongKey": "Το κλειδί ασφαλείας του server δεν ταιριάζει με το QR. Ζητήστε νέο QR από τον διαχειριστή."
|
||||
},
|
||||
"detail": {
|
||||
"split": {
|
||||
"title": "Διαχωρισμός",
|
||||
"howMany": "Χώρισε σε πόσα;",
|
||||
"newLine": "Νέα γραμμή:",
|
||||
"remains": "Μένει:"
|
||||
},
|
||||
"price": {
|
||||
"title": "Ρύθμιση Τιμής",
|
||||
"tapToType": "Πάτα για πληκτρολόγιο",
|
||||
"reset": "Επαναφορά αρχικής τιμής",
|
||||
"base": "Βασική: {{base}} {{change}}"
|
||||
},
|
||||
"item": {
|
||||
"price": "Ρύθμιση τιμής",
|
||||
"priceSub": "Αλλαγή τιμής για αυτό το αντικείμενο",
|
||||
"again": "Παραγγελία ξανά",
|
||||
"againSub": "Προσθήκη στο νέο καλάθι",
|
||||
"move": "Μεταφορά σε άλλο τραπέζι",
|
||||
"moveSub": "Μεταφορά επιλεγμένων αντικειμένων",
|
||||
"splitSub": "Χώρισμα σε δύο γραμμές",
|
||||
"cancel": "Ακύρωση παραγγελίας",
|
||||
"cancelSub": "Ακύρωση επιλεγμένων αντικειμένων"
|
||||
},
|
||||
"withApproval": "Με έγκριση διαχειριστή (PIN)",
|
||||
"cancelNotAllowed": "Δεν επιτρέπεται η ακύρωση",
|
||||
"discount": {
|
||||
"pickOne": "Επιλέξτε τουλάχιστον ένα αντικείμενο",
|
||||
"badPct": "Μη έγκυρο ποσοστό",
|
||||
"failed": "Σφάλμα εφαρμογής έκπτωσης",
|
||||
"rounding": "Η τελική τιμή στρογγυλοποιείται στο 0.10 €",
|
||||
"items": "Αντικείμενα",
|
||||
"pct": "Ποσοστό έκπτωσης",
|
||||
"note": "Σημείωση (προαιρετικό)",
|
||||
"notePlaceholder": "π.χ. VIP πελάτης",
|
||||
"applying": "Εφαρμογή…"
|
||||
},
|
||||
"actions": {
|
||||
"discount": "Εφαρμογή Έκπτωσης",
|
||||
"markAllServedSub": "Σήμανση όλων των έτοιμων ειδών ως παραδοθέντα",
|
||||
"discountSub": "Έκπτωση σε αντικείμενα παραγγελίας",
|
||||
"discountNotAllowed": "Δεν επιτρέπεται η εφαρμογή έκπτωσης",
|
||||
"transfer": "Μεταφορά Τραπεζιού",
|
||||
"merge": "Συγχώνευση Τραπεζιού",
|
||||
"mergeSub": "Συγχώνευση με άλλο τραπέζι",
|
||||
"flagsSub": "Επιλογή σημαιών",
|
||||
"assignSub": "Προσθήκη σερβιτόρου στην παραγγελία",
|
||||
"printSub": "Εκτύπωση σύνοψης παραγγελίας",
|
||||
"cancelSub": "Ακύρωση ολόκληρης παραγγελίας"
|
||||
},
|
||||
"noTables": "Δεν υπάρχουν διαθέσιμα τραπέζια",
|
||||
"noFlags": "Δεν υπάρχουν σημαίες",
|
||||
"allAssigned": "Όλοι οι σερβιτόροι έχουν ήδη ανατεθεί",
|
||||
"pickPrinter": "Επιλέξτε εκτυπωτή",
|
||||
"cancel": {
|
||||
"title": "Ακύρωση παραγγελίας;",
|
||||
"button": "Ακύρωση ✕",
|
||||
"whole": "Ολόκληρη η παραγγελία θα ακυρωθεί οριστικά.",
|
||||
"items_one": "{{count}} αντικείμενο θα ακυρωθεί οριστικά.",
|
||||
"items_other": "{{count}} αντικείμενα θα ακυρωθούν οριστικά."
|
||||
},
|
||||
"guests": {
|
||||
"title": "Αριθμός Πελατών",
|
||||
"question": "Πόσα άτομα κάθονται στο τραπέζι;",
|
||||
"button": "Αριθμός πελατών"
|
||||
},
|
||||
"err": {
|
||||
"load": "Σφάλμα φόρτωσης",
|
||||
"open": "Σφάλμα ανοίγματος",
|
||||
"offlinePay": "Σφάλμα αποθήκευσης offline πληρωμής",
|
||||
"pay": "Σφάλμα πληρωμής",
|
||||
"revert": "Σφάλμα αναίρεσης πληρωμής",
|
||||
"close": "Σφάλμα κλεισίματος",
|
||||
"cancel": "Σφάλμα ακύρωσης",
|
||||
"cancelOrder": "Σφάλμα ακύρωσης παραγγελίας",
|
||||
"mark": "Σφάλμα σήμανσης",
|
||||
"splitOffline": "Σφάλμα διαχωρισμού offline",
|
||||
"split": "Σφάλμα διαχωρισμού",
|
||||
"transfer": "Σφάλμα μεταφοράς",
|
||||
"noTargetOrder": "Δεν βρέθηκε παραγγελία στο τραπέζι",
|
||||
"merge": "Σφάλμα συγχώνευσης",
|
||||
"moveItems": "Σφάλμα μεταφοράς αντικειμένων",
|
||||
"flags": "Σφάλμα αποθήκευσης σημαιών"
|
||||
},
|
||||
"openOrder": "Άνοιγμα Παραγγελίας",
|
||||
"noPaid": "Δεν υπάρχουν πληρωμένα αντικείμενα",
|
||||
"revert": {
|
||||
"button": "ΑΝΑΙΡΕΣΗ",
|
||||
"title": "Αναίρεση Πληρωμής;",
|
||||
"items_one": "{{count}} αντικείμενο θα επιστραφεί σε μη πληρωμένο.",
|
||||
"items_other": "{{count}} αντικείμενα θα επιστραφούν σε μη πληρωμένα.",
|
||||
"confirm": "Αναίρεση"
|
||||
},
|
||||
"notOffline": "Μη διαθέσιμο offline",
|
||||
"view": {
|
||||
"title": "Εμφάνιση Αντικειμένων",
|
||||
"off": "ΑΡΧΙΚΗ",
|
||||
"offDesc": "Ακριβώς όπως παραγγέλθηκαν",
|
||||
"identical": "ΣΥΓΧΩΝΕΥΣΗ ΠΑΡΟΜΟΙΩΝ",
|
||||
"identicalDesc": "Ίδιο προϊόν, ίδιες επιλογές, ίδια τιμή",
|
||||
"sameItem": "ΣΥΓΧΩΝΕΥΣΗ ΟΛΩΝ",
|
||||
"sameItemDesc": "Ίδιο προϊόν με ίδια τελική τιμή"
|
||||
},
|
||||
"close": {
|
||||
"title": "Κλείσιμο παραγγελίας;",
|
||||
"body": "Αυτή η ενέργεια δεν αναιρείται."
|
||||
},
|
||||
"move": {
|
||||
"pickFree": "Επιλέξτε κενό τραπέζι",
|
||||
"mergeSub": "Τα αντικείμενα μεταφέρονται στο επιλεγμένο τραπέζι",
|
||||
"itemsTitle": "Μεταφορά Αντικειμένων",
|
||||
"subtitle_one": "Μεταφορά {{count}} αντικειμένου σε τραπέζι",
|
||||
"subtitle_other": "Μεταφορά {{count}} αντικειμένων σε τραπέζι",
|
||||
"confirmTransfer": "Επιβεβαίωση Μεταφοράς",
|
||||
"confirmMerge": "Επιβεβαίωση Συγχώνευσης",
|
||||
"confirmItems": "Επιβεβαίωση Μεταφοράς Αντικειμένων",
|
||||
"transferTo": "Μεταφορά παραγγελίας στο τραπέζι",
|
||||
"mergeWith": "Συγχώνευση παραγγελίας με το τραπέζι",
|
||||
"itemsTo_one": "Μεταφορά {{count}} αντικειμένου στο τραπέζι",
|
||||
"itemsTo_other": "Μεταφορά {{count}} αντικειμένων στο τραπέζι"
|
||||
},
|
||||
"selected_one": "{{count}} αντικείμενο επιλεγμένο",
|
||||
"selected_other": "{{count}} αντικείμενα επιλεγμένα",
|
||||
"pay": {
|
||||
"titleClose": "Επιβεβαίωση Πληρωμής και Κλείσιμο",
|
||||
"title": "Επιβεβαίωση πληρωμής",
|
||||
"allAndClose": "Όλα τα αντικείμενα — το τραπέζι θα κλείσει αμέσως μετά",
|
||||
"all": "Όλα τα αντικείμενα",
|
||||
"items_one": "{{count}} αντικείμενο",
|
||||
"items_other": "{{count}} αντικείμενα",
|
||||
"cash": "Μετρητά",
|
||||
"card": "Κάρτα",
|
||||
"hold": "Κρατήστε…",
|
||||
"paid": "Πληρώθηκαν",
|
||||
"yesPaid": "Ναι, Πληρώθηκαν"
|
||||
},
|
||||
"tabs": {
|
||||
"unpaid": "Εκκρεμή",
|
||||
"paid": "Πληρωμένα"
|
||||
}
|
||||
},
|
||||
"add": {
|
||||
"course": {
|
||||
"title": "Ορισμός πιάτου",
|
||||
"sub": "Τα γρήγορα προϊόντα θα μπαίνουν σε αυτό το πιάτο.",
|
||||
"none": "Χωρίς πιάτο"
|
||||
},
|
||||
"sendFailed": "Σφάλμα αποστολής — η παραγγελία δεν στάλθηκε",
|
||||
"search": {
|
||||
"title": "Αναζήτηση",
|
||||
"type": "Πληκτρολογήστε για αναζήτηση…",
|
||||
"placeholder": "Αναζήτηση προϊόντος…",
|
||||
"none": "Δεν βρέθηκαν προϊόντα για «{{query}}»"
|
||||
},
|
||||
"allCategories": "Όλες οι κατηγορίες",
|
||||
"order": "Παραγγελία",
|
||||
"empty": "Η παραγγελία είναι κενή.",
|
||||
"note": {
|
||||
"placeholder": "Σημείωση για ολόκληρη την παραγγελία…",
|
||||
"title": "Σημείωση Παραγγελίας",
|
||||
"add": "Προσθήκη σημείωσης παραγγελίας"
|
||||
},
|
||||
"deal": {
|
||||
"title": "Προσφορά Ενεργοποιήθηκε!",
|
||||
"freeProduct": "Δωρεάν προϊόν:",
|
||||
"skip": "Παράβλεψη",
|
||||
"pickFree_one": "Επιλέξτε {{count}} δωρεάν προϊόν",
|
||||
"pickFree_other": "Επιλέξτε {{count}} δωρεάν προϊόντα",
|
||||
"remaining": "({{count}} ακόμα)",
|
||||
"addFree": "Προσθήκη Δωρεάν"
|
||||
},
|
||||
"inCart": "στο καλάθι",
|
||||
"edit": "Επεξ.",
|
||||
"optionGone": "«{{product}}»: το «{{what}}» δεν υπάρχει πια στο μενού. Αφαιρέστε το και προσθέστε το ξανά.",
|
||||
"offlineSaveFailed": "Σφάλμα αποθήκευσης offline παραγγελίας",
|
||||
"totalEstimateOffline": "Σύνολο (εκτίμηση, χωρίς σύνδεση)",
|
||||
"totalEstimate": "Σύνολο (εκτίμηση)",
|
||||
"withoutList": "Χωρίς: {{names}}",
|
||||
"newOrder": "Νέα Παραγγελία",
|
||||
"add": "Προσθήκη",
|
||||
"moreSeeAll": "+{{count}} ακόμα — δείτε όλα →",
|
||||
"sending": "Αποστολή…",
|
||||
"send": "ΑΠΟΣΤΟΛΗ",
|
||||
"sendCount": "ΑΠΟΣΤΟΛΗ ({{count}})",
|
||||
"summaryCount": "ΣΥΝΟΨΗ ({{count}})",
|
||||
"products_one": "{{count}} προϊόν",
|
||||
"products_other": "{{count}} προϊόντα",
|
||||
"ack": {
|
||||
"offline": "Αποθηκεύτηκε Offline",
|
||||
"printing": "Στάλθηκε — Εκτύπωση σε εξέλιξη",
|
||||
"printed": "Εκτυπώθηκε Επιτυχώς"
|
||||
}
|
||||
},
|
||||
"summary": {
|
||||
"modifier": "Τροποποιητής",
|
||||
"discount": "Έκπτωση",
|
||||
"free": "Δωρεάν",
|
||||
"freeCaps": "ΔΩΡΕΑΝ",
|
||||
"notPrinted": "Δεν εκτυπώθηκε ακόμα",
|
||||
"ordered": "Παραγγέλθηκε",
|
||||
"paidAt": "Πληρώθηκε",
|
||||
"noItems": "Δεν υπάρχουν αντικείμενα",
|
||||
"due": "Εκκρεμεί",
|
||||
"paidBadge": "Πληρωμένο",
|
||||
"cancelledBadge": "Ακυρωμένο"
|
||||
},
|
||||
"picker": {
|
||||
"noService": "Δεν υπάρχουν service αντικείμενα",
|
||||
"noFavorites": "Δεν έχεις αγαπημένα ακόμα.",
|
||||
"noProducts": "Δεν υπάρχουν προϊόντα",
|
||||
"noTags": "Δεν υπάρχουν tags ακόμα.",
|
||||
"noTagged": "Κανένα προϊόν με αυτό το tag.",
|
||||
"setToGuests_one": "Ορισμός σε {{count}} άτομο",
|
||||
"setToGuests_other": "Ορισμός σε {{count}} άτομα",
|
||||
"noCharge": "χωρίς χρέωση",
|
||||
"noCategory": "Χωρίς Κατηγορία",
|
||||
"categories": "Κατηγορίες",
|
||||
"tags": "Ετικέτες"
|
||||
},
|
||||
"summaryModal": {
|
||||
"edit": "Επεξεργασία",
|
||||
"title": "Επισκόπηση Παραγγελίας"
|
||||
},
|
||||
"log": {
|
||||
"printProblem": "Πρόβλημα Εκτύπωσης",
|
||||
"cancelPrint": "Ακύρωση Εκτύπωσης",
|
||||
"ok": "Επιτυχής",
|
||||
"failedF": "Αποτυχημένη",
|
||||
"range": "Εύρος ημερομηνίας/ώρας",
|
||||
"from": "Από",
|
||||
"to": "Έως",
|
||||
"clearDates": "Καθαρισμός ημερομηνίας",
|
||||
"fiscal": "Φορολογική εκτύπωση",
|
||||
"print": "Εκτύπωση",
|
||||
"holdForOptions": "Κρατήστε πατημένο για επιλογές",
|
||||
"titleShort": "Αρχ. Παραγγ.",
|
||||
"searchPlaceholder": "Τραπέζι, #παραγγελία, αντικείμενο…",
|
||||
"orderLine": "Παραγγελία #{{id}} · {{table}} · {{time}}",
|
||||
"retries_one": "{{count}} επανάληψη",
|
||||
"retries_other": "{{count}} επαναλήψεις",
|
||||
"printNow": "Εκτύπωση Τώρα",
|
||||
"pending": "Εκκρεμεί…",
|
||||
"failed": "Αποτυχία",
|
||||
"pendingRetries": "Εκκρεμεί ({{count}} επαν.)",
|
||||
"itemsShort": "{{count}} αντ.",
|
||||
"printProblems_one": "{{count}} παραγγελία με πρόβλημα εκτύπωσης",
|
||||
"printProblems_other": "{{count}} παραγγελίες με πρόβλημα εκτύπωσης",
|
||||
"printFailed": "Αποτυχημένη εκτύπωση",
|
||||
"printOk": "Επιτυχής εκτύπωση",
|
||||
"noneFound": "Δεν βρέθηκαν παραγγελίες",
|
||||
"noneThisShift": "Δεν υπάρχουν παραγγελίες σε αυτή τη βάρδια",
|
||||
"detailedView": "Λεπτομερής προβολή",
|
||||
"compactView": "Συμπαγής προβολή",
|
||||
"cancel": "Ακύρωση"
|
||||
},
|
||||
"shiftPage": {
|
||||
"none": "Δεν υπάρχει ενεργή βάρδια",
|
||||
"noneSub": "Ξεκινήστε βάρδια για να δείτε στατιστικά.",
|
||||
"onBreak": "Σε διάλειμμα",
|
||||
"start": "Έναρξη",
|
||||
"worked": "Ώρες Εργασίας",
|
||||
"startCash": "Αρχ. Μετρητά",
|
||||
"collected": "Είσπραξη",
|
||||
"toHandIn": "Παραδ. Ποσό",
|
||||
"toHandInSub": "Αρχ. + Είσπραξη",
|
||||
"openTables": "Ανοιχτά Τραπέζια",
|
||||
"openTablesSub": "τρέχουσες παραγγελίες",
|
||||
"items": "Είδη (ανοιχτά)",
|
||||
"breaks": "Διαλείμματα",
|
||||
"perHour": "Ανά Ώρα",
|
||||
"itemsShort": "Είδη",
|
||||
"now": "Τώρα",
|
||||
"breakSince": "από {{time}} · {{duration}} μέχρι τώρα",
|
||||
"breaksSub": "{{duration}} διαλείμματα",
|
||||
"totalSub": "{{duration}} σύνολο",
|
||||
"breaksCount": "Διαλείμματα ({{count}})"
|
||||
},
|
||||
"chat": {
|
||||
"group": "Ομάδα",
|
||||
"unknown": "Άγνωστος",
|
||||
"deleted": "Το μήνυμα διαγράφηκε",
|
||||
"noMessages": "Δεν υπάρχουν μηνύματα",
|
||||
"usersFailed": "Αποτυχία φόρτωσης χρηστών",
|
||||
"createFailed": "Σφάλμα δημιουργίας συνομιλίας",
|
||||
"groupFailed": "Σφάλμα δημιουργίας ομάδας",
|
||||
"new": "Νέα Συνομιλία",
|
||||
"newGroup": "Νέα Ομάδα",
|
||||
"noStaff": "Δεν υπάρχει άλλο προσωπικό",
|
||||
"groupName": "Όνομα Ομάδας",
|
||||
"groupNamePlaceholder": "π.χ. Βραδινή βάρδια",
|
||||
"next": "Επόμενο",
|
||||
"pickMembers": "Επιλογή Μελών",
|
||||
"startHint": "Πατήστε «Νέα Συνομιλία» για να ξεκινήσετε μια συζήτηση.",
|
||||
"now": "τώρα",
|
||||
"yesterday": "χθες",
|
||||
"creating": "Δημιουργία…",
|
||||
"createGroup": "Δημιουργία Ομάδας",
|
||||
"createGroupCount": "Δημιουργία Ομάδας ({{count}})",
|
||||
"groupLabel": "Ομάδα:",
|
||||
"leaveTitle": "Αποχώρηση από ομάδα;",
|
||||
"leaveBody": "Δεν θα λαμβάνετε πλέον μηνύματα από αυτή την ομάδα.",
|
||||
"leave": "Αποχώρηση",
|
||||
"conversation": "Συνομιλία",
|
||||
"loadingOlder": "Φόρτωση παλαιότερων…",
|
||||
"placeholder": "Γράψτε μήνυμα…",
|
||||
"today": "Σήμερα",
|
||||
"yesterdayCap": "Χθες",
|
||||
"members_one": "{{count}} μέλος",
|
||||
"members_other": "{{count}} μέλη",
|
||||
"emptyThread": "Δεν υπάρχουν μηνύματα ακόμα.",
|
||||
"sayHi": "Πείτε γεια!"
|
||||
},
|
||||
"offline": {
|
||||
"title": "Δεν υπάρχει σύνδεση",
|
||||
"body": "Δεν είναι δυνατή η επικοινωνία με το σύστημα. Ελέγξτε τη σύνδεση WiFi.",
|
||||
"notFound": "Ο server δεν βρέθηκε στο δίκτυο. Ελέγξτε ότι είναι αναμμένος, ή σαρώστε ξανά το QR από τον διαχειριστή.",
|
||||
"changeVenue": "Αλλαγή καταστήματος",
|
||||
"searching": "Αναζήτηση… {{done}}/{{total}}",
|
||||
"search": "Αναζήτηση server στο δίκτυο",
|
||||
"moved": "Ο server άλλαξε διεύθυνση",
|
||||
"reconnecting": "Επανασύνδεση…"
|
||||
},
|
||||
"refused": {
|
||||
"title": "Δεν στάλθηκαν",
|
||||
"body": "Τα παρακάτω πάρθηκαν χωρίς σύνδεση και ο server δεν τα δέχτηκε. Ελέγξτε τα τραπέζια.",
|
||||
"ok": "Το είδα",
|
||||
"oldFormat": "Παλιά μορφή παραγγελίας: προσθέστε το ξανά",
|
||||
"notAccepted": "Ο server δεν το δέχτηκε"
|
||||
},
|
||||
"notify": {
|
||||
"tables_one": "Τραπέζι: {{tables}}",
|
||||
"tables_other": "Τραπέζια: {{tables}}",
|
||||
"more_one": "+{{count}} ακόμα μήνυμα",
|
||||
"more_other": "+{{count}} ακόμα μηνύματα"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,773 @@
|
||||
{
|
||||
"common": {
|
||||
"loading": "Loading…",
|
||||
"refresh": "Refresh",
|
||||
"signOut": "Sign out",
|
||||
"close": "Close",
|
||||
"minutesShort": "{{m}}m",
|
||||
"hoursShort": "{{h}}h",
|
||||
"hoursMinutesShort": "{{h}}h {{m}}m",
|
||||
"change": "Change",
|
||||
"retry": "Try again",
|
||||
"total": "Total",
|
||||
"clear": "Clear",
|
||||
"ok": "OK",
|
||||
"cancel": "Cancel",
|
||||
"confirm": "Confirm",
|
||||
"back": "Back",
|
||||
"save": "Save",
|
||||
"apply": "Apply",
|
||||
"sure": "Are you sure?"
|
||||
},
|
||||
"gate": {
|
||||
"closedTitle": "The venue is closed",
|
||||
"closedBody": "There's no business day open.\nAsk a manager to open the day.",
|
||||
"waitingTitle": "Waiting for your shift to start",
|
||||
"waitingBody": "Ask a manager to start your shift.",
|
||||
"startFailed": "Couldn't start the shift",
|
||||
"welcome": "Welcome, {{name}}!",
|
||||
"startQuestion": "Start your shift?",
|
||||
"startingCash": "Starting cash (optional)",
|
||||
"starting": "Starting…",
|
||||
"startShift": "Start shift"
|
||||
},
|
||||
"nav": {
|
||||
"tables": "Tables",
|
||||
"activeOrders": "Active orders",
|
||||
"orders": "Orders",
|
||||
"messages": "Messages",
|
||||
"takeaway": "Takeaway",
|
||||
"shift": "Shift",
|
||||
"log": "Log",
|
||||
"takeawayDelivery": "Takeaway / Delivery",
|
||||
"shiftSummary": "Shift summary",
|
||||
"orderLog": "Order log",
|
||||
"settings": "Settings",
|
||||
"installApp": "Install the app",
|
||||
"chat": "Chat"
|
||||
},
|
||||
"shell": {
|
||||
"notifications": "Notifications",
|
||||
"noNotifications": "No notifications",
|
||||
"notificationTables": "Table: {{tables}}",
|
||||
"posSystem": "POS system",
|
||||
"navigation": "Navigation"
|
||||
},
|
||||
"menu": {
|
||||
"title": "User menu",
|
||||
"endShiftConfirm": "End your shift?",
|
||||
"shiftActive": "Shift active",
|
||||
"since": "Since {{time}}",
|
||||
"startingCash": "Starting cash: {{amount}}",
|
||||
"onBreakSince": "On a break since {{time}}",
|
||||
"endBreak": "End break",
|
||||
"break": "Break",
|
||||
"endShift": "End shift",
|
||||
"askManagerToEnd": "Ask a manager to end your shift",
|
||||
"venue": "Venue: {{name}}",
|
||||
"lightTheme": "Light theme",
|
||||
"darkTheme": "Dark theme",
|
||||
"lock": "Lock",
|
||||
"languageNotSaved": "Language changed on this phone, but it couldn't be saved to your profile."
|
||||
},
|
||||
"login": {
|
||||
"onShift": "On shift",
|
||||
"wrongPassword": "Wrong password",
|
||||
"wrongPin": "Wrong PIN",
|
||||
"tapOnly": "At this venue waiters sign in by tapping their name on the paired screens. That way of signing in doesn't work on a phone: ask a manager to change the sign-in method to PIN or password.",
|
||||
"whoAreYou": "Who are you?",
|
||||
"serverNotFound": "Can't find the server",
|
||||
"serverNotFoundBody": "Can't connect to the venue server. A shift can't start without a connection.",
|
||||
"noWaiters": "No waiters found",
|
||||
"username": "Username",
|
||||
"password": "Password",
|
||||
"signIn": "Sign in",
|
||||
"enterPin": "Enter your PIN"
|
||||
},
|
||||
"card": {
|
||||
"freeLower": "Free",
|
||||
"noItems": "No items",
|
||||
"free": "FREE",
|
||||
"open": "OPEN",
|
||||
"mine": "MINE",
|
||||
"paid": "PAID",
|
||||
"partlyPaid": "PART PAID",
|
||||
"waiters_one": "{{count}} waiter",
|
||||
"waiters_other": "{{count}} waiters",
|
||||
"allReady": "All ready to serve",
|
||||
"preparingCount": "{{count}} preparing",
|
||||
"readyCount": "{{count}} ready",
|
||||
"more": "+{{count}} more…"
|
||||
},
|
||||
"tables": {
|
||||
"quick": {
|
||||
"paid": "Paid",
|
||||
"due": "Due",
|
||||
"noOrder": "No open order",
|
||||
"openTable": "Open the table",
|
||||
"markAllServed": "Mark all as served",
|
||||
"cancelOrder": "Cancel order"
|
||||
},
|
||||
"filter": {
|
||||
"title": "Filters",
|
||||
"owner": "Assigned",
|
||||
"status": "Status",
|
||||
"all": "All",
|
||||
"mine": "Mine",
|
||||
"free": "Free",
|
||||
"open": "Open",
|
||||
"paid": "Paid",
|
||||
"zones": "Zones",
|
||||
"zonesSelected": "Zones ({{count}} selected)"
|
||||
},
|
||||
"offlineNoData": "Offline: nothing saved on this phone yet",
|
||||
"offlineNoDataBody": "Connect to the network once so the data is saved on the phone.",
|
||||
"cancelConfirmTitle": "Cancel the order?",
|
||||
"cancelConfirmBody": "All active items will be cancelled and a cancellation slip printed.",
|
||||
"actions": {
|
||||
"flags": "Table flags",
|
||||
"transfer": "Transfer",
|
||||
"merge": "Merge",
|
||||
"printSynopsis": "Print summary",
|
||||
"assignWaiter": "Assign a waiter"
|
||||
},
|
||||
"status": {
|
||||
"open": "Open",
|
||||
"partlyPaid": "Partly paid",
|
||||
"paid": "Paid",
|
||||
"free": "Free"
|
||||
},
|
||||
"pull": {
|
||||
"refreshing": "Refreshing…",
|
||||
"release": "Release to refresh",
|
||||
"pull": "Pull to refresh"
|
||||
}
|
||||
},
|
||||
"orders": {
|
||||
"filter": {
|
||||
"title": "Order filters",
|
||||
"view": "Show",
|
||||
"sort": "Sort",
|
||||
"mine": "Mine"
|
||||
},
|
||||
"none": "No orders",
|
||||
"open": "Open",
|
||||
"markServed": "Mark served",
|
||||
"newTakeaway": "+ New takeaway",
|
||||
"newDelivery": "+ New delivery",
|
||||
"chips": {
|
||||
"all": "All",
|
||||
"allShort": "All",
|
||||
"pending": "Pending",
|
||||
"pendingShort": "PEND",
|
||||
"preparing": "Preparing",
|
||||
"preparingShort": "PREP",
|
||||
"ready": "Ready",
|
||||
"readyShort": "READY",
|
||||
"partly": "Partly ready",
|
||||
"partlyShort": "PART"
|
||||
},
|
||||
"sort": {
|
||||
"time": "By order time",
|
||||
"latest": "By latest change",
|
||||
"kds": "Ready → Preparing → Pending"
|
||||
},
|
||||
"items_one": "{{count}} item",
|
||||
"items_other": "{{count}} items"
|
||||
},
|
||||
"kds": {
|
||||
"pending": "PENDING",
|
||||
"preparing": "PREPARING",
|
||||
"ready": "READY",
|
||||
"someReady": "{{done}}/{{total}} READY"
|
||||
},
|
||||
"settings": {
|
||||
"chips": {
|
||||
"title": "Order filter chips",
|
||||
"sub": "How the filters look on the Orders page.",
|
||||
"full": "Full text",
|
||||
"short": "Short text",
|
||||
"iconFull": "Icon + full text",
|
||||
"iconShort": "Icon + short text",
|
||||
"icon": "Icon only",
|
||||
"exIconFull": "⏳ Pending",
|
||||
"exIconShort": "⏳ PEND"
|
||||
},
|
||||
"density": {
|
||||
"title": "Table cards",
|
||||
"sub": "Choose how much each card shows.",
|
||||
"d1x1": "4 per row: name only",
|
||||
"d2x1": "2 per row: name + status",
|
||||
"d2x2": "2 per row: compact card",
|
||||
"d4x1": "1 per row: horizontal list",
|
||||
"d4x2": "1 per row: full card",
|
||||
"d4x3": "1 per row: card with the order list"
|
||||
},
|
||||
"kds": {
|
||||
"title": "Kitchen status",
|
||||
"sub": "How each order item's kitchen status is shown.",
|
||||
"badge": "Badge",
|
||||
"badgeDesc": "Text in a chip (PENDING, READY…)",
|
||||
"icon": "Icon",
|
||||
"iconDesc": "A small coloured icon: takes less room"
|
||||
},
|
||||
"itemLayout": {
|
||||
"title": "Order item layout",
|
||||
"sub": "How each item shows in a table's order list.",
|
||||
"compact": "Compact",
|
||||
"compactDesc": "One line: compact, less height",
|
||||
"expanded": "Expanded",
|
||||
"expandedDesc": "Two lines: name + kitchen status above, prices below",
|
||||
"full": "Fully detailed",
|
||||
"fullDesc": "Everything: name, prices, waiter, time, options"
|
||||
},
|
||||
"merge": {
|
||||
"title": "Keep the grouped view",
|
||||
"sub": "How long the chosen grouping of items is kept.",
|
||||
"off": "OFF",
|
||||
"offDesc": "Back to the default when you navigate",
|
||||
"perOrder": "KEEP PER ORDER",
|
||||
"perOrderDesc": "Kept until the order is closed",
|
||||
"global": "ALWAYS KEEP",
|
||||
"globalDesc": "The same choice for every table, always"
|
||||
},
|
||||
"theme": {
|
||||
"title": "Theme",
|
||||
"light": "Light",
|
||||
"dark": "Dark"
|
||||
},
|
||||
"popup": {
|
||||
"title": "Notification style",
|
||||
"sub": "When a pop-up banner appears for a new notification.",
|
||||
"all": "Pop up everything",
|
||||
"allDesc": "A pop-up for every notification (kitchen, messages, etc.)",
|
||||
"manager": "Pop up only a manager's messages",
|
||||
"managerDesc": "Kitchen notifications go to the bell without a pop-up.",
|
||||
"never": "Never pop up",
|
||||
"neverDesc": "No pop-ups. Open the bell to see them; they are then cleared."
|
||||
},
|
||||
"persist": {
|
||||
"title": "Pop-ups stay",
|
||||
"on": "Pop-ups stay until you tap OK.",
|
||||
"off": "Pop-ups close by themselves after 3 seconds and the notification is cleared when it arrives.",
|
||||
"label": "Pop-ups stay",
|
||||
"onDesc": "On: you close them yourself",
|
||||
"offDesc": "Off: they close after 3 s"
|
||||
},
|
||||
"summary": {
|
||||
"title": "Summary before sending",
|
||||
"sub": "Instead of sending at once, a summary of every product, choice and the order note is shown first.",
|
||||
"label": "Summary + send",
|
||||
"onDesc": "On: a summary is shown before sending",
|
||||
"offDesc": "Off: sent at once"
|
||||
},
|
||||
"paySafety": {
|
||||
"title": "Payment safety",
|
||||
"sub": "Adds one more confirmation step against accidental payments. If you still make a mistake, a manager can turn the payment back.",
|
||||
"off": "Off",
|
||||
"offDesc": "A single tap confirms the payment.",
|
||||
"second": "Second confirmation",
|
||||
"secondDesc": "After confirming the payment, one more safety window appears before it goes through.",
|
||||
"hold": "Press and hold",
|
||||
"holdDesc": "To confirm the payment, hold the button down for about a second."
|
||||
},
|
||||
"fav": {
|
||||
"title": "Favourite products",
|
||||
"none": "You haven't picked any favourites yet. Tap below to start.",
|
||||
"setup": "Set up favourites",
|
||||
"setupSub": "Pick products and change their order",
|
||||
"count_one": "{{count}} favourite on: shown as the first category when ordering.",
|
||||
"count_other": "{{count}} favourites on: shown as the first category when ordering."
|
||||
},
|
||||
"reset": {
|
||||
"title": "Reset",
|
||||
"sure": "Are you sure? This can't be undone.",
|
||||
"sub": "Deletes every favourite and puts the preferences back to their defaults.",
|
||||
"again": "Tap again to confirm",
|
||||
"all": "Reset everything",
|
||||
"allSub": "Favourites & settings"
|
||||
},
|
||||
"navStyle": {
|
||||
"title": "Navigation bar style",
|
||||
"sub": "How the navigation bar at the bottom of the screen looks.",
|
||||
"triple": "Three pills",
|
||||
"tripleDesc": "Always 3 buttons with an icon and text, pill shaped",
|
||||
"icons": "Icon bar",
|
||||
"iconsDesc": "Android style, 1–5 icons of your choice"
|
||||
},
|
||||
"triple": {
|
||||
"title": "Three-pill buttons",
|
||||
"sub": "Pick exactly 3 buttons and drag to change their order.",
|
||||
"count": "{{count}}/3 buttons on"
|
||||
},
|
||||
"available": "Available",
|
||||
"icons": {
|
||||
"title": "Icon bar items",
|
||||
"sub": "Pick the icons to show (1–5). Drag to change the order.",
|
||||
"count": "{{count}}/5 icons on"
|
||||
},
|
||||
"tabs": {
|
||||
"layout": "Layout",
|
||||
"operation": "Operation",
|
||||
"favorites": "Favourites"
|
||||
},
|
||||
"max": "maximum"
|
||||
},
|
||||
"venues": {
|
||||
"active": "ACTIVE",
|
||||
"removeLabel": "Remove",
|
||||
"placeholder": "e.g. 192.168.1.50",
|
||||
"failed": "Couldn't connect.",
|
||||
"removeActive": "Remove the active venue «{{name}}»? You will have to connect again.",
|
||||
"remove": "Remove the venue «{{name}}» from this phone?",
|
||||
"connectTitle": "Connect to a venue",
|
||||
"title": "Venues",
|
||||
"intro": "Scan the QR code from the manager or type the server's address. The phone must be on the venue's WiFi.",
|
||||
"scan": "Scan QR",
|
||||
"checking": "Checking…",
|
||||
"connect": "Connect"
|
||||
},
|
||||
"install": {
|
||||
"title": "The Xenia app",
|
||||
"download": "Download the app",
|
||||
"later": "Not now",
|
||||
"fast": "Opens at once",
|
||||
"fastText": "No loading in the browser, like any other app.",
|
||||
"wifi": "Copes with WiFi drops",
|
||||
"wifiText": "Keeps working when the connection drops for a moment.",
|
||||
"secure": "Secure connection",
|
||||
"secureText": "Encrypted link to the venue's server.",
|
||||
"noSetup": "Nothing to set up",
|
||||
"noSetupText": "Finds the server by itself and updates itself.",
|
||||
"step1": "Tap «Download the app».",
|
||||
"step2": "Open the file and allow the installation.",
|
||||
"step3": "Open Xenia and scan the venue's QR code again.",
|
||||
"intro": "Install the app for a faster, steadier experience."
|
||||
},
|
||||
"lock": {
|
||||
"locked": "Locked",
|
||||
"unlock": "Unlock",
|
||||
"signOutOther": "Sign out (another waiter)"
|
||||
},
|
||||
"update": {
|
||||
"available": "A new version is available",
|
||||
"update": "Update",
|
||||
"needsNewerApp": "The venue's server needs a newer version of the app."
|
||||
},
|
||||
"qr": {
|
||||
"aim": "Point at the QR code from the manager (Settings → General → WiFi waiters)",
|
||||
"denied": "Camera permission wasn't given. Allow it in the phone's settings or type the address.",
|
||||
"noCamera": "Couldn't turn the camera on. Type the address."
|
||||
},
|
||||
"favSetup": {
|
||||
"noOptions": "This product has no options, ingredients or preferences.",
|
||||
"all": "ALL",
|
||||
"favorites": "FAVOURITES ({{count}})",
|
||||
"personalOn": "Personal settings on",
|
||||
"managerDefaults": "Using the manager's settings",
|
||||
"pickIntro": "Choose which options show for this product on the tab",
|
||||
"pickOutro": "If you choose none, the manager's settings are used.",
|
||||
"saveCount": "Save ({{count}} options)",
|
||||
"options": "Favourite options",
|
||||
"none": "You haven't added any favourites yet.",
|
||||
"noneHow": "Go to the ALL tab and tap the heart next to a product."
|
||||
},
|
||||
"drawer": {
|
||||
"tabs": {
|
||||
"quick": "Quick options",
|
||||
"ingredients": "Ingredients",
|
||||
"prefs": "Preferences",
|
||||
"extrasTitle": "Extras",
|
||||
"note": "Note",
|
||||
"quickShort": "Quick",
|
||||
"extras": "Extras",
|
||||
"options": "Options",
|
||||
"price": "Price",
|
||||
"summary": "Summary",
|
||||
"quantity": "Quantity ({{unit}})"
|
||||
},
|
||||
"choose": "Choose",
|
||||
"chooseMany": "Choose (several)",
|
||||
"removed": "Removed",
|
||||
"remove": "Remove",
|
||||
"required": "Required",
|
||||
"choiceRequired": "— choose one",
|
||||
"empty": {
|
||||
"favorites": "No favourites for this product.",
|
||||
"quick": "No quick options.",
|
||||
"extras": "No extras.",
|
||||
"ingredients": "No ingredients.",
|
||||
"prefs": "No preferences."
|
||||
},
|
||||
"qty": {
|
||||
"quickPick": "QUICK PICK",
|
||||
"quickAdd": "QUICK ADD"
|
||||
},
|
||||
"price": {
|
||||
"intro": "Changes the price of this item only. Other orders aren't affected.",
|
||||
"base": "Base: {{price}}"
|
||||
},
|
||||
"notes": {
|
||||
"placeholder": "e.g. No salt, cut in half…",
|
||||
"quickTitle": "Quick notes",
|
||||
"noSalt": "No salt",
|
||||
"quick": "Bring it quickly",
|
||||
"allergy": "Allergy!",
|
||||
"smallPieces": "Cut into small pieces",
|
||||
"napkins": "Extra napkins"
|
||||
},
|
||||
"summary": {
|
||||
"empty": "Nothing changed yet. Use the tabs to set up the product.",
|
||||
"removed": "Removed"
|
||||
},
|
||||
"included": "Included",
|
||||
"selectedCount": "{{count}} selected",
|
||||
"each": "each",
|
||||
"without": "Without {{name}}"
|
||||
},
|
||||
"pairing": {
|
||||
"empty": "Type the server's address.",
|
||||
"invalid": "Not a valid address. Example: 192.168.1.50",
|
||||
"noServer": "No server found at this address. Check that the phone is on the venue's WiFi.",
|
||||
"refused": "The server refused the connection. The phone must be on the venue's WiFi.",
|
||||
"notXenia": "This address isn't a Xenia server.",
|
||||
"incompatible": "The server (version {{version}}) doesn't work with this app. Update the app or the server.",
|
||||
"otherVenue": "A different venue than the QR's answers at this address. Ask the manager for a new QR code.",
|
||||
"wrongKey": "The server's security key doesn't match the QR code. Ask the manager for a new QR code."
|
||||
},
|
||||
"detail": {
|
||||
"split": {
|
||||
"title": "Split",
|
||||
"howMany": "Split off how many?",
|
||||
"newLine": "New line:",
|
||||
"remains": "Remains:"
|
||||
},
|
||||
"price": {
|
||||
"title": "Set the price",
|
||||
"tapToType": "Tap to type",
|
||||
"reset": "Back to the original price",
|
||||
"base": "Base: {{base}} {{change}}"
|
||||
},
|
||||
"item": {
|
||||
"price": "Change the price",
|
||||
"priceSub": "Change the price of this item",
|
||||
"again": "Order again",
|
||||
"againSub": "Add to a new cart",
|
||||
"move": "Move to another table",
|
||||
"moveSub": "Move the selected items",
|
||||
"splitSub": "Split into two lines",
|
||||
"cancel": "Cancel",
|
||||
"cancelSub": "Cancel the selected items"
|
||||
},
|
||||
"withApproval": "With a manager's approval (PIN)",
|
||||
"cancelNotAllowed": "Cancelling is not allowed",
|
||||
"discount": {
|
||||
"pickOne": "Pick at least one item",
|
||||
"badPct": "Not a valid percentage",
|
||||
"failed": "Couldn't apply the discount",
|
||||
"rounding": "The final price is rounded to €0.10",
|
||||
"items": "Items",
|
||||
"pct": "Discount (%)",
|
||||
"note": "Note (optional)",
|
||||
"notePlaceholder": "e.g. VIP guest",
|
||||
"applying": "Applying…"
|
||||
},
|
||||
"actions": {
|
||||
"discount": "Apply a discount",
|
||||
"markAllServedSub": "Mark every ready item as served",
|
||||
"discountSub": "A discount on items of the order",
|
||||
"discountNotAllowed": "Discounts are not allowed",
|
||||
"transfer": "Transfer the table",
|
||||
"merge": "Merge tables",
|
||||
"mergeSub": "Merge with another table",
|
||||
"flagsSub": "Choose flags",
|
||||
"assignSub": "Add a waiter to the order",
|
||||
"printSub": "Print the order's summary",
|
||||
"cancelSub": "Cancel the whole order"
|
||||
},
|
||||
"noTables": "No tables available",
|
||||
"noFlags": "No flags",
|
||||
"allAssigned": "Every waiter is already assigned",
|
||||
"pickPrinter": "Choose a printer",
|
||||
"cancel": {
|
||||
"title": "Cancel the order?",
|
||||
"button": "Cancel ✕",
|
||||
"whole": "The whole order will be cancelled for good.",
|
||||
"items_one": "{{count}} item will be cancelled for good.",
|
||||
"items_other": "{{count}} items will be cancelled for good."
|
||||
},
|
||||
"guests": {
|
||||
"title": "Number of guests",
|
||||
"question": "How many people sit at the table?",
|
||||
"button": "Number of guests"
|
||||
},
|
||||
"err": {
|
||||
"load": "Couldn't load",
|
||||
"open": "Couldn't open",
|
||||
"offlinePay": "Couldn't save the offline payment",
|
||||
"pay": "Couldn't take the payment",
|
||||
"revert": "Couldn't turn the payment back",
|
||||
"close": "Couldn't close",
|
||||
"cancel": "Couldn't cancel",
|
||||
"cancelOrder": "Couldn't cancel the order",
|
||||
"mark": "Couldn't mark",
|
||||
"splitOffline": "Couldn't split offline",
|
||||
"split": "Couldn't split",
|
||||
"transfer": "Couldn't transfer",
|
||||
"noTargetOrder": "No order found on that table",
|
||||
"merge": "Couldn't merge",
|
||||
"moveItems": "Couldn't move the items",
|
||||
"flags": "Couldn't save the flags"
|
||||
},
|
||||
"openOrder": "Open an order",
|
||||
"noPaid": "No paid items",
|
||||
"revert": {
|
||||
"button": "UNDO",
|
||||
"title": "Turn the payment back?",
|
||||
"items_one": "{{count}} item goes back to unpaid.",
|
||||
"items_other": "{{count}} items go back to unpaid.",
|
||||
"confirm": "Turn back"
|
||||
},
|
||||
"notOffline": "Not available offline",
|
||||
"view": {
|
||||
"title": "How items are shown",
|
||||
"off": "AS ORDERED",
|
||||
"offDesc": "Exactly as they were ordered",
|
||||
"identical": "GROUP IDENTICAL",
|
||||
"identicalDesc": "Same product, same choices, same price",
|
||||
"sameItem": "GROUP ALL",
|
||||
"sameItemDesc": "Same product at the same final price"
|
||||
},
|
||||
"close": {
|
||||
"title": "Close the order?",
|
||||
"body": "This can't be undone."
|
||||
},
|
||||
"move": {
|
||||
"pickFree": "Choose a free table",
|
||||
"mergeSub": "The items move to the chosen table",
|
||||
"itemsTitle": "Move items",
|
||||
"subtitle_one": "Move {{count}} item to a table",
|
||||
"subtitle_other": "Move {{count}} items to a table",
|
||||
"confirmTransfer": "Confirm the transfer",
|
||||
"confirmMerge": "Confirm the merge",
|
||||
"confirmItems": "Confirm moving the items",
|
||||
"transferTo": "Move the order to table",
|
||||
"mergeWith": "Merge the order with table",
|
||||
"itemsTo_one": "Move {{count}} item to table",
|
||||
"itemsTo_other": "Move {{count}} items to table"
|
||||
},
|
||||
"selected_one": "{{count}} item selected",
|
||||
"selected_other": "{{count}} items selected",
|
||||
"pay": {
|
||||
"titleClose": "Confirm payment and close",
|
||||
"title": "Confirm payment",
|
||||
"allAndClose": "Every item: the table closes right after",
|
||||
"all": "Every item",
|
||||
"items_one": "{{count}} item",
|
||||
"items_other": "{{count}} items",
|
||||
"cash": "Cash",
|
||||
"card": "Card",
|
||||
"hold": "Hold…",
|
||||
"paid": "Paid",
|
||||
"yesPaid": "Yes, paid"
|
||||
},
|
||||
"tabs": {
|
||||
"unpaid": "Unpaid",
|
||||
"paid": "Paid"
|
||||
}
|
||||
},
|
||||
"add": {
|
||||
"course": {
|
||||
"title": "Set course",
|
||||
"sub": "Quick-add items will use this course.",
|
||||
"none": "No course"
|
||||
},
|
||||
"sendFailed": "Couldn't send: the order wasn't sent",
|
||||
"search": {
|
||||
"title": "Search",
|
||||
"type": "Type to search…",
|
||||
"placeholder": "Search for a product…",
|
||||
"none": "No products found for «{{query}}»"
|
||||
},
|
||||
"allCategories": "All categories",
|
||||
"order": "Order",
|
||||
"empty": "The order is empty.",
|
||||
"note": {
|
||||
"placeholder": "A note for the whole order…",
|
||||
"title": "Order note",
|
||||
"add": "Add an order note"
|
||||
},
|
||||
"deal": {
|
||||
"title": "Deal unlocked!",
|
||||
"freeProduct": "Free product:",
|
||||
"skip": "Skip",
|
||||
"pickFree_one": "Choose {{count}} free product",
|
||||
"pickFree_other": "Choose {{count}} free products",
|
||||
"remaining": "({{count}} more)",
|
||||
"addFree": "Add for free"
|
||||
},
|
||||
"inCart": "in the cart",
|
||||
"edit": "Edit",
|
||||
"optionGone": "«{{product}}»: «{{what}}» is not on the menu any more. Remove it and add it again.",
|
||||
"offlineSaveFailed": "Couldn't save the offline order",
|
||||
"totalEstimateOffline": "Total (estimate, offline)",
|
||||
"totalEstimate": "Total (estimate)",
|
||||
"withoutList": "Without: {{names}}",
|
||||
"newOrder": "New order",
|
||||
"add": "Add",
|
||||
"moreSeeAll": "+{{count}} more: see all →",
|
||||
"sending": "Sending…",
|
||||
"send": "SEND",
|
||||
"sendCount": "SEND ({{count}})",
|
||||
"summaryCount": "SUMMARY ({{count}})",
|
||||
"products_one": "{{count}} product",
|
||||
"products_other": "{{count}} products",
|
||||
"ack": {
|
||||
"offline": "Saved offline",
|
||||
"printing": "Sent: printing",
|
||||
"printed": "Printed"
|
||||
}
|
||||
},
|
||||
"summary": {
|
||||
"modifier": "Price rule",
|
||||
"discount": "Discount",
|
||||
"free": "Free",
|
||||
"freeCaps": "FREE",
|
||||
"notPrinted": "Not printed yet",
|
||||
"ordered": "Ordered",
|
||||
"paidAt": "Paid",
|
||||
"noItems": "No items",
|
||||
"due": "Due",
|
||||
"paidBadge": "Paid",
|
||||
"cancelledBadge": "Cancelled"
|
||||
},
|
||||
"picker": {
|
||||
"noService": "No service items",
|
||||
"noFavorites": "You don't have favourites yet.",
|
||||
"noProducts": "No products",
|
||||
"noTags": "No tags yet.",
|
||||
"noTagged": "No product has this tag.",
|
||||
"setToGuests_one": "Set to {{count}} guest",
|
||||
"setToGuests_other": "Set to {{count}} guests",
|
||||
"noCharge": "no charge",
|
||||
"noCategory": "No category",
|
||||
"categories": "Categories",
|
||||
"tags": "Tags"
|
||||
},
|
||||
"summaryModal": {
|
||||
"edit": "Edit",
|
||||
"title": "Order summary"
|
||||
},
|
||||
"log": {
|
||||
"printProblem": "Print problem",
|
||||
"cancelPrint": "Cancel printing",
|
||||
"ok": "Succeeded",
|
||||
"failedF": "Failed",
|
||||
"range": "Date / time range",
|
||||
"from": "From",
|
||||
"to": "To",
|
||||
"clearDates": "Clear the dates",
|
||||
"fiscal": "Fiscal receipt",
|
||||
"print": "Printing",
|
||||
"holdForOptions": "Press and hold for options",
|
||||
"titleShort": "Order log",
|
||||
"searchPlaceholder": "Table, #order, item…",
|
||||
"orderLine": "Order #{{id}} · {{table}} · {{time}}",
|
||||
"retries_one": "{{count}} retry",
|
||||
"retries_other": "{{count}} retries",
|
||||
"printNow": "Print now",
|
||||
"pending": "Pending…",
|
||||
"failed": "Failed",
|
||||
"pendingRetries": "Pending ({{count}} retries)",
|
||||
"itemsShort": "{{count}} it.",
|
||||
"printProblems_one": "{{count}} order with a print problem",
|
||||
"printProblems_other": "{{count}} orders with a print problem",
|
||||
"printFailed": "Printing failed",
|
||||
"printOk": "Printed",
|
||||
"noneFound": "No orders found",
|
||||
"noneThisShift": "No orders in this shift",
|
||||
"detailedView": "Detailed view",
|
||||
"compactView": "Compact view",
|
||||
"cancel": "Cancel"
|
||||
},
|
||||
"shiftPage": {
|
||||
"none": "No active shift",
|
||||
"noneSub": "Start a shift to see the numbers.",
|
||||
"onBreak": "On a break",
|
||||
"start": "Started",
|
||||
"worked": "Hours worked",
|
||||
"startCash": "Starting cash",
|
||||
"collected": "Collected",
|
||||
"toHandIn": "To hand in",
|
||||
"toHandInSub": "Start + collected",
|
||||
"openTables": "Open tables",
|
||||
"openTablesSub": "current orders",
|
||||
"items": "Items (open)",
|
||||
"breaks": "Breaks",
|
||||
"perHour": "Per hour",
|
||||
"itemsShort": "Items",
|
||||
"now": "Now",
|
||||
"breakSince": "since {{time}} · {{duration}} so far",
|
||||
"breaksSub": "{{duration}} breaks",
|
||||
"totalSub": "{{duration}} in all",
|
||||
"breaksCount": "Breaks ({{count}})"
|
||||
},
|
||||
"chat": {
|
||||
"group": "Group",
|
||||
"unknown": "Unknown",
|
||||
"deleted": "The message was deleted",
|
||||
"noMessages": "No messages",
|
||||
"usersFailed": "Couldn't load the staff",
|
||||
"createFailed": "Couldn't start the conversation",
|
||||
"groupFailed": "Couldn't create the group",
|
||||
"new": "New conversation",
|
||||
"newGroup": "New group",
|
||||
"noStaff": "No other staff",
|
||||
"groupName": "Group name",
|
||||
"groupNamePlaceholder": "e.g. Evening shift",
|
||||
"next": "Next",
|
||||
"pickMembers": "Choose members",
|
||||
"startHint": "Tap «New conversation» to start one.",
|
||||
"now": "now",
|
||||
"yesterday": "yesterday",
|
||||
"creating": "Creating…",
|
||||
"createGroup": "Create group",
|
||||
"createGroupCount": "Create group ({{count}})",
|
||||
"groupLabel": "Group:",
|
||||
"leaveTitle": "Leave the group?",
|
||||
"leaveBody": "You won't get messages from this group any more.",
|
||||
"leave": "Leave",
|
||||
"conversation": "Conversation",
|
||||
"loadingOlder": "Loading older messages…",
|
||||
"placeholder": "Write a message…",
|
||||
"today": "Today",
|
||||
"yesterdayCap": "Yesterday",
|
||||
"members_one": "{{count}} member",
|
||||
"members_other": "{{count}} members",
|
||||
"emptyThread": "No messages yet.",
|
||||
"sayHi": "Say hello!"
|
||||
},
|
||||
"offline": {
|
||||
"title": "No connection",
|
||||
"body": "Can't reach the system. Check the WiFi connection.",
|
||||
"notFound": "The server wasn't found on the network. Check that it's on, or scan the QR code from the manager again.",
|
||||
"changeVenue": "Change venue",
|
||||
"searching": "Searching… {{done}}/{{total}}",
|
||||
"search": "Search the network for the server",
|
||||
"moved": "The server changed address",
|
||||
"reconnecting": "Reconnecting…"
|
||||
},
|
||||
"refused": {
|
||||
"title": "Not sent",
|
||||
"body": "These were taken offline and the server didn't accept them. Check the tables.",
|
||||
"ok": "Got it",
|
||||
"oldFormat": "Old order format: add it again",
|
||||
"notAccepted": "The server didn't accept it"
|
||||
},
|
||||
"notify": {
|
||||
"tables_one": "Table: {{tables}}",
|
||||
"tables_other": "Tables: {{tables}}",
|
||||
"more_one": "+{{count}} more message",
|
||||
"more_other": "+{{count}} more messages"
|
||||
}
|
||||
}
|
||||
@@ -3,23 +3,25 @@
|
||||
// Namespaces: common (shared words, component labels), errors (backend error codes,
|
||||
// local_backend/core/errors.py; tests/errors.test.mjs keeps them complete), manager (the manager shell, 2.6), modules (module
|
||||
// names/descriptions/limits for staff; local_backend/tests/test_module_texts.py keeps them complete),
|
||||
// terminal (the terminal app, phase 3), dev (sample screens). The waiter adds its own in phase 4.
|
||||
// terminal (the terminal app, phase 3), waiter (the waiter app, plan step 4.5), dev (sample screens).
|
||||
import elCommon from '../locales/el/common.json'
|
||||
import elDev from '../locales/el/dev.json'
|
||||
import elErrors from '../locales/el/errors.json'
|
||||
import elManager from '../locales/el/manager.json'
|
||||
import elModules from '../locales/el/modules.json'
|
||||
import elTerminal from '../locales/el/terminal.json'
|
||||
import elWaiter from '../locales/el/waiter.json'
|
||||
import enCommon from '../locales/en/common.json'
|
||||
import enDev from '../locales/en/dev.json'
|
||||
import enErrors from '../locales/en/errors.json'
|
||||
import enManager from '../locales/en/manager.json'
|
||||
import enModules from '../locales/en/modules.json'
|
||||
import enTerminal from '../locales/en/terminal.json'
|
||||
import enWaiter from '../locales/en/waiter.json'
|
||||
|
||||
export const NAMESPACES = ['common', 'errors', 'manager', 'modules', 'terminal', 'dev']
|
||||
export const NAMESPACES = ['common', 'errors', 'manager', 'modules', 'terminal', 'waiter', 'dev']
|
||||
|
||||
export const resources = {
|
||||
en: { common: enCommon, errors: enErrors, manager: enManager, modules: enModules, terminal: enTerminal, dev: enDev },
|
||||
el: { common: elCommon, errors: elErrors, manager: elManager, modules: elModules, terminal: elTerminal, dev: elDev },
|
||||
en: { common: enCommon, errors: enErrors, manager: enManager, modules: enModules, terminal: enTerminal, waiter: enWaiter, dev: enDev },
|
||||
el: { common: elCommon, errors: elErrors, manager: elManager, modules: elModules, terminal: elTerminal, waiter: elWaiter, dev: elDev },
|
||||
}
|
||||
|
||||
+25
-23
@@ -54,28 +54,28 @@ async function basics() {
|
||||
let v = await freshApp()
|
||||
|
||||
await typeInto(v, `${H}:9999`)
|
||||
await tap(v, 'button', 'Σύνδεση')
|
||||
await tap(v, 'button', 'Connect')
|
||||
await sleep(6500)
|
||||
r.check('wrong address → "no server" error', (await v.evaluate('document.body.innerText')).includes('Δεν βρέθηκε server'))
|
||||
r.check('wrong address → "no server" error', (await v.evaluate('document.body.innerText')).includes('No server found'))
|
||||
|
||||
await typeInto(v, `http://${H}:8055/?pair=some-other-site`)
|
||||
await tap(v, 'button', 'Σύνδεση')
|
||||
await tap(v, 'button', 'Connect')
|
||||
await sleep(3000)
|
||||
r.check("another venue's QR → refused", (await v.evaluate('document.body.innerText')).includes('διαφορετικό κατάστημα'))
|
||||
r.check("another venue's QR → refused", (await v.evaluate('document.body.innerText')).includes('A different venue'))
|
||||
|
||||
await typeInto(v, `${H}:8055`)
|
||||
await tap(v, 'button', 'Σύνδεση')
|
||||
await tap(v, 'button', 'Connect')
|
||||
await sleep(5000)
|
||||
v = await attach()
|
||||
const st = await venuesState(v)
|
||||
r.check('pairing saves and activates the venue', st?.active === 'test-site-1' && st.venues['test-site-1'].baseUrl.includes(`${H}:`), JSON.stringify(st))
|
||||
r.check('login screen shows the venue + "Αλλαγή"', (await v.evaluate('document.body.innerText')).includes('Αλλαγή'))
|
||||
r.check('login screen shows the venue + "Change"', (await v.evaluate('document.body.innerText')).includes('Change'))
|
||||
|
||||
// 4.2: a real sign-in in the native app: pick your name, PIN on the pad, start the shift
|
||||
await fetch(`${b1.url}/api/business-day/open`, { method: 'POST', headers: { 'content-type': 'application/json', authorization: `Bearer ${token}` }, body: '{}' }).catch(() => {})
|
||||
await tap(v, '[data-testid="waiter-card"]', 'Κωνσταντίνου')
|
||||
for (const d of '3302') await tap(v, 'button.pin-btn', d)
|
||||
await tap(v, 'button', 'Έναρξη Βάρδιας', { timeout: 15_000 })
|
||||
await tap(v, 'button', 'Start shift', { timeout: 15_000 })
|
||||
await waitFor(() => v.evaluate("location.pathname === '/tables'"), 15_000, 500)
|
||||
await sleep(3000)
|
||||
r.check('signed in with name + PIN on the pad: /tables', (await v.evaluate('location.pathname')) === '/tables'
|
||||
@@ -86,7 +86,7 @@ async function basics() {
|
||||
|
||||
// 4.2: lock from the menu, unlock with the PIN on the pad (same session)
|
||||
const before = await v.evaluate("localStorage.getItem('xenia:test-site-1:token')")
|
||||
await tap(v, 'button[title="Μενού χρήστη"]')
|
||||
await tap(v, '[data-testid="user-menu"]')
|
||||
await tap(v, '[data-testid="menu-lock"]')
|
||||
const lockedOk = await waitFor(() => v.evaluate("!!document.querySelector('[data-testid=lock-screen]')"), 5000, 300)
|
||||
for (const d of '3302') await tap(v, '[data-testid="lock-screen"] button.pin-btn', d)
|
||||
@@ -102,9 +102,9 @@ async function basics() {
|
||||
r.check('restart: still paired and logged in', (await v.evaluate('location.pathname')) === '/tables')
|
||||
|
||||
// venues
|
||||
await tap(v, 'button[title="Μενού χρήστη"]')
|
||||
await tap(v, '[data-testid="user-menu"]')
|
||||
await sleep(600)
|
||||
await tap(v, 'button.user-menu-item', 'Κατάστημα')
|
||||
await tap(v, 'button.user-menu-item', 'Venue')
|
||||
await sleep(1200)
|
||||
r.check('user menu → /venues', (await v.evaluate('location.pathname')) === '/venues')
|
||||
back()
|
||||
@@ -113,14 +113,14 @@ async function basics() {
|
||||
await goTo(v, '/venues')
|
||||
await sleep(1000)
|
||||
await typeInto(v, `${H}:8056`)
|
||||
await tap(v, 'button', 'Σύνδεση')
|
||||
await tap(v, 'button', 'Connect')
|
||||
await sleep(5000)
|
||||
v = await attach()
|
||||
let vs = await venuesState(v)
|
||||
r.check('second venue paired and active', vs.active === 'test-site-2' && Object.keys(vs.venues).length === 2)
|
||||
const path2 = await v.evaluate('location.pathname')
|
||||
r.check('second venue starts logged out (own session)', path2 === '/login', `${path2} ${JSON.stringify(vs)}`)
|
||||
await tap(v, 'button', 'Αλλαγή')
|
||||
await tap(v, 'button', 'Change')
|
||||
await sleep(1200)
|
||||
await tap(v, 'button', `${H}:8055`)
|
||||
await sleep(5000)
|
||||
@@ -139,14 +139,14 @@ async function basics() {
|
||||
v = await relaunch()
|
||||
await goTo(v, '/venues')
|
||||
await sleep(1000)
|
||||
await tap(v, 'button', 'Σάρωση QR')
|
||||
await tap(v, 'button', 'Scan QR')
|
||||
await sleep(2500)
|
||||
r.check(`camera ${label}: permission prompt shown`, /GrantPermissions/.test(focusedWindow()))
|
||||
tapDialogButton(button)
|
||||
await sleep(label === 'deny' ? 2000 : 4000)
|
||||
if (label === 'deny') {
|
||||
r.check('camera deny: asked only once', !/GrantPermissions/.test(focusedWindow()))
|
||||
r.check('camera deny: explains the missing permission', (await v.evaluate('document.body.innerText')).includes('Δεν δόθηκε άδεια κάμερας'))
|
||||
r.check('camera deny: explains the missing permission', (await v.evaluate('document.body.innerText')).includes("Camera permission wasn't given"))
|
||||
} else {
|
||||
const video = await v.evaluate("(() => { const x = document.querySelector('video'); return { ready: x.readyState, w: x.videoWidth, paused: x.paused } })()")
|
||||
r.check('camera allow: live preview', video.ready >= 2 && video.w > 0 && !video.paused, JSON.stringify(video))
|
||||
@@ -219,8 +219,8 @@ async function rediscovery() {
|
||||
const offlineShown = await onScreen(async vv => (await vv.evaluate('location.pathname')) === '/offline', 45_000)
|
||||
r.check('server really down: saved address untouched', (await venuesState(v)).venues['test-site-1'].baseUrl.includes('.99:'))
|
||||
r.check('server really down: offline screen', !!offlineShown, await v.evaluate('location.pathname + " | " + document.body.innerText.slice(0, 200)').catch(e => String(e)))
|
||||
await v.evaluate("[...document.querySelectorAll('button')].find(e => e.textContent.includes('Αναζήτηση server')).click()")
|
||||
const notFound = await waitFor(async () => (await v.evaluate('document.body.innerText')).includes('Ο server δεν βρέθηκε'), 60_000)
|
||||
await v.evaluate("[...document.querySelectorAll('button')].find(e => e.textContent.includes('Search the network')).click()")
|
||||
const notFound = await waitFor(async () => (await v.evaluate('document.body.innerText')).includes("The server wasn't found"), 60_000)
|
||||
r.check('manual search ends with "not found" guidance', !!notFound)
|
||||
|
||||
// cold start while the server is down keeps the login
|
||||
@@ -272,11 +272,11 @@ server { listen 443 ssl; ssl_certificate /t/cert.pem; ssl_certificate_key /t/key
|
||||
// ── TLS ───────────────────────────────────────────────────────────────────
|
||||
let v = await freshApp()
|
||||
await typeInto(v, qr('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='))
|
||||
await tap(v, 'button', 'Σύνδεση')
|
||||
await tap(v, 'button', 'Connect')
|
||||
await sleep(4000)
|
||||
r.check('TLS: QR with a wrong key → refused', (await v.evaluate('document.body.innerText')).includes('κλειδί ασφαλείας'))
|
||||
r.check('TLS: QR with a wrong key → refused', (await v.evaluate('document.body.innerText')).includes('security key'))
|
||||
await typeInto(v, qr(pin))
|
||||
await tap(v, 'button', 'Σύνδεση')
|
||||
await tap(v, 'button', 'Connect')
|
||||
await sleep(6000)
|
||||
v = await attach()
|
||||
let ven = (await venuesState(v)).venues['test-site-1']
|
||||
@@ -344,7 +344,8 @@ server { listen 443 ssl; ssl_certificate /t/cert.pem; ssl_certificate_key /t/key
|
||||
|
||||
serve({ ...manifest, version: 'e2e-new-apk', min_shell_build: 99 })
|
||||
await bgAndBack(); await sleep(8000); v = await attach()
|
||||
r.check('bundles: needs a newer APK → skipped + banner', (await current()) === 'e2e-staged' && (await v.evaluate('document.body.innerText')).includes('νεότερη έκδοση της εφαρμογής'))
|
||||
const newer = { cur: await current(), text: await v.evaluate('document.body.innerText').catch(e => String(e)) }
|
||||
r.check('bundles: needs a newer APK → skipped + banner', newer.cur === 'e2e-staged' && newer.text.includes('needs a newer version of the app'), `${newer.cur} | ${newer.text.replace(/\s+/g, ' ').slice(0, 160)}`)
|
||||
|
||||
const broken = zipSync({ 'index.html': strToU8('<!doctype html><html><body><h1>broken bundle</h1></body></html>') })
|
||||
execFileSync('docker', ['exec', '-i', WAITER1, 'sh', '-c', `cat > ${DL}/waiter-bundle-broken.zip`], { input: Buffer.from(broken) })
|
||||
@@ -354,9 +355,10 @@ server { listen 443 ssl; ssl_certificate /t/cert.pem; ssl_certificate_key /t/key
|
||||
await bgAndBack()
|
||||
await waitFor(async () => { v = await attach(); return (await v.evaluate('document.body.innerText')).includes('broken bundle') }, 40_000, 1500)
|
||||
const rolledBack = await waitFor(async () => { v = await attach(); return (await current()) === 'e2e-staged' }, 60_000, 2000)
|
||||
r.check('bundles: broken bundle rolled back automatically', !!rolledBack)
|
||||
r.check('bundles: broken bundle rolled back automatically', !!rolledBack, String(await current()))
|
||||
await sleep(70000); await bgAndBack(); await sleep(12000); v = await attach()
|
||||
r.check('bundles: no retry loop, broken version blocklisted', (await current()) === 'e2e-staged' && (await v.evaluate("localStorage.getItem('xenia.bundleFailed') || ''")).includes('e2e-broken'))
|
||||
const after = { cur: await current(), failed: await v.evaluate("localStorage.getItem('xenia.bundleFailed') || ''").catch(e => String(e)) }
|
||||
r.check('bundles: no retry loop, broken version blocklisted', after.cur === 'e2e-staged' && after.failed.includes('e2e-broken'), JSON.stringify(after))
|
||||
serve(manifest)
|
||||
|
||||
// ── two venues, each on its own bundle ─────────────────────────────────────
|
||||
@@ -366,7 +368,7 @@ server { listen 443 ssl; ssl_certificate /t/cert.pem; ssl_certificate_key /t/key
|
||||
v = await attach()
|
||||
await goTo(v, '/venues'); await sleep(1200)
|
||||
await typeInto(v, `http://${H}:28080/?${new URLSearchParams({ pair: 'test-site-2', k: pin2 })}`)
|
||||
await tap(v, 'button', 'Σύνδεση')
|
||||
await tap(v, 'button', 'Connect')
|
||||
v.close()
|
||||
let s = await waitFor(async () => { const st = await state(); return st.active === 'test-site-2' && st.current === m2.version && st }, 90_000, 2000)
|
||||
r.check('bundles: pairing venue 2 → venue 2 bundle', !!s)
|
||||
|
||||
@@ -75,7 +75,7 @@ try {
|
||||
// ── Install-app dialog + drawer entry ─────────────────────────────────────
|
||||
const r2 = reporter('browser: install-app dialog')
|
||||
const phone = ua => browser.newContext({ userAgent: ua, viewport: { width: 393, height: 852 }, deviceScaleFactor: 2.75, isMobile: true, hasTouch: true })
|
||||
const dialog = page => page.getByRole('dialog', { name: 'Εφαρμογή Xenia' })
|
||||
const dialog = page => page.getByRole('dialog', { name: 'The Xenia app' })
|
||||
const hamburger = page => page.locator('button').filter({ has: page.locator('svg') }).first()
|
||||
|
||||
let ctx = await phone(ANDROID_UA)
|
||||
@@ -85,21 +85,21 @@ try {
|
||||
r2.check('first visit on Android: dialog opens by itself', await dialog(page).isVisible())
|
||||
const box = await dialog(page).boundingBox()
|
||||
r2.check('dialog is taller than wide', box && box.height > box.width, box ? `${Math.round(box.width)}×${Math.round(box.height)}` : '')
|
||||
r2.check('download link points at the APK', (await page.getByRole('link', { name: 'Λήψη εφαρμογής' }).getAttribute('href')) === '/downloads/xenia-waiter.apk')
|
||||
r2.check('download link points at the APK', (await page.getByRole('link', { name: 'Download the app' }).getAttribute('href')) === '/downloads/xenia-waiter.apk')
|
||||
await page.screenshot({ path: path.join(OUT, 'install-dialog.png') })
|
||||
await page.getByRole('button', { name: 'Όχι τώρα' }).click()
|
||||
await page.getByRole('button', { name: 'Not now' }).click()
|
||||
await sleep(400)
|
||||
await page.reload()
|
||||
await sleep(3500)
|
||||
r2.check('"Όχι τώρα" → never opens by itself again', !(await dialog(page).isVisible()))
|
||||
r2.check('"Not now" → never opens by itself again', !(await dialog(page).isVisible()))
|
||||
await page.evaluate(t => localStorage.setItem('token', t), token)
|
||||
await page.goto(`http://${LAN}:15173/tables`)
|
||||
await sleep(4000)
|
||||
await hamburger(page).click()
|
||||
await sleep(600)
|
||||
const install = page.getByRole('button', { name: 'Εγκατάσταση εφαρμογής' })
|
||||
const install = page.getByRole('button', { name: 'Install the app' })
|
||||
const [ib, sb] = [await install.boundingBox(), await page.getByRole('button', { name: 'Settings' }).boundingBox()]
|
||||
r2.check('drawer shows "Εγκατάσταση εφαρμογής" right above Settings', !!(ib && sb && ib.y < sb.y && sb.y - ib.y < 80))
|
||||
r2.check('drawer shows "Install the app" right above Settings', !!(ib && sb && ib.y < sb.y && sb.y - ib.y < 80))
|
||||
await install.click()
|
||||
await sleep(500)
|
||||
r2.check('drawer entry reopens the dialog', await dialog(page).isVisible())
|
||||
@@ -115,7 +115,7 @@ try {
|
||||
const noDialog = !(await dialog(page).isVisible())
|
||||
await hamburger(page).click()
|
||||
await sleep(500)
|
||||
r2.check(`${label}: never offered (no dialog, no drawer entry)`, noDialog && !(await page.getByRole('button', { name: 'Εγκατάσταση εφαρμογής' }).isVisible()))
|
||||
r2.check(`${label}: never offered (no dialog, no drawer entry)`, noDialog && !(await page.getByRole('button', { name: 'Install the app' }).isVisible()))
|
||||
await ctx.close()
|
||||
}
|
||||
ctx = await phone(ANDROID_UA)
|
||||
|
||||
+29
-12
@@ -15,7 +15,7 @@ const vite = await startViteNative({ port: 5181, backendUrl: backend.url })
|
||||
const APP = 'http://localhost:5181'
|
||||
const TOKEN_KEY = 'xenia:dev:token'
|
||||
const browser = await chromium.launch(BROWSER_CHANNEL ? { channel: BROWSER_CHANNEL } : {})
|
||||
const r = reporter('waiter: sign-in v2, lock, approvals (4.2), keys (4.3), server prices (4.4)')
|
||||
const r = reporter('waiter: sign-in v2, lock, approvals (4.2), keys (4.3), server prices (4.4), languages (4.5)')
|
||||
const errors = []
|
||||
let failures = 0
|
||||
|
||||
@@ -77,7 +77,7 @@ try {
|
||||
r.check('the session is a "waiter" session', sessions.some(s => s.username === 'demo_maria' && s.client === 'waiter'), JSON.stringify(sessions.map(s => [s.username, s.client])))
|
||||
|
||||
// start the shift on the phone (the gate after sign-in)
|
||||
await a.getByRole('button', { name: /Έναρξη Βάρδιας/ }).click({ timeout: 10_000 }).catch(() => {})
|
||||
await a.getByRole('button', { name: /Start shift/ }).click({ timeout: 10_000 }).catch(() => {})
|
||||
await a.waitForURL(u => u.pathname.startsWith('/tables'), { timeout: 10_000 }).catch(() => {})
|
||||
await sleep(1500)
|
||||
|
||||
@@ -94,7 +94,7 @@ try {
|
||||
// ── Lock from the menu, wrong PIN, right PIN (same session) ────────────────
|
||||
await a.getByRole('button', { name: 'demo_maria' }).first().click({ timeout: 10_000 })
|
||||
await a.getByTestId('menu-lock').click()
|
||||
r.check('menu "Κλείδωμα" locks the phone', await shown(a, 'lock-screen', 5000))
|
||||
r.check('menu "Lock" locks the phone', await shown(a, 'lock-screen', 5000))
|
||||
await a.reload()
|
||||
r.check('still locked after the app is reopened', await shown(a, 'lock-screen', 10_000))
|
||||
await pin(a, '0000')
|
||||
@@ -132,9 +132,9 @@ try {
|
||||
await sleep(800)
|
||||
const sheet = await a.locator('.modal-sheet--top').innerText().catch(() => '')
|
||||
r.check('4.3: the actions follow the keys (transfer yes, discount hidden, cancel "with a manager\'s PIN")',
|
||||
sheet.includes('Μεταφορά Τραπεζιού') && !sheet.includes('Εφαρμογή Έκπτωσης') && sheet.includes('Με έγκριση διαχειριστή'), sheet.replace(/\s+/g, ' ').slice(0, 300))
|
||||
await a.getByText('Ακύρωση Παραγγελίας', { exact: true }).click()
|
||||
await a.getByRole('button', { name: 'Ακύρωση ✕' }).click()
|
||||
sheet.includes('Transfer the table') && !sheet.includes('Apply a discount') && sheet.includes("With a manager's approval"), sheet.replace(/\s+/g, ' ').slice(0, 300))
|
||||
await a.getByText('Cancel order', { exact: true }).click()
|
||||
await a.getByRole('button', { name: 'Cancel ✕' }).click()
|
||||
const dlg = a.getByRole('dialog')
|
||||
await dlg.waitFor({ timeout: 10_000 }).catch(() => {})
|
||||
r.check('4.3: cancelling from the screen opens the approval dialog', await a.getByTestId('override-key').textContent().catch(() => '') === 'ordering.orders.cancel')
|
||||
@@ -192,10 +192,10 @@ try {
|
||||
const exact = await waitFor(async () => await total().getAttribute('data-estimated') === 'false', 10_000, 300)
|
||||
const shownTotal = await total().innerText().catch(() => '')
|
||||
r.check('4.4: the cart total is the server\'s price (a price the phone\'s menu doesn\'t know)', !!exact && shownTotal.includes('2.40'), shownTotal.replace(/\s+/g, ' '))
|
||||
await a.getByRole('button', { name: /^(ΑΠΟΣΤΟΛΗ|ΣΥΝΟΨΗ)/ }).last().click()
|
||||
await a.getByRole('button', { name: /^(SEND|SUMMARY)/ }).last().click()
|
||||
if (await shown(a, 'summary-total', 3000)) {
|
||||
r.check('4.4: the summary shows the same total', (await a.getByTestId('summary-total').innerText()).includes('2.40'))
|
||||
await a.getByRole('button', { name: /ΑΠΟΣΤΟΛΗ/ }).last().click()
|
||||
await a.getByRole('button', { name: /SEND/ }).last().click()
|
||||
}
|
||||
const sent = await waitFor(async () => {
|
||||
const st = await api('GET', `/api/tables/${t4.id}/status`, { token: boss })
|
||||
@@ -212,7 +212,7 @@ try {
|
||||
await addOn(t5.id, plain)
|
||||
await ctxA.setOffline(true)
|
||||
await a.getByTestId('cart-open').click()
|
||||
const wentOffline = await waitFor(async () => (await total().innerText().catch(() => '')).includes('χωρίς σύνδεση'), 30_000, 1000)
|
||||
const wentOffline = await waitFor(async () => (await total().innerText().catch(() => '')).includes('offline'), 30_000, 1000)
|
||||
const est = await total().getAttribute('data-estimated').catch(() => null)
|
||||
r.check('4.4: offline the cart total is an estimate (≈, the menu prices)', !!wentOffline && est === 'true'
|
||||
&& (await total().innerText()).includes('≈'), `${wentOffline} ${est} ${await total().innerText().catch(() => '')}`)
|
||||
@@ -220,8 +220,8 @@ try {
|
||||
await sleep(500)
|
||||
await addOn(t5.id, other)
|
||||
await a.getByTestId('cart-open').click()
|
||||
await a.getByRole('button', { name: /^(ΑΠΟΣΤΟΛΗ|ΣΥΝΟΨΗ)/ }).last().click()
|
||||
if (await shown(a, 'summary-total', 3000)) await a.getByRole('button', { name: /ΑΠΟΣΤΟΛΗ/ }).last().click()
|
||||
await a.getByRole('button', { name: /^(SEND|SUMMARY)/ }).last().click()
|
||||
if (await shown(a, 'summary-total', 3000)) await a.getByRole('button', { name: /SEND/ }).last().click()
|
||||
await sleep(2000)
|
||||
await api('PUT', `/api/products/${other.id}`, { token: boss, body: { is_available: false } })
|
||||
await ctxA.setOffline(false)
|
||||
@@ -244,9 +244,26 @@ try {
|
||||
for (const o of [sent, synced]) if (o) await api('DELETE', `/api/orders/${o.id}`, { token: boss }).catch(() => {})
|
||||
await a.goto(`${APP}/tables`)
|
||||
|
||||
// ── 4.5: English first; the language switch in the user menu, saved to the person ──
|
||||
const navText = () => a.locator('body').innerText()
|
||||
await a.goto(`${APP}/tables`)
|
||||
await a.locator('.table-card, [data-testid="user-menu"]').first().waitFor({ timeout: 10_000 }).catch(() => {})
|
||||
r.check('4.5: the phone runs in English (the venue language; the demo data stays Greek)', (await navText()).includes('Tables') && !(await navText()).includes('Τραπέζια'), (await navText()).replace(/\s+/g, ' ').slice(0, 300))
|
||||
await a.getByRole('button', { name: 'demo_maria' }).first().click({ timeout: 10_000 })
|
||||
await a.getByTestId('menu-language-el').click()
|
||||
const greek = await waitFor(async () => (await navText()).includes('Τραπέζια'), 8000, 300)
|
||||
const me = await api('GET', '/api/auth/me', { token: tokenA })
|
||||
r.check('4.5: menu → Ελληνικά: the screen turns Greek at once and it is saved for the person', !!greek && me.language === 'el', me.language)
|
||||
await a.reload()
|
||||
r.check('4.5: …still Greek after a reload', !!(await waitFor(async () => (await navText()).includes('Τραπέζια'), 15_000, 500)))
|
||||
await a.screenshot({ path: path.join(OUT, 'waiter-greek.png') })
|
||||
await a.getByRole('button', { name: 'demo_maria' }).first().click({ timeout: 10_000 })
|
||||
await a.getByTestId('menu-language-en').click()
|
||||
await waitFor(async () => (await navText()).includes('Tables'), 8000, 300)
|
||||
|
||||
// ── Signing out ends the session on the server: the second phone can sign in ─
|
||||
await a.getByRole('button', { name: 'demo_maria' }).first().click({ timeout: 10_000 })
|
||||
await a.getByRole('button', { name: /Αποσύνδεση/ }).last().click()
|
||||
await a.getByRole('button', { name: /Sign out/ }).last().click()
|
||||
await a.waitForURL(u => u.pathname === '/login', { timeout: 10_000 }).catch(() => {})
|
||||
await sleep(1000)
|
||||
const after = await api('GET', '/api/auth/sessions', { token: boss })
|
||||
|
||||
+20
-15
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'
|
||||
import { BrowserRouter, Routes, Route, Navigate, Outlet, useNavigate } from 'react-router-dom'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { AccessProvider, useAccess, useCan, useModule } from '@xenia/access'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
import { i18n } from './i18n'
|
||||
import useAuthStore from './store/authStore'
|
||||
import useShiftStore from './store/shiftStore'
|
||||
@@ -40,6 +41,7 @@ import { deliveryMode, getActiveVenue } from './config/server'
|
||||
// ─── Utility ─────────────────────────────────────────────────────────────────
|
||||
|
||||
function Spinner() {
|
||||
const { t } = useTranslation('waiter')
|
||||
return (
|
||||
<div className="page page--centered" style={{ gap: 12 }}>
|
||||
<div style={{
|
||||
@@ -49,7 +51,7 @@ function Spinner() {
|
||||
borderRadius: '50%',
|
||||
animation: 'gate-spin 0.7s linear infinite',
|
||||
}} />
|
||||
<span style={{ color: 'var(--muted)', fontSize: 14 }}>Φόρτωση…</span>
|
||||
<span style={{ color: 'var(--muted)', fontSize: 14 }}>{t('common.loading')}</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -84,30 +86,33 @@ function GateBtn({ onClick, disabled, variant = 'primary', children }) {
|
||||
}
|
||||
|
||||
function ClosedScreen({ onRefresh, onLogout }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
return (
|
||||
<GateCard emoji="🔒" title="Εστιατόριο κλειστό"
|
||||
subtitle={'Δεν υπάρχει ενεργή ημέρα λειτουργίας.\nΖητήστε από τον διαχειριστή να ανοίξει την ημέρα.'}>
|
||||
<GateCard emoji="🔒" title={t('gate.closedTitle')}
|
||||
subtitle={t('gate.closedBody')}>
|
||||
<div style={{ display: 'flex', gap: 12 }}>
|
||||
<GateBtn variant="secondary" onClick={onRefresh}>Ανανέωση</GateBtn>
|
||||
<GateBtn variant="danger" onClick={onLogout}>Αποσύνδεση</GateBtn>
|
||||
<GateBtn variant="secondary" onClick={onRefresh}>{t('common.refresh')}</GateBtn>
|
||||
<GateBtn variant="danger" onClick={onLogout}>{t('common.signOut')}</GateBtn>
|
||||
</div>
|
||||
</GateCard>
|
||||
)
|
||||
}
|
||||
|
||||
function WaitingManagerScreen({ onRefresh, onLogout }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
return (
|
||||
<GateCard emoji="⏳" title="Αναμονή για έναρξη βάρδιας"
|
||||
subtitle="Ζητήστε από τον διαχειριστή να ξεκινήσει τη βάρδια σας.">
|
||||
<GateCard emoji="⏳" title={t('gate.waitingTitle')}
|
||||
subtitle={t('gate.waitingBody')}>
|
||||
<div style={{ display: 'flex', gap: 12 }}>
|
||||
<GateBtn variant="secondary" onClick={onRefresh}>Ανανέωση</GateBtn>
|
||||
<GateBtn variant="danger" onClick={onLogout}>Αποσύνδεση</GateBtn>
|
||||
<GateBtn variant="secondary" onClick={onRefresh}>{t('common.refresh')}</GateBtn>
|
||||
<GateBtn variant="danger" onClick={onLogout}>{t('common.signOut')}</GateBtn>
|
||||
</div>
|
||||
</GateCard>
|
||||
)
|
||||
}
|
||||
|
||||
function StartShiftScreen({ username, onStart, onLogout }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [startingCash, setStartingCash] = useState('')
|
||||
const [starting, setStarting] = useState(false)
|
||||
const [error, setError] = useState(null)
|
||||
@@ -118,14 +123,14 @@ function StartShiftScreen({ username, onStart, onLogout }) {
|
||||
try {
|
||||
await onStart(startingCash ? parseFloat(startingCash) : null)
|
||||
} catch (e) {
|
||||
setError(apiError(e, 'Σφάλμα εκκίνησης βάρδιας'))
|
||||
setError(apiError(e, t('gate.startFailed')))
|
||||
setStarting(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<GateCard emoji="👋" title={`Καλώς ήρθες, ${username}!`}
|
||||
subtitle="Θέλεις να ξεκινήσεις τη βάρδια σου;">
|
||||
<GateCard emoji="👋" title={t('gate.welcome', { name: username })}
|
||||
subtitle={t('gate.startQuestion')}>
|
||||
<div style={{
|
||||
width: '100%', maxWidth: 320,
|
||||
background: 'var(--bg2)', border: '1px solid var(--border)',
|
||||
@@ -134,7 +139,7 @@ function StartShiftScreen({ username, onStart, onLogout }) {
|
||||
}}>
|
||||
<div>
|
||||
<label style={{ fontSize: 13, fontWeight: 600, color: 'var(--muted)', display: 'block', marginBottom: 6 }}>
|
||||
Αρχικά μετρητά (προαιρετικό)
|
||||
{t('gate.startingCash')}
|
||||
</label>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||
<span style={{ color: 'var(--muted)', fontWeight: 700 }}>€</span>
|
||||
@@ -160,7 +165,7 @@ function StartShiftScreen({ username, onStart, onLogout }) {
|
||||
)}
|
||||
|
||||
<GateBtn onClick={handleStart} disabled={starting}>
|
||||
{starting ? 'Εκκίνηση…' : '▶ Έναρξη Βάρδιας'}
|
||||
{starting ? t('gate.starting') : `▶ ${t('gate.startShift')}`}
|
||||
</GateBtn>
|
||||
</div>
|
||||
|
||||
@@ -168,7 +173,7 @@ function StartShiftScreen({ username, onStart, onLogout }) {
|
||||
style={{ fontSize: 13, color: 'var(--muted)', background: 'none', border: 'none', cursor: 'pointer' }}
|
||||
onClick={onLogout}
|
||||
>
|
||||
Αποσύνδεση
|
||||
{t('common.signOut')}
|
||||
</button>
|
||||
</GateCard>
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useNavigate, useLocation } from 'react-router-dom'
|
||||
import { useCan, useModule } from '@xenia/access'
|
||||
import { useFormat, useTranslation } from '@xenia/i18n'
|
||||
import UserMenu from './UserMenu'
|
||||
import { useNotifications } from '../context/NotificationContext'
|
||||
import useNotificationSettingsStore from '../store/notificationSettingsStore'
|
||||
@@ -16,8 +17,8 @@ import useFailedPrintCount from '../hooks/useFailedPrintCount'
|
||||
const NAV_REGISTRY = {
|
||||
tables: {
|
||||
key: 'tables',
|
||||
label: 'Τραπέζια',
|
||||
shortLabel: 'Τραπέζια',
|
||||
label: 'nav.tables',
|
||||
shortLabel: 'nav.tables',
|
||||
href: '/tables?tab=tables',
|
||||
match: (loc) => loc.pathname === '/tables' && loc.search !== '?tab=orders',
|
||||
icon: (
|
||||
@@ -31,8 +32,8 @@ const NAV_REGISTRY = {
|
||||
},
|
||||
orders: {
|
||||
key: 'orders',
|
||||
label: 'Ενεργές Παραγγελίες',
|
||||
shortLabel: 'Παραγγελίες',
|
||||
label: 'nav.activeOrders',
|
||||
shortLabel: 'nav.orders',
|
||||
href: '/tables?tab=orders',
|
||||
match: (loc) => loc.pathname === '/tables' && loc.search === '?tab=orders',
|
||||
icon: (
|
||||
@@ -44,8 +45,8 @@ const NAV_REGISTRY = {
|
||||
},
|
||||
messages: {
|
||||
key: 'messages',
|
||||
label: 'Μηνύματα',
|
||||
shortLabel: 'Μηνύματα',
|
||||
label: 'nav.messages',
|
||||
shortLabel: 'nav.messages',
|
||||
href: '/messages',
|
||||
match: (loc) => loc.pathname === '/messages',
|
||||
icon: (
|
||||
@@ -56,8 +57,8 @@ const NAV_REGISTRY = {
|
||||
},
|
||||
standalone: {
|
||||
key: 'standalone',
|
||||
label: 'Takeaway',
|
||||
shortLabel: 'Takeaway',
|
||||
label: 'nav.takeaway',
|
||||
shortLabel: 'nav.takeaway',
|
||||
href: '/tables',
|
||||
match: () => false,
|
||||
icon: (
|
||||
@@ -70,8 +71,8 @@ const NAV_REGISTRY = {
|
||||
},
|
||||
'shift-overview': {
|
||||
key: 'shift-overview',
|
||||
label: 'Βάρδια',
|
||||
shortLabel: 'Βάρδια',
|
||||
label: 'nav.shift',
|
||||
shortLabel: 'nav.shift',
|
||||
href: '/shift-overview',
|
||||
match: (loc) => loc.pathname === '/shift-overview',
|
||||
icon: (
|
||||
@@ -83,8 +84,8 @@ const NAV_REGISTRY = {
|
||||
},
|
||||
'order-log': {
|
||||
key: 'order-log',
|
||||
label: 'Αρχείο',
|
||||
shortLabel: 'Αρχείο',
|
||||
label: 'nav.log',
|
||||
shortLabel: 'nav.log',
|
||||
href: '/order-log',
|
||||
match: (loc) => loc.pathname === '/order-log',
|
||||
icon: (
|
||||
@@ -206,14 +207,16 @@ function BellButton({ onClick, count }) {
|
||||
// ─── Notification drawer ──────────────────────────────────────────────────────
|
||||
|
||||
function NotificationDrawer({ messages, onClose }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { formatTime } = useFormat()
|
||||
return (
|
||||
<div className="modal-overlay" onClick={onClose}>
|
||||
<div className="modal-sheet" onClick={e => e.stopPropagation()} style={{ maxHeight: '80svh' }}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title" style={{ marginBottom: 8 }}>Ειδοποιήσεις</h2>
|
||||
<h2 className="modal-title" style={{ marginBottom: 8 }}>{t('shell.notifications')}</h2>
|
||||
{messages.length === 0 && (
|
||||
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: '24px 0' }}>
|
||||
Δεν υπάρχουν ειδοποιήσεις
|
||||
{t('shell.noNotifications')}
|
||||
</p>
|
||||
)}
|
||||
<div style={{ display: 'flex', flexDirection: 'column', overflowY: 'auto', flex: 1 }}>
|
||||
@@ -231,17 +234,17 @@ function NotificationDrawer({ messages, onClose }) {
|
||||
)}
|
||||
<div style={{ fontSize: 14, fontWeight: 600, color: 'var(--text)' }}>{msg.body}</div>
|
||||
{tableIds.length > 0 && (
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>Τραπέζι: {tableIds.join(', ')}</div>
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>{t('shell.notificationTables', { tables: tableIds.join(', ') })}</div>
|
||||
)}
|
||||
<div style={{ fontSize: 11, color: 'var(--muted)', marginTop: 2 }}>
|
||||
{new Date(msg.created_at).toLocaleTimeString('el-GR', { hour: '2-digit', minute: '2-digit' })}
|
||||
{formatTime(msg.created_at)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
<button className="btn btn--secondary" style={{ width: '100%', marginTop: 4 }} onClick={onClose}>Κλείσιμο</button>
|
||||
<button className="btn btn--secondary" style={{ width: '100%', marginTop: 4 }} onClick={onClose}>{t('common.close')}</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -253,7 +256,7 @@ const DRAWER_NAV_ITEMS = [
|
||||
{ ...NAV_REGISTRY.tables },
|
||||
{
|
||||
key: 'standalone',
|
||||
label: 'Takeaway / Delivery',
|
||||
label: 'nav.takeawayDelivery',
|
||||
href: '/tables',
|
||||
match: () => false, // active state handled separately in SideDrawer
|
||||
icon: (
|
||||
@@ -268,7 +271,7 @@ const DRAWER_NAV_ITEMS = [
|
||||
{ ...NAV_REGISTRY.messages },
|
||||
{
|
||||
key: 'shift-overview',
|
||||
label: 'Σύνοψη Βάρδιας',
|
||||
label: 'nav.shiftSummary',
|
||||
href: '/shift-overview',
|
||||
match: (loc) => loc.pathname === '/shift-overview',
|
||||
icon: (
|
||||
@@ -280,7 +283,7 @@ const DRAWER_NAV_ITEMS = [
|
||||
},
|
||||
{
|
||||
key: 'order-log',
|
||||
label: 'Αρχείο Παραγγελιών',
|
||||
label: 'nav.orderLog',
|
||||
href: '/order-log',
|
||||
match: (loc) => loc.pathname === '/order-log',
|
||||
icon: (
|
||||
@@ -295,7 +298,7 @@ const DRAWER_NAV_ITEMS = [
|
||||
|
||||
const DRAWER_SETTINGS_ITEM = {
|
||||
key: 'settings',
|
||||
label: 'Settings',
|
||||
label: 'nav.settings',
|
||||
href: '/settings',
|
||||
match: (loc) => loc.pathname.startsWith('/settings'),
|
||||
icon: (
|
||||
@@ -308,7 +311,7 @@ const DRAWER_SETTINGS_ITEM = {
|
||||
|
||||
const DRAWER_INSTALL_ITEM = {
|
||||
key: 'install-app',
|
||||
label: 'Εγκατάσταση εφαρμογής',
|
||||
label: 'nav.installApp',
|
||||
match: () => false,
|
||||
icon: (
|
||||
<svg width="22" height="22" viewBox="0 0 24 24" fill="none">
|
||||
@@ -338,6 +341,7 @@ function InstallAppDrawerButton({ location, onClose }) {
|
||||
}
|
||||
|
||||
function DrawerButton({ item, location, onNavigate, active: activeProp, onClick }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const active = activeProp ?? item.match(location)
|
||||
return (
|
||||
<button
|
||||
@@ -353,7 +357,7 @@ function DrawerButton({ item, location, onNavigate, active: activeProp, onClick
|
||||
}}
|
||||
>
|
||||
<span style={{ opacity: active ? 1 : 0.6, flexShrink: 0 }}>{item.icon}</span>
|
||||
{item.label}
|
||||
{t(item.label)}
|
||||
{active && (
|
||||
<div style={{ marginLeft: 'auto', width: 6, height: 6, borderRadius: '50%', background: 'var(--accent)' }} />
|
||||
)}
|
||||
@@ -362,6 +366,7 @@ function DrawerButton({ item, location, onNavigate, active: activeProp, onClick
|
||||
}
|
||||
|
||||
function SideDrawer({ open, onClose }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const navigate = useNavigate()
|
||||
const chatOn = useChatOn()
|
||||
const location = useLocation()
|
||||
@@ -406,13 +411,13 @@ function SideDrawer({ open, onClose }) {
|
||||
{/* Drawer header */}
|
||||
<div style={{ padding: '20px 20px 16px', borderBottom: '1px solid var(--border)' }}>
|
||||
<div style={{ fontSize: 22, fontWeight: 800, color: 'var(--accent)', letterSpacing: -0.5 }}>Xenia</div>
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>POS System</div>
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>{t('shell.posSystem')}</div>
|
||||
</div>
|
||||
|
||||
{/* Main nav items */}
|
||||
<div style={{ flex: 1, padding: '12px 10px', display: 'flex', flexDirection: 'column', gap: 4, overflowY: 'auto' }}>
|
||||
<div style={{ fontSize: 10, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 1, padding: '4px 10px 8px' }}>
|
||||
Πλοήγηση
|
||||
{t('shell.navigation')}
|
||||
</div>
|
||||
{DRAWER_NAV_ITEMS.filter(shown(chatOn)).map(item => {
|
||||
const isStandaloneActive = location.pathname === '/tables' && activeZoneTab === 'standalone'
|
||||
@@ -461,6 +466,7 @@ function PillBadge({ count, color = '#ef4444' }) {
|
||||
}
|
||||
|
||||
function TripleFooter({ location, navigate, chatUnread, kdsReady, tripleItems }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { activeZoneTab, setActiveZoneTab } = useTableViewStore()
|
||||
const chatOn = useChatOn()
|
||||
const items = (tripleItems || ['tables', 'orders', 'messages']).map(k => NAV_REGISTRY[k]).filter(Boolean).filter(shown(chatOn))
|
||||
@@ -513,7 +519,7 @@ function TripleFooter({ location, navigate, chatUnread, kdsReady, tripleItems })
|
||||
{item.key === 'orders' && <svg width="15" height="15" 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="1.8" strokeLinecap="round"/><path d="M9 12h6M9 16h4" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round"/></svg>}
|
||||
{item.key === 'messages' && <svg width="15" height="15" 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="1.8" strokeLinecap="round" strokeLinejoin="round"/></svg>}
|
||||
</span>
|
||||
{item.shortLabel ?? item.label}
|
||||
{t(item.shortLabel ?? item.label)}
|
||||
{badge && <PillBadge count={badge.count} color={badge.color} />}
|
||||
</button>
|
||||
)
|
||||
@@ -526,6 +532,7 @@ function TripleFooter({ location, navigate, chatUnread, kdsReady, tripleItems })
|
||||
// ─── Icon navbar footer ───────────────────────────────────────────────────────
|
||||
|
||||
function IconNavbar({ navItems, location, navigate, chatUnread, kdsReady }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { activeZoneTab, setActiveZoneTab } = useTableViewStore()
|
||||
const chatOn = useChatOn()
|
||||
const items = navItems
|
||||
@@ -597,7 +604,7 @@ function IconNavbar({ navItems, location, navigate, chatUnread, kdsReady }) {
|
||||
)}
|
||||
</span>
|
||||
<span style={{ fontSize: 10, fontWeight: active ? 700 : 500, letterSpacing: 0.2 }}>
|
||||
{item.shortLabel ?? item.label}
|
||||
{t(item.shortLabel ?? item.label)}
|
||||
</span>
|
||||
</button>
|
||||
)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { markBundleReady, syncVenueBundle } from '../native/bundles'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
const FIRST_SYNC_DELAY_MS = 3000 // let a TLS upgrade / rediscovery reload settle first
|
||||
const PERIODIC_SYNC_MS = 30 * 60_000
|
||||
@@ -11,6 +12,7 @@ const PERIODIC_SYNC_MS = 30 * 60_000
|
||||
* only if the venue's UI needs a newer APK than the one installed.
|
||||
*/
|
||||
export default function BundleSync() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [apkUpdate, setApkUpdate] = useState(null) // APK download URL when the shell is too old
|
||||
|
||||
useEffect(() => {
|
||||
@@ -47,7 +49,7 @@ export default function BundleSync() {
|
||||
boxShadow: '0 8px 32px rgba(0,0,0,0.4)',
|
||||
}}>
|
||||
<span style={{ flex: 1, fontSize: 13, color: 'var(--text)', lineHeight: 1.35 }}>
|
||||
Ο server του καταστήματος χρειάζεται νεότερη έκδοση της εφαρμογής.
|
||||
{t('update.needsNewerApp')}
|
||||
</span>
|
||||
<a
|
||||
href={apkUpdate}
|
||||
@@ -58,7 +60,7 @@ export default function BundleSync() {
|
||||
fontSize: 14, fontWeight: 700, textDecoration: 'none', whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
Ενημέρωση
|
||||
{t('update.update')}
|
||||
</a>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import { useEffect } from 'react'
|
||||
import useInstallPromptStore, { APK_URL, canOfferApp } from '../store/installPromptStore'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
const BENEFITS = [
|
||||
{ icon: '⚡', title: 'Ανοίγει αμέσως', text: 'Χωρίς φόρτωση από τον browser, σαν κανονική εφαρμογή.' },
|
||||
{ icon: '📶', title: 'Αντέχει στο WiFi', text: 'Συνεχίζει να δουλεύει όταν χάνεται για λίγο η σύνδεση.' },
|
||||
{ icon: '🔒', title: 'Ασφαλής σύνδεση', text: 'Κρυπτογραφημένη επικοινωνία με τον server του καταστήματος.' },
|
||||
{ icon: '🔄', title: 'Χωρίς ρυθμίσεις', text: 'Βρίσκει μόνη της τον server και ενημερώνεται αυτόματα.' },
|
||||
{ icon: '⚡', title: 'install.fast', text: 'install.fastText' },
|
||||
{ icon: '📶', title: 'install.wifi', text: 'install.wifiText' },
|
||||
{ icon: '🔒', title: 'install.secure', text: 'install.secureText' },
|
||||
{ icon: '🔄', title: 'install.noSetup', text: 'install.noSetupText' },
|
||||
]
|
||||
|
||||
const STEPS = [
|
||||
'Πατήστε «Λήψη εφαρμογής».',
|
||||
'Ανοίξτε το αρχείο και επιτρέψτε την εγκατάσταση.',
|
||||
'Ανοίξτε το Xenia και σαρώστε ξανά το QR του καταστήματος.',
|
||||
'install.step1',
|
||||
'install.step2',
|
||||
'install.step3',
|
||||
]
|
||||
|
||||
/**
|
||||
@@ -19,6 +20,7 @@ const STEPS = [
|
||||
* Opens by itself once; afterwards from the side drawer.
|
||||
*/
|
||||
export default function InstallAppDialog() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { open, dismiss, autoOpen } = useInstallPromptStore()
|
||||
|
||||
useEffect(() => {
|
||||
@@ -56,10 +58,10 @@ export default function InstallAppDialog() {
|
||||
style={{ borderRadius: 18, boxShadow: '0 6px 20px rgba(0,0,0,0.35)' }}
|
||||
/>
|
||||
<h2 id="install-app-title" style={{ fontSize: 20, fontWeight: 800, color: 'var(--text)', margin: '14px 0 4px' }}>
|
||||
Εφαρμογή Xenia
|
||||
{t('install.title')}
|
||||
</h2>
|
||||
<p style={{ fontSize: 13, color: 'var(--muted)', lineHeight: 1.45 }}>
|
||||
Εγκαταστήστε την εφαρμογή για γρηγορότερη και πιο σταθερή λειτουργία.
|
||||
{t('install.intro')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -73,8 +75,8 @@ export default function InstallAppDialog() {
|
||||
{b.icon}
|
||||
</span>
|
||||
<div>
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: 'var(--text)' }}>{b.title}</div>
|
||||
<div style={{ fontSize: 12.5, color: 'var(--muted)', lineHeight: 1.4 }}>{b.text}</div>
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: 'var(--text)' }}>{t(b.title)}</div>
|
||||
<div style={{ fontSize: 12.5, color: 'var(--muted)', lineHeight: 1.4 }}>{t(b.text)}</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
@@ -84,7 +86,7 @@ export default function InstallAppDialog() {
|
||||
margin: 0, padding: '12px 14px 12px 32px', borderRadius: 12, background: 'var(--bg3)',
|
||||
fontSize: 12.5, color: 'var(--muted)', lineHeight: 1.55,
|
||||
}}>
|
||||
{STEPS.map(s => <li key={s}>{s}</li>)}
|
||||
{STEPS.map(s => <li key={s}>{t(s)}</li>)}
|
||||
</ol>
|
||||
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
@@ -95,10 +97,10 @@ export default function InstallAppDialog() {
|
||||
className="btn btn--accent btn--lg"
|
||||
style={{ textDecoration: 'none', display: 'flex', alignItems: 'center', justifyContent: 'center' }}
|
||||
>
|
||||
Λήψη εφαρμογής
|
||||
{t('install.download')}
|
||||
</a>
|
||||
<button className="btn btn--secondary" onClick={dismiss} style={{ minHeight: 44 }}>
|
||||
Όχι τώρα
|
||||
{t('install.later')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,6 +20,7 @@ import { apiError } from '../api/errors'
|
||||
import { getVenueSettings } from '../api/venueSettings'
|
||||
import { storageKey } from '../config/server'
|
||||
import { idleAction, idleLimits } from '../logic/idle'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
const ACTIVITY_EVENTS = ['pointerdown', 'keydown', 'touchstart', 'scroll']
|
||||
const SAVE_EVERY_MS = 5_000
|
||||
@@ -84,6 +85,7 @@ function touchActivity() {
|
||||
}
|
||||
|
||||
export default function LockScreen() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { user, savedUsername, unlock, logout } = useAuthStore()
|
||||
const { login: modes } = useAccess()
|
||||
const usePassword = modes?.waiter_mode === 'password'
|
||||
@@ -108,7 +110,7 @@ export default function LockScreen() {
|
||||
unlock(data.user)
|
||||
} catch (err) {
|
||||
if (isError(err, 'auth.session_ended')) { signOut(); return }
|
||||
setError(apiError(err, usePassword ? 'Λανθασμένος κωδικός' : 'Λανθασμένο PIN'))
|
||||
setError(apiError(err, usePassword ? t('login.wrongPassword') : t('login.wrongPin')))
|
||||
setPassword('')
|
||||
setAttempt(a => a + 1)
|
||||
} finally {
|
||||
@@ -127,7 +129,7 @@ export default function LockScreen() {
|
||||
>
|
||||
<div className="login-box" style={{ textAlign: 'center' }}>
|
||||
<div style={{ fontSize: 40 }}>🔒</div>
|
||||
<p style={{ fontSize: 18, fontWeight: 700, color: 'var(--text)', margin: '6px 0 2px' }}>Κλειδωμένο</p>
|
||||
<p style={{ fontSize: 18, fontWeight: 700, color: 'var(--text)', margin: '6px 0 2px' }}>{t('lock.locked')}</p>
|
||||
<p style={{ fontSize: 14, color: 'var(--muted)', marginBottom: 12 }}>{user?.full_name || user?.username || savedUsername}</p>
|
||||
|
||||
{usePassword ? (
|
||||
@@ -136,7 +138,7 @@ export default function LockScreen() {
|
||||
type="password"
|
||||
value={password}
|
||||
onChange={e => setPassword(e.target.value)}
|
||||
placeholder="Κωδικός"
|
||||
placeholder={t('login.password')}
|
||||
autoComplete="current-password"
|
||||
data-testid="unlock-password"
|
||||
style={{
|
||||
@@ -144,7 +146,7 @@ export default function LockScreen() {
|
||||
border: '1px solid var(--border)', background: 'var(--bg2)', color: 'var(--text)', fontSize: 16,
|
||||
}}
|
||||
/>
|
||||
<button type="submit" className="btn btn--primary btn--lg" disabled={busy || !password}>Ξεκλείδωμα</button>
|
||||
<button type="submit" className="btn btn--primary btn--lg" disabled={busy || !password}>{t('lock.unlock')}</button>
|
||||
</form>
|
||||
) : (
|
||||
<PinPad key={attempt} onSubmit={pin => tryUnlock({ pin })} loading={busy} />
|
||||
@@ -157,7 +159,7 @@ export default function LockScreen() {
|
||||
data-testid="lock-sign-out"
|
||||
style={{ marginTop: 16, background: 'none', border: 'none', color: 'var(--muted)', fontSize: 13, cursor: 'pointer' }}
|
||||
>
|
||||
Αποσύνδεση (άλλος σερβιτόρος)
|
||||
{t('lock.signOutOther')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,8 @@ import { useState, useEffect, useRef } from 'react'
|
||||
import { useCan } from '@xenia/access'
|
||||
import useWaiterFavoritesStore from '../store/waiterFavoritesStore'
|
||||
import { assetUrl } from '../config/server'
|
||||
import { money } from '../i18n'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
// ── Helpers ──────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -78,7 +80,6 @@ function buildFavorites(product, waiterOverride) {
|
||||
return items.sort((a, b) => a.sortOrder - b.sortOrder)
|
||||
}
|
||||
|
||||
const QUICK_NOTES = ['Χωρίς αλάτι', 'Βγάλτε γρήγορα', 'Αλλεργία!', 'Κόψτε σε μικρά κομμάτια', 'Έξτρα χαρτοπετσέτες']
|
||||
|
||||
// ── Primitives ────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -150,6 +151,7 @@ function Row({ selected, onClick, children, right, left, style = {} }) {
|
||||
// ── Shared: single quick option row ──────────────────────────────────────────
|
||||
|
||||
function QuickOptionRow({ opt, quickState, setQuickState, compact }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const qty = quickState[opt.id] || 0
|
||||
const selected = qty > 0
|
||||
const toggleSingle = () => setQuickState(s => ({ ...s, [opt.id]: selected ? 0 : 1 }))
|
||||
@@ -172,7 +174,7 @@ function QuickOptionRow({ opt, quickState, setQuickState, compact }) {
|
||||
) : null}
|
||||
>
|
||||
<div style={{ fontSize: compact ? 13 : 15, fontWeight: 500, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{opt.name}</div>
|
||||
{opt.price > 0 && <div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>+{opt.price.toFixed(2)} €{opt.allow_multiple ? ' each' : ''}</div>}
|
||||
{opt.price > 0 && <div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>+{money(opt.price)}{opt.allow_multiple ? ` ${t('drawer.each')}` : ''}</div>}
|
||||
</Row>
|
||||
)
|
||||
}
|
||||
@@ -180,6 +182,7 @@ function QuickOptionRow({ opt, quickState, setQuickState, compact }) {
|
||||
// ── Shared: single extra/option row ──────────────────────────────────────────
|
||||
|
||||
function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setExpandedExtra, compact }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const sel = extrasState[opt.id]
|
||||
const selected = !!sel
|
||||
const open = expandedExtra === opt.id
|
||||
@@ -245,10 +248,10 @@ function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setEx
|
||||
>
|
||||
<div style={{ fontSize: compact ? 13 : 15, fontWeight: 500, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{opt.name}</div>
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>
|
||||
{(opt.extra_cost ?? 0) !== 0 ? `+${opt.extra_cost.toFixed(2)} €` : 'Included'}
|
||||
{(opt.extra_cost ?? 0) !== 0 ? `+${money(opt.extra_cost)}` : t('drawer.included')}
|
||||
{subLabel && <span style={{ color: '#f59e0b', fontWeight: 600 }}> · {subLabel}</span>}
|
||||
{isMultiSelect && selectedSubCount > 0 && (
|
||||
<span style={{ color: '#f59e0b', fontWeight: 600 }}> · {selectedSubCount} επιλεγμένα</span>
|
||||
<span style={{ color: '#f59e0b', fontWeight: 600 }}> · {t('drawer.selectedCount', { count: selectedSubCount })}</span>
|
||||
)}
|
||||
</div>
|
||||
</Row>
|
||||
@@ -256,7 +259,7 @@ function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setEx
|
||||
{/* Single-select sub-choices (radio) */}
|
||||
{selected && open && hasSubs && !isMultiSelect && (
|
||||
<div style={{ margin: '6px 0 2px 16px', paddingLeft: 14, borderLeft: '2px solid rgba(245,158,11,0.3)', display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
||||
<div style={{ width: '100%', fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, padding: '6px 2px 2px' }}>Επιλογή</div>
|
||||
<div style={{ width: '100%', fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, padding: '6px 2px 2px' }}>{t('drawer.choose')}</div>
|
||||
{opt.sub_choices.map((sub, si) => {
|
||||
const isSel = sel.subName === sub.name
|
||||
return (
|
||||
@@ -267,7 +270,7 @@ function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setEx
|
||||
style={sub.is_compact ? { minHeight: 44 } : {}}>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||
<div style={{ fontSize: sub.is_compact ? 12 : 14, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{sub.name}</div>
|
||||
{(sub.extra_cost ?? 0) !== 0 && <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0, marginLeft: 6 }}>+{sub.extra_cost.toFixed(2)} €</div>}
|
||||
{(sub.extra_cost ?? 0) !== 0 && <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0, marginLeft: 6 }}>+{money(sub.extra_cost)}</div>}
|
||||
</div>
|
||||
</Row>
|
||||
</div>
|
||||
@@ -279,7 +282,7 @@ function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setEx
|
||||
{/* Multi-select sub-choices (checkboxes, optional qty stepper per sub) */}
|
||||
{selected && open && hasSubs && isMultiSelect && (
|
||||
<div style={{ margin: '6px 0 2px 16px', paddingLeft: 14, borderLeft: '2px solid rgba(245,158,11,0.3)', display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
||||
<div style={{ width: '100%', fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, padding: '6px 2px 2px' }}>Επιλογή (πολλαπλή)</div>
|
||||
<div style={{ width: '100%', fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, padding: '6px 2px 2px' }}>{t('drawer.chooseMany')}</div>
|
||||
{opt.sub_choices.map((sub, si) => {
|
||||
const subQty = subs[sub.name] || 0
|
||||
const subSel = subQty > 0
|
||||
@@ -306,7 +309,7 @@ function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setEx
|
||||
{sub.name}
|
||||
{subQty > 1 && <span style={{ color: 'var(--muted)', marginLeft: 6, fontSize: 12, fontVariantNumeric: 'tabular-nums' }}>×{subQty}</span>}
|
||||
</div>
|
||||
{(sub.extra_cost ?? 0) !== 0 && <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0, marginLeft: 6 }}>+{sub.extra_cost.toFixed(2)} €{sub.allow_multiple ? ' each' : ''}</div>}
|
||||
{(sub.extra_cost ?? 0) !== 0 && <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0, marginLeft: 6 }}>+{money(sub.extra_cost)}{sub.allow_multiple ? ` ${t('drawer.each')}` : ''}</div>}
|
||||
</div>
|
||||
</Row>
|
||||
</div>
|
||||
@@ -321,6 +324,7 @@ function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setEx
|
||||
// ── Shared: single ingredient row ─────────────────────────────────────────────
|
||||
|
||||
function IngredientRow({ ing, removedState, setRemovedState, compact }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const removed = !!removedState[ing.id]
|
||||
return (
|
||||
<Row selected={false}
|
||||
@@ -336,7 +340,7 @@ function IngredientRow({ ing, removedState, setRemovedState, compact }) {
|
||||
display: 'inline-flex', alignItems: 'center',
|
||||
transition: 'all 120ms ease', whiteSpace: 'nowrap',
|
||||
}}>
|
||||
{removed ? 'Αφαιρέθηκε' : 'Αφαίρεση'}
|
||||
{removed ? t('drawer.removed') : t('drawer.remove')}
|
||||
</div>
|
||||
}>
|
||||
<div style={{ fontSize: compact ? 13 : 15, fontWeight: 500, color: removed ? 'var(--muted)' : 'var(--text)', textDecoration: removed ? 'line-through' : 'none', transition: 'all 120ms', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{ing.name}</div>
|
||||
@@ -347,6 +351,7 @@ function IngredientRow({ ing, removedState, setRemovedState, compact }) {
|
||||
// ── Shared: single preference set ─────────────────────────────────────────────
|
||||
|
||||
function PrefSetBlock({ ps, prefs, setPrefs, subChoices, setSubChoices, sharedSubs, setSharedSubs }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const selChoice = prefs[ps.id] ?? null
|
||||
const complete = selChoice != null
|
||||
&& !(selChoice.sub_choices?.length > 0 && subChoices[selChoice.id] == null)
|
||||
@@ -367,7 +372,7 @@ function PrefSetBlock({ ps, prefs, setPrefs, subChoices, setSubChoices, sharedSu
|
||||
<div>
|
||||
<div style={{ display: 'flex', alignItems: 'baseline', gap: 8, padding: '0 2px 10px' }}>
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: complete ? 'var(--text)' : '#ef4444' }}>{ps.name}</div>
|
||||
{!complete && <div style={{ fontSize: 11, fontWeight: 700, color: '#ef4444', textTransform: 'uppercase', letterSpacing: 0.6 }}>Απαιτείται</div>}
|
||||
{!complete && <div style={{ fontSize: 11, fontWeight: 700, color: '#ef4444', textTransform: 'uppercase', letterSpacing: 0.6 }}>{t('drawer.required')}</div>}
|
||||
</div>
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
|
||||
{ps.choices.map(ch => {
|
||||
@@ -379,20 +384,20 @@ function PrefSetBlock({ ps, prefs, setPrefs, subChoices, setSubChoices, sharedSu
|
||||
<div key={ch.id} style={{ width: ch.is_compact ? 'calc(50% - 4px)' : '100%', minWidth: 0 }}>
|
||||
<Row selected={isSel} onClick={() => selectPref(ch)} left={<RadioDot selected={isSel} />}
|
||||
style={ch.is_compact ? { minHeight: 48 } : {}}
|
||||
right={(ch.extra_cost ?? 0) !== 0 ? <div style={{ fontSize: ch.is_compact ? 12 : 14, fontWeight: 500, color: 'var(--muted)', flexShrink: 0 }}>{ch.extra_cost > 0 ? '+' : ''}{ch.extra_cost.toFixed(2)} €</div> : null}>
|
||||
right={(ch.extra_cost ?? 0) !== 0 ? <div style={{ fontSize: ch.is_compact ? 12 : 14, fontWeight: 500, color: 'var(--muted)', flexShrink: 0 }}>{ch.extra_cost > 0 ? '+' : ''}{money(ch.extra_cost)}</div> : null}>
|
||||
<div style={{ fontSize: ch.is_compact ? 13 : 15, fontWeight: 500, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{ch.name}</div>
|
||||
</Row>
|
||||
|
||||
{isSel && hasSubs && (
|
||||
<div style={{ margin: '6px 0 2px 16px', paddingLeft: 14, borderLeft: `2px solid ${subMissing ? '#ef4444' : 'rgba(245,158,11,0.3)'}`, display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
||||
{subMissing && <p style={{ width: '100%', fontSize: 12, color: '#ef4444', margin: '4px 2px 2px' }}>— απαιτείται επιλογή</p>}
|
||||
{subMissing && <p style={{ width: '100%', fontSize: 12, color: '#ef4444', margin: '4px 2px 2px' }}>{t('drawer.choiceRequired')}</p>}
|
||||
{ch.sub_choices.map((sub, si) => {
|
||||
const subSel = subChoices[ch.id]?.name === sub.name
|
||||
return (
|
||||
<div key={si} style={{ width: sub.is_compact ? 'calc(50% - 3px)' : '100%', minWidth: 0 }}>
|
||||
<Row selected={subSel} onClick={() => setSubChoices(s => ({ ...s, [ch.id]: sub }))} left={<RadioDot selected={subSel} />}
|
||||
style={sub.is_compact ? { minHeight: 44 } : {}}
|
||||
right={(sub.extra_cost ?? 0) !== 0 ? <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0 }}>+{sub.extra_cost.toFixed(2)} €</div> : null}>
|
||||
right={(sub.extra_cost ?? 0) !== 0 ? <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0 }}>+{money(sub.extra_cost)}</div> : null}>
|
||||
<div style={{ fontSize: sub.is_compact ? 12 : 14, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{sub.name}</div>
|
||||
</Row>
|
||||
</div>
|
||||
@@ -414,7 +419,7 @@ function PrefSetBlock({ ps, prefs, setPrefs, subChoices, setSubChoices, sharedSu
|
||||
<div key={si} style={{ width: sub.is_compact ? 'calc(50% - 3px)' : '100%', minWidth: 0 }}>
|
||||
<Row selected={subSel} onClick={() => setSharedSubs(s => ({ ...s, [ps.id]: sub }))} left={<RadioDot selected={subSel} />}
|
||||
style={sub.is_compact ? { minHeight: 44 } : {}}
|
||||
right={(sub.extra_cost ?? 0) !== 0 ? <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0 }}>+{sub.extra_cost.toFixed(2)} €</div> : null}>
|
||||
right={(sub.extra_cost ?? 0) !== 0 ? <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0 }}>+{money(sub.extra_cost)}</div> : null}>
|
||||
<div style={{ fontSize: sub.is_compact ? 12 : 14, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{sub.name}</div>
|
||||
</Row>
|
||||
</div>
|
||||
@@ -431,10 +436,11 @@ function PrefSetBlock({ ps, prefs, setPrefs, subChoices, setSubChoices, sharedSu
|
||||
// ── Tab: Favorites ────────────────────────────────────────────────────────────
|
||||
|
||||
function FavoritesTab({ product, waiterOverride, quickState, setQuickState, extrasState, setExtrasState, expandedExtra, setExpandedExtra, removedState, setRemovedState, prefs, setPrefs, subChoices, setSubChoices, sharedSubs, setSharedSubs }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const favorites = buildFavorites(product, waiterOverride)
|
||||
|
||||
if (favorites.length === 0) return (
|
||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>Δεν υπάρχουν αγαπημένα για αυτό το προϊόν.</p>
|
||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>{t('drawer.empty.favorites')}</p>
|
||||
)
|
||||
|
||||
return (
|
||||
@@ -467,9 +473,10 @@ function FavoritesTab({ product, waiterOverride, quickState, setQuickState, extr
|
||||
// ── Tab: Quick Options ────────────────────────────────────────────────────────
|
||||
|
||||
function QuickTab({ product, quickState, setQuickState }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const quickOptions = product.quick_options || []
|
||||
if (quickOptions.length === 0) return (
|
||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>Δεν υπάρχουν γρήγορες επιλογές.</p>
|
||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>{t('drawer.empty.quick')}</p>
|
||||
)
|
||||
return (
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
|
||||
@@ -538,11 +545,12 @@ function partitionByGroup(items, modifierGroups) {
|
||||
// ── Tab: Extras ───────────────────────────────────────────────────────────────
|
||||
|
||||
function ExtrasTab({ product, extrasState, setExtrasState, expandedExtra, setExpandedExtra }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const extraGroups = (product.modifier_groups || []).filter(g => g.modifier_type === 'option')
|
||||
const [collapsedGroups, setCollapsedGroups] = useState(() => Object.fromEntries(extraGroups.map(g => [g.id, true])))
|
||||
const options = product.options || []
|
||||
if (options.length === 0) return (
|
||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>Δεν υπάρχουν extras.</p>
|
||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>{t('drawer.empty.extras')}</p>
|
||||
)
|
||||
|
||||
function toggleGroup(id) { setCollapsedGroups(s => ({ ...s, [id]: !s[id] })) }
|
||||
@@ -581,14 +589,15 @@ function ExtrasTab({ product, extrasState, setExtrasState, expandedExtra, setExp
|
||||
)
|
||||
}
|
||||
|
||||
// ── Tab: Υλικά (Ingredients) ─────────────────────────────────────────────────
|
||||
// ── Tab: Ingredients ─────────────────────────────────────────────────
|
||||
|
||||
function IngredientsTab({ product, removedState, setRemovedState }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const ingGroups = (product.modifier_groups || []).filter(g => g.modifier_type === 'ingredient')
|
||||
const [collapsedGroups, setCollapsedGroups] = useState(() => Object.fromEntries(ingGroups.map(g => [g.id, true])))
|
||||
const ingredients = product.ingredients || []
|
||||
if (ingredients.length === 0) return (
|
||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>Δεν υπάρχουν υλικά.</p>
|
||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>{t('drawer.empty.ingredients')}</p>
|
||||
)
|
||||
|
||||
function toggleGroup(id) { setCollapsedGroups(s => ({ ...s, [id]: !s[id] })) }
|
||||
@@ -627,14 +636,15 @@ function IngredientsTab({ product, removedState, setRemovedState }) {
|
||||
)
|
||||
}
|
||||
|
||||
// ── Tab: Προτιμήσεις ─────────────────────────────────────────────────────────
|
||||
// ── Tab: Preferences ─────────────────────────────────────────────────────────
|
||||
|
||||
function PrefsTab({ product, prefs, setPrefs, subChoices, setSubChoices, sharedSubs, setSharedSubs }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const prefGroups = (product.modifier_groups || []).filter(g => g.modifier_type === 'preference')
|
||||
const [collapsedGroups, setCollapsedGroups] = useState(() => Object.fromEntries(prefGroups.map(g => [g.id, true])))
|
||||
const preferenceSets = product.preference_sets || []
|
||||
if (preferenceSets.length === 0) return (
|
||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>Δεν υπάρχουν προτιμήσεις.</p>
|
||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>{t('drawer.empty.prefs')}</p>
|
||||
)
|
||||
|
||||
function toggleGroup(id) { setCollapsedGroups(s => ({ ...s, [id]: !s[id] })) }
|
||||
@@ -694,6 +704,7 @@ function fmtDecimalQty(qty, cfg) {
|
||||
}
|
||||
|
||||
function QuantityTab({ unitCfg, qty, setQty }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [editingQty, setEditingQty] = useState(false)
|
||||
const [qtyInput, setQtyInput] = useState('')
|
||||
const inputRef = useRef(null)
|
||||
@@ -747,7 +758,7 @@ function QuantityTab({ unitCfg, qty, setQty }) {
|
||||
|
||||
{/* Quick presets — 3 rows of 4 */}
|
||||
<div>
|
||||
<p style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', letterSpacing: 0.8, marginBottom: 8, textAlign: 'center' }}>ΓΡΗΓΟΡΗ ΕΠΙΛΟΓΗ</p>
|
||||
<p style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', letterSpacing: 0.8, marginBottom: 8, textAlign: 'center' }}>{t('drawer.qty.quickPick')}</p>
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 8 }}>
|
||||
{unitCfg.presets.map(v => (
|
||||
<button
|
||||
@@ -769,7 +780,7 @@ function QuantityTab({ unitCfg, qty, setQty }) {
|
||||
|
||||
{/* Quick ± offset buttons — 2×2 grid */}
|
||||
<div>
|
||||
<p style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', letterSpacing: 0.8, marginBottom: 8, textAlign: 'center' }}>ΓΡΗΓΟΡΗ ΠΡΟΣΘΗΚΗ</p>
|
||||
<p style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', letterSpacing: 0.8, marginBottom: 8, textAlign: 'center' }}>{t('drawer.qty.quickAdd')}</p>
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 8 }}>
|
||||
{unitCfg.offsets.map(off => (
|
||||
<button
|
||||
@@ -804,6 +815,7 @@ function QuantityTab({ unitCfg, qty, setQty }) {
|
||||
const PRICE_DELTAS = [-5, -3, -2, -1, -0.5, -0.2, +0.2, +0.5, +1, +2, +3, +5]
|
||||
|
||||
function PriceAdjustTab({ basePrice, priceAdj, setPriceAdj }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [editing, setEditing] = useState(false)
|
||||
const [rawInput, setRawInput] = useState('')
|
||||
const inputRef = useRef(null)
|
||||
@@ -832,7 +844,7 @@ function PriceAdjustTab({ basePrice, priceAdj, setPriceAdj }) {
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 20 }}>
|
||||
<div style={{ padding: '10px 14px', background: 'rgba(245,158,11,0.08)', border: '1px solid rgba(245,158,11,0.2)', borderRadius: 10, fontSize: 13, color: '#f59e0b' }}>
|
||||
Αλλαγή τιμής μόνο για αυτό το αντικείμενο. Δεν επηρεάζει άλλες παραγγελίες.
|
||||
{t('drawer.price.intro')}
|
||||
</div>
|
||||
|
||||
{/* Price display / input */}
|
||||
@@ -857,7 +869,7 @@ function PriceAdjustTab({ basePrice, priceAdj, setPriceAdj }) {
|
||||
color: priceAdj !== 0 ? '#f59e0b' : 'var(--text)',
|
||||
fontSize: 22, fontWeight: 800, cursor: 'pointer', fontFamily: 'inherit',
|
||||
}}>
|
||||
{effectivePrice.toFixed(2)} €
|
||||
{money(effectivePrice)}
|
||||
</button>
|
||||
)}
|
||||
<button onClick={() => applyDelta(+0.1)} style={{ width: 44, height: 44, borderRadius: '50%', border: '1.5px solid var(--border)', background: 'var(--bg3)', fontSize: 20, fontWeight: 700, color: 'var(--text)', cursor: 'pointer' }}>+</button>
|
||||
@@ -865,11 +877,11 @@ function PriceAdjustTab({ basePrice, priceAdj, setPriceAdj }) {
|
||||
|
||||
{priceAdj !== 0 && (
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 10 }}>
|
||||
<span style={{ fontSize: 13, color: 'var(--muted)' }}>Βάση: {basePrice.toFixed(2)} €</span>
|
||||
<span style={{ fontSize: 13, color: 'var(--muted)' }}>{t('drawer.price.base', { price: money(basePrice) })}</span>
|
||||
<span style={{ fontSize: 13, fontWeight: 700, color: priceAdj > 0 ? '#4ade80' : '#f87171' }}>
|
||||
{priceAdj > 0 ? '+' : ''}{priceAdj.toFixed(2)} €
|
||||
{priceAdj > 0 ? '+' : ''}{money(priceAdj)}
|
||||
</span>
|
||||
<button onClick={() => setPriceAdj(0)} style={{ padding: '3px 10px', borderRadius: 8, border: '1px solid var(--border)', background: 'var(--bg3)', color: 'var(--muted)', fontSize: 12, cursor: 'pointer' }}>Επαναφορά</button>
|
||||
<button onClick={() => setPriceAdj(0)} style={{ padding: '3px 10px', borderRadius: 8, border: '1px solid var(--border)', background: 'var(--bg3)', color: 'var(--muted)', fontSize: 12, cursor: 'pointer' }}>{t('settings.reset.title')}</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -896,19 +908,21 @@ function PriceAdjustTab({ basePrice, priceAdj, setPriceAdj }) {
|
||||
|
||||
// ── Tab: Notes ────────────────────────────────────────────────────────────────
|
||||
|
||||
function NotesTab({ note, setNote, quickNotes = FALLBACK_QUICK_NOTES }) {
|
||||
function NotesTab({ note, setNote, quickNotes }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
quickNotes = quickNotes ?? FALLBACK_QUICK_NOTES.map(k => t(k))
|
||||
return (
|
||||
<div>
|
||||
<textarea
|
||||
value={note}
|
||||
onChange={e => setNote(e.target.value)}
|
||||
placeholder="π.χ. Χωρίς αλάτι, κόψτε στη μέση..."
|
||||
placeholder={t('drawer.notes.placeholder')}
|
||||
rows={5}
|
||||
style={{ width: '100%', padding: 14, fontSize: 15, fontFamily: 'inherit', color: 'var(--text)', background: 'var(--bg2)', border: '1px solid var(--border)', borderRadius: 12, resize: 'none', outline: 'none', boxSizing: 'border-box' }}
|
||||
/>
|
||||
{quickNotes.length > 0 && (
|
||||
<>
|
||||
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, marginTop: 20, marginBottom: 8 }}>Γρήγορες σημειώσεις</div>
|
||||
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, marginTop: 20, marginBottom: 8 }}>{t('drawer.notes.quickTitle')}</div>
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
|
||||
{quickNotes.map(q => (
|
||||
<button key={q} onClick={() => setNote(n => n ? `${n}\n${q}` : q)}
|
||||
@@ -927,12 +941,13 @@ function NotesTab({ note, setNote, quickNotes = FALLBACK_QUICK_NOTES }) {
|
||||
|
||||
/** One group of the summary (prefs, quick options, extras, removed) with its "change" link. */
|
||||
function Section({ title, tab, lines, onJumpTab }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
if (lines.length === 0) return null
|
||||
return (
|
||||
<div style={{ marginBottom: 20 }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '0 2px 8px' }}>
|
||||
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6 }}>{title}</div>
|
||||
<button onClick={() => onJumpTab(tab)} style={{ background: 'none', border: 'none', fontSize: 12, fontWeight: 700, color: '#f59e0b', cursor: 'pointer', textTransform: 'uppercase', letterSpacing: 0.6 }}>Αλλαγή</button>
|
||||
<button onClick={() => onJumpTab(tab)} style={{ background: 'none', border: 'none', fontSize: 12, fontWeight: 700, color: '#f59e0b', cursor: 'pointer', textTransform: 'uppercase', letterSpacing: 0.6 }}>{t('common.change')}</button>
|
||||
</div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
|
||||
{lines.map((l, i) => (
|
||||
@@ -945,7 +960,7 @@ function Section({ title, tab, lines, onJumpTab }) {
|
||||
</>
|
||||
) : l.group === 'removed' ? (
|
||||
<div style={{ fontSize: 14, fontWeight: 500, color: 'var(--text)' }}>
|
||||
Χωρίς {l.label}
|
||||
{t('drawer.without', { name: l.label })}
|
||||
</div>
|
||||
) : l.group === 'extras' ? (
|
||||
<div style={{ fontSize: 14, fontWeight: 500, color: 'var(--text)' }}>
|
||||
@@ -960,7 +975,7 @@ function Section({ title, tab, lines, onJumpTab }) {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{l.price !== 0 && <div style={{ fontSize: 13, fontWeight: 600, color: l.price < 0 ? 'var(--danger)' : 'var(--text)', fontVariantNumeric: 'tabular-nums' }}>{l.price > 0 ? '+' : ''}{l.price.toFixed(2)} €</div>}
|
||||
{l.price !== 0 && <div style={{ fontSize: 13, fontWeight: 600, color: l.price < 0 ? 'var(--danger)' : 'var(--text)', fontVariantNumeric: 'tabular-nums' }}>{l.price > 0 ? '+' : ''}{money(l.price)}</div>}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -969,6 +984,7 @@ function Section({ title, tab, lines, onJumpTab }) {
|
||||
}
|
||||
|
||||
function SummaryTab({ _product, summaryLines, note, onJumpTab }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const isEmpty = summaryLines.length === 0 && !note
|
||||
const byGroup = { quick: [], extras: [], removed: [], prefs: [] }
|
||||
summaryLines.forEach(l => byGroup[l.group]?.push(l))
|
||||
@@ -978,19 +994,19 @@ function SummaryTab({ _product, summaryLines, note, onJumpTab }) {
|
||||
<div>
|
||||
{isEmpty ? (
|
||||
<div style={{ padding: '40px 16px', textAlign: 'center', color: 'var(--muted)', fontSize: 14 }}>
|
||||
Δεν έχει γίνει καμία προσαρμογή. Χρησιμοποιήστε τις καρτέλες για να διαμορφώσετε το προϊόν.
|
||||
{t('drawer.summary.empty')}
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<Section title="Προτιμήσεις" tab="prefs" lines={byGroup.prefs} onJumpTab={onJumpTab} />
|
||||
<Section title="Γρήγορες Επιλογές" tab="quick" lines={byGroup.quick} onJumpTab={onJumpTab} />
|
||||
<Section title="Extras" tab="extras" lines={byGroup.extras} onJumpTab={onJumpTab} />
|
||||
<Section title="Αφαιρέθηκαν" tab="ingredients" lines={byGroup.removed} onJumpTab={onJumpTab} />
|
||||
<Section title={t('drawer.tabs.prefs')} tab="prefs" lines={byGroup.prefs} onJumpTab={onJumpTab} />
|
||||
<Section title={t('drawer.tabs.quick')} tab="quick" lines={byGroup.quick} onJumpTab={onJumpTab} />
|
||||
<Section title={t('drawer.tabs.extrasTitle')} tab="extras" lines={byGroup.extras} onJumpTab={onJumpTab} />
|
||||
<Section title={t('drawer.summary.removed')} tab="ingredients" lines={byGroup.removed} onJumpTab={onJumpTab} />
|
||||
{note && (
|
||||
<div style={{ marginBottom: 20 }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '0 2px 8px' }}>
|
||||
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6 }}>Σημείωση</div>
|
||||
<button onClick={() => onJumpTab('notes')} style={{ background: 'none', border: 'none', fontSize: 12, fontWeight: 700, color: '#f59e0b', cursor: 'pointer', textTransform: 'uppercase', letterSpacing: 0.6 }}>Αλλαγή</button>
|
||||
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6 }}>{t('drawer.tabs.note')}</div>
|
||||
<button onClick={() => onJumpTab('notes')} style={{ background: 'none', border: 'none', fontSize: 12, fontWeight: 700, color: '#f59e0b', cursor: 'pointer', textTransform: 'uppercase', letterSpacing: 0.6 }}>{t('common.change')}</button>
|
||||
</div>
|
||||
<div style={{ padding: '12px 14px', background: 'rgba(245,158,11,0.08)', border: '1px solid rgba(245,158,11,0.2)', borderRadius: 10, fontSize: 14, color: 'var(--text)', lineHeight: 1.4, whiteSpace: 'pre-wrap' }}>{note}</div>
|
||||
</div>
|
||||
@@ -1043,9 +1059,11 @@ function CoursesTab({ courses, courseId, setCourseId }) {
|
||||
)
|
||||
}
|
||||
|
||||
const FALLBACK_QUICK_NOTES = ['Χωρίς αλάτι', 'Βγάλτε γρήγορα', 'Αλλεργία!', 'Κόψτε σε μικρά κομμάτια', 'Έξτρα χαρτοπετσέτες']
|
||||
// the venue's own quick notes (Settings) win; these are the defaults, in the waiter's language
|
||||
const FALLBACK_QUICK_NOTES = ['drawer.notes.noSalt', 'drawer.notes.quick', 'drawer.notes.allergy', 'drawer.notes.smallPieces', 'drawer.notes.napkins']
|
||||
|
||||
export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialState, courses, quickNotes }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const itemFavorites = useWaiterFavoritesStore(s => s.itemFavorites)
|
||||
// A price set before sending needs the key itself (plan 4.3); the manager-approval path for
|
||||
// it comes with server-priced orders (4.4). After sending, the item's actions offer it.
|
||||
@@ -1341,16 +1359,16 @@ export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialSt
|
||||
summary: <svg width="14" height="14" viewBox="0 0 24 24" fill="none"><path d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2M9 12h6M9 16h4" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/></svg>,
|
||||
}
|
||||
const tabs = [
|
||||
hasTabs.favorites && { id: 'favorites', label: 'Αγαπημένα' },
|
||||
hasTabs.quick && { id: 'quick', label: 'Γρήγορες' },
|
||||
hasTabs.extras && { id: 'extras', label: 'Έξτρα' },
|
||||
hasTabs.ingredients && { id: 'ingredients', label: 'Υλικά' },
|
||||
hasTabs.prefs && { id: 'prefs', label: 'Επιλογές' },
|
||||
hasTabs.quantity && { id: 'quantity', label: `Ποσότητα (${unitCfg?.label})` },
|
||||
hasTabs.favorites && { id: 'favorites', label: t('settings.tabs.favorites') },
|
||||
hasTabs.quick && { id: 'quick', label: t('drawer.tabs.quickShort') },
|
||||
hasTabs.extras && { id: 'extras', label: t('drawer.tabs.extras') },
|
||||
hasTabs.ingredients && { id: 'ingredients', label: t('drawer.tabs.ingredients') },
|
||||
hasTabs.prefs && { id: 'prefs', label: t('drawer.tabs.options') },
|
||||
hasTabs.quantity && { id: 'quantity', label: t('drawer.tabs.quantity', { unit: unitCfg?.label }) },
|
||||
(courses?.length > 0) && { id: 'courses', label: 'Courses' },
|
||||
{ id: 'notes', label: 'Σημείωση' },
|
||||
priceAdjAllowed && { id: 'price_adjust', label: 'Τιμή' },
|
||||
{ id: 'summary', label: 'Σύνοψη' },
|
||||
{ id: 'notes', label: t('drawer.tabs.note') },
|
||||
priceAdjAllowed && { id: 'price_adjust', label: t('drawer.tabs.price') },
|
||||
{ id: 'summary', label: t('drawer.tabs.summary') },
|
||||
].filter(Boolean)
|
||||
|
||||
const badgeFor = id => {
|
||||
@@ -1415,8 +1433,8 @@ export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialSt
|
||||
<div style={{ fontSize: 18, fontWeight: 700, color: 'var(--text)', lineHeight: 1.2 }}>{product.name}</div>
|
||||
<div style={{ fontSize: 13, color: priceAdj !== 0 ? '#f59e0b' : 'var(--muted)', marginTop: 2 }}>
|
||||
{priceAdj !== 0
|
||||
? <><span style={{ textDecoration: 'line-through', opacity: 0.5 }}>{product.base_price.toFixed(2)}</span> → {(product.base_price + priceAdj).toFixed(2)} €</>
|
||||
: <>{product.base_price.toFixed(2)} €</>
|
||||
? <><span style={{ textDecoration: 'line-through', opacity: 0.5 }}>{money(product.base_price)}</span> → {money(product.base_price + priceAdj)}</>
|
||||
: <>{money(product.base_price)}</>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1428,13 +1446,13 @@ export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialSt
|
||||
{/* Tabs bar */}
|
||||
<div ref={tabsScrollRef} style={{ marginTop: 12, borderBottom: '1px solid var(--border)', overflowX: 'auto', scrollbarWidth: 'none', flexShrink: 0 }}>
|
||||
<div style={{ display: 'flex', padding: '0 12px', gap: 2, minWidth: 'max-content' }}>
|
||||
{tabs.map(t => {
|
||||
const active = activeTab === t.id
|
||||
const badge = badgeFor(t.id)
|
||||
const isAlert = (t.id === 'prefs' && prefsTabAlert) || (t.id === 'favorites' && favTabAlert)
|
||||
{tabs.map(tb => {
|
||||
const active = activeTab === tb.id
|
||||
const badge = badgeFor(tb.id)
|
||||
const isAlert = (tb.id === 'prefs' && prefsTabAlert) || (tb.id === 'favorites' && favTabAlert)
|
||||
const tabColor = isAlert ? '#f87171' : active ? '#f59e0b' : 'var(--muted)'
|
||||
return (
|
||||
<button key={t.id} ref={el => { tabButtonRefs.current[t.id] = el }} onClick={() => setActiveTab(t.id)} style={{
|
||||
<button key={tb.id} ref={el => { tabButtonRefs.current[tb.id] = el }} onClick={() => setActiveTab(tb.id)} style={{
|
||||
padding: '12px 6px',
|
||||
background: 'none', border: 'none',
|
||||
borderBottom: `2px solid ${active ? '#f59e0b' : isAlert ? '#f87171' : 'transparent'}`,
|
||||
@@ -1446,8 +1464,8 @@ export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialSt
|
||||
transition: isAlert ? 'none' : 'color 120ms ease, border-color 120ms ease',
|
||||
animation: isAlert ? 'tab-alert 1.2s ease-in-out infinite' : 'none',
|
||||
}}>
|
||||
{TAB_ICON[t.id] && <span style={{ display: 'inline-flex', alignItems: 'center', opacity: active || isAlert ? 1 : 0.7 }}>{TAB_ICON[t.id]}</span>}
|
||||
{t.label}
|
||||
{TAB_ICON[tb.id] && <span style={{ display: 'inline-flex', alignItems: 'center', opacity: active || isAlert ? 1 : 0.7 }}>{TAB_ICON[tb.id]}</span>}
|
||||
{tb.label}
|
||||
{badge > 0 && !isAlert && (
|
||||
<span style={{
|
||||
minWidth: 18, height: 18, padding: '0 5px',
|
||||
@@ -1486,12 +1504,12 @@ export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialSt
|
||||
{activeTab === 'prefs' && <PrefsTab product={product} prefs={prefs} setPrefs={setPrefs} subChoices={subChoices} setSubChoices={setSubChoices} sharedSubs={sharedSubs} setSharedSubs={setSharedSubs} />}
|
||||
{activeTab === 'quantity' && isDecimal && <QuantityTab unitCfg={unitCfg} qty={qty} setQty={setQty} />}
|
||||
{activeTab === 'courses' && courses?.length > 0 && <CoursesTab courses={courses} courseId={courseId} setCourseId={setCourseId} />}
|
||||
{activeTab === 'notes' && <NotesTab note={note} setNote={setNote} quickNotes={quickNotes ?? FALLBACK_QUICK_NOTES} />}
|
||||
{activeTab === 'notes' && <NotesTab note={note} setNote={setNote} quickNotes={quickNotes ?? undefined} />}
|
||||
{activeTab === 'price_adjust' && <PriceAdjustTab basePrice={product.base_price} priceAdj={priceAdj} setPriceAdj={setPriceAdj} />}
|
||||
{activeTab === 'summary' && <SummaryTab product={product} summaryLines={summaryLines} note={note} onJumpTab={setActiveTab} />}
|
||||
</div>
|
||||
|
||||
{/* Footer: qty stepper + ΠΡΟΣΘΗΚΗ */}
|
||||
{/* Footer: qty stepper + ADD */}
|
||||
<div style={{ padding: '12px 16px 20px', background: 'var(--bg2)', borderTop: '1px solid var(--border)', display: 'flex', alignItems: 'center', gap: 12, flexShrink: 0, boxShadow: '0 -4px 16px rgba(0,0,0,0.3)' }}>
|
||||
{isDecimal ? (
|
||||
<div
|
||||
@@ -1519,7 +1537,7 @@ export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialSt
|
||||
transition: 'background 150ms ease',
|
||||
}}>
|
||||
<span>ADD</span>
|
||||
<span style={{ fontVariantNumeric: 'tabular-nums' }}>{totalPrice.toFixed(2)} €</span>
|
||||
<span style={{ fontVariantNumeric: 'tabular-nums' }}>{money(totalPrice)}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useRef, useState } from 'react'
|
||||
import useTableViewStore from '../store/tableViewStore'
|
||||
import { money } from '../i18n'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
function fmtPrice(v) {
|
||||
return Number(v).toFixed(2) + ' €'
|
||||
}
|
||||
const fmtPrice = money
|
||||
|
||||
const UNIT_LABELS = { kg: 'kg', liter: 'L', gram: 'g', ml: 'mL' }
|
||||
function fmtQty(qty, unitType) {
|
||||
@@ -112,15 +112,16 @@ function buildSections(item) {
|
||||
// ── KDS colour strip ──────────────────────────────────────────────────────────
|
||||
|
||||
const KDS_COLORS = {
|
||||
pending: { textColor: '#f59e0b', label: 'ΕΚΚΡΕΜΕΙ', icon: '⏳', dot: '#f59e0b' },
|
||||
preparing: { textColor: '#60a5fa', label: 'ΕΤΟΙΜΑΖΕΤΑΙ', icon: '🔥', dot: '#60a5fa' },
|
||||
done: { textColor: '#4ade80', label: 'READY', icon: '✓', dot: '#4ade80' },
|
||||
pending: { textColor: '#f59e0b', label: 'kds.pending', icon: '⏳', dot: '#f59e0b' },
|
||||
preparing: { textColor: '#60a5fa', label: 'kds.preparing', icon: '🔥', dot: '#60a5fa' },
|
||||
done: { textColor: '#4ade80', label: 'kds.ready', icon: '✓', dot: '#4ade80' },
|
||||
served: { textColor: null, label: null, icon: null, dot: null },
|
||||
}
|
||||
|
||||
// ── Shared expanded details panel ─────────────────────────────────────────────
|
||||
|
||||
function OptionsPanel({ sections }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
return (
|
||||
<div style={{ paddingBottom: 8 }}>
|
||||
{sections.map((sec, si) => (
|
||||
@@ -160,7 +161,7 @@ function OptionsPanel({ sections }) {
|
||||
{sec.type === 'removed' && sec.lines.map((line, li) => (
|
||||
<div key={li} style={{ display: 'flex', alignItems: 'center', gap: 7 }}>
|
||||
<SectionIcon type="removed" />
|
||||
<span style={{ fontSize: 12, color: 'var(--text)', flex: 1 }}>Χωρίς {line.name}</span>
|
||||
<span style={{ fontSize: 12, color: 'var(--text)', flex: 1 }}>{t('drawer.without', { name: line.name })}</span>
|
||||
</div>
|
||||
))}
|
||||
{sec.type === 'note' && sec.lines.map((line, li) => (
|
||||
@@ -179,13 +180,14 @@ function OptionsPanel({ sections }) {
|
||||
// ── KDS badge/icon renderer ───────────────────────────────────────────────────
|
||||
|
||||
function KdsBadge({ kdsColor, kdsDisplayStyle }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
if (!kdsColor?.label) return null
|
||||
if (kdsDisplayStyle === 'icon' && kdsColor.dot) {
|
||||
return (
|
||||
<span style={{
|
||||
width: 8, height: 8, borderRadius: '50%',
|
||||
background: kdsColor.dot, flexShrink: 0, display: 'inline-block',
|
||||
}} title={kdsColor.label} />
|
||||
}} title={t(kdsColor.label)} />
|
||||
)
|
||||
}
|
||||
return (
|
||||
@@ -195,7 +197,7 @@ function KdsBadge({ kdsColor, kdsDisplayStyle }) {
|
||||
borderRadius: 3, padding: '1px 5px',
|
||||
border: `1px solid ${kdsColor.textColor}60`,
|
||||
flexShrink: 0,
|
||||
}}>{kdsColor.label}</span>
|
||||
}}>{t(kdsColor.label)}</span>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -203,12 +205,13 @@ function KdsBadge({ kdsColor, kdsDisplayStyle }) {
|
||||
|
||||
const PRICING_EVENT_STYLE = {
|
||||
modifier_applied: { color: '#60a5fa', label: null }, // label comes from modifier_name
|
||||
waiter_discount: { color: '#c084fc', label: 'Έκπτωση' },
|
||||
free_item_added: { color: '#4ade80', label: 'Δωρεάν' },
|
||||
waiter_discount: { color: '#c084fc', label: 'summary.discount' },
|
||||
free_item_added: { color: '#4ade80', label: 'summary.free' },
|
||||
deal_offer_accepted: { color: '#4ade80', label: null }, // label from deal_name
|
||||
}
|
||||
|
||||
function PricingRows({ events, _layout, nameIndent = 12 }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const rows = events.filter(ev =>
|
||||
ev.event_type === 'modifier_applied' ||
|
||||
ev.event_type === 'waiter_discount' ||
|
||||
@@ -223,7 +226,7 @@ function PricingRows({ events, _layout, nameIndent = 12 }) {
|
||||
<div style={{ padding: `4px 12px 4px ${nameIndent}px`, display: 'flex', flexDirection: 'column', gap: 3 }}>
|
||||
{rows.map((ev, i) => {
|
||||
const evStyle = PRICING_EVENT_STYLE[ev.event_type] || { color: '#94a3b8', label: ev.event_type }
|
||||
const label = ev.modifier_name || ev.deal_name || evStyle.label || ev.event_type
|
||||
const label = ev.modifier_name || ev.deal_name || (evStyle.label && t(evStyle.label)) || ev.event_type
|
||||
const delta = ev.delta_amount
|
||||
|
||||
return (
|
||||
@@ -238,7 +241,7 @@ function PricingRows({ events, _layout, nameIndent = 12 }) {
|
||||
</span>
|
||||
{delta != null && (
|
||||
<span style={{ fontSize: 12, color: evStyle.color, fontWeight: 700, flexShrink: 0, marginLeft: 8 }}>
|
||||
{delta > 0 ? '+' : ''}{delta.toFixed(2)} €
|
||||
{delta > 0 ? '+' : ''}{money(delta)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
@@ -251,6 +254,7 @@ function PricingRows({ events, _layout, nameIndent = 12 }) {
|
||||
|
||||
// Small badge shown on the main item row to hint that pricing changes exist
|
||||
function PricingBadge({ events }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
if (!events || events.length === 0) return null
|
||||
const hasDiscount = events.some(ev => ev.event_type === 'waiter_discount')
|
||||
const hasModifier = events.some(ev => ev.event_type === 'modifier_applied')
|
||||
@@ -258,19 +262,19 @@ function PricingBadge({ events }) {
|
||||
|
||||
const icons = []
|
||||
if (hasModifier) icons.push(
|
||||
<svg key="mod" width="10" height="10" viewBox="0 0 24 24" fill="none" title="Τροποποιητής">
|
||||
<svg key="mod" width="10" height="10" viewBox="0 0 24 24" fill="none" title={t('summary.modifier')}>
|
||||
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" stroke="#60a5fa" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||
</svg>
|
||||
)
|
||||
if (hasDiscount) icons.push(
|
||||
<svg key="disc" width="10" height="10" viewBox="0 0 24 24" fill="none" title="Έκπτωση">
|
||||
<svg key="disc" width="10" height="10" viewBox="0 0 24 24" fill="none" title={t('summary.discount')}>
|
||||
<circle cx="9" cy="9" r="2" stroke="#c084fc" strokeWidth="2"/>
|
||||
<circle cx="15" cy="15" r="2" stroke="#c084fc" strokeWidth="2"/>
|
||||
<path d="M5 19L19 5" stroke="#c084fc" strokeWidth="2" strokeLinecap="round"/>
|
||||
</svg>
|
||||
)
|
||||
if (hasFree) icons.push(
|
||||
<svg key="free" width="10" height="10" viewBox="0 0 24 24" fill="none" title="Δωρεάν">
|
||||
<svg key="free" width="10" height="10" viewBox="0 0 24 24" fill="none" title={t('summary.free')}>
|
||||
<path d="M20 12v10H4V12M22 7H2v5h20V7z" stroke="#4ade80" strokeWidth="2" strokeLinecap="round"/>
|
||||
</svg>
|
||||
)
|
||||
@@ -285,6 +289,7 @@ function PricingBadge({ events }) {
|
||||
|
||||
// Deal badge on items that triggered or were added by a deal
|
||||
function DealBadge({ item }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
if (item.deal_id) {
|
||||
return (
|
||||
<span style={{
|
||||
@@ -292,7 +297,7 @@ function DealBadge({ item }) {
|
||||
background: 'rgba(167,139,250,0.15)', color: '#a78bfa',
|
||||
border: '1px solid rgba(167,139,250,0.4)', flexShrink: 0, letterSpacing: 0.3,
|
||||
}}>
|
||||
ΔΩΡΕΑΝ
|
||||
{t('summary.freeCaps')}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
@@ -315,6 +320,7 @@ function MergedBadge({ item }) {
|
||||
// ── ItemRow ───────────────────────────────────────────────────────────────────
|
||||
|
||||
function ItemRow({ item, selectable, selected, onToggle, onLongPress, isLast, kdsDisplayStyle, orderItemLayout, waiterMap, courses, priceEvents }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const isPaid = item.status === 'paid'
|
||||
const isCancelled = item.status === 'cancelled'
|
||||
const effectiveKds = item.kds_status || 'pending'
|
||||
@@ -390,10 +396,10 @@ function ItemRow({ item, selectable, selected, onToggle, onLongPress, isLast, kd
|
||||
</span>
|
||||
)
|
||||
|
||||
const paidBadge = isPaid && !isServed ? <span className="badge badge--paid">Paid</span> : null
|
||||
const cancelledBadge = isCancelled ? <span className="badge badge--cancelled">Cancelled</span> : null
|
||||
const paidBadge = isPaid && !isServed ? <span className="badge badge--paid">{t('summary.paidBadge')}</span> : null
|
||||
const cancelledBadge = isCancelled ? <span className="badge badge--cancelled">{t('summary.cancelledBadge')}</span> : null
|
||||
const draftBadge = !isPaid && !isCancelled && !item.printed
|
||||
? <span className="badge badge--draft" title="Δεν εκτυπώθηκε ακόμα">⏳</span>
|
||||
? <span className="badge badge--draft" title={t('summary.notPrinted')}>⏳</span>
|
||||
: null
|
||||
|
||||
// Whole-card click+touch handlers on the outer wrapper
|
||||
@@ -592,7 +598,7 @@ function ItemRow({ item, selectable, selected, onToggle, onLongPress, isLast, kd
|
||||
|
||||
{/* Ordered by */}
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<span style={{ fontSize: 11, color: 'var(--muted)', minWidth: 90 }}>Παραγγέλθηκε</span>
|
||||
<span style={{ fontSize: 11, color: 'var(--muted)', minWidth: 90 }}>{t('summary.ordered')}</span>
|
||||
<span style={{ flex: 1 }} />
|
||||
<span style={{ fontSize: 11, color: 'var(--muted)', textAlign: 'right' }}>
|
||||
{addedByName && addedAtFmt ? `${addedByName} · ${addedAtFmt}` : addedByName || addedAtFmt || '—'}
|
||||
@@ -602,7 +608,7 @@ function ItemRow({ item, selectable, selected, onToggle, onLongPress, isLast, kd
|
||||
{/* Paid by — only if paid */}
|
||||
{isPaid && (
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<span style={{ fontSize: 11, color: 'var(--muted)', minWidth: 90 }}>Πληρώθηκε</span>
|
||||
<span style={{ fontSize: 11, color: 'var(--muted)', minWidth: 90 }}>{t('summary.paidAt')}</span>
|
||||
<span style={{ flex: 1 }} />
|
||||
<span style={{ fontSize: 11, color: 'var(--muted)', textAlign: 'right' }}>
|
||||
{paidByName && paidAtFmt ? `${paidByName} · ${paidAtFmt}` : paidByName || paidAtFmt || '—'}
|
||||
@@ -646,7 +652,7 @@ function ItemRow({ item, selectable, selected, onToggle, onLongPress, isLast, kd
|
||||
{sec.type === 'removed' && sec.lines.map((line, li) => (
|
||||
<div key={li} style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||
<SectionIcon type="removed" />
|
||||
<span style={{ fontSize: 11, color: 'var(--text)', flex: 1 }}>Χωρίς {line.name}</span>
|
||||
<span style={{ fontSize: 11, color: 'var(--text)', flex: 1 }}>{t('drawer.without', { name: line.name })}</span>
|
||||
</div>
|
||||
))}
|
||||
{sec.type === 'note' && sec.lines.map((line, li) => (
|
||||
@@ -665,6 +671,7 @@ function ItemRow({ item, selectable, selected, onToggle, onLongPress, isLast, kd
|
||||
}
|
||||
|
||||
export default function OrderSummary({ order, selectable = false, selectedIds = [], onToggle, onLongPressItem, waiterMap, courses = [], priceEventsMap = {} }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const kdsDisplayStyle = useTableViewStore(s => s.kdsDisplayStyle || 'badge')
|
||||
const orderItemLayout = useTableViewStore(s => s.orderItemLayout || 'compact')
|
||||
const activeItems = order.items?.filter(i => i.status !== 'cancelled') || []
|
||||
@@ -677,7 +684,7 @@ export default function OrderSummary({ order, selectable = false, selectedIds =
|
||||
|
||||
return (
|
||||
<div className="order-summary">
|
||||
{activeItems.length === 0 && <p style={{ color: '#64748b', textAlign: 'center' }}>Δεν υπάρχουν αντικείμενα</p>}
|
||||
{activeItems.length === 0 && <p style={{ color: '#64748b', textAlign: 'center' }}>{t('summary.noItems')}</p>}
|
||||
{activeItems.map((item, idx) => (
|
||||
<ItemRow
|
||||
key={item.id}
|
||||
@@ -695,18 +702,18 @@ export default function OrderSummary({ order, selectable = false, selectedIds =
|
||||
/>
|
||||
))}
|
||||
<div className="order-summary__total">
|
||||
<span>Σύνολο</span>
|
||||
<span>{t('common.total')}</span>
|
||||
<span>{fmtPrice(total)}</span>
|
||||
</div>
|
||||
{paidTotal > 0 && paidTotal < total && (
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0 12px 8px', fontSize: 13, color: '#64748b' }}>
|
||||
<span>Πληρωμένο</span>
|
||||
<span>{t('tables.quick.paid')}</span>
|
||||
<span style={{ color: '#22c55e' }}>{fmtPrice(paidTotal)}</span>
|
||||
</div>
|
||||
)}
|
||||
{paidTotal > 0 && paidTotal < total && (
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0 12px 8px', fontSize: 13, color: '#94a3b8' }}>
|
||||
<span>Εκκρεμεί</span>
|
||||
<span>{t('summary.due')}</span>
|
||||
<span style={{ color: '#f59e0b', fontWeight: 700 }}>{fmtPrice(total - paidTotal)}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { useState } from 'react'
|
||||
import { money } from '../i18n'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
const _UNIT_LABELS = { kg: 'kg', liter: 'L', gram: 'g', ml: 'mL' }
|
||||
function fmtQty(qty, unitType) {
|
||||
@@ -7,7 +9,7 @@ function fmtQty(qty, unitType) {
|
||||
if (unitType === 'kg' || unitType === 'liter') return `${Number(qty).toFixed(1)}${label}`
|
||||
return `${qty}${label}`
|
||||
}
|
||||
function fmtEUR(v) { return Number(v || 0).toFixed(2) + ' €' }
|
||||
const fmtEUR = money
|
||||
|
||||
// Flatten selected_options into readable lines
|
||||
function describeOptions(selected_options) {
|
||||
@@ -15,13 +17,14 @@ function describeOptions(selected_options) {
|
||||
return selected_options.map(o => {
|
||||
let s = o.name || ''
|
||||
if (o.price_delta && Math.abs(o.price_delta) > 0.001) {
|
||||
s += ` (${o.price_delta > 0 ? '+' : ''}${o.price_delta.toFixed(2)} €)`
|
||||
s += ` (${o.price_delta > 0 ? '+' : ''}${money(o.price_delta)})`
|
||||
}
|
||||
return s
|
||||
}).filter(Boolean)
|
||||
}
|
||||
|
||||
function CartItemSummaryRow({ item, product, price, estimated, onEdit }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const opts = describeOptions(item.selected_options)
|
||||
const removed = item.removed_ingredients || []
|
||||
|
||||
@@ -63,7 +66,7 @@ function CartItemSummaryRow({ item, product, price, estimated, onEdit }) {
|
||||
onClick={onEdit}
|
||||
style={{ background: 'var(--bg3)', border: '1px solid var(--border)', borderRadius: 7, padding: '3px 10px', fontSize: 12, color: 'var(--muted)', cursor: 'pointer', fontWeight: 600 }}
|
||||
>
|
||||
Επεξεργασία
|
||||
{t('summaryModal.edit')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -75,6 +78,7 @@ function CartItemSummaryRow({ item, product, price, estimated, onEdit }) {
|
||||
// prices / total: the server's (POST /api/orders/quote, plan step 4.4) or, offline, the menu's
|
||||
// estimate (`estimated`); priceError: a line the server would refuse.
|
||||
export default function OrderSummaryModal({ cart, products, prices, total, estimated, priceError, orderNote, setOrderNote, onSend, onClose, sending }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [noteEditing, setNoteEditing] = useState(false)
|
||||
|
||||
function getProduct(id) { return products.find(p => p.id === id) }
|
||||
@@ -101,8 +105,8 @@ export default function OrderSummaryModal({ cart, products, prices, total, estim
|
||||
padding: '14px 16px', borderBottom: '1px solid var(--border)', flexShrink: 0,
|
||||
}}>
|
||||
<div>
|
||||
<div style={{ fontSize: 17, fontWeight: 800, color: 'var(--text)' }}>Επισκόπηση Παραγγελίας</div>
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 1 }}>{cart.length} {cart.length === 1 ? 'προϊόν' : 'προϊόντα'} · {estimated ? '≈ ' : ''}{fmtEUR(total)}</div>
|
||||
<div style={{ fontSize: 17, fontWeight: 800, color: 'var(--text)' }}>{t('summaryModal.title')}</div>
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 1 }}>{t('add.products', { count: cart.length })} · {estimated ? '≈ ' : ''}{fmtEUR(total)}</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={onClose}
|
||||
@@ -129,7 +133,7 @@ export default function OrderSummaryModal({ cart, products, prices, total, estim
|
||||
{/* Order note section */}
|
||||
<div style={{ marginTop: 16, marginBottom: 8 }}>
|
||||
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.7, marginBottom: 8 }}>
|
||||
Σημείωση Παραγγελίας
|
||||
{t('add.note.title')}
|
||||
</div>
|
||||
{noteEditing ? (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
|
||||
@@ -137,7 +141,7 @@ export default function OrderSummaryModal({ cart, products, prices, total, estim
|
||||
autoFocus
|
||||
value={orderNote}
|
||||
onChange={e => setOrderNote(e.target.value)}
|
||||
placeholder="Σημείωση για ολόκληρη την παραγγελία…"
|
||||
placeholder={t('add.note.placeholder')}
|
||||
rows={3}
|
||||
style={{
|
||||
width: '100%', resize: 'none', padding: '10px 12px',
|
||||
@@ -150,7 +154,7 @@ export default function OrderSummaryModal({ cart, products, prices, total, estim
|
||||
onClick={() => setNoteEditing(false)}
|
||||
style={{ alignSelf: 'flex-end', background: 'none', border: 'none', fontSize: 12, fontWeight: 700, color: 'var(--accent)', cursor: 'pointer' }}
|
||||
>
|
||||
Αποθήκευση
|
||||
{t('common.save')}
|
||||
</button>
|
||||
</div>
|
||||
) : orderNote ? (
|
||||
@@ -172,14 +176,14 @@ export default function OrderSummaryModal({ cart, products, prices, total, estim
|
||||
}}
|
||||
>
|
||||
<svg width="15" height="15" viewBox="0 0 24 24" fill="none"><path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/></svg>
|
||||
Προσθήκη σημείωσης παραγγελίας
|
||||
{t('add.note.add')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Total */}
|
||||
<div style={{ marginTop: 12, marginBottom: 4, display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 4px', borderTop: '1px solid var(--border)' }}>
|
||||
<span style={{ fontSize: 14, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6 }}>{estimated ? 'Σύνολο (εκτίμηση)' : 'Σύνολο'}</span>
|
||||
<span style={{ fontSize: 14, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6 }}>{estimated ? t('add.totalEstimate') : t('common.total')}</span>
|
||||
<span data-testid="summary-total" data-estimated={estimated ? 'true' : 'false'} style={{ fontSize: 20, fontWeight: 800, color: 'var(--text)', fontVariantNumeric: 'tabular-nums' }}>{estimated ? '≈ ' : ''}{fmtEUR(total)}</span>
|
||||
</div>
|
||||
{priceError && <div style={{ fontSize: 12, color: 'var(--danger)', padding: '0 4px 8px' }}>{priceError}</div>}
|
||||
@@ -193,7 +197,7 @@ export default function OrderSummaryModal({ cart, products, prices, total, estim
|
||||
onClick={onSend}
|
||||
disabled={sending}
|
||||
>
|
||||
{sending ? 'Αποστολή…' : `ΑΠΟΣΤΟΛΗ (${cart.length})`}
|
||||
{sending ? t('add.sending') : t('add.sendCount', { count: cart.length })}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ import { useNavigate } from 'react-router-dom'
|
||||
import OrderDrawer from './OrderDrawer'
|
||||
import useWaiterFavoritesStore from '../store/waiterFavoritesStore'
|
||||
import { assetUrl } from '../config/server'
|
||||
import { money } from '../i18n'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
const FAV_CAT_ID = '__favorites__'
|
||||
const SVC_CAT_ID = '__service__'
|
||||
@@ -132,7 +134,7 @@ function ProductDetailModal({ product, onClose }) {
|
||||
{product.name}
|
||||
</div>
|
||||
<div style={{ fontSize: 18, fontWeight: 700, color: 'var(--accent, #f59e0b)', marginBottom: product.description ? 14 : 0 }}>
|
||||
{Number(product.base_price).toFixed(2)} €
|
||||
{money(product.base_price)}
|
||||
</div>
|
||||
{product.description && (
|
||||
<div style={{
|
||||
@@ -215,7 +217,7 @@ function ProductCard({ product, onOpen, onQuickAdd, onShowDetail }) {
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<span className="product-btn__price">{Number(product.base_price).toFixed(2)} €</span>
|
||||
<span className="product-btn__price">{money(product.base_price)}</span>
|
||||
</div>
|
||||
|
||||
{canQuickAdd && (
|
||||
@@ -249,6 +251,7 @@ function ProductCard({ product, onOpen, onQuickAdd, onShowDetail }) {
|
||||
|
||||
// ── Service Item Card ─────────────────────────────────────────────────────────
|
||||
function ServiceItemCard({ product, customerCount, onAdd }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [qty, setQty] = useState(0)
|
||||
|
||||
function dec() { setQty(q => Math.max(0, q - 1)) }
|
||||
@@ -279,7 +282,7 @@ function ServiceItemCard({ product, customerCount, onAdd }) {
|
||||
{product.name}
|
||||
</span>
|
||||
<span style={{ fontSize: 13, fontWeight: 600, color: hasPrice ? '#f59e0b' : 'var(--muted)', flexShrink: 0 }}>
|
||||
{hasPrice ? `${Number(product.base_price).toFixed(2)} €` : 'no charge'}
|
||||
{hasPrice ? money(product.base_price) : t('picker.noCharge')}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -300,7 +303,7 @@ function ServiceItemCard({ product, customerCount, onAdd }) {
|
||||
<button
|
||||
onPointerDown={e => e.stopPropagation()}
|
||||
onClick={setToCustomerCount}
|
||||
title={`Ορισμός σε ${customerCount ?? 1} άτομα`}
|
||||
title={t('picker.setToGuests', { count: customerCount ?? 1 })}
|
||||
style={{
|
||||
...btnBase,
|
||||
background: 'rgba(245,158,11,0.12)',
|
||||
@@ -369,11 +372,12 @@ function ServiceItemCard({ product, customerCount, onAdd }) {
|
||||
}
|
||||
|
||||
function ServiceItemView({ products, customerCount, onAdd }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, padding: '12px 14px' }}>
|
||||
{products.length === 0 ? (
|
||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: 32 }}>
|
||||
Δεν υπάρχουν service αντικείμενα
|
||||
{t('picker.noService')}
|
||||
</p>
|
||||
) : products.map(p => (
|
||||
<ServiceItemCard
|
||||
@@ -422,6 +426,7 @@ function buildSections(parent, subcategories, directProducts) {
|
||||
}
|
||||
|
||||
export default function ProductPicker({ categories, products, onAdd, onQuickAdd: onQuickAddProp, viewAllOpen, setViewAllOpen, customerCount, courses = [], globalCourseId = null, quickNotes }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const navigate = useNavigate()
|
||||
const favorites = useWaiterFavoritesStore(s => s.favorites)
|
||||
|
||||
@@ -541,7 +546,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
||||
<svg width="13" height="13" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" strokeWidth="1" strokeLinecap="round" strokeLinejoin="round">
|
||||
<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>
|
||||
Αγαπημένα
|
||||
{t('settings.tabs.favorites')}
|
||||
</button>
|
||||
)}
|
||||
{topLevel.map(cat => {
|
||||
@@ -591,7 +596,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
||||
<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={{ color: 'var(--muted)', fontSize: 14, textAlign: 'center', lineHeight: 1.6 }}>
|
||||
Δεν έχεις αγαπημένα ακόμα.
|
||||
{t('picker.noFavorites')}
|
||||
</p>
|
||||
<button
|
||||
onClick={() => navigate('/settings/favorites')}
|
||||
@@ -601,7 +606,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
||||
border: 'none', fontSize: 14, fontWeight: 700, cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
Ρύθμιση Αγαπημένων
|
||||
{t('settings.fav.setup')}
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
@@ -616,7 +621,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
||||
/>
|
||||
{flatProducts.length === 0 && (
|
||||
<p style={{ color: '#64748b', textAlign: 'center', padding: 32 }}>
|
||||
Δεν υπάρχουν προϊόντα
|
||||
{t('picker.noProducts')}
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
@@ -682,7 +687,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* View All modal — Κατηγορίες + Tags tabs */}
|
||||
{/* View All modal — categories + tags tabs */}
|
||||
{viewAllOpen && (
|
||||
<div className="modal-overlay" onClick={() => setViewAllOpen(false)}>
|
||||
<div
|
||||
@@ -691,7 +696,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
||||
style={{ display: 'flex', flexDirection: 'column' }}
|
||||
>
|
||||
<div className="cat-all-modal__header">
|
||||
<span className="cat-all-modal__title">{modalTab === 'categories' ? 'Κατηγορίες' : 'Tags'}</span>
|
||||
<span className="cat-all-modal__title">{modalTab === 'categories' ? t('picker.categories') : t('picker.tags')}</span>
|
||||
<button className="icon-btn" onClick={() => setViewAllOpen(false)}>✕</button>
|
||||
</div>
|
||||
|
||||
@@ -711,7 +716,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
||||
transition: 'color 0.12s',
|
||||
}}
|
||||
>
|
||||
{tab === 'categories' ? 'Κατηγορίες' : 'Tags'}
|
||||
{tab === 'categories' ? t('picker.categories') : t('picker.tags')}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
@@ -729,7 +734,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
||||
<svg width="13" height="13" viewBox="0 0 24 24" fill="white" stroke="white" strokeWidth="1" style={{ flexShrink: 0 }}>
|
||||
<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>
|
||||
Αγαπημένα
|
||||
{t('settings.tabs.favorites')}
|
||||
</span>
|
||||
</button>
|
||||
)}
|
||||
@@ -757,7 +762,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
||||
const taggedProducts = activeTag ? products.filter(p => (p.tags || []).includes(activeTag)) : []
|
||||
const byCategory = taggedProducts.reduce((acc, p) => {
|
||||
const cat = categories.find(c => c.id === p.category_id)
|
||||
const key = cat?.name || 'Χωρίς Κατηγορία'
|
||||
const key = cat?.name || t('picker.noCategory')
|
||||
if (!acc[key]) acc[key] = []
|
||||
acc[key].push(p)
|
||||
return acc
|
||||
@@ -767,7 +772,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
||||
<div style={{ flex: 1, overflowY: 'auto', display: 'flex', flexDirection: 'column' }}>
|
||||
{allTags.length === 0 && (
|
||||
<div style={{ padding: '32px 16px', textAlign: 'center', color: 'var(--muted)', fontSize: 14 }}>
|
||||
Δεν υπάρχουν tags ακόμα.
|
||||
{t('picker.noTags')}
|
||||
</div>
|
||||
)}
|
||||
{allTags.length > 0 && (
|
||||
@@ -791,7 +796,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
||||
)}
|
||||
{activeTag && taggedProducts.length === 0 && (
|
||||
<div style={{ padding: '24px 16px', textAlign: 'center', color: 'var(--muted)', fontSize: 14 }}>
|
||||
Κανένα προϊόν με αυτό το tag.
|
||||
{t('picker.noTagged')}
|
||||
</div>
|
||||
)}
|
||||
{activeTag && Object.entries(byCategory).map(([catName, prods]) => (
|
||||
@@ -811,7 +816,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
||||
}}
|
||||
>
|
||||
<span style={{ fontSize: 14, fontWeight: 600, color: 'var(--text)' }}>{p.name}</span>
|
||||
<span style={{ fontSize: 13, color: 'var(--muted)' }}>€{Number(p.base_price).toFixed(2)}</span>
|
||||
<span style={{ fontSize: 13, color: 'var(--muted)' }}>{money(p.base_price)}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import QrScanner from 'qr-scanner'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
const MSG_DENIED = 'Δεν δόθηκε άδεια κάμερας. Επιτρέψτε την από τις ρυθμίσεις του κινητού ή πληκτρολογήστε τη διεύθυνση.'
|
||||
const MSG_NO_CAMERA = 'Δεν ήταν δυνατή η ενεργοποίηση της κάμερας. Πληκτρολογήστε τη διεύθυνση.'
|
||||
const MSG_DENIED = 'qr.denied'
|
||||
const MSG_NO_CAMERA = 'qr.noCamera'
|
||||
|
||||
/**
|
||||
* Full-screen camera view that resolves the first QR code it sees.
|
||||
@@ -11,6 +12,7 @@ const MSG_NO_CAMERA = 'Δεν ήταν δυνατή η ενεργοποίηση
|
||||
* the normal Android runtime permission prompt.
|
||||
*/
|
||||
export default function QrScannerModal({ onResult, onClose }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const videoRef = useRef(null)
|
||||
const [error, setError] = useState(null)
|
||||
|
||||
@@ -73,17 +75,17 @@ export default function QrScannerModal({ onResult, onClose }) {
|
||||
padding: 32, textAlign: 'center', color: '#e2e8f0', fontSize: 15, lineHeight: 1.5,
|
||||
background: 'rgba(15,23,42,0.92)',
|
||||
}}>
|
||||
{error}
|
||||
{t(error)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div style={{ padding: 16, display: 'flex', flexDirection: 'column', gap: 10, background: '#0f172a' }}>
|
||||
{!error && (
|
||||
<p style={{ color: '#94a3b8', fontSize: 13, textAlign: 'center' }}>
|
||||
Σκοπεύστε το QR από τον διαχειριστή (Ρυθμίσεις → Γενικά → Σερβιτόροι WiFi)
|
||||
{t('qr.aim')}
|
||||
</p>
|
||||
)}
|
||||
<button className="btn btn--secondary btn--lg" onClick={onClose} style={{ width: '100%' }}>Ακύρωση</button>
|
||||
<button className="btn btn--secondary btn--lg" onClick={onClose} style={{ width: '100%' }}>{t('common.cancel')}</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -2,12 +2,14 @@ import { useEffect, useState } from 'react'
|
||||
import db from '../db/posdb'
|
||||
import { clearRefusedLines, refusedLines } from '../services/offlineOrders'
|
||||
import useAuthStore from '../store/authStore'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
// Lines of an order taken offline that the server refused when the phone came back (plan
|
||||
// step 4.4): a product taken off the menu meanwhile, an option deleted, a price change not
|
||||
// allowed. They are never dropped silently: this sheet lists them, with the reason, until the
|
||||
// waiter confirms they've seen them (and dealt with the table).
|
||||
export default function RefusedLines() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const token = useAuthStore(s => s.token)
|
||||
const [lines, setLines] = useState([])
|
||||
|
||||
@@ -30,9 +32,9 @@ export default function RefusedLines() {
|
||||
<div className="modal-overlay" data-testid="refused-lines">
|
||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title">Δεν στάλθηκαν</h2>
|
||||
<h2 className="modal-title">{t('refused.title')}</h2>
|
||||
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 14px' }}>
|
||||
Τα παρακάτω πάρθηκαν χωρίς σύνδεση και ο server δεν τα δέχτηκε. Ελέγξτε τα τραπέζια.
|
||||
{t('refused.body')}
|
||||
</p>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginBottom: 16, maxHeight: '45vh', overflowY: 'auto' }}>
|
||||
{lines.map((l, i) => (
|
||||
@@ -46,7 +48,7 @@ export default function RefusedLines() {
|
||||
))}
|
||||
</div>
|
||||
<button className="btn btn--primary" style={{ width: '100%' }} data-testid="refused-lines-ok" onClick={() => clearRefusedLines()}>
|
||||
Το είδα
|
||||
{t('refused.ok')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import useConnectionStore from '../store/connectionStore'
|
||||
import { canRediscover, rediscover, upgradeToTls } from '../native/autoRediscover'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
const WATCHDOG_MS = 60_000
|
||||
const RELOAD_DELAY_MS = 1500
|
||||
@@ -20,6 +21,7 @@ const RELOAD_DELAY_MS = 1500
|
||||
* IndexedDB and syncs after the reload.
|
||||
*/
|
||||
export default function ServerRediscovery() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [movedTo, setMovedTo] = useState(null)
|
||||
const enabled = canRediscover()
|
||||
|
||||
@@ -65,10 +67,10 @@ export default function ServerRediscovery() {
|
||||
<div>
|
||||
<div style={{ fontSize: 44, marginBottom: 12 }}>🔄</div>
|
||||
<p style={{ color: '#e2e8f0', fontSize: 17, fontWeight: 600, marginBottom: 6 }}>
|
||||
Ο server άλλαξε διεύθυνση
|
||||
{t('offline.moved')}
|
||||
</p>
|
||||
<p style={{ color: '#94a3b8', fontSize: 14, fontFamily: 'monospace' }}>{movedTo}</p>
|
||||
<p style={{ color: '#94a3b8', fontSize: 14, marginTop: 10 }}>Επανασύνδεση…</p>
|
||||
<p style={{ color: '#94a3b8', fontSize: 14, marginTop: 10 }}>{t('offline.reconnecting')}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useRef, useState, useEffect } from 'react'
|
||||
import { useFormat, useTranslation } from '@xenia/i18n'
|
||||
import useThemeStore from '../store/themeStore'
|
||||
import useTableColourStore from '../store/tableColourStore'
|
||||
import { assetUrl } from '../config/server'
|
||||
@@ -36,11 +37,11 @@ function fmtItemQtyTC(qty, unitType) {
|
||||
|
||||
|
||||
const STATUS_LABELS = {
|
||||
free: 'ΕΛΕΥΘΕΡΟ',
|
||||
open: 'ΑΝΟΙΧΤΟ',
|
||||
mine: 'ΔΙΚΟ ΜΟΥ',
|
||||
paid: 'ΠΛΗΡΩΜΕΝΟ',
|
||||
partially_paid: 'ΜΕΡ. ΠΛHΡ.',
|
||||
free: 'card.free',
|
||||
open: 'card.open',
|
||||
mine: 'card.mine',
|
||||
paid: 'card.paid',
|
||||
partially_paid: 'card.partlyPaid',
|
||||
}
|
||||
|
||||
// ─── KDS badge helpers ────────────────────────────────────────────────────────
|
||||
@@ -131,6 +132,7 @@ function WaiterAvatar({ waiter, size = 22, ring }) {
|
||||
// Renders [icon] Name, [icon] Name inline. Falls back to icons + "X Waiters" if they don't fit
|
||||
// (we approximate "don't fit" as > 2 waiters for the compact footer height).
|
||||
function WaiterRow({ waiters, size = 22, cfg }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
if (!waiters?.length) return null
|
||||
const textColor = cfg.nameText
|
||||
|
||||
@@ -172,7 +174,7 @@ function WaiterRow({ waiters, size = 22, cfg }) {
|
||||
}}>+{waiters.length - 3}</div>
|
||||
)}
|
||||
<span style={{ fontSize: 12, fontWeight: 600, color: textColor, opacity: 0.7, marginLeft: 4 }}>
|
||||
{waiters.length} σερβιτόροι
|
||||
{t('card.waiters', { count: waiters.length })}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
@@ -266,14 +268,16 @@ function FlagChip({ flag }) {
|
||||
// ─── Amount display ───────────────────────────────────────────────────────────
|
||||
|
||||
function Amount({ value, size = 22, color }) {
|
||||
const s = Number(value || 0).toFixed(2)
|
||||
const [whole, cents] = s.split('.')
|
||||
// the venue's money format (4.5), the cents smaller: "2,40 €" / "€2.40"
|
||||
const { formatMoney } = useFormat()
|
||||
const m = /^(.*?)([.,])(\d{2})(\D*)$/.exec(formatMoney(Number(value || 0)))
|
||||
const [whole, cents] = m ? [m[1], `${m[2]}${m[3]}${m[4]}`] : [formatMoney(Number(value || 0)), '']
|
||||
const isNum = typeof size === 'number'
|
||||
const centsSize = isNum ? size * 0.56 : `calc(${size} * 0.56)`
|
||||
return (
|
||||
<div style={{ lineHeight: 1, color: color || 'inherit' }}>
|
||||
<span style={{ fontSize: size, fontWeight: 800, letterSpacing: -0.5 }}>{whole}</span>
|
||||
<span style={{ fontSize: centsSize, fontWeight: 800, opacity: 0.8 }}>.{cents}€</span>
|
||||
<span style={{ fontSize: centsSize, fontWeight: 800, opacity: 0.8 }}>{cents}</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -282,6 +286,7 @@ function Amount({ value, size = 22, color }) {
|
||||
|
||||
// 1x1 — square-ish, 4 per row. Badges top (up to 2 + +N), name center, KDS badge bottom (replaces status).
|
||||
function Card1x1({ table, _order, flags, _waiterObjects, cfg, statusKey, kdsBadge, flashOverlay }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
return (
|
||||
<div style={{
|
||||
width: '100%', aspectRatio: '1 / 1.05',
|
||||
@@ -319,7 +324,7 @@ function Card1x1({ table, _order, flags, _waiterObjects, cfg, statusKey, kdsBadg
|
||||
background: cfg.badgeBg, borderRadius: 3,
|
||||
padding: '1px 4px', whiteSpace: 'nowrap',
|
||||
}}>
|
||||
{STATUS_LABELS[statusKey]}
|
||||
{t(STATUS_LABELS[statusKey])}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
@@ -329,6 +334,7 @@ function Card1x1({ table, _order, flags, _waiterObjects, cfg, statusKey, kdsBadg
|
||||
|
||||
// 2x1 — half width, compact horizontal. Name left, KDS badge (or status) + flags right.
|
||||
function Card2x1({ table, _order, flags, _waiterObjects, cfg, statusKey, kdsBadge, flashOverlay }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
return (
|
||||
<div style={{
|
||||
width: '100%', height: 64,
|
||||
@@ -357,7 +363,7 @@ function Card2x1({ table, _order, flags, _waiterObjects, cfg, statusKey, kdsBadg
|
||||
{kdsBadge ? (
|
||||
<KdsBadge badge={kdsBadge} small />
|
||||
) : (
|
||||
<StatusPill label={STATUS_LABELS[statusKey]} badgeBg={cfg.badgeBg} badgeText={cfg.badgeText} small />
|
||||
<StatusPill label={t(STATUS_LABELS[statusKey])} badgeBg={cfg.badgeBg} badgeText={cfg.badgeText} small />
|
||||
)}
|
||||
{flags.length > 0 && (
|
||||
<FlagDots flags={flags} size={18} maxShow={3} />
|
||||
@@ -369,6 +375,7 @@ function Card2x1({ table, _order, flags, _waiterObjects, cfg, statusKey, kdsBadg
|
||||
|
||||
// 2x2 — current-style square. Name top-left, status below, amount bottom-left, KDS badge top-right, flags right.
|
||||
function Card2x2({ table, order, flags, _waiterObjects, cfg, statusKey, kdsBadge, flashOverlay }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const isFree = !order
|
||||
const total = order?.items?.filter(i => i.status === 'active').reduce((s, i) => s + i.unit_price * i.quantity, 0) ?? 0
|
||||
|
||||
@@ -392,7 +399,7 @@ function Card2x2({ table, order, flags, _waiterObjects, cfg, statusKey, kdsBadge
|
||||
{table.label || `T${table.number}`}
|
||||
</span>
|
||||
<div style={{ marginTop: 5 }}>
|
||||
<StatusPill label={STATUS_LABELS[statusKey]} badgeBg={cfg.badgeBg} badgeText={cfg.badgeText} small />
|
||||
<StatusPill label={t(STATUS_LABELS[statusKey])} badgeBg={cfg.badgeBg} badgeText={cfg.badgeText} small />
|
||||
</div>
|
||||
{/* Always reserve amount height — invisible when free */}
|
||||
<div style={{ marginTop: 'auto', paddingTop: 8, minHeight: 28, visibility: isFree ? 'hidden' : 'visible' }}>
|
||||
@@ -419,6 +426,7 @@ function Card2x2({ table, order, flags, _waiterObjects, cfg, statusKey, kdsBadge
|
||||
|
||||
// 4x1 — full width horizontal. Name + amount left-center, flags, KDS badge (or status) right.
|
||||
function Card4x1({ table, order, flags, _waiterObjects, cfg, statusKey, kdsBadge, flashOverlay }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const isFree = !order
|
||||
const total = order?.items?.filter(i => i.status === 'active').reduce((s, i) => s + i.unit_price * i.quantity, 0) ?? 0
|
||||
|
||||
@@ -462,7 +470,7 @@ function Card4x1({ table, order, flags, _waiterObjects, cfg, statusKey, kdsBadge
|
||||
{kdsBadge ? (
|
||||
<KdsBadge badge={kdsBadge} />
|
||||
) : (
|
||||
<StatusPill label={STATUS_LABELS[statusKey]} badgeBg={cfg.badgeBg} badgeText={cfg.badgeText} />
|
||||
<StatusPill label={t(STATUS_LABELS[statusKey])} badgeBg={cfg.badgeBg} badgeText={cfg.badgeText} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -471,6 +479,7 @@ function Card4x1({ table, order, flags, _waiterObjects, cfg, statusKey, kdsBadge
|
||||
|
||||
// 4x2 — full width, tall. Top row: name LEFT | status + KDS badge CENTER (v-centered with amount) | amount RIGHT.
|
||||
function Card4x2({ table, order, flags, waiterObjects, groupName, cfg, statusKey, kdsBadge, flashOverlay }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const isFree = !order
|
||||
const total = order?.items?.filter(i => i.status === 'active').reduce((s, i) => s + i.unit_price * i.quantity, 0) ?? 0
|
||||
const showWaiters = !isFree && waiterObjects.length > 0
|
||||
@@ -511,7 +520,7 @@ function Card4x2({ table, order, flags, waiterObjects, groupName, cfg, statusKey
|
||||
|
||||
{/* center: status + KDS badge side-by-side, vertically centered */}
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6, flexShrink: 0 }}>
|
||||
<StatusPill label={STATUS_LABELS[statusKey]} badgeBg={cfg.badgeBg} badgeText={cfg.badgeText} />
|
||||
<StatusPill label={t(STATUS_LABELS[statusKey])} badgeBg={cfg.badgeBg} badgeText={cfg.badgeText} />
|
||||
{kdsBadge && <KdsBadge badge={kdsBadge} />}
|
||||
</div>
|
||||
|
||||
@@ -555,6 +564,7 @@ function Card4x2({ table, order, flags, waiterObjects, groupName, cfg, statusKey
|
||||
|
||||
// 4x3 — full width, two-column detail card. Left: name/zone/status/amount. Right: items. KDS footer. Waiter footer.
|
||||
function Card4x3({ table, order, flags, waiterObjects, groupName, cfg, statusKey, _kdsBadge, flashOverlay }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const isFree = !order
|
||||
const activeItems = order?.items?.filter(i => i.status === 'active') ?? []
|
||||
const total = activeItems.reduce((s, i) => s + i.unit_price * i.quantity, 0)
|
||||
@@ -568,10 +578,10 @@ function Card4x3({ table, order, flags, waiterObjects, groupName, cfg, statusKey
|
||||
const preparing = relevant.filter(i => kds(i.kds_status) === 'preparing').length
|
||||
const done = relevant.filter(i => kds(i.kds_status) === 'done').length
|
||||
const total = relevant.length
|
||||
if (done === total && total > 0) return { text: 'Όλα Έτοιμα για Παράδοση', color: '#4ade80' }
|
||||
if (done === total && total > 0) return { text: t('card.allReady'), color: '#4ade80' }
|
||||
const parts = []
|
||||
if (preparing > 0) parts.push(`${preparing} Ετοιμάζεται`)
|
||||
if (done > 0) parts.push(`${done} Έτοιμα`)
|
||||
if (preparing > 0) parts.push(t('card.preparingCount', { count: preparing }))
|
||||
if (done > 0) parts.push(t('card.readyCount', { count: done }))
|
||||
return parts.length > 0 ? { text: parts.join(' · '), color: done > 0 ? '#4ade80' : '#60a5fa' } : null
|
||||
})()
|
||||
|
||||
@@ -611,7 +621,7 @@ function Card4x3({ table, order, flags, waiterObjects, groupName, cfg, statusKey
|
||||
</div>
|
||||
|
||||
<div style={{ marginTop: 8 }}>
|
||||
<StatusPill label={STATUS_LABELS[statusKey]} badgeBg={cfg.badgeBg} badgeText={cfg.badgeText} small />
|
||||
<StatusPill label={t(STATUS_LABELS[statusKey])} badgeBg={cfg.badgeBg} badgeText={cfg.badgeText} small />
|
||||
</div>
|
||||
|
||||
{flags.length > 0 && (
|
||||
@@ -628,11 +638,11 @@ function Card4x3({ table, order, flags, waiterObjects, groupName, cfg, statusKey
|
||||
<div style={{ flex: 1, minWidth: 0, overflow: 'hidden' }}>
|
||||
{isFree ? (
|
||||
<div style={{ height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
||||
<span style={{ fontSize: 12, color: cfg.nameText, opacity: 0.35 }}>Ελεύθερο</span>
|
||||
<span style={{ fontSize: 12, color: cfg.nameText, opacity: 0.35 }}>{t('card.freeLower')}</span>
|
||||
</div>
|
||||
) : activeItems.length === 0 ? (
|
||||
<div style={{ height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
||||
<span style={{ fontSize: 12, color: cfg.nameText, opacity: 0.35 }}>Κανένα είδος</span>
|
||||
<span style={{ fontSize: 12, color: cfg.nameText, opacity: 0.35 }}>{t('card.noItems')}</span>
|
||||
</div>
|
||||
) : (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 3, minWidth: 0 }}>
|
||||
@@ -654,7 +664,7 @@ function Card4x3({ table, order, flags, waiterObjects, groupName, cfg, statusKey
|
||||
))}
|
||||
{activeItems.length > 7 && (
|
||||
<div style={{ fontSize: 11, color: cfg.nameText, opacity: 0.5, marginTop: 2 }}>
|
||||
+{activeItems.length - 7} ακόμα…
|
||||
{t('card.more', { count: activeItems.length - 7 })}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { useRegisterSW } from 'virtual:pwa-register/react'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
export default function UpdatePrompt() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const {
|
||||
needRefresh: [needRefresh],
|
||||
updateServiceWorker,
|
||||
@@ -26,7 +28,7 @@ export default function UpdatePrompt() {
|
||||
whiteSpace: 'nowrap',
|
||||
}}>
|
||||
<span style={{ fontSize: 14, color: 'var(--text)', fontWeight: 500 }}>
|
||||
Νέα έκδοση διαθέσιμη
|
||||
{t('update.available')}
|
||||
</span>
|
||||
<button
|
||||
onClick={() => updateServiceWorker(true)}
|
||||
@@ -41,7 +43,7 @@ export default function UpdatePrompt() {
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
Ενημέρωση
|
||||
{t('update.update')}
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useCan } from '@xenia/access'
|
||||
import { useAccess, useCan } from '@xenia/access'
|
||||
import { LANGUAGE_NAMES, setUserLanguage, useFormat, useLanguage, useTranslation } from '@xenia/i18n'
|
||||
import useAuthStore from '../store/authStore'
|
||||
import useShiftStore from '../store/shiftStore'
|
||||
import useThemeStore from '../store/themeStore'
|
||||
import client from '../api/client'
|
||||
import { deliveryMode, getActiveVenue } from '../config/server'
|
||||
|
||||
function formatTime(iso) {
|
||||
if (!iso) return ''
|
||||
return new Date(iso).toLocaleTimeString('el-GR', { hour: '2-digit', minute: '2-digit' })
|
||||
}
|
||||
|
||||
function formatDuration(iso) {
|
||||
function formatDuration(iso, t) {
|
||||
if (!iso) return ''
|
||||
const mins = Math.floor((Date.now() - new Date(iso).getTime()) / 60000)
|
||||
if (mins < 60) return `${mins}λ`
|
||||
if (mins < 60) return t('common.minutesShort', { m: mins })
|
||||
const h = Math.floor(mins / 60)
|
||||
const m = mins % 60
|
||||
return m === 0 ? `${h}ω` : `${h}ω ${m}λ`
|
||||
return m === 0 ? t('common.hoursShort', { h }) : t('common.hoursMinutesShort', { h, m })
|
||||
}
|
||||
|
||||
export default function UserMenu() {
|
||||
const { t, i18n } = useTranslation('waiter')
|
||||
const { formatTime, formatMoney } = useFormat()
|
||||
const { language, languages } = useLanguage()
|
||||
const { refresh } = useAccess()
|
||||
const [open, setOpen] = useState(false)
|
||||
const [busy, setBusy] = useState(false)
|
||||
const ref = useRef(null)
|
||||
@@ -41,6 +41,18 @@ export default function UserMenu() {
|
||||
return () => document.removeEventListener('mousedown', onClick)
|
||||
}, [])
|
||||
|
||||
// The screen changes at once; the choice is saved to the profile and the bootstrap reloaded,
|
||||
// so it holds on the next sign-in and on the other apps.
|
||||
async function chooseLanguage(lng) {
|
||||
setOpen(false)
|
||||
try {
|
||||
await setUserLanguage(i18n, lng, { save: l => client.patch('/api/auth/me', { language: l }) })
|
||||
await refresh()
|
||||
} catch {
|
||||
window.alert(t('menu.languageNotSaved'))
|
||||
}
|
||||
}
|
||||
|
||||
function handleLogout() {
|
||||
setOpen(false)
|
||||
logout()
|
||||
@@ -52,7 +64,7 @@ export default function UserMenu() {
|
||||
const isWaiter = !canDashboard // works in a shift (plan 4.1: the key, not the role)
|
||||
|
||||
async function handleEndShift() {
|
||||
if (!window.confirm('Να τελειώσει η βάρδια σου;')) return
|
||||
if (!window.confirm(t('menu.endShiftConfirm'))) return
|
||||
setBusy(true)
|
||||
try {
|
||||
await client.post('/api/shifts/end', {})
|
||||
@@ -86,7 +98,7 @@ export default function UserMenu() {
|
||||
<div ref={ref} style={{ position: 'relative' }}>
|
||||
<button
|
||||
onClick={() => setOpen(o => !o)}
|
||||
title="Μενού χρήστη"
|
||||
title={t('menu.title')} data-testid="user-menu"
|
||||
style={{
|
||||
display: 'flex', alignItems: 'center', gap: 6,
|
||||
padding: '8px 14px', borderRadius: 20, border: '2px solid transparent',
|
||||
@@ -122,20 +134,20 @@ export default function UserMenu() {
|
||||
margin: '4px 8px 2px',
|
||||
}}>
|
||||
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, marginBottom: 4 }}>
|
||||
Βάρδια ενεργή
|
||||
{t('menu.shiftActive')}
|
||||
</div>
|
||||
<div style={{ fontSize: 13, color: 'var(--text)', display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span>Από {formatTime(shift.started_at)}</span>
|
||||
<span style={{ color: 'var(--muted)' }}>{formatDuration(shift.started_at)}</span>
|
||||
<span>{t('menu.since', { time: formatTime(shift.started_at) })}</span>
|
||||
<span style={{ color: 'var(--muted)' }}>{formatDuration(shift.started_at, t)}</span>
|
||||
</div>
|
||||
{shift.starting_cash != null && (
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>
|
||||
Αρχικά: €{shift.starting_cash.toFixed(2)}
|
||||
{t('menu.startingCash', { amount: formatMoney(shift.starting_cash) })}
|
||||
</div>
|
||||
)}
|
||||
{activeBreak && (
|
||||
<div style={{ fontSize: 12, color: 'var(--accent)', marginTop: 4, fontWeight: 600 }}>
|
||||
☕ Σε διάλειμμα από {formatTime(activeBreak.started_at)}
|
||||
☕ {t('menu.onBreakSince', { time: formatTime(activeBreak.started_at) })}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -147,7 +159,7 @@ export default function UserMenu() {
|
||||
disabled={busy}
|
||||
>
|
||||
<span className="user-menu-item__icon">{activeBreak ? '▶' : '☕'}</span>
|
||||
<span>{activeBreak ? 'Τέλος Διαλείμματος' : 'Διάλειμμα'}</span>
|
||||
<span>{activeBreak ? t('menu.endBreak') : t('menu.break')}</span>
|
||||
</button>
|
||||
|
||||
{/* End shift button */}
|
||||
@@ -159,11 +171,11 @@ export default function UserMenu() {
|
||||
style={{ color: 'var(--danger)' }}
|
||||
>
|
||||
<span className="user-menu-item__icon">⏹</span>
|
||||
<span>Τέλος Βάρδιας</span>
|
||||
<span>{t('menu.endShift')}</span>
|
||||
</button>
|
||||
) : (
|
||||
<div style={{ padding: '8px 16px', fontSize: 12, color: 'var(--muted)', fontStyle: 'italic' }}>
|
||||
Ζητήστε από τον διαχειριστή να κλείσει τη βάρδια
|
||||
{t('menu.askManagerToEnd')}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -175,27 +187,35 @@ export default function UserMenu() {
|
||||
{deliveryMode() === 'native' && (
|
||||
<button className="user-menu-item" onClick={() => { setOpen(false); navigate('/venues') }}>
|
||||
<span className="user-menu-item__icon">🏪</span>
|
||||
<span>Κατάστημα: {getActiveVenue()?.name ?? '—'}</span>
|
||||
<span>{t('menu.venue', { name: getActiveVenue()?.name ?? '—' })}</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* ── Theme toggle ──────────────────────────────────── */}
|
||||
<button className="user-menu-item" onClick={() => { toggle(); setOpen(false) }}>
|
||||
<span className="user-menu-item__icon">{dark ? '☀️' : '🌙'}</span>
|
||||
<span>{dark ? 'Φωτεινό θέμα' : 'Σκοτεινό θέμα'}</span>
|
||||
<span>{dark ? t('menu.lightTheme') : t('menu.darkTheme')}</span>
|
||||
</button>
|
||||
|
||||
{/* ── Language (plan step 4.5, D-12): saved to the person's profile ── */}
|
||||
{languages.filter(l => l !== language).map(l => (
|
||||
<button key={l} className="user-menu-item" data-testid={`menu-language-${l}`} onClick={() => chooseLanguage(l)}>
|
||||
<span className="user-menu-item__icon">🌐</span>
|
||||
<span>{LANGUAGE_NAMES[l] ?? l}</span>
|
||||
</button>
|
||||
))}
|
||||
|
||||
<div className="user-menu-divider" />
|
||||
|
||||
{/* ── Lock (plan step 4.2): the same waiter unlocks with their PIN ── */}
|
||||
<button className="user-menu-item" data-testid="menu-lock" onClick={() => { setOpen(false); lock() }}>
|
||||
<span className="user-menu-item__icon">🔒</span>
|
||||
<span>Κλείδωμα</span>
|
||||
<span>{t('menu.lock')}</span>
|
||||
</button>
|
||||
|
||||
<button className="user-menu-item user-menu-item--danger" onClick={handleLogout}>
|
||||
<span className="user-menu-item__icon">⏏</span>
|
||||
<span>Αποσύνδεση</span>
|
||||
<span>{t('common.signOut')}</span>
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { createContext, useContext, useEffect, useState, useCallback } from 'rea
|
||||
import useAuthStore from '../store/authStore'
|
||||
import useNotificationSettingsStore from '../store/notificationSettingsStore'
|
||||
import client from '../api/client'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
const NotificationContext = createContext(null)
|
||||
|
||||
@@ -51,22 +52,26 @@ function isManagerMessage(msg) {
|
||||
|
||||
const HIGHLIGHT = { color: '#7dd3fc', fontWeight: 800 } // light blue bold
|
||||
|
||||
// the word before a table name in staff messages, English or Greek (\u escapes keep the source ASCII)
|
||||
const TABLE_WORDS = 'table|\u03c4\u03c1\u03b1\u03c0\u03ad\u03b6\u03b9'
|
||||
|
||||
function RichBody({ text }) {
|
||||
if (!text) return null
|
||||
// Highlighted tokens:
|
||||
// #digits → order number
|
||||
// τραπέζι <word> → keep "τραπέζι " plain, highlight the word after it
|
||||
// table <word> → keep the word "table" (English or Greek) plain, highlight the word after it
|
||||
// " - " <rest> → keep " - " plain, highlight everything after
|
||||
const parts = []
|
||||
const re = /(#\d+|τραπέζι \S+| - .+$)/g
|
||||
const re = new RegExp(`(#\\d+|(?:${TABLE_WORDS}) \\S+| - .+$)`, 'gi')
|
||||
let last = 0
|
||||
let m
|
||||
while ((m = re.exec(text)) !== null) {
|
||||
if (m.index > last) parts.push({ t: 'plain', v: text.slice(last, m.index) })
|
||||
const v = m[0]
|
||||
if (v.startsWith('τραπέζι ')) {
|
||||
parts.push({ t: 'plain', v: 'τραπέζι ' })
|
||||
parts.push({ t: 'hi', v: v.slice(8) })
|
||||
const word = new RegExp(`^(?:${TABLE_WORDS}) `, 'i').exec(v)
|
||||
if (word) {
|
||||
parts.push({ t: 'plain', v: word[0] })
|
||||
parts.push({ t: 'hi', v: v.slice(word[0].length) })
|
||||
} else if (v.startsWith(' - ')) {
|
||||
parts.push({ t: 'plain', v: ' - ' })
|
||||
parts.push({ t: 'hi', v: v.slice(3) })
|
||||
@@ -91,6 +96,7 @@ function RichBody({ text }) {
|
||||
// ─── Persistent banner (one message at a time, stacked) ─────────────────────
|
||||
|
||||
function NotificationBanner({ message, onAck, autoDismiss }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const tableIds = (() => { try { return JSON.parse(message.table_ids || '[]') } catch { return [] } })()
|
||||
const theme = getTheme(message.message_type)
|
||||
|
||||
@@ -120,7 +126,7 @@ function NotificationBanner({ message, onAck, autoDismiss }) {
|
||||
</div>
|
||||
{tableIds.length > 0 && (
|
||||
<div style={{ fontSize: 12, color: '#94a3b8', marginTop: 4 }}>
|
||||
Τραπέζι{tableIds.length > 1 ? 'α' : ''}: {tableIds.join(', ')}
|
||||
{t('notify.tables', { count: tableIds.length, tables: tableIds.join(', ') })}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -138,6 +144,7 @@ function NotificationBanner({ message, onAck, autoDismiss }) {
|
||||
}
|
||||
|
||||
export function NotificationProvider({ children }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { token, user } = useAuthStore()
|
||||
const { popupMode, persistentPopup } = useNotificationSettingsStore()
|
||||
|
||||
@@ -275,7 +282,7 @@ export function NotificationProvider({ children }) {
|
||||
textAlign: 'center', fontSize: 12, color: '#94a3b8',
|
||||
pointerEvents: 'all',
|
||||
}}>
|
||||
+{popupMessages.length - 3} ακόμα μηνύματα
|
||||
{t('notify.more', { count: popupMessages.length - 3 })}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+16
-2
@@ -1,4 +1,18 @@
|
||||
// The waiter app's translations instance (plan step 4.1; its own texts become keys in 4.5).
|
||||
import { createI18n } from '@xenia/i18n'
|
||||
// The waiter app's translations instance (plan step 4.1); its texts are keys in the `waiter`
|
||||
// namespace of @xenia/i18n (step 4.5). Components use useTranslation('waiter'); code outside
|
||||
// components (services, stores, native glue) uses tw('key').
|
||||
import { createFormatters, createI18n } from '@xenia/i18n'
|
||||
|
||||
export const i18n = createI18n({ defaultNS: 'common' })
|
||||
|
||||
/** Translate a waiter key outside a component (the current language). */
|
||||
export const tw = (key, options) => i18n.t(key, { ns: 'waiter', ...options })
|
||||
|
||||
// Money outside a component's useFormat() (helpers shared by several components): the current
|
||||
// language's format, the venue currency (€). Inside components prefer useFormat().formatMoney.
|
||||
const formatters = new Map()
|
||||
export function money(value) {
|
||||
const lng = i18n.language
|
||||
if (!formatters.has(lng)) formatters.set(lng, createFormatters({ language: lng }))
|
||||
return formatters.get(lng).formatMoney(Number(value) || 0)
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import { deliveryMode, saveVenue } from '../config/server'
|
||||
import { syncTrustedKeys, tlsBaseUrl } from './tls'
|
||||
|
||||
import { SUPPORTED_API_VERSIONS } from './apiVersion'
|
||||
import { tw } from '../i18n'
|
||||
|
||||
export { SUPPORTED_API_VERSIONS }
|
||||
|
||||
@@ -27,16 +28,16 @@ export class PairingError extends Error {}
|
||||
*/
|
||||
export function parseServerInput(raw) {
|
||||
const text = String(raw || '').trim()
|
||||
if (!text) throw new PairingError('Συμπληρώστε τη διεύθυνση του server.')
|
||||
if (!text) throw new PairingError(tw('pairing.empty'))
|
||||
|
||||
const withScheme = /^https?:\/\//i.test(text) ? text : `http://${text}`
|
||||
let url
|
||||
try {
|
||||
url = new URL(withScheme)
|
||||
} catch {
|
||||
throw new PairingError('Μη έγκυρη διεύθυνση. Παράδειγμα: 192.168.1.50')
|
||||
throw new PairingError(tw('pairing.invalid'))
|
||||
}
|
||||
if (!url.hostname) throw new PairingError('Μη έγκυρη διεύθυνση. Παράδειγμα: 192.168.1.50')
|
||||
if (!url.hostname) throw new PairingError(tw('pairing.invalid'))
|
||||
|
||||
return {
|
||||
baseUrl: url.origin,
|
||||
@@ -53,15 +54,13 @@ export async function probeServer(baseUrl) {
|
||||
try {
|
||||
res = await fetch(`${baseUrl}/api/system/identity`, { signal: controller.signal })
|
||||
} catch {
|
||||
throw new PairingError(
|
||||
'Δεν βρέθηκε server σε αυτή τη διεύθυνση. Ελέγξτε ότι το κινητό είναι στο ίδιο WiFi με το κατάστημα.'
|
||||
)
|
||||
throw new PairingError(tw('pairing.noServer'))
|
||||
} finally {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
|
||||
if (res.status === 403) {
|
||||
throw new PairingError('Ο server αρνήθηκε τη σύνδεση. Το κινητό πρέπει να είναι στο WiFi του καταστήματος.')
|
||||
throw new PairingError(tw('pairing.refused'))
|
||||
}
|
||||
let identity = null
|
||||
try {
|
||||
@@ -70,12 +69,10 @@ export async function probeServer(baseUrl) {
|
||||
// not JSON → not a Xenia server
|
||||
}
|
||||
if (!res.ok || identity?.app !== 'xenia-pos') {
|
||||
throw new PairingError('Η διεύθυνση δεν ανήκει σε server Xenia.')
|
||||
throw new PairingError(tw('pairing.notXenia'))
|
||||
}
|
||||
if (!SUPPORTED_API_VERSIONS.includes(identity.api_version)) {
|
||||
throw new PairingError(
|
||||
`Ο server (έκδοση ${identity.version}) δεν είναι συμβατός με αυτή την εφαρμογή. Ενημερώστε την εφαρμογή ή τον server.`
|
||||
)
|
||||
throw new PairingError(tw('pairing.incompatible', { version: identity.version }))
|
||||
}
|
||||
return identity
|
||||
}
|
||||
@@ -94,16 +91,12 @@ export async function pairWith(raw) {
|
||||
const identity = await probeServer(baseUrl)
|
||||
|
||||
if (expectedSiteId && identity.site_id && identity.site_id !== expectedSiteId) {
|
||||
throw new PairingError(
|
||||
'Σε αυτή τη διεύθυνση απαντά διαφορετικό κατάστημα από αυτό του QR. Ζητήστε νέο QR από τον διαχειριστή.'
|
||||
)
|
||||
throw new PairingError(tw('pairing.otherVenue'))
|
||||
}
|
||||
const spki = identity.tls?.spki_sha256 || null
|
||||
if (expectedKey && spki !== expectedKey) {
|
||||
// The QR carries the real server's key: anything else is a different machine
|
||||
throw new PairingError(
|
||||
'Το κλειδί ασφαλείας του server δεν ταιριάζει με το QR. Ζητήστε νέο QR από τον διαχειριστή.'
|
||||
)
|
||||
throw new PairingError(tw('pairing.wrongKey'))
|
||||
}
|
||||
|
||||
const venue = {
|
||||
|
||||
@@ -13,22 +13,24 @@ import useConnectionStore from '../store/connectionStore'
|
||||
import useAuthStore from '../store/authStore'
|
||||
import { queueOfflineOrder } from '../services/offlineOrders'
|
||||
import { assetUrl } from '../config/server'
|
||||
import { money } from '../i18n'
|
||||
import { LineError, estimate, wireLine } from '@xenia/api'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
// A cart item whose option is not on the menu any more (4.4: lines go by id)
|
||||
const lineErrorText = err => `«${err.product}»: το «${err.what}» δεν υπάρχει πια στο μενού. Αφαιρέστε το και προσθέστε το ξανά.`
|
||||
const money = v => `${Number(v || 0).toFixed(2)} €`
|
||||
const lineErrorText = (err, t) => t('add.optionGone', { product: err.product, what: err.what })
|
||||
|
||||
// ─── Global Course Modal ──────────────────────────────────────────────────────
|
||||
|
||||
function GlobalCourseModal({ courses, selected, onSelect, onClose }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
return (
|
||||
<div className="modal-overlay" onClick={onClose}>
|
||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title">Set Course</h2>
|
||||
<h2 className="modal-title">{t('add.course.title')}</h2>
|
||||
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 16px' }}>
|
||||
Quick-add items will use this course.
|
||||
{t('add.course.sub')}
|
||||
</p>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginBottom: 16 }}>
|
||||
{courses.map(c => (
|
||||
@@ -57,10 +59,10 @@ function GlobalCourseModal({ courses, selected, onSelect, onClose }) {
|
||||
style={{ width: '100%', marginBottom: 8 }}
|
||||
onClick={() => { onSelect(null); onClose() }}
|
||||
>
|
||||
Clear
|
||||
{t('common.clear')}
|
||||
</button>
|
||||
)}
|
||||
<button className="btn btn--secondary" style={{ width: '100%' }} onClick={onClose}>Cancel</button>
|
||||
<button className="btn btn--secondary" style={{ width: '100%' }} onClick={onClose}>{t('common.cancel')}</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -69,6 +71,7 @@ function GlobalCourseModal({ courses, selected, onSelect, onClose }) {
|
||||
// ─── Customer count modal ─────────────────────────────────────────────────────
|
||||
|
||||
function CustomerCountModal({ value, onChange, onClose }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [count, setCount] = useState(value ?? 0)
|
||||
const QUICK = [1, 2, 3, 4, 5, 6]
|
||||
|
||||
@@ -76,9 +79,9 @@ function CustomerCountModal({ value, onChange, onClose }) {
|
||||
<div className="modal-overlay" onClick={onClose}>
|
||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title">Αριθμός Πελατών</h2>
|
||||
<h2 className="modal-title">{t('detail.guests.title')}</h2>
|
||||
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 20px' }}>
|
||||
Πόσα άτομα κάθονται στο τραπέζι;
|
||||
{t('detail.guests.question')}
|
||||
</p>
|
||||
|
||||
{/* Quick pick */}
|
||||
@@ -105,9 +108,9 @@ function CustomerCountModal({ value, onChange, onClose }) {
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', gap: 10 }}>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>Άκυρο</button>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => { onChange(count || null); onClose() }}>
|
||||
Εφαρμογή
|
||||
{t('common.apply')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -120,13 +123,14 @@ function CustomerCountModal({ value, onChange, onClose }) {
|
||||
// menu's prices as an estimate. A line the server would refuse shows its reason here.
|
||||
|
||||
function CartTotal({ priced, estimatedTotal, offline }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const exact = !!priced?.data
|
||||
return (
|
||||
<div data-testid="cart-total" data-estimated={exact ? 'false' : 'true'}
|
||||
style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline' }}>
|
||||
<span style={{ fontSize: 13, color: 'var(--muted)', fontWeight: 600 }}>
|
||||
{exact ? 'Σύνολο' : offline ? 'Σύνολο (εκτίμηση, χωρίς σύνδεση)' : 'Σύνολο (εκτίμηση)'}
|
||||
{exact ? t('common.total') : offline ? t('add.totalEstimateOffline') : t('add.totalEstimate')}
|
||||
</span>
|
||||
<span style={{ fontSize: 17, fontWeight: 800, color: 'var(--text)', fontVariantNumeric: 'tabular-nums' }}>
|
||||
{exact ? money(priced.data.total) : `≈ ${money(estimatedTotal)}`}
|
||||
@@ -148,6 +152,7 @@ function fmtDraftQty(qty, unitType) {
|
||||
}
|
||||
|
||||
export default function AddItemsPage() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { tableId, orderType } = useParams()
|
||||
const isStandalone = !!orderType // true when on /standalone/:orderType/add
|
||||
const [searchParams] = useSearchParams()
|
||||
@@ -199,8 +204,8 @@ export default function AddItemsPage() {
|
||||
try {
|
||||
const statusRes = await client.get(`/api/tables/${tableId}/status`)
|
||||
setOrderId(statusRes.data.active_order_id)
|
||||
const t = statusRes.data.table
|
||||
if (t) setTableLabel(t.label || `T${t.number}`)
|
||||
const tbl = statusRes.data.table
|
||||
if (tbl) setTableLabel(tbl.label || `T${tbl.number}`)
|
||||
// Load existing customer count from the active order
|
||||
if (statusRes.data.active_order_id) {
|
||||
const { data: o } = await client.get(`/api/orders/${statusRes.data.active_order_id}`)
|
||||
@@ -208,8 +213,8 @@ export default function AddItemsPage() {
|
||||
}
|
||||
} catch {
|
||||
// Offline — read table label from IDB snapshot
|
||||
const t = await db.pos_tables.get(Number(tableId))
|
||||
if (t) setTableLabel(t.label || `T${t.number}`)
|
||||
const tbl = await db.pos_tables.get(Number(tableId))
|
||||
if (tbl) setTableLabel(tbl.label || `T${tbl.number}`)
|
||||
// orderId stays null — offline orders don't need a pre-existing server order
|
||||
}
|
||||
}
|
||||
@@ -325,17 +330,17 @@ export default function AddItemsPage() {
|
||||
if (!quoteKey) return undefined
|
||||
let lines
|
||||
try { lines = cartLines() } catch (err) {
|
||||
const t = setTimeout(() => setQuote({ key: quoteKey, data: null, error: err instanceof LineError ? lineErrorText(err) : String(err) }), 0)
|
||||
return () => clearTimeout(t)
|
||||
const timer = setTimeout(() => setQuote({ key: quoteKey, data: null, error: err instanceof LineError ? lineErrorText(err, t) : String(err) }), 0)
|
||||
return () => clearTimeout(timer)
|
||||
}
|
||||
const t = setTimeout(() => {
|
||||
const timer = setTimeout(() => {
|
||||
client.post('/api/orders/quote', {
|
||||
lines, order_id: orderId ?? undefined, order_type: isStandalone ? orderType : 'here',
|
||||
}, { noOverride: true })
|
||||
.then(r => setQuote({ key: quoteKey, data: r.data, error: null }))
|
||||
.catch(err => setQuote({ key: quoteKey, data: null, error: apiError(err, '') }))
|
||||
}, 250)
|
||||
return () => clearTimeout(t)
|
||||
return () => clearTimeout(timer)
|
||||
}, [quoteKey]) // eslint-disable-line react-hooks/exhaustive-deps
|
||||
const priced = quote && quote.key === quoteKey ? quote : null
|
||||
|
||||
@@ -370,7 +375,7 @@ export default function AddItemsPage() {
|
||||
setTimeout(() => navigate('/tables'), 1200)
|
||||
} catch (err) {
|
||||
console.error('[offline order] save failed:', err)
|
||||
setError(err instanceof LineError ? lineErrorText(err) : 'Σφάλμα αποθήκευσης offline παραγγελίας')
|
||||
setError(err instanceof LineError ? lineErrorText(err, t) : t('add.offlineSaveFailed'))
|
||||
} finally {
|
||||
setSending(false)
|
||||
}
|
||||
@@ -382,7 +387,7 @@ export default function AddItemsPage() {
|
||||
let lines
|
||||
try { lines = cartLines() } catch (err) {
|
||||
if (!(err instanceof LineError)) throw err
|
||||
setError(lineErrorText(err))
|
||||
setError(lineErrorText(err, t))
|
||||
return
|
||||
}
|
||||
let activeOrderId = orderId
|
||||
@@ -414,7 +419,7 @@ export default function AddItemsPage() {
|
||||
setTimeout(() => navigate('/tables'), 1200)
|
||||
}
|
||||
} catch (err) {
|
||||
setError(apiError(err, 'Σφάλμα αποστολής — η παραγγελία δεν στάλθηκε'))
|
||||
setError(apiError(err, t('add.sendFailed')))
|
||||
} finally {
|
||||
setSending(false)
|
||||
}
|
||||
@@ -517,11 +522,11 @@ export default function AddItemsPage() {
|
||||
if (item.selected_options?.length) {
|
||||
item.selected_options.forEach(o => {
|
||||
if (o.price_delta && o.price_delta !== 0)
|
||||
lines.push(`${o.name} (${o.price_delta > 0 ? '+' : ''}${o.price_delta.toFixed(2)} €)`)
|
||||
lines.push(`${o.name} (${o.price_delta > 0 ? '+' : ''}${money(o.price_delta)})`)
|
||||
else lines.push(o.name)
|
||||
})
|
||||
}
|
||||
if (item.removed_ingredients?.length) lines.push(`Χωρίς: ${item.removed_ingredients.join(', ')}`)
|
||||
if (item.removed_ingredients?.length) lines.push(t('add.withoutList', { names: item.removed_ingredients.join(', ') }))
|
||||
if (item.notes) lines.push(item.notes)
|
||||
return lines
|
||||
}
|
||||
@@ -534,14 +539,14 @@ export default function AddItemsPage() {
|
||||
<div className="page" style={{ position: 'relative' }}>
|
||||
<header className="top-bar">
|
||||
<button className="icon-btn" onClick={handleBack}>←</button>
|
||||
<span className="top-bar__title">{tableLabel || (isNewTable ? 'Νέα Παραγγελία' : 'Προσθήκη')}</span>
|
||||
<span className="top-bar__title">{tableLabel || (isNewTable ? t('add.newOrder') : t('add.add'))}</span>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
|
||||
{/* Customer count button */}
|
||||
<button
|
||||
className="icon-btn"
|
||||
style={{ position: 'relative' }}
|
||||
onClick={() => setCustomerCountOpen(true)}
|
||||
title="Αριθμός πελατών"
|
||||
title={t('detail.guests.button')}
|
||||
>
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||
@@ -566,7 +571,7 @@ export default function AddItemsPage() {
|
||||
className="icon-btn"
|
||||
style={{ position: 'relative' }}
|
||||
onClick={() => setGlobalCourseOpen(true)}
|
||||
title="Set course"
|
||||
title={t('add.course.title')}
|
||||
>
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
|
||||
<circle cx="12" cy="12" r="9" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/>
|
||||
@@ -588,14 +593,14 @@ export default function AddItemsPage() {
|
||||
</button>
|
||||
)}
|
||||
{/* Search button */}
|
||||
<button className="icon-btn" onClick={() => { setSearchQuery(''); setSearchOpen(true) }} title="Αναζήτηση">
|
||||
<button className="icon-btn" onClick={() => { setSearchQuery(''); setSearchOpen(true) }} title={t('add.search.title')}>
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
|
||||
<circle cx="11" cy="11" r="7" stroke="currentColor" strokeWidth="2.2"/>
|
||||
<path d="M16.5 16.5L21 21" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
{/* Categories button */}
|
||||
<button className="icon-btn" onClick={() => setViewAllOpen(true)} title="Όλες οι κατηγορίες">
|
||||
<button className="icon-btn" onClick={() => setViewAllOpen(true)} title={t('add.allCategories')}>
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
|
||||
<rect x="3" y="3" width="7" height="7" rx="1.5" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/>
|
||||
<rect x="14" y="3" width="7" height="7" rx="1.5" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/>
|
||||
@@ -646,7 +651,7 @@ export default function AddItemsPage() {
|
||||
<QuickAddToast product={quickToast.product} count={quickToast.count} />
|
||||
)}
|
||||
|
||||
{/* ── Bottom bar: floating mini-cart + full-width ΑΠΟΣΤΟΛΗ ─────────────── */}
|
||||
{/* ── Bottom bar: floating mini-cart + full-width SEND ─────────────── */}
|
||||
<div style={{
|
||||
background: 'var(--bg2)',
|
||||
borderTop: '1px solid var(--border)',
|
||||
@@ -680,7 +685,7 @@ export default function AddItemsPage() {
|
||||
})}
|
||||
{hiddenCount > 0 && (
|
||||
<div style={{ fontSize: 11, color: 'var(--muted)', textAlign: 'right' }}>
|
||||
+{hiddenCount} ακόμα — δείτε όλα →
|
||||
{t('add.moreSeeAll', { count: hiddenCount })}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -693,7 +698,7 @@ export default function AddItemsPage() {
|
||||
onClick={() => summaryBeforeSend && cart.length > 0 ? setSummaryOpen(true) : sendOrder()}
|
||||
disabled={cart.length === 0 || sending}
|
||||
>
|
||||
{sending ? 'Αποστολή…' : summaryBeforeSend && cart.length > 0 ? `ΣΥΝΟΨΗ (${cart.length})` : `ΑΠΟΣΤΟΛΗ${cart.length > 0 ? ` (${cart.length})` : ''}`}
|
||||
{sending ? t('add.sending') : summaryBeforeSend && cart.length > 0 ? t('add.summaryCount', { count: cart.length }) : cart.length > 0 ? t('add.sendCount', { count: cart.length }) : t('add.send')}
|
||||
</button>
|
||||
|
||||
{error && <p className="error-msg" style={{ marginTop: 8 }}>{error}</p>}
|
||||
@@ -728,8 +733,8 @@ export default function AddItemsPage() {
|
||||
{/* Drawer header */}
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '14px 16px', borderBottom: '1px solid var(--border)', flexShrink: 0 }}>
|
||||
<div>
|
||||
<div style={{ fontSize: 16, fontWeight: 700, color: 'var(--text)' }}>Παραγγελία</div>
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 1 }}>{cart.length} {cart.length === 1 ? 'προϊόν' : 'προϊόντα'}</div>
|
||||
<div style={{ fontSize: 16, fontWeight: 700, color: 'var(--text)' }}>{t('add.order')}</div>
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 1 }}>{t('add.products', { count: cart.length })}</div>
|
||||
</div>
|
||||
<button onClick={() => setCartOpen(false)} style={{ background: 'var(--bg3)', border: 'none', borderRadius: '50%', width: 34, height: 34, display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', color: 'var(--text)' }}>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M6 6L18 18M6 18L18 6" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round"/></svg>
|
||||
@@ -739,7 +744,7 @@ export default function AddItemsPage() {
|
||||
{/* Item list */}
|
||||
<div style={{ flex: 1, overflowY: 'auto', padding: 12 }}>
|
||||
{cart.length === 0 ? (
|
||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '40px 0', fontSize: 14 }}>Η παραγγελία είναι κενή.</p>
|
||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '40px 0', fontSize: 14 }}>{t('add.empty')}</p>
|
||||
) : courses.length > 0 ? (() => {
|
||||
// Group by course, ordered by course definition, "no course" last
|
||||
const groups = []
|
||||
@@ -768,7 +773,7 @@ export default function AddItemsPage() {
|
||||
textTransform: 'uppercase', letterSpacing: 0.8,
|
||||
marginBottom: 6,
|
||||
}}>
|
||||
{group.course ? group.course.name : 'No course'}
|
||||
{group.course ? group.course.name : t('add.course.none')}
|
||||
</div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
{group.items.map(item => {
|
||||
@@ -822,7 +827,7 @@ export default function AddItemsPage() {
|
||||
autoFocus
|
||||
value={orderNote}
|
||||
onChange={e => setOrderNote(e.target.value)}
|
||||
placeholder="Σημείωση για ολόκληρη την παραγγελία…"
|
||||
placeholder={t('add.note.placeholder')}
|
||||
rows={3}
|
||||
style={{
|
||||
width: '100%', resize: 'none', padding: '10px 12px',
|
||||
@@ -835,7 +840,7 @@ export default function AddItemsPage() {
|
||||
onClick={() => setOrderNoteEditing(false)}
|
||||
style={{ alignSelf: 'flex-end', background: 'none', border: 'none', fontSize: 12, fontWeight: 700, color: 'var(--accent)', cursor: 'pointer', padding: '2px 0' }}
|
||||
>
|
||||
Αποθήκευση
|
||||
{t('common.save')}
|
||||
</button>
|
||||
</div>
|
||||
) : orderNote ? (
|
||||
@@ -843,7 +848,7 @@ export default function AddItemsPage() {
|
||||
onClick={() => setOrderNoteEditing(true)}
|
||||
style={{ cursor: 'pointer', padding: '9px 12px', background: 'rgba(245,158,11,0.09)', border: '1.5px solid rgba(245,158,11,0.3)', borderRadius: 10, fontSize: 13, color: 'var(--text)', lineHeight: 1.5, whiteSpace: 'pre-wrap', position: 'relative' }}
|
||||
>
|
||||
<span style={{ fontSize: 10, fontWeight: 700, color: '#f59e0b', textTransform: 'uppercase', letterSpacing: 0.6, display: 'block', marginBottom: 3 }}>Σημείωση Παραγγελίας</span>
|
||||
<span style={{ fontSize: 10, fontWeight: 700, color: '#f59e0b', textTransform: 'uppercase', letterSpacing: 0.6, display: 'block', marginBottom: 3 }}>{t('add.note.title')}</span>
|
||||
{orderNote}
|
||||
<span style={{ position: 'absolute', top: 8, right: 10, fontSize: 11, color: '#f59e0b', fontWeight: 700 }}>✎</span>
|
||||
</div>
|
||||
@@ -858,7 +863,7 @@ export default function AddItemsPage() {
|
||||
}}
|
||||
>
|
||||
<svg width="15" height="15" viewBox="0 0 24 24" fill="none"><path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/></svg>
|
||||
Προσθήκη σημείωσης παραγγελίας
|
||||
{t('add.note.add')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -875,7 +880,7 @@ export default function AddItemsPage() {
|
||||
onClick={() => { setCartOpen(false); if (summaryBeforeSend) setSummaryOpen(true); else sendOrder() }}
|
||||
disabled={cart.length === 0 || sending}
|
||||
>
|
||||
{sending ? 'Αποστολή…' : summaryBeforeSend ? `ΣΥΝΟΨΗ (${cart.length})` : `ΑΠΟΣΤΟΛΗ (${cart.length})`}
|
||||
{sending ? t('add.sending') : summaryBeforeSend ? t('add.summaryCount', { count: cart.length }) : t('add.sendCount', { count: cart.length })}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1008,7 +1013,7 @@ export default function AddItemsPage() {
|
||||
)}
|
||||
</svg>
|
||||
<span style={{ color: printAck._offline || printAck._pending ? '#fcd34d' : '#86efac', fontWeight: 700, fontSize: 18, letterSpacing: 0.3 }}>
|
||||
{printAck._offline ? 'Αποθηκεύτηκε Offline' : printAck._pending ? 'Στάλθηκε — Εκτύπωση σε εξέλιξη' : 'Εκτυπώθηκε Επιτυχώς'}
|
||||
{printAck._offline ? t('add.ack.offline') : printAck._pending ? t('add.ack.printing') : t('add.ack.printed')}
|
||||
</span>
|
||||
</div>
|
||||
<style>{`
|
||||
@@ -1024,6 +1029,7 @@ export default function AddItemsPage() {
|
||||
// ── Deal Offer Modal ──────────────────────────────────────────────────────────
|
||||
|
||||
function DealOfferModal({ offer, _products, onAccept, onDismiss }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const isFreeItem = offer.action_type === 'free_item'
|
||||
const isFreeChoice = offer.action_type === 'free_choice'
|
||||
const isDiscount = ['set_price','add_amount','add_percent','apply_modifier'].includes(offer.action_type)
|
||||
@@ -1069,7 +1075,7 @@ function DealOfferModal({ offer, _products, onAccept, onDismiss }) {
|
||||
stroke="#a78bfa" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 style={{ margin: 0, fontSize: 17, fontWeight: 700, color: '#a78bfa' }}>Προσφορά Ενεργοποιήθηκε!</h2>
|
||||
<h2 style={{ margin: 0, fontSize: 17, fontWeight: 700, color: '#a78bfa' }}>{t('add.deal.title')}</h2>
|
||||
<p style={{ margin: '6px 0 0', fontSize: 14, fontWeight: 600, color: 'var(--text)' }}>{offer.deal_name}</p>
|
||||
</div>
|
||||
|
||||
@@ -1080,7 +1086,7 @@ function DealOfferModal({ offer, _products, onAccept, onDismiss }) {
|
||||
background: 'rgba(34,197,94,0.08)', border: '1.5px solid rgba(34,197,94,0.3)',
|
||||
borderRadius: 12,
|
||||
}}>
|
||||
<p style={{ margin: 0, fontSize: 13, color: 'var(--muted)', marginBottom: 4 }}>Δωρεάν προϊόν:</p>
|
||||
<p style={{ margin: 0, fontSize: 13, color: 'var(--muted)', marginBottom: 4 }}>{t('add.deal.freeProduct')}</p>
|
||||
<p style={{ margin: 0, fontSize: 15, fontWeight: 700, color: '#4ade80' }}>
|
||||
{offer.free_item_name}
|
||||
{offer.free_quantity > 1 && <span style={{ color: '#f59e0b', marginLeft: 6 }}>×{offer.free_quantity}</span>}
|
||||
@@ -1092,8 +1098,8 @@ function DealOfferModal({ offer, _products, onAccept, onDismiss }) {
|
||||
{isFreeChoice && offer.free_choices?.length > 0 && (
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 8 }}>
|
||||
Επιλέξτε {offer.free_quantity ?? 1} δωρεάν {offer.free_quantity === 1 ? 'προϊόν' : 'προϊόντα'}
|
||||
{remaining > 0 && <span style={{ color: '#a78bfa', marginLeft: 4 }}>({remaining} ακόμα)</span>}
|
||||
{t('add.deal.pickFree', { count: offer.free_quantity ?? 1 })}
|
||||
{remaining > 0 && <span style={{ color: '#a78bfa', marginLeft: 4 }}>{t('add.deal.remaining', { count: remaining })}</span>}
|
||||
</p>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, maxHeight: 220, overflowY: 'auto' }}>
|
||||
{offer.free_choices.map(choice => {
|
||||
@@ -1130,21 +1136,21 @@ function DealOfferModal({ offer, _products, onAccept, onDismiss }) {
|
||||
borderRadius: 12, textAlign: 'center',
|
||||
}}>
|
||||
<span style={{ fontSize: 14, color: 'var(--muted)', textDecoration: 'line-through' }}>
|
||||
{offer.price_before.toFixed(2)} €
|
||||
{money(offer.price_before)}
|
||||
</span>
|
||||
<span style={{ fontSize: 22, fontWeight: 800, color: '#4ade80', margin: '0 12px' }}>
|
||||
{offer.price_after.toFixed(2)} €
|
||||
{money(offer.price_after)}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div style={{ display: 'flex', gap: 10 }}>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onDismiss}>
|
||||
Παράβλεψη
|
||||
{t('add.deal.skip')}
|
||||
</button>
|
||||
<button className="btn btn--primary" style={{ flex: 1, background: '#7c3aed', borderColor: '#7c3aed' }}
|
||||
onClick={handleAccept} disabled={!canConfirm}>
|
||||
{isFreeItem ? 'Προσθήκη Δωρεάν' : isFreeChoice ? 'Επιβεβαίωση' : 'Εφαρμογή'}
|
||||
{isFreeItem ? t('add.deal.addFree') : isFreeChoice ? t('common.confirm') : t('common.apply')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1155,6 +1161,7 @@ function DealOfferModal({ offer, _products, onAccept, onDismiss }) {
|
||||
// ── Quick-Add Toast ───────────────────────────────────────────────────────────
|
||||
|
||||
function QuickAddToast({ product, count }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const initials = product.name.trim().split(/\s+/).slice(0, 2).map(w => w[0]).join('').toUpperCase()
|
||||
return (
|
||||
<div style={{
|
||||
@@ -1188,7 +1195,7 @@ function QuickAddToast({ product, count }) {
|
||||
fontSize: 13, fontWeight: 600, color: 'var(--text)',
|
||||
overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
|
||||
}}>{product.name}</div>
|
||||
<div style={{ fontSize: 11, color: 'var(--muted)', marginTop: 1 }}>στο καλάθι</div>
|
||||
<div style={{ fontSize: 11, color: 'var(--muted)', marginTop: 1 }}>{t('add.inCart')}</div>
|
||||
</div>
|
||||
{/* Count badge */}
|
||||
<div style={{
|
||||
@@ -1230,6 +1237,7 @@ function SectionIcon({ type }) {
|
||||
}
|
||||
|
||||
function CartItem({ item, product, summaryLines, sections, onEdit, onRemove, onChangeQty }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [expanded, setExpanded] = useState(false)
|
||||
const hasDetails = sections.length > 0
|
||||
|
||||
@@ -1262,7 +1270,7 @@ function CartItem({ item, product, summaryLines, sections, onEdit, onRemove, onC
|
||||
|
||||
{/* Edit — stop propagation so it doesn't toggle expand */}
|
||||
<button onClick={e => { e.stopPropagation(); onEdit() }} style={{ background: 'none', border: '1px solid var(--border)', borderRadius: 7, color: 'var(--muted)', cursor: 'pointer', padding: '3px 9px', fontSize: 12, fontWeight: 500, flexShrink: 0 }}>
|
||||
Επεξ.
|
||||
{t('add.edit')}
|
||||
</button>
|
||||
{/* Remove */}
|
||||
<button onClick={e => { e.stopPropagation(); onRemove() }} style={{ background: 'none', border: 'none', color: 'var(--danger)', cursor: 'pointer', padding: 4, display: 'flex', alignItems: 'center', flexShrink: 0 }}>
|
||||
@@ -1307,7 +1315,7 @@ function CartItem({ item, product, summaryLines, sections, onEdit, onRemove, onC
|
||||
{sec.type === 'removed' && sec.lines.map((line, li) => (
|
||||
<div key={li} style={{ display: 'flex', alignItems: 'center', gap: 7 }}>
|
||||
<SectionIcon type="removed" />
|
||||
<span style={{ fontSize: 12, color: 'var(--text)', flex: 1 }}>Χωρίς {line.name}</span>
|
||||
<span style={{ fontSize: 12, color: 'var(--text)', flex: 1 }}>{t('drawer.without', { name: line.name })}</span>
|
||||
</div>
|
||||
))}
|
||||
{sec.type === 'note' && sec.lines.map((line, li) => (
|
||||
@@ -1366,6 +1374,7 @@ function CartItem({ item, product, summaryLines, sections, onEdit, onRemove, onC
|
||||
|
||||
|
||||
function SearchModal({ products, query, setQuery, onClose, onAdd, courses = [], quickNotes }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [drawerProduct, setDrawerProduct] = useState(null)
|
||||
const activeProducts = products.filter(p => p.lifecycle_status !== 'archived')
|
||||
|
||||
@@ -1404,11 +1413,11 @@ function SearchModal({ products, query, setQuery, onClose, onAdd, courses = [],
|
||||
<div style={{ flex: 1, overflowY: 'auto', minHeight: 0 }}>
|
||||
{query.trim().length === 0 ? (
|
||||
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: '16px 20px', fontSize: 14 }}>
|
||||
Πληκτρολογήστε για αναζήτηση…
|
||||
{t('add.search.type')}
|
||||
</p>
|
||||
) : results.length === 0 ? (
|
||||
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: '16px 20px', fontSize: 14 }}>
|
||||
Δεν βρέθηκαν προϊόντα για «{query}»
|
||||
{t('add.search.none', { query })}
|
||||
</p>
|
||||
) : results.map(p => {
|
||||
const initials = p.name.trim().split(/\s+/).slice(0, 2).map(w => w[0]).join('').toUpperCase()
|
||||
@@ -1439,7 +1448,7 @@ function SearchModal({ products, query, setQuery, onClose, onAdd, courses = [],
|
||||
{p.name}
|
||||
</div>
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>
|
||||
{Number(p.base_price).toFixed(2)} €
|
||||
{money(p.base_price)}
|
||||
</div>
|
||||
</div>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" style={{ color: 'var(--muted)', flexShrink: 0 }}>
|
||||
@@ -1465,7 +1474,7 @@ function SearchModal({ products, query, setQuery, onClose, onAdd, courses = [],
|
||||
autoFocus
|
||||
value={query}
|
||||
onChange={e => setQuery(e.target.value)}
|
||||
placeholder="Αναζήτηση προϊόντος…"
|
||||
placeholder={t('add.search.placeholder')}
|
||||
style={{
|
||||
flex: 1, height: 44, background: 'var(--bg2)',
|
||||
border: '1px solid var(--border)', borderRadius: 12,
|
||||
|
||||
@@ -2,12 +2,13 @@ import { useEffect, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import client from '../api/client'
|
||||
import { apiError } from '../api/errors'
|
||||
import { useFormat, useTranslation } from '@xenia/i18n'
|
||||
import useAuthStore from '../store/authStore'
|
||||
import useChatStore from '../store/chatStore'
|
||||
|
||||
// ─── Relative time (Greek) ────────────────────────────────────────────────────
|
||||
|
||||
function relativeTime(dateStr) {
|
||||
function relativeTime(dateStr, t, formatDate) {
|
||||
if (!dateStr) return ''
|
||||
const date = new Date(dateStr)
|
||||
const now = new Date()
|
||||
@@ -15,9 +16,9 @@ function relativeTime(dateStr) {
|
||||
const diffMin = Math.floor(diffMs / 60_000)
|
||||
const diffHours = Math.floor(diffMs / 3_600_000)
|
||||
|
||||
if (diffMin < 1) return 'τώρα'
|
||||
if (diffMin < 60) return `${diffMin}λ`
|
||||
if (diffHours < 24) return `${diffHours}ω`
|
||||
if (diffMin < 1) return t('chat.now')
|
||||
if (diffMin < 60) return t('common.minutesShort', { m: diffMin })
|
||||
if (diffHours < 24) return t('common.hoursShort', { h: diffHours })
|
||||
|
||||
const yesterday = new Date(now)
|
||||
yesterday.setDate(yesterday.getDate() - 1)
|
||||
@@ -25,9 +26,9 @@ function relativeTime(dateStr) {
|
||||
date.getDate() === yesterday.getDate() &&
|
||||
date.getMonth() === yesterday.getMonth() &&
|
||||
date.getFullYear() === yesterday.getFullYear()
|
||||
) return 'χθες'
|
||||
) return t('chat.yesterday')
|
||||
|
||||
return date.toLocaleDateString('el-GR', { day: '2-digit', month: '2-digit' })
|
||||
return formatDate(date, 'dateShort')
|
||||
}
|
||||
|
||||
// ─── Avatar ───────────────────────────────────────────────────────────────────
|
||||
@@ -53,18 +54,20 @@ function Avatar({ label, size = 44, isGroup = false }) {
|
||||
// ─── Conversation row ─────────────────────────────────────────────────────────
|
||||
|
||||
function ConvRow({ conv, currentUserId, onClick }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { formatDate } = useFormat()
|
||||
const isGroup = conv.type === 'group'
|
||||
|
||||
const title = isGroup
|
||||
? (conv.name || 'Ομάδα')
|
||||
: (conv.participants?.find(p => p.user_id !== currentUserId)?.username || 'Άγνωστος')
|
||||
? (conv.name || t('chat.group'))
|
||||
: (conv.participants?.find(p => p.user_id !== currentUserId)?.username || t('chat.unknown'))
|
||||
|
||||
const lastMsg = conv.last_message
|
||||
const preview = lastMsg
|
||||
? lastMsg.is_deleted
|
||||
? 'Το μήνυμα διαγράφηκε'
|
||||
? t('chat.deleted')
|
||||
: lastMsg.body
|
||||
: 'Δεν υπάρχουν μηνύματα'
|
||||
: t('chat.noMessages')
|
||||
|
||||
const timestamp = lastMsg?.sent_at || conv.created_at
|
||||
const hasUnread = (conv.unread_count || 0) > 0
|
||||
@@ -91,7 +94,7 @@ function ConvRow({ conv, currentUserId, onClick }) {
|
||||
{title}
|
||||
</span>
|
||||
<span style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0 }}>
|
||||
{relativeTime(timestamp)}
|
||||
{relativeTime(timestamp, t, formatDate)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{
|
||||
@@ -125,6 +128,7 @@ function ConvRow({ conv, currentUserId, onClick }) {
|
||||
// ─── New Chat bottom drawer ───────────────────────────────────────────────────
|
||||
|
||||
function NewChatDrawer({ currentUserId, onClose, onConversationCreated }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [staff, setStaff] = useState([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [mode, setMode] = useState('picker') // 'picker' | 'group_name' | 'group_pick'
|
||||
@@ -136,7 +140,7 @@ function NewChatDrawer({ currentUserId, onClose, onConversationCreated }) {
|
||||
useEffect(() => {
|
||||
client.get('/api/chat/users')
|
||||
.then(r => setStaff((r.data || []).filter(u => u.id !== currentUserId)))
|
||||
.catch(() => setError('Αποτυχία φόρτωσης χρηστών'))
|
||||
.catch(() => setError(t('chat.usersFailed')))
|
||||
.finally(() => setLoading(false))
|
||||
}, [currentUserId])
|
||||
|
||||
@@ -150,7 +154,7 @@ function NewChatDrawer({ currentUserId, onClose, onConversationCreated }) {
|
||||
})
|
||||
onConversationCreated(res.data)
|
||||
} catch (e) {
|
||||
setError(apiError(e, 'Σφάλμα δημιουργίας συνομιλίας'))
|
||||
setError(apiError(e, t('chat.createFailed')))
|
||||
setCreating(false)
|
||||
}
|
||||
}
|
||||
@@ -167,7 +171,7 @@ function NewChatDrawer({ currentUserId, onClose, onConversationCreated }) {
|
||||
})
|
||||
onConversationCreated(res.data)
|
||||
} catch (e) {
|
||||
setError(apiError(e, 'Σφάλμα δημιουργίας ομάδας'))
|
||||
setError(apiError(e, t('chat.groupFailed')))
|
||||
setCreating(false)
|
||||
}
|
||||
}
|
||||
@@ -185,7 +189,7 @@ function NewChatDrawer({ currentUserId, onClose, onConversationCreated }) {
|
||||
|
||||
{mode === 'picker' && (
|
||||
<>
|
||||
<h2 className="modal-title" style={{ marginBottom: 16 }}>Νέα Συνομιλία</h2>
|
||||
<h2 className="modal-title" style={{ marginBottom: 16 }}>{t('chat.new')}</h2>
|
||||
|
||||
{/* New Group option */}
|
||||
<button
|
||||
@@ -204,18 +208,18 @@ function NewChatDrawer({ currentUserId, onClose, onConversationCreated }) {
|
||||
}}>
|
||||
👥
|
||||
</div>
|
||||
<span style={{ fontSize: 15, fontWeight: 700, color: 'var(--accent)' }}>Νέα Ομάδα</span>
|
||||
<span style={{ fontSize: 15, fontWeight: 700, color: 'var(--accent)' }}>{t('chat.newGroup')}</span>
|
||||
</button>
|
||||
|
||||
<div style={{ flex: 1, overflowY: 'auto', marginTop: 4 }}>
|
||||
{loading && (
|
||||
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: 24, fontSize: 14 }}>
|
||||
Φόρτωση…
|
||||
{t('common.loading')}
|
||||
</p>
|
||||
)}
|
||||
{!loading && staff.length === 0 && !error && (
|
||||
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: 24, fontSize: 14 }}>
|
||||
Δεν υπάρχει άλλο προσωπικό
|
||||
{t('chat.noStaff')}
|
||||
</p>
|
||||
)}
|
||||
{staff.map(u => (
|
||||
@@ -257,14 +261,14 @@ function NewChatDrawer({ currentUserId, onClose, onConversationCreated }) {
|
||||
<path d="M12.5 15l-5-5 5-5" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
<h2 className="modal-title" style={{ margin: 0 }}>Όνομα Ομάδας</h2>
|
||||
<h2 className="modal-title" style={{ margin: 0 }}>{t('chat.groupName')}</h2>
|
||||
</div>
|
||||
<input
|
||||
autoFocus
|
||||
value={groupName}
|
||||
onChange={e => setGroupName(e.target.value)}
|
||||
onKeyDown={e => e.key === 'Enter' && groupName.trim() && setMode('group_pick')}
|
||||
placeholder="π.χ. Βραδινή βάρδια"
|
||||
placeholder={t('chat.groupNamePlaceholder')}
|
||||
style={{
|
||||
width: '100%', padding: '12px 14px',
|
||||
background: 'var(--bg3)', border: '1px solid var(--border)',
|
||||
@@ -278,7 +282,7 @@ function NewChatDrawer({ currentUserId, onClose, onConversationCreated }) {
|
||||
disabled={!groupName.trim()}
|
||||
onClick={() => groupName.trim() && setMode('group_pick')}
|
||||
>
|
||||
Επόμενο
|
||||
{t('chat.next')}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
@@ -294,10 +298,10 @@ function NewChatDrawer({ currentUserId, onClose, onConversationCreated }) {
|
||||
<path d="M12.5 15l-5-5 5-5" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
<h2 className="modal-title" style={{ margin: 0 }}>Επιλογή Μελών</h2>
|
||||
<h2 className="modal-title" style={{ margin: 0 }}>{t('chat.pickMembers')}</h2>
|
||||
</div>
|
||||
<p style={{ fontSize: 13, color: 'var(--muted)', marginBottom: 12 }}>
|
||||
Ομάδα: <strong style={{ color: 'var(--text)' }}>{groupName}</strong>
|
||||
{t('chat.groupLabel')} <strong style={{ color: 'var(--text)' }}>{groupName}</strong>
|
||||
</p>
|
||||
|
||||
<div style={{ flex: 1, overflowY: 'auto', marginBottom: 12 }}>
|
||||
@@ -347,7 +351,7 @@ function NewChatDrawer({ currentUserId, onClose, onConversationCreated }) {
|
||||
disabled={creating}
|
||||
onClick={createGroup}
|
||||
>
|
||||
{creating ? 'Δημιουργία…' : `Δημιουργία Ομάδας${selectedIds.length > 0 ? ` (${selectedIds.length})` : ''}`}
|
||||
{creating ? t('chat.creating') : selectedIds.length > 0 ? t('chat.createGroupCount', { count: selectedIds.length }) : t('chat.createGroup')}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
@@ -363,6 +367,7 @@ function NewChatDrawer({ currentUserId, onClose, onConversationCreated }) {
|
||||
// ─── Main page ────────────────────────────────────────────────────────────────
|
||||
|
||||
export default function ChatListPage() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const navigate = useNavigate()
|
||||
const { user } = useAuthStore()
|
||||
const { conversations, setConversations, upsertConversation } = useChatStore()
|
||||
@@ -414,7 +419,7 @@ export default function ChatListPage() {
|
||||
</svg>
|
||||
</div>
|
||||
<span style={{ fontSize: 15, fontWeight: 700, color: 'var(--accent)' }}>
|
||||
Νέα Συνομιλία
|
||||
{t('chat.new')}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
@@ -430,7 +435,7 @@ export default function ChatListPage() {
|
||||
{/* ── Regular conversations ────────────────────────────────────── */}
|
||||
{loading && (
|
||||
<div style={{ textAlign: 'center', padding: 40, color: 'var(--muted)', fontSize: 14 }}>
|
||||
Φόρτωση…
|
||||
{t('common.loading')}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -441,7 +446,7 @@ export default function ChatListPage() {
|
||||
}}>
|
||||
<span style={{ fontSize: 40 }}>💬</span>
|
||||
<p style={{ fontSize: 15, color: 'var(--muted)', textAlign: 'center', lineHeight: 1.5, margin: 0 }}>
|
||||
Πατήστε «Νέα Συνομιλία» για να ξεκινήσετε μια συζήτηση.
|
||||
{t('chat.startHint')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
import { useEffect, useRef, useState, useCallback } from 'react'
|
||||
import { useNavigate, useParams } from 'react-router-dom'
|
||||
import client from '../api/client'
|
||||
import { useFormat, useTranslation } from '@xenia/i18n'
|
||||
import useAuthStore from '../store/authStore'
|
||||
import useChatStore from '../store/chatStore'
|
||||
|
||||
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
||||
|
||||
function formatTime(dateStr) {
|
||||
if (!dateStr) return ''
|
||||
return new Date(dateStr).toLocaleTimeString('el-GR', { hour: '2-digit', minute: '2-digit' })
|
||||
}
|
||||
|
||||
function formatDateLabel(dateStr) {
|
||||
function formatDateLabel(dateStr, t, formatDateTime) {
|
||||
const date = new Date(dateStr)
|
||||
const now = new Date()
|
||||
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate())
|
||||
@@ -19,9 +16,9 @@ function formatDateLabel(dateStr) {
|
||||
yesterday.setDate(yesterday.getDate() - 1)
|
||||
const d = new Date(date.getFullYear(), date.getMonth(), date.getDate())
|
||||
|
||||
if (d.getTime() === today.getTime()) return 'Σήμερα'
|
||||
if (d.getTime() === yesterday.getTime()) return 'Χθες'
|
||||
return date.toLocaleDateString('el-GR', { weekday: 'long', day: 'numeric', month: 'long' })
|
||||
if (d.getTime() === today.getTime()) return t('chat.today')
|
||||
if (d.getTime() === yesterday.getTime()) return t('chat.yesterdayCap')
|
||||
return formatDateTime(date, { weekday: 'long', day: 'numeric', month: 'long' })
|
||||
}
|
||||
|
||||
function sameDay(a, b) {
|
||||
@@ -34,6 +31,8 @@ function sameDay(a, b) {
|
||||
// ─── Message bubble ───────────────────────────────────────────────────────────
|
||||
|
||||
function MessageBubble({ msg, isOwn, showSender, isGroup }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { formatTime } = useFormat()
|
||||
if (msg.is_deleted) {
|
||||
return (
|
||||
<div style={{
|
||||
@@ -44,7 +43,7 @@ function MessageBubble({ msg, isOwn, showSender, isGroup }) {
|
||||
background: 'var(--bg3)',
|
||||
}}>
|
||||
<span style={{ fontSize: 13, color: 'var(--muted)', fontStyle: 'italic' }}>
|
||||
Το μήνυμα διαγράφηκε
|
||||
{t('chat.deleted')}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
@@ -142,6 +141,7 @@ function AutoTextarea({ value, onChange, onSubmit, placeholder }) {
|
||||
// ─── Leave confirmation modal ─────────────────────────────────────────────────
|
||||
|
||||
function LeaveModal({ onConfirm, onCancel }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
return (
|
||||
<div className="modal-overlay" onClick={onCancel}>
|
||||
<div
|
||||
@@ -150,12 +150,12 @@ function LeaveModal({ onConfirm, onCancel }) {
|
||||
style={{ maxHeight: 'auto' }}
|
||||
>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title" style={{ marginBottom: 8 }}>Αποχώρηση από ομάδα;</h2>
|
||||
<h2 className="modal-title" style={{ marginBottom: 8 }}>{t('chat.leaveTitle')}</h2>
|
||||
<p style={{ fontSize: 14, color: 'var(--muted)', lineHeight: 1.5, marginBottom: 20 }}>
|
||||
Δεν θα λαμβάνετε πλέον μηνύματα από αυτή την ομάδα.
|
||||
{t('chat.leaveBody')}
|
||||
</p>
|
||||
<div style={{ display: 'flex', gap: 10 }}>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onCancel}>Ακύρωση</button>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onCancel}>{t('common.cancel')}</button>
|
||||
<button
|
||||
style={{
|
||||
flex: 1, height: 44, borderRadius: 12, border: 'none',
|
||||
@@ -164,7 +164,7 @@ function LeaveModal({ onConfirm, onCancel }) {
|
||||
}}
|
||||
onClick={onConfirm}
|
||||
>
|
||||
Αποχώρηση
|
||||
{t('chat.leave')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -175,6 +175,8 @@ function LeaveModal({ onConfirm, onCancel }) {
|
||||
// ─── Main page ────────────────────────────────────────────────────────────────
|
||||
|
||||
export default function ChatThreadPage() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { formatDateTime } = useFormat()
|
||||
const { conversationId } = useParams()
|
||||
const navigate = useNavigate()
|
||||
const { user } = useAuthStore()
|
||||
@@ -205,8 +207,8 @@ export default function ChatThreadPage() {
|
||||
const isGroup = conv?.type === 'group'
|
||||
|
||||
const title = isGroup
|
||||
? (conv?.name || 'Ομάδα')
|
||||
: (conv?.participants?.find(p => p.user_id !== user?.id)?.username || 'Συνομιλία')
|
||||
? (conv?.name || t('chat.group'))
|
||||
: (conv?.participants?.find(p => p.user_id !== user?.id)?.username || t('chat.conversation'))
|
||||
|
||||
// ── Mark as read ─────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -418,7 +420,7 @@ export default function ChatThreadPage() {
|
||||
|
||||
if (!prev || !sameDay(prev.sent_at, msg.sent_at)) {
|
||||
items.push(
|
||||
<DateSeparator key={`date-${msg.id}`} label={formatDateLabel(msg.sent_at)} />
|
||||
<DateSeparator key={`date-${msg.id}`} label={formatDateLabel(msg.sent_at, t, formatDateTime)} />
|
||||
)
|
||||
}
|
||||
|
||||
@@ -458,7 +460,7 @@ export default function ChatThreadPage() {
|
||||
<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>
|
||||
|
||||
<div style={{ flex: 1, textAlign: 'center', minWidth: 0 }}>
|
||||
@@ -470,7 +472,7 @@ export default function ChatThreadPage() {
|
||||
</span>
|
||||
{isGroup && (
|
||||
<span style={{ fontSize: 11, color: 'var(--muted)', display: 'block', marginTop: -2 }}>
|
||||
{(conv?.participants || []).length} μέλη
|
||||
{t('chat.members', { count: (conv?.participants || []).length })}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
@@ -484,7 +486,7 @@ export default function ChatThreadPage() {
|
||||
padding: '0 4px', minHeight: 44, borderRadius: 8, flexShrink: 0,
|
||||
}}
|
||||
>
|
||||
Αποχώρηση
|
||||
{t('chat.leave')}
|
||||
</button>
|
||||
) : (
|
||||
<div style={{ width: 72, flexShrink: 0 }} />
|
||||
@@ -504,13 +506,13 @@ export default function ChatThreadPage() {
|
||||
>
|
||||
{loadingMore && (
|
||||
<div style={{ textAlign: 'center', padding: '8px 0', color: 'var(--muted)', fontSize: 13 }}>
|
||||
Φόρτωση παλαιότερων…
|
||||
{t('chat.loadingOlder')}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{initialLoad && (
|
||||
<div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
||||
<span style={{ color: 'var(--muted)', fontSize: 14 }}>Φόρτωση…</span>
|
||||
<span style={{ color: 'var(--muted)', fontSize: 14 }}>{t('common.loading')}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -521,7 +523,7 @@ export default function ChatThreadPage() {
|
||||
}}>
|
||||
<span style={{ fontSize: 40 }}>💬</span>
|
||||
<p style={{ fontSize: 15, color: 'var(--muted)', textAlign: 'center', lineHeight: 1.5 }}>
|
||||
Δεν υπάρχουν μηνύματα ακόμα.{'\n'}Πείτε γεια!
|
||||
{t('chat.emptyThread')}{'\n'}{t('chat.sayHi')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -542,7 +544,7 @@ export default function ChatThreadPage() {
|
||||
value={inputText}
|
||||
onChange={e => setInputText(e.target.value)}
|
||||
onSubmit={sendMessage}
|
||||
placeholder="Γράψτε μήνυμα…"
|
||||
placeholder={t('chat.placeholder')}
|
||||
/>
|
||||
|
||||
<button
|
||||
|
||||
@@ -3,6 +3,8 @@ 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'
|
||||
import { money } from '../i18n'
|
||||
|
||||
// ── Heart icon ────────────────────────────────────────────────────────────────
|
||||
function Heart({ filled, size = 22 }) {
|
||||
@@ -66,10 +68,10 @@ function AttrSection({ title, items, favIds, onToggle }) {
|
||||
{item.name}
|
||||
</div>
|
||||
{item.extra_cost != null && item.extra_cost !== 0 && (
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)' }}>+{Number(item.extra_cost).toFixed(2)} €</div>
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)' }}>+{money(item.extra_cost)}</div>
|
||||
)}
|
||||
{item.price != null && item.price !== 0 && (
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)' }}>+{Number(item.price).toFixed(2)} €</div>
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)' }}>+{money(item.price)}</div>
|
||||
)}
|
||||
</div>
|
||||
<button
|
||||
@@ -87,6 +89,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 +167,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 +182,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 +209,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 +234,7 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
|
||||
fontSize: 13, fontWeight: 600, cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
Επαναφορά
|
||||
{t('settings.reset.title')}
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
@@ -243,7 +246,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 +256,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 +286,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 +303,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 +361,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>
|
||||
)
|
||||
@@ -402,7 +408,7 @@ function FavoritesList({ items, products, onReorder }) {
|
||||
{product.name}
|
||||
</span>
|
||||
|
||||
<span style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0 }}>{Number(product.base_price).toFixed(2)} €</span>
|
||||
<span style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0 }}>{money(product.base_price)}</span>
|
||||
</div>
|
||||
|
||||
{dropIndex === idx + 1 && dragging != null && dragging !== idx && (
|
||||
@@ -417,6 +423,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 +437,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',
|
||||
|
||||
@@ -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} />
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -2,11 +2,13 @@ import client from '../api/client'
|
||||
import { deliveryMode } from '../config/server'
|
||||
import { canRediscover, rediscover } from '../native/autoRediscover'
|
||||
import { useState } from 'react'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
// Shown at /offline, and (plan step 4.1) instead of the whole app when the server can't be
|
||||
// reached on a start with no cached bootstrap (the app retries by itself and then opens the
|
||||
// screen the address asks for).
|
||||
export default function OfflinePage() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [checking, setChecking] = useState(false)
|
||||
const [search, setSearch] = useState(null) // null | { done, total } | 'not-found'
|
||||
|
||||
@@ -37,12 +39,12 @@ export default function OfflinePage() {
|
||||
<div className="page page--centered">
|
||||
<div style={{ textAlign: 'center', maxWidth: 300 }}>
|
||||
<p style={{ fontSize: 48, marginBottom: 16 }}>📡</p>
|
||||
<h2 style={{ color: '#e2e8f0', marginBottom: 8 }}>Δεν υπάρχει σύνδεση</h2>
|
||||
<h2 style={{ color: '#e2e8f0', marginBottom: 8 }}>{t('offline.title')}</h2>
|
||||
<p style={{ color: '#64748b', marginBottom: 32 }}>
|
||||
Δεν είναι δυνατή η επικοινωνία με το σύστημα. Ελέγξτε τη σύνδεση WiFi.
|
||||
{t('offline.body')}
|
||||
</p>
|
||||
<button className="btn btn--primary btn--lg" onClick={retry} disabled={checking || searching}>
|
||||
{checking ? 'Έλεγχος…' : 'Επανάληψη'}
|
||||
{checking ? t('venues.checking') : t('common.retry')}
|
||||
</button>
|
||||
{canRediscover() && (
|
||||
<button
|
||||
@@ -51,12 +53,12 @@ export default function OfflinePage() {
|
||||
onClick={searchNetwork}
|
||||
disabled={searching}
|
||||
>
|
||||
{searching ? `Αναζήτηση… ${search.done}/${search.total}` : 'Αναζήτηση server στο δίκτυο'}
|
||||
{searching ? t('offline.searching', { done: search.done, total: search.total }) : t('offline.search')}
|
||||
</button>
|
||||
)}
|
||||
{search === 'not-found' && (
|
||||
<p style={{ color: '#94a3b8', fontSize: 13, marginTop: 12, lineHeight: 1.45 }}>
|
||||
Ο server δεν βρέθηκε στο δίκτυο. Ελέγξτε ότι είναι αναμμένος, ή σαρώστε ξανά το QR από τον διαχειριστή.
|
||||
{t('offline.notFound')}
|
||||
</p>
|
||||
)}
|
||||
{deliveryMode() === 'native' && (
|
||||
@@ -66,7 +68,7 @@ export default function OfflinePage() {
|
||||
onClick={() => { window.location.href = '/venues' }}
|
||||
disabled={searching}
|
||||
>
|
||||
Αλλαγή καταστήματος
|
||||
{t('offline.changeVenue')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -2,25 +2,12 @@ import { useState, useEffect, useCallback, useRef } from 'react'
|
||||
import { useSearchParams } from 'react-router-dom'
|
||||
import AppShell from '../components/AppShell'
|
||||
import client from '../api/client'
|
||||
import { useFormat, useTranslation } from '@xenia/i18n'
|
||||
import { money as fmtPrice } from '../i18n'
|
||||
|
||||
// ── helpers ───────────────────────────────────────────────────────────────────
|
||||
|
||||
function fmtTime(iso) {
|
||||
if (!iso) return '—'
|
||||
return new Date(iso).toLocaleTimeString('el-GR', { hour: '2-digit', minute: '2-digit' })
|
||||
}
|
||||
|
||||
function fmtDateTime(iso) {
|
||||
if (!iso) return '—'
|
||||
return new Date(iso).toLocaleString('el-GR', {
|
||||
day: '2-digit', month: '2-digit',
|
||||
hour: '2-digit', minute: '2-digit',
|
||||
})
|
||||
}
|
||||
|
||||
function fmtPrice(n) {
|
||||
return '€' + parseFloat(n || 0).toFixed(2)
|
||||
}
|
||||
// times in the venue's clock and the language's format: useFormat() in each component (4.5)
|
||||
|
||||
// ── icons ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -86,6 +73,8 @@ function FilterIcon() {
|
||||
// ── action sheet — long-press on detailed cards ───────────────────────────────
|
||||
|
||||
function PrintActionSheet({ order, onRetry, onCancel, onClose, busy }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { formatTime: fmtTime } = useFormat()
|
||||
return (
|
||||
<div
|
||||
onClick={onClose}
|
||||
@@ -106,13 +95,13 @@ function PrintActionSheet({ order, onRetry, onCancel, onClose, busy }) {
|
||||
>
|
||||
<div style={{ width: 40, height: 4, borderRadius: 2, background: 'var(--border)', margin: '0 auto 16px' }} />
|
||||
<div style={{ fontSize: 15, fontWeight: 700, color: 'var(--text)', marginBottom: 4 }}>
|
||||
Πρόβλημα Εκτύπωσης
|
||||
{t('log.printProblem')}
|
||||
</div>
|
||||
<div style={{ fontSize: 13, color: 'var(--muted)', marginBottom: 20 }}>
|
||||
Παραγγελία #{order.id} · {order.table_name} · {fmtTime(order.opened_at)}
|
||||
{t('log.orderLine', { id: order.id, table: order.table_name, time: fmtTime(order.opened_at) })}
|
||||
{order.print_retry_count > 0 && (
|
||||
<span style={{ marginLeft: 8, color: '#f59e0b' }}>
|
||||
{order.print_retry_count} επανάληψ{order.print_retry_count === 1 ? 'η' : 'εις'}
|
||||
{t('log.retries', { count: order.print_retry_count })}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
@@ -127,7 +116,7 @@ function PrintActionSheet({ order, onRetry, onCancel, onClose, busy }) {
|
||||
opacity: busy ? 0.6 : 1,
|
||||
}}
|
||||
>
|
||||
{busy ? 'Αποστολή…' : 'Εκτύπωση Τώρα'}
|
||||
{busy ? t('add.sending') : t('log.printNow')}
|
||||
</button>
|
||||
<button
|
||||
onClick={onCancel}
|
||||
@@ -140,7 +129,7 @@ function PrintActionSheet({ order, onRetry, onCancel, onClose, busy }) {
|
||||
opacity: busy ? 0.6 : 1,
|
||||
}}
|
||||
>
|
||||
Ακύρωση Εκτύπωσης
|
||||
{t('log.cancelPrint')}
|
||||
</button>
|
||||
<button
|
||||
onClick={onClose}
|
||||
@@ -150,7 +139,7 @@ function PrintActionSheet({ order, onRetry, onCancel, onClose, busy }) {
|
||||
fontSize: 15, color: 'var(--muted)', cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
Κλείσιμο
|
||||
{t('common.close')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -161,6 +150,7 @@ function PrintActionSheet({ order, onRetry, onCancel, onClose, busy }) {
|
||||
// ── filter sheet ──────────────────────────────────────────────────────────────
|
||||
|
||||
function FilterSheet({ filter, dateFrom, dateTo, onApply, onClose }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [localFilter, setLocalFilter] = useState(filter)
|
||||
const [localFrom, setLocalFrom] = useState(dateFrom)
|
||||
const [localTo, setLocalTo] = useState(dateTo)
|
||||
@@ -184,18 +174,18 @@ function FilterSheet({ filter, dateFrom, dateTo, onApply, onClose }) {
|
||||
}}
|
||||
>
|
||||
<div style={{ width: 40, height: 4, borderRadius: 2, background: 'var(--border)', margin: '0 auto 20px' }} />
|
||||
<div style={{ fontSize: 15, fontWeight: 700, color: 'var(--text)', marginBottom: 16 }}>Φίλτρα</div>
|
||||
<div style={{ fontSize: 15, fontWeight: 700, color: 'var(--text)', marginBottom: 16 }}>{t('tables.filter.title')}</div>
|
||||
|
||||
{/* Status filter */}
|
||||
<div style={{ marginBottom: 20 }}>
|
||||
<div style={{ fontSize: 12, fontWeight: 600, color: 'var(--muted)', marginBottom: 8, textTransform: 'uppercase', letterSpacing: '0.05em' }}>
|
||||
Κατάσταση
|
||||
{t('tables.filter.status')}
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 8 }}>
|
||||
{[
|
||||
{ value: 'all', label: 'Όλες' },
|
||||
{ value: 'success', label: 'Επιτυχής' },
|
||||
{ value: 'failed', label: 'Αποτυχημένη' },
|
||||
{ value: 'all', label: t('orders.chips.all') },
|
||||
{ value: 'success', label: t('log.ok') },
|
||||
{ value: 'failed', label: t('log.failedF') },
|
||||
].map(opt => (
|
||||
<button
|
||||
key={opt.value}
|
||||
@@ -218,11 +208,11 @@ function FilterSheet({ filter, dateFrom, dateTo, onApply, onClose }) {
|
||||
{/* Date range */}
|
||||
<div style={{ marginBottom: 24 }}>
|
||||
<div style={{ fontSize: 12, fontWeight: 600, color: 'var(--muted)', marginBottom: 8, textTransform: 'uppercase', letterSpacing: '0.05em' }}>
|
||||
Εύρος ημερομηνίας/ώρας
|
||||
{t('log.range')}
|
||||
</div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
|
||||
<span style={{ fontSize: 12, color: 'var(--muted)', width: 28 }}>Από</span>
|
||||
<span style={{ fontSize: 12, color: 'var(--muted)', width: 28 }}>{t('log.from')}</span>
|
||||
<input
|
||||
type="datetime-local"
|
||||
value={localFrom}
|
||||
@@ -236,7 +226,7 @@ function FilterSheet({ filter, dateFrom, dateTo, onApply, onClose }) {
|
||||
/>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
|
||||
<span style={{ fontSize: 12, color: 'var(--muted)', width: 28 }}>Έως</span>
|
||||
<span style={{ fontSize: 12, color: 'var(--muted)', width: 28 }}>{t('log.to')}</span>
|
||||
<input
|
||||
type="datetime-local"
|
||||
value={localTo}
|
||||
@@ -257,7 +247,7 @@ function FilterSheet({ filter, dateFrom, dateTo, onApply, onClose }) {
|
||||
background: 'none', border: 'none', cursor: 'pointer', padding: '2px 0',
|
||||
}}
|
||||
>
|
||||
Καθαρισμός ημερομηνίας
|
||||
{t('log.clearDates')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -271,7 +261,7 @@ function FilterSheet({ filter, dateFrom, dateTo, onApply, onClose }) {
|
||||
fontSize: 15, fontWeight: 700, cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
Εφαρμογή
|
||||
{t('common.apply')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -281,6 +271,7 @@ function FilterSheet({ filter, dateFrom, dateTo, onApply, onClose }) {
|
||||
// ── compact card (click = expand inline, expanded shows action buttons) ────────
|
||||
|
||||
function CompactCard({ order, expanded, onToggle, onRetry, onCancel, busy }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const isPending = order.print_status === 'pending'
|
||||
|
||||
return (
|
||||
@@ -315,7 +306,7 @@ function CompactCard({ order, expanded, onToggle, onRetry, onCancel, busy }) {
|
||||
{/* Row 2: item count | total */}
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 5 }}>
|
||||
<span style={{ fontSize: 12, color: 'var(--muted)' }}>
|
||||
{order.items.length} αντ.
|
||||
{t('log.itemsShort', { count: order.items.length })}
|
||||
</span>
|
||||
<span style={{ fontSize: 12, fontWeight: 600, color: 'var(--text)' }}>
|
||||
{fmtPrice(order.total)}
|
||||
@@ -343,11 +334,11 @@ function CompactCard({ order, expanded, onToggle, onRetry, onCancel, busy }) {
|
||||
<div style={{ borderTop: '1px dashed var(--border)', margin: '0 14px' }} />
|
||||
<div style={{ padding: '8px 14px', display: 'flex', flexDirection: 'column', gap: 4 }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||
<span style={{ fontSize: 14, fontWeight: 600, color: 'var(--muted)' }}>Σύνολο</span>
|
||||
<span style={{ fontSize: 14, fontWeight: 600, color: 'var(--muted)' }}>{t('common.total')}</span>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
|
||||
{isPending && order.print_retry_count > 0 && (
|
||||
<span style={{ fontSize: 11, color: '#f59e0b' }}>
|
||||
{order.print_retry_count} επανάληψ{order.print_retry_count === 1 ? 'η' : 'εις'}
|
||||
{t('log.retries', { count: order.print_retry_count })}
|
||||
</span>
|
||||
)}
|
||||
<span style={{ fontSize: 14, fontWeight: 700, color: 'var(--text)' }}>{fmtPrice(order.total)}</span>
|
||||
@@ -355,9 +346,9 @@ function CompactCard({ order, expanded, onToggle, onRetry, onCancel, busy }) {
|
||||
</div>
|
||||
{order.fiscal_status && (
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 12 }}>
|
||||
<span style={{ color: 'var(--muted)' }}>Φορολογική εκτύπωση</span>
|
||||
<span style={{ color: 'var(--muted)' }}>{t('log.fiscal')}</span>
|
||||
<span style={{ fontWeight: 600, color: order.fiscal_status === 'success' ? '#22c55e' : order.fiscal_status === 'pending' ? '#f59e0b' : '#ef4444' }}>
|
||||
{order.fiscal_status === 'success' ? 'Επιτυχής' : order.fiscal_status === 'pending' ? 'Εκκρεμεί…' : 'Αποτυχία'}
|
||||
{order.fiscal_status === 'success' ? t('log.ok') : order.fiscal_status === 'pending' ? t('log.pending') : t('log.failed')}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
@@ -376,7 +367,7 @@ function CompactCard({ order, expanded, onToggle, onRetry, onCancel, busy }) {
|
||||
opacity: busy ? 0.6 : 1,
|
||||
}}
|
||||
>
|
||||
{busy ? 'Αποστολή…' : 'Εκτύπωση Τώρα'}
|
||||
{busy ? t('add.sending') : t('log.printNow')}
|
||||
</button>
|
||||
<button
|
||||
onClick={() => onCancel(order)}
|
||||
@@ -389,7 +380,7 @@ function CompactCard({ order, expanded, onToggle, onRetry, onCancel, busy }) {
|
||||
opacity: busy ? 0.6 : 1,
|
||||
}}
|
||||
>
|
||||
Ακύρωση
|
||||
{t('log.cancel')}
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
@@ -403,6 +394,9 @@ function CompactCard({ order, expanded, onToggle, onRetry, onCancel, busy }) {
|
||||
// ── detailed card (long-press = action sheet) ─────────────────────────────────
|
||||
|
||||
function DetailedCard({ order, onLongPress }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { formatDateTime: fmtDateTime } = useFormat()
|
||||
const { formatTime: fmtTime } = useFormat()
|
||||
const isPending = order.print_status === 'pending'
|
||||
const pressTimer = useRef(null)
|
||||
|
||||
@@ -450,22 +444,22 @@ function DetailedCard({ order, onLongPress }) {
|
||||
{/* Meta rows */}
|
||||
<div style={{ padding: '10px 14px', display: 'flex', flexDirection: 'column', gap: 5 }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 12 }}>
|
||||
<span style={{ color: 'var(--muted)' }}>Παραγγέλθηκε</span>
|
||||
<span style={{ color: 'var(--muted)' }}>{t('summary.ordered')}</span>
|
||||
<span style={{ color: 'var(--text)', fontWeight: 500 }}>{fmtDateTime(order.opened_at)}</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 12 }}>
|
||||
<span style={{ color: 'var(--muted)' }}>Εκτύπωση</span>
|
||||
<span style={{ color: 'var(--muted)' }}>{t('log.print')}</span>
|
||||
<span style={{ fontWeight: 600, color: isPending ? '#ef4444' : '#22c55e' }}>
|
||||
{isPending
|
||||
? `Εκκρεμεί (${order.print_retry_count} επαν.)`
|
||||
? t('log.pendingRetries', { count: order.print_retry_count })
|
||||
: `OK ${fmtTime(order.print_attempted_at)}`}
|
||||
</span>
|
||||
</div>
|
||||
{order.fiscal_status && (
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 12 }}>
|
||||
<span style={{ color: 'var(--muted)' }}>Φορολογική εκτύπωση</span>
|
||||
<span style={{ color: 'var(--muted)' }}>{t('log.fiscal')}</span>
|
||||
<span style={{ fontWeight: 600, color: order.fiscal_status === 'success' ? '#22c55e' : order.fiscal_status === 'pending' ? '#f59e0b' : '#ef4444' }}>
|
||||
{order.fiscal_status === 'success' ? 'Επιτυχής' : order.fiscal_status === 'pending' ? 'Εκκρεμεί…' : 'Αποτυχία'}
|
||||
{order.fiscal_status === 'success' ? t('log.ok') : order.fiscal_status === 'pending' ? t('log.pending') : t('log.failed')}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
@@ -493,13 +487,13 @@ function DetailedCard({ order, onLongPress }) {
|
||||
|
||||
{/* Total */}
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '8px 14px', fontSize: 14 }}>
|
||||
<span style={{ color: 'var(--muted)', fontWeight: 600 }}>Σύνολο</span>
|
||||
<span style={{ color: 'var(--muted)', fontWeight: 600 }}>{t('common.total')}</span>
|
||||
<span style={{ color: 'var(--text)', fontWeight: 700 }}>{fmtPrice(order.total)}</span>
|
||||
</div>
|
||||
|
||||
{isPending && (
|
||||
<div style={{ padding: '0 14px 10px', textAlign: 'center' }}>
|
||||
<span style={{ fontSize: 11, color: 'var(--muted)' }}>Κρατήστε πατημένο για επιλογές</span>
|
||||
<span style={{ fontSize: 11, color: 'var(--muted)' }}>{t('log.holdForOptions')}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -509,6 +503,8 @@ function DetailedCard({ order, onLongPress }) {
|
||||
// ── main page ─────────────────────────────────────────────────────────────────
|
||||
|
||||
export default function OrderLogPage() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { formatDateTime } = useFormat()
|
||||
const [searchParams] = useSearchParams()
|
||||
const initialFilter = searchParams.get('filter') === 'failed' ? 'failed' : 'all'
|
||||
|
||||
@@ -605,7 +601,7 @@ export default function OrderLogPage() {
|
||||
const hasActiveFilters = filter !== 'all' || !!dateFrom || !!dateTo
|
||||
|
||||
return (
|
||||
<AppShell title="Αρχ. Παραγγ.">
|
||||
<AppShell title={t('log.titleShort')}>
|
||||
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', overflow: 'hidden', position: 'relative' }}>
|
||||
|
||||
{/* Toolbar */}
|
||||
@@ -617,7 +613,7 @@ export default function OrderLogPage() {
|
||||
}}>
|
||||
<input
|
||||
type="search"
|
||||
placeholder="Τραπέζι, #παραγγελία, αντικείμενο…"
|
||||
placeholder={t('log.searchPlaceholder')}
|
||||
value={search}
|
||||
onChange={e => setSearch(e.target.value)}
|
||||
style={{
|
||||
@@ -636,7 +632,7 @@ export default function OrderLogPage() {
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
title={view === 'compact' ? 'Λεπτομερής προβολή' : 'Συμπαγής προβολή'}
|
||||
title={view === 'compact' ? t('log.detailedView') : t('log.compactView')}
|
||||
>
|
||||
{view === 'compact' ? <DetailedIcon active={false} /> : <CompactIcon active={false} />}
|
||||
</button>
|
||||
@@ -656,7 +652,7 @@ export default function OrderLogPage() {
|
||||
<path d="M12 8v4M12 16h.01" stroke="#ef4444" strokeWidth="2" strokeLinecap="round"/>
|
||||
</svg>
|
||||
<span style={{ fontSize: 13, color: '#ef4444', fontWeight: 600 }}>
|
||||
{pendingCount} παραγγελί{pendingCount !== 1 ? 'ες' : 'α'} με πρόβλημα εκτύπωσης
|
||||
{t('log.printProblems', { count: pendingCount })}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
@@ -676,24 +672,24 @@ export default function OrderLogPage() {
|
||||
color: filter === 'failed' ? '#ef4444' : '#22c55e',
|
||||
fontWeight: 600,
|
||||
}}>
|
||||
{filter === 'failed' ? 'Αποτυχημένη εκτύπωση' : 'Επιτυχής εκτύπωση'}
|
||||
{filter === 'failed' ? t('log.printFailed') : t('log.printOk')}
|
||||
</span>
|
||||
)}
|
||||
{dateFrom && (
|
||||
<span style={{ fontSize: 12, padding: '3px 10px', borderRadius: 999, background: 'var(--bg3)', color: 'var(--muted)' }}>
|
||||
Από {new Date(dateFrom).toLocaleString('el-GR', { day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' })}
|
||||
{t('log.from')} {formatDateTime(new Date(dateFrom), 'datetimeShort')}
|
||||
</span>
|
||||
)}
|
||||
{dateTo && (
|
||||
<span style={{ fontSize: 12, padding: '3px 10px', borderRadius: 999, background: 'var(--bg3)', color: 'var(--muted)' }}>
|
||||
Έως {new Date(dateTo).toLocaleString('el-GR', { day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' })}
|
||||
{t('log.to')} {formatDateTime(new Date(dateTo), 'datetimeShort')}
|
||||
</span>
|
||||
)}
|
||||
<button
|
||||
onClick={() => { setFilter('all'); setDateFrom(''); setDateTo('') }}
|
||||
style={{ fontSize: 12, color: 'var(--muted)', background: 'none', border: 'none', cursor: 'pointer', padding: '3px 6px' }}
|
||||
>
|
||||
✕ Καθαρισμός
|
||||
✕ {t('common.clear')}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -701,11 +697,11 @@ export default function OrderLogPage() {
|
||||
{/* List */}
|
||||
<div style={{ flex: 1, overflowY: 'auto', padding: '12px 14px 80px', display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
{loading && (
|
||||
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: '40px 0', fontSize: 14 }}>Φόρτωση…</p>
|
||||
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: '40px 0', fontSize: 14 }}>{t('common.loading')}</p>
|
||||
)}
|
||||
{!loading && filtered.length === 0 && (
|
||||
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: '40px 0', fontSize: 14 }}>
|
||||
{search || hasActiveFilters ? 'Δεν βρέθηκαν παραγγελίες' : 'Δεν υπάρχουν παραγγελίες σε αυτή τη βάρδια'}
|
||||
{search || hasActiveFilters ? t('log.noneFound') : t('log.noneThisShift')}
|
||||
</p>
|
||||
)}
|
||||
{filtered.map(order =>
|
||||
@@ -744,7 +740,7 @@ export default function OrderLogPage() {
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
||||
zIndex: 10,
|
||||
}}
|
||||
title="Φίλτρα"
|
||||
title={t('tables.filter.title')}
|
||||
>
|
||||
<FilterIcon />
|
||||
{hasActiveFilters && (
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,27 +1,22 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import AppShell from '../components/AppShell'
|
||||
import client from '../api/client'
|
||||
import { useFormat, useTranslation } from '@xenia/i18n'
|
||||
import { money as fmtEuro, tw } from '../i18n'
|
||||
import { getVenueSettings } from '../api/venueSettings'
|
||||
|
||||
// ── helpers ───────────────────────────────────────────────────────────────────
|
||||
|
||||
function fmtTime(iso) {
|
||||
if (!iso) return '—'
|
||||
return new Date(iso).toLocaleTimeString('el-GR', { hour: '2-digit', minute: '2-digit' })
|
||||
}
|
||||
|
||||
function fmtDuration(seconds) {
|
||||
if (seconds == null || seconds < 0) return '—'
|
||||
const h = Math.floor(seconds / 3600)
|
||||
const m = Math.floor((seconds % 3600) / 60)
|
||||
if (h === 0) return `${m}λ`
|
||||
if (m === 0) return `${h}ω`
|
||||
return `${h}ω ${m}λ`
|
||||
if (h === 0) return tw('common.minutesShort', { m })
|
||||
if (m === 0) return tw('common.hoursShort', { h })
|
||||
return tw('common.hoursMinutesShort', { h, m })
|
||||
}
|
||||
|
||||
function fmtEuro(n) {
|
||||
return '€' + parseFloat(n || 0).toFixed(2)
|
||||
}
|
||||
|
||||
function sinceSeconds(isoStart) {
|
||||
if (!isoStart) return 0
|
||||
@@ -101,6 +96,8 @@ function PerHourChart({ title, data, accent = 'var(--accent)' }) {
|
||||
// ── breaks timeline ───────────────────────────────────────────────────────────
|
||||
|
||||
function BreakRow({ brk, index }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { formatTime: fmtTime } = useFormat()
|
||||
const dur = breakDurationSeconds(brk)
|
||||
const active = !brk.ended_at
|
||||
return (
|
||||
@@ -118,7 +115,7 @@ function BreakRow({ brk, index }) {
|
||||
}}>{index + 1}</div>
|
||||
<div style={{ flex: 1 }}>
|
||||
<div style={{ fontSize: 13, fontWeight: 600, color: 'var(--text)' }}>
|
||||
{fmtTime(brk.started_at)} – {active ? 'Τώρα' : fmtTime(brk.ended_at)}
|
||||
{fmtTime(brk.started_at)} – {active ? t('shiftPage.now') : fmtTime(brk.ended_at)}
|
||||
</div>
|
||||
<div style={{ fontSize: 11, color: 'var(--muted)', marginTop: 1 }}>
|
||||
{fmtDuration(dur)}
|
||||
@@ -128,7 +125,7 @@ function BreakRow({ brk, index }) {
|
||||
<span style={{
|
||||
fontSize: 10, fontWeight: 700, padding: '3px 8px', borderRadius: 999,
|
||||
background: '#f97316', color: 'white',
|
||||
}}>ΕΝΕΡΓΟ</span>
|
||||
}}>{t('venues.active')}</span>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
@@ -137,6 +134,8 @@ function BreakRow({ brk, index }) {
|
||||
// ── main page ─────────────────────────────────────────────────────────────────
|
||||
|
||||
export default function ShiftOverviewPage() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { formatTime: fmtTime } = useFormat()
|
||||
const { data: shift, isLoading: shiftLoading } = useQuery({
|
||||
queryKey: ['my-shift'],
|
||||
queryFn: () => client.get('/api/shifts/my').then(r => r.data),
|
||||
@@ -164,7 +163,7 @@ export default function ShiftOverviewPage() {
|
||||
return (
|
||||
<AppShell title="Shift Overview">
|
||||
<div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center', color: 'var(--muted)', fontSize: 14 }}>
|
||||
Φόρτωση…
|
||||
{t('common.loading')}
|
||||
</div>
|
||||
</AppShell>
|
||||
)
|
||||
@@ -175,8 +174,8 @@ export default function ShiftOverviewPage() {
|
||||
<AppShell title="Shift Overview">
|
||||
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 12, padding: 24, textAlign: 'center' }}>
|
||||
<div style={{ fontSize: 40 }}>⏸</div>
|
||||
<div style={{ fontSize: 16, fontWeight: 700, color: 'var(--text)' }}>Δεν υπάρχει ενεργή βάρδια</div>
|
||||
<div style={{ fontSize: 13, color: 'var(--muted)' }}>Ξεκινήστε βάρδια για να δείτε στατιστικά.</div>
|
||||
<div style={{ fontSize: 16, fontWeight: 700, color: 'var(--text)' }}>{t('shiftPage.none')}</div>
|
||||
<div style={{ fontSize: 13, color: 'var(--muted)' }}>{t('shiftPage.noneSub')}</div>
|
||||
</div>
|
||||
</AppShell>
|
||||
)
|
||||
@@ -219,9 +218,9 @@ export default function ShiftOverviewPage() {
|
||||
}}>
|
||||
<span style={{ fontSize: 20 }}>☕</span>
|
||||
<div>
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: '#f97316' }}>Σε διάλειμμα</div>
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: '#f97316' }}>{t('shiftPage.onBreak')}</div>
|
||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 1 }}>
|
||||
από {fmtTime(activeBreak.started_at)} · {fmtDuration(breakDurationSeconds(activeBreak))} μέχρι τώρα
|
||||
{t('shiftPage.breakSince', { time: fmtTime(activeBreak.started_at), duration: fmtDuration(breakDurationSeconds(activeBreak)) })}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -229,18 +228,18 @@ export default function ShiftOverviewPage() {
|
||||
|
||||
{/* Hero stats grid */}
|
||||
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 10, marginBottom: 20 }}>
|
||||
<StatCard label="Έναρξη" value={fmtTime(shift.started_at)} />
|
||||
<StatCard label="Ώρες Εργασίας" value={fmtDuration(workedSec)} sub={`${fmtDuration(totalBreakSec)} διαλείμματα`} />
|
||||
<StatCard label="Αρχ. Μετρητά" value={fmtEuro(shift.starting_cash)} />
|
||||
<StatCard label={t('shiftPage.start')} value={fmtTime(shift.started_at)} />
|
||||
<StatCard label={t('shiftPage.worked')} value={fmtDuration(workedSec)} sub={t('shiftPage.breaksSub', { duration: fmtDuration(totalBreakSec) })} />
|
||||
<StatCard label={t('shiftPage.startCash')} value={fmtEuro(shift.starting_cash)} />
|
||||
{!hideRevenue && (
|
||||
<StatCard label="Είσπραξη" value={fmtEuro(shift.total_collected)} accent="var(--success, #22c55e)" />
|
||||
<StatCard label={t('shiftPage.collected')} value={fmtEuro(shift.total_collected)} accent="var(--success, #22c55e)" />
|
||||
)}
|
||||
{!hideRevenue && (
|
||||
<StatCard label="Παραδ. Ποσό" value={fmtEuro(shift.net_to_deliver)} sub="Αρχ. + Είσπραξη" accent="var(--accent)" />
|
||||
<StatCard label={t('shiftPage.toHandIn')} value={fmtEuro(shift.net_to_deliver)} sub={t('shiftPage.toHandInSub')} accent="var(--accent)" />
|
||||
)}
|
||||
<StatCard label="Ανοιχτά Τραπέζια" value={String(openOrders.length)} sub="τρέχουσες παραγγελίες" />
|
||||
<StatCard label="Είδη (ανοιχτά)" value={String(totalItems)} />
|
||||
<StatCard label="Διαλείμματα" value={String((shift.breaks || []).length)} sub={`${fmtDuration(totalBreakSec)} σύνολο`} />
|
||||
<StatCard label={t('shiftPage.openTables')} value={String(openOrders.length)} sub={t('shiftPage.openTablesSub')} />
|
||||
<StatCard label={t('shiftPage.items')} value={String(totalItems)} />
|
||||
<StatCard label={t('shiftPage.breaks')} value={String((shift.breaks || []).length)} sub={t('shiftPage.totalSub', { duration: fmtDuration(totalBreakSec) })} />
|
||||
</div>
|
||||
|
||||
{/* Per-hour charts */}
|
||||
@@ -249,9 +248,9 @@ export default function ShiftOverviewPage() {
|
||||
background: 'var(--bg2)', border: '1px solid var(--border)',
|
||||
borderRadius: 16, padding: '16px 18px', marginBottom: 20,
|
||||
}}>
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: 'var(--text)', marginBottom: 16 }}>Ανά Ώρα</div>
|
||||
<PerHourChart title="Παραγγελίες" data={ordersByHour} />
|
||||
<PerHourChart title="Είδη" data={itemsByHour} />
|
||||
<div style={{ fontSize: 14, fontWeight: 700, color: 'var(--text)', marginBottom: 16 }}>{t('shiftPage.perHour')}</div>
|
||||
<PerHourChart title={t('nav.orders')} data={ordersByHour} />
|
||||
<PerHourChart title={t('shiftPage.itemsShort')} data={itemsByHour} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -259,7 +258,7 @@ export default function ShiftOverviewPage() {
|
||||
{(shift.breaks || []).length > 0 && (
|
||||
<div>
|
||||
<div style={{ fontSize: 12, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.5, marginBottom: 10 }}>
|
||||
Διαλείμματα ({shift.breaks.length})
|
||||
{t('shiftPage.breaksCount', { count: shift.breaks.length })}
|
||||
</div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
{shift.breaks.map((b, i) => <BreakRow key={b.id} brk={b} index={i} />)}
|
||||
|
||||
@@ -5,14 +5,16 @@ import OrderSummary from '../components/OrderSummary'
|
||||
import useConnectionStore from '../store/connectionStore'
|
||||
import client from '../api/client'
|
||||
import { apiError } from '../api/errors'
|
||||
import { money } from '../i18n'
|
||||
import { getVenueSettings } from '../api/venueSettings'
|
||||
import db from '../db/posdb'
|
||||
import { queueOfflineSplit, queueOfflinePayment as queueOfflinePaymentOp } from '../services/offlineOrders'
|
||||
import { TransferIcon, MergeIcon, FlagsIcon, WaiterIcon, PrintIcon } from '../components/Icons'
|
||||
import usePaymentSettingsStore from '../store/paymentSettingsStore'
|
||||
import useTableViewStore from '../store/tableViewStore'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
|
||||
function fmtPrice(v) { return Number(v).toFixed(2) + ' €' }
|
||||
const fmtPrice = money
|
||||
|
||||
// ─── Merge mode ───────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -20,12 +22,6 @@ const MERGE_OFF = 'off'
|
||||
const MERGE_IDENTICAL = 'identical' // same product + options + price
|
||||
const MERGE_SAME_ITEM = 'same_item' // same product + same effective unit price
|
||||
|
||||
const MERGE_LABELS = {
|
||||
[MERGE_OFF]: 'ΔΙΑΧΩΡΙΣΜΟΣ',
|
||||
[MERGE_IDENTICAL]: 'ΙΔΙΑ ITEMS',
|
||||
[MERGE_SAME_ITEM]: 'ΙΔΙΑ ΤΙΜΗ',
|
||||
}
|
||||
|
||||
// Returns a stable string key for grouping under MERGE_IDENTICAL
|
||||
function identicalKey(item) {
|
||||
const effPrice = ((item.unit_price ?? 0) + (item.price_adjustment ?? 0)).toFixed(4)
|
||||
@@ -73,6 +69,7 @@ function mergeItems(items, mode) {
|
||||
// ─── Split stepper modal ──────────────────────────────────────────────────────
|
||||
|
||||
function SplitModal({ item, onConfirm, onClose }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [splitQty, setSplitQty] = useState(1)
|
||||
const max = item.quantity - 1
|
||||
|
||||
@@ -80,12 +77,12 @@ function SplitModal({ item, onConfirm, onClose }) {
|
||||
<div className="modal-overlay" onClick={onClose}>
|
||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title">Διαχωρισμός</h2>
|
||||
<h2 className="modal-title">{t('detail.split.title')}</h2>
|
||||
<p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 14, marginBottom: 4 }}>
|
||||
{item.product?.name} ×{item.quantity}
|
||||
</p>
|
||||
<p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 13, marginBottom: 16 }}>
|
||||
Χώρισε σε πόσα;
|
||||
{t('detail.split.howMany')}
|
||||
</p>
|
||||
|
||||
<div className="modal-qty" style={{ marginBottom: 8 }}>
|
||||
@@ -95,14 +92,14 @@ function SplitModal({ item, onConfirm, onClose }) {
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', justifyContent: 'center', gap: 20, marginBottom: 20, fontSize: 13, color: '#94a3b8' }}>
|
||||
<span>Νέα γραμμή: <strong style={{ color: '#f59e0b' }}>×{splitQty}</strong></span>
|
||||
<span>Μένει: <strong style={{ color: '#64748b' }}>×{item.quantity - splitQty}</strong></span>
|
||||
<span>{t('detail.split.newLine')} <strong style={{ color: '#f59e0b' }}>×{splitQty}</strong></span>
|
||||
<span>{t('detail.split.remains')} <strong style={{ color: '#64748b' }}>×{item.quantity - splitQty}</strong></span>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', gap: 12 }}>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>Άκυρο</button>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => onConfirm(splitQty)}>
|
||||
Διαχωρισμός
|
||||
{t('detail.split.title')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -113,6 +110,7 @@ function SplitModal({ item, onConfirm, onClose }) {
|
||||
// ─── Price adjust modal ───────────────────────────────────────────────────────
|
||||
|
||||
function PriceAdjustModal({ item, onConfirm, onClose }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const basePrice = item.unit_price ?? 0
|
||||
const [adj, setAdj] = useState(item.price_adjustment ?? 0)
|
||||
const [editing, setEditing] = useState(false)
|
||||
@@ -148,7 +146,7 @@ function PriceAdjustModal({ item, onConfirm, onClose }) {
|
||||
<div className="modal-overlay" onClick={onClose}>
|
||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title">Ρύθμιση Τιμής</h2>
|
||||
<h2 className="modal-title">{t('detail.price.title')}</h2>
|
||||
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 16px' }}>
|
||||
{item.product?.name}
|
||||
</p>
|
||||
@@ -180,15 +178,15 @@ function PriceAdjustModal({ item, onConfirm, onClose }) {
|
||||
borderRadius: 12, padding: '6px 20px', cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
{effective.toFixed(2)} €
|
||||
{fmtPrice(effective)}
|
||||
</button>
|
||||
)}
|
||||
{adj !== 0 && (
|
||||
<div style={{ fontSize: 12, color: adj > 0 ? '#22c55e' : '#f87171', marginTop: 4 }}>
|
||||
Βασική: {basePrice.toFixed(2)} € {adj > 0 ? '+' : ''}{adj.toFixed(2)} €
|
||||
{t('detail.price.base', { base: fmtPrice(basePrice), change: `${adj > 0 ? '+' : ''}${fmtPrice(adj)}` })}
|
||||
</div>
|
||||
)}
|
||||
<div style={{ fontSize: 11, color: 'var(--muted)', marginTop: 2 }}>Πάτα για πληκτρολόγιο</div>
|
||||
<div style={{ fontSize: 11, color: 'var(--muted)', marginTop: 2 }}>{t('detail.price.tapToType')}</div>
|
||||
</div>
|
||||
|
||||
{/* +/- stepper (0.1 step) */}
|
||||
@@ -226,14 +224,14 @@ function PriceAdjustModal({ item, onConfirm, onClose }) {
|
||||
color: 'var(--muted)', fontSize: 13, cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
Επαναφορά αρχικής τιμής
|
||||
{t('detail.price.reset')}
|
||||
</button>
|
||||
)}
|
||||
|
||||
<div style={{ display: 'flex', gap: 10 }}>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>Άκυρο</button>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => onConfirm(adj)}>
|
||||
Εφαρμογή
|
||||
{t('common.apply')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -244,9 +242,10 @@ function PriceAdjustModal({ item, onConfirm, onClose }) {
|
||||
// ─── Item action modal (long-press) ──────────────────────────────────────────
|
||||
|
||||
function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCancel, canCancel, cancelNeedsApproval, priceAdjAllowed, priceNeedsApproval, canMove, onAdjustPrice, onClose }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { items, singleStacked, multiSelect } = target
|
||||
const label = multiSelect
|
||||
? `${items.length} αντικείμενα επιλεγμένα`
|
||||
? t('detail.selected', { count: items.length })
|
||||
: items[0]?.product?.name || `#${items[0]?.product_id}`
|
||||
|
||||
const actionRows = [
|
||||
@@ -254,8 +253,8 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
||||
key: 'adjust_price',
|
||||
color: '#f59e0b',
|
||||
iconBg: 'rgba(245,158,11,0.15)',
|
||||
label: 'Ρύθμιση τιμής',
|
||||
sub: priceNeedsApproval ? 'Με έγκριση διαχειριστή (PIN)' : 'Αλλαγή τιμής για αυτό το αντικείμενο',
|
||||
label: t('detail.item.price'),
|
||||
sub: priceNeedsApproval ? t('detail.withApproval') : t('detail.item.priceSub'),
|
||||
icon: (
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||
<circle cx="12" cy="12" r="9" stroke="#f59e0b" strokeWidth="2"/>
|
||||
@@ -269,8 +268,8 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
||||
key: 'order_again',
|
||||
color: '#22c55e',
|
||||
iconBg: 'rgba(34,197,94,0.15)',
|
||||
label: 'Παραγγελία ξανά',
|
||||
sub: 'Προσθήκη στο νέο καλάθι',
|
||||
label: t('detail.item.again'),
|
||||
sub: t('detail.item.againSub'),
|
||||
icon: (
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M1 4v6h6M23 20v-6h-6" stroke="#22c55e" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||
@@ -284,8 +283,8 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
||||
key: 'move',
|
||||
color: '#f97316',
|
||||
iconBg: 'rgba(249,115,22,0.15)',
|
||||
label: 'Μεταφορά σε άλλο τραπέζι',
|
||||
sub: 'Μεταφορά επιλεγμένων αντικειμένων',
|
||||
label: t('detail.item.move'),
|
||||
sub: t('detail.item.moveSub'),
|
||||
icon: (
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M5 12h14M12 5l7 7-7 7" stroke="#f97316" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||
@@ -298,8 +297,8 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
||||
key: 'split',
|
||||
color: '#60a5fa',
|
||||
iconBg: 'rgba(96,165,250,0.15)',
|
||||
label: 'Διαχωρισμός',
|
||||
sub: 'Χώρισμα σε δύο γραμμές',
|
||||
label: t('detail.split.title'),
|
||||
sub: t('detail.item.splitSub'),
|
||||
icon: (
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M16 3h5v5M4 20L21 3M21 16v5h-5M15 15l6 6M4 4l5 5" stroke="#60a5fa" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||
@@ -312,8 +311,8 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
||||
key: 'cancel',
|
||||
color: canCancel ? '#ef4444' : '#6b7280',
|
||||
iconBg: canCancel ? 'rgba(239,68,68,0.15)' : 'rgba(107,114,128,0.1)',
|
||||
label: 'Ακύρωση παραγγελίας',
|
||||
sub: !canCancel ? 'Δεν επιτρέπεται η ακύρωση' : cancelNeedsApproval ? 'Με έγκριση διαχειριστή (PIN)' : 'Ακύρωση επιλεγμένων αντικειμένων',
|
||||
label: t('detail.item.cancel'),
|
||||
sub: !canCancel ? t('detail.cancelNotAllowed') : cancelNeedsApproval ? t('detail.withApproval') : t('detail.item.cancelSub'),
|
||||
icon: (
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||
<circle cx="12" cy="12" r="10" stroke={canCancel ? '#ef4444' : '#6b7280'} strokeWidth="2"/>
|
||||
@@ -358,7 +357,7 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
||||
))}
|
||||
|
||||
<button className="btn btn--secondary" style={{ width: '100%', marginTop: 12 }} onClick={onClose}>
|
||||
Άκυρο
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -368,6 +367,7 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
||||
// ─── Apply Discount modal ─────────────────────────────────────────────────────
|
||||
|
||||
function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const activeItems = (order?.items ?? []).filter(i => i.status === 'active')
|
||||
const [selectedIds, setSelectedIds] = useState(activeItems.map(i => i.id))
|
||||
const [pct, setPct] = useState(10)
|
||||
@@ -392,8 +392,8 @@ function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
||||
const roundedPct = Math.round(pct * 10) / 10
|
||||
|
||||
async function apply() {
|
||||
if (selectedIds.length === 0) { setError('Επιλέξτε τουλάχιστον ένα αντικείμενο'); return }
|
||||
if (roundedPct <= 0 || roundedPct > 100) { setError('Μη έγκυρο ποσοστό'); return }
|
||||
if (selectedIds.length === 0) { setError(t('detail.discount.pickOne')); return }
|
||||
if (roundedPct <= 0 || roundedPct > 100) { setError(t('detail.discount.badPct')); return }
|
||||
setApplying(true); setError('')
|
||||
try {
|
||||
const res = await client.post(`/api/orders/${order.id}/items/discount`, {
|
||||
@@ -408,7 +408,7 @@ function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
||||
onApplied()
|
||||
onClose()
|
||||
} catch (e) {
|
||||
setError(apiError(e, 'Σφάλμα εφαρμογής έκπτωσης'))
|
||||
setError(apiError(e, t('detail.discount.failed')))
|
||||
} finally {
|
||||
setApplying(false)
|
||||
}
|
||||
@@ -418,14 +418,14 @@ function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
||||
<div className="modal-overlay" onClick={onClose}>
|
||||
<div className="modal-sheet" onClick={e => e.stopPropagation()} style={{ gap: 0 }}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title" style={{ marginBottom: 4 }}>Εφαρμογή Έκπτωσης</h2>
|
||||
<h2 className="modal-title" style={{ marginBottom: 4 }}>{t('detail.actions.discount')}</h2>
|
||||
<p style={{ textAlign: 'center', fontSize: 12, color: 'var(--muted)', marginBottom: 16 }}>
|
||||
Η τελική τιμή στρογγυλοποιείται στο 0.10 €
|
||||
{t('detail.discount.rounding')}
|
||||
</p>
|
||||
|
||||
{/* Item multi-select */}
|
||||
<div style={{ marginBottom: 14 }}>
|
||||
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 8 }}>Αντικείμενα</p>
|
||||
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 8 }}>{t('detail.discount.items')}</p>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, maxHeight: 180, overflowY: 'auto' }}>
|
||||
{activeItems.map(item => {
|
||||
const eff = (item.unit_price ?? 0) + (item.price_adjustment ?? 0)
|
||||
@@ -450,11 +450,11 @@ function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
||||
<div style={{ fontSize: 13, fontWeight: 600, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
||||
{item.product?.name ?? `#${item.product_id}`}
|
||||
</div>
|
||||
<div style={{ fontSize: 11, color: 'var(--muted)' }}>×{item.quantity} · {eff.toFixed(2)} €</div>
|
||||
<div style={{ fontSize: 11, color: 'var(--muted)' }}>×{item.quantity} · {fmtPrice(eff)}</div>
|
||||
</div>
|
||||
{checked && (
|
||||
<div style={{ fontSize: 12, fontWeight: 700, color: '#4ade80', shrink: 0 }}>
|
||||
→ {newPrice.toFixed(2)} €
|
||||
→ {fmtPrice(newPrice)}
|
||||
</div>
|
||||
)}
|
||||
</button>
|
||||
@@ -465,7 +465,7 @@ function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
||||
|
||||
{/* Percent picker */}
|
||||
<div style={{ marginBottom: 14 }}>
|
||||
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 8 }}>Ποσοστό έκπτωσης</p>
|
||||
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 8 }}>{t('detail.discount.pct')}</p>
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 6, marginBottom: 10 }}>
|
||||
{PCT_PRESETS.map(p => (
|
||||
<button key={p} onClick={() => setPct(p)}
|
||||
@@ -488,16 +488,16 @@ function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
||||
}} />
|
||||
<span style={{ fontSize: 14, color: 'var(--muted)' }}>%</span>
|
||||
<span style={{ fontSize: 13, color: '#4ade80', fontWeight: 700 }}>
|
||||
−{discountTotal.toFixed(2)} €
|
||||
−{fmtPrice(discountTotal)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Note */}
|
||||
<div style={{ marginBottom: 14 }}>
|
||||
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 6 }}>Σημείωση (προαιρετικό)</p>
|
||||
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 6 }}>{t('detail.discount.note')}</p>
|
||||
<input value={note} onChange={e => setNote(e.target.value)}
|
||||
placeholder="π.χ. VIP πελάτης"
|
||||
placeholder={t('detail.discount.notePlaceholder')}
|
||||
style={{
|
||||
width: '100%', padding: '9px 12px', borderRadius: 10,
|
||||
border: '1.5px solid var(--border)', background: 'var(--bg3)',
|
||||
@@ -510,9 +510,9 @@ function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
||||
)}
|
||||
|
||||
<div style={{ display: 'flex', gap: 10 }}>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>Άκυρο</button>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||
<button className="btn btn--primary" style={{ flex: 1 }} onClick={apply} disabled={applying}>
|
||||
{applying ? 'Εφαρμογή…' : 'Εφαρμογή'}
|
||||
{applying ? t('detail.discount.applying') : t('common.apply')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -549,20 +549,21 @@ function DiscountIcon({ width = 20, height = 20 }) {
|
||||
}
|
||||
|
||||
function ActionsSheet({ order, _tableId, isStandalone, onClose, onTransfer, onMerge, onSetFlags, onAssignWaiter, onPrintSynopsis, onCancelOrder, onMarkAllServed, canCancel, cancelNeedsApproval, canDiscount, canMove, onApplyDiscount }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const hasOrder = !!order
|
||||
const hasServable = hasOrder && order.items?.some(i => i.kds_status === 'done')
|
||||
const hasActiveItems = hasOrder && order.items?.some(i => i.status === 'active')
|
||||
const allActions = [
|
||||
{ Icon: CheckIcon, label: 'Σήμανση Όλων ως Παραδοθέντα', sub: 'Σήμανση όλων των έτοιμων ειδών ως παραδοθέντα',
|
||||
{ Icon: CheckIcon, label: t('tables.quick.markAllServed'), sub: t('detail.actions.markAllServedSub'),
|
||||
onClick: hasServable ? onMarkAllServed : null, color: hasServable ? '#4ade80' : '#6b7280', iconBg: hasServable ? 'rgba(34,197,94,0.15)' : 'rgba(107,114,128,0.1)' },
|
||||
{ Icon: DiscountIcon, label: 'Εφαρμογή Έκπτωσης', sub: canDiscount ? 'Έκπτωση σε αντικείμενα παραγγελίας' : 'Δεν επιτρέπεται η εφαρμογή έκπτωσης',
|
||||
{ Icon: DiscountIcon, label: t('detail.actions.discount'), sub: canDiscount ? t('detail.actions.discountSub') : t('detail.actions.discountNotAllowed'),
|
||||
onClick: (hasActiveItems && canDiscount) ? onApplyDiscount : null, color: (hasActiveItems && canDiscount) ? '#a78bfa' : '#6b7280', iconBg: (hasActiveItems && canDiscount) ? 'rgba(167,139,250,0.15)' : 'rgba(107,114,128,0.1)' },
|
||||
{ Icon: TransferIcon, label: 'Μεταφορά Τραπεζιού', sub: 'Μεταφορά σε άλλο τραπέζι', onClick: hasOrder ? onTransfer : null, color: '#6099db', iconBg: 'rgba(96,165,250,0.15)', tableOnly: true, needsMove: true },
|
||||
{ Icon: MergeIcon, label: 'Συγχώνευση Τραπεζιού', sub: 'Συγχώνευση με άλλο τραπέζι', onClick: hasOrder ? onMerge : null, color: '#6099db', iconBg: 'rgba(96,165,250,0.15)', tableOnly: true, needsMove: true },
|
||||
{ Icon: FlagsIcon, label: 'Ενδείξεις Τραπεζιού', sub: 'Επιλογή σημαιών', onClick: onSetFlags, color: '#fac823', iconBg: 'rgba(251,191,36,0.15)', tableOnly: true },
|
||||
{ Icon: WaiterIcon, label: 'Ανάθεση Σερβιτόρου', sub: 'Προσθήκη σερβιτόρου στην παραγγελία', onClick: hasOrder ? onAssignWaiter : null, color: '#39b861', iconBg: 'rgba(34,197,94,0.15)' },
|
||||
{ Icon: PrintIcon, label: 'Εκτύπωση Σύνοψης', sub: 'Εκτύπωση σύνοψης παραγγελίας', onClick: hasOrder ? onPrintSynopsis : null, color: '#cbd5e1', iconBg: 'rgba(148,163,184,0.15)' },
|
||||
{ Icon: CancelIcon, label: 'Ακύρωση Παραγγελίας', sub: !canCancel ? 'Δεν επιτρέπεται η ακύρωση' : cancelNeedsApproval ? 'Με έγκριση διαχειριστή (PIN)' : 'Ακύρωση ολόκληρης παραγγελίας',
|
||||
{ Icon: TransferIcon, label: t('detail.actions.transfer'), sub: t('detail.item.move'), onClick: hasOrder ? onTransfer : null, color: '#6099db', iconBg: 'rgba(96,165,250,0.15)', tableOnly: true, needsMove: true },
|
||||
{ Icon: MergeIcon, label: t('detail.actions.merge'), sub: t('detail.actions.mergeSub'), onClick: hasOrder ? onMerge : null, color: '#6099db', iconBg: 'rgba(96,165,250,0.15)', tableOnly: true, needsMove: true },
|
||||
{ Icon: FlagsIcon, label: t('tables.actions.flags'), sub: t('detail.actions.flagsSub'), onClick: onSetFlags, color: '#fac823', iconBg: 'rgba(251,191,36,0.15)', tableOnly: true },
|
||||
{ Icon: WaiterIcon, label: t('tables.actions.assignWaiter'), sub: t('detail.actions.assignSub'), onClick: hasOrder ? onAssignWaiter : null, color: '#39b861', iconBg: 'rgba(34,197,94,0.15)' },
|
||||
{ Icon: PrintIcon, label: t('tables.actions.printSynopsis'), sub: t('detail.actions.printSub'), onClick: hasOrder ? onPrintSynopsis : null, color: '#cbd5e1', iconBg: 'rgba(148,163,184,0.15)' },
|
||||
{ Icon: CancelIcon, label: t('tables.quick.cancelOrder'), sub: !canCancel ? t('detail.cancelNotAllowed') : cancelNeedsApproval ? t('detail.withApproval') : t('detail.actions.cancelSub'),
|
||||
onClick: (hasOrder && canCancel) ? onCancelOrder : null, color: (hasOrder && canCancel) ? '#ef4444' : '#6b7280', iconBg: (hasOrder && canCancel) ? 'rgba(239,68,68,0.15)' : 'rgba(107,114,128,0.1)' },
|
||||
]
|
||||
// plan 4.3: discounts show only with pricing.discounts.apply, transfer/merge with ordering.orders.open
|
||||
@@ -612,6 +613,7 @@ function ActionsSheet({ order, _tableId, isStandalone, onClose, onTransfer, onMe
|
||||
// ─── Table picker (for transfer / merge / move-items) ─────────────────────────
|
||||
|
||||
function TablePicker({ title, subtitle, tables, _currentTableId, onSelect, onClose, loading }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
return (
|
||||
<div className="modal-overlay modal-overlay--top" onClick={onClose}>
|
||||
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
||||
@@ -620,15 +622,15 @@ function TablePicker({ title, subtitle, tables, _currentTableId, onSelect, onClo
|
||||
{subtitle && <p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 13, marginBottom: 4 }}>{subtitle}</p>}
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 0, maxHeight: '60svh', overflowY: 'auto' }}>
|
||||
{loading && (
|
||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 24 }}>Φόρτωση…</p>
|
||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 24 }}>{t('common.loading')}</p>
|
||||
)}
|
||||
{!loading && tables.length === 0 && (
|
||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 24 }}>Δεν υπάρχουν διαθέσιμα τραπέζια</p>
|
||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 24 }}>{t('detail.noTables')}</p>
|
||||
)}
|
||||
{!loading && tables.map(t => (
|
||||
{!loading && tables.map(tb => (
|
||||
<button
|
||||
key={t.id}
|
||||
onClick={() => onSelect(t)}
|
||||
key={tb.id}
|
||||
onClick={() => onSelect(tb)}
|
||||
style={{
|
||||
width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'space-between',
|
||||
padding: '14px 4px', background: 'none', border: 'none',
|
||||
@@ -637,11 +639,11 @@ function TablePicker({ title, subtitle, tables, _currentTableId, onSelect, onClo
|
||||
>
|
||||
<div>
|
||||
<div style={{ fontSize: 15, fontWeight: 600, color: 'var(--text)' }}>
|
||||
{t.label || `T${t.number}`}
|
||||
{tb.label || `T${tb.number}`}
|
||||
</div>
|
||||
{t.orderStatus && (
|
||||
{tb.orderStatus && (
|
||||
<div style={{ fontSize: 12, color: '#f59e0b', marginTop: 2 }}>
|
||||
{t.orderStatus === 'open' ? 'Ανοιχτό' : t.orderStatus === 'partially_paid' ? 'Μερικώς πληρωμένο' : t.orderStatus}
|
||||
{tb.orderStatus === 'open' ? t('tables.status.open') : tb.orderStatus === 'partially_paid' ? t('tables.status.partlyPaid') : tb.orderStatus}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -649,7 +651,7 @@ function TablePicker({ title, subtitle, tables, _currentTableId, onSelect, onClo
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<button className="btn btn--secondary" style={{ width: '100%', marginTop: 8 }} onClick={onClose}>Άκυρο</button>
|
||||
<button className="btn btn--secondary" style={{ width: '100%', marginTop: 8 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -658,6 +660,7 @@ function TablePicker({ title, subtitle, tables, _currentTableId, onSelect, onClo
|
||||
// ─── Flag picker ──────────────────────────────────────────────────────────────
|
||||
|
||||
function FlagPicker({ _tableId, currentFlagIds, flagDefs, onSave, onClose, loading }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [selected, setSelected] = useState(currentFlagIds || [])
|
||||
|
||||
// Sync selected when currentFlagIds loads
|
||||
@@ -671,13 +674,13 @@ function FlagPicker({ _tableId, currentFlagIds, flagDefs, onSave, onClose, loadi
|
||||
<div className="modal-overlay modal-overlay--top" onClick={onClose}>
|
||||
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title">Ενδείξεις Τραπεζιού</h2>
|
||||
<h2 className="modal-title">{t('tables.actions.flags')}</h2>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 0, marginBottom: 20 }}>
|
||||
{loading && (
|
||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>Φόρτωση…</p>
|
||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>{t('common.loading')}</p>
|
||||
)}
|
||||
{!loading && flagDefs.length === 0 && (
|
||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>Δεν υπάρχουν σημαίες</p>
|
||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>{t('detail.noFlags')}</p>
|
||||
)}
|
||||
{!loading && flagDefs.map(f => {
|
||||
const sel = selected.includes(f.id)
|
||||
@@ -710,8 +713,8 @@ function FlagPicker({ _tableId, currentFlagIds, flagDefs, onSave, onClose, loadi
|
||||
})}
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 12 }}>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>Άκυρο</button>
|
||||
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => onSave(selected)}>Αποθήκευση</button>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => onSave(selected)}>{t('common.save')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -721,6 +724,7 @@ function FlagPicker({ _tableId, currentFlagIds, flagDefs, onSave, onClose, loadi
|
||||
// ─── Assign waiter picker ─────────────────────────────────────────────────────
|
||||
|
||||
function AssignWaiterPicker({ orderId, currentWaiterIds, waiters, onAssigned, onClose, loading }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [saving, setSaving] = useState(false)
|
||||
|
||||
async function assign(waiterId) {
|
||||
@@ -743,13 +747,13 @@ function AssignWaiterPicker({ orderId, currentWaiterIds, waiters, onAssigned, on
|
||||
<div className="modal-overlay modal-overlay--top" onClick={onClose}>
|
||||
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title">Ανάθεση Σερβιτόρου</h2>
|
||||
<h2 className="modal-title">{t('tables.actions.assignWaiter')}</h2>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 0, marginBottom: 16, maxHeight: '60svh', overflowY: 'auto' }}>
|
||||
{loading && (
|
||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>Φόρτωση…</p>
|
||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>{t('common.loading')}</p>
|
||||
)}
|
||||
{!loading && available.length === 0 && (
|
||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>Όλοι οι σερβιτόροι έχουν ήδη ανατεθεί</p>
|
||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>{t('detail.allAssigned')}</p>
|
||||
)}
|
||||
{!loading && available.map(w => (
|
||||
<button
|
||||
@@ -774,7 +778,7 @@ function AssignWaiterPicker({ orderId, currentWaiterIds, waiters, onAssigned, on
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<button className="btn btn--secondary" style={{ width: '100%' }} onClick={onClose}>Άκυρο</button>
|
||||
<button className="btn btn--secondary" style={{ width: '100%' }} onClick={onClose}>{t('common.cancel')}</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -783,6 +787,7 @@ function AssignWaiterPicker({ orderId, currentWaiterIds, waiters, onAssigned, on
|
||||
// ─── Print synopsis picker ────────────────────────────────────────────────────
|
||||
|
||||
function PrintSynopsisPicker({ orderId, onClose }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [printers, setPrinters] = useState([])
|
||||
const [printing, setPrinting] = useState(false)
|
||||
|
||||
@@ -806,8 +811,8 @@ function PrintSynopsisPicker({ orderId, onClose }) {
|
||||
<div className="modal-overlay modal-overlay--top" onClick={onClose}>
|
||||
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title">Εκτύπωση Σύνοψης</h2>
|
||||
<p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 13, marginBottom: 8 }}>Επιλέξτε εκτυπωτή</p>
|
||||
<h2 className="modal-title">{t('tables.actions.printSynopsis')}</h2>
|
||||
<p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 13, marginBottom: 8 }}>{t('detail.pickPrinter')}</p>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 0, marginBottom: 16 }}>
|
||||
{printers.filter(p => p.reachable).map(p => (
|
||||
<button
|
||||
@@ -833,7 +838,7 @@ function PrintSynopsisPicker({ orderId, onClose }) {
|
||||
</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.cancel')}</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -842,25 +847,26 @@ function PrintSynopsisPicker({ orderId, onClose }) {
|
||||
// ─── Pay confirm modal ────────────────────────────────────────────────────────
|
||||
|
||||
function CancelConfirmModal({ itemCount, onConfirm, onClose }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
return (
|
||||
<div className="modal-overlay" onClick={onClose}>
|
||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title">Ακύρωση παραγγελίας;</h2>
|
||||
<h2 className="modal-title">{t('detail.cancel.title')}</h2>
|
||||
<p style={{ color: '#94a3b8', textAlign: 'center', marginBottom: 24, fontSize: 14 }}>
|
||||
{itemCount === null
|
||||
? 'Ολόκληρη η παραγγελία θα ακυρωθεί οριστικά.'
|
||||
: `${itemCount} αντικείμενο${itemCount !== 1 ? 'α' : ''} θα ακυρωθ${itemCount !== 1 ? 'ούν' : 'εί'} οριστικά.`}
|
||||
? t('detail.cancel.whole')
|
||||
: t('detail.cancel.items', { count: itemCount })}
|
||||
</p>
|
||||
<div style={{ display: 'flex', gap: 12 }}>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>Άκυρο</button>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||
<button
|
||||
onClick={onConfirm}
|
||||
style={{
|
||||
flex: 1, height: 48, borderRadius: 12, border: 'none',
|
||||
background: '#dc2626', color: 'white', fontSize: 15, fontWeight: 700, cursor: 'pointer',
|
||||
}}
|
||||
>Ακύρωση ✕</button>
|
||||
>{t('detail.cancel.button')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -868,6 +874,7 @@ function CancelConfirmModal({ itemCount, onConfirm, onClose }) {
|
||||
}
|
||||
|
||||
function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, onConfirm, onClose }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { paymentSafety } = usePaymentSettingsStore()
|
||||
const [method, setMethod] = useState('cash')
|
||||
const [secondConfirmOpen, setSecondConfirmOpen] = useState(false)
|
||||
@@ -878,10 +885,10 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
||||
.filter(i => payIds.includes(i.id))
|
||||
.reduce((s, i) => s + ((i.unit_price ?? 0) + (i.price_adjustment ?? 0)) * i.quantity, 0)
|
||||
|
||||
const title = andClose ? 'Επιβεβαίωση Πληρωμής και Κλείσιμο' : 'Επιβεβαίωση πληρωμής'
|
||||
const title = andClose ? t('detail.pay.titleClose') : t('detail.pay.title')
|
||||
const subtitle = andClose
|
||||
? 'Όλα τα αντικείμενα — το τραπέζι θα κλείσει αμέσως μετά'
|
||||
: payAll ? 'Όλα τα αντικείμενα' : `${payIds.length} αντικείμενο${payIds.length !== 1 ? 'α' : ''}`
|
||||
? t('detail.pay.allAndClose')
|
||||
: payAll ? t('detail.pay.all') : t('detail.pay.items', { count: payIds.length })
|
||||
|
||||
function handleConfirmClick() {
|
||||
if (paymentSafety === 'second_confirm') {
|
||||
@@ -929,7 +936,7 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
||||
cursor: 'pointer', transition: 'all 0.12s',
|
||||
}}
|
||||
>
|
||||
{m === 'cash' ? '💵 Μετρητά' : '💳 Κάρτα'}
|
||||
{m === 'cash' ? `💵 ${t('detail.pay.cash')}` : `💳 ${t('detail.pay.card')}`}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
@@ -937,7 +944,7 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
||||
|
||||
<div style={{ display: 'flex', gap: 12 }}>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>
|
||||
Άκυρο
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
{paymentSafety === 'long_press' ? (
|
||||
<button
|
||||
@@ -951,7 +958,7 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
||||
onPointerLeave={cancelLongPress}
|
||||
>
|
||||
<span style={{ position: 'relative', zIndex: 1 }}>
|
||||
{longPressActive ? 'Κρατήστε…' : 'Πληρώθηκαν ✓'}
|
||||
{longPressActive ? t('detail.pay.hold') : `${t('detail.pay.paid')} ✓`}
|
||||
</span>
|
||||
{longPressActive && (
|
||||
<span style={{
|
||||
@@ -963,7 +970,7 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
||||
</button>
|
||||
) : (
|
||||
<button className="btn btn--success" style={{ flex: 1 }} onClick={handleConfirmClick}>
|
||||
Πληρώθηκαν ✓
|
||||
{t('detail.pay.paid')} ✓
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -977,17 +984,17 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
||||
}} onClick={e => e.stopPropagation()}>
|
||||
<div style={{ background: 'var(--bg2,#1e293b)', borderRadius: 14, padding: 24, width: '100%' }}>
|
||||
<p style={{ color: '#f1f5f9', fontWeight: 700, fontSize: 15, textAlign: 'center', marginBottom: 8 }}>
|
||||
Είσαι σίγουρος;
|
||||
{t('common.sure')}
|
||||
</p>
|
||||
<p style={{ color: '#94a3b8', fontSize: 13, textAlign: 'center', marginBottom: 20 }}>
|
||||
{fmtPrice(payTotal)} — {method === 'card' ? 'Κάρτα' : 'Μετρητά'}
|
||||
{fmtPrice(payTotal)} — {method === 'card' ? t('detail.pay.card') : t('detail.pay.cash')}
|
||||
</p>
|
||||
<div style={{ display: 'flex', gap: 10 }}>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setSecondConfirmOpen(false)}>
|
||||
Πίσω
|
||||
{t('common.back')}
|
||||
</button>
|
||||
<button className="btn btn--success" style={{ flex: 1 }} onClick={() => onConfirm(method)}>
|
||||
Ναι, Πληρώθηκαν ✓
|
||||
{t('detail.pay.yesPaid')} ✓
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1001,15 +1008,16 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
||||
// ─── Customer count modal ─────────────────────────────────────────────────────
|
||||
|
||||
function CustomerCountModal({ value, onChange, onClose }) {
|
||||
const { t } = useTranslation('waiter')
|
||||
const [count, setCount] = useState(value ?? 0)
|
||||
const QUICK = [1, 2, 3, 4, 5, 6]
|
||||
return (
|
||||
<div className="modal-overlay" onClick={onClose}>
|
||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title">Αριθμός Πελατών</h2>
|
||||
<h2 className="modal-title">{t('detail.guests.title')}</h2>
|
||||
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 20px' }}>
|
||||
Πόσα άτομα κάθονται στο τραπέζι;
|
||||
{t('detail.guests.question')}
|
||||
</p>
|
||||
<div style={{ display: 'flex', gap: 8, justifyContent: 'center', marginBottom: 20 }}>
|
||||
{QUICK.map(n => (
|
||||
@@ -1027,9 +1035,9 @@ function CustomerCountModal({ value, onChange, onClose }) {
|
||||
<button className="qty-btn" onClick={() => setCount(c => c + 1)}>+</button>
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 10 }}>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>Άκυρο</button>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => { onChange(count || null); onClose() }}>
|
||||
Εφαρμογή
|
||||
{t('common.apply')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1040,6 +1048,7 @@ function CustomerCountModal({ value, onChange, onClose }) {
|
||||
// ─── Main page ────────────────────────────────────────────────────────────────
|
||||
|
||||
export default function TableDetailPage() {
|
||||
const { t } = useTranslation('waiter')
|
||||
const { tableId, orderId: standaloneOrderId } = useParams()
|
||||
const isStandalone = !!standaloneOrderId
|
||||
const [searchParams, setSearchParams] = useSearchParams()
|
||||
@@ -1191,7 +1200,7 @@ export default function TableDetailPage() {
|
||||
if (waitersRes.status === 200) setAllWaiters(waitersRes.data)
|
||||
}
|
||||
} catch {
|
||||
if (!table) setError('Σφάλμα φόρτωσης')
|
||||
if (!table) setError(t('detail.err.load'))
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
@@ -1324,7 +1333,7 @@ export default function TableDetailPage() {
|
||||
await client.post('/api/orders/', { table_id: Number(tableId) })
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(apiError(err, 'Σφάλμα ανοίγματος'))
|
||||
setError(apiError(err, t('detail.err.open')))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1346,7 +1355,7 @@ export default function TableDetailPage() {
|
||||
const updatedOrder = await db.pos_orders.get(order.id)
|
||||
if (!updatedOrder || updatedOrder.status === 'paid') navigate('/tables', { replace: true })
|
||||
} catch {
|
||||
setError('Σφάλμα αποθήκευσης offline πληρωμής')
|
||||
setError(t('detail.err.offlinePay'))
|
||||
} finally {
|
||||
setPaying(false)
|
||||
}
|
||||
@@ -1367,7 +1376,7 @@ export default function TableDetailPage() {
|
||||
}
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(apiError(err, 'Σφάλμα πληρωμής'))
|
||||
setError(apiError(err, t('detail.err.pay')))
|
||||
} finally {
|
||||
setPaying(false)
|
||||
}
|
||||
@@ -1380,7 +1389,7 @@ export default function TableDetailPage() {
|
||||
setPaidSelectedIds([])
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(apiError(err, 'Σφάλμα αναίρεσης πληρωμής'))
|
||||
setError(apiError(err, t('detail.err.revert')))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1390,7 +1399,7 @@ export default function TableDetailPage() {
|
||||
setConfirmClose(false)
|
||||
navigate('/tables')
|
||||
} catch (err) {
|
||||
setError(apiError(err, 'Σφάλμα κλεισίματος'))
|
||||
setError(apiError(err, t('detail.err.close')))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1406,7 +1415,7 @@ export default function TableDetailPage() {
|
||||
setItemActionTarget(null)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(apiError(err, 'Σφάλμα ακύρωσης'))
|
||||
setError(apiError(err, t('detail.err.cancel')))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1416,7 +1425,7 @@ export default function TableDetailPage() {
|
||||
await client.delete(`/api/orders/${order.id}?print_cancellation=true`)
|
||||
navigate('/tables')
|
||||
} catch (err) {
|
||||
setError(apiError(err, 'Σφάλμα ακύρωσης παραγγελίας'))
|
||||
setError(apiError(err, t('detail.err.cancelOrder')))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1435,7 +1444,7 @@ export default function TableDetailPage() {
|
||||
setPaidSelectedIds([])
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(apiError(err, 'Σφάλμα σήμανσης'))
|
||||
setError(apiError(err, t('detail.err.mark')))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1447,7 +1456,7 @@ export default function TableDetailPage() {
|
||||
await client.post(`/api/kds/orders/${order.id}/items/mark-all-served`)
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(apiError(err, 'Σφάλμα σήμανσης'))
|
||||
setError(apiError(err, t('detail.err.mark')))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1484,7 +1493,7 @@ export default function TableDetailPage() {
|
||||
setSelectedIds([])
|
||||
await loadFromDB()
|
||||
} catch (err) {
|
||||
setError(err.message || 'Σφάλμα διαχωρισμού offline')
|
||||
setError(err.message || t('detail.err.splitOffline'))
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -1494,7 +1503,7 @@ export default function TableDetailPage() {
|
||||
setSelectedIds([])
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(apiError(err, 'Σφάλμα διαχωρισμού'))
|
||||
setError(apiError(err, t('detail.err.split')))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1507,7 +1516,7 @@ export default function TableDetailPage() {
|
||||
await client.post(`/api/orders/${order.id}/transfer`, { target_table_id: targetTable.id })
|
||||
navigate('/tables')
|
||||
} catch (err) {
|
||||
setError(apiError(err, 'Σφάλμα μεταφοράς'))
|
||||
setError(apiError(err, t('detail.err.transfer')))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1515,14 +1524,14 @@ export default function TableDetailPage() {
|
||||
async function doMerge(targetTable) {
|
||||
if (!order) return
|
||||
const targetOrder = allOrders.find(o => o.table_id === targetTable.id)
|
||||
if (!targetOrder) { setError('Δεν βρέθηκε παραγγελία στο τραπέζι'); return }
|
||||
if (!targetOrder) { setError(t('detail.err.noTargetOrder')); return }
|
||||
setPendingTable(null)
|
||||
setActionsMode(null)
|
||||
try {
|
||||
await client.post(`/api/orders/${order.id}/merge`, { target_order_id: targetOrder.id })
|
||||
navigate('/tables')
|
||||
} catch (err) {
|
||||
setError(apiError(err, 'Σφάλμα συγχώνευσης'))
|
||||
setError(apiError(err, t('detail.err.merge')))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1530,7 +1539,7 @@ export default function TableDetailPage() {
|
||||
async function doMoveItems(targetTable) {
|
||||
if (!order || selectedIds.length === 0) return
|
||||
const targetOrder = allOrders.find(o => o.table_id === targetTable.id)
|
||||
if (!targetOrder) { setError('Δεν βρέθηκε παραγγελία στο τραπέζι'); return }
|
||||
if (!targetOrder) { setError(t('detail.err.noTargetOrder')); return }
|
||||
setPendingTable(null)
|
||||
setActionsMode(null)
|
||||
try {
|
||||
@@ -1541,7 +1550,7 @@ export default function TableDetailPage() {
|
||||
setSelectedIds([])
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(apiError(err, 'Σφάλμα μεταφοράς αντικειμένων'))
|
||||
setError(apiError(err, t('detail.err.moveItems')))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1552,7 +1561,7 @@ export default function TableDetailPage() {
|
||||
setCurrentFlagIds(flagIds)
|
||||
setActionsMode(null)
|
||||
} catch {
|
||||
setError('Σφάλμα αποθήκευσης σημαιών')
|
||||
setError(t('detail.err.flags'))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1585,7 +1594,7 @@ export default function TableDetailPage() {
|
||||
? (order?.order_type === 'delivery' ? `Delivery #${standaloneOrderId}` : `Takeaway #${standaloneOrderId}`)
|
||||
: (table ? (table.label || `T${table.number}`) : '—')
|
||||
|
||||
if (loading) return <div className="page page--centered"><p style={{ color: '#94a3b8' }}>Φόρτωση…</p></div>
|
||||
if (loading) return <div className="page page--centered"><p style={{ color: '#94a3b8' }}>{t('common.loading')}</p></div>
|
||||
|
||||
return (
|
||||
<div className="page">
|
||||
@@ -1607,7 +1616,7 @@ export default function TableDetailPage() {
|
||||
color: customerCount ? '#f59e0b' : 'var(--muted)',
|
||||
cursor: 'pointer', fontSize: 13, fontWeight: 700,
|
||||
}}
|
||||
title="Αριθμός πελατών"
|
||||
title={t('detail.guests.button')}
|
||||
>
|
||||
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
||||
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/>
|
||||
@@ -1689,9 +1698,9 @@ export default function TableDetailPage() {
|
||||
|
||||
{!order && !isStandalone && (
|
||||
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
|
||||
<p style={{ color: '#94a3b8', marginBottom: 24 }}>Δεν υπάρχει ενεργή παραγγελία</p>
|
||||
<p style={{ color: '#94a3b8', marginBottom: 24 }}>{t('tables.quick.noOrder')}</p>
|
||||
<button className="btn btn--primary btn--lg" onClick={openOrder}>
|
||||
Άνοιγμα Παραγγελίας
|
||||
{t('detail.openOrder')}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -1743,7 +1752,7 @@ export default function TableDetailPage() {
|
||||
transition: 'background 0.15s',
|
||||
}}
|
||||
>
|
||||
Εκκρεμή {activeItems.length > 0 && (
|
||||
{t('detail.tabs.unpaid')} {activeItems.length > 0 && (
|
||||
<span style={{
|
||||
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
||||
background: activeTab === 'active' ? 'rgba(0,0,0,0.2)' : 'var(--bg3)',
|
||||
@@ -1762,7 +1771,7 @@ export default function TableDetailPage() {
|
||||
transition: 'background 0.15s',
|
||||
}}
|
||||
>
|
||||
Πληρωμένα {paidItems.length > 0 && (
|
||||
{t('detail.tabs.paid')} {paidItems.length > 0 && (
|
||||
<span style={{
|
||||
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
||||
background: activeTab === 'paid' ? 'rgba(0,0,0,0.2)' : 'var(--bg3)',
|
||||
@@ -1887,7 +1896,7 @@ export default function TableDetailPage() {
|
||||
<div style={{ padding: '8px 0' }}>
|
||||
{paidItems.length === 0 ? (
|
||||
<p style={{ color: '#64748b', textAlign: 'center', padding: '24px 0', fontSize: 14 }}>
|
||||
Δεν υπάρχουν πληρωμένα αντικείμενα
|
||||
{t('detail.noPaid')}
|
||||
</p>
|
||||
) : (
|
||||
<>
|
||||
@@ -1973,7 +1982,7 @@ export default function TableDetailPage() {
|
||||
cursor: 'pointer',
|
||||
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
||||
}}
|
||||
>ΑΝΑΙΡΕΣΗ</button>
|
||||
>{t('detail.revert.button')}</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -2029,7 +2038,7 @@ export default function TableDetailPage() {
|
||||
}}
|
||||
disabled={isOffline}
|
||||
style={{ borderRadius: 999, flex: 1, opacity: isOffline ? 0.4 : 1 }}
|
||||
title={isOffline ? 'Μη διαθέσιμο offline' : undefined}
|
||||
title={isOffline ? t('detail.notOffline') : undefined}
|
||||
>
|
||||
<span style={{ marginRight: 6 }}>✕</span>CLOSE
|
||||
</button>
|
||||
@@ -2042,12 +2051,12 @@ export default function TableDetailPage() {
|
||||
<div className="modal-overlay" onClick={() => setShowMergeModal(false)} style={{ alignItems: 'flex-end' }}>
|
||||
<div className="modal-sheet" onClick={e => e.stopPropagation()} style={{ borderRadius: '20px 20px 0 0', paddingBottom: 40, gap: 0 }}>
|
||||
<div className="modal-handle" />
|
||||
<p style={{ fontSize: 17, fontWeight: 700, color: 'var(--text)', marginBottom: 20, paddingTop: 4 }}>Εμφάνιση Αντικειμένων</p>
|
||||
<p style={{ fontSize: 17, fontWeight: 700, color: 'var(--text)', marginBottom: 20, paddingTop: 4 }}>{t('detail.view.title')}</p>
|
||||
|
||||
{[
|
||||
{ mode: MERGE_OFF, label: 'ΑΡΧΙΚΗ', desc: 'Ακριβώς όπως παραγγέλθηκαν' },
|
||||
{ mode: MERGE_IDENTICAL, label: 'ΣΥΓΧΩΝΕΥΣΗ ΠΑΡΟΜΟΙΩΝ', desc: 'Ίδιο προϊόν, ίδιες επιλογές, ίδια τιμή' },
|
||||
{ mode: MERGE_SAME_ITEM, label: 'ΣΥΓΧΩΝΕΥΣΗ ΟΛΩΝ', desc: 'Ίδιο προϊόν με ίδια τελική τιμή' },
|
||||
{ mode: MERGE_OFF, label: t('detail.view.off'), desc: t('detail.view.offDesc') },
|
||||
{ mode: MERGE_IDENTICAL, label: t('detail.view.identical'), desc: t('detail.view.identicalDesc') },
|
||||
{ mode: MERGE_SAME_ITEM, label: t('detail.view.sameItem'), desc: t('detail.view.sameItemDesc') },
|
||||
].map(({ mode, label, desc }) => {
|
||||
const active = mergeMode === mode
|
||||
return (
|
||||
@@ -2082,7 +2091,7 @@ export default function TableDetailPage() {
|
||||
})}
|
||||
|
||||
<button className="btn btn--secondary" style={{ width: '100%', marginTop: 20 }} onClick={() => setShowMergeModal(false)}>
|
||||
Άκυρο
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2223,22 +2232,22 @@ export default function TableDetailPage() {
|
||||
<div className="modal-overlay" onClick={() => setRevertConfirm(null)}>
|
||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title">Αναίρεση Πληρωμής;</h2>
|
||||
<h2 className="modal-title">{t('detail.revert.title')}</h2>
|
||||
<p style={{ color: '#94a3b8', textAlign: 'center', marginBottom: 24 }}>
|
||||
{revertConfirm.itemIds.length === 1
|
||||
? '1 αντικείμενο θα επιστραφεί σε μη πληρωμένο.'
|
||||
: `${revertConfirm.itemIds.length} αντικείμενα θα επιστραφούν σε μη πληρωμένα.`}
|
||||
? t('detail.revert.items', { count: 1 })
|
||||
: t('detail.revert.items', { count: revertConfirm.itemIds.length })}
|
||||
</p>
|
||||
<div style={{ display: 'flex', gap: 12 }}>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setRevertConfirm(null)}>
|
||||
Άκυρο
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button
|
||||
className="btn btn--danger"
|
||||
style={{ flex: 1 }}
|
||||
onClick={() => revertPayment(revertConfirm.itemIds)}
|
||||
>
|
||||
Αναίρεση ✓
|
||||
{t('detail.revert.confirm')} ✓
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2250,13 +2259,13 @@ export default function TableDetailPage() {
|
||||
<div className="modal-overlay" onClick={() => setConfirmClose(false)}>
|
||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title">Κλείσιμο παραγγελίας;</h2>
|
||||
<h2 className="modal-title">{t('detail.close.title')}</h2>
|
||||
<p style={{ color: '#94a3b8', textAlign: 'center', marginBottom: 24 }}>
|
||||
Αυτή η ενέργεια δεν αναιρείται.
|
||||
{t('detail.close.body')}
|
||||
</p>
|
||||
<div style={{ display: 'flex', gap: 12 }}>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setConfirmClose(false)}>
|
||||
Άκυρο
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button className="btn btn--danger" style={{ flex: 1 }} onClick={closeOrder}>
|
||||
CLOSE
|
||||
@@ -2300,8 +2309,8 @@ export default function TableDetailPage() {
|
||||
{/* Transfer picker */}
|
||||
{actionsMode === 'transfer' && !pendingTable && (
|
||||
<TablePicker
|
||||
title="Μεταφορά Τραπεζιού"
|
||||
subtitle="Επιλέξτε κενό τραπέζι"
|
||||
title={t('detail.actions.transfer')}
|
||||
subtitle={t('detail.move.pickFree')}
|
||||
tables={transferTargets}
|
||||
currentTableId={Number(tableId)}
|
||||
onSelect={t => setPendingTable({ table: t, mode: 'transfer' })}
|
||||
@@ -2313,8 +2322,8 @@ export default function TableDetailPage() {
|
||||
{/* Merge picker */}
|
||||
{actionsMode === 'merge' && !pendingTable && (
|
||||
<TablePicker
|
||||
title="Συγχώνευση Τραπεζιού"
|
||||
subtitle="Τα αντικείμενα μεταφέρονται στο επιλεγμένο τραπέζι"
|
||||
title={t('detail.actions.merge')}
|
||||
subtitle={t('detail.move.mergeSub')}
|
||||
tables={mergeTargets}
|
||||
currentTableId={Number(tableId)}
|
||||
onSelect={t => setPendingTable({ table: t, mode: 'merge' })}
|
||||
@@ -2326,8 +2335,8 @@ export default function TableDetailPage() {
|
||||
{/* Move items picker */}
|
||||
{actionsMode === 'move_items' && !pendingTable && (
|
||||
<TablePicker
|
||||
title="Μεταφορά Αντικειμένων"
|
||||
subtitle={`Μεταφορά ${selectedIds.length} αντικειμένου${selectedIds.length !== 1 ? 'ων' : ''} σε τραπέζι`}
|
||||
title={t('detail.move.itemsTitle')}
|
||||
subtitle={t('detail.move.subtitle', { count: selectedIds.length })}
|
||||
tables={moveItemsTargets}
|
||||
currentTableId={Number(tableId)}
|
||||
onSelect={t => setPendingTable({ table: t, mode: 'move_items' })}
|
||||
@@ -2342,21 +2351,21 @@ export default function TableDetailPage() {
|
||||
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
||||
<div className="modal-handle" />
|
||||
<h2 className="modal-title">
|
||||
{pendingTable.mode === 'transfer' ? 'Επιβεβαίωση Μεταφοράς'
|
||||
: pendingTable.mode === 'merge' ? 'Επιβεβαίωση Συγχώνευσης'
|
||||
: 'Επιβεβαίωση Μεταφοράς Αντικειμένων'}
|
||||
{pendingTable.mode === 'transfer' ? t('detail.move.confirmTransfer')
|
||||
: pendingTable.mode === 'merge' ? t('detail.move.confirmMerge')
|
||||
: t('detail.move.confirmItems')}
|
||||
</h2>
|
||||
<p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 14, marginBottom: 4 }}>
|
||||
{pendingTable.mode === 'transfer' ? 'Μεταφορά παραγγελίας στο τραπέζι'
|
||||
: pendingTable.mode === 'merge' ? 'Συγχώνευση παραγγελίας με το τραπέζι'
|
||||
: `Μεταφορά ${selectedIds.length} αντικειμένου${selectedIds.length !== 1 ? 'ων' : ''} στο τραπέζι`}
|
||||
{pendingTable.mode === 'transfer' ? t('detail.move.transferTo')
|
||||
: pendingTable.mode === 'merge' ? t('detail.move.mergeWith')
|
||||
: t('detail.move.itemsTo', { count: selectedIds.length })}
|
||||
</p>
|
||||
<p style={{ textAlign: 'center', fontSize: 22, fontWeight: 700, color: 'var(--accent)', marginBottom: 20 }}>
|
||||
{pendingTable.table.label || `T${pendingTable.table.number}`}
|
||||
</p>
|
||||
<div style={{ display: 'flex', gap: 12 }}>
|
||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setPendingTable(null)}>
|
||||
Άκυρο
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button
|
||||
className="btn btn--primary"
|
||||
@@ -2367,9 +2376,7 @@ export default function TableDetailPage() {
|
||||
else doMoveItems(pendingTable.table)
|
||||
}}
|
||||
>
|
||||
{pendingTable.mode === 'transfer' ? 'Μεταφορά ✓'
|
||||
: pendingTable.mode === 'merge' ? 'Συγχώνευση ✓'
|
||||
: 'Μεταφορά ✓'}
|
||||
{pendingTable.mode === 'merge' ? t('tables.actions.merge') : t('tables.actions.transfer')} ✓
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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')}
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import db from '../db/posdb'
|
||||
import client from '../api/client'
|
||||
import { apiError } from '../api/errors'
|
||||
import { tw } from '../i18n'
|
||||
|
||||
// Orders taken offline (plan step 4.4): the cart lines are queued by id (`_wire`, built when
|
||||
// the order was taken: @xenia/api wireLine) and priced by the server when they reach it; the
|
||||
@@ -248,7 +249,7 @@ async function _flushLegacyOfflineOrders() {
|
||||
}
|
||||
// True legacy record (before v0.6.4): it can't be priced by the server (no lines by id)
|
||||
if (!entry.items.some(i => i._wire)) {
|
||||
await keepRefused(entry.items.map(i => refusedEntry(i, entry.tableId, entry.uuid, OLD_FORMAT)))
|
||||
await keepRefused(entry.items.map(i => refusedEntry(i, entry.tableId, entry.uuid, OLD_FORMAT())))
|
||||
await db.offline_orders.update(entry.localId, { synced: 1 })
|
||||
await db.pos_orders.delete(`offline_${entry.uuid}`)
|
||||
continue
|
||||
@@ -296,7 +297,7 @@ async function _flushCreateOrder(op, idMap) {
|
||||
const synthetic = await db.pos_orders.get(op.localOrderId)
|
||||
// queued before 4.4: nothing the server can price → all refused, no empty order opened
|
||||
if (!op.items.some(i => i._wire)) {
|
||||
await keepRefused(op.items.map(i => refusedEntry(i, op.tableId, op.uuid, OLD_FORMAT)))
|
||||
await keepRefused(op.items.map(i => refusedEntry(i, op.tableId, op.uuid, OLD_FORMAT())))
|
||||
for (const it of synthetic?.items ?? []) idMap[it.id] = REFUSED
|
||||
await db.offline_orders.where('uuid').equals(op.uuid).modify({ synced: 1 })
|
||||
await db.offline_ops.update(op.localId, { synced: 1 })
|
||||
@@ -412,7 +413,7 @@ async function _flushPay(op, idMap) {
|
||||
|
||||
const REFUSED_KEY = 'refused_lines'
|
||||
const REFUSED = 'refused'
|
||||
const OLD_FORMAT = 'Παλιά μορφή παραγγελίας: προσθέστε το ξανά'
|
||||
const OLD_FORMAT = () => tw('refused.oldFormat')
|
||||
|
||||
/** Lines the server refused when an offline order was sent: [{ at, tableId, product, quantity, reason }]. */
|
||||
export async function refusedLines() {
|
||||
@@ -449,7 +450,7 @@ async function postLines(pending, refused, ctx, post) {
|
||||
const n = refusedLine(err, pending.length)
|
||||
if (n == null) throw err
|
||||
const [{ item }] = pending.splice(n - 1, 1)
|
||||
refused.push(refusedEntry(item, ctx.tableId, ctx.uuid, apiError(err, 'Ο server δεν το δέχτηκε')))
|
||||
refused.push(refusedEntry(item, ctx.tableId, ctx.uuid, apiError(err, tw('refused.notAccepted'))))
|
||||
}
|
||||
}
|
||||
return pending
|
||||
@@ -463,7 +464,7 @@ async function postLines(pending, refused, ctx, post) {
|
||||
* refusals are found again next time). Returns { orderId (null: all refused), sent: [indexes] }.
|
||||
*/
|
||||
async function sendLines(items, ctx, getOrderId) {
|
||||
const refused = items.filter(item => !item._wire).map(item => refusedEntry(item, ctx.tableId, ctx.uuid, OLD_FORMAT))
|
||||
const refused = items.filter(item => !item._wire).map(item => refusedEntry(item, ctx.tableId, ctx.uuid, OLD_FORMAT()))
|
||||
const opts = { noOverride: true }
|
||||
let pending = items.map((item, index) => ({ item, index })).filter(({ item }) => item._wire)
|
||||
pending = await postLines(pending, refused, ctx, lines => client.post('/api/orders/quote', { lines }, opts))
|
||||
|
||||
@@ -7,7 +7,7 @@ import { deliveryMode } from '../config/server'
|
||||
* It opens by itself once, the first time an Android phone opens the waiter app
|
||||
* in a browser, and only if this venue's server actually serves the APK. Closing it or tapping
|
||||
* download marks it as seen for good; after that it's reachable from the side
|
||||
* drawer ("Εγκατάσταση εφαρμογής", above Settings).
|
||||
* drawer ("Install the app", above Settings).
|
||||
*/
|
||||
|
||||
export const APK_URL = import.meta.env.VITE_APP_DOWNLOAD_URL || '/downloads/xenia-waiter.apk'
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
// Plan step 4.5: the waiter app's texts live in @xenia/i18n (namespace `waiter`, English first,
|
||||
// Greek as a translation). No Greek letter may appear in the app's source: a new text is a key
|
||||
// in packages/i18n/locales/{en,el}/waiter.json. (A Greek word the code must recognise, e.g. in
|
||||
// a server message, is written with \u escapes.)
|
||||
import { test } from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { readdirSync, readFileSync, statSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const SRC = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'src')
|
||||
const GREEK = /[Ͱ-Ͽἀ-]/
|
||||
|
||||
function walk(dir, out = []) {
|
||||
for (const name of readdirSync(dir)) {
|
||||
const p = path.join(dir, name)
|
||||
if (statSync(p).isDirectory()) walk(p, out)
|
||||
else if (/\.(jsx?|mjs|css|html)$/.test(name)) out.push(p)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
test('no Greek text in the waiter app source (texts are i18n keys)', () => {
|
||||
const hits = []
|
||||
for (const file of walk(SRC)) {
|
||||
readFileSync(file, 'utf8').split('\n').forEach((line, i) => {
|
||||
if (GREEK.test(line)) hits.push(`${path.relative(SRC, file)}:${i + 1}: ${line.trim().slice(0, 80)}`)
|
||||
})
|
||||
}
|
||||
assert.deepEqual(hits, [], `Greek text found — make it a key in the waiter namespace:\n${hits.join('\n')}`)
|
||||
})
|
||||
Reference in New Issue
Block a user