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

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 03:50:33 +02:00
co-authored by Claude Opus 5.5
parent 8e0a786bbc
commit 37155c0457
20 changed files with 1229 additions and 375 deletions
+390
View File
@@ -0,0 +1,390 @@
{
"common": {
"loading": "Φόρτωση…",
"refresh": "Ανανέωση",
"signOut": "Αποσύνδεση",
"close": "Κλείσιμο",
"minutesShort": "{{m}}λ",
"hoursShort": "{{h}}ω",
"hoursMinutesShort": "{{h}}ω {{m}}λ",
"change": "Αλλαγή",
"retry": "Επανάληψη",
"total": "Σύνολο",
"clear": "Καθαρισμός",
"ok": "Εντάξει",
"cancel": "Ακύρωση",
"confirm": "Επιβεβαίωση",
"back": "Πίσω",
"save": "Αποθήκευση"
},
"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": "Προτιμήσεις"
}
},
"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 από τον διαχειριστή."
}
}
+390
View File
@@ -0,0 +1,390 @@
{
"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"
},
"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"
}
},
"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."
}
}
+6 -4
View File
@@ -3,23 +3,25 @@
// Namespaces: common (shared words, component labels), errors (backend error codes, // 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 // 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), // 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 elCommon from '../locales/el/common.json'
import elDev from '../locales/el/dev.json' import elDev from '../locales/el/dev.json'
import elErrors from '../locales/el/errors.json' import elErrors from '../locales/el/errors.json'
import elManager from '../locales/el/manager.json' import elManager from '../locales/el/manager.json'
import elModules from '../locales/el/modules.json' import elModules from '../locales/el/modules.json'
import elTerminal from '../locales/el/terminal.json' import elTerminal from '../locales/el/terminal.json'
import elWaiter from '../locales/el/waiter.json'
import enCommon from '../locales/en/common.json' import enCommon from '../locales/en/common.json'
import enDev from '../locales/en/dev.json' import enDev from '../locales/en/dev.json'
import enErrors from '../locales/en/errors.json' import enErrors from '../locales/en/errors.json'
import enManager from '../locales/en/manager.json' import enManager from '../locales/en/manager.json'
import enModules from '../locales/en/modules.json' import enModules from '../locales/en/modules.json'
import enTerminal from '../locales/en/terminal.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 = { export const resources = {
en: { common: enCommon, errors: enErrors, manager: enManager, modules: enModules, terminal: enTerminal, dev: enDev }, 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, dev: elDev }, el: { common: elCommon, errors: elErrors, manager: elManager, modules: elModules, terminal: elTerminal, waiter: elWaiter, dev: elDev },
} }
+20 -15
View File
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'
import { BrowserRouter, Routes, Route, Navigate, Outlet, useNavigate } from 'react-router-dom' import { BrowserRouter, Routes, Route, Navigate, Outlet, useNavigate } from 'react-router-dom'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { AccessProvider, useAccess, useCan, useModule } from '@xenia/access' import { AccessProvider, useAccess, useCan, useModule } from '@xenia/access'
import { useTranslation } from '@xenia/i18n'
import { i18n } from './i18n' import { i18n } from './i18n'
import useAuthStore from './store/authStore' import useAuthStore from './store/authStore'
import useShiftStore from './store/shiftStore' import useShiftStore from './store/shiftStore'
@@ -40,6 +41,7 @@ import { deliveryMode, getActiveVenue } from './config/server'
// ─── Utility ───────────────────────────────────────────────────────────────── // ─── Utility ─────────────────────────────────────────────────────────────────
function Spinner() { function Spinner() {
const { t } = useTranslation('waiter')
return ( return (
<div className="page page--centered" style={{ gap: 12 }}> <div className="page page--centered" style={{ gap: 12 }}>
<div style={{ <div style={{
@@ -49,7 +51,7 @@ function Spinner() {
borderRadius: '50%', borderRadius: '50%',
animation: 'gate-spin 0.7s linear infinite', 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> </div>
) )
} }
@@ -84,30 +86,33 @@ function GateBtn({ onClick, disabled, variant = 'primary', children }) {
} }
function ClosedScreen({ onRefresh, onLogout }) { function ClosedScreen({ onRefresh, onLogout }) {
const { t } = useTranslation('waiter')
return ( return (
<GateCard emoji="🔒" title="Εστιατόριο κλειστό" <GateCard emoji="🔒" title={t('gate.closedTitle')}
subtitle={'Δεν υπάρχει ενεργή ημέρα λειτουργίας.\nΖητήστε από τον διαχειριστή να ανοίξει την ημέρα.'}> subtitle={t('gate.closedBody')}>
<div style={{ display: 'flex', gap: 12 }}> <div style={{ display: 'flex', gap: 12 }}>
<GateBtn variant="secondary" onClick={onRefresh}>Ανανέωση</GateBtn> <GateBtn variant="secondary" onClick={onRefresh}>{t('common.refresh')}</GateBtn>
<GateBtn variant="danger" onClick={onLogout}>Αποσύνδεση</GateBtn> <GateBtn variant="danger" onClick={onLogout}>{t('common.signOut')}</GateBtn>
</div> </div>
</GateCard> </GateCard>
) )
} }
function WaitingManagerScreen({ onRefresh, onLogout }) { function WaitingManagerScreen({ onRefresh, onLogout }) {
const { t } = useTranslation('waiter')
return ( return (
<GateCard emoji="⏳" title="Αναμονή για έναρξη βάρδιας" <GateCard emoji="⏳" title={t('gate.waitingTitle')}
subtitle="Ζητήστε από τον διαχειριστή να ξεκινήσει τη βάρδια σας."> subtitle={t('gate.waitingBody')}>
<div style={{ display: 'flex', gap: 12 }}> <div style={{ display: 'flex', gap: 12 }}>
<GateBtn variant="secondary" onClick={onRefresh}>Ανανέωση</GateBtn> <GateBtn variant="secondary" onClick={onRefresh}>{t('common.refresh')}</GateBtn>
<GateBtn variant="danger" onClick={onLogout}>Αποσύνδεση</GateBtn> <GateBtn variant="danger" onClick={onLogout}>{t('common.signOut')}</GateBtn>
</div> </div>
</GateCard> </GateCard>
) )
} }
function StartShiftScreen({ username, onStart, onLogout }) { function StartShiftScreen({ username, onStart, onLogout }) {
const { t } = useTranslation('waiter')
const [startingCash, setStartingCash] = useState('') const [startingCash, setStartingCash] = useState('')
const [starting, setStarting] = useState(false) const [starting, setStarting] = useState(false)
const [error, setError] = useState(null) const [error, setError] = useState(null)
@@ -118,14 +123,14 @@ function StartShiftScreen({ username, onStart, onLogout }) {
try { try {
await onStart(startingCash ? parseFloat(startingCash) : null) await onStart(startingCash ? parseFloat(startingCash) : null)
} catch (e) { } catch (e) {
setError(apiError(e, 'Σφάλμα εκκίνησης βάρδιας')) setError(apiError(e, t('gate.startFailed')))
setStarting(false) setStarting(false)
} }
} }
return ( return (
<GateCard emoji="👋" title={`Καλώς ήρθες, ${username}!`} <GateCard emoji="👋" title={t('gate.welcome', { name: username })}
subtitle="Θέλεις να ξεκινήσεις τη βάρδια σου;"> subtitle={t('gate.startQuestion')}>
<div style={{ <div style={{
width: '100%', maxWidth: 320, width: '100%', maxWidth: 320,
background: 'var(--bg2)', border: '1px solid var(--border)', background: 'var(--bg2)', border: '1px solid var(--border)',
@@ -134,7 +139,7 @@ function StartShiftScreen({ username, onStart, onLogout }) {
}}> }}>
<div> <div>
<label style={{ fontSize: 13, fontWeight: 600, color: 'var(--muted)', display: 'block', marginBottom: 6 }}> <label style={{ fontSize: 13, fontWeight: 600, color: 'var(--muted)', display: 'block', marginBottom: 6 }}>
Αρχικά μετρητά (προαιρετικό) {t('gate.startingCash')}
</label> </label>
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<span style={{ color: 'var(--muted)', fontWeight: 700 }}>€</span> <span style={{ color: 'var(--muted)', fontWeight: 700 }}>€</span>
@@ -160,7 +165,7 @@ function StartShiftScreen({ username, onStart, onLogout }) {
)} )}
<GateBtn onClick={handleStart} disabled={starting}> <GateBtn onClick={handleStart} disabled={starting}>
{starting ? 'Εκκίνηση…' : '▶ Έναρξη Βάρδιας'} {starting ? t('gate.starting') : `▶ ${t('gate.startShift')}`}
</GateBtn> </GateBtn>
</div> </div>
@@ -168,7 +173,7 @@ function StartShiftScreen({ username, onStart, onLogout }) {
style={{ fontSize: 13, color: 'var(--muted)', background: 'none', border: 'none', cursor: 'pointer' }} style={{ fontSize: 13, color: 'var(--muted)', background: 'none', border: 'none', cursor: 'pointer' }}
onClick={onLogout} onClick={onLogout}
> >
Αποσύνδεση {t('common.signOut')}
</button> </button>
</GateCard> </GateCard>
) )
+34 -27
View File
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { useNavigate, useLocation } from 'react-router-dom' import { useNavigate, useLocation } from 'react-router-dom'
import { useCan, useModule } from '@xenia/access' import { useCan, useModule } from '@xenia/access'
import { useFormat, useTranslation } from '@xenia/i18n'
import UserMenu from './UserMenu' import UserMenu from './UserMenu'
import { useNotifications } from '../context/NotificationContext' import { useNotifications } from '../context/NotificationContext'
import useNotificationSettingsStore from '../store/notificationSettingsStore' import useNotificationSettingsStore from '../store/notificationSettingsStore'
@@ -16,8 +17,8 @@ import useFailedPrintCount from '../hooks/useFailedPrintCount'
const NAV_REGISTRY = { const NAV_REGISTRY = {
tables: { tables: {
key: 'tables', key: 'tables',
label: 'Τραπέζια', label: 'nav.tables',
shortLabel: 'Τραπέζια', shortLabel: 'nav.tables',
href: '/tables?tab=tables', href: '/tables?tab=tables',
match: (loc) => loc.pathname === '/tables' && loc.search !== '?tab=orders', match: (loc) => loc.pathname === '/tables' && loc.search !== '?tab=orders',
icon: ( icon: (
@@ -31,8 +32,8 @@ const NAV_REGISTRY = {
}, },
orders: { orders: {
key: 'orders', key: 'orders',
label: 'Ενεργές Παραγγελίες', label: 'nav.activeOrders',
shortLabel: 'Παραγγελίες', shortLabel: 'nav.orders',
href: '/tables?tab=orders', href: '/tables?tab=orders',
match: (loc) => loc.pathname === '/tables' && loc.search === '?tab=orders', match: (loc) => loc.pathname === '/tables' && loc.search === '?tab=orders',
icon: ( icon: (
@@ -44,8 +45,8 @@ const NAV_REGISTRY = {
}, },
messages: { messages: {
key: 'messages', key: 'messages',
label: 'Μηνύματα', label: 'nav.messages',
shortLabel: 'Μηνύματα', shortLabel: 'nav.messages',
href: '/messages', href: '/messages',
match: (loc) => loc.pathname === '/messages', match: (loc) => loc.pathname === '/messages',
icon: ( icon: (
@@ -56,8 +57,8 @@ const NAV_REGISTRY = {
}, },
standalone: { standalone: {
key: 'standalone', key: 'standalone',
label: 'Takeaway', label: 'nav.takeaway',
shortLabel: 'Takeaway', shortLabel: 'nav.takeaway',
href: '/tables', href: '/tables',
match: () => false, match: () => false,
icon: ( icon: (
@@ -70,8 +71,8 @@ const NAV_REGISTRY = {
}, },
'shift-overview': { 'shift-overview': {
key: 'shift-overview', key: 'shift-overview',
label: 'Βάρδια', label: 'nav.shift',
shortLabel: 'Βάρδια', shortLabel: 'nav.shift',
href: '/shift-overview', href: '/shift-overview',
match: (loc) => loc.pathname === '/shift-overview', match: (loc) => loc.pathname === '/shift-overview',
icon: ( icon: (
@@ -83,8 +84,8 @@ const NAV_REGISTRY = {
}, },
'order-log': { 'order-log': {
key: 'order-log', key: 'order-log',
label: 'Αρχείο', label: 'nav.log',
shortLabel: 'Αρχείο', shortLabel: 'nav.log',
href: '/order-log', href: '/order-log',
match: (loc) => loc.pathname === '/order-log', match: (loc) => loc.pathname === '/order-log',
icon: ( icon: (
@@ -206,14 +207,16 @@ function BellButton({ onClick, count }) {
// ─── Notification drawer ────────────────────────────────────────────────────── // ─── Notification drawer ──────────────────────────────────────────────────────
function NotificationDrawer({ messages, onClose }) { function NotificationDrawer({ messages, onClose }) {
const { t } = useTranslation('waiter')
const { formatTime } = useFormat()
return ( return (
<div className="modal-overlay" onClick={onClose}> <div className="modal-overlay" onClick={onClose}>
<div className="modal-sheet" onClick={e => e.stopPropagation()} style={{ maxHeight: '80svh' }}> <div className="modal-sheet" onClick={e => e.stopPropagation()} style={{ maxHeight: '80svh' }}>
<div className="modal-handle" /> <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 && ( {messages.length === 0 && (
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: '24px 0' }}> <p style={{ textAlign: 'center', color: 'var(--muted)', padding: '24px 0' }}>
Δεν υπάρχουν ειδοποιήσεις {t('shell.noNotifications')}
</p> </p>
)} )}
<div style={{ display: 'flex', flexDirection: 'column', overflowY: 'auto', flex: 1 }}> <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> <div style={{ fontSize: 14, fontWeight: 600, color: 'var(--text)' }}>{msg.body}</div>
{tableIds.length > 0 && ( {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 }}> <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>
</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>
</div> </div>
) )
@@ -253,7 +256,7 @@ const DRAWER_NAV_ITEMS = [
{ ...NAV_REGISTRY.tables }, { ...NAV_REGISTRY.tables },
{ {
key: 'standalone', key: 'standalone',
label: 'Takeaway / Delivery', label: 'nav.takeawayDelivery',
href: '/tables', href: '/tables',
match: () => false, // active state handled separately in SideDrawer match: () => false, // active state handled separately in SideDrawer
icon: ( icon: (
@@ -268,7 +271,7 @@ const DRAWER_NAV_ITEMS = [
{ ...NAV_REGISTRY.messages }, { ...NAV_REGISTRY.messages },
{ {
key: 'shift-overview', key: 'shift-overview',
label: 'Σύνοψη Βάρδιας', label: 'nav.shiftSummary',
href: '/shift-overview', href: '/shift-overview',
match: (loc) => loc.pathname === '/shift-overview', match: (loc) => loc.pathname === '/shift-overview',
icon: ( icon: (
@@ -280,7 +283,7 @@ const DRAWER_NAV_ITEMS = [
}, },
{ {
key: 'order-log', key: 'order-log',
label: 'Αρχείο Παραγγελιών', label: 'nav.orderLog',
href: '/order-log', href: '/order-log',
match: (loc) => loc.pathname === '/order-log', match: (loc) => loc.pathname === '/order-log',
icon: ( icon: (
@@ -295,7 +298,7 @@ const DRAWER_NAV_ITEMS = [
const DRAWER_SETTINGS_ITEM = { const DRAWER_SETTINGS_ITEM = {
key: 'settings', key: 'settings',
label: 'Settings', label: 'nav.settings',
href: '/settings', href: '/settings',
match: (loc) => loc.pathname.startsWith('/settings'), match: (loc) => loc.pathname.startsWith('/settings'),
icon: ( icon: (
@@ -308,7 +311,7 @@ const DRAWER_SETTINGS_ITEM = {
const DRAWER_INSTALL_ITEM = { const DRAWER_INSTALL_ITEM = {
key: 'install-app', key: 'install-app',
label: 'Εγκατάσταση εφαρμογής', label: 'nav.installApp',
match: () => false, match: () => false,
icon: ( icon: (
<svg width="22" height="22" viewBox="0 0 24 24" fill="none"> <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 }) { function DrawerButton({ item, location, onNavigate, active: activeProp, onClick }) {
const { t } = useTranslation('waiter')
const active = activeProp ?? item.match(location) const active = activeProp ?? item.match(location)
return ( return (
<button <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> <span style={{ opacity: active ? 1 : 0.6, flexShrink: 0 }}>{item.icon}</span>
{item.label} {t(item.label)}
{active && ( {active && (
<div style={{ marginLeft: 'auto', width: 6, height: 6, borderRadius: '50%', background: 'var(--accent)' }} /> <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 }) { function SideDrawer({ open, onClose }) {
const { t } = useTranslation('waiter')
const navigate = useNavigate() const navigate = useNavigate()
const chatOn = useChatOn() const chatOn = useChatOn()
const location = useLocation() const location = useLocation()
@@ -406,13 +411,13 @@ function SideDrawer({ open, onClose }) {
{/* Drawer header */} {/* Drawer header */}
<div style={{ padding: '20px 20px 16px', borderBottom: '1px solid var(--border)' }}> <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: 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> </div>
{/* Main nav items */} {/* Main nav items */}
<div style={{ flex: 1, padding: '12px 10px', display: 'flex', flexDirection: 'column', gap: 4, overflowY: 'auto' }}> <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' }}> <div style={{ fontSize: 10, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 1, padding: '4px 10px 8px' }}>
Πλοήγηση {t('shell.navigation')}
</div> </div>
{DRAWER_NAV_ITEMS.filter(shown(chatOn)).map(item => { {DRAWER_NAV_ITEMS.filter(shown(chatOn)).map(item => {
const isStandaloneActive = location.pathname === '/tables' && activeZoneTab === 'standalone' const isStandaloneActive = location.pathname === '/tables' && activeZoneTab === 'standalone'
@@ -461,6 +466,7 @@ function PillBadge({ count, color = '#ef4444' }) {
} }
function TripleFooter({ location, navigate, chatUnread, kdsReady, tripleItems }) { function TripleFooter({ location, navigate, chatUnread, kdsReady, tripleItems }) {
const { t } = useTranslation('waiter')
const { activeZoneTab, setActiveZoneTab } = useTableViewStore() const { activeZoneTab, setActiveZoneTab } = useTableViewStore()
const chatOn = useChatOn() const chatOn = useChatOn()
const items = (tripleItems || ['tables', 'orders', 'messages']).map(k => NAV_REGISTRY[k]).filter(Boolean).filter(shown(chatOn)) 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 === '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>} {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> </span>
{item.shortLabel ?? item.label} {t(item.shortLabel ?? item.label)}
{badge && <PillBadge count={badge.count} color={badge.color} />} {badge && <PillBadge count={badge.count} color={badge.color} />}
</button> </button>
) )
@@ -526,6 +532,7 @@ function TripleFooter({ location, navigate, chatUnread, kdsReady, tripleItems })
// ─── Icon navbar footer ─────────────────────────────────────────────────────── // ─── Icon navbar footer ───────────────────────────────────────────────────────
function IconNavbar({ navItems, location, navigate, chatUnread, kdsReady }) { function IconNavbar({ navItems, location, navigate, chatUnread, kdsReady }) {
const { t } = useTranslation('waiter')
const { activeZoneTab, setActiveZoneTab } = useTableViewStore() const { activeZoneTab, setActiveZoneTab } = useTableViewStore()
const chatOn = useChatOn() const chatOn = useChatOn()
const items = navItems const items = navItems
@@ -597,7 +604,7 @@ function IconNavbar({ navItems, location, navigate, chatUnread, kdsReady }) {
)} )}
</span> </span>
<span style={{ fontSize: 10, fontWeight: active ? 700 : 500, letterSpacing: 0.2 }}> <span style={{ fontSize: 10, fontWeight: active ? 700 : 500, letterSpacing: 0.2 }}>
{item.shortLabel ?? item.label} {t(item.shortLabel ?? item.label)}
</span> </span>
</button> </button>
) )
+4 -2
View File
@@ -1,5 +1,6 @@
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { markBundleReady, syncVenueBundle } from '../native/bundles' 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 FIRST_SYNC_DELAY_MS = 3000 // let a TLS upgrade / rediscovery reload settle first
const PERIODIC_SYNC_MS = 30 * 60_000 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. * only if the venue's UI needs a newer APK than the one installed.
*/ */
export default function BundleSync() { export default function BundleSync() {
const { t } = useTranslation('waiter')
const [apkUpdate, setApkUpdate] = useState(null) // APK download URL when the shell is too old const [apkUpdate, setApkUpdate] = useState(null) // APK download URL when the shell is too old
useEffect(() => { useEffect(() => {
@@ -47,7 +49,7 @@ export default function BundleSync() {
boxShadow: '0 8px 32px rgba(0,0,0,0.4)', boxShadow: '0 8px 32px rgba(0,0,0,0.4)',
}}> }}>
<span style={{ flex: 1, fontSize: 13, color: 'var(--text)', lineHeight: 1.35 }}> <span style={{ flex: 1, fontSize: 13, color: 'var(--text)', lineHeight: 1.35 }}>
Ο server του καταστήματος χρειάζεται νεότερη έκδοση της εφαρμογής. {t('update.needsNewerApp')}
</span> </span>
<a <a
href={apkUpdate} href={apkUpdate}
@@ -58,7 +60,7 @@ export default function BundleSync() {
fontSize: 14, fontWeight: 700, textDecoration: 'none', whiteSpace: 'nowrap', fontSize: 14, fontWeight: 700, textDecoration: 'none', whiteSpace: 'nowrap',
}} }}
> >
Ενημέρωση {t('update.update')}
</a> </a>
</div> </div>
) )
+16 -14
View File
@@ -1,17 +1,18 @@
import { useEffect } from 'react' import { useEffect } from 'react'
import useInstallPromptStore, { APK_URL, canOfferApp } from '../store/installPromptStore' import useInstallPromptStore, { APK_URL, canOfferApp } from '../store/installPromptStore'
import { useTranslation } from '@xenia/i18n'
const BENEFITS = [ const BENEFITS = [
{ icon: '⚡', title: 'Ανοίγει αμέσως', text: 'Χωρίς φόρτωση από τον browser, σαν κανονική εφαρμογή.' }, { icon: '⚡', title: 'install.fast', text: 'install.fastText' },
{ icon: '📶', title: 'Αντέχει στο WiFi', text: 'Συνεχίζει να δουλεύει όταν χάνεται για λίγο η σύνδεση.' }, { icon: '📶', title: 'install.wifi', text: 'install.wifiText' },
{ icon: '🔒', title: 'Ασφαλής σύνδεση', text: 'Κρυπτογραφημένη επικοινωνία με τον server του καταστήματος.' }, { icon: '🔒', title: 'install.secure', text: 'install.secureText' },
{ icon: '🔄', title: 'Χωρίς ρυθμίσεις', text: 'Βρίσκει μόνη της τον server και ενημερώνεται αυτόματα.' }, { icon: '🔄', title: 'install.noSetup', text: 'install.noSetupText' },
] ]
const STEPS = [ const STEPS = [
'Πατήστε «Λήψη εφαρμογής».', 'install.step1',
'Ανοίξτε το αρχείο και επιτρέψτε την εγκατάσταση.', 'install.step2',
'Ανοίξτε το Xenia και σαρώστε ξανά το QR του καταστήματος.', 'install.step3',
] ]
/** /**
@@ -19,6 +20,7 @@ const STEPS = [
* Opens by itself once; afterwards from the side drawer. * Opens by itself once; afterwards from the side drawer.
*/ */
export default function InstallAppDialog() { export default function InstallAppDialog() {
const { t } = useTranslation('waiter')
const { open, dismiss, autoOpen } = useInstallPromptStore() const { open, dismiss, autoOpen } = useInstallPromptStore()
useEffect(() => { useEffect(() => {
@@ -56,10 +58,10 @@ export default function InstallAppDialog() {
style={{ borderRadius: 18, boxShadow: '0 6px 20px rgba(0,0,0,0.35)' }} 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' }}> <h2 id="install-app-title" style={{ fontSize: 20, fontWeight: 800, color: 'var(--text)', margin: '14px 0 4px' }}>
Εφαρμογή Xenia {t('install.title')}
</h2> </h2>
<p style={{ fontSize: 13, color: 'var(--muted)', lineHeight: 1.45 }}> <p style={{ fontSize: 13, color: 'var(--muted)', lineHeight: 1.45 }}>
Εγκαταστήστε την εφαρμογή για γρηγορότερη και πιο σταθερή λειτουργία. {t('install.intro')}
</p> </p>
</div> </div>
@@ -73,8 +75,8 @@ export default function InstallAppDialog() {
{b.icon} {b.icon}
</span> </span>
<div> <div>
<div style={{ fontSize: 14, fontWeight: 700, color: 'var(--text)' }}>{b.title}</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 }}>{b.text}</div> <div style={{ fontSize: 12.5, color: 'var(--muted)', lineHeight: 1.4 }}>{t(b.text)}</div>
</div> </div>
</div> </div>
))} ))}
@@ -84,7 +86,7 @@ export default function InstallAppDialog() {
margin: 0, padding: '12px 14px 12px 32px', borderRadius: 12, background: 'var(--bg3)', margin: 0, padding: '12px 14px 12px 32px', borderRadius: 12, background: 'var(--bg3)',
fontSize: 12.5, color: 'var(--muted)', lineHeight: 1.55, 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> </ol>
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
@@ -95,10 +97,10 @@ export default function InstallAppDialog() {
className="btn btn--accent btn--lg" className="btn btn--accent btn--lg"
style={{ textDecoration: 'none', display: 'flex', alignItems: 'center', justifyContent: 'center' }} style={{ textDecoration: 'none', display: 'flex', alignItems: 'center', justifyContent: 'center' }}
> >
Λήψη εφαρμογής {t('install.download')}
</a> </a>
<button className="btn btn--secondary" onClick={dismiss} style={{ minHeight: 44 }}> <button className="btn btn--secondary" onClick={dismiss} style={{ minHeight: 44 }}>
Όχι τώρα {t('install.later')}
</button> </button>
</div> </div>
</div> </div>
+7 -5
View File
@@ -20,6 +20,7 @@ import { apiError } from '../api/errors'
import { getVenueSettings } from '../api/venueSettings' import { getVenueSettings } from '../api/venueSettings'
import { storageKey } from '../config/server' import { storageKey } from '../config/server'
import { idleAction, idleLimits } from '../logic/idle' import { idleAction, idleLimits } from '../logic/idle'
import { useTranslation } from '@xenia/i18n'
const ACTIVITY_EVENTS = ['pointerdown', 'keydown', 'touchstart', 'scroll'] const ACTIVITY_EVENTS = ['pointerdown', 'keydown', 'touchstart', 'scroll']
const SAVE_EVERY_MS = 5_000 const SAVE_EVERY_MS = 5_000
@@ -84,6 +85,7 @@ function touchActivity() {
} }
export default function LockScreen() { export default function LockScreen() {
const { t } = useTranslation('waiter')
const { user, savedUsername, unlock, logout } = useAuthStore() const { user, savedUsername, unlock, logout } = useAuthStore()
const { login: modes } = useAccess() const { login: modes } = useAccess()
const usePassword = modes?.waiter_mode === 'password' const usePassword = modes?.waiter_mode === 'password'
@@ -108,7 +110,7 @@ export default function LockScreen() {
unlock(data.user) unlock(data.user)
} catch (err) { } catch (err) {
if (isError(err, 'auth.session_ended')) { signOut(); return } if (isError(err, 'auth.session_ended')) { signOut(); return }
setError(apiError(err, usePassword ? 'Λανθασμένος κωδικός' : 'Λανθασμένο PIN')) setError(apiError(err, usePassword ? t('login.wrongPassword') : t('login.wrongPin')))
setPassword('') setPassword('')
setAttempt(a => a + 1) setAttempt(a => a + 1)
} finally { } finally {
@@ -127,7 +129,7 @@ export default function LockScreen() {
> >
<div className="login-box" style={{ textAlign: 'center' }}> <div className="login-box" style={{ textAlign: 'center' }}>
<div style={{ fontSize: 40 }}>🔒</div> <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> <p style={{ fontSize: 14, color: 'var(--muted)', marginBottom: 12 }}>{user?.full_name || user?.username || savedUsername}</p>
{usePassword ? ( {usePassword ? (
@@ -136,7 +138,7 @@ export default function LockScreen() {
type="password" type="password"
value={password} value={password}
onChange={e => setPassword(e.target.value)} onChange={e => setPassword(e.target.value)}
placeholder="Κωδικός" placeholder={t('login.password')}
autoComplete="current-password" autoComplete="current-password"
data-testid="unlock-password" data-testid="unlock-password"
style={{ style={{
@@ -144,7 +146,7 @@ export default function LockScreen() {
border: '1px solid var(--border)', background: 'var(--bg2)', color: 'var(--text)', fontSize: 16, 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> </form>
) : ( ) : (
<PinPad key={attempt} onSubmit={pin => tryUnlock({ pin })} loading={busy} /> <PinPad key={attempt} onSubmit={pin => tryUnlock({ pin })} loading={busy} />
@@ -157,7 +159,7 @@ export default function LockScreen() {
data-testid="lock-sign-out" data-testid="lock-sign-out"
style={{ marginTop: 16, background: 'none', border: 'none', color: 'var(--muted)', fontSize: 13, cursor: 'pointer' }} style={{ marginTop: 16, background: 'none', border: 'none', color: 'var(--muted)', fontSize: 13, cursor: 'pointer' }}
> >
Αποσύνδεση (άλλος σερβιτόρος) {t('lock.signOutOther')}
</button> </button>
</div> </div>
</div> </div>
+7 -5
View File
@@ -1,8 +1,9 @@
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import QrScanner from 'qr-scanner' import QrScanner from 'qr-scanner'
import { useTranslation } from '@xenia/i18n'
const MSG_DENIED = 'Δεν δόθηκε άδεια κάμερας. Επιτρέψτε την από τις ρυθμίσεις του κινητού ή πληκτρολογήστε τη διεύθυνση.' const MSG_DENIED = 'qr.denied'
const MSG_NO_CAMERA = 'Δεν ήταν δυνατή η ενεργοποίηση της κάμερας. Πληκτρολογήστε τη διεύθυνση.' const MSG_NO_CAMERA = 'qr.noCamera'
/** /**
* Full-screen camera view that resolves the first QR code it sees. * 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. * the normal Android runtime permission prompt.
*/ */
export default function QrScannerModal({ onResult, onClose }) { export default function QrScannerModal({ onResult, onClose }) {
const { t } = useTranslation('waiter')
const videoRef = useRef(null) const videoRef = useRef(null)
const [error, setError] = useState(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, padding: 32, textAlign: 'center', color: '#e2e8f0', fontSize: 15, lineHeight: 1.5,
background: 'rgba(15,23,42,0.92)', background: 'rgba(15,23,42,0.92)',
}}> }}>
{error} {t(error)}
</div> </div>
)} )}
</div> </div>
<div style={{ padding: 16, display: 'flex', flexDirection: 'column', gap: 10, background: '#0f172a' }}> <div style={{ padding: 16, display: 'flex', flexDirection: 'column', gap: 10, background: '#0f172a' }}>
{!error && ( {!error && (
<p style={{ color: '#94a3b8', fontSize: 13, textAlign: 'center' }}> <p style={{ color: '#94a3b8', fontSize: 13, textAlign: 'center' }}>
Σκοπεύστε το QR από τον διαχειριστή (Ρυθμίσεις → Γενικά → Σερβιτόροι WiFi) {t('qr.aim')}
</p> </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>
</div> </div>
) )
+31 -21
View File
@@ -1,4 +1,5 @@
import { useRef, useState, useEffect } from 'react' import { useRef, useState, useEffect } from 'react'
import { useFormat, useTranslation } from '@xenia/i18n'
import useThemeStore from '../store/themeStore' import useThemeStore from '../store/themeStore'
import useTableColourStore from '../store/tableColourStore' import useTableColourStore from '../store/tableColourStore'
import { assetUrl } from '../config/server' import { assetUrl } from '../config/server'
@@ -36,11 +37,11 @@ function fmtItemQtyTC(qty, unitType) {
const STATUS_LABELS = { const STATUS_LABELS = {
free: 'ΕΛΕΥΘΕΡΟ', free: 'card.free',
open: 'ΑΝΟΙΧΤΟ', open: 'card.open',
mine: 'ΔΙΚΟ ΜΟΥ', mine: 'card.mine',
paid: 'ΠΛΗΡΩΜΕΝΟ', paid: 'card.paid',
partially_paid: 'ΜΕΡ. ΠΛHΡ.', partially_paid: 'card.partlyPaid',
} }
// ─── KDS badge helpers ──────────────────────────────────────────────────────── // ─── 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 // 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). // (we approximate "don't fit" as > 2 waiters for the compact footer height).
function WaiterRow({ waiters, size = 22, cfg }) { function WaiterRow({ waiters, size = 22, cfg }) {
const { t } = useTranslation('waiter')
if (!waiters?.length) return null if (!waiters?.length) return null
const textColor = cfg.nameText const textColor = cfg.nameText
@@ -172,7 +174,7 @@ function WaiterRow({ waiters, size = 22, cfg }) {
}}>+{waiters.length - 3}</div> }}>+{waiters.length - 3}</div>
)} )}
<span style={{ fontSize: 12, fontWeight: 600, color: textColor, opacity: 0.7, marginLeft: 4 }}> <span style={{ fontSize: 12, fontWeight: 600, color: textColor, opacity: 0.7, marginLeft: 4 }}>
{waiters.length} σερβιτόροι {t('card.waiters', { count: waiters.length })}
</span> </span>
</div> </div>
) )
@@ -266,14 +268,16 @@ function FlagChip({ flag }) {
// ─── Amount display ─────────────────────────────────────────────────────────── // ─── Amount display ───────────────────────────────────────────────────────────
function Amount({ value, size = 22, color }) { function Amount({ value, size = 22, color }) {
const s = Number(value || 0).toFixed(2) // the venue's money format (4.5), the cents smaller: "2,40 €" / "€2.40"
const [whole, cents] = s.split('.') 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 isNum = typeof size === 'number'
const centsSize = isNum ? size * 0.56 : `calc(${size} * 0.56)` const centsSize = isNum ? size * 0.56 : `calc(${size} * 0.56)`
return ( return (
<div style={{ lineHeight: 1, color: color || 'inherit' }}> <div style={{ lineHeight: 1, color: color || 'inherit' }}>
<span style={{ fontSize: size, fontWeight: 800, letterSpacing: -0.5 }}>{whole}</span> <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> </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). // 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 }) { function Card1x1({ table, _order, flags, _waiterObjects, cfg, statusKey, kdsBadge, flashOverlay }) {
const { t } = useTranslation('waiter')
return ( return (
<div style={{ <div style={{
width: '100%', aspectRatio: '1 / 1.05', width: '100%', aspectRatio: '1 / 1.05',
@@ -319,7 +324,7 @@ function Card1x1({ table, _order, flags, _waiterObjects, cfg, statusKey, kdsBadg
background: cfg.badgeBg, borderRadius: 3, background: cfg.badgeBg, borderRadius: 3,
padding: '1px 4px', whiteSpace: 'nowrap', padding: '1px 4px', whiteSpace: 'nowrap',
}}> }}>
{STATUS_LABELS[statusKey]} {t(STATUS_LABELS[statusKey])}
</span> </span>
)} )}
</div> </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. // 2x1 — half width, compact horizontal. Name left, KDS badge (or status) + flags right.
function Card2x1({ table, _order, flags, _waiterObjects, cfg, statusKey, kdsBadge, flashOverlay }) { function Card2x1({ table, _order, flags, _waiterObjects, cfg, statusKey, kdsBadge, flashOverlay }) {
const { t } = useTranslation('waiter')
return ( return (
<div style={{ <div style={{
width: '100%', height: 64, width: '100%', height: 64,
@@ -357,7 +363,7 @@ function Card2x1({ table, _order, flags, _waiterObjects, cfg, statusKey, kdsBadg
{kdsBadge ? ( {kdsBadge ? (
<KdsBadge badge={kdsBadge} small /> <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 && ( {flags.length > 0 && (
<FlagDots flags={flags} size={18} maxShow={3} /> <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. // 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 }) { function Card2x2({ table, order, flags, _waiterObjects, cfg, statusKey, kdsBadge, flashOverlay }) {
const { t } = useTranslation('waiter')
const isFree = !order const isFree = !order
const total = order?.items?.filter(i => i.status === 'active').reduce((s, i) => s + i.unit_price * i.quantity, 0) ?? 0 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}`} {table.label || `T${table.number}`}
</span> </span>
<div style={{ marginTop: 5 }}> <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> </div>
{/* Always reserve amount height — invisible when free */} {/* Always reserve amount height — invisible when free */}
<div style={{ marginTop: 'auto', paddingTop: 8, minHeight: 28, visibility: isFree ? 'hidden' : 'visible' }}> <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. // 4x1 — full width horizontal. Name + amount left-center, flags, KDS badge (or status) right.
function Card4x1({ table, order, flags, _waiterObjects, cfg, statusKey, kdsBadge, flashOverlay }) { function Card4x1({ table, order, flags, _waiterObjects, cfg, statusKey, kdsBadge, flashOverlay }) {
const { t } = useTranslation('waiter')
const isFree = !order const isFree = !order
const total = order?.items?.filter(i => i.status === 'active').reduce((s, i) => s + i.unit_price * i.quantity, 0) ?? 0 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 ? (
<KdsBadge badge={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>
</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. // 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 }) { function Card4x2({ table, order, flags, waiterObjects, groupName, cfg, statusKey, kdsBadge, flashOverlay }) {
const { t } = useTranslation('waiter')
const isFree = !order const isFree = !order
const total = order?.items?.filter(i => i.status === 'active').reduce((s, i) => s + i.unit_price * i.quantity, 0) ?? 0 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 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 */} {/* center: status + KDS badge side-by-side, vertically centered */}
<div style={{ display: 'flex', alignItems: 'center', gap: 6, flexShrink: 0 }}> <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} />} {kdsBadge && <KdsBadge badge={kdsBadge} />}
</div> </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. // 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 }) { function Card4x3({ table, order, flags, waiterObjects, groupName, cfg, statusKey, _kdsBadge, flashOverlay }) {
const { t } = useTranslation('waiter')
const isFree = !order const isFree = !order
const activeItems = order?.items?.filter(i => i.status === 'active') ?? [] const activeItems = order?.items?.filter(i => i.status === 'active') ?? []
const total = activeItems.reduce((s, i) => s + i.unit_price * i.quantity, 0) 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 preparing = relevant.filter(i => kds(i.kds_status) === 'preparing').length
const done = relevant.filter(i => kds(i.kds_status) === 'done').length const done = relevant.filter(i => kds(i.kds_status) === 'done').length
const total = relevant.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 = [] const parts = []
if (preparing > 0) parts.push(`${preparing} Ετοιμάζεται`) if (preparing > 0) parts.push(t('card.preparingCount', { count: preparing }))
if (done > 0) parts.push(`${done} Έτοιμα`) if (done > 0) parts.push(t('card.readyCount', { count: done }))
return parts.length > 0 ? { text: parts.join(' · '), color: done > 0 ? '#4ade80' : '#60a5fa' } : null 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>
<div style={{ marginTop: 8 }}> <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> </div>
{flags.length > 0 && ( {flags.length > 0 && (
@@ -628,11 +638,11 @@ function Card4x3({ table, order, flags, waiterObjects, groupName, cfg, statusKey
<div style={{ flex: 1, minWidth: 0, overflow: 'hidden' }}> <div style={{ flex: 1, minWidth: 0, overflow: 'hidden' }}>
{isFree ? ( {isFree ? (
<div style={{ height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center' }}> <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> </div>
) : activeItems.length === 0 ? ( ) : activeItems.length === 0 ? (
<div style={{ height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center' }}> <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>
) : ( ) : (
<div style={{ display: 'flex', flexDirection: 'column', gap: 3, minWidth: 0 }}> <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 && ( {activeItems.length > 7 && (
<div style={{ fontSize: 11, color: cfg.nameText, opacity: 0.5, marginTop: 2 }}> <div style={{ fontSize: 11, color: cfg.nameText, opacity: 0.5, marginTop: 2 }}>
+{activeItems.length - 7} ακόμα… {t('card.more', { count: activeItems.length - 7 })}
</div> </div>
)} )}
</div> </div>
+4 -2
View File
@@ -1,6 +1,8 @@
import { useRegisterSW } from 'virtual:pwa-register/react' import { useRegisterSW } from 'virtual:pwa-register/react'
import { useTranslation } from '@xenia/i18n'
export default function UpdatePrompt() { export default function UpdatePrompt() {
const { t } = useTranslation('waiter')
const { const {
needRefresh: [needRefresh], needRefresh: [needRefresh],
updateServiceWorker, updateServiceWorker,
@@ -26,7 +28,7 @@ export default function UpdatePrompt() {
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
}}> }}>
<span style={{ fontSize: 14, color: 'var(--text)', fontWeight: 500 }}> <span style={{ fontSize: 14, color: 'var(--text)', fontWeight: 500 }}>
Νέα έκδοση διαθέσιμη {t('update.available')}
</span> </span>
<button <button
onClick={() => updateServiceWorker(true)} onClick={() => updateServiceWorker(true)}
@@ -41,7 +43,7 @@ export default function UpdatePrompt() {
cursor: 'pointer', cursor: 'pointer',
}} }}
> >
Ενημέρωση {t('update.update')}
</button> </button>
</div> </div>
) )
+43 -23
View File
@@ -1,27 +1,27 @@
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import { useNavigate } from 'react-router-dom' 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 useAuthStore from '../store/authStore'
import useShiftStore from '../store/shiftStore' import useShiftStore from '../store/shiftStore'
import useThemeStore from '../store/themeStore' import useThemeStore from '../store/themeStore'
import client from '../api/client' import client from '../api/client'
import { deliveryMode, getActiveVenue } from '../config/server' import { deliveryMode, getActiveVenue } from '../config/server'
function formatTime(iso) { function formatDuration(iso, t) {
if (!iso) return ''
return new Date(iso).toLocaleTimeString('el-GR', { hour: '2-digit', minute: '2-digit' })
}
function formatDuration(iso) {
if (!iso) return '' if (!iso) return ''
const mins = Math.floor((Date.now() - new Date(iso).getTime()) / 60000) 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 h = Math.floor(mins / 60)
const m = 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() { 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 [open, setOpen] = useState(false)
const [busy, setBusy] = useState(false) const [busy, setBusy] = useState(false)
const ref = useRef(null) const ref = useRef(null)
@@ -41,6 +41,18 @@ export default function UserMenu() {
return () => document.removeEventListener('mousedown', onClick) 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() { function handleLogout() {
setOpen(false) setOpen(false)
logout() logout()
@@ -52,7 +64,7 @@ export default function UserMenu() {
const isWaiter = !canDashboard // works in a shift (plan 4.1: the key, not the role) const isWaiter = !canDashboard // works in a shift (plan 4.1: the key, not the role)
async function handleEndShift() { async function handleEndShift() {
if (!window.confirm('Να τελειώσει η βάρδια σου;')) return if (!window.confirm(t('menu.endShiftConfirm'))) return
setBusy(true) setBusy(true)
try { try {
await client.post('/api/shifts/end', {}) await client.post('/api/shifts/end', {})
@@ -86,7 +98,7 @@ export default function UserMenu() {
<div ref={ref} style={{ position: 'relative' }}> <div ref={ref} style={{ position: 'relative' }}>
<button <button
onClick={() => setOpen(o => !o)} onClick={() => setOpen(o => !o)}
title="Μενού χρήστη" title={t('menu.title')} data-testid="user-menu"
style={{ style={{
display: 'flex', alignItems: 'center', gap: 6, display: 'flex', alignItems: 'center', gap: 6,
padding: '8px 14px', borderRadius: 20, border: '2px solid transparent', padding: '8px 14px', borderRadius: 20, border: '2px solid transparent',
@@ -122,20 +134,20 @@ export default function UserMenu() {
margin: '4px 8px 2px', margin: '4px 8px 2px',
}}> }}>
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, marginBottom: 4 }}> <div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, marginBottom: 4 }}>
Βάρδια ενεργή {t('menu.shiftActive')}
</div> </div>
<div style={{ fontSize: 13, color: 'var(--text)', display: 'flex', justifyContent: 'space-between' }}> <div style={{ fontSize: 13, color: 'var(--text)', display: 'flex', justifyContent: 'space-between' }}>
<span>Από {formatTime(shift.started_at)}</span> <span>{t('menu.since', { time: formatTime(shift.started_at) })}</span>
<span style={{ color: 'var(--muted)' }}>{formatDuration(shift.started_at)}</span> <span style={{ color: 'var(--muted)' }}>{formatDuration(shift.started_at, t)}</span>
</div> </div>
{shift.starting_cash != null && ( {shift.starting_cash != null && (
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}> <div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>
Αρχικά: €{shift.starting_cash.toFixed(2)} {t('menu.startingCash', { amount: formatMoney(shift.starting_cash) })}
</div> </div>
)} )}
{activeBreak && ( {activeBreak && (
<div style={{ fontSize: 12, color: 'var(--accent)', marginTop: 4, fontWeight: 600 }}> <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>
)} )}
</div> </div>
@@ -147,7 +159,7 @@ export default function UserMenu() {
disabled={busy} disabled={busy}
> >
<span className="user-menu-item__icon">{activeBreak ? '▶' : '☕'}</span> <span className="user-menu-item__icon">{activeBreak ? '▶' : '☕'}</span>
<span>{activeBreak ? 'Τέλος Διαλείμματος' : 'Διάλειμμα'}</span> <span>{activeBreak ? t('menu.endBreak') : t('menu.break')}</span>
</button> </button>
{/* End shift button */} {/* End shift button */}
@@ -159,11 +171,11 @@ export default function UserMenu() {
style={{ color: 'var(--danger)' }} style={{ color: 'var(--danger)' }}
> >
<span className="user-menu-item__icon">⏹</span> <span className="user-menu-item__icon">⏹</span>
<span>Τέλος Βάρδιας</span> <span>{t('menu.endShift')}</span>
</button> </button>
) : ( ) : (
<div style={{ padding: '8px 16px', fontSize: 12, color: 'var(--muted)', fontStyle: 'italic' }}> <div style={{ padding: '8px 16px', fontSize: 12, color: 'var(--muted)', fontStyle: 'italic' }}>
Ζητήστε από τον διαχειριστή να κλείσει τη βάρδια {t('menu.askManagerToEnd')}
</div> </div>
)} )}
@@ -175,27 +187,35 @@ export default function UserMenu() {
{deliveryMode() === 'native' && ( {deliveryMode() === 'native' && (
<button className="user-menu-item" onClick={() => { setOpen(false); navigate('/venues') }}> <button className="user-menu-item" onClick={() => { setOpen(false); navigate('/venues') }}>
<span className="user-menu-item__icon">🏪</span> <span className="user-menu-item__icon">🏪</span>
<span>Κατάστημα: {getActiveVenue()?.name ?? '—'}</span> <span>{t('menu.venue', { name: getActiveVenue()?.name ?? '—' })}</span>
</button> </button>
)} )}
{/* ── Theme toggle ──────────────────────────────────── */} {/* ── Theme toggle ──────────────────────────────────── */}
<button className="user-menu-item" onClick={() => { toggle(); setOpen(false) }}> <button className="user-menu-item" onClick={() => { toggle(); setOpen(false) }}>
<span className="user-menu-item__icon">{dark ? '☀️' : '🌙'}</span> <span className="user-menu-item__icon">{dark ? '☀️' : '🌙'}</span>
<span>{dark ? 'Φωτεινό θέμα' : 'Σκοτεινό θέμα'}</span> <span>{dark ? t('menu.lightTheme') : t('menu.darkTheme')}</span>
</button> </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" /> <div className="user-menu-divider" />
{/* ── Lock (plan step 4.2): the same waiter unlocks with their PIN ── */} {/* ── 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() }}> <button className="user-menu-item" data-testid="menu-lock" onClick={() => { setOpen(false); lock() }}>
<span className="user-menu-item__icon">🔒</span> <span className="user-menu-item__icon">🔒</span>
<span>Κλείδωμα</span> <span>{t('menu.lock')}</span>
</button> </button>
<button className="user-menu-item user-menu-item--danger" onClick={handleLogout}> <button className="user-menu-item user-menu-item--danger" onClick={handleLogout}>
<span className="user-menu-item__icon">⏏</span> <span className="user-menu-item__icon">⏏</span>
<span>Αποσύνδεση</span> <span>{t('common.signOut')}</span>
</button> </button>
</div> </div>
)} )}
+6 -1
View File
@@ -1,4 +1,9 @@
// The waiter app's translations instance (plan step 4.1; its own texts become keys in 4.5). // 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 { createI18n } from '@xenia/i18n' import { createI18n } from '@xenia/i18n'
export const i18n = createI18n({ defaultNS: 'common' }) 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 })
+10 -17
View File
@@ -14,6 +14,7 @@ import { deliveryMode, saveVenue } from '../config/server'
import { syncTrustedKeys, tlsBaseUrl } from './tls' import { syncTrustedKeys, tlsBaseUrl } from './tls'
import { SUPPORTED_API_VERSIONS } from './apiVersion' import { SUPPORTED_API_VERSIONS } from './apiVersion'
import { tw } from '../i18n'
export { SUPPORTED_API_VERSIONS } export { SUPPORTED_API_VERSIONS }
@@ -27,16 +28,16 @@ export class PairingError extends Error {}
*/ */
export function parseServerInput(raw) { export function parseServerInput(raw) {
const text = String(raw || '').trim() 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}` const withScheme = /^https?:\/\//i.test(text) ? text : `http://${text}`
let url let url
try { try {
url = new URL(withScheme) url = new URL(withScheme)
} catch { } 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 { return {
baseUrl: url.origin, baseUrl: url.origin,
@@ -53,15 +54,13 @@ export async function probeServer(baseUrl) {
try { try {
res = await fetch(`${baseUrl}/api/system/identity`, { signal: controller.signal }) res = await fetch(`${baseUrl}/api/system/identity`, { signal: controller.signal })
} catch { } catch {
throw new PairingError( throw new PairingError(tw('pairing.noServer'))
'Δεν βρέθηκε server σε αυτή τη διεύθυνση. Ελέγξτε ότι το κινητό είναι στο ίδιο WiFi με το κατάστημα.'
)
} finally { } finally {
clearTimeout(timer) clearTimeout(timer)
} }
if (res.status === 403) { if (res.status === 403) {
throw new PairingError('Ο server αρνήθηκε τη σύνδεση. Το κινητό πρέπει να είναι στο WiFi του καταστήματος.') throw new PairingError(tw('pairing.refused'))
} }
let identity = null let identity = null
try { try {
@@ -70,12 +69,10 @@ export async function probeServer(baseUrl) {
// not JSON → not a Xenia server // not JSON → not a Xenia server
} }
if (!res.ok || identity?.app !== 'xenia-pos') { 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)) { if (!SUPPORTED_API_VERSIONS.includes(identity.api_version)) {
throw new PairingError( throw new PairingError(tw('pairing.incompatible', { version: identity.version }))
`Ο server (έκδοση ${identity.version}) δεν είναι συμβατός με αυτή την εφαρμογή. Ενημερώστε την εφαρμογή ή τον server.`
)
} }
return identity return identity
} }
@@ -94,16 +91,12 @@ export async function pairWith(raw) {
const identity = await probeServer(baseUrl) const identity = await probeServer(baseUrl)
if (expectedSiteId && identity.site_id && identity.site_id !== expectedSiteId) { if (expectedSiteId && identity.site_id && identity.site_id !== expectedSiteId) {
throw new PairingError( throw new PairingError(tw('pairing.otherVenue'))
'Σε αυτή τη διεύθυνση απαντά διαφορετικό κατάστημα από αυτό του QR. Ζητήστε νέο QR από τον διαχειριστή.'
)
} }
const spki = identity.tls?.spki_sha256 || null const spki = identity.tls?.spki_sha256 || null
if (expectedKey && spki !== expectedKey) { if (expectedKey && spki !== expectedKey) {
// The QR carries the real server's key: anything else is a different machine // The QR carries the real server's key: anything else is a different machine
throw new PairingError( throw new PairingError(tw('pairing.wrongKey'))
'Το κλειδί ασφαλείας του server δεν ταιριάζει με το QR. Ζητήστε νέο QR από τον διαχειριστή.'
)
} }
const venue = { const venue = {
+22 -16
View File
@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom'
import { useProductCache } from '../hooks/useProductCache' import { useProductCache } from '../hooks/useProductCache'
import useWaiterFavoritesStore from '../store/waiterFavoritesStore' import useWaiterFavoritesStore from '../store/waiterFavoritesStore'
import { assetUrl } from '../config/server' import { assetUrl } from '../config/server'
import { useFormat, useTranslation } from '@xenia/i18n'
// ── Heart icon ──────────────────────────────────────────────────────────────── // ── Heart icon ────────────────────────────────────────────────────────────────
function Heart({ filled, size = 22 }) { function Heart({ filled, size = 22 }) {
@@ -87,6 +88,7 @@ function AttrSection({ title, items, favIds, onToggle }) {
} }
function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) { function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
const { t } = useTranslation('waiter')
// Local state: { quick: id[], ingredients: id[], options: id[], prefs: id[] } // 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 // Start from waiter overrides if they exist, otherwise seed from manager's is_favorite flags
function seedFromManager() { function seedFromManager() {
@@ -164,7 +166,7 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
{product.name} {product.name}
</div> </div>
<div style={{ fontSize: 12, color: 'var(--muted)' }}> <div style={{ fontSize: 12, color: 'var(--muted)' }}>
{waiterAttrFavs ? 'Προσωπικές ρυθμίσεις ενεργές' : 'Χρήση ρυθμίσεων διαχειριστή'} {waiterAttrFavs ? t('favSetup.personalOn') : t('favSetup.managerDefaults')}
</div> </div>
</div> </div>
<button <button
@@ -179,22 +181,22 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
<div style={{ flex: 1, overflowY: 'auto', padding: '16px 16px 0' }}> <div style={{ flex: 1, overflowY: 'auto', padding: '16px 16px 0' }}>
{!hasAnything ? ( {!hasAnything ? (
<p style={{ color: 'var(--muted)', fontSize: 14, textAlign: 'center', padding: '32px 0' }}> <p style={{ color: 'var(--muted)', fontSize: 14, textAlign: 'center', padding: '32px 0' }}>
Αυτό το προϊόν δεν έχει επιλογές, υλικά ή προτιμήσεις. {t('favSetup.noOptions')}
</p> </p>
) : ( ) : (
<> <>
<p style={{ fontSize: 13, color: 'var(--muted)', marginBottom: 16, lineHeight: 1.5 }}> <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> </p>
<AttrSection <AttrSection
title="Γρήγορες Επιλογές" title={t('drawer.tabs.quick')}
items={product.quick_options} items={product.quick_options}
favIds={local.quick || []} favIds={local.quick || []}
onToggle={id => toggle('quick', id)} onToggle={id => toggle('quick', id)}
/> />
<AttrSection <AttrSection
title="Υλικά" title={t('drawer.tabs.ingredients')}
items={product.ingredients} items={product.ingredients}
favIds={local.ingredients || []} favIds={local.ingredients || []}
onToggle={id => toggle('ingredients', id)} onToggle={id => toggle('ingredients', id)}
@@ -206,7 +208,7 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
onToggle={id => toggle('options', id)} onToggle={id => toggle('options', id)}
/> />
<AttrSection <AttrSection
title="Προτιμήσεις" title={t('drawer.tabs.prefs')}
items={product.preference_sets} items={product.preference_sets}
favIds={local.prefs || []} favIds={local.prefs || []}
onToggle={id => toggle('prefs', id)} onToggle={id => toggle('prefs', id)}
@@ -231,7 +233,7 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
fontSize: 13, fontWeight: 600, cursor: 'pointer', fontSize: 13, fontWeight: 600, cursor: 'pointer',
}} }}
> >
Επαναφορά {t('settings.reset.title')}
</button> </button>
)} )}
<button <button
@@ -243,7 +245,7 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
fontSize: 15, fontWeight: 700, cursor: 'pointer', fontSize: 15, fontWeight: 700, cursor: 'pointer',
}} }}
> >
{totalSelected > 0 ? `Αποθήκευση (${totalSelected} επιλογές)` : 'Αποθήκευση'} {totalSelected > 0 ? t('favSetup.saveCount', { count: totalSelected }) : t('common.save')}
</button> </button>
</div> </div>
</div> </div>
@@ -253,6 +255,8 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
// ── Product row (ALL tab) ───────────────────────────────────────────────────── // ── Product row (ALL tab) ─────────────────────────────────────────────────────
function ProductRow({ product, isFav, hasAttrOverride, onToggleFav, onEditAttrs }) { function ProductRow({ product, isFav, hasAttrOverride, onToggleFav, onEditAttrs }) {
const { t } = useTranslation('waiter')
const { formatMoney } = useFormat()
const hasAttrs = ( const hasAttrs = (
(product.quick_options || []).length > 0 || (product.quick_options || []).length > 0 ||
(product.ingredients || []).length > 0 || (product.ingredients || []).length > 0 ||
@@ -281,7 +285,7 @@ function ProductRow({ product, isFav, hasAttrOverride, onToggleFav, onEditAttrs
)} )}
</div> </div>
<div style={{ fontSize: 12, color: hasAttrs ? 'var(--accent)' : 'var(--muted)' }}> <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>
</div> </div>
@@ -298,6 +302,7 @@ function ProductRow({ product, isFav, hasAttrOverride, onToggleFav, onEditAttrs
// ── Draggable favorites list (pointer-events — works on touch + mouse) ───────── // ── Draggable favorites list (pointer-events — works on touch + mouse) ─────────
function FavoritesList({ items, products, onReorder }) { function FavoritesList({ items, products, onReorder }) {
const { t } = useTranslation('waiter')
const [dragging, setDragging] = useState(null) const [dragging, setDragging] = useState(null)
const [dropIndex, setDropIndex] = useState(null) const [dropIndex, setDropIndex] = useState(null)
const containerRef = useRef(null) const containerRef = useRef(null)
@@ -355,7 +360,7 @@ function FavoritesList({ items, products, onReorder }) {
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/> <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> </svg>
<p style={{ fontSize: 14, color: 'var(--muted)', textAlign: 'center', lineHeight: 1.6 }}> <p style={{ fontSize: 14, color: 'var(--muted)', textAlign: 'center', lineHeight: 1.6 }}>
Δεν έχεις προσθέσει αγαπημένα ακόμα.<br />Πήγαινε στην καρτέλα ΌΛΑ και πάτα την καρδιά δίπλα στα προϊόντα. {t('favSetup.none')}<br />{t('favSetup.noneHow')}
</p> </p>
</div> </div>
) )
@@ -417,6 +422,7 @@ function FavoritesList({ items, products, onReorder }) {
// ── Main page ───────────────────────────────────────────────────────────────── // ── Main page ─────────────────────────────────────────────────────────────────
export default function FavoritesSetupPage() { export default function FavoritesSetupPage() {
const { t } = useTranslation('waiter')
const navigate = useNavigate() const navigate = useNavigate()
const { products, categories } = useProductCache() const { products, categories } = useProductCache()
const { favorites, toggleFavorite, reorderFavorites, itemFavorites, setItemFavorites } = useWaiterFavoritesStore() const { favorites, toggleFavorite, reorderFavorites, itemFavorites, setItemFavorites } = useWaiterFavoritesStore()
@@ -430,19 +436,19 @@ export default function FavoritesSetupPage() {
{/* Header */} {/* Header */}
<header className="top-bar"> <header className="top-bar">
<button className="icon-btn" onClick={() => navigate(-1)}>←</button> <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 }} /> <div style={{ width: 40 }} />
</header> </header>
{/* Tabs */} {/* Tabs */}
<div style={{ display: 'flex', borderBottom: '1px solid var(--border)', flexShrink: 0, background: 'var(--bg)' }}> <div style={{ display: 'flex', borderBottom: '1px solid var(--border)', flexShrink: 0, background: 'var(--bg)' }}>
{[ {[
{ key: 'all', label: 'ΌΛΑ' }, { key: 'all', label: t('favSetup.all') },
{ key: 'favorites', label: `ΑΓΑΠΗΜΈΝΑ (${favorites.length})` }, { key: 'favorites', label: t('favSetup.favorites', { count: favorites.length }) },
].map(t => ( ].map(tb => (
<button <button
key={t.key} key={tb.key}
onClick={() => setTab(t.key)} onClick={() => setTab(tb.key)}
style={{ style={{
flex: 1, padding: '12px 8px', flex: 1, padding: '12px 8px',
background: 'none', border: 'none', cursor: 'pointer', background: 'none', border: 'none', cursor: 'pointer',
+18 -18
View File
@@ -1,6 +1,7 @@
import { useCallback, useEffect, useState } from 'react' import { useCallback, useEffect, useState } from 'react'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { useAccess } from '@xenia/access' import { useAccess } from '@xenia/access'
import { useTranslation } from '@xenia/i18n'
import PinPad from '../components/PinPad' import PinPad from '../components/PinPad'
import useAuthStore from '../store/authStore' import useAuthStore from '../store/authStore'
import client from '../api/client' import client from '../api/client'
@@ -20,6 +21,7 @@ function initialsOf(waiter) {
} }
function WaiterCard({ waiter, onClick }) { function WaiterCard({ waiter, onClick }) {
const { t } = useTranslation('waiter')
return ( return (
<button <button
onClick={onClick} onClick={onClick}
@@ -70,7 +72,7 @@ function WaiterCard({ waiter, onClick }) {
background: '#22c55e', background: '#22c55e',
flexShrink: 0, flexShrink: 0,
boxShadow: '0 0 6px #22c55e88', boxShadow: '0 0 6px #22c55e88',
}} title="Σε βάρδια" /> }} title={t('login.onShift')} />
)} )}
<span style={{ color: 'var(--muted)', fontSize: 18, flexShrink: 0 }}>›</span> <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. // are shown in the user's language.
export default function LoginPage() { export default function LoginPage() {
const { t } = useTranslation('waiter')
const { login, savedUsername } = useAuthStore() const { login, savedUsername } = useAuthStore()
const { login: modes } = useAccess() const { login: modes } = useAccess()
const mode = modes?.waiter_mode || 'pin' 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) login({ id: data.user.id, username: data.user.username, role: data.user.role }, data.access_token)
navigate('/tables', { replace: true }) navigate('/tables', { replace: true })
} catch (err) { } catch (err) {
setError(apiError(err, mode === 'password' ? 'Λανθασμένος κωδικός' : 'Λανθασμένο PIN')) setError(apiError(err, mode === 'password' ? t('login.wrongPassword') : t('login.wrongPin')))
setPassword('') setPassword('')
setAttempt(a => a + 1) setAttempt(a => a + 1)
} finally { } finally {
@@ -150,7 +153,7 @@ export default function LoginPage() {
onClick={() => navigate('/venues')} onClick={() => navigate('/venues')}
style={{ marginTop: 10, background: 'none', border: 'none', color: 'var(--muted)', fontSize: 13, cursor: 'pointer' }} 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> </button>
) )
@@ -161,9 +164,7 @@ export default function LoginPage() {
<div className="login-box" style={{ textAlign: 'center' }} data-testid="login-tap-only"> <div className="login-box" style={{ textAlign: 'center' }} data-testid="login-tap-only">
<h1 className="app-title">XeniaPOS</h1> <h1 className="app-title">XeniaPOS</h1>
<p style={{ color: 'var(--text)', fontSize: 15, lineHeight: 1.5 }}> <p style={{ color: 'var(--text)', fontSize: 15, lineHeight: 1.5 }}>
Σε αυτό το κατάστημα οι σερβιτόροι συνδέονται πατώντας το όνομά τους στις συνδεδεμένες οθόνες. {t('login.tapOnly')}
Από κινητό δεν γίνεται σύνδεση με αυτόν τον τρόπο — ζητήστε από τον διαχειριστή να αλλάξει
τον τρόπο σύνδεσης σε PIN ή κωδικό.
</p> </p>
{venueSwitch} {venueSwitch}
</div> </div>
@@ -184,7 +185,7 @@ export default function LoginPage() {
{/* Static header — never scrolls */} {/* Static header — never scrolls */}
<div style={{ flexShrink: 0, padding: '40px 16px 20px', textAlign: 'center' }}> <div style={{ flexShrink: 0, padding: '40px 16px 20px', textAlign: 'center' }}>
<h1 className="app-title" style={{ marginBottom: 10 }}>Xenia POS</h1> <h1 className="app-title" style={{ marginBottom: 10 }}>Xenia POS</h1>
<p className="app-subtitle">Ποιος είσαι;</p> <p className="app-subtitle">{t('login.whoAreYou')}</p>
{venueSwitch} {venueSwitch}
</div> </div>
@@ -192,21 +193,20 @@ export default function LoginPage() {
<div style={{ flex: 1, overflowY: 'auto', padding: '4px 16px 40px' }}> <div style={{ flex: 1, overflowY: 'auto', padding: '4px 16px 40px' }}>
<div style={{ maxWidth: 480, margin: '0 auto' }}> <div style={{ maxWidth: 480, margin: '0 auto' }}>
{loadingWaiters ? ( {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 ? ( ) : serverUnreachable ? (
<div style={{ textAlign: 'center', padding: 32 }}> <div style={{ textAlign: 'center', padding: 32 }}>
<div style={{ fontSize: 48, marginBottom: 16 }}>🔌</div> <div style={{ fontSize: 48, marginBottom: 16 }}>🔌</div>
<p style={{ fontSize: 17, fontWeight: 700, color: '#ef4444', marginBottom: 8 }}> <p style={{ fontSize: 17, fontWeight: 700, color: '#ef4444', marginBottom: 8 }}>
Δεν βρέθηκε ο Server {t('login.serverNotFound')}
</p> </p>
<p style={{ fontSize: 14, color: 'var(--muted)', lineHeight: 1.6, marginBottom: 24 }}> <p style={{ fontSize: 14, color: 'var(--muted)', lineHeight: 1.6, marginBottom: 24 }}>
Δεν είναι δυνατή η σύνδεση με τον Manager.<br /> {t('login.serverNotFoundBody')}
Δεν μπορεί να ξεκινήσει βάρδια χωρίς σύνδεση.
</p> </p>
<button className="btn btn--secondary" onClick={loadWaiters}>⟳ Επανάληψη</button> <button className="btn btn--secondary" onClick={loadWaiters}>⟳ {t('common.retry')}</button>
</div> </div>
) : waiters.length === 0 ? ( ) : 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' }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 10, alignItems: 'stretch' }}>
{sorted.map(w => ( {sorted.map(w => (
@@ -260,7 +260,7 @@ export default function LoginPage() {
onClick={() => { setSelectedWaiter(null); setError(''); setPassword('') }} onClick={() => { setSelectedWaiter(null); setError(''); setPassword('') }}
style={{ background: 'none', border: 'none', color: 'var(--muted)', cursor: 'pointer', fontSize: 13, padding: '4px 8px' }} style={{ background: 'none', border: 'none', color: 'var(--muted)', cursor: 'pointer', fontSize: 13, padding: '4px 8px' }}
> >
Αλλαγή {t('common.change')}
</button> </button>
</div> </div>
) : ( ) : (
@@ -269,7 +269,7 @@ export default function LoginPage() {
<input <input
value={username} value={username}
onChange={e => setUsername(e.target.value)} onChange={e => setUsername(e.target.value)}
placeholder="Όνομα χρήστη" placeholder={t('login.username')}
autoComplete="username" autoComplete="username"
autoCapitalize="none" autoCapitalize="none"
style={{ ...inputStyle, marginTop: 8 }} style={{ ...inputStyle, marginTop: 8 }}
@@ -287,7 +287,7 @@ export default function LoginPage() {
type="password" type="password"
value={password} value={password}
onChange={e => setPassword(e.target.value)} onChange={e => setPassword(e.target.value)}
placeholder="Κωδικός" placeholder={t('login.password')}
autoComplete="current-password" autoComplete="current-password"
style={inputStyle} style={inputStyle}
data-testid="login-password" data-testid="login-password"
@@ -298,12 +298,12 @@ export default function LoginPage() {
disabled={loading || !password || (!w && !username.trim())} disabled={loading || !password || (!w && !username.trim())}
data-testid="login-submit" data-testid="login-submit"
> >
{loading ? '…' : 'Σύνδεση'} {loading ? '…' : t('login.signIn')}
</button> </button>
</form> </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} /> <PinPad key={attempt} onSubmit={pin => signIn({ pin })} loading={loading} />
</> </>
)} )}
+127 -121
View File
@@ -6,22 +6,23 @@ import useNotificationSettingsStore from '../store/notificationSettingsStore'
import useOrderingSettingsStore from '../store/orderingSettingsStore' import useOrderingSettingsStore from '../store/orderingSettingsStore'
import usePaymentSettingsStore from '../store/paymentSettingsStore' import usePaymentSettingsStore from '../store/paymentSettingsStore'
import useWaiterFavoritesStore from '../store/waiterFavoritesStore' import useWaiterFavoritesStore from '../store/waiterFavoritesStore'
import { useTranslation } from '@xenia/i18n'
const CHIP_STYLE_OPTIONS = [ const CHIP_STYLE_OPTIONS = [
{ key: 'full', label: 'Πλήρες κείμενο', example: 'Εκκρεμούν' }, { key: 'full', label: 'settings.chips.full', example: 'orders.chips.pending' },
{ key: 'short', label: 'Σύντομο κείμενο', example: 'PND' }, { key: 'short', label: 'settings.chips.short', example: 'orders.chips.pendingShort' },
{ key: 'icon_full', label: 'Εικονίδιο + πλήρες', example: '⏳ Εκκρεμούν' }, { key: 'icon_full', label: 'settings.chips.iconFull', example: 'settings.chips.exIconFull' },
{ key: 'icon_short', label: 'Εικονίδιο + σύντομο', example: '⏳ PND' }, { key: 'icon_short', label: 'settings.chips.iconShort', example: 'settings.chips.exIconShort' },
{ key: 'icon', label: 'Μόνο εικονίδιο', example: '⏳' }, { key: 'icon', label: 'settings.chips.icon', example: '⏳' },
] ]
// ─── Tab definitions (stub future tabs here) ────────────────────────────────── // ─── Tab definitions (stub future tabs here) ──────────────────────────────────
const TABS = [ const TABS = [
{ key: 'layout', label: 'Εμφάνιση' }, { key: 'layout', label: 'settings.tabs.layout' },
{ key: 'leitourgia', label: 'Λειτουργία' }, { key: 'leitourgia', label: 'settings.tabs.operation' },
{ key: 'ploigisi', label: 'Πλοήγηση' }, { key: 'ploigisi', label: 'shell.navigation' },
{ key: 'personalize', label: 'Αγαπημένα' }, { key: 'personalize', label: 'settings.tabs.favorites' },
] ]
// ─── Density option data ────────────────────────────────────────────────────── // ─── Density option data ──────────────────────────────────────────────────────
@@ -30,37 +31,37 @@ const DENSITY_OPTIONS = [
{ {
key: '1x1', key: '1x1',
label: '1×1', label: '1×1',
desc: '4 ανά σειρά — μόνο όνομα', desc: 'settings.density.d1x1',
preview: <Grid4 />, preview: <Grid4 />,
}, },
{ {
key: '2x1', key: '2x1',
label: '2×1', label: '2×1',
desc: '2 ανά σειρά — όνομα + κατάσταση', desc: 'settings.density.d2x1',
preview: <Grid2H />, preview: <Grid2H />,
}, },
{ {
key: '2x2', key: '2x2',
label: '2×2', label: '2×2',
desc: '2 ανά σειρά — συμπαγής κάρτα', desc: 'settings.density.d2x2',
preview: <Grid2 />, preview: <Grid2 />,
}, },
{ {
key: '4x1', key: '4x1',
label: '4×1', label: '4×1',
desc: '1 ανά σειρά — οριζόντια λίστα', desc: 'settings.density.d4x1',
preview: <Grid1H />, preview: <Grid1H />,
}, },
{ {
key: '4x2', key: '4x2',
label: '4×2', label: '4×2',
desc: '1 ανά σειρά — πλήρης κάρτα', desc: 'settings.density.d4x2',
preview: <Grid1 />, preview: <Grid1 />,
}, },
{ {
key: '4x3', key: '4x3',
label: '4×3', label: '4×3',
desc: '1 ανά σειρά — κάρτα με λίστα παραγγελίας', desc: 'settings.density.d4x3',
preview: <Grid1Detail />, preview: <Grid1Detail />,
}, },
] ]
@@ -153,22 +154,23 @@ function Grid1Detail() {
const ORDER_ITEM_LAYOUT_OPTIONS = [ const ORDER_ITEM_LAYOUT_OPTIONS = [
{ {
key: 'compact', key: 'compact',
label: 'Compact', label: 'settings.itemLayout.compact',
desc: 'Μία γραμμή — συμπαγής εμφάνιση, λιγότερο ύψος', desc: 'settings.itemLayout.compactDesc',
}, },
{ {
key: 'expanded', key: 'expanded',
label: 'Expanded', label: 'settings.itemLayout.expanded',
desc: 'Δύο γραμμές — όνομα + KDS πάνω, τιμολόγηση κάτω', desc: 'settings.itemLayout.expandedDesc',
}, },
{ {
key: 'fully_detailed', key: 'fully_detailed',
label: 'Fully Detailed', label: 'settings.itemLayout.full',
desc: 'Πλήρης ανάλυση — όνομα, τιμές, σερβιτόρος, ώρα, options', desc: 'settings.itemLayout.fullDesc',
}, },
] ]
function LayoutTab() { function LayoutTab() {
const { t } = useTranslation('waiter')
const { density, setDensity, chipStyle, setChipStyle, kdsDisplayStyle, setKdsDisplayStyle, orderItemLayout, setOrderItemLayout, mergePersist, setMergePersist } = useTableViewStore() const { density, setDensity, chipStyle, setChipStyle, kdsDisplayStyle, setKdsDisplayStyle, orderItemLayout, setOrderItemLayout, mergePersist, setMergePersist } = useTableViewStore()
const { dark, toggle } = useThemeStore() const { dark, toggle } = useThemeStore()
@@ -177,8 +179,8 @@ function LayoutTab() {
{/* Chip style */} {/* Chip style */}
<section> <section>
<h2 style={sectionTitle}>Εμφάνιση chips παραγγελιών</h2> <h2 style={sectionTitle}>{t('settings.chips.title')}</h2>
<p style={sectionSub}>Πώς εμφανίζονται τα φίλτρα στη σελίδα Παραγγελίες.</p> <p style={sectionSub}>{t('settings.chips.sub')}</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}>
{CHIP_STYLE_OPTIONS.map(opt => { {CHIP_STYLE_OPTIONS.map(opt => {
const active = (chipStyle || 'icon_short') === opt.key const active = (chipStyle || 'icon_short') === opt.key
@@ -197,9 +199,9 @@ function LayoutTab() {
> >
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}> <div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}>
{opt.label} {t(opt.label)}
</div> </div>
<div style={{ fontSize: 12, color: 'var(--muted)' }}>{opt.example}</div> <div style={{ fontSize: 12, color: 'var(--muted)' }}>{t(opt.example)}</div>
</div> </div>
{active && ( {active && (
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" style={{ flexShrink: 0, color: 'var(--accent)' }}> <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 */} {/* Card density */}
<section> <section>
<h2 style={sectionTitle}>Κάρτες τραπεζιών</h2> <h2 style={sectionTitle}>{t('settings.density.title')}</h2>
<p style={sectionSub}>Επίλεξε πόσα στοιχεία εμφανίζονται σε κάθε κάρτα.</p> <p style={sectionSub}>{t('settings.density.sub')}</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: 10, marginTop: 14 }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 10, marginTop: 14 }}>
{DENSITY_OPTIONS.map(opt => { {DENSITY_OPTIONS.map(opt => {
@@ -252,10 +254,10 @@ function LayoutTab() {
color: active ? 'var(--accent)' : 'var(--text)', color: active ? 'var(--accent)' : 'var(--text)',
marginBottom: 2, marginBottom: 2,
}}> }}>
{opt.label} {t(opt.label)}
</div> </div>
<div style={{ fontSize: 13, color: 'var(--muted)', lineHeight: 1.4 }}> <div style={{ fontSize: 13, color: 'var(--muted)', lineHeight: 1.4 }}>
{opt.desc} {t(opt.desc)}
</div> </div>
</div> </div>
@@ -274,12 +276,12 @@ function LayoutTab() {
{/* KDS status display */} {/* KDS status display */}
<section> <section>
<h2 style={sectionTitle}>Εμφάνιση Κατάστασης KDS</h2> <h2 style={sectionTitle}>{t('settings.kds.title')}</h2>
<p style={sectionSub}>Πώς εμφανίζεται η κατάσταση KDS σε κάθε αντικείμενο παραγγελίας.</p> <p style={sectionSub}>{t('settings.kds.sub')}</p>
<div style={{ display: 'flex', gap: 10, marginTop: 14 }}> <div style={{ display: 'flex', gap: 10, marginTop: 14 }}>
{[ {[
{ key: 'badge', label: 'Badge', desc: 'Κείμενο σε chip (ΕΚΚΡΕΜΕΙ, READY…)' }, { key: 'badge', label: 'settings.kds.badge', desc: 'settings.kds.badgeDesc' },
{ key: 'icon', label: 'Εικονίδιο', desc: 'Μικρό χρωματιστό εικονίδιο — λιγότερος χώρος' }, { key: 'icon', label: 'settings.kds.icon', desc: 'settings.kds.iconDesc' },
].map(opt => { ].map(opt => {
const active = (kdsDisplayStyle || 'badge') === opt.key const active = (kdsDisplayStyle || 'badge') === opt.key
return ( return (
@@ -295,8 +297,8 @@ function LayoutTab() {
transition: 'border-color 0.12s, background 0.12s', 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: 13, fontWeight: 800, color: active ? 'var(--accent)' : 'var(--text)' }}>{t(opt.label)}</span>
<span style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.4 }}>{opt.desc}</span> <span style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.4 }}>{t(opt.desc)}</span>
</button> </button>
) )
})} })}
@@ -305,8 +307,8 @@ function LayoutTab() {
{/* Order item layout */} {/* Order item layout */}
<section> <section>
<h2 style={sectionTitle}>Layout Αντικειμένων Παραγγελίας</h2> <h2 style={sectionTitle}>{t('settings.itemLayout.title')}</h2>
<p style={sectionSub}>Πώς εμφανίζεται κάθε αντικείμενο στη λίστα παραγγελίας ενός τραπεζιού.</p> <p style={sectionSub}>{t('settings.itemLayout.sub')}</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}>
{ORDER_ITEM_LAYOUT_OPTIONS.map(opt => { {ORDER_ITEM_LAYOUT_OPTIONS.map(opt => {
const active = (orderItemLayout || 'compact') === opt.key const active = (orderItemLayout || 'compact') === opt.key
@@ -325,9 +327,9 @@ function LayoutTab() {
> >
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}> <div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}>
{opt.label} {t(opt.label)}
</div> </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> </div>
{active && ( {active && (
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" style={{ flexShrink: 0, color: 'var(--accent)' }}> <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 */} {/* Merge view persistence */}
<section> <section>
<h2 style={sectionTitle}>Διατήρηση Προβολής Συγχώνευσης</h2> <h2 style={sectionTitle}>{t('settings.merge.title')}</h2>
<p style={sectionSub}>Πόσο διατηρείται η επιλεγμένη προβολή συγχώνευσης αντικειμένων.</p> <p style={sectionSub}>{t('settings.merge.sub')}</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}>
{[ {[
{ key: 'off', label: 'OFF', desc: 'Επαναφορά στην αρχική κατά την πλοήγηση' }, { key: 'off', label: 'settings.merge.off', desc: 'settings.merge.offDesc' },
{ key: 'per_order', label: 'ΔΙΑΤΗΡΗΣΗ ΑΝΑ ΠΑΡΑΓΓΕΛΙΑ', desc: 'Διατηρείται μέχρι το κλείσιμο της παραγγελίας' }, { key: 'per_order', label: 'settings.merge.perOrder', desc: 'settings.merge.perOrderDesc' },
{ key: 'global', label: 'ΔΙΑΤΗΡΗΣΗ ΠΑΝΤΑ', desc: 'Ίδια ρύθμιση για όλα τα τραπέζια, πάντα' }, { key: 'global', label: 'settings.merge.global', desc: 'settings.merge.globalDesc' },
].map(opt => { ].map(opt => {
const active = (mergePersist || 'off') === opt.key const active = (mergePersist || 'off') === opt.key
return ( return (
@@ -366,8 +368,8 @@ function LayoutTab() {
}} }}
> >
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}>{opt.label}</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)' }}>{opt.desc}</div> <div style={{ fontSize: 12, color: 'var(--muted)' }}>{t(opt.desc)}</div>
</div> </div>
{active && ( {active && (
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" style={{ flexShrink: 0, color: 'var(--accent)' }}> <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 */} {/* Theme */}
<section> <section>
<h2 style={sectionTitle}>Θέμα</h2> <h2 style={sectionTitle}>{t('settings.theme.title')}</h2>
<div style={{ display: 'flex', gap: 10, marginTop: 14 }}> <div style={{ display: 'flex', gap: 10, marginTop: 14 }}>
{[ {[
{ key: false, icon: '☀️', label: 'Φωτεινό' }, { key: false, icon: '☀️', label: 'settings.theme.light' },
{ key: true, icon: '🌙', label: 'Σκοτεινό' }, { key: true, icon: '🌙', label: 'settings.theme.dark' },
].map(opt => { ].map(opt => {
const active = dark === opt.key const active = dark === opt.key
return ( return (
@@ -410,7 +412,7 @@ function LayoutTab() {
<span style={{ <span style={{
fontSize: 14, fontWeight: 600, fontSize: 14, fontWeight: 600,
color: active ? 'var(--accent)' : 'var(--muted)', color: active ? 'var(--accent)' : 'var(--muted)',
}}>{opt.label}</span> }}>{t(opt.label)}</span>
</button> </button>
) )
})} })}
@@ -428,23 +430,23 @@ const sectionSub = {
fontSize: 14, color: 'var(--muted)', lineHeight: 1.5, fontSize: 14, color: 'var(--muted)', lineHeight: 1.5,
} }
// ─── Λειτουργία tab ────────────────────────────────────────────────────────── // ─── Operation tab ──────────────────────────────────────────────────────────
const POPUP_MODE_OPTIONS = [ const POPUP_MODE_OPTIONS = [
{ {
key: 'all', key: 'all',
label: 'Popup Everything', label: 'settings.popup.all',
desc: 'Εμφανίζεται popup για κάθε ειδοποίηση (KDS, μηνύματα, κλπ.)', desc: 'settings.popup.allDesc',
}, },
{ {
key: 'manager_only', key: 'manager_only',
label: 'Popup μόνο για μηνύματα διαχειριστή', label: 'settings.popup.manager',
desc: 'KDS ειδοποιήσεις αποθηκεύονται στο κουδούνι χωρίς popup.', desc: 'settings.popup.managerDesc',
}, },
{ {
key: 'never', key: 'never',
label: 'Never Popup', label: 'settings.popup.never',
desc: 'Καμία αναδυόμενη ειδοποίηση. Ανοίξτε το κουδούνι για να τις δείτε — και θα σβηστούν αυτόματα.', desc: 'settings.popup.neverDesc',
}, },
] ]
@@ -482,22 +484,23 @@ function ToggleRow({ label, desc, checked, onChange }) {
const PAYMENT_SAFETY_OPTIONS = [ const PAYMENT_SAFETY_OPTIONS = [
{ {
key: 'off', key: 'off',
label: 'Απενεργοποιημένο', label: 'settings.paySafety.off',
desc: 'Η πληρωμή επιβεβαιώνεται με ένα απλό πάτημα.', desc: 'settings.paySafety.offDesc',
}, },
{ {
key: 'second_confirm', key: 'second_confirm',
label: 'Δεύτερη Επιβεβαίωση', label: 'settings.paySafety.second',
desc: 'Μετά την επιβεβαίωση πληρωμής, εμφανίζεται ένα επιπλέον παράθυρο ασφαλείας πριν ολοκληρωθεί η πληρωμή.', desc: 'settings.paySafety.secondDesc',
}, },
{ {
key: 'long_press', key: 'long_press',
label: 'Παρατεταμένο Πάτημα', label: 'settings.paySafety.hold',
desc: 'Για να επιβεβαιωθεί η πληρωμή, πρέπει να κρατήσετε πατημένο το κουμπί για ~1 δευτερόλεπτο.', desc: 'settings.paySafety.holdDesc',
}, },
] ]
function LeitourgiaTab() { function LeitourgiaTab() {
const { t } = useTranslation('waiter')
const { popupMode, persistentPopup, setPopupMode, setPersistentPopup } = useNotificationSettingsStore() const { popupMode, persistentPopup, setPopupMode, setPersistentPopup } = useNotificationSettingsStore()
const { summaryBeforeSend, setSummaryBeforeSend } = useOrderingSettingsStore() const { summaryBeforeSend, setSummaryBeforeSend } = useOrderingSettingsStore()
const { paymentSafety, setPaymentSafety } = usePaymentSettingsStore() const { paymentSafety, setPaymentSafety } = usePaymentSettingsStore()
@@ -507,8 +510,8 @@ function LeitourgiaTab() {
{/* Popup mode */} {/* Popup mode */}
<section> <section>
<h2 style={sectionTitle}>Στυλ ειδοποιήσεων</h2> <h2 style={sectionTitle}>{t('settings.popup.title')}</h2>
<p style={sectionSub}>Πότε εμφανίζονται αναδυόμενα banners κατά την παραλαβή ειδοποίησης.</p> <p style={sectionSub}>{t('settings.popup.sub')}</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}>
{POPUP_MODE_OPTIONS.map(opt => { {POPUP_MODE_OPTIONS.map(opt => {
const active = popupMode === opt.key const active = popupMode === opt.key
@@ -527,9 +530,9 @@ function LeitourgiaTab() {
> >
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}> <div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}>
{opt.label} {t(opt.label)}
</div> </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> </div>
{active && ( {active && (
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" style={{ flexShrink: 0, color: 'var(--accent)' }}> <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 */} {/* Persistent popup */}
<section> <section>
<h2 style={sectionTitle}>Επιμονή Popup</h2> <h2 style={sectionTitle}>{t('settings.persist.title')}</h2>
<p style={sectionSub}> <p style={sectionSub}>
{persistentPopup {persistentPopup
? 'Τα popups παραμένουν μέχρι να πατήσετε OK.' ? t('settings.persist.on')
: 'Τα popups κλείνουν αυτόματα μετά από 3 δευτερόλεπτα και η ειδοποίηση σβήνεται αμέσως κατά την παραλαβή.'} : t('settings.persist.off')}
</p> </p>
<div style={{ marginTop: 14 }}> <div style={{ marginTop: 14 }}>
<ToggleRow <ToggleRow
label="Persistent Popup" label={t('settings.persist.label')}
desc={persistentPopup ? 'Ενεργό — απαιτεί χειροκίνητο κλείσιμο' : 'Ανενεργό — αυτόματο κλείσιμο σε 3 δευτ.'} desc={persistentPopup ? t('settings.persist.onDesc') : t('settings.persist.offDesc')}
checked={persistentPopup} checked={persistentPopup}
onChange={() => setPersistentPopup(!persistentPopup)} onChange={() => setPersistentPopup(!persistentPopup)}
/> />
@@ -563,14 +566,14 @@ function LeitourgiaTab() {
{/* Summary before send */} {/* Summary before send */}
<section> <section>
<h2 style={sectionTitle}>Σύνοψη πριν την Αποστολή</h2> <h2 style={sectionTitle}>{t('settings.summary.title')}</h2>
<p style={sectionSub}> <p style={sectionSub}>
Αντί για απευθείας αποστολή, εμφανίζεται πρώτα σελίδα επισκόπησης με όλα τα προϊόντα, τις επιλογές, και τη σημείωση παραγγελίας. {t('settings.summary.sub')}
</p> </p>
<div style={{ marginTop: 14 }}> <div style={{ marginTop: 14 }}>
<ToggleRow <ToggleRow
label="Σύνοψη + Αποστολή" label={t('settings.summary.label')}
desc={summaryBeforeSend ? 'Ενεργό — εμφανίζεται modal επισκόπησης πριν την αποστολή' : 'Ανενεργό — άμεση αποστολή'} desc={summaryBeforeSend ? t('settings.summary.onDesc') : t('settings.summary.offDesc')}
checked={summaryBeforeSend} checked={summaryBeforeSend}
onChange={() => setSummaryBeforeSend(!summaryBeforeSend)} onChange={() => setSummaryBeforeSend(!summaryBeforeSend)}
/> />
@@ -579,9 +582,9 @@ function LeitourgiaTab() {
{/* Payment safety switch */} {/* Payment safety switch */}
<section> <section>
<h2 style={sectionTitle}>Ασφάλεια Πληρωμών</h2> <h2 style={sectionTitle}>{t('settings.paySafety.title')}</h2>
<p style={sectionSub}> <p style={sectionSub}>
Προσθέτει ένα επιπλέον βήμα επιβεβαίωσης για να αποφύγετε τυχαίες πληρωμές. Ακόμα κι αν κάνετε λάθος, ο διαχειριστής μπορεί να ενεργοποιήσει την αναίρεση πληρωμής. {t('settings.paySafety.sub')}
</p> </p>
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginTop: 14 }}>
{PAYMENT_SAFETY_OPTIONS.map(opt => { {PAYMENT_SAFETY_OPTIONS.map(opt => {
@@ -601,9 +604,9 @@ function LeitourgiaTab() {
> >
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}> <div style={{ fontSize: 15, fontWeight: 700, color: active ? 'var(--accent)' : 'var(--text)', marginBottom: 2 }}>
{opt.label} {t(opt.label)}
</div> </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> </div>
{active && ( {active && (
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" style={{ flexShrink: 0, color: 'var(--accent)' }}> <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() { function PersonalizeTab() {
const { t } = useTranslation('waiter')
const navigate = useNavigate() const navigate = useNavigate()
const { favorites, resetAll } = useWaiterFavoritesStore() const { favorites, resetAll } = useWaiterFavoritesStore()
const [confirmReset, setConfirmReset] = useState(false) const [confirmReset, setConfirmReset] = useState(false)
@@ -639,11 +643,11 @@ function PersonalizeTab() {
{/* Favorites setup */} {/* Favorites setup */}
<section> <section>
<h2 style={sectionTitle}>Αγαπημένα Προϊόντα</h2> <h2 style={sectionTitle}>{t('settings.fav.title')}</h2>
<p style={sectionSub}> <p style={sectionSub}>
{favorites.length > 0 {favorites.length > 0
? `${favorites.length} αγαπημένα ενεργά — εμφανίζονται ως πρώτη κατηγορία στο ProductPicker.` ? t('settings.fav.count', { count: favorites.length })
: 'Δεν έχεις ορίσει αγαπημένα ακόμα. Πάτα παρακάτω για να ξεκινήσεις.'} : t('settings.fav.none')}
</p> </p>
<div style={{ marginTop: 14 }}> <div style={{ marginTop: 14 }}>
<button <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"/> <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> </svg>
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<div style={{ fontSize: 15, fontWeight: 700, color: 'var(--accent)' }}>Ρύθμιση Αγαπημένων</div> <div style={{ fontSize: 15, fontWeight: 700, color: 'var(--accent)' }}>{t('settings.fav.setup')}</div>
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>Επίλεξε προϊόντα και άλλαξε σειρά εμφάνισης</div> <div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>{t('settings.fav.setupSub')}</div>
</div> </div>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" style={{ color: 'var(--accent)', flexShrink: 0 }}> <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"/> <path d="M9 18l6-6-6-6" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"/>
@@ -672,11 +676,11 @@ function PersonalizeTab() {
{/* Reset all */} {/* Reset all */}
<section> <section>
<h2 style={sectionTitle}>Επαναφορά</h2> <h2 style={sectionTitle}>{t('settings.reset.title')}</h2>
<p style={sectionSub}> <p style={sectionSub}>
{confirmReset {confirmReset
? 'Είσαι σίγουρος; Αυτή η ενέργεια δεν μπορεί να αναιρεθεί.' ? t('settings.reset.sure')
: 'Διαγράφει όλα τα αγαπημένα και επαναφέρει τις προτιμήσεις στις εργοστασιακές τιμές.'} : t('settings.reset.sub')}
</p> </p>
<div style={{ marginTop: 14 }}> <div style={{ marginTop: 14 }}>
<button <button
@@ -696,9 +700,9 @@ function PersonalizeTab() {
</svg> </svg>
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<div style={{ fontSize: 15, fontWeight: 700, color: confirmReset ? 'var(--danger)' : 'var(--text)' }}> <div style={{ fontSize: 15, fontWeight: 700, color: confirmReset ? 'var(--danger)' : 'var(--text)' }}>
{confirmReset ? 'Πάτα ξανά για επιβεβαίωση' : 'Επαναφορά Όλων'} {confirmReset ? t('settings.reset.again') : t('settings.reset.all')}
</div> </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> </div>
</button> </button>
</div> </div>
@@ -708,12 +712,12 @@ function PersonalizeTab() {
) )
} }
// ─── Πλοήγηση tab ───────────────────────────────────────────────────────────── // ─── Navigation tab ─────────────────────────────────────────────────────────────
const ALL_NAV_ITEMS = [ const ALL_NAV_ITEMS = [
{ {
key: 'tables', key: 'tables',
label: 'Τραπέζια', label: 'nav.tables',
icon: ( icon: (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none"> <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"/> <rect x="3" y="3" width="7" height="7" rx="1.5" fill="currentColor"/>
@@ -725,7 +729,7 @@ const ALL_NAV_ITEMS = [
}, },
{ {
key: 'orders', key: 'orders',
label: 'Παραγγελίες', label: 'nav.orders',
icon: ( icon: (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none"> <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"/> <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', key: 'messages',
label: 'Chat', label: 'nav.chat',
icon: ( icon: (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none"> <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"/> <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', key: 'standalone',
label: 'Takeaway', label: 'nav.takeaway',
icon: ( icon: (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none"> <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"/> <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', key: 'shift-overview',
label: 'Βάρδια', label: 'nav.shift',
icon: ( icon: (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none"> <svg width="20" height="20" viewBox="0 0 24 24" fill="none">
<circle cx="12" cy="12" r="9" stroke="currentColor" strokeWidth="2"/> <circle cx="12" cy="12" r="9" stroke="currentColor" strokeWidth="2"/>
@@ -765,7 +769,7 @@ const ALL_NAV_ITEMS = [
}, },
{ {
key: 'order-log', key: 'order-log',
label: 'Αρχείο', label: 'nav.log',
icon: ( icon: (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none"> <svg width="20" height="20" viewBox="0 0 24 24" fill="none">
<path d="M6 9V2h12v7" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/> <path d="M6 9V2h12v7" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
@@ -806,6 +810,7 @@ function Checkbox({ checked }) {
} }
function PloigisiTab() { function PloigisiTab() {
const { t } = useTranslation('waiter')
const { navStyle, setNavStyle, navItems, setNavItems, tripleItems, setTripleItems } = useTableViewStore() const { navStyle, setNavStyle, navItems, setNavItems, tripleItems, setTripleItems } = useTableViewStore()
const NAV_MAP = Object.fromEntries(ALL_NAV_ITEMS.map(i => [i.key, i])) const NAV_MAP = Object.fromEntries(ALL_NAV_ITEMS.map(i => [i.key, i]))
@@ -917,12 +922,12 @@ function PloigisiTab() {
{/* Nav style picker */} {/* Nav style picker */}
<section> <section>
<h2 style={sectionTitle}>Στυλ γραμμής πλοήγησης</h2> <h2 style={sectionTitle}>{t('settings.navStyle.title')}</h2>
<p style={sectionSub}>Πώς εμφανίζεται η γραμμή πλοήγησης στο κάτω μέρος της οθόνης.</p> <p style={sectionSub}>{t('settings.navStyle.sub')}</p>
<div style={{ display: 'flex', gap: 10, marginTop: 14 }}> <div style={{ display: 'flex', gap: 10, marginTop: 14 }}>
{[ {[
{ key: 'triple', label: 'Triple Pill', desc: 'Σταθερά 3 κουμπιά με εικονίδιο + κείμενο σε pill μορφή' }, { key: 'triple', label: 'settings.navStyle.triple', desc: 'settings.navStyle.tripleDesc' },
{ key: 'icon_navbar', label: 'Icon Navbar', desc: 'Android-style με 1–5 εικονίδια που μπορείτε να διαμορφώσετε' }, { key: 'icon_navbar', label: 'settings.navStyle.icons', desc: 'settings.navStyle.iconsDesc' },
].map(opt => { ].map(opt => {
const active = navStyle === opt.key const active = navStyle === opt.key
return ( return (
@@ -939,8 +944,8 @@ function PloigisiTab() {
transition: 'border-color 0.12s, background 0.12s', 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: 13, fontWeight: 800, color: active ? 'var(--accent)' : 'var(--text)' }}>{t(opt.label)}</span>
<span style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.4 }}>{opt.desc}</span> <span style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.4 }}>{t(opt.desc)}</span>
</button> </button>
) )
})} })}
@@ -950,8 +955,8 @@ function PloigisiTab() {
{/* Triple Pill item editor */} {/* Triple Pill item editor */}
{navStyle === 'triple' && ( {navStyle === 'triple' && (
<section> <section>
<h2 style={sectionTitle}>Στοιχεία Triple Pill</h2> <h2 style={sectionTitle}>{t('settings.triple.title')}</h2>
<p style={sectionSub}>Επίλεξε ακριβώς 3 κουμπιά και σύρε για να αλλάξεις τη σειρά τους.</p> <p style={sectionSub}>{t('settings.triple.sub')}</p>
<div <div
style={{ display: 'flex', flexDirection: 'column', gap: 0, marginTop: 14 }} style={{ display: 'flex', flexDirection: 'column', gap: 0, marginTop: 14 }}
@@ -986,7 +991,7 @@ function PloigisiTab() {
> >
<DragHandle /> <DragHandle />
<span style={{ color: 'var(--accent)', flexShrink: 0 }}>{item.icon}</span> <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 <button
onClick={() => toggleTripleItem(item.key)} onClick={() => toggleTripleItem(item.key)}
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 0 }} 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={{ display: 'flex', alignItems: 'center', gap: 10, padding: '4px 0', margin: '4px 0 8px' }}>
<div style={{ flex: 1, height: 1, background: 'var(--border)' }} /> <div style={{ flex: 1, height: 1, background: 'var(--border)' }} />
<span style={{ fontSize: 11, color: 'var(--muted)', fontWeight: 700, textTransform: 'uppercase', letterSpacing: 0.8 }}> <span style={{ fontSize: 11, color: 'var(--muted)', fontWeight: 700, textTransform: 'uppercase', letterSpacing: 0.8 }}>
Διαθέσιμα {t('settings.available')}
</span> </span>
<div style={{ flex: 1, height: 1, background: 'var(--border)' }} /> <div style={{ flex: 1, height: 1, background: 'var(--border)' }} />
</div> </div>
@@ -1026,7 +1031,7 @@ function PloigisiTab() {
> >
<span style={{ width: 20, flexShrink: 0 }} /> <span style={{ width: 20, flexShrink: 0 }} />
<span style={{ color: 'var(--muted)', flexShrink: 0 }}>{item.icon}</span> <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 <button
onClick={() => toggleTripleItem(item.key)} 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 }} 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 }}> <p style={{ fontSize: 12, color: 'var(--muted)', marginTop: 4, lineHeight: 1.5 }}>
{tripleItems.length}/3 κουμπιά ενεργά {t('settings.triple.count', { count: tripleItems.length })}
{tripleItems.length >= 3 ? ' — μέγιστο' : ''} {tripleItems.length >= 3 ? ` — ${t('settings.max')}` : ''}
</p> </p>
</section> </section>
)} )}
@@ -1048,8 +1053,8 @@ function PloigisiTab() {
{/* Icon navbar item editor */} {/* Icon navbar item editor */}
{navStyle === 'icon_navbar' && ( {navStyle === 'icon_navbar' && (
<section> <section>
<h2 style={sectionTitle}>Στοιχεία Icon Navbar</h2> <h2 style={sectionTitle}>{t('settings.icons.title')}</h2>
<p style={sectionSub}>Επίλεξε ποια εικονίδια εμφανίζονται (1–5). Σύρε για να αλλάξεις τη σειρά.</p> <p style={sectionSub}>{t('settings.icons.sub')}</p>
<div <div
style={{ display: 'flex', flexDirection: 'column', gap: 0, marginTop: 14 }} style={{ display: 'flex', flexDirection: 'column', gap: 0, marginTop: 14 }}
@@ -1088,7 +1093,7 @@ function PloigisiTab() {
> >
<DragHandle /> <DragHandle />
<span style={{ color: 'var(--accent)', flexShrink: 0 }}>{item.icon}</span> <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 <button
onClick={() => toggleItem(item.key)} onClick={() => toggleItem(item.key)}
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 0 }} 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={{ display: 'flex', alignItems: 'center', gap: 10, padding: '4px 0', marginBottom: 8 }}>
<div style={{ flex: 1, height: 1, background: 'var(--border)' }} /> <div style={{ flex: 1, height: 1, background: 'var(--border)' }} />
<span style={{ fontSize: 11, color: 'var(--muted)', fontWeight: 700, textTransform: 'uppercase', letterSpacing: 0.8 }}> <span style={{ fontSize: 11, color: 'var(--muted)', fontWeight: 700, textTransform: 'uppercase', letterSpacing: 0.8 }}>
Διαθέσιμα {t('settings.available')}
</span> </span>
<div style={{ flex: 1, height: 1, background: 'var(--border)' }} /> <div style={{ flex: 1, height: 1, background: 'var(--border)' }} />
</div> </div>
@@ -1131,7 +1136,7 @@ function PloigisiTab() {
> >
<span style={{ width: 20, flexShrink: 0 }} /> <span style={{ width: 20, flexShrink: 0 }} />
<span style={{ color: 'var(--muted)', flexShrink: 0 }}>{item.icon}</span> <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 <button
onClick={() => toggleItem(item.key)} onClick={() => toggleItem(item.key)}
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 0 }} style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 0 }}
@@ -1143,8 +1148,8 @@ function PloigisiTab() {
</div> </div>
<p style={{ fontSize: 12, color: 'var(--muted)', marginTop: 4, lineHeight: 1.5 }}> <p style={{ fontSize: 12, color: 'var(--muted)', marginTop: 4, lineHeight: 1.5 }}>
{navItems.length}/5 εικονίδια ενεργά {t('settings.icons.count', { count: navItems.length })}
{navItems.length >= 5 ? ' — μέγιστο' : ''} {navItems.length >= 5 ? ` — ${t('settings.max')}` : ''}
</p> </p>
</section> </section>
)} )}
@@ -1156,6 +1161,7 @@ function PloigisiTab() {
// ─── Main page ──────────────────────────────────────────────────────────────── // ─── Main page ────────────────────────────────────────────────────────────────
export default function SettingsPage() { export default function SettingsPage() {
const { t } = useTranslation('waiter')
const navigate = useNavigate() const navigate = useNavigate()
const [activeTab, setActiveTab] = useState('layout') 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"> <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"/> <path d="M12.5 15l-5-5 5-5" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"/>
</svg> </svg>
Πίσω {t('common.back')}
</button> </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 */} {/* spacer to balance the back button */}
<div style={{ width: 72 }} /> <div style={{ width: 72 }} />
</header> </header>
@@ -1208,7 +1214,7 @@ export default function SettingsPage() {
transition: 'color 0.12s', transition: 'color 0.12s',
}} }}
> >
{tab.label} {t(tab.label)}
</button> </button>
))} ))}
</div> </div>
+80 -71
View File
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState, useCallback } from 'react' import { useEffect, useRef, useState, useCallback } from 'react'
import { useAllowed } from '@xenia/access' import { useAllowed } from '@xenia/access'
import { useFormat, useTranslation } from '@xenia/i18n'
import { useNavigate, useSearchParams } from 'react-router-dom' import { useNavigate, useSearchParams } from 'react-router-dom'
import TableCard from '../components/TableCard' import TableCard from '../components/TableCard'
import useAuthStore from '../store/authStore' import useAuthStore from '../store/authStore'
@@ -11,7 +12,6 @@ import { getVenueSettings } from '../api/venueSettings'
import db from '../db/posdb' import db from '../db/posdb'
import { FlagsIcon, TransferIcon, MergeIcon, PrintIcon, WaiterIcon } from '../components/Icons' 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' } const _UNIT_LABELS = { kg: 'kg', liter: 'L', gram: 'g', ml: 'mL' }
function fmtItemQty(qty, unitType) { function fmtItemQty(qty, unitType) {
@@ -44,14 +44,16 @@ function CheckIcon({ width = 18, height = 18 }) {
} }
const QUICK_ACTIONS = [ const QUICK_ACTIONS = [
{ Icon: FlagsIcon, label: 'Ενδείξεις Τραπεζιού', key: 'flags', color: '#fac823', iconBg: 'rgba(251,191,36,0.15)' }, { Icon: FlagsIcon, label: 'tables.actions.flags', 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: TransferIcon, label: 'tables.actions.transfer', 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: MergeIcon, label: 'tables.actions.merge', 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: PrintIcon, label: 'tables.actions.printSynopsis', 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: 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 }) { 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 tableName = table.label || `T${table.number}`
const activeItems = order?.items?.filter(i => i.status === 'active') || [] const activeItems = order?.items?.filter(i => i.status === 'active') || []
const total = activeItems.reduce((s, i) => s + i.unit_price * i.quantity, 0) 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 due = Math.max(0, total - paid)
const statusLabel = { const statusLabel = {
open: 'Ανοιχτό', partially_paid: 'Μερικώς πληρωμένο', paid: 'Πληρωμένο', open: t('tables.status.open'), partially_paid: t('tables.status.partlyPaid'), paid: t('tables.status.paid'),
}[order?.status] || 'Ελεύθερο' }[order?.status] || t('tables.status.free')
return ( return (
<div className="modal-overlay" onClick={onClose}> <div className="modal-overlay" onClick={onClose}>
@@ -74,22 +76,22 @@ function TableQuickModal({ table, order, flags, onClose, onNavigate, onAction, o
{order ? ( {order ? (
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, marginBottom: 12 }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 6, marginBottom: 12 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 14 }}> <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> <span style={{ fontWeight: 600, color: 'var(--text)' }}>{fmtPrice(total)}</span>
</div> </div>
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 14 }}> <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> <span style={{ fontWeight: 600, color: '#22c55e' }}>{fmtPrice(paid)}</span>
</div> </div>
{due > 0 && ( {due > 0 && (
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 14 }}> <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> <span style={{ fontWeight: 700, color: '#f59e0b' }}>{fmtPrice(due)}</span>
</div> </div>
)} )}
</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 && ( {flags.length > 0 && (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}> <div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
@@ -107,7 +109,7 @@ function TableQuickModal({ table, order, flags, onClose, onNavigate, onAction, o
</div> </div>
)} )}
<button className="btn btn--primary" style={{ width: '100%', marginTop: 14 }} onClick={() => { onClose(); onNavigate() }}> <button className="btn btn--primary" style={{ width: '100%', marginTop: 14 }} onClick={() => { onClose(); onNavigate() }}>
Άνοιγμα τραπεζιού {t('tables.quick.openTable')}
</button> </button>
</div> </div>
<div style={{ background: 'var(--bg2)', borderRadius: '0 0 16px 16px', padding: '8px 20px 24px', borderTop: '2px solid var(--border)' }}> <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 }}> <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" /> <a.Icon width="18" height="18" />
</span> </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>} {!disabled && <span style={{ marginLeft: 'auto', color: 'var(--muted)', fontSize: 18 }}>›</span>}
</button> </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' }}> <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" /> <CheckIcon width="18" height="18" />
</span> </span>
<span style={{ fontSize: 15, fontWeight: 600, color: '#4ade80' }}>Σήμανση Όλων ως Παραδοθέντα</span> <span style={{ fontSize: 15, fontWeight: 600, color: '#4ade80' }}>{t('tables.quick.markAllServed')}</span>
</button> </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"/> <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> </svg>
</span> </span>
<span style={{ fontSize: 15, fontWeight: 600, color: colour }}>Ακύρωση Παραγγελίας</span> <span style={{ fontSize: 15, fontWeight: 600, color: colour }}>{t('tables.quick.cancelOrder')}</span>
</button> </button>
) )
})()} })()}
@@ -187,6 +189,7 @@ function TableQuickModal({ table, order, flags, onClose, onNavigate, onAction, o
// ─── Filters modal ──────────────────────────────────────────────────────────── // ─── Filters modal ────────────────────────────────────────────────────────────
function FiltersModal({ groups, onClose }) { function FiltersModal({ groups, onClose }) {
const { t } = useTranslation('waiter')
const { const {
ownerFilter, statusFilter, zoneFilter, ownerFilter, statusFilter, zoneFilter,
setOwnerFilter, setStatusFilter, setZoneFilter, setOwnerFilter, setStatusFilter, setZoneFilter,
@@ -214,22 +217,22 @@ function FiltersModal({ groups, onClose }) {
<div className="modal-handle" /> <div className="modal-handle" />
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}> <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 && ( {hasActiveFilters && (
<button <button
onClick={() => { clearFilters(); onClose() }} onClick={() => { clearFilters(); onClose() }}
style={{ fontSize: 13, fontWeight: 600, color: 'var(--danger)', background: 'none', border: 'none', cursor: 'pointer', padding: '4px 8px' }} style={{ fontSize: 13, fontWeight: 600, color: 'var(--danger)', background: 'none', border: 'none', cursor: 'pointer', padding: '4px 8px' }}
> >
Καθαρισμός {t('common.clear')}
</button> </button>
)} )}
</div> </div>
{/* Owner: ALL | MINE */} {/* Owner: ALL | MINE */}
<div> <div>
<p style={sectionLabel}>Ανάθεση</p> <p style={sectionLabel}>{t('tables.filter.owner')}</p>
<div style={segmentedWrap}> <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> <button key={key} onClick={() => setOwnerFilter(key)} style={segBtn(ownerFilter === key)}>{lbl}</button>
))} ))}
</div> </div>
@@ -237,9 +240,9 @@ function FiltersModal({ groups, onClose }) {
{/* Status: ALL | FREE | OPEN | PAID */} {/* Status: ALL | FREE | OPEN | PAID */}
<div> <div>
<p style={sectionLabel}>Κατάσταση</p> <p style={sectionLabel}>{t('tables.filter.status')}</p>
<div style={{ ...segmentedWrap, display: 'grid', gridTemplateColumns: '1fr 1fr' }}> <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> <button key={key} onClick={() => setStatusFilter(key)} style={{ ...segBtn(statusFilter === key), borderRadius: 10 }}>{lbl}</button>
))} ))}
</div> </div>
@@ -248,7 +251,7 @@ function FiltersModal({ groups, onClose }) {
{/* Zones: multi-select, one segmented container per zone */} {/* Zones: multi-select, one segmented container per zone */}
{groups.length > 0 && ( {groups.length > 0 && (
<div> <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 }}> <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 6 }}>
{groups.map(g => { {groups.map(g => {
const active = zoneFilter.includes(g.id) const active = zoneFilter.includes(g.id)
@@ -277,7 +280,7 @@ function FiltersModal({ groups, 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.ok')}</button>
</div> </div>
</div> </div>
) )
@@ -298,6 +301,7 @@ function segBtn(active) {
// ─── Main page ──────────────────────────────────────────────────────────────── // ─── Main page ────────────────────────────────────────────────────────────────
export default function TableListPage() { export default function TableListPage() {
const { t } = useTranslation('waiter')
const { user } = useAuthStore() const { user } = useAuthStore()
const { status: connStatus } = useConnectionStore() const { status: connStatus } = useConnectionStore()
const isOffline = connStatus !== 'online' const isOffline = connStatus !== 'online'
@@ -663,7 +667,7 @@ export default function TableListPage() {
borderBottom: '1px solid var(--border)', borderBottom: '1px solid var(--border)',
overflowX: 'auto', scrollbarWidth: 'none', 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 => ( {visibleGroups.map(g => (
<ZoneTab key={g.id} label={g.name} color={g.color} <ZoneTab key={g.id} label={g.name} color={g.color}
active={effectiveZoneTab === g.id} active={effectiveZoneTab === g.id}
@@ -690,14 +694,14 @@ export default function TableListPage() {
color: 'var(--muted)', fontSize: 13, fontWeight: 600, color: 'var(--muted)', fontSize: 13, fontWeight: 600,
overflow: 'hidden', transition: pulling ? 'none' : 'height 0.2s', 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> </div>
)} )}
{isOffline && tables.length === 0 && ( {isOffline && tables.length === 0 && (
<div style={{ textAlign: 'center', padding: '48px 24px', color: 'var(--muted)' }}> <div style={{ textAlign: 'center', padding: '48px 24px', color: 'var(--muted)' }}>
<div style={{ fontSize: 36, marginBottom: 12 }}>📡</div> <div style={{ fontSize: 36, marginBottom: 12 }}>📡</div>
<p style={{ fontWeight: 700, fontSize: 16, color: 'var(--text)', marginBottom: 6 }}>Offline — δεν υπάρχουν αποθηκευμένα δεδομένα</p> <p style={{ fontWeight: 700, fontSize: 16, color: 'var(--text)', marginBottom: 6 }}>{t('tables.offlineNoData')}</p>
<p style={{ fontSize: 13, lineHeight: 1.5 }}>Συνδέσου στο δίκτυο μια φορά για να αποθηκευτούν τα δεδομένα τοπικά.</p> <p style={{ fontSize: 13, lineHeight: 1.5 }}>{t('tables.offlineNoDataBody')}</p>
</div> </div>
)} )}
<div style={{ <div style={{
@@ -810,11 +814,11 @@ export default function TableListPage() {
<div className="modal-overlay" onClick={() => setCancelConfirm(null)}> <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 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 }} /> <div className="modal-handle" style={{ marginBottom: 16 }} />
<p style={{ fontSize: 18, fontWeight: 700, color: 'var(--text)', marginBottom: 8 }}>Ακύρωση Παραγγελίας;</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 }}>Όλα τα ενεργά αντικείμενα θα ακυρωθούν και θα εκτυπωθεί απόδειξη ακύρωσης.</p> <p style={{ fontSize: 14, color: 'var(--muted)', marginBottom: 20 }}>{t('tables.cancelConfirmBody')}</p>
<div style={{ display: 'flex', gap: 10 }}> <div style={{ display: 'flex', gap: 10 }}>
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setCancelConfirm(null)}>Ακύρωση</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)}>Επιβεβαίωση</button> <button className="btn" style={{ flex: 1, background: '#ef4444', color: '#fff' }} onClick={() => executeCancelOrder(cancelConfirm.orderId)}>{t('common.confirm')}</button>
</div> </div>
</div> </div>
</div> </div>
@@ -829,7 +833,7 @@ export default function TableListPage() {
const KDS_FILTER_CHIPS = [ const KDS_FILTER_CHIPS = [
{ {
key: 'all', key: 'all',
full: 'Όλες', short: 'All', full: 'orders.chips.all', short: 'orders.chips.allShort',
icon: ( icon: (
<svg width="14" height="14" viewBox="0 0 24 24" fill="none"> <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"/> <rect x="3" y="3" width="7" height="7" rx="1.5" fill="currentColor"/>
@@ -842,7 +846,7 @@ const KDS_FILTER_CHIPS = [
}, },
{ {
key: 'pending', key: 'pending',
full: 'Εκκρεμούν', short: 'PND', full: 'orders.chips.pending', short: 'orders.chips.pendingShort',
icon: ( icon: (
<svg width="14" height="14" viewBox="0 0 24 24" fill="none"> <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"/> <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', key: 'preparing',
full: 'Σε Προετοιμασία', short: 'PRP', full: 'orders.chips.preparing', short: 'orders.chips.preparingShort',
icon: ( icon: (
<svg width="14" height="14" viewBox="0 0 24 24" fill="none"> <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"/> <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', key: 'ready',
full: 'Έτοιμες', short: 'RDY', full: 'orders.chips.ready', short: 'orders.chips.readyShort',
icon: ( icon: (
<svg width="14" height="14" viewBox="0 0 24 24" fill="none"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none">
<circle cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="2"/> <circle cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="2"/>
@@ -873,7 +877,7 @@ const KDS_FILTER_CHIPS = [
}, },
{ {
key: 'ready_items', key: 'ready_items',
full: 'Μερικώς Έτοιμες', short: 'PRT', full: 'orders.chips.partly', short: 'orders.chips.partlyShort',
icon: ( icon: (
<svg width="14" height="14" viewBox="0 0 24 24" fill="none"> <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"/> <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 = { const KDS_ITEM_COLORS = {
pending: { textColor: '#f59e0b', label: 'ΕΚΚΡΕΜΕΙ' }, pending: { textColor: '#f59e0b', label: 'kds.pending' },
preparing: { textColor: '#60a5fa', label: 'ΕΤΟΙΜΑΖΕΤΑΙ' }, preparing: { textColor: '#60a5fa', label: 'kds.preparing' },
done: { textColor: '#4ade80', label: 'READY' }, done: { textColor: '#4ade80', label: 'kds.ready' },
served: { textColor: null, label: null }, served: { textColor: null, label: null },
} }
@@ -896,13 +900,14 @@ const KDS_ITEM_COLORS = {
// ─── Orders filter drawer ───────────────────────────────────────────────────── // ─── Orders filter drawer ─────────────────────────────────────────────────────
function OrdersFilterDrawer({ myOnly, setMyOnly, sortBy, setSortBy, filter, setFilter, onClose }) { function OrdersFilterDrawer({ myOnly, setMyOnly, sortBy, setSortBy, filter, setFilter, onClose }) {
const { t } = useTranslation('waiter')
const hasActive = myOnly || sortBy !== 'time' || filter !== 'all' const hasActive = myOnly || sortBy !== 'time' || filter !== 'all'
const STATUS_OPTIONS = [ const STATUS_OPTIONS = [
{ key: 'all', label: 'Όλες' }, { key: 'all', label: t('orders.chips.all') },
{ key: 'pending', label: 'PEND' }, { key: 'pending', label: t('orders.chips.pendingShort') },
{ key: 'preparing', label: 'PREP' }, { key: 'preparing', label: t('orders.chips.preparingShort') },
{ key: 'ready', label: 'READY' }, { key: 'ready', label: t('orders.chips.readyShort') },
] ]
function toggleStatus(key) { function toggleStatus(key) {
@@ -920,22 +925,22 @@ function OrdersFilterDrawer({ myOnly, setMyOnly, sortBy, setSortBy, filter, setF
<div className="modal-handle" /> <div className="modal-handle" />
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}> <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 && ( {hasActive && (
<button <button
onClick={() => { setMyOnly(false); setSortBy('time'); setFilter('all'); onClose() }} 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' }} style={{ fontSize: 13, fontWeight: 600, color: 'var(--danger)', background: 'none', border: 'none', cursor: 'pointer', padding: '4px 8px' }}
> >
Καθαρισμός {t('common.clear')}
</button> </button>
)} )}
</div> </div>
{/* View filter */} {/* View filter */}
<div> <div>
<p style={sectionLabel}>Προβολή</p> <p style={sectionLabel}>{t('orders.filter.view')}</p>
<div style={segmentedWrap}> <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> <button key={val} onClick={() => setMyOnly(val === 'true')} style={segBtn(String(myOnly) === val)}>{lbl}</button>
))} ))}
</div> </div>
@@ -943,12 +948,12 @@ function OrdersFilterDrawer({ myOnly, setMyOnly, sortBy, setSortBy, filter, setF
{/* Sort method */} {/* Sort method */}
<div> <div>
<p style={sectionLabel}>Ταξινόμηση</p> <p style={sectionLabel}>{t('orders.filter.sort')}</p>
<div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
{[ {[
['time', 'Κατά ώρα παραγγελίας'], ['time', t('orders.sort.time')],
['latest_change', 'Κατά τελευταία αλλαγή'], ['latest_change', t('orders.sort.latest')],
['kds_priority', 'Ready → Prep → Pend'], ['kds_priority', t('orders.sort.kds')],
].map(([key, lbl]) => ( ].map(([key, lbl]) => (
<div key={key} style={segmentedWrap}> <div key={key} style={segmentedWrap}>
<button onClick={() => setSortBy(key)} style={segBtn(sortBy === key)}>{lbl}</button> <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) */} {/* Status filter (multi-select: ALL selects all 3) */}
<div> <div>
<p style={sectionLabel}>Κατάσταση</p> <p style={sectionLabel}>{t('tables.filter.status')}</p>
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 6 }}> <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 6 }}>
{STATUS_OPTIONS.map(({ key, label }) => ( {STATUS_OPTIONS.map(({ key, label }) => (
<div key={key} style={segmentedWrap}> <div key={key} style={segmentedWrap}>
@@ -974,13 +979,14 @@ function OrdersFilterDrawer({ myOnly, setMyOnly, sortBy, setSortBy, filter, setF
</div> </div>
</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>
</div> </div>
) )
} }
function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setMyOnly, sortBy, setSortBy, showFilters, setShowFilters, onNavigate, onMarkAllServed, onRefresh }) { function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setMyOnly, sortBy, setSortBy, showFilters, setShowFilters, onNavigate, onMarkAllServed, onRefresh }) {
const { t } = useTranslation('waiter')
const { chipStyle } = useTableViewStore() const { chipStyle } = useTableViewStore()
const [expandedOrders, setExpandedOrders] = useState({}) const [expandedOrders, setExpandedOrders] = useState({})
const [refreshing, setRefreshing] = useState(false) 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 preparing = items.filter(i => kds(i.kds_status) === 'preparing').length
const done = items.filter(i => kds(i.kds_status) === 'done').length const done = items.filter(i => kds(i.kds_status) === 'done').length
const total = items.length const total = items.length
if (done === total) return { label: 'READY', color: '#4ade80', bg: 'rgba(34,197,94,0.15)' } if (done === total) return { label: t('kds.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 (preparing > 0) return { label: t('kds.preparing'), color: '#60a5fa', bg: 'rgba(96,165,250,0.15)' }
if (pending === total) return { label: 'ΕΚΚΡΕΜΕΙ', color: '#f59e0b', bg: 'rgba(245,158,11,0.15)' } if (pending === total) return { label: t('kds.pending'), color: '#f59e0b', bg: 'rgba(245,158,11,0.15)' }
return { label: `${done}/${total} READY`, color: '#4ade80', bg: 'rgba(34,197,94,0.12)' } return { label: t('kds.someReady', { done, total }), color: '#4ade80', bg: 'rgba(34,197,94,0.12)' }
} }
// Count per filter for badge // Count per filter for badge
@@ -1071,7 +1077,7 @@ function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setM
const cs = chipStyle || 'icon_short' const cs = chipStyle || 'icon_short'
const showIcon = cs === 'icon' || cs === 'icon_short' || cs === 'icon_full' const showIcon = cs === 'icon' || cs === 'icon_short' || cs === 'icon_full'
const showText = cs !== 'icon' 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 ( return (
<button <button
key={chip.key} key={chip.key}
@@ -1116,12 +1122,12 @@ function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setM
color: 'var(--muted)', fontSize: 13, fontWeight: 600, color: 'var(--muted)', fontSize: 13, fontWeight: 600,
overflow: 'hidden', transition: pulling ? 'none' : 'height 0.2s', 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> </div>
)} )}
{orders.length === 0 && ( {orders.length === 0 && (
<div style={{ textAlign: 'center', padding: '40px 0', color: 'var(--muted)', fontSize: 14 }}> <div style={{ textAlign: 'center', padding: '40px 0', color: 'var(--muted)', fontSize: 14 }}>
Δεν υπάρχουν παραγγελίες {t('orders.none')}
</div> </div>
)} )}
{orders.map(o => { {orders.map(o => {
@@ -1168,7 +1174,7 @@ function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setM
{/* Item count */} {/* Item count */}
<span style={{ fontSize: 12, color: 'var(--muted)', marginLeft: 2 }}> <span style={{ fontSize: 12, color: 'var(--muted)', marginLeft: 2 }}>
{visibleItems.length} είδη {t('orders.items', { count: visibleItems.length })}
</span> </span>
<span style={{ marginLeft: 'auto', color: 'var(--muted)', fontSize: 16, transition: 'transform 0.2s', display: 'inline-block', transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)' }}>▾</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, fontSize: 9, fontWeight: 800, color: kdsC.textColor,
borderRadius: 3, padding: '1px 5px', borderRadius: 3, padding: '1px 5px',
border: `1px solid ${kdsC.textColor}60`, border: `1px solid ${kdsC.textColor}60`,
}}>{kdsC.label}</span> }}>{t(kdsC.label)}</span>
)} )}
</div> </div>
) )
@@ -1213,7 +1219,7 @@ function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setM
background: 'var(--bg3)', color: 'var(--text)', background: 'var(--bg3)', color: 'var(--text)',
fontSize: 13, fontWeight: 600, cursor: 'pointer', fontSize: 13, fontWeight: 600, cursor: 'pointer',
}} }}
>Άνοιγμα</button> >{t('orders.open')}</button>
{o.items?.some(i => kds(i.kds_status) === 'done') && ( {o.items?.some(i => kds(i.kds_status) === 'done') && (
<button <button
onClick={() => onMarkAllServed(o.id)} 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', background: 'rgba(34,197,94,0.15)', color: '#4ade80',
fontSize: 13, fontWeight: 700, cursor: 'pointer', fontSize: 13, fontWeight: 700, cursor: 'pointer',
}} }}
>Σήμανση Παραδοθέντων</button> >{t('orders.markServed')}</button>
)} )}
</div> </div>
</div> </div>
@@ -1278,6 +1284,8 @@ function OrdersView({ orders, allOrders, tables, filter, setFilter, myOnly, setM
// ─── Standalone order card (takeaway / delivery) ────────────────────────────── // ─── Standalone order card (takeaway / delivery) ──────────────────────────────
function StandaloneOrderCard({ order, onClick }) { function StandaloneOrderCard({ order, onClick }) {
const { t } = useTranslation('waiter')
const { formatMoney } = useFormat()
const isDelivery = order.order_type === 'delivery' const isDelivery = order.order_type === 'delivery'
const activeItems = (order.items || []).filter(i => i.status === 'active') const activeItems = (order.items || []).filter(i => i.status === 'active')
const paidItems = (order.items || []).filter(i => i.status === 'paid') const paidItems = (order.items || []).filter(i => i.status === 'paid')
@@ -1334,7 +1342,7 @@ function StandaloneOrderCard({ order, onClick }) {
background: `${statusColor}22`, color: statusColor, background: `${statusColor}22`, color: statusColor,
border: `1px solid ${statusColor}44`, 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> </span>
{kds !== 'served' && ( {kds !== 'served' && (
<span style={{ <span style={{
@@ -1343,15 +1351,15 @@ function StandaloneOrderCard({ order, onClick }) {
background: `${kdsColor}22`, color: kdsColor, background: `${kdsColor}22`, color: kdsColor,
border: `1px solid ${kdsColor}44`, 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> </span>
)} )}
</div> </div>
{/* Total + item count */} {/* Total + item count */}
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', marginTop: 'auto' }}> <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: 11, color: 'var(--muted)' }}>{t('orders.items', { count: activeItems.length + paidItems.length })}</span>
<span style={{ fontSize: 14, fontWeight: 700, color: 'var(--text)' }}>{total.toFixed(2)} €</span> <span style={{ fontSize: 14, fontWeight: 700, color: 'var(--text)' }}>{formatMoney(total)}</span>
</div> </div>
</div> </div>
) )
@@ -1386,6 +1394,7 @@ function NewStandaloneCard({ label, color, icon, onClick }) {
// ─── Standalone page view ───────────────────────────────────────────────────── // ─── Standalone page view ─────────────────────────────────────────────────────
function StandaloneView({ orders, gridCols, navigate }) { function StandaloneView({ orders, gridCols, navigate }) {
const { t } = useTranslation('waiter')
const standaloneOrders = orders const standaloneOrders = orders
.filter(o => o.order_type === 'takeaway' || o.order_type === 'delivery') .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)) .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 */} {/* Fixed action cards always at top */}
<NewStandaloneCard <NewStandaloneCard
label="+ Νέο Takeaway" label={t('orders.newTakeaway')}
color="#f59e0b" color="#f59e0b"
icon="🥡" icon="🥡"
onClick={() => navigate('/standalone/takeaway/add?new=1')} onClick={() => navigate('/standalone/takeaway/add?new=1')}
/> />
<NewStandaloneCard <NewStandaloneCard
label="+ Νέα Delivery" label={t('orders.newDelivery')}
color="#60a5fa" color="#60a5fa"
icon="🛵" icon="🛵"
onClick={() => navigate('/standalone/delivery/add?new=1')} onClick={() => navigate('/standalone/delivery/add?new=1')}
+13 -12
View File
@@ -3,6 +3,7 @@ import useThemeStore from '../store/themeStore'
import QrScannerModal from '../components/QrScannerModal' import QrScannerModal from '../components/QrScannerModal'
import { pairWith } from '../native/pairing' import { pairWith } from '../native/pairing'
import { getActiveVenue, listVenues, removeVenue, switchVenue } from '../config/server' 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. * 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. * screen, the user menu and the offline screen.
*/ */
export default function VenuesPage({ firstRun = false }) { export default function VenuesPage({ firstRun = false }) {
const { t } = useTranslation('waiter')
const dark = useThemeStore(s => s.dark) const dark = useThemeStore(s => s.dark)
const [venues, setVenues] = useState(listVenues) const [venues, setVenues] = useState(listVenues)
const [address, setAddress] = useState('') const [address, setAddress] = useState('')
@@ -33,15 +35,15 @@ export default function VenuesPage({ firstRun = false }) {
const venue = await pairWith(raw) const venue = await pairWith(raw)
switchVenue(venue.siteId) // reloads the app into the venue switchVenue(venue.siteId) // reloads the app into the venue
} catch (e) { } catch (e) {
setError(e.message || 'Αποτυχία σύνδεσης.') setError(e.message || t('venues.failed'))
setBusy(false) setBusy(false)
} }
}, []) }, [])
function handleRemove(venue) { function handleRemove(venue) {
const msg = venue.siteId === active?.siteId const msg = venue.siteId === active?.siteId
? `Αφαίρεση του ενεργού καταστήματος «${venue.name}»; Θα χρειαστεί νέα σύνδεση.` ? t('venues.removeActive', { name: venue.name })
: `Αφαίρεση του καταστήματος «${venue.name}» από αυτό το κινητό;` : t('venues.remove', { name: venue.name })
if (!window.confirm(msg)) return if (!window.confirm(msg)) return
removeVenue(venue.siteId) removeVenue(venue.siteId)
if (venue.siteId === active?.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('/')} 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 }} style={{ alignSelf: 'flex-start', background: 'none', border: 'none', color: 'var(--muted)', fontSize: 15, cursor: 'pointer', padding: 0 }}
> >
← Πίσω ← {t('common.back')}
</button> </button>
)} )}
<div style={{ textAlign: 'center' }}> <div style={{ textAlign: 'center' }}>
<div style={{ fontSize: 44, marginBottom: 8 }}>🏪</div> <div style={{ fontSize: 44, marginBottom: 8 }}>🏪</div>
<h1 style={{ fontSize: 22, fontWeight: 700, color: 'var(--text)', marginBottom: 6 }}> <h1 style={{ fontSize: 22, fontWeight: 700, color: 'var(--text)', marginBottom: 6 }}>
{firstRun ? 'Σύνδεση με κατάστημα' : 'Καταστήματα'} {firstRun ? t('venues.connectTitle') : t('venues.title')}
</h1> </h1>
<p style={{ fontSize: 14, color: 'var(--muted)', lineHeight: 1.5 }}> <p style={{ fontSize: 14, color: 'var(--muted)', lineHeight: 1.5 }}>
Σαρώστε το QR από τον διαχειριστή ή πληκτρολογήστε τη διεύθυνση του server. {t('venues.intro')}
Το κινητό πρέπει να είναι στο WiFi του καταστήματος.
</p> </p>
</div> </div>
@@ -91,14 +92,14 @@ export default function VenuesPage({ firstRun = false }) {
<div style={{ fontSize: 16, fontWeight: 600, color: 'var(--text)' }}> <div style={{ fontSize: 16, fontWeight: 600, color: 'var(--text)' }}>
{v.name} {v.name}
{isActive && ( {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>
<div style={{ fontSize: 12, color: 'var(--muted)', fontFamily: 'monospace' }}>{v.baseUrl}</div> <div style={{ fontSize: 12, color: 'var(--muted)', fontFamily: 'monospace' }}>{v.baseUrl}</div>
</button> </button>
<button <button
onClick={() => handleRemove(v)} onClick={() => handleRemove(v)}
aria-label="Αφαίρεση" aria-label={t('venues.removeLabel')}
style={{ background: 'none', border: 'none', color: 'var(--muted)', fontSize: 22, cursor: 'pointer', padding: 4 }} 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 }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
<button className="btn btn--accent btn--lg" onClick={() => { setError(null); setScanning(true) }} disabled={busy}> <button className="btn btn--accent btn--lg" onClick={() => { setError(null); setScanning(true) }} disabled={busy}>
📷 Σάρωση QR 📷 {t('venues.scan')}
</button> </button>
<div style={{ display: 'flex', gap: 8 }}> <div style={{ display: 'flex', gap: 8 }}>
@@ -119,7 +120,7 @@ export default function VenuesPage({ firstRun = false }) {
value={address} value={address}
onChange={e => setAddress(e.target.value)} onChange={e => setAddress(e.target.value)}
onKeyDown={e => e.key === 'Enter' && address && connect(address)} onKeyDown={e => e.key === 'Enter' && address && connect(address)}
placeholder="π.χ. 192.168.1.50" placeholder={t('venues.placeholder')}
inputMode="url" inputMode="url"
autoCapitalize="off" autoCapitalize="off"
autoCorrect="off" autoCorrect="off"
@@ -131,7 +132,7 @@ export default function VenuesPage({ firstRun = false }) {
/> />
<button className="btn btn--secondary" onClick={() => connect(address)} disabled={busy || !address} <button className="btn btn--secondary" onClick={() => connect(address)} disabled={busy || !address}
style={{ height: 52, padding: '0 18px' }}> style={{ height: 52, padding: '0 18px' }}>
{busy ? 'Έλεγχος…' : 'Σύνδεση'} {busy ? t('venues.checking') : t('venues.connect')}
</button> </button>
</div> </div>
+1 -1
View File
@@ -7,7 +7,7 @@ import { deliveryMode } from '../config/server'
* It opens by itself once, the first time an Android phone opens the waiter app * 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 * 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 * 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' export const APK_URL = import.meta.env.VITE_APP_DOWNLOAD_URL || '/downloads/xenia-waiter.apk'