feat(waiter): English-first texts, part b: table detail, ordering, options, payment (platform-v2 step 4.5b)
- Table detail (actions, item actions, split, price, discount, pay / revert / close, move / merge / transfer, guests, flags, assign, print), the order drawer (tabs, options, quick notes, price change, summary), add items (cart, totals, deals, search), the order summary and the summary before sending, the product picker. - Money everywhere here in the language's format (`money()` in waiter i18n.js for helpers shared by several components, useFormat() elsewhere). - The default quick notes are keys (the venue's own quick notes still win). - Variables named `t` (tables, tabs, timers) renamed so they don't shadow t(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,10 +12,12 @@
|
|||||||
"total": "Σύνολο",
|
"total": "Σύνολο",
|
||||||
"clear": "Καθαρισμός",
|
"clear": "Καθαρισμός",
|
||||||
"ok": "Εντάξει",
|
"ok": "Εντάξει",
|
||||||
"cancel": "Ακύρωση",
|
"cancel": "Άκυρο",
|
||||||
"confirm": "Επιβεβαίωση",
|
"confirm": "Επιβεβαίωση",
|
||||||
"back": "Πίσω",
|
"back": "Πίσω",
|
||||||
"save": "Αποθήκευση"
|
"save": "Αποθήκευση",
|
||||||
|
"apply": "Εφαρμογή",
|
||||||
|
"sure": "Είσαι σίγουρος;"
|
||||||
},
|
},
|
||||||
"gate": {
|
"gate": {
|
||||||
"closedTitle": "Εστιατόριο κλειστό",
|
"closedTitle": "Εστιατόριο κλειστό",
|
||||||
@@ -374,8 +376,54 @@
|
|||||||
"tabs": {
|
"tabs": {
|
||||||
"quick": "Γρήγορες Επιλογές",
|
"quick": "Γρήγορες Επιλογές",
|
||||||
"ingredients": "Υλικά",
|
"ingredients": "Υλικά",
|
||||||
"prefs": "Προτιμήσεις"
|
"prefs": "Προτιμήσεις",
|
||||||
}
|
"extrasTitle": "Extras",
|
||||||
|
"note": "Σημείωση",
|
||||||
|
"quickShort": "Γρήγορες",
|
||||||
|
"extras": "Έξτρα",
|
||||||
|
"options": "Επιλογές",
|
||||||
|
"price": "Τιμή",
|
||||||
|
"summary": "Σύνοψη",
|
||||||
|
"quantity": "Ποσότητα ({{unit}})"
|
||||||
|
},
|
||||||
|
"choose": "Επιλογή",
|
||||||
|
"chooseMany": "Επιλογή (πολλαπλή)",
|
||||||
|
"removed": "Αφαιρέθηκε",
|
||||||
|
"remove": "Αφαίρεση",
|
||||||
|
"required": "Απαιτείται",
|
||||||
|
"choiceRequired": "— απαιτείται επιλογή",
|
||||||
|
"empty": {
|
||||||
|
"favorites": "Δεν υπάρχουν αγαπημένα για αυτό το προϊόν.",
|
||||||
|
"quick": "Δεν υπάρχουν γρήγορες επιλογές.",
|
||||||
|
"extras": "Δεν υπάρχουν extras.",
|
||||||
|
"ingredients": "Δεν υπάρχουν υλικά.",
|
||||||
|
"prefs": "Δεν υπάρχουν προτιμήσεις."
|
||||||
|
},
|
||||||
|
"qty": {
|
||||||
|
"quickPick": "ΓΡΗΓΟΡΗ ΕΠΙΛΟΓΗ",
|
||||||
|
"quickAdd": "ΓΡΗΓΟΡΗ ΠΡΟΣΘΗΚΗ"
|
||||||
|
},
|
||||||
|
"price": {
|
||||||
|
"intro": "Αλλαγή τιμής μόνο για αυτό το αντικείμενο. Δεν επηρεάζει άλλες παραγγελίες.",
|
||||||
|
"base": "Βάση: {{price}}"
|
||||||
|
},
|
||||||
|
"notes": {
|
||||||
|
"placeholder": "π.χ. Χωρίς αλάτι, κόψτε στη μέση...",
|
||||||
|
"quickTitle": "Γρήγορες σημειώσεις",
|
||||||
|
"noSalt": "Χωρίς αλάτι",
|
||||||
|
"quick": "Βγάλτε γρήγορα",
|
||||||
|
"allergy": "Αλλεργία!",
|
||||||
|
"smallPieces": "Κόψτε σε μικρά κομμάτια",
|
||||||
|
"napkins": "Έξτρα χαρτοπετσέτες"
|
||||||
|
},
|
||||||
|
"summary": {
|
||||||
|
"empty": "Δεν έχει γίνει καμία προσαρμογή. Χρησιμοποιήστε τις καρτέλες για να διαμορφώσετε το προϊόν.",
|
||||||
|
"removed": "Αφαιρέθηκαν"
|
||||||
|
},
|
||||||
|
"included": "Περιλαμβάνεται",
|
||||||
|
"selectedCount": "{{count}} επιλεγμένα",
|
||||||
|
"each": "το ένα",
|
||||||
|
"without": "Χωρίς {{name}}"
|
||||||
},
|
},
|
||||||
"pairing": {
|
"pairing": {
|
||||||
"empty": "Συμπληρώστε τη διεύθυνση του server.",
|
"empty": "Συμπληρώστε τη διεύθυνση του server.",
|
||||||
@@ -386,5 +434,228 @@
|
|||||||
"incompatible": "Ο server (έκδοση {{version}}) δεν είναι συμβατός με αυτή την εφαρμογή. Ενημερώστε την εφαρμογή ή τον server.",
|
"incompatible": "Ο server (έκδοση {{version}}) δεν είναι συμβατός με αυτή την εφαρμογή. Ενημερώστε την εφαρμογή ή τον server.",
|
||||||
"otherVenue": "Σε αυτή τη διεύθυνση απαντά διαφορετικό κατάστημα από αυτό του QR. Ζητήστε νέο QR από τον διαχειριστή.",
|
"otherVenue": "Σε αυτή τη διεύθυνση απαντά διαφορετικό κατάστημα από αυτό του QR. Ζητήστε νέο QR από τον διαχειριστή.",
|
||||||
"wrongKey": "Το κλειδί ασφαλείας του server δεν ταιριάζει με το QR. Ζητήστε νέο QR από τον διαχειριστή."
|
"wrongKey": "Το κλειδί ασφαλείας του server δεν ταιριάζει με το QR. Ζητήστε νέο QR από τον διαχειριστή."
|
||||||
|
},
|
||||||
|
"detail": {
|
||||||
|
"split": {
|
||||||
|
"title": "Διαχωρισμός",
|
||||||
|
"howMany": "Χώρισε σε πόσα;",
|
||||||
|
"newLine": "Νέα γραμμή:",
|
||||||
|
"remains": "Μένει:"
|
||||||
|
},
|
||||||
|
"price": {
|
||||||
|
"title": "Ρύθμιση Τιμής",
|
||||||
|
"tapToType": "Πάτα για πληκτρολόγιο",
|
||||||
|
"reset": "Επαναφορά αρχικής τιμής",
|
||||||
|
"base": "Βασική: {{base}} {{change}}"
|
||||||
|
},
|
||||||
|
"item": {
|
||||||
|
"price": "Ρύθμιση τιμής",
|
||||||
|
"priceSub": "Αλλαγή τιμής για αυτό το αντικείμενο",
|
||||||
|
"again": "Παραγγελία ξανά",
|
||||||
|
"againSub": "Προσθήκη στο νέο καλάθι",
|
||||||
|
"move": "Μεταφορά σε άλλο τραπέζι",
|
||||||
|
"moveSub": "Μεταφορά επιλεγμένων αντικειμένων",
|
||||||
|
"splitSub": "Χώρισμα σε δύο γραμμές",
|
||||||
|
"cancel": "Ακύρωση παραγγελίας",
|
||||||
|
"cancelSub": "Ακύρωση επιλεγμένων αντικειμένων"
|
||||||
|
},
|
||||||
|
"withApproval": "Με έγκριση διαχειριστή (PIN)",
|
||||||
|
"cancelNotAllowed": "Δεν επιτρέπεται η ακύρωση",
|
||||||
|
"discount": {
|
||||||
|
"pickOne": "Επιλέξτε τουλάχιστον ένα αντικείμενο",
|
||||||
|
"badPct": "Μη έγκυρο ποσοστό",
|
||||||
|
"failed": "Σφάλμα εφαρμογής έκπτωσης",
|
||||||
|
"rounding": "Η τελική τιμή στρογγυλοποιείται στο 0.10 €",
|
||||||
|
"items": "Αντικείμενα",
|
||||||
|
"pct": "Ποσοστό έκπτωσης",
|
||||||
|
"note": "Σημείωση (προαιρετικό)",
|
||||||
|
"notePlaceholder": "π.χ. VIP πελάτης",
|
||||||
|
"applying": "Εφαρμογή…"
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"discount": "Εφαρμογή Έκπτωσης",
|
||||||
|
"markAllServedSub": "Σήμανση όλων των έτοιμων ειδών ως παραδοθέντα",
|
||||||
|
"discountSub": "Έκπτωση σε αντικείμενα παραγγελίας",
|
||||||
|
"discountNotAllowed": "Δεν επιτρέπεται η εφαρμογή έκπτωσης",
|
||||||
|
"transfer": "Μεταφορά Τραπεζιού",
|
||||||
|
"merge": "Συγχώνευση Τραπεζιού",
|
||||||
|
"mergeSub": "Συγχώνευση με άλλο τραπέζι",
|
||||||
|
"flagsSub": "Επιλογή σημαιών",
|
||||||
|
"assignSub": "Προσθήκη σερβιτόρου στην παραγγελία",
|
||||||
|
"printSub": "Εκτύπωση σύνοψης παραγγελίας",
|
||||||
|
"cancelSub": "Ακύρωση ολόκληρης παραγγελίας"
|
||||||
|
},
|
||||||
|
"noTables": "Δεν υπάρχουν διαθέσιμα τραπέζια",
|
||||||
|
"noFlags": "Δεν υπάρχουν σημαίες",
|
||||||
|
"allAssigned": "Όλοι οι σερβιτόροι έχουν ήδη ανατεθεί",
|
||||||
|
"pickPrinter": "Επιλέξτε εκτυπωτή",
|
||||||
|
"cancel": {
|
||||||
|
"title": "Ακύρωση παραγγελίας;",
|
||||||
|
"button": "Ακύρωση ✕",
|
||||||
|
"whole": "Ολόκληρη η παραγγελία θα ακυρωθεί οριστικά.",
|
||||||
|
"items_one": "{{count}} αντικείμενο θα ακυρωθεί οριστικά.",
|
||||||
|
"items_other": "{{count}} αντικείμενα θα ακυρωθούν οριστικά."
|
||||||
|
},
|
||||||
|
"guests": {
|
||||||
|
"title": "Αριθμός Πελατών",
|
||||||
|
"question": "Πόσα άτομα κάθονται στο τραπέζι;",
|
||||||
|
"button": "Αριθμός πελατών"
|
||||||
|
},
|
||||||
|
"err": {
|
||||||
|
"load": "Σφάλμα φόρτωσης",
|
||||||
|
"open": "Σφάλμα ανοίγματος",
|
||||||
|
"offlinePay": "Σφάλμα αποθήκευσης offline πληρωμής",
|
||||||
|
"pay": "Σφάλμα πληρωμής",
|
||||||
|
"revert": "Σφάλμα αναίρεσης πληρωμής",
|
||||||
|
"close": "Σφάλμα κλεισίματος",
|
||||||
|
"cancel": "Σφάλμα ακύρωσης",
|
||||||
|
"cancelOrder": "Σφάλμα ακύρωσης παραγγελίας",
|
||||||
|
"mark": "Σφάλμα σήμανσης",
|
||||||
|
"splitOffline": "Σφάλμα διαχωρισμού offline",
|
||||||
|
"split": "Σφάλμα διαχωρισμού",
|
||||||
|
"transfer": "Σφάλμα μεταφοράς",
|
||||||
|
"noTargetOrder": "Δεν βρέθηκε παραγγελία στο τραπέζι",
|
||||||
|
"merge": "Σφάλμα συγχώνευσης",
|
||||||
|
"moveItems": "Σφάλμα μεταφοράς αντικειμένων",
|
||||||
|
"flags": "Σφάλμα αποθήκευσης σημαιών"
|
||||||
|
},
|
||||||
|
"openOrder": "Άνοιγμα Παραγγελίας",
|
||||||
|
"noPaid": "Δεν υπάρχουν πληρωμένα αντικείμενα",
|
||||||
|
"revert": {
|
||||||
|
"button": "ΑΝΑΙΡΕΣΗ",
|
||||||
|
"title": "Αναίρεση Πληρωμής;",
|
||||||
|
"items_one": "{{count}} αντικείμενο θα επιστραφεί σε μη πληρωμένο.",
|
||||||
|
"items_other": "{{count}} αντικείμενα θα επιστραφούν σε μη πληρωμένα.",
|
||||||
|
"confirm": "Αναίρεση"
|
||||||
|
},
|
||||||
|
"notOffline": "Μη διαθέσιμο offline",
|
||||||
|
"view": {
|
||||||
|
"title": "Εμφάνιση Αντικειμένων",
|
||||||
|
"off": "ΑΡΧΙΚΗ",
|
||||||
|
"offDesc": "Ακριβώς όπως παραγγέλθηκαν",
|
||||||
|
"identical": "ΣΥΓΧΩΝΕΥΣΗ ΠΑΡΟΜΟΙΩΝ",
|
||||||
|
"identicalDesc": "Ίδιο προϊόν, ίδιες επιλογές, ίδια τιμή",
|
||||||
|
"sameItem": "ΣΥΓΧΩΝΕΥΣΗ ΟΛΩΝ",
|
||||||
|
"sameItemDesc": "Ίδιο προϊόν με ίδια τελική τιμή"
|
||||||
|
},
|
||||||
|
"close": {
|
||||||
|
"title": "Κλείσιμο παραγγελίας;",
|
||||||
|
"body": "Αυτή η ενέργεια δεν αναιρείται."
|
||||||
|
},
|
||||||
|
"move": {
|
||||||
|
"pickFree": "Επιλέξτε κενό τραπέζι",
|
||||||
|
"mergeSub": "Τα αντικείμενα μεταφέρονται στο επιλεγμένο τραπέζι",
|
||||||
|
"itemsTitle": "Μεταφορά Αντικειμένων",
|
||||||
|
"subtitle_one": "Μεταφορά {{count}} αντικειμένου σε τραπέζι",
|
||||||
|
"subtitle_other": "Μεταφορά {{count}} αντικειμένων σε τραπέζι",
|
||||||
|
"confirmTransfer": "Επιβεβαίωση Μεταφοράς",
|
||||||
|
"confirmMerge": "Επιβεβαίωση Συγχώνευσης",
|
||||||
|
"confirmItems": "Επιβεβαίωση Μεταφοράς Αντικειμένων",
|
||||||
|
"transferTo": "Μεταφορά παραγγελίας στο τραπέζι",
|
||||||
|
"mergeWith": "Συγχώνευση παραγγελίας με το τραπέζι",
|
||||||
|
"itemsTo_one": "Μεταφορά {{count}} αντικειμένου στο τραπέζι",
|
||||||
|
"itemsTo_other": "Μεταφορά {{count}} αντικειμένων στο τραπέζι"
|
||||||
|
},
|
||||||
|
"selected_one": "{{count}} αντικείμενο επιλεγμένο",
|
||||||
|
"selected_other": "{{count}} αντικείμενα επιλεγμένα",
|
||||||
|
"pay": {
|
||||||
|
"titleClose": "Επιβεβαίωση Πληρωμής και Κλείσιμο",
|
||||||
|
"title": "Επιβεβαίωση πληρωμής",
|
||||||
|
"allAndClose": "Όλα τα αντικείμενα — το τραπέζι θα κλείσει αμέσως μετά",
|
||||||
|
"all": "Όλα τα αντικείμενα",
|
||||||
|
"items_one": "{{count}} αντικείμενο",
|
||||||
|
"items_other": "{{count}} αντικείμενα",
|
||||||
|
"cash": "Μετρητά",
|
||||||
|
"card": "Κάρτα",
|
||||||
|
"hold": "Κρατήστε…",
|
||||||
|
"paid": "Πληρώθηκαν",
|
||||||
|
"yesPaid": "Ναι, Πληρώθηκαν"
|
||||||
|
},
|
||||||
|
"tabs": {
|
||||||
|
"unpaid": "Εκκρεμή",
|
||||||
|
"paid": "Πληρωμένα"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"add": {
|
||||||
|
"course": {
|
||||||
|
"title": "Ορισμός πιάτου",
|
||||||
|
"sub": "Τα γρήγορα προϊόντα θα μπαίνουν σε αυτό το πιάτο.",
|
||||||
|
"none": "Χωρίς πιάτο"
|
||||||
|
},
|
||||||
|
"sendFailed": "Σφάλμα αποστολής — η παραγγελία δεν στάλθηκε",
|
||||||
|
"search": {
|
||||||
|
"title": "Αναζήτηση",
|
||||||
|
"type": "Πληκτρολογήστε για αναζήτηση…",
|
||||||
|
"placeholder": "Αναζήτηση προϊόντος…",
|
||||||
|
"none": "Δεν βρέθηκαν προϊόντα για «{{query}}»"
|
||||||
|
},
|
||||||
|
"allCategories": "Όλες οι κατηγορίες",
|
||||||
|
"order": "Παραγγελία",
|
||||||
|
"empty": "Η παραγγελία είναι κενή.",
|
||||||
|
"note": {
|
||||||
|
"placeholder": "Σημείωση για ολόκληρη την παραγγελία…",
|
||||||
|
"title": "Σημείωση Παραγγελίας",
|
||||||
|
"add": "Προσθήκη σημείωσης παραγγελίας"
|
||||||
|
},
|
||||||
|
"deal": {
|
||||||
|
"title": "Προσφορά Ενεργοποιήθηκε!",
|
||||||
|
"freeProduct": "Δωρεάν προϊόν:",
|
||||||
|
"skip": "Παράβλεψη",
|
||||||
|
"pickFree_one": "Επιλέξτε {{count}} δωρεάν προϊόν",
|
||||||
|
"pickFree_other": "Επιλέξτε {{count}} δωρεάν προϊόντα",
|
||||||
|
"remaining": "({{count}} ακόμα)",
|
||||||
|
"addFree": "Προσθήκη Δωρεάν"
|
||||||
|
},
|
||||||
|
"inCart": "στο καλάθι",
|
||||||
|
"edit": "Επεξ.",
|
||||||
|
"optionGone": "«{{product}}»: το «{{what}}» δεν υπάρχει πια στο μενού. Αφαιρέστε το και προσθέστε το ξανά.",
|
||||||
|
"offlineSaveFailed": "Σφάλμα αποθήκευσης offline παραγγελίας",
|
||||||
|
"totalEstimateOffline": "Σύνολο (εκτίμηση, χωρίς σύνδεση)",
|
||||||
|
"totalEstimate": "Σύνολο (εκτίμηση)",
|
||||||
|
"withoutList": "Χωρίς: {{names}}",
|
||||||
|
"newOrder": "Νέα Παραγγελία",
|
||||||
|
"add": "Προσθήκη",
|
||||||
|
"moreSeeAll": "+{{count}} ακόμα — δείτε όλα →",
|
||||||
|
"sending": "Αποστολή…",
|
||||||
|
"send": "ΑΠΟΣΤΟΛΗ",
|
||||||
|
"sendCount": "ΑΠΟΣΤΟΛΗ ({{count}})",
|
||||||
|
"summaryCount": "ΣΥΝΟΨΗ ({{count}})",
|
||||||
|
"products_one": "{{count}} προϊόν",
|
||||||
|
"products_other": "{{count}} προϊόντα",
|
||||||
|
"ack": {
|
||||||
|
"offline": "Αποθηκεύτηκε Offline",
|
||||||
|
"printing": "Στάλθηκε — Εκτύπωση σε εξέλιξη",
|
||||||
|
"printed": "Εκτυπώθηκε Επιτυχώς"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"summary": {
|
||||||
|
"modifier": "Τροποποιητής",
|
||||||
|
"discount": "Έκπτωση",
|
||||||
|
"free": "Δωρεάν",
|
||||||
|
"freeCaps": "ΔΩΡΕΑΝ",
|
||||||
|
"notPrinted": "Δεν εκτυπώθηκε ακόμα",
|
||||||
|
"ordered": "Παραγγέλθηκε",
|
||||||
|
"paidAt": "Πληρώθηκε",
|
||||||
|
"noItems": "Δεν υπάρχουν αντικείμενα",
|
||||||
|
"due": "Εκκρεμεί",
|
||||||
|
"paidBadge": "Πληρωμένο",
|
||||||
|
"cancelledBadge": "Ακυρωμένο"
|
||||||
|
},
|
||||||
|
"picker": {
|
||||||
|
"noService": "Δεν υπάρχουν service αντικείμενα",
|
||||||
|
"noFavorites": "Δεν έχεις αγαπημένα ακόμα.",
|
||||||
|
"noProducts": "Δεν υπάρχουν προϊόντα",
|
||||||
|
"noTags": "Δεν υπάρχουν tags ακόμα.",
|
||||||
|
"noTagged": "Κανένα προϊόν με αυτό το tag.",
|
||||||
|
"setToGuests_one": "Ορισμός σε {{count}} άτομο",
|
||||||
|
"setToGuests_other": "Ορισμός σε {{count}} άτομα",
|
||||||
|
"noCharge": "χωρίς χρέωση",
|
||||||
|
"noCategory": "Χωρίς Κατηγορία",
|
||||||
|
"categories": "Κατηγορίες",
|
||||||
|
"tags": "Ετικέτες"
|
||||||
|
},
|
||||||
|
"summaryModal": {
|
||||||
|
"edit": "Επεξεργασία",
|
||||||
|
"title": "Επισκόπηση Παραγγελίας"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,9 @@
|
|||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"confirm": "Confirm",
|
"confirm": "Confirm",
|
||||||
"back": "Back",
|
"back": "Back",
|
||||||
"save": "Save"
|
"save": "Save",
|
||||||
|
"apply": "Apply",
|
||||||
|
"sure": "Are you sure?"
|
||||||
},
|
},
|
||||||
"gate": {
|
"gate": {
|
||||||
"closedTitle": "The venue is closed",
|
"closedTitle": "The venue is closed",
|
||||||
@@ -374,8 +376,54 @@
|
|||||||
"tabs": {
|
"tabs": {
|
||||||
"quick": "Quick options",
|
"quick": "Quick options",
|
||||||
"ingredients": "Ingredients",
|
"ingredients": "Ingredients",
|
||||||
"prefs": "Preferences"
|
"prefs": "Preferences",
|
||||||
}
|
"extrasTitle": "Extras",
|
||||||
|
"note": "Note",
|
||||||
|
"quickShort": "Quick",
|
||||||
|
"extras": "Extras",
|
||||||
|
"options": "Options",
|
||||||
|
"price": "Price",
|
||||||
|
"summary": "Summary",
|
||||||
|
"quantity": "Quantity ({{unit}})"
|
||||||
|
},
|
||||||
|
"choose": "Choose",
|
||||||
|
"chooseMany": "Choose (several)",
|
||||||
|
"removed": "Removed",
|
||||||
|
"remove": "Remove",
|
||||||
|
"required": "Required",
|
||||||
|
"choiceRequired": "— choose one",
|
||||||
|
"empty": {
|
||||||
|
"favorites": "No favourites for this product.",
|
||||||
|
"quick": "No quick options.",
|
||||||
|
"extras": "No extras.",
|
||||||
|
"ingredients": "No ingredients.",
|
||||||
|
"prefs": "No preferences."
|
||||||
|
},
|
||||||
|
"qty": {
|
||||||
|
"quickPick": "QUICK PICK",
|
||||||
|
"quickAdd": "QUICK ADD"
|
||||||
|
},
|
||||||
|
"price": {
|
||||||
|
"intro": "Changes the price of this item only. Other orders aren't affected.",
|
||||||
|
"base": "Base: {{price}}"
|
||||||
|
},
|
||||||
|
"notes": {
|
||||||
|
"placeholder": "e.g. No salt, cut in half…",
|
||||||
|
"quickTitle": "Quick notes",
|
||||||
|
"noSalt": "No salt",
|
||||||
|
"quick": "Bring it quickly",
|
||||||
|
"allergy": "Allergy!",
|
||||||
|
"smallPieces": "Cut into small pieces",
|
||||||
|
"napkins": "Extra napkins"
|
||||||
|
},
|
||||||
|
"summary": {
|
||||||
|
"empty": "Nothing changed yet. Use the tabs to set up the product.",
|
||||||
|
"removed": "Removed"
|
||||||
|
},
|
||||||
|
"included": "Included",
|
||||||
|
"selectedCount": "{{count}} selected",
|
||||||
|
"each": "each",
|
||||||
|
"without": "Without {{name}}"
|
||||||
},
|
},
|
||||||
"pairing": {
|
"pairing": {
|
||||||
"empty": "Type the server's address.",
|
"empty": "Type the server's address.",
|
||||||
@@ -386,5 +434,228 @@
|
|||||||
"incompatible": "The server (version {{version}}) doesn't work with this app. Update the app or the 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.",
|
"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."
|
"wrongKey": "The server's security key doesn't match the QR code. Ask the manager for a new QR code."
|
||||||
|
},
|
||||||
|
"detail": {
|
||||||
|
"split": {
|
||||||
|
"title": "Split",
|
||||||
|
"howMany": "Split off how many?",
|
||||||
|
"newLine": "New line:",
|
||||||
|
"remains": "Remains:"
|
||||||
|
},
|
||||||
|
"price": {
|
||||||
|
"title": "Set the price",
|
||||||
|
"tapToType": "Tap to type",
|
||||||
|
"reset": "Back to the original price",
|
||||||
|
"base": "Base: {{base}} {{change}}"
|
||||||
|
},
|
||||||
|
"item": {
|
||||||
|
"price": "Change the price",
|
||||||
|
"priceSub": "Change the price of this item",
|
||||||
|
"again": "Order again",
|
||||||
|
"againSub": "Add to a new cart",
|
||||||
|
"move": "Move to another table",
|
||||||
|
"moveSub": "Move the selected items",
|
||||||
|
"splitSub": "Split into two lines",
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"cancelSub": "Cancel the selected items"
|
||||||
|
},
|
||||||
|
"withApproval": "With a manager's approval (PIN)",
|
||||||
|
"cancelNotAllowed": "Cancelling is not allowed",
|
||||||
|
"discount": {
|
||||||
|
"pickOne": "Pick at least one item",
|
||||||
|
"badPct": "Not a valid percentage",
|
||||||
|
"failed": "Couldn't apply the discount",
|
||||||
|
"rounding": "The final price is rounded to €0.10",
|
||||||
|
"items": "Items",
|
||||||
|
"pct": "Discount (%)",
|
||||||
|
"note": "Note (optional)",
|
||||||
|
"notePlaceholder": "e.g. VIP guest",
|
||||||
|
"applying": "Applying…"
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"discount": "Apply a discount",
|
||||||
|
"markAllServedSub": "Mark every ready item as served",
|
||||||
|
"discountSub": "A discount on items of the order",
|
||||||
|
"discountNotAllowed": "Discounts are not allowed",
|
||||||
|
"transfer": "Transfer the table",
|
||||||
|
"merge": "Merge tables",
|
||||||
|
"mergeSub": "Merge with another table",
|
||||||
|
"flagsSub": "Choose flags",
|
||||||
|
"assignSub": "Add a waiter to the order",
|
||||||
|
"printSub": "Print the order's summary",
|
||||||
|
"cancelSub": "Cancel the whole order"
|
||||||
|
},
|
||||||
|
"noTables": "No tables available",
|
||||||
|
"noFlags": "No flags",
|
||||||
|
"allAssigned": "Every waiter is already assigned",
|
||||||
|
"pickPrinter": "Choose a printer",
|
||||||
|
"cancel": {
|
||||||
|
"title": "Cancel the order?",
|
||||||
|
"button": "Cancel ✕",
|
||||||
|
"whole": "The whole order will be cancelled for good.",
|
||||||
|
"items_one": "{{count}} item will be cancelled for good.",
|
||||||
|
"items_other": "{{count}} items will be cancelled for good."
|
||||||
|
},
|
||||||
|
"guests": {
|
||||||
|
"title": "Number of guests",
|
||||||
|
"question": "How many people sit at the table?",
|
||||||
|
"button": "Number of guests"
|
||||||
|
},
|
||||||
|
"err": {
|
||||||
|
"load": "Couldn't load",
|
||||||
|
"open": "Couldn't open",
|
||||||
|
"offlinePay": "Couldn't save the offline payment",
|
||||||
|
"pay": "Couldn't take the payment",
|
||||||
|
"revert": "Couldn't turn the payment back",
|
||||||
|
"close": "Couldn't close",
|
||||||
|
"cancel": "Couldn't cancel",
|
||||||
|
"cancelOrder": "Couldn't cancel the order",
|
||||||
|
"mark": "Couldn't mark",
|
||||||
|
"splitOffline": "Couldn't split offline",
|
||||||
|
"split": "Couldn't split",
|
||||||
|
"transfer": "Couldn't transfer",
|
||||||
|
"noTargetOrder": "No order found on that table",
|
||||||
|
"merge": "Couldn't merge",
|
||||||
|
"moveItems": "Couldn't move the items",
|
||||||
|
"flags": "Couldn't save the flags"
|
||||||
|
},
|
||||||
|
"openOrder": "Open an order",
|
||||||
|
"noPaid": "No paid items",
|
||||||
|
"revert": {
|
||||||
|
"button": "UNDO",
|
||||||
|
"title": "Turn the payment back?",
|
||||||
|
"items_one": "{{count}} item goes back to unpaid.",
|
||||||
|
"items_other": "{{count}} items go back to unpaid.",
|
||||||
|
"confirm": "Turn back"
|
||||||
|
},
|
||||||
|
"notOffline": "Not available offline",
|
||||||
|
"view": {
|
||||||
|
"title": "How items are shown",
|
||||||
|
"off": "AS ORDERED",
|
||||||
|
"offDesc": "Exactly as they were ordered",
|
||||||
|
"identical": "GROUP IDENTICAL",
|
||||||
|
"identicalDesc": "Same product, same choices, same price",
|
||||||
|
"sameItem": "GROUP ALL",
|
||||||
|
"sameItemDesc": "Same product at the same final price"
|
||||||
|
},
|
||||||
|
"close": {
|
||||||
|
"title": "Close the order?",
|
||||||
|
"body": "This can't be undone."
|
||||||
|
},
|
||||||
|
"move": {
|
||||||
|
"pickFree": "Choose a free table",
|
||||||
|
"mergeSub": "The items move to the chosen table",
|
||||||
|
"itemsTitle": "Move items",
|
||||||
|
"subtitle_one": "Move {{count}} item to a table",
|
||||||
|
"subtitle_other": "Move {{count}} items to a table",
|
||||||
|
"confirmTransfer": "Confirm the transfer",
|
||||||
|
"confirmMerge": "Confirm the merge",
|
||||||
|
"confirmItems": "Confirm moving the items",
|
||||||
|
"transferTo": "Move the order to table",
|
||||||
|
"mergeWith": "Merge the order with table",
|
||||||
|
"itemsTo_one": "Move {{count}} item to table",
|
||||||
|
"itemsTo_other": "Move {{count}} items to table"
|
||||||
|
},
|
||||||
|
"selected_one": "{{count}} item selected",
|
||||||
|
"selected_other": "{{count}} items selected",
|
||||||
|
"pay": {
|
||||||
|
"titleClose": "Confirm payment and close",
|
||||||
|
"title": "Confirm payment",
|
||||||
|
"allAndClose": "Every item: the table closes right after",
|
||||||
|
"all": "Every item",
|
||||||
|
"items_one": "{{count}} item",
|
||||||
|
"items_other": "{{count}} items",
|
||||||
|
"cash": "Cash",
|
||||||
|
"card": "Card",
|
||||||
|
"hold": "Hold…",
|
||||||
|
"paid": "Paid",
|
||||||
|
"yesPaid": "Yes, paid"
|
||||||
|
},
|
||||||
|
"tabs": {
|
||||||
|
"unpaid": "Unpaid",
|
||||||
|
"paid": "Paid"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"add": {
|
||||||
|
"course": {
|
||||||
|
"title": "Set course",
|
||||||
|
"sub": "Quick-add items will use this course.",
|
||||||
|
"none": "No course"
|
||||||
|
},
|
||||||
|
"sendFailed": "Couldn't send: the order wasn't sent",
|
||||||
|
"search": {
|
||||||
|
"title": "Search",
|
||||||
|
"type": "Type to search…",
|
||||||
|
"placeholder": "Search for a product…",
|
||||||
|
"none": "No products found for «{{query}}»"
|
||||||
|
},
|
||||||
|
"allCategories": "All categories",
|
||||||
|
"order": "Order",
|
||||||
|
"empty": "The order is empty.",
|
||||||
|
"note": {
|
||||||
|
"placeholder": "A note for the whole order…",
|
||||||
|
"title": "Order note",
|
||||||
|
"add": "Add an order note"
|
||||||
|
},
|
||||||
|
"deal": {
|
||||||
|
"title": "Deal unlocked!",
|
||||||
|
"freeProduct": "Free product:",
|
||||||
|
"skip": "Skip",
|
||||||
|
"pickFree_one": "Choose {{count}} free product",
|
||||||
|
"pickFree_other": "Choose {{count}} free products",
|
||||||
|
"remaining": "({{count}} more)",
|
||||||
|
"addFree": "Add for free"
|
||||||
|
},
|
||||||
|
"inCart": "in the cart",
|
||||||
|
"edit": "Edit",
|
||||||
|
"optionGone": "«{{product}}»: «{{what}}» is not on the menu any more. Remove it and add it again.",
|
||||||
|
"offlineSaveFailed": "Couldn't save the offline order",
|
||||||
|
"totalEstimateOffline": "Total (estimate, offline)",
|
||||||
|
"totalEstimate": "Total (estimate)",
|
||||||
|
"withoutList": "Without: {{names}}",
|
||||||
|
"newOrder": "New order",
|
||||||
|
"add": "Add",
|
||||||
|
"moreSeeAll": "+{{count}} more: see all →",
|
||||||
|
"sending": "Sending…",
|
||||||
|
"send": "SEND",
|
||||||
|
"sendCount": "SEND ({{count}})",
|
||||||
|
"summaryCount": "SUMMARY ({{count}})",
|
||||||
|
"products_one": "{{count}} product",
|
||||||
|
"products_other": "{{count}} products",
|
||||||
|
"ack": {
|
||||||
|
"offline": "Saved offline",
|
||||||
|
"printing": "Sent: printing",
|
||||||
|
"printed": "Printed"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"summary": {
|
||||||
|
"modifier": "Price rule",
|
||||||
|
"discount": "Discount",
|
||||||
|
"free": "Free",
|
||||||
|
"freeCaps": "FREE",
|
||||||
|
"notPrinted": "Not printed yet",
|
||||||
|
"ordered": "Ordered",
|
||||||
|
"paidAt": "Paid",
|
||||||
|
"noItems": "No items",
|
||||||
|
"due": "Due",
|
||||||
|
"paidBadge": "Paid",
|
||||||
|
"cancelledBadge": "Cancelled"
|
||||||
|
},
|
||||||
|
"picker": {
|
||||||
|
"noService": "No service items",
|
||||||
|
"noFavorites": "You don't have favourites yet.",
|
||||||
|
"noProducts": "No products",
|
||||||
|
"noTags": "No tags yet.",
|
||||||
|
"noTagged": "No product has this tag.",
|
||||||
|
"setToGuests_one": "Set to {{count}} guest",
|
||||||
|
"setToGuests_other": "Set to {{count}} guests",
|
||||||
|
"noCharge": "no charge",
|
||||||
|
"noCategory": "No category",
|
||||||
|
"categories": "Categories",
|
||||||
|
"tags": "Tags"
|
||||||
|
},
|
||||||
|
"summaryModal": {
|
||||||
|
"edit": "Edit",
|
||||||
|
"title": "Order summary"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import { useState, useEffect, useRef } from 'react'
|
|||||||
import { useCan } from '@xenia/access'
|
import { useCan } from '@xenia/access'
|
||||||
import useWaiterFavoritesStore from '../store/waiterFavoritesStore'
|
import useWaiterFavoritesStore from '../store/waiterFavoritesStore'
|
||||||
import { assetUrl } from '../config/server'
|
import { assetUrl } from '../config/server'
|
||||||
|
import { money } from '../i18n'
|
||||||
|
import { useTranslation } from '@xenia/i18n'
|
||||||
|
|
||||||
// ── Helpers ──────────────────────────────────────────────────────────────────
|
// ── Helpers ──────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -78,7 +80,6 @@ function buildFavorites(product, waiterOverride) {
|
|||||||
return items.sort((a, b) => a.sortOrder - b.sortOrder)
|
return items.sort((a, b) => a.sortOrder - b.sortOrder)
|
||||||
}
|
}
|
||||||
|
|
||||||
const QUICK_NOTES = ['Χωρίς αλάτι', 'Βγάλτε γρήγορα', 'Αλλεργία!', 'Κόψτε σε μικρά κομμάτια', 'Έξτρα χαρτοπετσέτες']
|
|
||||||
|
|
||||||
// ── Primitives ────────────────────────────────────────────────────────────────
|
// ── Primitives ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -150,6 +151,7 @@ function Row({ selected, onClick, children, right, left, style = {} }) {
|
|||||||
// ── Shared: single quick option row ──────────────────────────────────────────
|
// ── Shared: single quick option row ──────────────────────────────────────────
|
||||||
|
|
||||||
function QuickOptionRow({ opt, quickState, setQuickState, compact }) {
|
function QuickOptionRow({ opt, quickState, setQuickState, compact }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const qty = quickState[opt.id] || 0
|
const qty = quickState[opt.id] || 0
|
||||||
const selected = qty > 0
|
const selected = qty > 0
|
||||||
const toggleSingle = () => setQuickState(s => ({ ...s, [opt.id]: selected ? 0 : 1 }))
|
const toggleSingle = () => setQuickState(s => ({ ...s, [opt.id]: selected ? 0 : 1 }))
|
||||||
@@ -172,7 +174,7 @@ function QuickOptionRow({ opt, quickState, setQuickState, compact }) {
|
|||||||
) : null}
|
) : null}
|
||||||
>
|
>
|
||||||
<div style={{ fontSize: compact ? 13 : 15, fontWeight: 500, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{opt.name}</div>
|
<div style={{ fontSize: compact ? 13 : 15, fontWeight: 500, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{opt.name}</div>
|
||||||
{opt.price > 0 && <div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>+{opt.price.toFixed(2)} €{opt.allow_multiple ? ' each' : ''}</div>}
|
{opt.price > 0 && <div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>+{money(opt.price)}{opt.allow_multiple ? ` ${t('drawer.each')}` : ''}</div>}
|
||||||
</Row>
|
</Row>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -180,6 +182,7 @@ function QuickOptionRow({ opt, quickState, setQuickState, compact }) {
|
|||||||
// ── Shared: single extra/option row ──────────────────────────────────────────
|
// ── Shared: single extra/option row ──────────────────────────────────────────
|
||||||
|
|
||||||
function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setExpandedExtra, compact }) {
|
function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setExpandedExtra, compact }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const sel = extrasState[opt.id]
|
const sel = extrasState[opt.id]
|
||||||
const selected = !!sel
|
const selected = !!sel
|
||||||
const open = expandedExtra === opt.id
|
const open = expandedExtra === opt.id
|
||||||
@@ -245,10 +248,10 @@ function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setEx
|
|||||||
>
|
>
|
||||||
<div style={{ fontSize: compact ? 13 : 15, fontWeight: 500, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{opt.name}</div>
|
<div style={{ fontSize: compact ? 13 : 15, fontWeight: 500, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{opt.name}</div>
|
||||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>
|
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>
|
||||||
{(opt.extra_cost ?? 0) !== 0 ? `+${opt.extra_cost.toFixed(2)} €` : 'Included'}
|
{(opt.extra_cost ?? 0) !== 0 ? `+${money(opt.extra_cost)}` : t('drawer.included')}
|
||||||
{subLabel && <span style={{ color: '#f59e0b', fontWeight: 600 }}> · {subLabel}</span>}
|
{subLabel && <span style={{ color: '#f59e0b', fontWeight: 600 }}> · {subLabel}</span>}
|
||||||
{isMultiSelect && selectedSubCount > 0 && (
|
{isMultiSelect && selectedSubCount > 0 && (
|
||||||
<span style={{ color: '#f59e0b', fontWeight: 600 }}> · {selectedSubCount} επιλεγμένα</span>
|
<span style={{ color: '#f59e0b', fontWeight: 600 }}> · {t('drawer.selectedCount', { count: selectedSubCount })}</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Row>
|
</Row>
|
||||||
@@ -256,7 +259,7 @@ function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setEx
|
|||||||
{/* Single-select sub-choices (radio) */}
|
{/* Single-select sub-choices (radio) */}
|
||||||
{selected && open && hasSubs && !isMultiSelect && (
|
{selected && open && hasSubs && !isMultiSelect && (
|
||||||
<div style={{ margin: '6px 0 2px 16px', paddingLeft: 14, borderLeft: '2px solid rgba(245,158,11,0.3)', display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
<div style={{ margin: '6px 0 2px 16px', paddingLeft: 14, borderLeft: '2px solid rgba(245,158,11,0.3)', display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
||||||
<div style={{ width: '100%', fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, padding: '6px 2px 2px' }}>Επιλογή</div>
|
<div style={{ width: '100%', fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, padding: '6px 2px 2px' }}>{t('drawer.choose')}</div>
|
||||||
{opt.sub_choices.map((sub, si) => {
|
{opt.sub_choices.map((sub, si) => {
|
||||||
const isSel = sel.subName === sub.name
|
const isSel = sel.subName === sub.name
|
||||||
return (
|
return (
|
||||||
@@ -267,7 +270,7 @@ function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setEx
|
|||||||
style={sub.is_compact ? { minHeight: 44 } : {}}>
|
style={sub.is_compact ? { minHeight: 44 } : {}}>
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||||
<div style={{ fontSize: sub.is_compact ? 12 : 14, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{sub.name}</div>
|
<div style={{ fontSize: sub.is_compact ? 12 : 14, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{sub.name}</div>
|
||||||
{(sub.extra_cost ?? 0) !== 0 && <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0, marginLeft: 6 }}>+{sub.extra_cost.toFixed(2)} €</div>}
|
{(sub.extra_cost ?? 0) !== 0 && <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0, marginLeft: 6 }}>+{money(sub.extra_cost)}</div>}
|
||||||
</div>
|
</div>
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
@@ -279,7 +282,7 @@ function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setEx
|
|||||||
{/* Multi-select sub-choices (checkboxes, optional qty stepper per sub) */}
|
{/* Multi-select sub-choices (checkboxes, optional qty stepper per sub) */}
|
||||||
{selected && open && hasSubs && isMultiSelect && (
|
{selected && open && hasSubs && isMultiSelect && (
|
||||||
<div style={{ margin: '6px 0 2px 16px', paddingLeft: 14, borderLeft: '2px solid rgba(245,158,11,0.3)', display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
<div style={{ margin: '6px 0 2px 16px', paddingLeft: 14, borderLeft: '2px solid rgba(245,158,11,0.3)', display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
||||||
<div style={{ width: '100%', fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, padding: '6px 2px 2px' }}>Επιλογή (πολλαπλή)</div>
|
<div style={{ width: '100%', fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, padding: '6px 2px 2px' }}>{t('drawer.chooseMany')}</div>
|
||||||
{opt.sub_choices.map((sub, si) => {
|
{opt.sub_choices.map((sub, si) => {
|
||||||
const subQty = subs[sub.name] || 0
|
const subQty = subs[sub.name] || 0
|
||||||
const subSel = subQty > 0
|
const subSel = subQty > 0
|
||||||
@@ -306,7 +309,7 @@ function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setEx
|
|||||||
{sub.name}
|
{sub.name}
|
||||||
{subQty > 1 && <span style={{ color: 'var(--muted)', marginLeft: 6, fontSize: 12, fontVariantNumeric: 'tabular-nums' }}>×{subQty}</span>}
|
{subQty > 1 && <span style={{ color: 'var(--muted)', marginLeft: 6, fontSize: 12, fontVariantNumeric: 'tabular-nums' }}>×{subQty}</span>}
|
||||||
</div>
|
</div>
|
||||||
{(sub.extra_cost ?? 0) !== 0 && <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0, marginLeft: 6 }}>+{sub.extra_cost.toFixed(2)} €{sub.allow_multiple ? ' each' : ''}</div>}
|
{(sub.extra_cost ?? 0) !== 0 && <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0, marginLeft: 6 }}>+{money(sub.extra_cost)}{sub.allow_multiple ? ` ${t('drawer.each')}` : ''}</div>}
|
||||||
</div>
|
</div>
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
@@ -321,6 +324,7 @@ function ExtraOptionRow({ opt, extrasState, setExtrasState, expandedExtra, setEx
|
|||||||
// ── Shared: single ingredient row ─────────────────────────────────────────────
|
// ── Shared: single ingredient row ─────────────────────────────────────────────
|
||||||
|
|
||||||
function IngredientRow({ ing, removedState, setRemovedState, compact }) {
|
function IngredientRow({ ing, removedState, setRemovedState, compact }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const removed = !!removedState[ing.id]
|
const removed = !!removedState[ing.id]
|
||||||
return (
|
return (
|
||||||
<Row selected={false}
|
<Row selected={false}
|
||||||
@@ -336,7 +340,7 @@ function IngredientRow({ ing, removedState, setRemovedState, compact }) {
|
|||||||
display: 'inline-flex', alignItems: 'center',
|
display: 'inline-flex', alignItems: 'center',
|
||||||
transition: 'all 120ms ease', whiteSpace: 'nowrap',
|
transition: 'all 120ms ease', whiteSpace: 'nowrap',
|
||||||
}}>
|
}}>
|
||||||
{removed ? 'Αφαιρέθηκε' : 'Αφαίρεση'}
|
{removed ? t('drawer.removed') : t('drawer.remove')}
|
||||||
</div>
|
</div>
|
||||||
}>
|
}>
|
||||||
<div style={{ fontSize: compact ? 13 : 15, fontWeight: 500, color: removed ? 'var(--muted)' : 'var(--text)', textDecoration: removed ? 'line-through' : 'none', transition: 'all 120ms', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{ing.name}</div>
|
<div style={{ fontSize: compact ? 13 : 15, fontWeight: 500, color: removed ? 'var(--muted)' : 'var(--text)', textDecoration: removed ? 'line-through' : 'none', transition: 'all 120ms', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{ing.name}</div>
|
||||||
@@ -347,6 +351,7 @@ function IngredientRow({ ing, removedState, setRemovedState, compact }) {
|
|||||||
// ── Shared: single preference set ─────────────────────────────────────────────
|
// ── Shared: single preference set ─────────────────────────────────────────────
|
||||||
|
|
||||||
function PrefSetBlock({ ps, prefs, setPrefs, subChoices, setSubChoices, sharedSubs, setSharedSubs }) {
|
function PrefSetBlock({ ps, prefs, setPrefs, subChoices, setSubChoices, sharedSubs, setSharedSubs }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const selChoice = prefs[ps.id] ?? null
|
const selChoice = prefs[ps.id] ?? null
|
||||||
const complete = selChoice != null
|
const complete = selChoice != null
|
||||||
&& !(selChoice.sub_choices?.length > 0 && subChoices[selChoice.id] == null)
|
&& !(selChoice.sub_choices?.length > 0 && subChoices[selChoice.id] == null)
|
||||||
@@ -367,7 +372,7 @@ function PrefSetBlock({ ps, prefs, setPrefs, subChoices, setSubChoices, sharedSu
|
|||||||
<div>
|
<div>
|
||||||
<div style={{ display: 'flex', alignItems: 'baseline', gap: 8, padding: '0 2px 10px' }}>
|
<div style={{ display: 'flex', alignItems: 'baseline', gap: 8, padding: '0 2px 10px' }}>
|
||||||
<div style={{ fontSize: 14, fontWeight: 700, color: complete ? 'var(--text)' : '#ef4444' }}>{ps.name}</div>
|
<div style={{ fontSize: 14, fontWeight: 700, color: complete ? 'var(--text)' : '#ef4444' }}>{ps.name}</div>
|
||||||
{!complete && <div style={{ fontSize: 11, fontWeight: 700, color: '#ef4444', textTransform: 'uppercase', letterSpacing: 0.6 }}>Απαιτείται</div>}
|
{!complete && <div style={{ fontSize: 11, fontWeight: 700, color: '#ef4444', textTransform: 'uppercase', letterSpacing: 0.6 }}>{t('drawer.required')}</div>}
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
|
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
|
||||||
{ps.choices.map(ch => {
|
{ps.choices.map(ch => {
|
||||||
@@ -379,20 +384,20 @@ function PrefSetBlock({ ps, prefs, setPrefs, subChoices, setSubChoices, sharedSu
|
|||||||
<div key={ch.id} style={{ width: ch.is_compact ? 'calc(50% - 4px)' : '100%', minWidth: 0 }}>
|
<div key={ch.id} style={{ width: ch.is_compact ? 'calc(50% - 4px)' : '100%', minWidth: 0 }}>
|
||||||
<Row selected={isSel} onClick={() => selectPref(ch)} left={<RadioDot selected={isSel} />}
|
<Row selected={isSel} onClick={() => selectPref(ch)} left={<RadioDot selected={isSel} />}
|
||||||
style={ch.is_compact ? { minHeight: 48 } : {}}
|
style={ch.is_compact ? { minHeight: 48 } : {}}
|
||||||
right={(ch.extra_cost ?? 0) !== 0 ? <div style={{ fontSize: ch.is_compact ? 12 : 14, fontWeight: 500, color: 'var(--muted)', flexShrink: 0 }}>{ch.extra_cost > 0 ? '+' : ''}{ch.extra_cost.toFixed(2)} €</div> : null}>
|
right={(ch.extra_cost ?? 0) !== 0 ? <div style={{ fontSize: ch.is_compact ? 12 : 14, fontWeight: 500, color: 'var(--muted)', flexShrink: 0 }}>{ch.extra_cost > 0 ? '+' : ''}{money(ch.extra_cost)}</div> : null}>
|
||||||
<div style={{ fontSize: ch.is_compact ? 13 : 15, fontWeight: 500, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{ch.name}</div>
|
<div style={{ fontSize: ch.is_compact ? 13 : 15, fontWeight: 500, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{ch.name}</div>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
{isSel && hasSubs && (
|
{isSel && hasSubs && (
|
||||||
<div style={{ margin: '6px 0 2px 16px', paddingLeft: 14, borderLeft: `2px solid ${subMissing ? '#ef4444' : 'rgba(245,158,11,0.3)'}`, display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
<div style={{ margin: '6px 0 2px 16px', paddingLeft: 14, borderLeft: `2px solid ${subMissing ? '#ef4444' : 'rgba(245,158,11,0.3)'}`, display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
||||||
{subMissing && <p style={{ width: '100%', fontSize: 12, color: '#ef4444', margin: '4px 2px 2px' }}>— απαιτείται επιλογή</p>}
|
{subMissing && <p style={{ width: '100%', fontSize: 12, color: '#ef4444', margin: '4px 2px 2px' }}>{t('drawer.choiceRequired')}</p>}
|
||||||
{ch.sub_choices.map((sub, si) => {
|
{ch.sub_choices.map((sub, si) => {
|
||||||
const subSel = subChoices[ch.id]?.name === sub.name
|
const subSel = subChoices[ch.id]?.name === sub.name
|
||||||
return (
|
return (
|
||||||
<div key={si} style={{ width: sub.is_compact ? 'calc(50% - 3px)' : '100%', minWidth: 0 }}>
|
<div key={si} style={{ width: sub.is_compact ? 'calc(50% - 3px)' : '100%', minWidth: 0 }}>
|
||||||
<Row selected={subSel} onClick={() => setSubChoices(s => ({ ...s, [ch.id]: sub }))} left={<RadioDot selected={subSel} />}
|
<Row selected={subSel} onClick={() => setSubChoices(s => ({ ...s, [ch.id]: sub }))} left={<RadioDot selected={subSel} />}
|
||||||
style={sub.is_compact ? { minHeight: 44 } : {}}
|
style={sub.is_compact ? { minHeight: 44 } : {}}
|
||||||
right={(sub.extra_cost ?? 0) !== 0 ? <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0 }}>+{sub.extra_cost.toFixed(2)} €</div> : null}>
|
right={(sub.extra_cost ?? 0) !== 0 ? <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0 }}>+{money(sub.extra_cost)}</div> : null}>
|
||||||
<div style={{ fontSize: sub.is_compact ? 12 : 14, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{sub.name}</div>
|
<div style={{ fontSize: sub.is_compact ? 12 : 14, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{sub.name}</div>
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
@@ -414,7 +419,7 @@ function PrefSetBlock({ ps, prefs, setPrefs, subChoices, setSubChoices, sharedSu
|
|||||||
<div key={si} style={{ width: sub.is_compact ? 'calc(50% - 3px)' : '100%', minWidth: 0 }}>
|
<div key={si} style={{ width: sub.is_compact ? 'calc(50% - 3px)' : '100%', minWidth: 0 }}>
|
||||||
<Row selected={subSel} onClick={() => setSharedSubs(s => ({ ...s, [ps.id]: sub }))} left={<RadioDot selected={subSel} />}
|
<Row selected={subSel} onClick={() => setSharedSubs(s => ({ ...s, [ps.id]: sub }))} left={<RadioDot selected={subSel} />}
|
||||||
style={sub.is_compact ? { minHeight: 44 } : {}}
|
style={sub.is_compact ? { minHeight: 44 } : {}}
|
||||||
right={(sub.extra_cost ?? 0) !== 0 ? <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0 }}>+{sub.extra_cost.toFixed(2)} €</div> : null}>
|
right={(sub.extra_cost ?? 0) !== 0 ? <div style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0 }}>+{money(sub.extra_cost)}</div> : null}>
|
||||||
<div style={{ fontSize: sub.is_compact ? 12 : 14, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{sub.name}</div>
|
<div style={{ fontSize: sub.is_compact ? 12 : 14, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{sub.name}</div>
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
@@ -431,10 +436,11 @@ function PrefSetBlock({ ps, prefs, setPrefs, subChoices, setSubChoices, sharedSu
|
|||||||
// ── Tab: Favorites ────────────────────────────────────────────────────────────
|
// ── Tab: Favorites ────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
function FavoritesTab({ product, waiterOverride, quickState, setQuickState, extrasState, setExtrasState, expandedExtra, setExpandedExtra, removedState, setRemovedState, prefs, setPrefs, subChoices, setSubChoices, sharedSubs, setSharedSubs }) {
|
function FavoritesTab({ product, waiterOverride, quickState, setQuickState, extrasState, setExtrasState, expandedExtra, setExpandedExtra, removedState, setRemovedState, prefs, setPrefs, subChoices, setSubChoices, sharedSubs, setSharedSubs }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const favorites = buildFavorites(product, waiterOverride)
|
const favorites = buildFavorites(product, waiterOverride)
|
||||||
|
|
||||||
if (favorites.length === 0) return (
|
if (favorites.length === 0) return (
|
||||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>Δεν υπάρχουν αγαπημένα για αυτό το προϊόν.</p>
|
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>{t('drawer.empty.favorites')}</p>
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -467,9 +473,10 @@ function FavoritesTab({ product, waiterOverride, quickState, setQuickState, extr
|
|||||||
// ── Tab: Quick Options ────────────────────────────────────────────────────────
|
// ── Tab: Quick Options ────────────────────────────────────────────────────────
|
||||||
|
|
||||||
function QuickTab({ product, quickState, setQuickState }) {
|
function QuickTab({ product, quickState, setQuickState }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const quickOptions = product.quick_options || []
|
const quickOptions = product.quick_options || []
|
||||||
if (quickOptions.length === 0) return (
|
if (quickOptions.length === 0) return (
|
||||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>Δεν υπάρχουν γρήγορες επιλογές.</p>
|
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>{t('drawer.empty.quick')}</p>
|
||||||
)
|
)
|
||||||
return (
|
return (
|
||||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
|
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
|
||||||
@@ -538,11 +545,12 @@ function partitionByGroup(items, modifierGroups) {
|
|||||||
// ── Tab: Extras ───────────────────────────────────────────────────────────────
|
// ── Tab: Extras ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
function ExtrasTab({ product, extrasState, setExtrasState, expandedExtra, setExpandedExtra }) {
|
function ExtrasTab({ product, extrasState, setExtrasState, expandedExtra, setExpandedExtra }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const extraGroups = (product.modifier_groups || []).filter(g => g.modifier_type === 'option')
|
const extraGroups = (product.modifier_groups || []).filter(g => g.modifier_type === 'option')
|
||||||
const [collapsedGroups, setCollapsedGroups] = useState(() => Object.fromEntries(extraGroups.map(g => [g.id, true])))
|
const [collapsedGroups, setCollapsedGroups] = useState(() => Object.fromEntries(extraGroups.map(g => [g.id, true])))
|
||||||
const options = product.options || []
|
const options = product.options || []
|
||||||
if (options.length === 0) return (
|
if (options.length === 0) return (
|
||||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>Δεν υπάρχουν extras.</p>
|
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>{t('drawer.empty.extras')}</p>
|
||||||
)
|
)
|
||||||
|
|
||||||
function toggleGroup(id) { setCollapsedGroups(s => ({ ...s, [id]: !s[id] })) }
|
function toggleGroup(id) { setCollapsedGroups(s => ({ ...s, [id]: !s[id] })) }
|
||||||
@@ -581,14 +589,15 @@ function ExtrasTab({ product, extrasState, setExtrasState, expandedExtra, setExp
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Tab: Υλικά (Ingredients) ─────────────────────────────────────────────────
|
// ── Tab: Ingredients ─────────────────────────────────────────────────
|
||||||
|
|
||||||
function IngredientsTab({ product, removedState, setRemovedState }) {
|
function IngredientsTab({ product, removedState, setRemovedState }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const ingGroups = (product.modifier_groups || []).filter(g => g.modifier_type === 'ingredient')
|
const ingGroups = (product.modifier_groups || []).filter(g => g.modifier_type === 'ingredient')
|
||||||
const [collapsedGroups, setCollapsedGroups] = useState(() => Object.fromEntries(ingGroups.map(g => [g.id, true])))
|
const [collapsedGroups, setCollapsedGroups] = useState(() => Object.fromEntries(ingGroups.map(g => [g.id, true])))
|
||||||
const ingredients = product.ingredients || []
|
const ingredients = product.ingredients || []
|
||||||
if (ingredients.length === 0) return (
|
if (ingredients.length === 0) return (
|
||||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>Δεν υπάρχουν υλικά.</p>
|
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>{t('drawer.empty.ingredients')}</p>
|
||||||
)
|
)
|
||||||
|
|
||||||
function toggleGroup(id) { setCollapsedGroups(s => ({ ...s, [id]: !s[id] })) }
|
function toggleGroup(id) { setCollapsedGroups(s => ({ ...s, [id]: !s[id] })) }
|
||||||
@@ -627,14 +636,15 @@ function IngredientsTab({ product, removedState, setRemovedState }) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Tab: Προτιμήσεις ─────────────────────────────────────────────────────────
|
// ── Tab: Preferences ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
function PrefsTab({ product, prefs, setPrefs, subChoices, setSubChoices, sharedSubs, setSharedSubs }) {
|
function PrefsTab({ product, prefs, setPrefs, subChoices, setSubChoices, sharedSubs, setSharedSubs }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const prefGroups = (product.modifier_groups || []).filter(g => g.modifier_type === 'preference')
|
const prefGroups = (product.modifier_groups || []).filter(g => g.modifier_type === 'preference')
|
||||||
const [collapsedGroups, setCollapsedGroups] = useState(() => Object.fromEntries(prefGroups.map(g => [g.id, true])))
|
const [collapsedGroups, setCollapsedGroups] = useState(() => Object.fromEntries(prefGroups.map(g => [g.id, true])))
|
||||||
const preferenceSets = product.preference_sets || []
|
const preferenceSets = product.preference_sets || []
|
||||||
if (preferenceSets.length === 0) return (
|
if (preferenceSets.length === 0) return (
|
||||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>Δεν υπάρχουν προτιμήσεις.</p>
|
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '32px 0', fontSize: 14 }}>{t('drawer.empty.prefs')}</p>
|
||||||
)
|
)
|
||||||
|
|
||||||
function toggleGroup(id) { setCollapsedGroups(s => ({ ...s, [id]: !s[id] })) }
|
function toggleGroup(id) { setCollapsedGroups(s => ({ ...s, [id]: !s[id] })) }
|
||||||
@@ -694,6 +704,7 @@ function fmtDecimalQty(qty, cfg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function QuantityTab({ unitCfg, qty, setQty }) {
|
function QuantityTab({ unitCfg, qty, setQty }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const [editingQty, setEditingQty] = useState(false)
|
const [editingQty, setEditingQty] = useState(false)
|
||||||
const [qtyInput, setQtyInput] = useState('')
|
const [qtyInput, setQtyInput] = useState('')
|
||||||
const inputRef = useRef(null)
|
const inputRef = useRef(null)
|
||||||
@@ -747,7 +758,7 @@ function QuantityTab({ unitCfg, qty, setQty }) {
|
|||||||
|
|
||||||
{/* Quick presets — 3 rows of 4 */}
|
{/* Quick presets — 3 rows of 4 */}
|
||||||
<div>
|
<div>
|
||||||
<p style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', letterSpacing: 0.8, marginBottom: 8, textAlign: 'center' }}>ΓΡΗΓΟΡΗ ΕΠΙΛΟΓΗ</p>
|
<p style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', letterSpacing: 0.8, marginBottom: 8, textAlign: 'center' }}>{t('drawer.qty.quickPick')}</p>
|
||||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 8 }}>
|
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 8 }}>
|
||||||
{unitCfg.presets.map(v => (
|
{unitCfg.presets.map(v => (
|
||||||
<button
|
<button
|
||||||
@@ -769,7 +780,7 @@ function QuantityTab({ unitCfg, qty, setQty }) {
|
|||||||
|
|
||||||
{/* Quick ± offset buttons — 2×2 grid */}
|
{/* Quick ± offset buttons — 2×2 grid */}
|
||||||
<div>
|
<div>
|
||||||
<p style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', letterSpacing: 0.8, marginBottom: 8, textAlign: 'center' }}>ΓΡΗΓΟΡΗ ΠΡΟΣΘΗΚΗ</p>
|
<p style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', letterSpacing: 0.8, marginBottom: 8, textAlign: 'center' }}>{t('drawer.qty.quickAdd')}</p>
|
||||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 8 }}>
|
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 8 }}>
|
||||||
{unitCfg.offsets.map(off => (
|
{unitCfg.offsets.map(off => (
|
||||||
<button
|
<button
|
||||||
@@ -804,6 +815,7 @@ function QuantityTab({ unitCfg, qty, setQty }) {
|
|||||||
const PRICE_DELTAS = [-5, -3, -2, -1, -0.5, -0.2, +0.2, +0.5, +1, +2, +3, +5]
|
const PRICE_DELTAS = [-5, -3, -2, -1, -0.5, -0.2, +0.2, +0.5, +1, +2, +3, +5]
|
||||||
|
|
||||||
function PriceAdjustTab({ basePrice, priceAdj, setPriceAdj }) {
|
function PriceAdjustTab({ basePrice, priceAdj, setPriceAdj }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const [editing, setEditing] = useState(false)
|
const [editing, setEditing] = useState(false)
|
||||||
const [rawInput, setRawInput] = useState('')
|
const [rawInput, setRawInput] = useState('')
|
||||||
const inputRef = useRef(null)
|
const inputRef = useRef(null)
|
||||||
@@ -832,7 +844,7 @@ function PriceAdjustTab({ basePrice, priceAdj, setPriceAdj }) {
|
|||||||
return (
|
return (
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 20 }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 20 }}>
|
||||||
<div style={{ padding: '10px 14px', background: 'rgba(245,158,11,0.08)', border: '1px solid rgba(245,158,11,0.2)', borderRadius: 10, fontSize: 13, color: '#f59e0b' }}>
|
<div style={{ padding: '10px 14px', background: 'rgba(245,158,11,0.08)', border: '1px solid rgba(245,158,11,0.2)', borderRadius: 10, fontSize: 13, color: '#f59e0b' }}>
|
||||||
Αλλαγή τιμής μόνο για αυτό το αντικείμενο. Δεν επηρεάζει άλλες παραγγελίες.
|
{t('drawer.price.intro')}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Price display / input */}
|
{/* Price display / input */}
|
||||||
@@ -857,7 +869,7 @@ function PriceAdjustTab({ basePrice, priceAdj, setPriceAdj }) {
|
|||||||
color: priceAdj !== 0 ? '#f59e0b' : 'var(--text)',
|
color: priceAdj !== 0 ? '#f59e0b' : 'var(--text)',
|
||||||
fontSize: 22, fontWeight: 800, cursor: 'pointer', fontFamily: 'inherit',
|
fontSize: 22, fontWeight: 800, cursor: 'pointer', fontFamily: 'inherit',
|
||||||
}}>
|
}}>
|
||||||
{effectivePrice.toFixed(2)} €
|
{money(effectivePrice)}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
<button onClick={() => applyDelta(+0.1)} style={{ width: 44, height: 44, borderRadius: '50%', border: '1.5px solid var(--border)', background: 'var(--bg3)', fontSize: 20, fontWeight: 700, color: 'var(--text)', cursor: 'pointer' }}>+</button>
|
<button onClick={() => applyDelta(+0.1)} style={{ width: 44, height: 44, borderRadius: '50%', border: '1.5px solid var(--border)', background: 'var(--bg3)', fontSize: 20, fontWeight: 700, color: 'var(--text)', cursor: 'pointer' }}>+</button>
|
||||||
@@ -865,11 +877,11 @@ function PriceAdjustTab({ basePrice, priceAdj, setPriceAdj }) {
|
|||||||
|
|
||||||
{priceAdj !== 0 && (
|
{priceAdj !== 0 && (
|
||||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 10 }}>
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 10 }}>
|
||||||
<span style={{ fontSize: 13, color: 'var(--muted)' }}>Βάση: {basePrice.toFixed(2)} €</span>
|
<span style={{ fontSize: 13, color: 'var(--muted)' }}>{t('drawer.price.base', { price: money(basePrice) })}</span>
|
||||||
<span style={{ fontSize: 13, fontWeight: 700, color: priceAdj > 0 ? '#4ade80' : '#f87171' }}>
|
<span style={{ fontSize: 13, fontWeight: 700, color: priceAdj > 0 ? '#4ade80' : '#f87171' }}>
|
||||||
{priceAdj > 0 ? '+' : ''}{priceAdj.toFixed(2)} €
|
{priceAdj > 0 ? '+' : ''}{money(priceAdj)}
|
||||||
</span>
|
</span>
|
||||||
<button onClick={() => setPriceAdj(0)} style={{ padding: '3px 10px', borderRadius: 8, border: '1px solid var(--border)', background: 'var(--bg3)', color: 'var(--muted)', fontSize: 12, cursor: 'pointer' }}>Επαναφορά</button>
|
<button onClick={() => setPriceAdj(0)} style={{ padding: '3px 10px', borderRadius: 8, border: '1px solid var(--border)', background: 'var(--bg3)', color: 'var(--muted)', fontSize: 12, cursor: 'pointer' }}>{t('settings.reset.title')}</button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -896,19 +908,21 @@ function PriceAdjustTab({ basePrice, priceAdj, setPriceAdj }) {
|
|||||||
|
|
||||||
// ── Tab: Notes ────────────────────────────────────────────────────────────────
|
// ── Tab: Notes ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
function NotesTab({ note, setNote, quickNotes = FALLBACK_QUICK_NOTES }) {
|
function NotesTab({ note, setNote, quickNotes }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
|
quickNotes = quickNotes ?? FALLBACK_QUICK_NOTES.map(k => t(k))
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<textarea
|
<textarea
|
||||||
value={note}
|
value={note}
|
||||||
onChange={e => setNote(e.target.value)}
|
onChange={e => setNote(e.target.value)}
|
||||||
placeholder="π.χ. Χωρίς αλάτι, κόψτε στη μέση..."
|
placeholder={t('drawer.notes.placeholder')}
|
||||||
rows={5}
|
rows={5}
|
||||||
style={{ width: '100%', padding: 14, fontSize: 15, fontFamily: 'inherit', color: 'var(--text)', background: 'var(--bg2)', border: '1px solid var(--border)', borderRadius: 12, resize: 'none', outline: 'none', boxSizing: 'border-box' }}
|
style={{ width: '100%', padding: 14, fontSize: 15, fontFamily: 'inherit', color: 'var(--text)', background: 'var(--bg2)', border: '1px solid var(--border)', borderRadius: 12, resize: 'none', outline: 'none', boxSizing: 'border-box' }}
|
||||||
/>
|
/>
|
||||||
{quickNotes.length > 0 && (
|
{quickNotes.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, marginTop: 20, marginBottom: 8 }}>Γρήγορες σημειώσεις</div>
|
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6, marginTop: 20, marginBottom: 8 }}>{t('drawer.notes.quickTitle')}</div>
|
||||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
|
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
|
||||||
{quickNotes.map(q => (
|
{quickNotes.map(q => (
|
||||||
<button key={q} onClick={() => setNote(n => n ? `${n}\n${q}` : q)}
|
<button key={q} onClick={() => setNote(n => n ? `${n}\n${q}` : q)}
|
||||||
@@ -927,12 +941,13 @@ function NotesTab({ note, setNote, quickNotes = FALLBACK_QUICK_NOTES }) {
|
|||||||
|
|
||||||
/** One group of the summary (prefs, quick options, extras, removed) with its "change" link. */
|
/** One group of the summary (prefs, quick options, extras, removed) with its "change" link. */
|
||||||
function Section({ title, tab, lines, onJumpTab }) {
|
function Section({ title, tab, lines, onJumpTab }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
if (lines.length === 0) return null
|
if (lines.length === 0) return null
|
||||||
return (
|
return (
|
||||||
<div style={{ marginBottom: 20 }}>
|
<div style={{ marginBottom: 20 }}>
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '0 2px 8px' }}>
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '0 2px 8px' }}>
|
||||||
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6 }}>{title}</div>
|
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6 }}>{title}</div>
|
||||||
<button onClick={() => onJumpTab(tab)} style={{ background: 'none', border: 'none', fontSize: 12, fontWeight: 700, color: '#f59e0b', cursor: 'pointer', textTransform: 'uppercase', letterSpacing: 0.6 }}>Αλλαγή</button>
|
<button onClick={() => onJumpTab(tab)} style={{ background: 'none', border: 'none', fontSize: 12, fontWeight: 700, color: '#f59e0b', cursor: 'pointer', textTransform: 'uppercase', letterSpacing: 0.6 }}>{t('common.change')}</button>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
|
||||||
{lines.map((l, i) => (
|
{lines.map((l, i) => (
|
||||||
@@ -945,7 +960,7 @@ function Section({ title, tab, lines, onJumpTab }) {
|
|||||||
</>
|
</>
|
||||||
) : l.group === 'removed' ? (
|
) : l.group === 'removed' ? (
|
||||||
<div style={{ fontSize: 14, fontWeight: 500, color: 'var(--text)' }}>
|
<div style={{ fontSize: 14, fontWeight: 500, color: 'var(--text)' }}>
|
||||||
Χωρίς {l.label}
|
{t('drawer.without', { name: l.label })}
|
||||||
</div>
|
</div>
|
||||||
) : l.group === 'extras' ? (
|
) : l.group === 'extras' ? (
|
||||||
<div style={{ fontSize: 14, fontWeight: 500, color: 'var(--text)' }}>
|
<div style={{ fontSize: 14, fontWeight: 500, color: 'var(--text)' }}>
|
||||||
@@ -960,7 +975,7 @@ function Section({ title, tab, lines, onJumpTab }) {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{l.price !== 0 && <div style={{ fontSize: 13, fontWeight: 600, color: l.price < 0 ? 'var(--danger)' : 'var(--text)', fontVariantNumeric: 'tabular-nums' }}>{l.price > 0 ? '+' : ''}{l.price.toFixed(2)} €</div>}
|
{l.price !== 0 && <div style={{ fontSize: 13, fontWeight: 600, color: l.price < 0 ? 'var(--danger)' : 'var(--text)', fontVariantNumeric: 'tabular-nums' }}>{l.price > 0 ? '+' : ''}{money(l.price)}</div>}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -969,6 +984,7 @@ function Section({ title, tab, lines, onJumpTab }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function SummaryTab({ _product, summaryLines, note, onJumpTab }) {
|
function SummaryTab({ _product, summaryLines, note, onJumpTab }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const isEmpty = summaryLines.length === 0 && !note
|
const isEmpty = summaryLines.length === 0 && !note
|
||||||
const byGroup = { quick: [], extras: [], removed: [], prefs: [] }
|
const byGroup = { quick: [], extras: [], removed: [], prefs: [] }
|
||||||
summaryLines.forEach(l => byGroup[l.group]?.push(l))
|
summaryLines.forEach(l => byGroup[l.group]?.push(l))
|
||||||
@@ -978,19 +994,19 @@ function SummaryTab({ _product, summaryLines, note, onJumpTab }) {
|
|||||||
<div>
|
<div>
|
||||||
{isEmpty ? (
|
{isEmpty ? (
|
||||||
<div style={{ padding: '40px 16px', textAlign: 'center', color: 'var(--muted)', fontSize: 14 }}>
|
<div style={{ padding: '40px 16px', textAlign: 'center', color: 'var(--muted)', fontSize: 14 }}>
|
||||||
Δεν έχει γίνει καμία προσαρμογή. Χρησιμοποιήστε τις καρτέλες για να διαμορφώσετε το προϊόν.
|
{t('drawer.summary.empty')}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Section title="Προτιμήσεις" tab="prefs" lines={byGroup.prefs} onJumpTab={onJumpTab} />
|
<Section title={t('drawer.tabs.prefs')} tab="prefs" lines={byGroup.prefs} onJumpTab={onJumpTab} />
|
||||||
<Section title="Γρήγορες Επιλογές" tab="quick" lines={byGroup.quick} onJumpTab={onJumpTab} />
|
<Section title={t('drawer.tabs.quick')} tab="quick" lines={byGroup.quick} onJumpTab={onJumpTab} />
|
||||||
<Section title="Extras" tab="extras" lines={byGroup.extras} onJumpTab={onJumpTab} />
|
<Section title={t('drawer.tabs.extrasTitle')} tab="extras" lines={byGroup.extras} onJumpTab={onJumpTab} />
|
||||||
<Section title="Αφαιρέθηκαν" tab="ingredients" lines={byGroup.removed} onJumpTab={onJumpTab} />
|
<Section title={t('drawer.summary.removed')} tab="ingredients" lines={byGroup.removed} onJumpTab={onJumpTab} />
|
||||||
{note && (
|
{note && (
|
||||||
<div style={{ marginBottom: 20 }}>
|
<div style={{ marginBottom: 20 }}>
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '0 2px 8px' }}>
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '0 2px 8px' }}>
|
||||||
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6 }}>Σημείωση</div>
|
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6 }}>{t('drawer.tabs.note')}</div>
|
||||||
<button onClick={() => onJumpTab('notes')} style={{ background: 'none', border: 'none', fontSize: 12, fontWeight: 700, color: '#f59e0b', cursor: 'pointer', textTransform: 'uppercase', letterSpacing: 0.6 }}>Αλλαγή</button>
|
<button onClick={() => onJumpTab('notes')} style={{ background: 'none', border: 'none', fontSize: 12, fontWeight: 700, color: '#f59e0b', cursor: 'pointer', textTransform: 'uppercase', letterSpacing: 0.6 }}>{t('common.change')}</button>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ padding: '12px 14px', background: 'rgba(245,158,11,0.08)', border: '1px solid rgba(245,158,11,0.2)', borderRadius: 10, fontSize: 14, color: 'var(--text)', lineHeight: 1.4, whiteSpace: 'pre-wrap' }}>{note}</div>
|
<div style={{ padding: '12px 14px', background: 'rgba(245,158,11,0.08)', border: '1px solid rgba(245,158,11,0.2)', borderRadius: 10, fontSize: 14, color: 'var(--text)', lineHeight: 1.4, whiteSpace: 'pre-wrap' }}>{note}</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1043,9 +1059,11 @@ function CoursesTab({ courses, courseId, setCourseId }) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const FALLBACK_QUICK_NOTES = ['Χωρίς αλάτι', 'Βγάλτε γρήγορα', 'Αλλεργία!', 'Κόψτε σε μικρά κομμάτια', 'Έξτρα χαρτοπετσέτες']
|
// the venue's own quick notes (Settings) win; these are the defaults, in the waiter's language
|
||||||
|
const FALLBACK_QUICK_NOTES = ['drawer.notes.noSalt', 'drawer.notes.quick', 'drawer.notes.allergy', 'drawer.notes.smallPieces', 'drawer.notes.napkins']
|
||||||
|
|
||||||
export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialState, courses, quickNotes }) {
|
export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialState, courses, quickNotes }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const itemFavorites = useWaiterFavoritesStore(s => s.itemFavorites)
|
const itemFavorites = useWaiterFavoritesStore(s => s.itemFavorites)
|
||||||
// A price set before sending needs the key itself (plan 4.3); the manager-approval path for
|
// A price set before sending needs the key itself (plan 4.3); the manager-approval path for
|
||||||
// it comes with server-priced orders (4.4). After sending, the item's actions offer it.
|
// it comes with server-priced orders (4.4). After sending, the item's actions offer it.
|
||||||
@@ -1341,16 +1359,16 @@ export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialSt
|
|||||||
summary: <svg width="14" height="14" viewBox="0 0 24 24" fill="none"><path d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2M9 12h6M9 16h4" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/></svg>,
|
summary: <svg width="14" height="14" viewBox="0 0 24 24" fill="none"><path d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2M9 12h6M9 16h4" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/></svg>,
|
||||||
}
|
}
|
||||||
const tabs = [
|
const tabs = [
|
||||||
hasTabs.favorites && { id: 'favorites', label: 'Αγαπημένα' },
|
hasTabs.favorites && { id: 'favorites', label: t('settings.tabs.favorites') },
|
||||||
hasTabs.quick && { id: 'quick', label: 'Γρήγορες' },
|
hasTabs.quick && { id: 'quick', label: t('drawer.tabs.quickShort') },
|
||||||
hasTabs.extras && { id: 'extras', label: 'Έξτρα' },
|
hasTabs.extras && { id: 'extras', label: t('drawer.tabs.extras') },
|
||||||
hasTabs.ingredients && { id: 'ingredients', label: 'Υλικά' },
|
hasTabs.ingredients && { id: 'ingredients', label: t('drawer.tabs.ingredients') },
|
||||||
hasTabs.prefs && { id: 'prefs', label: 'Επιλογές' },
|
hasTabs.prefs && { id: 'prefs', label: t('drawer.tabs.options') },
|
||||||
hasTabs.quantity && { id: 'quantity', label: `Ποσότητα (${unitCfg?.label})` },
|
hasTabs.quantity && { id: 'quantity', label: t('drawer.tabs.quantity', { unit: unitCfg?.label }) },
|
||||||
(courses?.length > 0) && { id: 'courses', label: 'Courses' },
|
(courses?.length > 0) && { id: 'courses', label: 'Courses' },
|
||||||
{ id: 'notes', label: 'Σημείωση' },
|
{ id: 'notes', label: t('drawer.tabs.note') },
|
||||||
priceAdjAllowed && { id: 'price_adjust', label: 'Τιμή' },
|
priceAdjAllowed && { id: 'price_adjust', label: t('drawer.tabs.price') },
|
||||||
{ id: 'summary', label: 'Σύνοψη' },
|
{ id: 'summary', label: t('drawer.tabs.summary') },
|
||||||
].filter(Boolean)
|
].filter(Boolean)
|
||||||
|
|
||||||
const badgeFor = id => {
|
const badgeFor = id => {
|
||||||
@@ -1415,8 +1433,8 @@ export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialSt
|
|||||||
<div style={{ fontSize: 18, fontWeight: 700, color: 'var(--text)', lineHeight: 1.2 }}>{product.name}</div>
|
<div style={{ fontSize: 18, fontWeight: 700, color: 'var(--text)', lineHeight: 1.2 }}>{product.name}</div>
|
||||||
<div style={{ fontSize: 13, color: priceAdj !== 0 ? '#f59e0b' : 'var(--muted)', marginTop: 2 }}>
|
<div style={{ fontSize: 13, color: priceAdj !== 0 ? '#f59e0b' : 'var(--muted)', marginTop: 2 }}>
|
||||||
{priceAdj !== 0
|
{priceAdj !== 0
|
||||||
? <><span style={{ textDecoration: 'line-through', opacity: 0.5 }}>{product.base_price.toFixed(2)}</span> → {(product.base_price + priceAdj).toFixed(2)} €</>
|
? <><span style={{ textDecoration: 'line-through', opacity: 0.5 }}>{money(product.base_price)}</span> → {money(product.base_price + priceAdj)}</>
|
||||||
: <>{product.base_price.toFixed(2)} €</>
|
: <>{money(product.base_price)}</>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1428,13 +1446,13 @@ export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialSt
|
|||||||
{/* Tabs bar */}
|
{/* Tabs bar */}
|
||||||
<div ref={tabsScrollRef} style={{ marginTop: 12, borderBottom: '1px solid var(--border)', overflowX: 'auto', scrollbarWidth: 'none', flexShrink: 0 }}>
|
<div ref={tabsScrollRef} style={{ marginTop: 12, borderBottom: '1px solid var(--border)', overflowX: 'auto', scrollbarWidth: 'none', flexShrink: 0 }}>
|
||||||
<div style={{ display: 'flex', padding: '0 12px', gap: 2, minWidth: 'max-content' }}>
|
<div style={{ display: 'flex', padding: '0 12px', gap: 2, minWidth: 'max-content' }}>
|
||||||
{tabs.map(t => {
|
{tabs.map(tb => {
|
||||||
const active = activeTab === t.id
|
const active = activeTab === tb.id
|
||||||
const badge = badgeFor(t.id)
|
const badge = badgeFor(tb.id)
|
||||||
const isAlert = (t.id === 'prefs' && prefsTabAlert) || (t.id === 'favorites' && favTabAlert)
|
const isAlert = (tb.id === 'prefs' && prefsTabAlert) || (tb.id === 'favorites' && favTabAlert)
|
||||||
const tabColor = isAlert ? '#f87171' : active ? '#f59e0b' : 'var(--muted)'
|
const tabColor = isAlert ? '#f87171' : active ? '#f59e0b' : 'var(--muted)'
|
||||||
return (
|
return (
|
||||||
<button key={t.id} ref={el => { tabButtonRefs.current[t.id] = el }} onClick={() => setActiveTab(t.id)} style={{
|
<button key={tb.id} ref={el => { tabButtonRefs.current[tb.id] = el }} onClick={() => setActiveTab(tb.id)} style={{
|
||||||
padding: '12px 6px',
|
padding: '12px 6px',
|
||||||
background: 'none', border: 'none',
|
background: 'none', border: 'none',
|
||||||
borderBottom: `2px solid ${active ? '#f59e0b' : isAlert ? '#f87171' : 'transparent'}`,
|
borderBottom: `2px solid ${active ? '#f59e0b' : isAlert ? '#f87171' : 'transparent'}`,
|
||||||
@@ -1446,8 +1464,8 @@ export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialSt
|
|||||||
transition: isAlert ? 'none' : 'color 120ms ease, border-color 120ms ease',
|
transition: isAlert ? 'none' : 'color 120ms ease, border-color 120ms ease',
|
||||||
animation: isAlert ? 'tab-alert 1.2s ease-in-out infinite' : 'none',
|
animation: isAlert ? 'tab-alert 1.2s ease-in-out infinite' : 'none',
|
||||||
}}>
|
}}>
|
||||||
{TAB_ICON[t.id] && <span style={{ display: 'inline-flex', alignItems: 'center', opacity: active || isAlert ? 1 : 0.7 }}>{TAB_ICON[t.id]}</span>}
|
{TAB_ICON[tb.id] && <span style={{ display: 'inline-flex', alignItems: 'center', opacity: active || isAlert ? 1 : 0.7 }}>{TAB_ICON[tb.id]}</span>}
|
||||||
{t.label}
|
{tb.label}
|
||||||
{badge > 0 && !isAlert && (
|
{badge > 0 && !isAlert && (
|
||||||
<span style={{
|
<span style={{
|
||||||
minWidth: 18, height: 18, padding: '0 5px',
|
minWidth: 18, height: 18, padding: '0 5px',
|
||||||
@@ -1486,12 +1504,12 @@ export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialSt
|
|||||||
{activeTab === 'prefs' && <PrefsTab product={product} prefs={prefs} setPrefs={setPrefs} subChoices={subChoices} setSubChoices={setSubChoices} sharedSubs={sharedSubs} setSharedSubs={setSharedSubs} />}
|
{activeTab === 'prefs' && <PrefsTab product={product} prefs={prefs} setPrefs={setPrefs} subChoices={subChoices} setSubChoices={setSubChoices} sharedSubs={sharedSubs} setSharedSubs={setSharedSubs} />}
|
||||||
{activeTab === 'quantity' && isDecimal && <QuantityTab unitCfg={unitCfg} qty={qty} setQty={setQty} />}
|
{activeTab === 'quantity' && isDecimal && <QuantityTab unitCfg={unitCfg} qty={qty} setQty={setQty} />}
|
||||||
{activeTab === 'courses' && courses?.length > 0 && <CoursesTab courses={courses} courseId={courseId} setCourseId={setCourseId} />}
|
{activeTab === 'courses' && courses?.length > 0 && <CoursesTab courses={courses} courseId={courseId} setCourseId={setCourseId} />}
|
||||||
{activeTab === 'notes' && <NotesTab note={note} setNote={setNote} quickNotes={quickNotes ?? FALLBACK_QUICK_NOTES} />}
|
{activeTab === 'notes' && <NotesTab note={note} setNote={setNote} quickNotes={quickNotes ?? undefined} />}
|
||||||
{activeTab === 'price_adjust' && <PriceAdjustTab basePrice={product.base_price} priceAdj={priceAdj} setPriceAdj={setPriceAdj} />}
|
{activeTab === 'price_adjust' && <PriceAdjustTab basePrice={product.base_price} priceAdj={priceAdj} setPriceAdj={setPriceAdj} />}
|
||||||
{activeTab === 'summary' && <SummaryTab product={product} summaryLines={summaryLines} note={note} onJumpTab={setActiveTab} />}
|
{activeTab === 'summary' && <SummaryTab product={product} summaryLines={summaryLines} note={note} onJumpTab={setActiveTab} />}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Footer: qty stepper + ΠΡΟΣΘΗΚΗ */}
|
{/* Footer: qty stepper + ADD */}
|
||||||
<div style={{ padding: '12px 16px 20px', background: 'var(--bg2)', borderTop: '1px solid var(--border)', display: 'flex', alignItems: 'center', gap: 12, flexShrink: 0, boxShadow: '0 -4px 16px rgba(0,0,0,0.3)' }}>
|
<div style={{ padding: '12px 16px 20px', background: 'var(--bg2)', borderTop: '1px solid var(--border)', display: 'flex', alignItems: 'center', gap: 12, flexShrink: 0, boxShadow: '0 -4px 16px rgba(0,0,0,0.3)' }}>
|
||||||
{isDecimal ? (
|
{isDecimal ? (
|
||||||
<div
|
<div
|
||||||
@@ -1519,7 +1537,7 @@ export default function OrderDrawer({ product, isOpen, onClose, onAdd, initialSt
|
|||||||
transition: 'background 150ms ease',
|
transition: 'background 150ms ease',
|
||||||
}}>
|
}}>
|
||||||
<span>ADD</span>
|
<span>ADD</span>
|
||||||
<span style={{ fontVariantNumeric: 'tabular-nums' }}>{totalPrice.toFixed(2)} €</span>
|
<span style={{ fontVariantNumeric: 'tabular-nums' }}>{money(totalPrice)}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { useRef, useState } from 'react'
|
import { useRef, useState } from 'react'
|
||||||
import useTableViewStore from '../store/tableViewStore'
|
import useTableViewStore from '../store/tableViewStore'
|
||||||
|
import { money } from '../i18n'
|
||||||
|
import { useTranslation } from '@xenia/i18n'
|
||||||
|
|
||||||
function fmtPrice(v) {
|
const fmtPrice = money
|
||||||
return Number(v).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 fmtQty(qty, unitType) {
|
function fmtQty(qty, unitType) {
|
||||||
@@ -112,15 +112,16 @@ function buildSections(item) {
|
|||||||
// ── KDS colour strip ──────────────────────────────────────────────────────────
|
// ── KDS colour strip ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
const KDS_COLORS = {
|
const KDS_COLORS = {
|
||||||
pending: { textColor: '#f59e0b', label: 'ΕΚΚΡΕΜΕΙ', icon: '⏳', dot: '#f59e0b' },
|
pending: { textColor: '#f59e0b', label: 'kds.pending', icon: '⏳', dot: '#f59e0b' },
|
||||||
preparing: { textColor: '#60a5fa', label: 'ΕΤΟΙΜΑΖΕΤΑΙ', icon: '🔥', dot: '#60a5fa' },
|
preparing: { textColor: '#60a5fa', label: 'kds.preparing', icon: '🔥', dot: '#60a5fa' },
|
||||||
done: { textColor: '#4ade80', label: 'READY', icon: '✓', dot: '#4ade80' },
|
done: { textColor: '#4ade80', label: 'kds.ready', icon: '✓', dot: '#4ade80' },
|
||||||
served: { textColor: null, label: null, icon: null, dot: null },
|
served: { textColor: null, label: null, icon: null, dot: null },
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Shared expanded details panel ─────────────────────────────────────────────
|
// ── Shared expanded details panel ─────────────────────────────────────────────
|
||||||
|
|
||||||
function OptionsPanel({ sections }) {
|
function OptionsPanel({ sections }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
return (
|
return (
|
||||||
<div style={{ paddingBottom: 8 }}>
|
<div style={{ paddingBottom: 8 }}>
|
||||||
{sections.map((sec, si) => (
|
{sections.map((sec, si) => (
|
||||||
@@ -160,7 +161,7 @@ function OptionsPanel({ sections }) {
|
|||||||
{sec.type === 'removed' && sec.lines.map((line, li) => (
|
{sec.type === 'removed' && sec.lines.map((line, li) => (
|
||||||
<div key={li} style={{ display: 'flex', alignItems: 'center', gap: 7 }}>
|
<div key={li} style={{ display: 'flex', alignItems: 'center', gap: 7 }}>
|
||||||
<SectionIcon type="removed" />
|
<SectionIcon type="removed" />
|
||||||
<span style={{ fontSize: 12, color: 'var(--text)', flex: 1 }}>Χωρίς {line.name}</span>
|
<span style={{ fontSize: 12, color: 'var(--text)', flex: 1 }}>{t('drawer.without', { name: line.name })}</span>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
{sec.type === 'note' && sec.lines.map((line, li) => (
|
{sec.type === 'note' && sec.lines.map((line, li) => (
|
||||||
@@ -179,13 +180,14 @@ function OptionsPanel({ sections }) {
|
|||||||
// ── KDS badge/icon renderer ───────────────────────────────────────────────────
|
// ── KDS badge/icon renderer ───────────────────────────────────────────────────
|
||||||
|
|
||||||
function KdsBadge({ kdsColor, kdsDisplayStyle }) {
|
function KdsBadge({ kdsColor, kdsDisplayStyle }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
if (!kdsColor?.label) return null
|
if (!kdsColor?.label) return null
|
||||||
if (kdsDisplayStyle === 'icon' && kdsColor.dot) {
|
if (kdsDisplayStyle === 'icon' && kdsColor.dot) {
|
||||||
return (
|
return (
|
||||||
<span style={{
|
<span style={{
|
||||||
width: 8, height: 8, borderRadius: '50%',
|
width: 8, height: 8, borderRadius: '50%',
|
||||||
background: kdsColor.dot, flexShrink: 0, display: 'inline-block',
|
background: kdsColor.dot, flexShrink: 0, display: 'inline-block',
|
||||||
}} title={kdsColor.label} />
|
}} title={t(kdsColor.label)} />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
@@ -195,7 +197,7 @@ function KdsBadge({ kdsColor, kdsDisplayStyle }) {
|
|||||||
borderRadius: 3, padding: '1px 5px',
|
borderRadius: 3, padding: '1px 5px',
|
||||||
border: `1px solid ${kdsColor.textColor}60`,
|
border: `1px solid ${kdsColor.textColor}60`,
|
||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
}}>{kdsColor.label}</span>
|
}}>{t(kdsColor.label)}</span>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,12 +205,13 @@ function KdsBadge({ kdsColor, kdsDisplayStyle }) {
|
|||||||
|
|
||||||
const PRICING_EVENT_STYLE = {
|
const PRICING_EVENT_STYLE = {
|
||||||
modifier_applied: { color: '#60a5fa', label: null }, // label comes from modifier_name
|
modifier_applied: { color: '#60a5fa', label: null }, // label comes from modifier_name
|
||||||
waiter_discount: { color: '#c084fc', label: 'Έκπτωση' },
|
waiter_discount: { color: '#c084fc', label: 'summary.discount' },
|
||||||
free_item_added: { color: '#4ade80', label: 'Δωρεάν' },
|
free_item_added: { color: '#4ade80', label: 'summary.free' },
|
||||||
deal_offer_accepted: { color: '#4ade80', label: null }, // label from deal_name
|
deal_offer_accepted: { color: '#4ade80', label: null }, // label from deal_name
|
||||||
}
|
}
|
||||||
|
|
||||||
function PricingRows({ events, _layout, nameIndent = 12 }) {
|
function PricingRows({ events, _layout, nameIndent = 12 }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const rows = events.filter(ev =>
|
const rows = events.filter(ev =>
|
||||||
ev.event_type === 'modifier_applied' ||
|
ev.event_type === 'modifier_applied' ||
|
||||||
ev.event_type === 'waiter_discount' ||
|
ev.event_type === 'waiter_discount' ||
|
||||||
@@ -223,7 +226,7 @@ function PricingRows({ events, _layout, nameIndent = 12 }) {
|
|||||||
<div style={{ padding: `4px 12px 4px ${nameIndent}px`, display: 'flex', flexDirection: 'column', gap: 3 }}>
|
<div style={{ padding: `4px 12px 4px ${nameIndent}px`, display: 'flex', flexDirection: 'column', gap: 3 }}>
|
||||||
{rows.map((ev, i) => {
|
{rows.map((ev, i) => {
|
||||||
const evStyle = PRICING_EVENT_STYLE[ev.event_type] || { color: '#94a3b8', label: ev.event_type }
|
const evStyle = PRICING_EVENT_STYLE[ev.event_type] || { color: '#94a3b8', label: ev.event_type }
|
||||||
const label = ev.modifier_name || ev.deal_name || evStyle.label || ev.event_type
|
const label = ev.modifier_name || ev.deal_name || (evStyle.label && t(evStyle.label)) || ev.event_type
|
||||||
const delta = ev.delta_amount
|
const delta = ev.delta_amount
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -238,7 +241,7 @@ function PricingRows({ events, _layout, nameIndent = 12 }) {
|
|||||||
</span>
|
</span>
|
||||||
{delta != null && (
|
{delta != null && (
|
||||||
<span style={{ fontSize: 12, color: evStyle.color, fontWeight: 700, flexShrink: 0, marginLeft: 8 }}>
|
<span style={{ fontSize: 12, color: evStyle.color, fontWeight: 700, flexShrink: 0, marginLeft: 8 }}>
|
||||||
{delta > 0 ? '+' : ''}{delta.toFixed(2)} €
|
{delta > 0 ? '+' : ''}{money(delta)}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -251,6 +254,7 @@ function PricingRows({ events, _layout, nameIndent = 12 }) {
|
|||||||
|
|
||||||
// Small badge shown on the main item row to hint that pricing changes exist
|
// Small badge shown on the main item row to hint that pricing changes exist
|
||||||
function PricingBadge({ events }) {
|
function PricingBadge({ events }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
if (!events || events.length === 0) return null
|
if (!events || events.length === 0) return null
|
||||||
const hasDiscount = events.some(ev => ev.event_type === 'waiter_discount')
|
const hasDiscount = events.some(ev => ev.event_type === 'waiter_discount')
|
||||||
const hasModifier = events.some(ev => ev.event_type === 'modifier_applied')
|
const hasModifier = events.some(ev => ev.event_type === 'modifier_applied')
|
||||||
@@ -258,19 +262,19 @@ function PricingBadge({ events }) {
|
|||||||
|
|
||||||
const icons = []
|
const icons = []
|
||||||
if (hasModifier) icons.push(
|
if (hasModifier) icons.push(
|
||||||
<svg key="mod" width="10" height="10" viewBox="0 0 24 24" fill="none" title="Τροποποιητής">
|
<svg key="mod" width="10" height="10" viewBox="0 0 24 24" fill="none" title={t('summary.modifier')}>
|
||||||
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" stroke="#60a5fa" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" stroke="#60a5fa" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||||
</svg>
|
</svg>
|
||||||
)
|
)
|
||||||
if (hasDiscount) icons.push(
|
if (hasDiscount) icons.push(
|
||||||
<svg key="disc" width="10" height="10" viewBox="0 0 24 24" fill="none" title="Έκπτωση">
|
<svg key="disc" width="10" height="10" viewBox="0 0 24 24" fill="none" title={t('summary.discount')}>
|
||||||
<circle cx="9" cy="9" r="2" stroke="#c084fc" strokeWidth="2"/>
|
<circle cx="9" cy="9" r="2" stroke="#c084fc" strokeWidth="2"/>
|
||||||
<circle cx="15" cy="15" r="2" stroke="#c084fc" strokeWidth="2"/>
|
<circle cx="15" cy="15" r="2" stroke="#c084fc" strokeWidth="2"/>
|
||||||
<path d="M5 19L19 5" stroke="#c084fc" strokeWidth="2" strokeLinecap="round"/>
|
<path d="M5 19L19 5" stroke="#c084fc" strokeWidth="2" strokeLinecap="round"/>
|
||||||
</svg>
|
</svg>
|
||||||
)
|
)
|
||||||
if (hasFree) icons.push(
|
if (hasFree) icons.push(
|
||||||
<svg key="free" width="10" height="10" viewBox="0 0 24 24" fill="none" title="Δωρεάν">
|
<svg key="free" width="10" height="10" viewBox="0 0 24 24" fill="none" title={t('summary.free')}>
|
||||||
<path d="M20 12v10H4V12M22 7H2v5h20V7z" stroke="#4ade80" strokeWidth="2" strokeLinecap="round"/>
|
<path d="M20 12v10H4V12M22 7H2v5h20V7z" stroke="#4ade80" strokeWidth="2" strokeLinecap="round"/>
|
||||||
</svg>
|
</svg>
|
||||||
)
|
)
|
||||||
@@ -285,6 +289,7 @@ function PricingBadge({ events }) {
|
|||||||
|
|
||||||
// Deal badge on items that triggered or were added by a deal
|
// Deal badge on items that triggered or were added by a deal
|
||||||
function DealBadge({ item }) {
|
function DealBadge({ item }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
if (item.deal_id) {
|
if (item.deal_id) {
|
||||||
return (
|
return (
|
||||||
<span style={{
|
<span style={{
|
||||||
@@ -292,7 +297,7 @@ function DealBadge({ item }) {
|
|||||||
background: 'rgba(167,139,250,0.15)', color: '#a78bfa',
|
background: 'rgba(167,139,250,0.15)', color: '#a78bfa',
|
||||||
border: '1px solid rgba(167,139,250,0.4)', flexShrink: 0, letterSpacing: 0.3,
|
border: '1px solid rgba(167,139,250,0.4)', flexShrink: 0, letterSpacing: 0.3,
|
||||||
}}>
|
}}>
|
||||||
ΔΩΡΕΑΝ
|
{t('summary.freeCaps')}
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -315,6 +320,7 @@ function MergedBadge({ item }) {
|
|||||||
// ── ItemRow ───────────────────────────────────────────────────────────────────
|
// ── ItemRow ───────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
function ItemRow({ item, selectable, selected, onToggle, onLongPress, isLast, kdsDisplayStyle, orderItemLayout, waiterMap, courses, priceEvents }) {
|
function ItemRow({ item, selectable, selected, onToggle, onLongPress, isLast, kdsDisplayStyle, orderItemLayout, waiterMap, courses, priceEvents }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const isPaid = item.status === 'paid'
|
const isPaid = item.status === 'paid'
|
||||||
const isCancelled = item.status === 'cancelled'
|
const isCancelled = item.status === 'cancelled'
|
||||||
const effectiveKds = item.kds_status || 'pending'
|
const effectiveKds = item.kds_status || 'pending'
|
||||||
@@ -390,10 +396,10 @@ function ItemRow({ item, selectable, selected, onToggle, onLongPress, isLast, kd
|
|||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
|
|
||||||
const paidBadge = isPaid && !isServed ? <span className="badge badge--paid">Paid</span> : null
|
const paidBadge = isPaid && !isServed ? <span className="badge badge--paid">{t('summary.paidBadge')}</span> : null
|
||||||
const cancelledBadge = isCancelled ? <span className="badge badge--cancelled">Cancelled</span> : null
|
const cancelledBadge = isCancelled ? <span className="badge badge--cancelled">{t('summary.cancelledBadge')}</span> : null
|
||||||
const draftBadge = !isPaid && !isCancelled && !item.printed
|
const draftBadge = !isPaid && !isCancelled && !item.printed
|
||||||
? <span className="badge badge--draft" title="Δεν εκτυπώθηκε ακόμα">⏳</span>
|
? <span className="badge badge--draft" title={t('summary.notPrinted')}>⏳</span>
|
||||||
: null
|
: null
|
||||||
|
|
||||||
// Whole-card click+touch handlers on the outer wrapper
|
// Whole-card click+touch handlers on the outer wrapper
|
||||||
@@ -592,7 +598,7 @@ function ItemRow({ item, selectable, selected, onToggle, onLongPress, isLast, kd
|
|||||||
|
|
||||||
{/* Ordered by */}
|
{/* Ordered by */}
|
||||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||||
<span style={{ fontSize: 11, color: 'var(--muted)', minWidth: 90 }}>Παραγγέλθηκε</span>
|
<span style={{ fontSize: 11, color: 'var(--muted)', minWidth: 90 }}>{t('summary.ordered')}</span>
|
||||||
<span style={{ flex: 1 }} />
|
<span style={{ flex: 1 }} />
|
||||||
<span style={{ fontSize: 11, color: 'var(--muted)', textAlign: 'right' }}>
|
<span style={{ fontSize: 11, color: 'var(--muted)', textAlign: 'right' }}>
|
||||||
{addedByName && addedAtFmt ? `${addedByName} · ${addedAtFmt}` : addedByName || addedAtFmt || '—'}
|
{addedByName && addedAtFmt ? `${addedByName} · ${addedAtFmt}` : addedByName || addedAtFmt || '—'}
|
||||||
@@ -602,7 +608,7 @@ function ItemRow({ item, selectable, selected, onToggle, onLongPress, isLast, kd
|
|||||||
{/* Paid by — only if paid */}
|
{/* Paid by — only if paid */}
|
||||||
{isPaid && (
|
{isPaid && (
|
||||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||||
<span style={{ fontSize: 11, color: 'var(--muted)', minWidth: 90 }}>Πληρώθηκε</span>
|
<span style={{ fontSize: 11, color: 'var(--muted)', minWidth: 90 }}>{t('summary.paidAt')}</span>
|
||||||
<span style={{ flex: 1 }} />
|
<span style={{ flex: 1 }} />
|
||||||
<span style={{ fontSize: 11, color: 'var(--muted)', textAlign: 'right' }}>
|
<span style={{ fontSize: 11, color: 'var(--muted)', textAlign: 'right' }}>
|
||||||
{paidByName && paidAtFmt ? `${paidByName} · ${paidAtFmt}` : paidByName || paidAtFmt || '—'}
|
{paidByName && paidAtFmt ? `${paidByName} · ${paidAtFmt}` : paidByName || paidAtFmt || '—'}
|
||||||
@@ -646,7 +652,7 @@ function ItemRow({ item, selectable, selected, onToggle, onLongPress, isLast, kd
|
|||||||
{sec.type === 'removed' && sec.lines.map((line, li) => (
|
{sec.type === 'removed' && sec.lines.map((line, li) => (
|
||||||
<div key={li} style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
<div key={li} style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||||
<SectionIcon type="removed" />
|
<SectionIcon type="removed" />
|
||||||
<span style={{ fontSize: 11, color: 'var(--text)', flex: 1 }}>Χωρίς {line.name}</span>
|
<span style={{ fontSize: 11, color: 'var(--text)', flex: 1 }}>{t('drawer.without', { name: line.name })}</span>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
{sec.type === 'note' && sec.lines.map((line, li) => (
|
{sec.type === 'note' && sec.lines.map((line, li) => (
|
||||||
@@ -665,6 +671,7 @@ function ItemRow({ item, selectable, selected, onToggle, onLongPress, isLast, kd
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function OrderSummary({ order, selectable = false, selectedIds = [], onToggle, onLongPressItem, waiterMap, courses = [], priceEventsMap = {} }) {
|
export default function OrderSummary({ order, selectable = false, selectedIds = [], onToggle, onLongPressItem, waiterMap, courses = [], priceEventsMap = {} }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const kdsDisplayStyle = useTableViewStore(s => s.kdsDisplayStyle || 'badge')
|
const kdsDisplayStyle = useTableViewStore(s => s.kdsDisplayStyle || 'badge')
|
||||||
const orderItemLayout = useTableViewStore(s => s.orderItemLayout || 'compact')
|
const orderItemLayout = useTableViewStore(s => s.orderItemLayout || 'compact')
|
||||||
const activeItems = order.items?.filter(i => i.status !== 'cancelled') || []
|
const activeItems = order.items?.filter(i => i.status !== 'cancelled') || []
|
||||||
@@ -677,7 +684,7 @@ export default function OrderSummary({ order, selectable = false, selectedIds =
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="order-summary">
|
<div className="order-summary">
|
||||||
{activeItems.length === 0 && <p style={{ color: '#64748b', textAlign: 'center' }}>Δεν υπάρχουν αντικείμενα</p>}
|
{activeItems.length === 0 && <p style={{ color: '#64748b', textAlign: 'center' }}>{t('summary.noItems')}</p>}
|
||||||
{activeItems.map((item, idx) => (
|
{activeItems.map((item, idx) => (
|
||||||
<ItemRow
|
<ItemRow
|
||||||
key={item.id}
|
key={item.id}
|
||||||
@@ -695,18 +702,18 @@ export default function OrderSummary({ order, selectable = false, selectedIds =
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<div className="order-summary__total">
|
<div className="order-summary__total">
|
||||||
<span>Σύνολο</span>
|
<span>{t('common.total')}</span>
|
||||||
<span>{fmtPrice(total)}</span>
|
<span>{fmtPrice(total)}</span>
|
||||||
</div>
|
</div>
|
||||||
{paidTotal > 0 && paidTotal < total && (
|
{paidTotal > 0 && paidTotal < total && (
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0 12px 8px', fontSize: 13, color: '#64748b' }}>
|
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0 12px 8px', fontSize: 13, color: '#64748b' }}>
|
||||||
<span>Πληρωμένο</span>
|
<span>{t('tables.quick.paid')}</span>
|
||||||
<span style={{ color: '#22c55e' }}>{fmtPrice(paidTotal)}</span>
|
<span style={{ color: '#22c55e' }}>{fmtPrice(paidTotal)}</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{paidTotal > 0 && paidTotal < total && (
|
{paidTotal > 0 && paidTotal < total && (
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0 12px 8px', fontSize: 13, color: '#94a3b8' }}>
|
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0 12px 8px', fontSize: 13, color: '#94a3b8' }}>
|
||||||
<span>Εκκρεμεί</span>
|
<span>{t('summary.due')}</span>
|
||||||
<span style={{ color: '#f59e0b', fontWeight: 700 }}>{fmtPrice(total - paidTotal)}</span>
|
<span style={{ color: '#f59e0b', fontWeight: 700 }}>{fmtPrice(total - paidTotal)}</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
|
import { money } from '../i18n'
|
||||||
|
import { useTranslation } from '@xenia/i18n'
|
||||||
|
|
||||||
const _UNIT_LABELS = { kg: 'kg', liter: 'L', gram: 'g', ml: 'mL' }
|
const _UNIT_LABELS = { kg: 'kg', liter: 'L', gram: 'g', ml: 'mL' }
|
||||||
function fmtQty(qty, unitType) {
|
function fmtQty(qty, unitType) {
|
||||||
@@ -7,7 +9,7 @@ function fmtQty(qty, unitType) {
|
|||||||
if (unitType === 'kg' || unitType === 'liter') return `${Number(qty).toFixed(1)}${label}`
|
if (unitType === 'kg' || unitType === 'liter') return `${Number(qty).toFixed(1)}${label}`
|
||||||
return `${qty}${label}`
|
return `${qty}${label}`
|
||||||
}
|
}
|
||||||
function fmtEUR(v) { return Number(v || 0).toFixed(2) + ' €' }
|
const fmtEUR = money
|
||||||
|
|
||||||
// Flatten selected_options into readable lines
|
// Flatten selected_options into readable lines
|
||||||
function describeOptions(selected_options) {
|
function describeOptions(selected_options) {
|
||||||
@@ -15,13 +17,14 @@ function describeOptions(selected_options) {
|
|||||||
return selected_options.map(o => {
|
return selected_options.map(o => {
|
||||||
let s = o.name || ''
|
let s = o.name || ''
|
||||||
if (o.price_delta && Math.abs(o.price_delta) > 0.001) {
|
if (o.price_delta && Math.abs(o.price_delta) > 0.001) {
|
||||||
s += ` (${o.price_delta > 0 ? '+' : ''}${o.price_delta.toFixed(2)} €)`
|
s += ` (${o.price_delta > 0 ? '+' : ''}${money(o.price_delta)})`
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}).filter(Boolean)
|
}).filter(Boolean)
|
||||||
}
|
}
|
||||||
|
|
||||||
function CartItemSummaryRow({ item, product, price, estimated, onEdit }) {
|
function CartItemSummaryRow({ item, product, price, estimated, onEdit }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const opts = describeOptions(item.selected_options)
|
const opts = describeOptions(item.selected_options)
|
||||||
const removed = item.removed_ingredients || []
|
const removed = item.removed_ingredients || []
|
||||||
|
|
||||||
@@ -63,7 +66,7 @@ function CartItemSummaryRow({ item, product, price, estimated, onEdit }) {
|
|||||||
onClick={onEdit}
|
onClick={onEdit}
|
||||||
style={{ background: 'var(--bg3)', border: '1px solid var(--border)', borderRadius: 7, padding: '3px 10px', fontSize: 12, color: 'var(--muted)', cursor: 'pointer', fontWeight: 600 }}
|
style={{ background: 'var(--bg3)', border: '1px solid var(--border)', borderRadius: 7, padding: '3px 10px', fontSize: 12, color: 'var(--muted)', cursor: 'pointer', fontWeight: 600 }}
|
||||||
>
|
>
|
||||||
Επεξεργασία
|
{t('summaryModal.edit')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -75,6 +78,7 @@ function CartItemSummaryRow({ item, product, price, estimated, onEdit }) {
|
|||||||
// prices / total: the server's (POST /api/orders/quote, plan step 4.4) or, offline, the menu's
|
// prices / total: the server's (POST /api/orders/quote, plan step 4.4) or, offline, the menu's
|
||||||
// estimate (`estimated`); priceError: a line the server would refuse.
|
// estimate (`estimated`); priceError: a line the server would refuse.
|
||||||
export default function OrderSummaryModal({ cart, products, prices, total, estimated, priceError, orderNote, setOrderNote, onSend, onClose, sending }) {
|
export default function OrderSummaryModal({ cart, products, prices, total, estimated, priceError, orderNote, setOrderNote, onSend, onClose, sending }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const [noteEditing, setNoteEditing] = useState(false)
|
const [noteEditing, setNoteEditing] = useState(false)
|
||||||
|
|
||||||
function getProduct(id) { return products.find(p => p.id === id) }
|
function getProduct(id) { return products.find(p => p.id === id) }
|
||||||
@@ -101,8 +105,8 @@ export default function OrderSummaryModal({ cart, products, prices, total, estim
|
|||||||
padding: '14px 16px', borderBottom: '1px solid var(--border)', flexShrink: 0,
|
padding: '14px 16px', borderBottom: '1px solid var(--border)', flexShrink: 0,
|
||||||
}}>
|
}}>
|
||||||
<div>
|
<div>
|
||||||
<div style={{ fontSize: 17, fontWeight: 800, color: 'var(--text)' }}>Επισκόπηση Παραγγελίας</div>
|
<div style={{ fontSize: 17, fontWeight: 800, color: 'var(--text)' }}>{t('summaryModal.title')}</div>
|
||||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 1 }}>{cart.length} {cart.length === 1 ? 'προϊόν' : 'προϊόντα'} · {estimated ? '≈ ' : ''}{fmtEUR(total)}</div>
|
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 1 }}>{t('add.products', { count: cart.length })} · {estimated ? '≈ ' : ''}{fmtEUR(total)}</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
@@ -129,7 +133,7 @@ export default function OrderSummaryModal({ cart, products, prices, total, estim
|
|||||||
{/* Order note section */}
|
{/* Order note section */}
|
||||||
<div style={{ marginTop: 16, marginBottom: 8 }}>
|
<div style={{ marginTop: 16, marginBottom: 8 }}>
|
||||||
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.7, marginBottom: 8 }}>
|
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.7, marginBottom: 8 }}>
|
||||||
Σημείωση Παραγγελίας
|
{t('add.note.title')}
|
||||||
</div>
|
</div>
|
||||||
{noteEditing ? (
|
{noteEditing ? (
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
|
||||||
@@ -137,7 +141,7 @@ export default function OrderSummaryModal({ cart, products, prices, total, estim
|
|||||||
autoFocus
|
autoFocus
|
||||||
value={orderNote}
|
value={orderNote}
|
||||||
onChange={e => setOrderNote(e.target.value)}
|
onChange={e => setOrderNote(e.target.value)}
|
||||||
placeholder="Σημείωση για ολόκληρη την παραγγελία…"
|
placeholder={t('add.note.placeholder')}
|
||||||
rows={3}
|
rows={3}
|
||||||
style={{
|
style={{
|
||||||
width: '100%', resize: 'none', padding: '10px 12px',
|
width: '100%', resize: 'none', padding: '10px 12px',
|
||||||
@@ -150,7 +154,7 @@ export default function OrderSummaryModal({ cart, products, prices, total, estim
|
|||||||
onClick={() => setNoteEditing(false)}
|
onClick={() => setNoteEditing(false)}
|
||||||
style={{ alignSelf: 'flex-end', background: 'none', border: 'none', fontSize: 12, fontWeight: 700, color: 'var(--accent)', cursor: 'pointer' }}
|
style={{ alignSelf: 'flex-end', background: 'none', border: 'none', fontSize: 12, fontWeight: 700, color: 'var(--accent)', cursor: 'pointer' }}
|
||||||
>
|
>
|
||||||
Αποθήκευση
|
{t('common.save')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
) : orderNote ? (
|
) : orderNote ? (
|
||||||
@@ -172,14 +176,14 @@ export default function OrderSummaryModal({ cart, products, prices, total, estim
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg width="15" height="15" viewBox="0 0 24 24" fill="none"><path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/></svg>
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none"><path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/></svg>
|
||||||
Προσθήκη σημείωσης παραγγελίας
|
{t('add.note.add')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Total */}
|
{/* Total */}
|
||||||
<div style={{ marginTop: 12, marginBottom: 4, display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 4px', borderTop: '1px solid var(--border)' }}>
|
<div style={{ marginTop: 12, marginBottom: 4, display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 4px', borderTop: '1px solid var(--border)' }}>
|
||||||
<span style={{ fontSize: 14, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6 }}>{estimated ? 'Σύνολο (εκτίμηση)' : 'Σύνολο'}</span>
|
<span style={{ fontSize: 14, fontWeight: 700, color: 'var(--muted)', textTransform: 'uppercase', letterSpacing: 0.6 }}>{estimated ? t('add.totalEstimate') : t('common.total')}</span>
|
||||||
<span data-testid="summary-total" data-estimated={estimated ? 'true' : 'false'} style={{ fontSize: 20, fontWeight: 800, color: 'var(--text)', fontVariantNumeric: 'tabular-nums' }}>{estimated ? '≈ ' : ''}{fmtEUR(total)}</span>
|
<span data-testid="summary-total" data-estimated={estimated ? 'true' : 'false'} style={{ fontSize: 20, fontWeight: 800, color: 'var(--text)', fontVariantNumeric: 'tabular-nums' }}>{estimated ? '≈ ' : ''}{fmtEUR(total)}</span>
|
||||||
</div>
|
</div>
|
||||||
{priceError && <div style={{ fontSize: 12, color: 'var(--danger)', padding: '0 4px 8px' }}>{priceError}</div>}
|
{priceError && <div style={{ fontSize: 12, color: 'var(--danger)', padding: '0 4px 8px' }}>{priceError}</div>}
|
||||||
@@ -193,7 +197,7 @@ export default function OrderSummaryModal({ cart, products, prices, total, estim
|
|||||||
onClick={onSend}
|
onClick={onSend}
|
||||||
disabled={sending}
|
disabled={sending}
|
||||||
>
|
>
|
||||||
{sending ? 'Αποστολή…' : `ΑΠΟΣΤΟΛΗ (${cart.length})`}
|
{sending ? t('add.sending') : t('add.sendCount', { count: cart.length })}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import { useNavigate } from 'react-router-dom'
|
|||||||
import OrderDrawer from './OrderDrawer'
|
import OrderDrawer from './OrderDrawer'
|
||||||
import useWaiterFavoritesStore from '../store/waiterFavoritesStore'
|
import useWaiterFavoritesStore from '../store/waiterFavoritesStore'
|
||||||
import { assetUrl } from '../config/server'
|
import { assetUrl } from '../config/server'
|
||||||
|
import { money } from '../i18n'
|
||||||
|
import { useTranslation } from '@xenia/i18n'
|
||||||
|
|
||||||
const FAV_CAT_ID = '__favorites__'
|
const FAV_CAT_ID = '__favorites__'
|
||||||
const SVC_CAT_ID = '__service__'
|
const SVC_CAT_ID = '__service__'
|
||||||
@@ -132,7 +134,7 @@ function ProductDetailModal({ product, onClose }) {
|
|||||||
{product.name}
|
{product.name}
|
||||||
</div>
|
</div>
|
||||||
<div style={{ fontSize: 18, fontWeight: 700, color: 'var(--accent, #f59e0b)', marginBottom: product.description ? 14 : 0 }}>
|
<div style={{ fontSize: 18, fontWeight: 700, color: 'var(--accent, #f59e0b)', marginBottom: product.description ? 14 : 0 }}>
|
||||||
{Number(product.base_price).toFixed(2)} €
|
{money(product.base_price)}
|
||||||
</div>
|
</div>
|
||||||
{product.description && (
|
{product.description && (
|
||||||
<div style={{
|
<div style={{
|
||||||
@@ -215,7 +217,7 @@ function ProductCard({ product, onOpen, onQuickAdd, onShowDetail }) {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<span className="product-btn__price">{Number(product.base_price).toFixed(2)} €</span>
|
<span className="product-btn__price">{money(product.base_price)}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{canQuickAdd && (
|
{canQuickAdd && (
|
||||||
@@ -249,6 +251,7 @@ function ProductCard({ product, onOpen, onQuickAdd, onShowDetail }) {
|
|||||||
|
|
||||||
// ── Service Item Card ─────────────────────────────────────────────────────────
|
// ── Service Item Card ─────────────────────────────────────────────────────────
|
||||||
function ServiceItemCard({ product, customerCount, onAdd }) {
|
function ServiceItemCard({ product, customerCount, onAdd }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const [qty, setQty] = useState(0)
|
const [qty, setQty] = useState(0)
|
||||||
|
|
||||||
function dec() { setQty(q => Math.max(0, q - 1)) }
|
function dec() { setQty(q => Math.max(0, q - 1)) }
|
||||||
@@ -279,7 +282,7 @@ function ServiceItemCard({ product, customerCount, onAdd }) {
|
|||||||
{product.name}
|
{product.name}
|
||||||
</span>
|
</span>
|
||||||
<span style={{ fontSize: 13, fontWeight: 600, color: hasPrice ? '#f59e0b' : 'var(--muted)', flexShrink: 0 }}>
|
<span style={{ fontSize: 13, fontWeight: 600, color: hasPrice ? '#f59e0b' : 'var(--muted)', flexShrink: 0 }}>
|
||||||
{hasPrice ? `${Number(product.base_price).toFixed(2)} €` : 'no charge'}
|
{hasPrice ? money(product.base_price) : t('picker.noCharge')}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -300,7 +303,7 @@ function ServiceItemCard({ product, customerCount, onAdd }) {
|
|||||||
<button
|
<button
|
||||||
onPointerDown={e => e.stopPropagation()}
|
onPointerDown={e => e.stopPropagation()}
|
||||||
onClick={setToCustomerCount}
|
onClick={setToCustomerCount}
|
||||||
title={`Ορισμός σε ${customerCount ?? 1} άτομα`}
|
title={t('picker.setToGuests', { count: customerCount ?? 1 })}
|
||||||
style={{
|
style={{
|
||||||
...btnBase,
|
...btnBase,
|
||||||
background: 'rgba(245,158,11,0.12)',
|
background: 'rgba(245,158,11,0.12)',
|
||||||
@@ -369,11 +372,12 @@ function ServiceItemCard({ product, customerCount, onAdd }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ServiceItemView({ products, customerCount, onAdd }) {
|
function ServiceItemView({ products, customerCount, onAdd }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
return (
|
return (
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, padding: '12px 14px' }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, padding: '12px 14px' }}>
|
||||||
{products.length === 0 ? (
|
{products.length === 0 ? (
|
||||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: 32 }}>
|
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: 32 }}>
|
||||||
Δεν υπάρχουν service αντικείμενα
|
{t('picker.noService')}
|
||||||
</p>
|
</p>
|
||||||
) : products.map(p => (
|
) : products.map(p => (
|
||||||
<ServiceItemCard
|
<ServiceItemCard
|
||||||
@@ -422,6 +426,7 @@ function buildSections(parent, subcategories, directProducts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function ProductPicker({ categories, products, onAdd, onQuickAdd: onQuickAddProp, viewAllOpen, setViewAllOpen, customerCount, courses = [], globalCourseId = null, quickNotes }) {
|
export default function ProductPicker({ categories, products, onAdd, onQuickAdd: onQuickAddProp, viewAllOpen, setViewAllOpen, customerCount, courses = [], globalCourseId = null, quickNotes }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const favorites = useWaiterFavoritesStore(s => s.favorites)
|
const favorites = useWaiterFavoritesStore(s => s.favorites)
|
||||||
|
|
||||||
@@ -541,7 +546,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
|||||||
<svg width="13" height="13" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" strokeWidth="1" strokeLinecap="round" strokeLinejoin="round">
|
<svg width="13" height="13" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" strokeWidth="1" strokeLinecap="round" strokeLinejoin="round">
|
||||||
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
|
<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>
|
||||||
Αγαπημένα
|
{t('settings.tabs.favorites')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{topLevel.map(cat => {
|
{topLevel.map(cat => {
|
||||||
@@ -591,7 +596,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
|||||||
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
|
<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={{ color: 'var(--muted)', fontSize: 14, textAlign: 'center', lineHeight: 1.6 }}>
|
<p style={{ color: 'var(--muted)', fontSize: 14, textAlign: 'center', lineHeight: 1.6 }}>
|
||||||
Δεν έχεις αγαπημένα ακόμα.
|
{t('picker.noFavorites')}
|
||||||
</p>
|
</p>
|
||||||
<button
|
<button
|
||||||
onClick={() => navigate('/settings/favorites')}
|
onClick={() => navigate('/settings/favorites')}
|
||||||
@@ -601,7 +606,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
|||||||
border: 'none', fontSize: 14, fontWeight: 700, cursor: 'pointer',
|
border: 'none', fontSize: 14, fontWeight: 700, cursor: 'pointer',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Ρύθμιση Αγαπημένων
|
{t('settings.fav.setup')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -616,7 +621,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
|||||||
/>
|
/>
|
||||||
{flatProducts.length === 0 && (
|
{flatProducts.length === 0 && (
|
||||||
<p style={{ color: '#64748b', textAlign: 'center', padding: 32 }}>
|
<p style={{ color: '#64748b', textAlign: 'center', padding: 32 }}>
|
||||||
Δεν υπάρχουν προϊόντα
|
{t('picker.noProducts')}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
@@ -682,7 +687,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* View All modal — Κατηγορίες + Tags tabs */}
|
{/* View All modal — categories + tags tabs */}
|
||||||
{viewAllOpen && (
|
{viewAllOpen && (
|
||||||
<div className="modal-overlay" onClick={() => setViewAllOpen(false)}>
|
<div className="modal-overlay" onClick={() => setViewAllOpen(false)}>
|
||||||
<div
|
<div
|
||||||
@@ -691,7 +696,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
|||||||
style={{ display: 'flex', flexDirection: 'column' }}
|
style={{ display: 'flex', flexDirection: 'column' }}
|
||||||
>
|
>
|
||||||
<div className="cat-all-modal__header">
|
<div className="cat-all-modal__header">
|
||||||
<span className="cat-all-modal__title">{modalTab === 'categories' ? 'Κατηγορίες' : 'Tags'}</span>
|
<span className="cat-all-modal__title">{modalTab === 'categories' ? t('picker.categories') : t('picker.tags')}</span>
|
||||||
<button className="icon-btn" onClick={() => setViewAllOpen(false)}>✕</button>
|
<button className="icon-btn" onClick={() => setViewAllOpen(false)}>✕</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -711,7 +716,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
|||||||
transition: 'color 0.12s',
|
transition: 'color 0.12s',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tab === 'categories' ? 'Κατηγορίες' : 'Tags'}
|
{tab === 'categories' ? t('picker.categories') : t('picker.tags')}
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -729,7 +734,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
|||||||
<svg width="13" height="13" viewBox="0 0 24 24" fill="white" stroke="white" strokeWidth="1" style={{ flexShrink: 0 }}>
|
<svg width="13" height="13" viewBox="0 0 24 24" fill="white" stroke="white" strokeWidth="1" style={{ flexShrink: 0 }}>
|
||||||
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
|
<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>
|
||||||
Αγαπημένα
|
{t('settings.tabs.favorites')}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
@@ -757,7 +762,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
|||||||
const taggedProducts = activeTag ? products.filter(p => (p.tags || []).includes(activeTag)) : []
|
const taggedProducts = activeTag ? products.filter(p => (p.tags || []).includes(activeTag)) : []
|
||||||
const byCategory = taggedProducts.reduce((acc, p) => {
|
const byCategory = taggedProducts.reduce((acc, p) => {
|
||||||
const cat = categories.find(c => c.id === p.category_id)
|
const cat = categories.find(c => c.id === p.category_id)
|
||||||
const key = cat?.name || 'Χωρίς Κατηγορία'
|
const key = cat?.name || t('picker.noCategory')
|
||||||
if (!acc[key]) acc[key] = []
|
if (!acc[key]) acc[key] = []
|
||||||
acc[key].push(p)
|
acc[key].push(p)
|
||||||
return acc
|
return acc
|
||||||
@@ -767,7 +772,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
|||||||
<div style={{ flex: 1, overflowY: 'auto', display: 'flex', flexDirection: 'column' }}>
|
<div style={{ flex: 1, overflowY: 'auto', display: 'flex', flexDirection: 'column' }}>
|
||||||
{allTags.length === 0 && (
|
{allTags.length === 0 && (
|
||||||
<div style={{ padding: '32px 16px', textAlign: 'center', color: 'var(--muted)', fontSize: 14 }}>
|
<div style={{ padding: '32px 16px', textAlign: 'center', color: 'var(--muted)', fontSize: 14 }}>
|
||||||
Δεν υπάρχουν tags ακόμα.
|
{t('picker.noTags')}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{allTags.length > 0 && (
|
{allTags.length > 0 && (
|
||||||
@@ -791,7 +796,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
|||||||
)}
|
)}
|
||||||
{activeTag && taggedProducts.length === 0 && (
|
{activeTag && taggedProducts.length === 0 && (
|
||||||
<div style={{ padding: '24px 16px', textAlign: 'center', color: 'var(--muted)', fontSize: 14 }}>
|
<div style={{ padding: '24px 16px', textAlign: 'center', color: 'var(--muted)', fontSize: 14 }}>
|
||||||
Κανένα προϊόν με αυτό το tag.
|
{t('picker.noTagged')}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{activeTag && Object.entries(byCategory).map(([catName, prods]) => (
|
{activeTag && Object.entries(byCategory).map(([catName, prods]) => (
|
||||||
@@ -811,7 +816,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span style={{ fontSize: 14, fontWeight: 600, color: 'var(--text)' }}>{p.name}</span>
|
<span style={{ fontSize: 14, fontWeight: 600, color: 'var(--text)' }}>{p.name}</span>
|
||||||
<span style={{ fontSize: 13, color: 'var(--muted)' }}>€{Number(p.base_price).toFixed(2)}</span>
|
<span style={{ fontSize: 13, color: 'var(--muted)' }}>{money(p.base_price)}</span>
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+10
-1
@@ -1,9 +1,18 @@
|
|||||||
// The waiter app's translations instance (plan step 4.1); its texts are keys in the `waiter`
|
// 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
|
// namespace of @xenia/i18n (step 4.5). Components use useTranslation('waiter'); code outside
|
||||||
// components (services, stores, native glue) uses tw('key').
|
// components (services, stores, native glue) uses tw('key').
|
||||||
import { createI18n } from '@xenia/i18n'
|
import { createFormatters, 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). */
|
/** Translate a waiter key outside a component (the current language). */
|
||||||
export const tw = (key, options) => i18n.t(key, { ns: 'waiter', ...options })
|
export const tw = (key, options) => i18n.t(key, { ns: 'waiter', ...options })
|
||||||
|
|
||||||
|
// Money outside a component's useFormat() (helpers shared by several components): the current
|
||||||
|
// language's format, the venue currency (€). Inside components prefer useFormat().formatMoney.
|
||||||
|
const formatters = new Map()
|
||||||
|
export function money(value) {
|
||||||
|
const lng = i18n.language
|
||||||
|
if (!formatters.has(lng)) formatters.set(lng, createFormatters({ language: lng }))
|
||||||
|
return formatters.get(lng).formatMoney(Number(value) || 0)
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,22 +13,24 @@ import useConnectionStore from '../store/connectionStore'
|
|||||||
import useAuthStore from '../store/authStore'
|
import useAuthStore from '../store/authStore'
|
||||||
import { queueOfflineOrder } from '../services/offlineOrders'
|
import { queueOfflineOrder } from '../services/offlineOrders'
|
||||||
import { assetUrl } from '../config/server'
|
import { assetUrl } from '../config/server'
|
||||||
|
import { money } from '../i18n'
|
||||||
import { LineError, estimate, wireLine } from '@xenia/api'
|
import { LineError, estimate, wireLine } from '@xenia/api'
|
||||||
|
import { useTranslation } from '@xenia/i18n'
|
||||||
|
|
||||||
// A cart item whose option is not on the menu any more (4.4: lines go by id)
|
// A cart item whose option is not on the menu any more (4.4: lines go by id)
|
||||||
const lineErrorText = err => `«${err.product}»: το «${err.what}» δεν υπάρχει πια στο μενού. Αφαιρέστε το και προσθέστε το ξανά.`
|
const lineErrorText = (err, t) => t('add.optionGone', { product: err.product, what: err.what })
|
||||||
const money = v => `${Number(v || 0).toFixed(2)} €`
|
|
||||||
|
|
||||||
// ─── Global Course Modal ──────────────────────────────────────────────────────
|
// ─── Global Course Modal ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
function GlobalCourseModal({ courses, selected, onSelect, onClose }) {
|
function GlobalCourseModal({ courses, selected, onSelect, onClose }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
return (
|
return (
|
||||||
<div className="modal-overlay" onClick={onClose}>
|
<div className="modal-overlay" onClick={onClose}>
|
||||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title">Set Course</h2>
|
<h2 className="modal-title">{t('add.course.title')}</h2>
|
||||||
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 16px' }}>
|
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 16px' }}>
|
||||||
Quick-add items will use this course.
|
{t('add.course.sub')}
|
||||||
</p>
|
</p>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginBottom: 16 }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, marginBottom: 16 }}>
|
||||||
{courses.map(c => (
|
{courses.map(c => (
|
||||||
@@ -57,10 +59,10 @@ function GlobalCourseModal({ courses, selected, onSelect, onClose }) {
|
|||||||
style={{ width: '100%', marginBottom: 8 }}
|
style={{ width: '100%', marginBottom: 8 }}
|
||||||
onClick={() => { onSelect(null); onClose() }}
|
onClick={() => { onSelect(null); onClose() }}
|
||||||
>
|
>
|
||||||
Clear
|
{t('common.clear')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
<button className="btn btn--secondary" style={{ width: '100%' }} onClick={onClose}>Cancel</button>
|
<button className="btn btn--secondary" style={{ width: '100%' }} onClick={onClose}>{t('common.cancel')}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -69,6 +71,7 @@ function GlobalCourseModal({ courses, selected, onSelect, onClose }) {
|
|||||||
// ─── Customer count modal ─────────────────────────────────────────────────────
|
// ─── Customer count modal ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
function CustomerCountModal({ value, onChange, onClose }) {
|
function CustomerCountModal({ value, onChange, onClose }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const [count, setCount] = useState(value ?? 0)
|
const [count, setCount] = useState(value ?? 0)
|
||||||
const QUICK = [1, 2, 3, 4, 5, 6]
|
const QUICK = [1, 2, 3, 4, 5, 6]
|
||||||
|
|
||||||
@@ -76,9 +79,9 @@ function CustomerCountModal({ value, onChange, onClose }) {
|
|||||||
<div className="modal-overlay" onClick={onClose}>
|
<div className="modal-overlay" onClick={onClose}>
|
||||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title">Αριθμός Πελατών</h2>
|
<h2 className="modal-title">{t('detail.guests.title')}</h2>
|
||||||
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 20px' }}>
|
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 20px' }}>
|
||||||
Πόσα άτομα κάθονται στο τραπέζι;
|
{t('detail.guests.question')}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{/* Quick pick */}
|
{/* Quick pick */}
|
||||||
@@ -105,9 +108,9 @@ function CustomerCountModal({ value, onChange, onClose }) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: 'flex', gap: 10 }}>
|
<div style={{ display: 'flex', gap: 10 }}>
|
||||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>Άκυρο</button>
|
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||||
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => { onChange(count || null); onClose() }}>
|
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => { onChange(count || null); onClose() }}>
|
||||||
Εφαρμογή
|
{t('common.apply')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -120,13 +123,14 @@ function CustomerCountModal({ value, onChange, onClose }) {
|
|||||||
// menu's prices as an estimate. A line the server would refuse shows its reason here.
|
// menu's prices as an estimate. A line the server would refuse shows its reason here.
|
||||||
|
|
||||||
function CartTotal({ priced, estimatedTotal, offline }) {
|
function CartTotal({ priced, estimatedTotal, offline }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const exact = !!priced?.data
|
const exact = !!priced?.data
|
||||||
return (
|
return (
|
||||||
<div data-testid="cart-total" data-estimated={exact ? 'false' : 'true'}
|
<div data-testid="cart-total" data-estimated={exact ? 'false' : 'true'}
|
||||||
style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
|
style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline' }}>
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline' }}>
|
||||||
<span style={{ fontSize: 13, color: 'var(--muted)', fontWeight: 600 }}>
|
<span style={{ fontSize: 13, color: 'var(--muted)', fontWeight: 600 }}>
|
||||||
{exact ? 'Σύνολο' : offline ? 'Σύνολο (εκτίμηση, χωρίς σύνδεση)' : 'Σύνολο (εκτίμηση)'}
|
{exact ? t('common.total') : offline ? t('add.totalEstimateOffline') : t('add.totalEstimate')}
|
||||||
</span>
|
</span>
|
||||||
<span style={{ fontSize: 17, fontWeight: 800, color: 'var(--text)', fontVariantNumeric: 'tabular-nums' }}>
|
<span style={{ fontSize: 17, fontWeight: 800, color: 'var(--text)', fontVariantNumeric: 'tabular-nums' }}>
|
||||||
{exact ? money(priced.data.total) : `≈ ${money(estimatedTotal)}`}
|
{exact ? money(priced.data.total) : `≈ ${money(estimatedTotal)}`}
|
||||||
@@ -148,6 +152,7 @@ function fmtDraftQty(qty, unitType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function AddItemsPage() {
|
export default function AddItemsPage() {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const { tableId, orderType } = useParams()
|
const { tableId, orderType } = useParams()
|
||||||
const isStandalone = !!orderType // true when on /standalone/:orderType/add
|
const isStandalone = !!orderType // true when on /standalone/:orderType/add
|
||||||
const [searchParams] = useSearchParams()
|
const [searchParams] = useSearchParams()
|
||||||
@@ -199,8 +204,8 @@ export default function AddItemsPage() {
|
|||||||
try {
|
try {
|
||||||
const statusRes = await client.get(`/api/tables/${tableId}/status`)
|
const statusRes = await client.get(`/api/tables/${tableId}/status`)
|
||||||
setOrderId(statusRes.data.active_order_id)
|
setOrderId(statusRes.data.active_order_id)
|
||||||
const t = statusRes.data.table
|
const tbl = statusRes.data.table
|
||||||
if (t) setTableLabel(t.label || `T${t.number}`)
|
if (tbl) setTableLabel(tbl.label || `T${tbl.number}`)
|
||||||
// Load existing customer count from the active order
|
// Load existing customer count from the active order
|
||||||
if (statusRes.data.active_order_id) {
|
if (statusRes.data.active_order_id) {
|
||||||
const { data: o } = await client.get(`/api/orders/${statusRes.data.active_order_id}`)
|
const { data: o } = await client.get(`/api/orders/${statusRes.data.active_order_id}`)
|
||||||
@@ -208,8 +213,8 @@ export default function AddItemsPage() {
|
|||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// Offline — read table label from IDB snapshot
|
// Offline — read table label from IDB snapshot
|
||||||
const t = await db.pos_tables.get(Number(tableId))
|
const tbl = await db.pos_tables.get(Number(tableId))
|
||||||
if (t) setTableLabel(t.label || `T${t.number}`)
|
if (tbl) setTableLabel(tbl.label || `T${tbl.number}`)
|
||||||
// orderId stays null — offline orders don't need a pre-existing server order
|
// orderId stays null — offline orders don't need a pre-existing server order
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -325,17 +330,17 @@ export default function AddItemsPage() {
|
|||||||
if (!quoteKey) return undefined
|
if (!quoteKey) return undefined
|
||||||
let lines
|
let lines
|
||||||
try { lines = cartLines() } catch (err) {
|
try { lines = cartLines() } catch (err) {
|
||||||
const t = setTimeout(() => setQuote({ key: quoteKey, data: null, error: err instanceof LineError ? lineErrorText(err) : String(err) }), 0)
|
const timer = setTimeout(() => setQuote({ key: quoteKey, data: null, error: err instanceof LineError ? lineErrorText(err, t) : String(err) }), 0)
|
||||||
return () => clearTimeout(t)
|
return () => clearTimeout(timer)
|
||||||
}
|
}
|
||||||
const t = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
client.post('/api/orders/quote', {
|
client.post('/api/orders/quote', {
|
||||||
lines, order_id: orderId ?? undefined, order_type: isStandalone ? orderType : 'here',
|
lines, order_id: orderId ?? undefined, order_type: isStandalone ? orderType : 'here',
|
||||||
}, { noOverride: true })
|
}, { noOverride: true })
|
||||||
.then(r => setQuote({ key: quoteKey, data: r.data, error: null }))
|
.then(r => setQuote({ key: quoteKey, data: r.data, error: null }))
|
||||||
.catch(err => setQuote({ key: quoteKey, data: null, error: apiError(err, '') }))
|
.catch(err => setQuote({ key: quoteKey, data: null, error: apiError(err, '') }))
|
||||||
}, 250)
|
}, 250)
|
||||||
return () => clearTimeout(t)
|
return () => clearTimeout(timer)
|
||||||
}, [quoteKey]) // eslint-disable-line react-hooks/exhaustive-deps
|
}, [quoteKey]) // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
const priced = quote && quote.key === quoteKey ? quote : null
|
const priced = quote && quote.key === quoteKey ? quote : null
|
||||||
|
|
||||||
@@ -370,7 +375,7 @@ export default function AddItemsPage() {
|
|||||||
setTimeout(() => navigate('/tables'), 1200)
|
setTimeout(() => navigate('/tables'), 1200)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('[offline order] save failed:', err)
|
console.error('[offline order] save failed:', err)
|
||||||
setError(err instanceof LineError ? lineErrorText(err) : 'Σφάλμα αποθήκευσης offline παραγγελίας')
|
setError(err instanceof LineError ? lineErrorText(err, t) : t('add.offlineSaveFailed'))
|
||||||
} finally {
|
} finally {
|
||||||
setSending(false)
|
setSending(false)
|
||||||
}
|
}
|
||||||
@@ -382,7 +387,7 @@ export default function AddItemsPage() {
|
|||||||
let lines
|
let lines
|
||||||
try { lines = cartLines() } catch (err) {
|
try { lines = cartLines() } catch (err) {
|
||||||
if (!(err instanceof LineError)) throw err
|
if (!(err instanceof LineError)) throw err
|
||||||
setError(lineErrorText(err))
|
setError(lineErrorText(err, t))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let activeOrderId = orderId
|
let activeOrderId = orderId
|
||||||
@@ -414,7 +419,7 @@ export default function AddItemsPage() {
|
|||||||
setTimeout(() => navigate('/tables'), 1200)
|
setTimeout(() => navigate('/tables'), 1200)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(apiError(err, 'Σφάλμα αποστολής — η παραγγελία δεν στάλθηκε'))
|
setError(apiError(err, t('add.sendFailed')))
|
||||||
} finally {
|
} finally {
|
||||||
setSending(false)
|
setSending(false)
|
||||||
}
|
}
|
||||||
@@ -517,11 +522,11 @@ export default function AddItemsPage() {
|
|||||||
if (item.selected_options?.length) {
|
if (item.selected_options?.length) {
|
||||||
item.selected_options.forEach(o => {
|
item.selected_options.forEach(o => {
|
||||||
if (o.price_delta && o.price_delta !== 0)
|
if (o.price_delta && o.price_delta !== 0)
|
||||||
lines.push(`${o.name} (${o.price_delta > 0 ? '+' : ''}${o.price_delta.toFixed(2)} €)`)
|
lines.push(`${o.name} (${o.price_delta > 0 ? '+' : ''}${money(o.price_delta)})`)
|
||||||
else lines.push(o.name)
|
else lines.push(o.name)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (item.removed_ingredients?.length) lines.push(`Χωρίς: ${item.removed_ingredients.join(', ')}`)
|
if (item.removed_ingredients?.length) lines.push(t('add.withoutList', { names: item.removed_ingredients.join(', ') }))
|
||||||
if (item.notes) lines.push(item.notes)
|
if (item.notes) lines.push(item.notes)
|
||||||
return lines
|
return lines
|
||||||
}
|
}
|
||||||
@@ -534,14 +539,14 @@ export default function AddItemsPage() {
|
|||||||
<div className="page" style={{ position: 'relative' }}>
|
<div className="page" style={{ position: 'relative' }}>
|
||||||
<header className="top-bar">
|
<header className="top-bar">
|
||||||
<button className="icon-btn" onClick={handleBack}>←</button>
|
<button className="icon-btn" onClick={handleBack}>←</button>
|
||||||
<span className="top-bar__title">{tableLabel || (isNewTable ? 'Νέα Παραγγελία' : 'Προσθήκη')}</span>
|
<span className="top-bar__title">{tableLabel || (isNewTable ? t('add.newOrder') : t('add.add'))}</span>
|
||||||
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
|
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
|
||||||
{/* Customer count button */}
|
{/* Customer count button */}
|
||||||
<button
|
<button
|
||||||
className="icon-btn"
|
className="icon-btn"
|
||||||
style={{ position: 'relative' }}
|
style={{ position: 'relative' }}
|
||||||
onClick={() => setCustomerCountOpen(true)}
|
onClick={() => setCustomerCountOpen(true)}
|
||||||
title="Αριθμός πελατών"
|
title={t('detail.guests.button')}
|
||||||
>
|
>
|
||||||
<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="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||||
@@ -566,7 +571,7 @@ export default function AddItemsPage() {
|
|||||||
className="icon-btn"
|
className="icon-btn"
|
||||||
style={{ position: 'relative' }}
|
style={{ position: 'relative' }}
|
||||||
onClick={() => setGlobalCourseOpen(true)}
|
onClick={() => setGlobalCourseOpen(true)}
|
||||||
title="Set course"
|
title={t('add.course.title')}
|
||||||
>
|
>
|
||||||
<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" strokeLinecap="round"/>
|
<circle cx="12" cy="12" r="9" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/>
|
||||||
@@ -588,14 +593,14 @@ export default function AddItemsPage() {
|
|||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{/* Search button */}
|
{/* Search button */}
|
||||||
<button className="icon-btn" onClick={() => { setSearchQuery(''); setSearchOpen(true) }} title="Αναζήτηση">
|
<button className="icon-btn" onClick={() => { setSearchQuery(''); setSearchOpen(true) }} title={t('add.search.title')}>
|
||||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
|
||||||
<circle cx="11" cy="11" r="7" stroke="currentColor" strokeWidth="2.2"/>
|
<circle cx="11" cy="11" r="7" stroke="currentColor" strokeWidth="2.2"/>
|
||||||
<path d="M16.5 16.5L21 21" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round"/>
|
<path d="M16.5 16.5L21 21" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round"/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
{/* Categories button */}
|
{/* Categories button */}
|
||||||
<button className="icon-btn" onClick={() => setViewAllOpen(true)} title="Όλες οι κατηγορίες">
|
<button className="icon-btn" onClick={() => setViewAllOpen(true)} title={t('add.allCategories')}>
|
||||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
|
||||||
<rect x="3" y="3" width="7" height="7" rx="1.5" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/>
|
<rect x="3" y="3" width="7" height="7" rx="1.5" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/>
|
||||||
<rect x="14" y="3" width="7" height="7" rx="1.5" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/>
|
<rect x="14" y="3" width="7" height="7" rx="1.5" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/>
|
||||||
@@ -646,7 +651,7 @@ export default function AddItemsPage() {
|
|||||||
<QuickAddToast product={quickToast.product} count={quickToast.count} />
|
<QuickAddToast product={quickToast.product} count={quickToast.count} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* ── Bottom bar: floating mini-cart + full-width ΑΠΟΣΤΟΛΗ ─────────────── */}
|
{/* ── Bottom bar: floating mini-cart + full-width SEND ─────────────── */}
|
||||||
<div style={{
|
<div style={{
|
||||||
background: 'var(--bg2)',
|
background: 'var(--bg2)',
|
||||||
borderTop: '1px solid var(--border)',
|
borderTop: '1px solid var(--border)',
|
||||||
@@ -680,7 +685,7 @@ export default function AddItemsPage() {
|
|||||||
})}
|
})}
|
||||||
{hiddenCount > 0 && (
|
{hiddenCount > 0 && (
|
||||||
<div style={{ fontSize: 11, color: 'var(--muted)', textAlign: 'right' }}>
|
<div style={{ fontSize: 11, color: 'var(--muted)', textAlign: 'right' }}>
|
||||||
+{hiddenCount} ακόμα — δείτε όλα →
|
{t('add.moreSeeAll', { count: hiddenCount })}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -693,7 +698,7 @@ export default function AddItemsPage() {
|
|||||||
onClick={() => summaryBeforeSend && cart.length > 0 ? setSummaryOpen(true) : sendOrder()}
|
onClick={() => summaryBeforeSend && cart.length > 0 ? setSummaryOpen(true) : sendOrder()}
|
||||||
disabled={cart.length === 0 || sending}
|
disabled={cart.length === 0 || sending}
|
||||||
>
|
>
|
||||||
{sending ? 'Αποστολή…' : summaryBeforeSend && cart.length > 0 ? `ΣΥΝΟΨΗ (${cart.length})` : `ΑΠΟΣΤΟΛΗ${cart.length > 0 ? ` (${cart.length})` : ''}`}
|
{sending ? t('add.sending') : summaryBeforeSend && cart.length > 0 ? t('add.summaryCount', { count: cart.length }) : cart.length > 0 ? t('add.sendCount', { count: cart.length }) : t('add.send')}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{error && <p className="error-msg" style={{ marginTop: 8 }}>{error}</p>}
|
{error && <p className="error-msg" style={{ marginTop: 8 }}>{error}</p>}
|
||||||
@@ -728,8 +733,8 @@ export default function AddItemsPage() {
|
|||||||
{/* Drawer header */}
|
{/* Drawer header */}
|
||||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '14px 16px', borderBottom: '1px solid var(--border)', flexShrink: 0 }}>
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '14px 16px', borderBottom: '1px solid var(--border)', flexShrink: 0 }}>
|
||||||
<div>
|
<div>
|
||||||
<div style={{ fontSize: 16, fontWeight: 700, color: 'var(--text)' }}>Παραγγελία</div>
|
<div style={{ fontSize: 16, fontWeight: 700, color: 'var(--text)' }}>{t('add.order')}</div>
|
||||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 1 }}>{cart.length} {cart.length === 1 ? 'προϊόν' : 'προϊόντα'}</div>
|
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 1 }}>{t('add.products', { count: cart.length })}</div>
|
||||||
</div>
|
</div>
|
||||||
<button onClick={() => setCartOpen(false)} style={{ background: 'var(--bg3)', border: 'none', borderRadius: '50%', width: 34, height: 34, display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', color: 'var(--text)' }}>
|
<button onClick={() => setCartOpen(false)} style={{ background: 'var(--bg3)', border: 'none', borderRadius: '50%', width: 34, height: 34, display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', color: 'var(--text)' }}>
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M6 6L18 18M6 18L18 6" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round"/></svg>
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M6 6L18 18M6 18L18 6" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round"/></svg>
|
||||||
@@ -739,7 +744,7 @@ export default function AddItemsPage() {
|
|||||||
{/* Item list */}
|
{/* Item list */}
|
||||||
<div style={{ flex: 1, overflowY: 'auto', padding: 12 }}>
|
<div style={{ flex: 1, overflowY: 'auto', padding: 12 }}>
|
||||||
{cart.length === 0 ? (
|
{cart.length === 0 ? (
|
||||||
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '40px 0', fontSize: 14 }}>Η παραγγελία είναι κενή.</p>
|
<p style={{ color: 'var(--muted)', textAlign: 'center', padding: '40px 0', fontSize: 14 }}>{t('add.empty')}</p>
|
||||||
) : courses.length > 0 ? (() => {
|
) : courses.length > 0 ? (() => {
|
||||||
// Group by course, ordered by course definition, "no course" last
|
// Group by course, ordered by course definition, "no course" last
|
||||||
const groups = []
|
const groups = []
|
||||||
@@ -768,7 +773,7 @@ export default function AddItemsPage() {
|
|||||||
textTransform: 'uppercase', letterSpacing: 0.8,
|
textTransform: 'uppercase', letterSpacing: 0.8,
|
||||||
marginBottom: 6,
|
marginBottom: 6,
|
||||||
}}>
|
}}>
|
||||||
{group.course ? group.course.name : 'No course'}
|
{group.course ? group.course.name : t('add.course.none')}
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||||
{group.items.map(item => {
|
{group.items.map(item => {
|
||||||
@@ -822,7 +827,7 @@ export default function AddItemsPage() {
|
|||||||
autoFocus
|
autoFocus
|
||||||
value={orderNote}
|
value={orderNote}
|
||||||
onChange={e => setOrderNote(e.target.value)}
|
onChange={e => setOrderNote(e.target.value)}
|
||||||
placeholder="Σημείωση για ολόκληρη την παραγγελία…"
|
placeholder={t('add.note.placeholder')}
|
||||||
rows={3}
|
rows={3}
|
||||||
style={{
|
style={{
|
||||||
width: '100%', resize: 'none', padding: '10px 12px',
|
width: '100%', resize: 'none', padding: '10px 12px',
|
||||||
@@ -835,7 +840,7 @@ export default function AddItemsPage() {
|
|||||||
onClick={() => setOrderNoteEditing(false)}
|
onClick={() => setOrderNoteEditing(false)}
|
||||||
style={{ alignSelf: 'flex-end', background: 'none', border: 'none', fontSize: 12, fontWeight: 700, color: 'var(--accent)', cursor: 'pointer', padding: '2px 0' }}
|
style={{ alignSelf: 'flex-end', background: 'none', border: 'none', fontSize: 12, fontWeight: 700, color: 'var(--accent)', cursor: 'pointer', padding: '2px 0' }}
|
||||||
>
|
>
|
||||||
Αποθήκευση
|
{t('common.save')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
) : orderNote ? (
|
) : orderNote ? (
|
||||||
@@ -843,7 +848,7 @@ export default function AddItemsPage() {
|
|||||||
onClick={() => setOrderNoteEditing(true)}
|
onClick={() => setOrderNoteEditing(true)}
|
||||||
style={{ cursor: 'pointer', padding: '9px 12px', background: 'rgba(245,158,11,0.09)', border: '1.5px solid rgba(245,158,11,0.3)', borderRadius: 10, fontSize: 13, color: 'var(--text)', lineHeight: 1.5, whiteSpace: 'pre-wrap', position: 'relative' }}
|
style={{ cursor: 'pointer', padding: '9px 12px', background: 'rgba(245,158,11,0.09)', border: '1.5px solid rgba(245,158,11,0.3)', borderRadius: 10, fontSize: 13, color: 'var(--text)', lineHeight: 1.5, whiteSpace: 'pre-wrap', position: 'relative' }}
|
||||||
>
|
>
|
||||||
<span style={{ fontSize: 10, fontWeight: 700, color: '#f59e0b', textTransform: 'uppercase', letterSpacing: 0.6, display: 'block', marginBottom: 3 }}>Σημείωση Παραγγελίας</span>
|
<span style={{ fontSize: 10, fontWeight: 700, color: '#f59e0b', textTransform: 'uppercase', letterSpacing: 0.6, display: 'block', marginBottom: 3 }}>{t('add.note.title')}</span>
|
||||||
{orderNote}
|
{orderNote}
|
||||||
<span style={{ position: 'absolute', top: 8, right: 10, fontSize: 11, color: '#f59e0b', fontWeight: 700 }}>✎</span>
|
<span style={{ position: 'absolute', top: 8, right: 10, fontSize: 11, color: '#f59e0b', fontWeight: 700 }}>✎</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -858,7 +863,7 @@ export default function AddItemsPage() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg width="15" height="15" viewBox="0 0 24 24" fill="none"><path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/></svg>
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none"><path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/></svg>
|
||||||
Προσθήκη σημείωσης παραγγελίας
|
{t('add.note.add')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -875,7 +880,7 @@ export default function AddItemsPage() {
|
|||||||
onClick={() => { setCartOpen(false); if (summaryBeforeSend) setSummaryOpen(true); else sendOrder() }}
|
onClick={() => { setCartOpen(false); if (summaryBeforeSend) setSummaryOpen(true); else sendOrder() }}
|
||||||
disabled={cart.length === 0 || sending}
|
disabled={cart.length === 0 || sending}
|
||||||
>
|
>
|
||||||
{sending ? 'Αποστολή…' : summaryBeforeSend ? `ΣΥΝΟΨΗ (${cart.length})` : `ΑΠΟΣΤΟΛΗ (${cart.length})`}
|
{sending ? t('add.sending') : summaryBeforeSend ? t('add.summaryCount', { count: cart.length }) : t('add.sendCount', { count: cart.length })}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1008,7 +1013,7 @@ export default function AddItemsPage() {
|
|||||||
)}
|
)}
|
||||||
</svg>
|
</svg>
|
||||||
<span style={{ color: printAck._offline || printAck._pending ? '#fcd34d' : '#86efac', fontWeight: 700, fontSize: 18, letterSpacing: 0.3 }}>
|
<span style={{ color: printAck._offline || printAck._pending ? '#fcd34d' : '#86efac', fontWeight: 700, fontSize: 18, letterSpacing: 0.3 }}>
|
||||||
{printAck._offline ? 'Αποθηκεύτηκε Offline' : printAck._pending ? 'Στάλθηκε — Εκτύπωση σε εξέλιξη' : 'Εκτυπώθηκε Επιτυχώς'}
|
{printAck._offline ? t('add.ack.offline') : printAck._pending ? t('add.ack.printing') : t('add.ack.printed')}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<style>{`
|
<style>{`
|
||||||
@@ -1024,6 +1029,7 @@ export default function AddItemsPage() {
|
|||||||
// ── Deal Offer Modal ──────────────────────────────────────────────────────────
|
// ── Deal Offer Modal ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
function DealOfferModal({ offer, _products, onAccept, onDismiss }) {
|
function DealOfferModal({ offer, _products, onAccept, onDismiss }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const isFreeItem = offer.action_type === 'free_item'
|
const isFreeItem = offer.action_type === 'free_item'
|
||||||
const isFreeChoice = offer.action_type === 'free_choice'
|
const isFreeChoice = offer.action_type === 'free_choice'
|
||||||
const isDiscount = ['set_price','add_amount','add_percent','apply_modifier'].includes(offer.action_type)
|
const isDiscount = ['set_price','add_amount','add_percent','apply_modifier'].includes(offer.action_type)
|
||||||
@@ -1069,7 +1075,7 @@ function DealOfferModal({ offer, _products, onAccept, onDismiss }) {
|
|||||||
stroke="#a78bfa" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
stroke="#a78bfa" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<h2 style={{ margin: 0, fontSize: 17, fontWeight: 700, color: '#a78bfa' }}>Προσφορά Ενεργοποιήθηκε!</h2>
|
<h2 style={{ margin: 0, fontSize: 17, fontWeight: 700, color: '#a78bfa' }}>{t('add.deal.title')}</h2>
|
||||||
<p style={{ margin: '6px 0 0', fontSize: 14, fontWeight: 600, color: 'var(--text)' }}>{offer.deal_name}</p>
|
<p style={{ margin: '6px 0 0', fontSize: 14, fontWeight: 600, color: 'var(--text)' }}>{offer.deal_name}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1080,7 +1086,7 @@ function DealOfferModal({ offer, _products, onAccept, onDismiss }) {
|
|||||||
background: 'rgba(34,197,94,0.08)', border: '1.5px solid rgba(34,197,94,0.3)',
|
background: 'rgba(34,197,94,0.08)', border: '1.5px solid rgba(34,197,94,0.3)',
|
||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
}}>
|
}}>
|
||||||
<p style={{ margin: 0, fontSize: 13, color: 'var(--muted)', marginBottom: 4 }}>Δωρεάν προϊόν:</p>
|
<p style={{ margin: 0, fontSize: 13, color: 'var(--muted)', marginBottom: 4 }}>{t('add.deal.freeProduct')}</p>
|
||||||
<p style={{ margin: 0, fontSize: 15, fontWeight: 700, color: '#4ade80' }}>
|
<p style={{ margin: 0, fontSize: 15, fontWeight: 700, color: '#4ade80' }}>
|
||||||
{offer.free_item_name}
|
{offer.free_item_name}
|
||||||
{offer.free_quantity > 1 && <span style={{ color: '#f59e0b', marginLeft: 6 }}>×{offer.free_quantity}</span>}
|
{offer.free_quantity > 1 && <span style={{ color: '#f59e0b', marginLeft: 6 }}>×{offer.free_quantity}</span>}
|
||||||
@@ -1092,8 +1098,8 @@ function DealOfferModal({ offer, _products, onAccept, onDismiss }) {
|
|||||||
{isFreeChoice && offer.free_choices?.length > 0 && (
|
{isFreeChoice && offer.free_choices?.length > 0 && (
|
||||||
<div style={{ marginBottom: 16 }}>
|
<div style={{ marginBottom: 16 }}>
|
||||||
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 8 }}>
|
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 8 }}>
|
||||||
Επιλέξτε {offer.free_quantity ?? 1} δωρεάν {offer.free_quantity === 1 ? 'προϊόν' : 'προϊόντα'}
|
{t('add.deal.pickFree', { count: offer.free_quantity ?? 1 })}
|
||||||
{remaining > 0 && <span style={{ color: '#a78bfa', marginLeft: 4 }}>({remaining} ακόμα)</span>}
|
{remaining > 0 && <span style={{ color: '#a78bfa', marginLeft: 4 }}>{t('add.deal.remaining', { count: remaining })}</span>}
|
||||||
</p>
|
</p>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, maxHeight: 220, overflowY: 'auto' }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, maxHeight: 220, overflowY: 'auto' }}>
|
||||||
{offer.free_choices.map(choice => {
|
{offer.free_choices.map(choice => {
|
||||||
@@ -1130,21 +1136,21 @@ function DealOfferModal({ offer, _products, onAccept, onDismiss }) {
|
|||||||
borderRadius: 12, textAlign: 'center',
|
borderRadius: 12, textAlign: 'center',
|
||||||
}}>
|
}}>
|
||||||
<span style={{ fontSize: 14, color: 'var(--muted)', textDecoration: 'line-through' }}>
|
<span style={{ fontSize: 14, color: 'var(--muted)', textDecoration: 'line-through' }}>
|
||||||
{offer.price_before.toFixed(2)} €
|
{money(offer.price_before)}
|
||||||
</span>
|
</span>
|
||||||
<span style={{ fontSize: 22, fontWeight: 800, color: '#4ade80', margin: '0 12px' }}>
|
<span style={{ fontSize: 22, fontWeight: 800, color: '#4ade80', margin: '0 12px' }}>
|
||||||
{offer.price_after.toFixed(2)} €
|
{money(offer.price_after)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div style={{ display: 'flex', gap: 10 }}>
|
<div style={{ display: 'flex', gap: 10 }}>
|
||||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onDismiss}>
|
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onDismiss}>
|
||||||
Παράβλεψη
|
{t('add.deal.skip')}
|
||||||
</button>
|
</button>
|
||||||
<button className="btn btn--primary" style={{ flex: 1, background: '#7c3aed', borderColor: '#7c3aed' }}
|
<button className="btn btn--primary" style={{ flex: 1, background: '#7c3aed', borderColor: '#7c3aed' }}
|
||||||
onClick={handleAccept} disabled={!canConfirm}>
|
onClick={handleAccept} disabled={!canConfirm}>
|
||||||
{isFreeItem ? 'Προσθήκη Δωρεάν' : isFreeChoice ? 'Επιβεβαίωση' : 'Εφαρμογή'}
|
{isFreeItem ? t('add.deal.addFree') : isFreeChoice ? t('common.confirm') : t('common.apply')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1155,6 +1161,7 @@ function DealOfferModal({ offer, _products, onAccept, onDismiss }) {
|
|||||||
// ── Quick-Add Toast ───────────────────────────────────────────────────────────
|
// ── Quick-Add Toast ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
function QuickAddToast({ product, count }) {
|
function QuickAddToast({ product, count }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const initials = product.name.trim().split(/\s+/).slice(0, 2).map(w => w[0]).join('').toUpperCase()
|
const initials = product.name.trim().split(/\s+/).slice(0, 2).map(w => w[0]).join('').toUpperCase()
|
||||||
return (
|
return (
|
||||||
<div style={{
|
<div style={{
|
||||||
@@ -1188,7 +1195,7 @@ function QuickAddToast({ product, count }) {
|
|||||||
fontSize: 13, fontWeight: 600, color: 'var(--text)',
|
fontSize: 13, fontWeight: 600, color: 'var(--text)',
|
||||||
overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
|
overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
|
||||||
}}>{product.name}</div>
|
}}>{product.name}</div>
|
||||||
<div style={{ fontSize: 11, color: 'var(--muted)', marginTop: 1 }}>στο καλάθι</div>
|
<div style={{ fontSize: 11, color: 'var(--muted)', marginTop: 1 }}>{t('add.inCart')}</div>
|
||||||
</div>
|
</div>
|
||||||
{/* Count badge */}
|
{/* Count badge */}
|
||||||
<div style={{
|
<div style={{
|
||||||
@@ -1230,6 +1237,7 @@ function SectionIcon({ type }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function CartItem({ item, product, summaryLines, sections, onEdit, onRemove, onChangeQty }) {
|
function CartItem({ item, product, summaryLines, sections, onEdit, onRemove, onChangeQty }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const [expanded, setExpanded] = useState(false)
|
const [expanded, setExpanded] = useState(false)
|
||||||
const hasDetails = sections.length > 0
|
const hasDetails = sections.length > 0
|
||||||
|
|
||||||
@@ -1262,7 +1270,7 @@ function CartItem({ item, product, summaryLines, sections, onEdit, onRemove, onC
|
|||||||
|
|
||||||
{/* Edit — stop propagation so it doesn't toggle expand */}
|
{/* Edit — stop propagation so it doesn't toggle expand */}
|
||||||
<button onClick={e => { e.stopPropagation(); onEdit() }} style={{ background: 'none', border: '1px solid var(--border)', borderRadius: 7, color: 'var(--muted)', cursor: 'pointer', padding: '3px 9px', fontSize: 12, fontWeight: 500, flexShrink: 0 }}>
|
<button onClick={e => { e.stopPropagation(); onEdit() }} style={{ background: 'none', border: '1px solid var(--border)', borderRadius: 7, color: 'var(--muted)', cursor: 'pointer', padding: '3px 9px', fontSize: 12, fontWeight: 500, flexShrink: 0 }}>
|
||||||
Επεξ.
|
{t('add.edit')}
|
||||||
</button>
|
</button>
|
||||||
{/* Remove */}
|
{/* Remove */}
|
||||||
<button onClick={e => { e.stopPropagation(); onRemove() }} style={{ background: 'none', border: 'none', color: 'var(--danger)', cursor: 'pointer', padding: 4, display: 'flex', alignItems: 'center', flexShrink: 0 }}>
|
<button onClick={e => { e.stopPropagation(); onRemove() }} style={{ background: 'none', border: 'none', color: 'var(--danger)', cursor: 'pointer', padding: 4, display: 'flex', alignItems: 'center', flexShrink: 0 }}>
|
||||||
@@ -1307,7 +1315,7 @@ function CartItem({ item, product, summaryLines, sections, onEdit, onRemove, onC
|
|||||||
{sec.type === 'removed' && sec.lines.map((line, li) => (
|
{sec.type === 'removed' && sec.lines.map((line, li) => (
|
||||||
<div key={li} style={{ display: 'flex', alignItems: 'center', gap: 7 }}>
|
<div key={li} style={{ display: 'flex', alignItems: 'center', gap: 7 }}>
|
||||||
<SectionIcon type="removed" />
|
<SectionIcon type="removed" />
|
||||||
<span style={{ fontSize: 12, color: 'var(--text)', flex: 1 }}>Χωρίς {line.name}</span>
|
<span style={{ fontSize: 12, color: 'var(--text)', flex: 1 }}>{t('drawer.without', { name: line.name })}</span>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
{sec.type === 'note' && sec.lines.map((line, li) => (
|
{sec.type === 'note' && sec.lines.map((line, li) => (
|
||||||
@@ -1366,6 +1374,7 @@ function CartItem({ item, product, summaryLines, sections, onEdit, onRemove, onC
|
|||||||
|
|
||||||
|
|
||||||
function SearchModal({ products, query, setQuery, onClose, onAdd, courses = [], quickNotes }) {
|
function SearchModal({ products, query, setQuery, onClose, onAdd, courses = [], quickNotes }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const [drawerProduct, setDrawerProduct] = useState(null)
|
const [drawerProduct, setDrawerProduct] = useState(null)
|
||||||
const activeProducts = products.filter(p => p.lifecycle_status !== 'archived')
|
const activeProducts = products.filter(p => p.lifecycle_status !== 'archived')
|
||||||
|
|
||||||
@@ -1404,11 +1413,11 @@ function SearchModal({ products, query, setQuery, onClose, onAdd, courses = [],
|
|||||||
<div style={{ flex: 1, overflowY: 'auto', minHeight: 0 }}>
|
<div style={{ flex: 1, overflowY: 'auto', minHeight: 0 }}>
|
||||||
{query.trim().length === 0 ? (
|
{query.trim().length === 0 ? (
|
||||||
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: '16px 20px', fontSize: 14 }}>
|
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: '16px 20px', fontSize: 14 }}>
|
||||||
Πληκτρολογήστε για αναζήτηση…
|
{t('add.search.type')}
|
||||||
</p>
|
</p>
|
||||||
) : results.length === 0 ? (
|
) : results.length === 0 ? (
|
||||||
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: '16px 20px', fontSize: 14 }}>
|
<p style={{ textAlign: 'center', color: 'var(--muted)', padding: '16px 20px', fontSize: 14 }}>
|
||||||
Δεν βρέθηκαν προϊόντα για «{query}»
|
{t('add.search.none', { query })}
|
||||||
</p>
|
</p>
|
||||||
) : results.map(p => {
|
) : results.map(p => {
|
||||||
const initials = p.name.trim().split(/\s+/).slice(0, 2).map(w => w[0]).join('').toUpperCase()
|
const initials = p.name.trim().split(/\s+/).slice(0, 2).map(w => w[0]).join('').toUpperCase()
|
||||||
@@ -1439,7 +1448,7 @@ function SearchModal({ products, query, setQuery, onClose, onAdd, courses = [],
|
|||||||
{p.name}
|
{p.name}
|
||||||
</div>
|
</div>
|
||||||
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>
|
<div style={{ fontSize: 12, color: 'var(--muted)', marginTop: 2 }}>
|
||||||
{Number(p.base_price).toFixed(2)} €
|
{money(p.base_price)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" style={{ color: 'var(--muted)', flexShrink: 0 }}>
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" style={{ color: 'var(--muted)', flexShrink: 0 }}>
|
||||||
@@ -1465,7 +1474,7 @@ function SearchModal({ products, query, setQuery, onClose, onAdd, courses = [],
|
|||||||
autoFocus
|
autoFocus
|
||||||
value={query}
|
value={query}
|
||||||
onChange={e => setQuery(e.target.value)}
|
onChange={e => setQuery(e.target.value)}
|
||||||
placeholder="Αναζήτηση προϊόντος…"
|
placeholder={t('add.search.placeholder')}
|
||||||
style={{
|
style={{
|
||||||
flex: 1, height: 44, background: 'var(--bg2)',
|
flex: 1, height: 44, background: 'var(--bg2)',
|
||||||
border: '1px solid var(--border)', borderRadius: 12,
|
border: '1px solid var(--border)', borderRadius: 12,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ 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'
|
import { useFormat, useTranslation } from '@xenia/i18n'
|
||||||
|
import { money } from '../i18n'
|
||||||
|
|
||||||
// ── Heart icon ────────────────────────────────────────────────────────────────
|
// ── Heart icon ────────────────────────────────────────────────────────────────
|
||||||
function Heart({ filled, size = 22 }) {
|
function Heart({ filled, size = 22 }) {
|
||||||
@@ -67,10 +68,10 @@ function AttrSection({ title, items, favIds, onToggle }) {
|
|||||||
{item.name}
|
{item.name}
|
||||||
</div>
|
</div>
|
||||||
{item.extra_cost != null && item.extra_cost !== 0 && (
|
{item.extra_cost != null && item.extra_cost !== 0 && (
|
||||||
<div style={{ fontSize: 12, color: 'var(--muted)' }}>+{Number(item.extra_cost).toFixed(2)} €</div>
|
<div style={{ fontSize: 12, color: 'var(--muted)' }}>+{money(item.extra_cost)}</div>
|
||||||
)}
|
)}
|
||||||
{item.price != null && item.price !== 0 && (
|
{item.price != null && item.price !== 0 && (
|
||||||
<div style={{ fontSize: 12, color: 'var(--muted)' }}>+{Number(item.price).toFixed(2)} €</div>
|
<div style={{ fontSize: 12, color: 'var(--muted)' }}>+{money(item.price)}</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
@@ -407,7 +408,7 @@ function FavoritesList({ items, products, onReorder }) {
|
|||||||
{product.name}
|
{product.name}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0 }}>{Number(product.base_price).toFixed(2)} €</span>
|
<span style={{ fontSize: 12, color: 'var(--muted)', flexShrink: 0 }}>{money(product.base_price)}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{dropIndex === idx + 1 && dragging != null && dragging !== idx && (
|
{dropIndex === idx + 1 && dragging != null && dragging !== idx && (
|
||||||
|
|||||||
@@ -5,14 +5,16 @@ import OrderSummary from '../components/OrderSummary'
|
|||||||
import useConnectionStore from '../store/connectionStore'
|
import useConnectionStore from '../store/connectionStore'
|
||||||
import client from '../api/client'
|
import client from '../api/client'
|
||||||
import { apiError } from '../api/errors'
|
import { apiError } from '../api/errors'
|
||||||
|
import { money } from '../i18n'
|
||||||
import { getVenueSettings } from '../api/venueSettings'
|
import { getVenueSettings } from '../api/venueSettings'
|
||||||
import db from '../db/posdb'
|
import db from '../db/posdb'
|
||||||
import { queueOfflineSplit, queueOfflinePayment as queueOfflinePaymentOp } from '../services/offlineOrders'
|
import { queueOfflineSplit, queueOfflinePayment as queueOfflinePaymentOp } from '../services/offlineOrders'
|
||||||
import { TransferIcon, MergeIcon, FlagsIcon, WaiterIcon, PrintIcon } from '../components/Icons'
|
import { TransferIcon, MergeIcon, FlagsIcon, WaiterIcon, PrintIcon } from '../components/Icons'
|
||||||
import usePaymentSettingsStore from '../store/paymentSettingsStore'
|
import usePaymentSettingsStore from '../store/paymentSettingsStore'
|
||||||
import useTableViewStore from '../store/tableViewStore'
|
import useTableViewStore from '../store/tableViewStore'
|
||||||
|
import { useTranslation } from '@xenia/i18n'
|
||||||
|
|
||||||
function fmtPrice(v) { return Number(v).toFixed(2) + ' €' }
|
const fmtPrice = money
|
||||||
|
|
||||||
// ─── Merge mode ───────────────────────────────────────────────────────────────
|
// ─── Merge mode ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -20,12 +22,6 @@ const MERGE_OFF = 'off'
|
|||||||
const MERGE_IDENTICAL = 'identical' // same product + options + price
|
const MERGE_IDENTICAL = 'identical' // same product + options + price
|
||||||
const MERGE_SAME_ITEM = 'same_item' // same product + same effective unit price
|
const MERGE_SAME_ITEM = 'same_item' // same product + same effective unit price
|
||||||
|
|
||||||
const MERGE_LABELS = {
|
|
||||||
[MERGE_OFF]: 'ΔΙΑΧΩΡΙΣΜΟΣ',
|
|
||||||
[MERGE_IDENTICAL]: 'ΙΔΙΑ ITEMS',
|
|
||||||
[MERGE_SAME_ITEM]: 'ΙΔΙΑ ΤΙΜΗ',
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns a stable string key for grouping under MERGE_IDENTICAL
|
// Returns a stable string key for grouping under MERGE_IDENTICAL
|
||||||
function identicalKey(item) {
|
function identicalKey(item) {
|
||||||
const effPrice = ((item.unit_price ?? 0) + (item.price_adjustment ?? 0)).toFixed(4)
|
const effPrice = ((item.unit_price ?? 0) + (item.price_adjustment ?? 0)).toFixed(4)
|
||||||
@@ -73,6 +69,7 @@ function mergeItems(items, mode) {
|
|||||||
// ─── Split stepper modal ──────────────────────────────────────────────────────
|
// ─── Split stepper modal ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
function SplitModal({ item, onConfirm, onClose }) {
|
function SplitModal({ item, onConfirm, onClose }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const [splitQty, setSplitQty] = useState(1)
|
const [splitQty, setSplitQty] = useState(1)
|
||||||
const max = item.quantity - 1
|
const max = item.quantity - 1
|
||||||
|
|
||||||
@@ -80,12 +77,12 @@ function SplitModal({ item, onConfirm, onClose }) {
|
|||||||
<div className="modal-overlay" onClick={onClose}>
|
<div className="modal-overlay" onClick={onClose}>
|
||||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title">Διαχωρισμός</h2>
|
<h2 className="modal-title">{t('detail.split.title')}</h2>
|
||||||
<p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 14, marginBottom: 4 }}>
|
<p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 14, marginBottom: 4 }}>
|
||||||
{item.product?.name} ×{item.quantity}
|
{item.product?.name} ×{item.quantity}
|
||||||
</p>
|
</p>
|
||||||
<p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 13, marginBottom: 16 }}>
|
<p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 13, marginBottom: 16 }}>
|
||||||
Χώρισε σε πόσα;
|
{t('detail.split.howMany')}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="modal-qty" style={{ marginBottom: 8 }}>
|
<div className="modal-qty" style={{ marginBottom: 8 }}>
|
||||||
@@ -95,14 +92,14 @@ function SplitModal({ item, onConfirm, onClose }) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: 'flex', justifyContent: 'center', gap: 20, marginBottom: 20, fontSize: 13, color: '#94a3b8' }}>
|
<div style={{ display: 'flex', justifyContent: 'center', gap: 20, marginBottom: 20, fontSize: 13, color: '#94a3b8' }}>
|
||||||
<span>Νέα γραμμή: <strong style={{ color: '#f59e0b' }}>×{splitQty}</strong></span>
|
<span>{t('detail.split.newLine')} <strong style={{ color: '#f59e0b' }}>×{splitQty}</strong></span>
|
||||||
<span>Μένει: <strong style={{ color: '#64748b' }}>×{item.quantity - splitQty}</strong></span>
|
<span>{t('detail.split.remains')} <strong style={{ color: '#64748b' }}>×{item.quantity - splitQty}</strong></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: 'flex', gap: 12 }}>
|
<div style={{ display: 'flex', gap: 12 }}>
|
||||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>Άκυρο</button>
|
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||||
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => onConfirm(splitQty)}>
|
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => onConfirm(splitQty)}>
|
||||||
Διαχωρισμός
|
{t('detail.split.title')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -113,6 +110,7 @@ function SplitModal({ item, onConfirm, onClose }) {
|
|||||||
// ─── Price adjust modal ───────────────────────────────────────────────────────
|
// ─── Price adjust modal ───────────────────────────────────────────────────────
|
||||||
|
|
||||||
function PriceAdjustModal({ item, onConfirm, onClose }) {
|
function PriceAdjustModal({ item, onConfirm, onClose }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const basePrice = item.unit_price ?? 0
|
const basePrice = item.unit_price ?? 0
|
||||||
const [adj, setAdj] = useState(item.price_adjustment ?? 0)
|
const [adj, setAdj] = useState(item.price_adjustment ?? 0)
|
||||||
const [editing, setEditing] = useState(false)
|
const [editing, setEditing] = useState(false)
|
||||||
@@ -148,7 +146,7 @@ function PriceAdjustModal({ item, onConfirm, onClose }) {
|
|||||||
<div className="modal-overlay" onClick={onClose}>
|
<div className="modal-overlay" onClick={onClose}>
|
||||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title">Ρύθμιση Τιμής</h2>
|
<h2 className="modal-title">{t('detail.price.title')}</h2>
|
||||||
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 16px' }}>
|
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 16px' }}>
|
||||||
{item.product?.name}
|
{item.product?.name}
|
||||||
</p>
|
</p>
|
||||||
@@ -180,15 +178,15 @@ function PriceAdjustModal({ item, onConfirm, onClose }) {
|
|||||||
borderRadius: 12, padding: '6px 20px', cursor: 'pointer',
|
borderRadius: 12, padding: '6px 20px', cursor: 'pointer',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{effective.toFixed(2)} €
|
{fmtPrice(effective)}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{adj !== 0 && (
|
{adj !== 0 && (
|
||||||
<div style={{ fontSize: 12, color: adj > 0 ? '#22c55e' : '#f87171', marginTop: 4 }}>
|
<div style={{ fontSize: 12, color: adj > 0 ? '#22c55e' : '#f87171', marginTop: 4 }}>
|
||||||
Βασική: {basePrice.toFixed(2)} € {adj > 0 ? '+' : ''}{adj.toFixed(2)} €
|
{t('detail.price.base', { base: fmtPrice(basePrice), change: `${adj > 0 ? '+' : ''}${fmtPrice(adj)}` })}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div style={{ fontSize: 11, color: 'var(--muted)', marginTop: 2 }}>Πάτα για πληκτρολόγιο</div>
|
<div style={{ fontSize: 11, color: 'var(--muted)', marginTop: 2 }}>{t('detail.price.tapToType')}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* +/- stepper (0.1 step) */}
|
{/* +/- stepper (0.1 step) */}
|
||||||
@@ -226,14 +224,14 @@ function PriceAdjustModal({ item, onConfirm, onClose }) {
|
|||||||
color: 'var(--muted)', fontSize: 13, cursor: 'pointer',
|
color: 'var(--muted)', fontSize: 13, cursor: 'pointer',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Επαναφορά αρχικής τιμής
|
{t('detail.price.reset')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div style={{ display: 'flex', gap: 10 }}>
|
<div style={{ display: 'flex', gap: 10 }}>
|
||||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>Άκυρο</button>
|
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||||
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => onConfirm(adj)}>
|
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => onConfirm(adj)}>
|
||||||
Εφαρμογή
|
{t('common.apply')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -244,9 +242,10 @@ function PriceAdjustModal({ item, onConfirm, onClose }) {
|
|||||||
// ─── Item action modal (long-press) ──────────────────────────────────────────
|
// ─── Item action modal (long-press) ──────────────────────────────────────────
|
||||||
|
|
||||||
function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCancel, canCancel, cancelNeedsApproval, priceAdjAllowed, priceNeedsApproval, canMove, onAdjustPrice, onClose }) {
|
function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCancel, canCancel, cancelNeedsApproval, priceAdjAllowed, priceNeedsApproval, canMove, onAdjustPrice, onClose }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const { items, singleStacked, multiSelect } = target
|
const { items, singleStacked, multiSelect } = target
|
||||||
const label = multiSelect
|
const label = multiSelect
|
||||||
? `${items.length} αντικείμενα επιλεγμένα`
|
? t('detail.selected', { count: items.length })
|
||||||
: items[0]?.product?.name || `#${items[0]?.product_id}`
|
: items[0]?.product?.name || `#${items[0]?.product_id}`
|
||||||
|
|
||||||
const actionRows = [
|
const actionRows = [
|
||||||
@@ -254,8 +253,8 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
|||||||
key: 'adjust_price',
|
key: 'adjust_price',
|
||||||
color: '#f59e0b',
|
color: '#f59e0b',
|
||||||
iconBg: 'rgba(245,158,11,0.15)',
|
iconBg: 'rgba(245,158,11,0.15)',
|
||||||
label: 'Ρύθμιση τιμής',
|
label: t('detail.item.price'),
|
||||||
sub: priceNeedsApproval ? 'Με έγκριση διαχειριστή (PIN)' : 'Αλλαγή τιμής για αυτό το αντικείμενο',
|
sub: priceNeedsApproval ? t('detail.withApproval') : t('detail.item.priceSub'),
|
||||||
icon: (
|
icon: (
|
||||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||||
<circle cx="12" cy="12" r="9" stroke="#f59e0b" strokeWidth="2"/>
|
<circle cx="12" cy="12" r="9" stroke="#f59e0b" strokeWidth="2"/>
|
||||||
@@ -269,8 +268,8 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
|||||||
key: 'order_again',
|
key: 'order_again',
|
||||||
color: '#22c55e',
|
color: '#22c55e',
|
||||||
iconBg: 'rgba(34,197,94,0.15)',
|
iconBg: 'rgba(34,197,94,0.15)',
|
||||||
label: 'Παραγγελία ξανά',
|
label: t('detail.item.again'),
|
||||||
sub: 'Προσθήκη στο νέο καλάθι',
|
sub: t('detail.item.againSub'),
|
||||||
icon: (
|
icon: (
|
||||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||||
<path d="M1 4v6h6M23 20v-6h-6" stroke="#22c55e" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
<path d="M1 4v6h6M23 20v-6h-6" stroke="#22c55e" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||||
@@ -284,8 +283,8 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
|||||||
key: 'move',
|
key: 'move',
|
||||||
color: '#f97316',
|
color: '#f97316',
|
||||||
iconBg: 'rgba(249,115,22,0.15)',
|
iconBg: 'rgba(249,115,22,0.15)',
|
||||||
label: 'Μεταφορά σε άλλο τραπέζι',
|
label: t('detail.item.move'),
|
||||||
sub: 'Μεταφορά επιλεγμένων αντικειμένων',
|
sub: t('detail.item.moveSub'),
|
||||||
icon: (
|
icon: (
|
||||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||||
<path d="M5 12h14M12 5l7 7-7 7" stroke="#f97316" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
<path d="M5 12h14M12 5l7 7-7 7" stroke="#f97316" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||||
@@ -298,8 +297,8 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
|||||||
key: 'split',
|
key: 'split',
|
||||||
color: '#60a5fa',
|
color: '#60a5fa',
|
||||||
iconBg: 'rgba(96,165,250,0.15)',
|
iconBg: 'rgba(96,165,250,0.15)',
|
||||||
label: 'Διαχωρισμός',
|
label: t('detail.split.title'),
|
||||||
sub: 'Χώρισμα σε δύο γραμμές',
|
sub: t('detail.item.splitSub'),
|
||||||
icon: (
|
icon: (
|
||||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||||
<path d="M16 3h5v5M4 20L21 3M21 16v5h-5M15 15l6 6M4 4l5 5" stroke="#60a5fa" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
<path d="M16 3h5v5M4 20L21 3M21 16v5h-5M15 15l6 6M4 4l5 5" stroke="#60a5fa" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||||
@@ -312,8 +311,8 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
|||||||
key: 'cancel',
|
key: 'cancel',
|
||||||
color: canCancel ? '#ef4444' : '#6b7280',
|
color: canCancel ? '#ef4444' : '#6b7280',
|
||||||
iconBg: canCancel ? 'rgba(239,68,68,0.15)' : 'rgba(107,114,128,0.1)',
|
iconBg: canCancel ? 'rgba(239,68,68,0.15)' : 'rgba(107,114,128,0.1)',
|
||||||
label: 'Ακύρωση παραγγελίας',
|
label: t('detail.item.cancel'),
|
||||||
sub: !canCancel ? 'Δεν επιτρέπεται η ακύρωση' : cancelNeedsApproval ? 'Με έγκριση διαχειριστή (PIN)' : 'Ακύρωση επιλεγμένων αντικειμένων',
|
sub: !canCancel ? t('detail.cancelNotAllowed') : cancelNeedsApproval ? t('detail.withApproval') : t('detail.item.cancelSub'),
|
||||||
icon: (
|
icon: (
|
||||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||||
<circle cx="12" cy="12" r="10" stroke={canCancel ? '#ef4444' : '#6b7280'} strokeWidth="2"/>
|
<circle cx="12" cy="12" r="10" stroke={canCancel ? '#ef4444' : '#6b7280'} strokeWidth="2"/>
|
||||||
@@ -358,7 +357,7 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
|||||||
))}
|
))}
|
||||||
|
|
||||||
<button className="btn btn--secondary" style={{ width: '100%', marginTop: 12 }} onClick={onClose}>
|
<button className="btn btn--secondary" style={{ width: '100%', marginTop: 12 }} onClick={onClose}>
|
||||||
Άκυρο
|
{t('common.cancel')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -368,6 +367,7 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
|||||||
// ─── Apply Discount modal ─────────────────────────────────────────────────────
|
// ─── Apply Discount modal ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const activeItems = (order?.items ?? []).filter(i => i.status === 'active')
|
const activeItems = (order?.items ?? []).filter(i => i.status === 'active')
|
||||||
const [selectedIds, setSelectedIds] = useState(activeItems.map(i => i.id))
|
const [selectedIds, setSelectedIds] = useState(activeItems.map(i => i.id))
|
||||||
const [pct, setPct] = useState(10)
|
const [pct, setPct] = useState(10)
|
||||||
@@ -392,8 +392,8 @@ function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
|||||||
const roundedPct = Math.round(pct * 10) / 10
|
const roundedPct = Math.round(pct * 10) / 10
|
||||||
|
|
||||||
async function apply() {
|
async function apply() {
|
||||||
if (selectedIds.length === 0) { setError('Επιλέξτε τουλάχιστον ένα αντικείμενο'); return }
|
if (selectedIds.length === 0) { setError(t('detail.discount.pickOne')); return }
|
||||||
if (roundedPct <= 0 || roundedPct > 100) { setError('Μη έγκυρο ποσοστό'); return }
|
if (roundedPct <= 0 || roundedPct > 100) { setError(t('detail.discount.badPct')); return }
|
||||||
setApplying(true); setError('')
|
setApplying(true); setError('')
|
||||||
try {
|
try {
|
||||||
const res = await client.post(`/api/orders/${order.id}/items/discount`, {
|
const res = await client.post(`/api/orders/${order.id}/items/discount`, {
|
||||||
@@ -408,7 +408,7 @@ function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
|||||||
onApplied()
|
onApplied()
|
||||||
onClose()
|
onClose()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setError(apiError(e, 'Σφάλμα εφαρμογής έκπτωσης'))
|
setError(apiError(e, t('detail.discount.failed')))
|
||||||
} finally {
|
} finally {
|
||||||
setApplying(false)
|
setApplying(false)
|
||||||
}
|
}
|
||||||
@@ -418,14 +418,14 @@ function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
|||||||
<div className="modal-overlay" onClick={onClose}>
|
<div className="modal-overlay" onClick={onClose}>
|
||||||
<div className="modal-sheet" onClick={e => e.stopPropagation()} style={{ gap: 0 }}>
|
<div className="modal-sheet" onClick={e => e.stopPropagation()} style={{ gap: 0 }}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title" style={{ marginBottom: 4 }}>Εφαρμογή Έκπτωσης</h2>
|
<h2 className="modal-title" style={{ marginBottom: 4 }}>{t('detail.actions.discount')}</h2>
|
||||||
<p style={{ textAlign: 'center', fontSize: 12, color: 'var(--muted)', marginBottom: 16 }}>
|
<p style={{ textAlign: 'center', fontSize: 12, color: 'var(--muted)', marginBottom: 16 }}>
|
||||||
Η τελική τιμή στρογγυλοποιείται στο 0.10 €
|
{t('detail.discount.rounding')}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{/* Item multi-select */}
|
{/* Item multi-select */}
|
||||||
<div style={{ marginBottom: 14 }}>
|
<div style={{ marginBottom: 14 }}>
|
||||||
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 8 }}>Αντικείμενα</p>
|
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 8 }}>{t('detail.discount.items')}</p>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, maxHeight: 180, overflowY: 'auto' }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, maxHeight: 180, overflowY: 'auto' }}>
|
||||||
{activeItems.map(item => {
|
{activeItems.map(item => {
|
||||||
const eff = (item.unit_price ?? 0) + (item.price_adjustment ?? 0)
|
const eff = (item.unit_price ?? 0) + (item.price_adjustment ?? 0)
|
||||||
@@ -450,11 +450,11 @@ function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
|||||||
<div style={{ fontSize: 13, fontWeight: 600, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
<div style={{ fontSize: 13, fontWeight: 600, color: 'var(--text)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
||||||
{item.product?.name ?? `#${item.product_id}`}
|
{item.product?.name ?? `#${item.product_id}`}
|
||||||
</div>
|
</div>
|
||||||
<div style={{ fontSize: 11, color: 'var(--muted)' }}>×{item.quantity} · {eff.toFixed(2)} €</div>
|
<div style={{ fontSize: 11, color: 'var(--muted)' }}>×{item.quantity} · {fmtPrice(eff)}</div>
|
||||||
</div>
|
</div>
|
||||||
{checked && (
|
{checked && (
|
||||||
<div style={{ fontSize: 12, fontWeight: 700, color: '#4ade80', shrink: 0 }}>
|
<div style={{ fontSize: 12, fontWeight: 700, color: '#4ade80', shrink: 0 }}>
|
||||||
→ {newPrice.toFixed(2)} €
|
→ {fmtPrice(newPrice)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
@@ -465,7 +465,7 @@ function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
|||||||
|
|
||||||
{/* Percent picker */}
|
{/* Percent picker */}
|
||||||
<div style={{ marginBottom: 14 }}>
|
<div style={{ marginBottom: 14 }}>
|
||||||
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 8 }}>Ποσοστό έκπτωσης</p>
|
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 8 }}>{t('detail.discount.pct')}</p>
|
||||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 6, marginBottom: 10 }}>
|
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 6, marginBottom: 10 }}>
|
||||||
{PCT_PRESETS.map(p => (
|
{PCT_PRESETS.map(p => (
|
||||||
<button key={p} onClick={() => setPct(p)}
|
<button key={p} onClick={() => setPct(p)}
|
||||||
@@ -488,16 +488,16 @@ function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
|||||||
}} />
|
}} />
|
||||||
<span style={{ fontSize: 14, color: 'var(--muted)' }}>%</span>
|
<span style={{ fontSize: 14, color: 'var(--muted)' }}>%</span>
|
||||||
<span style={{ fontSize: 13, color: '#4ade80', fontWeight: 700 }}>
|
<span style={{ fontSize: 13, color: '#4ade80', fontWeight: 700 }}>
|
||||||
−{discountTotal.toFixed(2)} €
|
−{fmtPrice(discountTotal)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Note */}
|
{/* Note */}
|
||||||
<div style={{ marginBottom: 14 }}>
|
<div style={{ marginBottom: 14 }}>
|
||||||
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 6 }}>Σημείωση (προαιρετικό)</p>
|
<p style={{ fontSize: 12, color: 'var(--muted)', marginBottom: 6 }}>{t('detail.discount.note')}</p>
|
||||||
<input value={note} onChange={e => setNote(e.target.value)}
|
<input value={note} onChange={e => setNote(e.target.value)}
|
||||||
placeholder="π.χ. VIP πελάτης"
|
placeholder={t('detail.discount.notePlaceholder')}
|
||||||
style={{
|
style={{
|
||||||
width: '100%', padding: '9px 12px', borderRadius: 10,
|
width: '100%', padding: '9px 12px', borderRadius: 10,
|
||||||
border: '1.5px solid var(--border)', background: 'var(--bg3)',
|
border: '1.5px solid var(--border)', background: 'var(--bg3)',
|
||||||
@@ -510,9 +510,9 @@ function ApplyDiscountModal({ order, _waiterId, onClose, onApplied }) {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<div style={{ display: 'flex', gap: 10 }}>
|
<div style={{ display: 'flex', gap: 10 }}>
|
||||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>Άκυρο</button>
|
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||||
<button className="btn btn--primary" style={{ flex: 1 }} onClick={apply} disabled={applying}>
|
<button className="btn btn--primary" style={{ flex: 1 }} onClick={apply} disabled={applying}>
|
||||||
{applying ? 'Εφαρμογή…' : 'Εφαρμογή'}
|
{applying ? t('detail.discount.applying') : t('common.apply')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -549,20 +549,21 @@ function DiscountIcon({ width = 20, height = 20 }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ActionsSheet({ order, _tableId, isStandalone, onClose, onTransfer, onMerge, onSetFlags, onAssignWaiter, onPrintSynopsis, onCancelOrder, onMarkAllServed, canCancel, cancelNeedsApproval, canDiscount, canMove, onApplyDiscount }) {
|
function ActionsSheet({ order, _tableId, isStandalone, onClose, onTransfer, onMerge, onSetFlags, onAssignWaiter, onPrintSynopsis, onCancelOrder, onMarkAllServed, canCancel, cancelNeedsApproval, canDiscount, canMove, onApplyDiscount }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const hasOrder = !!order
|
const hasOrder = !!order
|
||||||
const hasServable = hasOrder && order.items?.some(i => i.kds_status === 'done')
|
const hasServable = hasOrder && order.items?.some(i => i.kds_status === 'done')
|
||||||
const hasActiveItems = hasOrder && order.items?.some(i => i.status === 'active')
|
const hasActiveItems = hasOrder && order.items?.some(i => i.status === 'active')
|
||||||
const allActions = [
|
const allActions = [
|
||||||
{ Icon: CheckIcon, label: 'Σήμανση Όλων ως Παραδοθέντα', sub: 'Σήμανση όλων των έτοιμων ειδών ως παραδοθέντα',
|
{ Icon: CheckIcon, label: t('tables.quick.markAllServed'), sub: t('detail.actions.markAllServedSub'),
|
||||||
onClick: hasServable ? onMarkAllServed : null, color: hasServable ? '#4ade80' : '#6b7280', iconBg: hasServable ? 'rgba(34,197,94,0.15)' : 'rgba(107,114,128,0.1)' },
|
onClick: hasServable ? onMarkAllServed : null, color: hasServable ? '#4ade80' : '#6b7280', iconBg: hasServable ? 'rgba(34,197,94,0.15)' : 'rgba(107,114,128,0.1)' },
|
||||||
{ Icon: DiscountIcon, label: 'Εφαρμογή Έκπτωσης', sub: canDiscount ? 'Έκπτωση σε αντικείμενα παραγγελίας' : 'Δεν επιτρέπεται η εφαρμογή έκπτωσης',
|
{ Icon: DiscountIcon, label: t('detail.actions.discount'), sub: canDiscount ? t('detail.actions.discountSub') : t('detail.actions.discountNotAllowed'),
|
||||||
onClick: (hasActiveItems && canDiscount) ? onApplyDiscount : null, color: (hasActiveItems && canDiscount) ? '#a78bfa' : '#6b7280', iconBg: (hasActiveItems && canDiscount) ? 'rgba(167,139,250,0.15)' : 'rgba(107,114,128,0.1)' },
|
onClick: (hasActiveItems && canDiscount) ? onApplyDiscount : null, color: (hasActiveItems && canDiscount) ? '#a78bfa' : '#6b7280', iconBg: (hasActiveItems && canDiscount) ? 'rgba(167,139,250,0.15)' : 'rgba(107,114,128,0.1)' },
|
||||||
{ Icon: TransferIcon, label: 'Μεταφορά Τραπεζιού', sub: 'Μεταφορά σε άλλο τραπέζι', onClick: hasOrder ? onTransfer : null, color: '#6099db', iconBg: 'rgba(96,165,250,0.15)', tableOnly: true, needsMove: true },
|
{ Icon: TransferIcon, label: t('detail.actions.transfer'), sub: t('detail.item.move'), onClick: hasOrder ? onTransfer : null, color: '#6099db', iconBg: 'rgba(96,165,250,0.15)', tableOnly: true, needsMove: true },
|
||||||
{ Icon: MergeIcon, label: 'Συγχώνευση Τραπεζιού', sub: 'Συγχώνευση με άλλο τραπέζι', onClick: hasOrder ? onMerge : null, color: '#6099db', iconBg: 'rgba(96,165,250,0.15)', tableOnly: true, needsMove: true },
|
{ Icon: MergeIcon, label: t('detail.actions.merge'), sub: t('detail.actions.mergeSub'), onClick: hasOrder ? onMerge : null, color: '#6099db', iconBg: 'rgba(96,165,250,0.15)', tableOnly: true, needsMove: true },
|
||||||
{ Icon: FlagsIcon, label: 'Ενδείξεις Τραπεζιού', sub: 'Επιλογή σημαιών', onClick: onSetFlags, color: '#fac823', iconBg: 'rgba(251,191,36,0.15)', tableOnly: true },
|
{ Icon: FlagsIcon, label: t('tables.actions.flags'), sub: t('detail.actions.flagsSub'), onClick: onSetFlags, color: '#fac823', iconBg: 'rgba(251,191,36,0.15)', tableOnly: true },
|
||||||
{ Icon: WaiterIcon, label: 'Ανάθεση Σερβιτόρου', sub: 'Προσθήκη σερβιτόρου στην παραγγελία', onClick: hasOrder ? onAssignWaiter : null, color: '#39b861', iconBg: 'rgba(34,197,94,0.15)' },
|
{ Icon: WaiterIcon, label: t('tables.actions.assignWaiter'), sub: t('detail.actions.assignSub'), onClick: hasOrder ? onAssignWaiter : null, color: '#39b861', iconBg: 'rgba(34,197,94,0.15)' },
|
||||||
{ Icon: PrintIcon, label: 'Εκτύπωση Σύνοψης', sub: 'Εκτύπωση σύνοψης παραγγελίας', onClick: hasOrder ? onPrintSynopsis : null, color: '#cbd5e1', iconBg: 'rgba(148,163,184,0.15)' },
|
{ Icon: PrintIcon, label: t('tables.actions.printSynopsis'), sub: t('detail.actions.printSub'), onClick: hasOrder ? onPrintSynopsis : null, color: '#cbd5e1', iconBg: 'rgba(148,163,184,0.15)' },
|
||||||
{ Icon: CancelIcon, label: 'Ακύρωση Παραγγελίας', sub: !canCancel ? 'Δεν επιτρέπεται η ακύρωση' : cancelNeedsApproval ? 'Με έγκριση διαχειριστή (PIN)' : 'Ακύρωση ολόκληρης παραγγελίας',
|
{ Icon: CancelIcon, label: t('tables.quick.cancelOrder'), sub: !canCancel ? t('detail.cancelNotAllowed') : cancelNeedsApproval ? t('detail.withApproval') : t('detail.actions.cancelSub'),
|
||||||
onClick: (hasOrder && canCancel) ? onCancelOrder : null, color: (hasOrder && canCancel) ? '#ef4444' : '#6b7280', iconBg: (hasOrder && canCancel) ? 'rgba(239,68,68,0.15)' : 'rgba(107,114,128,0.1)' },
|
onClick: (hasOrder && canCancel) ? onCancelOrder : null, color: (hasOrder && canCancel) ? '#ef4444' : '#6b7280', iconBg: (hasOrder && canCancel) ? 'rgba(239,68,68,0.15)' : 'rgba(107,114,128,0.1)' },
|
||||||
]
|
]
|
||||||
// plan 4.3: discounts show only with pricing.discounts.apply, transfer/merge with ordering.orders.open
|
// plan 4.3: discounts show only with pricing.discounts.apply, transfer/merge with ordering.orders.open
|
||||||
@@ -612,6 +613,7 @@ function ActionsSheet({ order, _tableId, isStandalone, onClose, onTransfer, onMe
|
|||||||
// ─── Table picker (for transfer / merge / move-items) ─────────────────────────
|
// ─── Table picker (for transfer / merge / move-items) ─────────────────────────
|
||||||
|
|
||||||
function TablePicker({ title, subtitle, tables, _currentTableId, onSelect, onClose, loading }) {
|
function TablePicker({ title, subtitle, tables, _currentTableId, onSelect, onClose, loading }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
return (
|
return (
|
||||||
<div className="modal-overlay modal-overlay--top" onClick={onClose}>
|
<div className="modal-overlay modal-overlay--top" onClick={onClose}>
|
||||||
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
||||||
@@ -620,15 +622,15 @@ function TablePicker({ title, subtitle, tables, _currentTableId, onSelect, onClo
|
|||||||
{subtitle && <p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 13, marginBottom: 4 }}>{subtitle}</p>}
|
{subtitle && <p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 13, marginBottom: 4 }}>{subtitle}</p>}
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 0, maxHeight: '60svh', overflowY: 'auto' }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 0, maxHeight: '60svh', overflowY: 'auto' }}>
|
||||||
{loading && (
|
{loading && (
|
||||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 24 }}>Φόρτωση…</p>
|
<p style={{ textAlign: 'center', color: '#64748b', padding: 24 }}>{t('common.loading')}</p>
|
||||||
)}
|
)}
|
||||||
{!loading && tables.length === 0 && (
|
{!loading && tables.length === 0 && (
|
||||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 24 }}>Δεν υπάρχουν διαθέσιμα τραπέζια</p>
|
<p style={{ textAlign: 'center', color: '#64748b', padding: 24 }}>{t('detail.noTables')}</p>
|
||||||
)}
|
)}
|
||||||
{!loading && tables.map(t => (
|
{!loading && tables.map(tb => (
|
||||||
<button
|
<button
|
||||||
key={t.id}
|
key={tb.id}
|
||||||
onClick={() => onSelect(t)}
|
onClick={() => onSelect(tb)}
|
||||||
style={{
|
style={{
|
||||||
width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'space-between',
|
width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'space-between',
|
||||||
padding: '14px 4px', background: 'none', border: 'none',
|
padding: '14px 4px', background: 'none', border: 'none',
|
||||||
@@ -637,11 +639,11 @@ function TablePicker({ title, subtitle, tables, _currentTableId, onSelect, onClo
|
|||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<div style={{ fontSize: 15, fontWeight: 600, color: 'var(--text)' }}>
|
<div style={{ fontSize: 15, fontWeight: 600, color: 'var(--text)' }}>
|
||||||
{t.label || `T${t.number}`}
|
{tb.label || `T${tb.number}`}
|
||||||
</div>
|
</div>
|
||||||
{t.orderStatus && (
|
{tb.orderStatus && (
|
||||||
<div style={{ fontSize: 12, color: '#f59e0b', marginTop: 2 }}>
|
<div style={{ fontSize: 12, color: '#f59e0b', marginTop: 2 }}>
|
||||||
{t.orderStatus === 'open' ? 'Ανοιχτό' : t.orderStatus === 'partially_paid' ? 'Μερικώς πληρωμένο' : t.orderStatus}
|
{tb.orderStatus === 'open' ? t('tables.status.open') : tb.orderStatus === 'partially_paid' ? t('tables.status.partlyPaid') : tb.orderStatus}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -649,7 +651,7 @@ function TablePicker({ title, subtitle, tables, _currentTableId, onSelect, onClo
|
|||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<button className="btn btn--secondary" style={{ width: '100%', marginTop: 8 }} onClick={onClose}>Άκυρο</button>
|
<button className="btn btn--secondary" style={{ width: '100%', marginTop: 8 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -658,6 +660,7 @@ function TablePicker({ title, subtitle, tables, _currentTableId, onSelect, onClo
|
|||||||
// ─── Flag picker ──────────────────────────────────────────────────────────────
|
// ─── Flag picker ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
function FlagPicker({ _tableId, currentFlagIds, flagDefs, onSave, onClose, loading }) {
|
function FlagPicker({ _tableId, currentFlagIds, flagDefs, onSave, onClose, loading }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const [selected, setSelected] = useState(currentFlagIds || [])
|
const [selected, setSelected] = useState(currentFlagIds || [])
|
||||||
|
|
||||||
// Sync selected when currentFlagIds loads
|
// Sync selected when currentFlagIds loads
|
||||||
@@ -671,13 +674,13 @@ function FlagPicker({ _tableId, currentFlagIds, flagDefs, onSave, onClose, loadi
|
|||||||
<div className="modal-overlay modal-overlay--top" onClick={onClose}>
|
<div className="modal-overlay modal-overlay--top" onClick={onClose}>
|
||||||
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title">Ενδείξεις Τραπεζιού</h2>
|
<h2 className="modal-title">{t('tables.actions.flags')}</h2>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 0, marginBottom: 20 }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 0, marginBottom: 20 }}>
|
||||||
{loading && (
|
{loading && (
|
||||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>Φόρτωση…</p>
|
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>{t('common.loading')}</p>
|
||||||
)}
|
)}
|
||||||
{!loading && flagDefs.length === 0 && (
|
{!loading && flagDefs.length === 0 && (
|
||||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>Δεν υπάρχουν σημαίες</p>
|
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>{t('detail.noFlags')}</p>
|
||||||
)}
|
)}
|
||||||
{!loading && flagDefs.map(f => {
|
{!loading && flagDefs.map(f => {
|
||||||
const sel = selected.includes(f.id)
|
const sel = selected.includes(f.id)
|
||||||
@@ -710,8 +713,8 @@ function FlagPicker({ _tableId, currentFlagIds, flagDefs, onSave, onClose, loadi
|
|||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'flex', gap: 12 }}>
|
<div style={{ display: 'flex', gap: 12 }}>
|
||||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>Άκυρο</button>
|
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||||
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => onSave(selected)}>Αποθήκευση</button>
|
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => onSave(selected)}>{t('common.save')}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -721,6 +724,7 @@ function FlagPicker({ _tableId, currentFlagIds, flagDefs, onSave, onClose, loadi
|
|||||||
// ─── Assign waiter picker ─────────────────────────────────────────────────────
|
// ─── Assign waiter picker ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
function AssignWaiterPicker({ orderId, currentWaiterIds, waiters, onAssigned, onClose, loading }) {
|
function AssignWaiterPicker({ orderId, currentWaiterIds, waiters, onAssigned, onClose, loading }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const [saving, setSaving] = useState(false)
|
const [saving, setSaving] = useState(false)
|
||||||
|
|
||||||
async function assign(waiterId) {
|
async function assign(waiterId) {
|
||||||
@@ -743,13 +747,13 @@ function AssignWaiterPicker({ orderId, currentWaiterIds, waiters, onAssigned, on
|
|||||||
<div className="modal-overlay modal-overlay--top" onClick={onClose}>
|
<div className="modal-overlay modal-overlay--top" onClick={onClose}>
|
||||||
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title">Ανάθεση Σερβιτόρου</h2>
|
<h2 className="modal-title">{t('tables.actions.assignWaiter')}</h2>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 0, marginBottom: 16, maxHeight: '60svh', overflowY: 'auto' }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 0, marginBottom: 16, maxHeight: '60svh', overflowY: 'auto' }}>
|
||||||
{loading && (
|
{loading && (
|
||||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>Φόρτωση…</p>
|
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>{t('common.loading')}</p>
|
||||||
)}
|
)}
|
||||||
{!loading && available.length === 0 && (
|
{!loading && available.length === 0 && (
|
||||||
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>Όλοι οι σερβιτόροι έχουν ήδη ανατεθεί</p>
|
<p style={{ textAlign: 'center', color: '#64748b', padding: 16 }}>{t('detail.allAssigned')}</p>
|
||||||
)}
|
)}
|
||||||
{!loading && available.map(w => (
|
{!loading && available.map(w => (
|
||||||
<button
|
<button
|
||||||
@@ -774,7 +778,7 @@ function AssignWaiterPicker({ orderId, currentWaiterIds, waiters, onAssigned, on
|
|||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<button className="btn btn--secondary" style={{ width: '100%' }} onClick={onClose}>Άκυρο</button>
|
<button className="btn btn--secondary" style={{ width: '100%' }} onClick={onClose}>{t('common.cancel')}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -783,6 +787,7 @@ function AssignWaiterPicker({ orderId, currentWaiterIds, waiters, onAssigned, on
|
|||||||
// ─── Print synopsis picker ────────────────────────────────────────────────────
|
// ─── Print synopsis picker ────────────────────────────────────────────────────
|
||||||
|
|
||||||
function PrintSynopsisPicker({ orderId, onClose }) {
|
function PrintSynopsisPicker({ orderId, onClose }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const [printers, setPrinters] = useState([])
|
const [printers, setPrinters] = useState([])
|
||||||
const [printing, setPrinting] = useState(false)
|
const [printing, setPrinting] = useState(false)
|
||||||
|
|
||||||
@@ -806,8 +811,8 @@ function PrintSynopsisPicker({ orderId, onClose }) {
|
|||||||
<div className="modal-overlay modal-overlay--top" onClick={onClose}>
|
<div className="modal-overlay modal-overlay--top" onClick={onClose}>
|
||||||
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title">Εκτύπωση Σύνοψης</h2>
|
<h2 className="modal-title">{t('tables.actions.printSynopsis')}</h2>
|
||||||
<p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 13, marginBottom: 8 }}>Επιλέξτε εκτυπωτή</p>
|
<p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 13, marginBottom: 8 }}>{t('detail.pickPrinter')}</p>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 0, marginBottom: 16 }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 0, marginBottom: 16 }}>
|
||||||
{printers.filter(p => p.reachable).map(p => (
|
{printers.filter(p => p.reachable).map(p => (
|
||||||
<button
|
<button
|
||||||
@@ -833,7 +838,7 @@ function PrintSynopsisPicker({ orderId, onClose }) {
|
|||||||
</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.cancel')}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -842,25 +847,26 @@ function PrintSynopsisPicker({ orderId, onClose }) {
|
|||||||
// ─── Pay confirm modal ────────────────────────────────────────────────────────
|
// ─── Pay confirm modal ────────────────────────────────────────────────────────
|
||||||
|
|
||||||
function CancelConfirmModal({ itemCount, onConfirm, onClose }) {
|
function CancelConfirmModal({ itemCount, onConfirm, onClose }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
return (
|
return (
|
||||||
<div className="modal-overlay" onClick={onClose}>
|
<div className="modal-overlay" onClick={onClose}>
|
||||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title">Ακύρωση παραγγελίας;</h2>
|
<h2 className="modal-title">{t('detail.cancel.title')}</h2>
|
||||||
<p style={{ color: '#94a3b8', textAlign: 'center', marginBottom: 24, fontSize: 14 }}>
|
<p style={{ color: '#94a3b8', textAlign: 'center', marginBottom: 24, fontSize: 14 }}>
|
||||||
{itemCount === null
|
{itemCount === null
|
||||||
? 'Ολόκληρη η παραγγελία θα ακυρωθεί οριστικά.'
|
? t('detail.cancel.whole')
|
||||||
: `${itemCount} αντικείμενο${itemCount !== 1 ? 'α' : ''} θα ακυρωθ${itemCount !== 1 ? 'ούν' : 'εί'} οριστικά.`}
|
: t('detail.cancel.items', { count: itemCount })}
|
||||||
</p>
|
</p>
|
||||||
<div style={{ display: 'flex', gap: 12 }}>
|
<div style={{ display: 'flex', gap: 12 }}>
|
||||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>Άκυρο</button>
|
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||||
<button
|
<button
|
||||||
onClick={onConfirm}
|
onClick={onConfirm}
|
||||||
style={{
|
style={{
|
||||||
flex: 1, height: 48, borderRadius: 12, border: 'none',
|
flex: 1, height: 48, borderRadius: 12, border: 'none',
|
||||||
background: '#dc2626', color: 'white', fontSize: 15, fontWeight: 700, cursor: 'pointer',
|
background: '#dc2626', color: 'white', fontSize: 15, fontWeight: 700, cursor: 'pointer',
|
||||||
}}
|
}}
|
||||||
>Ακύρωση ✕</button>
|
>{t('detail.cancel.button')}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -868,6 +874,7 @@ function CancelConfirmModal({ itemCount, onConfirm, onClose }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, onConfirm, onClose }) {
|
function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, onConfirm, onClose }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const { paymentSafety } = usePaymentSettingsStore()
|
const { paymentSafety } = usePaymentSettingsStore()
|
||||||
const [method, setMethod] = useState('cash')
|
const [method, setMethod] = useState('cash')
|
||||||
const [secondConfirmOpen, setSecondConfirmOpen] = useState(false)
|
const [secondConfirmOpen, setSecondConfirmOpen] = useState(false)
|
||||||
@@ -878,10 +885,10 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
|||||||
.filter(i => payIds.includes(i.id))
|
.filter(i => payIds.includes(i.id))
|
||||||
.reduce((s, i) => s + ((i.unit_price ?? 0) + (i.price_adjustment ?? 0)) * i.quantity, 0)
|
.reduce((s, i) => s + ((i.unit_price ?? 0) + (i.price_adjustment ?? 0)) * i.quantity, 0)
|
||||||
|
|
||||||
const title = andClose ? 'Επιβεβαίωση Πληρωμής και Κλείσιμο' : 'Επιβεβαίωση πληρωμής'
|
const title = andClose ? t('detail.pay.titleClose') : t('detail.pay.title')
|
||||||
const subtitle = andClose
|
const subtitle = andClose
|
||||||
? 'Όλα τα αντικείμενα — το τραπέζι θα κλείσει αμέσως μετά'
|
? t('detail.pay.allAndClose')
|
||||||
: payAll ? 'Όλα τα αντικείμενα' : `${payIds.length} αντικείμενο${payIds.length !== 1 ? 'α' : ''}`
|
: payAll ? t('detail.pay.all') : t('detail.pay.items', { count: payIds.length })
|
||||||
|
|
||||||
function handleConfirmClick() {
|
function handleConfirmClick() {
|
||||||
if (paymentSafety === 'second_confirm') {
|
if (paymentSafety === 'second_confirm') {
|
||||||
@@ -929,7 +936,7 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
|||||||
cursor: 'pointer', transition: 'all 0.12s',
|
cursor: 'pointer', transition: 'all 0.12s',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{m === 'cash' ? '💵 Μετρητά' : '💳 Κάρτα'}
|
{m === 'cash' ? `💵 ${t('detail.pay.cash')}` : `💳 ${t('detail.pay.card')}`}
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -937,7 +944,7 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
|||||||
|
|
||||||
<div style={{ display: 'flex', gap: 12 }}>
|
<div style={{ display: 'flex', gap: 12 }}>
|
||||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>
|
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>
|
||||||
Άκυρο
|
{t('common.cancel')}
|
||||||
</button>
|
</button>
|
||||||
{paymentSafety === 'long_press' ? (
|
{paymentSafety === 'long_press' ? (
|
||||||
<button
|
<button
|
||||||
@@ -951,7 +958,7 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
|||||||
onPointerLeave={cancelLongPress}
|
onPointerLeave={cancelLongPress}
|
||||||
>
|
>
|
||||||
<span style={{ position: 'relative', zIndex: 1 }}>
|
<span style={{ position: 'relative', zIndex: 1 }}>
|
||||||
{longPressActive ? 'Κρατήστε…' : 'Πληρώθηκαν ✓'}
|
{longPressActive ? t('detail.pay.hold') : `${t('detail.pay.paid')} ✓`}
|
||||||
</span>
|
</span>
|
||||||
{longPressActive && (
|
{longPressActive && (
|
||||||
<span style={{
|
<span style={{
|
||||||
@@ -963,7 +970,7 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
|||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<button className="btn btn--success" style={{ flex: 1 }} onClick={handleConfirmClick}>
|
<button className="btn btn--success" style={{ flex: 1 }} onClick={handleConfirmClick}>
|
||||||
Πληρώθηκαν ✓
|
{t('detail.pay.paid')} ✓
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -977,17 +984,17 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
|||||||
}} onClick={e => e.stopPropagation()}>
|
}} onClick={e => e.stopPropagation()}>
|
||||||
<div style={{ background: 'var(--bg2,#1e293b)', borderRadius: 14, padding: 24, width: '100%' }}>
|
<div style={{ background: 'var(--bg2,#1e293b)', borderRadius: 14, padding: 24, width: '100%' }}>
|
||||||
<p style={{ color: '#f1f5f9', fontWeight: 700, fontSize: 15, textAlign: 'center', marginBottom: 8 }}>
|
<p style={{ color: '#f1f5f9', fontWeight: 700, fontSize: 15, textAlign: 'center', marginBottom: 8 }}>
|
||||||
Είσαι σίγουρος;
|
{t('common.sure')}
|
||||||
</p>
|
</p>
|
||||||
<p style={{ color: '#94a3b8', fontSize: 13, textAlign: 'center', marginBottom: 20 }}>
|
<p style={{ color: '#94a3b8', fontSize: 13, textAlign: 'center', marginBottom: 20 }}>
|
||||||
{fmtPrice(payTotal)} — {method === 'card' ? 'Κάρτα' : 'Μετρητά'}
|
{fmtPrice(payTotal)} — {method === 'card' ? t('detail.pay.card') : t('detail.pay.cash')}
|
||||||
</p>
|
</p>
|
||||||
<div style={{ display: 'flex', gap: 10 }}>
|
<div style={{ display: 'flex', gap: 10 }}>
|
||||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setSecondConfirmOpen(false)}>
|
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setSecondConfirmOpen(false)}>
|
||||||
Πίσω
|
{t('common.back')}
|
||||||
</button>
|
</button>
|
||||||
<button className="btn btn--success" style={{ flex: 1 }} onClick={() => onConfirm(method)}>
|
<button className="btn btn--success" style={{ flex: 1 }} onClick={() => onConfirm(method)}>
|
||||||
Ναι, Πληρώθηκαν ✓
|
{t('detail.pay.yesPaid')} ✓
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1001,15 +1008,16 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
|||||||
// ─── Customer count modal ─────────────────────────────────────────────────────
|
// ─── Customer count modal ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
function CustomerCountModal({ value, onChange, onClose }) {
|
function CustomerCountModal({ value, onChange, onClose }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const [count, setCount] = useState(value ?? 0)
|
const [count, setCount] = useState(value ?? 0)
|
||||||
const QUICK = [1, 2, 3, 4, 5, 6]
|
const QUICK = [1, 2, 3, 4, 5, 6]
|
||||||
return (
|
return (
|
||||||
<div className="modal-overlay" onClick={onClose}>
|
<div className="modal-overlay" onClick={onClose}>
|
||||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title">Αριθμός Πελατών</h2>
|
<h2 className="modal-title">{t('detail.guests.title')}</h2>
|
||||||
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 20px' }}>
|
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 20px' }}>
|
||||||
Πόσα άτομα κάθονται στο τραπέζι;
|
{t('detail.guests.question')}
|
||||||
</p>
|
</p>
|
||||||
<div style={{ display: 'flex', gap: 8, justifyContent: 'center', marginBottom: 20 }}>
|
<div style={{ display: 'flex', gap: 8, justifyContent: 'center', marginBottom: 20 }}>
|
||||||
{QUICK.map(n => (
|
{QUICK.map(n => (
|
||||||
@@ -1027,9 +1035,9 @@ function CustomerCountModal({ value, onChange, onClose }) {
|
|||||||
<button className="qty-btn" onClick={() => setCount(c => c + 1)}>+</button>
|
<button className="qty-btn" onClick={() => setCount(c => c + 1)}>+</button>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'flex', gap: 10 }}>
|
<div style={{ display: 'flex', gap: 10 }}>
|
||||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>Άκυρο</button>
|
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={onClose}>{t('common.cancel')}</button>
|
||||||
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => { onChange(count || null); onClose() }}>
|
<button className="btn btn--primary" style={{ flex: 1 }} onClick={() => { onChange(count || null); onClose() }}>
|
||||||
Εφαρμογή
|
{t('common.apply')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1040,6 +1048,7 @@ function CustomerCountModal({ value, onChange, onClose }) {
|
|||||||
// ─── Main page ────────────────────────────────────────────────────────────────
|
// ─── Main page ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
export default function TableDetailPage() {
|
export default function TableDetailPage() {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
const { tableId, orderId: standaloneOrderId } = useParams()
|
const { tableId, orderId: standaloneOrderId } = useParams()
|
||||||
const isStandalone = !!standaloneOrderId
|
const isStandalone = !!standaloneOrderId
|
||||||
const [searchParams, setSearchParams] = useSearchParams()
|
const [searchParams, setSearchParams] = useSearchParams()
|
||||||
@@ -1191,7 +1200,7 @@ export default function TableDetailPage() {
|
|||||||
if (waitersRes.status === 200) setAllWaiters(waitersRes.data)
|
if (waitersRes.status === 200) setAllWaiters(waitersRes.data)
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
if (!table) setError('Σφάλμα φόρτωσης')
|
if (!table) setError(t('detail.err.load'))
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
@@ -1324,7 +1333,7 @@ export default function TableDetailPage() {
|
|||||||
await client.post('/api/orders/', { table_id: Number(tableId) })
|
await client.post('/api/orders/', { table_id: Number(tableId) })
|
||||||
await load()
|
await load()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(apiError(err, 'Σφάλμα ανοίγματος'))
|
setError(apiError(err, t('detail.err.open')))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1346,7 +1355,7 @@ export default function TableDetailPage() {
|
|||||||
const updatedOrder = await db.pos_orders.get(order.id)
|
const updatedOrder = await db.pos_orders.get(order.id)
|
||||||
if (!updatedOrder || updatedOrder.status === 'paid') navigate('/tables', { replace: true })
|
if (!updatedOrder || updatedOrder.status === 'paid') navigate('/tables', { replace: true })
|
||||||
} catch {
|
} catch {
|
||||||
setError('Σφάλμα αποθήκευσης offline πληρωμής')
|
setError(t('detail.err.offlinePay'))
|
||||||
} finally {
|
} finally {
|
||||||
setPaying(false)
|
setPaying(false)
|
||||||
}
|
}
|
||||||
@@ -1367,7 +1376,7 @@ export default function TableDetailPage() {
|
|||||||
}
|
}
|
||||||
await load()
|
await load()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(apiError(err, 'Σφάλμα πληρωμής'))
|
setError(apiError(err, t('detail.err.pay')))
|
||||||
} finally {
|
} finally {
|
||||||
setPaying(false)
|
setPaying(false)
|
||||||
}
|
}
|
||||||
@@ -1380,7 +1389,7 @@ export default function TableDetailPage() {
|
|||||||
setPaidSelectedIds([])
|
setPaidSelectedIds([])
|
||||||
await load()
|
await load()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(apiError(err, 'Σφάλμα αναίρεσης πληρωμής'))
|
setError(apiError(err, t('detail.err.revert')))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1390,7 +1399,7 @@ export default function TableDetailPage() {
|
|||||||
setConfirmClose(false)
|
setConfirmClose(false)
|
||||||
navigate('/tables')
|
navigate('/tables')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(apiError(err, 'Σφάλμα κλεισίματος'))
|
setError(apiError(err, t('detail.err.close')))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1406,7 +1415,7 @@ export default function TableDetailPage() {
|
|||||||
setItemActionTarget(null)
|
setItemActionTarget(null)
|
||||||
await load()
|
await load()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(apiError(err, 'Σφάλμα ακύρωσης'))
|
setError(apiError(err, t('detail.err.cancel')))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1416,7 +1425,7 @@ export default function TableDetailPage() {
|
|||||||
await client.delete(`/api/orders/${order.id}?print_cancellation=true`)
|
await client.delete(`/api/orders/${order.id}?print_cancellation=true`)
|
||||||
navigate('/tables')
|
navigate('/tables')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(apiError(err, 'Σφάλμα ακύρωσης παραγγελίας'))
|
setError(apiError(err, t('detail.err.cancelOrder')))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1435,7 +1444,7 @@ export default function TableDetailPage() {
|
|||||||
setPaidSelectedIds([])
|
setPaidSelectedIds([])
|
||||||
await load()
|
await load()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(apiError(err, 'Σφάλμα σήμανσης'))
|
setError(apiError(err, t('detail.err.mark')))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1447,7 +1456,7 @@ export default function TableDetailPage() {
|
|||||||
await client.post(`/api/kds/orders/${order.id}/items/mark-all-served`)
|
await client.post(`/api/kds/orders/${order.id}/items/mark-all-served`)
|
||||||
await load()
|
await load()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(apiError(err, 'Σφάλμα σήμανσης'))
|
setError(apiError(err, t('detail.err.mark')))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1484,7 +1493,7 @@ export default function TableDetailPage() {
|
|||||||
setSelectedIds([])
|
setSelectedIds([])
|
||||||
await loadFromDB()
|
await loadFromDB()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(err.message || 'Σφάλμα διαχωρισμού offline')
|
setError(err.message || t('detail.err.splitOffline'))
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -1494,7 +1503,7 @@ export default function TableDetailPage() {
|
|||||||
setSelectedIds([])
|
setSelectedIds([])
|
||||||
await load()
|
await load()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(apiError(err, 'Σφάλμα διαχωρισμού'))
|
setError(apiError(err, t('detail.err.split')))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1507,7 +1516,7 @@ export default function TableDetailPage() {
|
|||||||
await client.post(`/api/orders/${order.id}/transfer`, { target_table_id: targetTable.id })
|
await client.post(`/api/orders/${order.id}/transfer`, { target_table_id: targetTable.id })
|
||||||
navigate('/tables')
|
navigate('/tables')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(apiError(err, 'Σφάλμα μεταφοράς'))
|
setError(apiError(err, t('detail.err.transfer')))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1515,14 +1524,14 @@ export default function TableDetailPage() {
|
|||||||
async function doMerge(targetTable) {
|
async function doMerge(targetTable) {
|
||||||
if (!order) return
|
if (!order) return
|
||||||
const targetOrder = allOrders.find(o => o.table_id === targetTable.id)
|
const targetOrder = allOrders.find(o => o.table_id === targetTable.id)
|
||||||
if (!targetOrder) { setError('Δεν βρέθηκε παραγγελία στο τραπέζι'); return }
|
if (!targetOrder) { setError(t('detail.err.noTargetOrder')); return }
|
||||||
setPendingTable(null)
|
setPendingTable(null)
|
||||||
setActionsMode(null)
|
setActionsMode(null)
|
||||||
try {
|
try {
|
||||||
await client.post(`/api/orders/${order.id}/merge`, { target_order_id: targetOrder.id })
|
await client.post(`/api/orders/${order.id}/merge`, { target_order_id: targetOrder.id })
|
||||||
navigate('/tables')
|
navigate('/tables')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(apiError(err, 'Σφάλμα συγχώνευσης'))
|
setError(apiError(err, t('detail.err.merge')))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1530,7 +1539,7 @@ export default function TableDetailPage() {
|
|||||||
async function doMoveItems(targetTable) {
|
async function doMoveItems(targetTable) {
|
||||||
if (!order || selectedIds.length === 0) return
|
if (!order || selectedIds.length === 0) return
|
||||||
const targetOrder = allOrders.find(o => o.table_id === targetTable.id)
|
const targetOrder = allOrders.find(o => o.table_id === targetTable.id)
|
||||||
if (!targetOrder) { setError('Δεν βρέθηκε παραγγελία στο τραπέζι'); return }
|
if (!targetOrder) { setError(t('detail.err.noTargetOrder')); return }
|
||||||
setPendingTable(null)
|
setPendingTable(null)
|
||||||
setActionsMode(null)
|
setActionsMode(null)
|
||||||
try {
|
try {
|
||||||
@@ -1541,7 +1550,7 @@ export default function TableDetailPage() {
|
|||||||
setSelectedIds([])
|
setSelectedIds([])
|
||||||
await load()
|
await load()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(apiError(err, 'Σφάλμα μεταφοράς αντικειμένων'))
|
setError(apiError(err, t('detail.err.moveItems')))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1552,7 +1561,7 @@ export default function TableDetailPage() {
|
|||||||
setCurrentFlagIds(flagIds)
|
setCurrentFlagIds(flagIds)
|
||||||
setActionsMode(null)
|
setActionsMode(null)
|
||||||
} catch {
|
} catch {
|
||||||
setError('Σφάλμα αποθήκευσης σημαιών')
|
setError(t('detail.err.flags'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1585,7 +1594,7 @@ export default function TableDetailPage() {
|
|||||||
? (order?.order_type === 'delivery' ? `Delivery #${standaloneOrderId}` : `Takeaway #${standaloneOrderId}`)
|
? (order?.order_type === 'delivery' ? `Delivery #${standaloneOrderId}` : `Takeaway #${standaloneOrderId}`)
|
||||||
: (table ? (table.label || `T${table.number}`) : '—')
|
: (table ? (table.label || `T${table.number}`) : '—')
|
||||||
|
|
||||||
if (loading) return <div className="page page--centered"><p style={{ color: '#94a3b8' }}>Φόρτωση…</p></div>
|
if (loading) return <div className="page page--centered"><p style={{ color: '#94a3b8' }}>{t('common.loading')}</p></div>
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="page">
|
<div className="page">
|
||||||
@@ -1607,7 +1616,7 @@ export default function TableDetailPage() {
|
|||||||
color: customerCount ? '#f59e0b' : 'var(--muted)',
|
color: customerCount ? '#f59e0b' : 'var(--muted)',
|
||||||
cursor: 'pointer', fontSize: 13, fontWeight: 700,
|
cursor: 'pointer', fontSize: 13, fontWeight: 700,
|
||||||
}}
|
}}
|
||||||
title="Αριθμός πελατών"
|
title={t('detail.guests.button')}
|
||||||
>
|
>
|
||||||
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
||||||
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/>
|
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/>
|
||||||
@@ -1689,9 +1698,9 @@ export default function TableDetailPage() {
|
|||||||
|
|
||||||
{!order && !isStandalone && (
|
{!order && !isStandalone && (
|
||||||
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
|
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
|
||||||
<p style={{ color: '#94a3b8', marginBottom: 24 }}>Δεν υπάρχει ενεργή παραγγελία</p>
|
<p style={{ color: '#94a3b8', marginBottom: 24 }}>{t('tables.quick.noOrder')}</p>
|
||||||
<button className="btn btn--primary btn--lg" onClick={openOrder}>
|
<button className="btn btn--primary btn--lg" onClick={openOrder}>
|
||||||
Άνοιγμα Παραγγελίας
|
{t('detail.openOrder')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -1743,7 +1752,7 @@ export default function TableDetailPage() {
|
|||||||
transition: 'background 0.15s',
|
transition: 'background 0.15s',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Εκκρεμή {activeItems.length > 0 && (
|
{t('detail.tabs.unpaid')} {activeItems.length > 0 && (
|
||||||
<span style={{
|
<span style={{
|
||||||
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
||||||
background: activeTab === 'active' ? 'rgba(0,0,0,0.2)' : 'var(--bg3)',
|
background: activeTab === 'active' ? 'rgba(0,0,0,0.2)' : 'var(--bg3)',
|
||||||
@@ -1762,7 +1771,7 @@ export default function TableDetailPage() {
|
|||||||
transition: 'background 0.15s',
|
transition: 'background 0.15s',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Πληρωμένα {paidItems.length > 0 && (
|
{t('detail.tabs.paid')} {paidItems.length > 0 && (
|
||||||
<span style={{
|
<span style={{
|
||||||
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
||||||
background: activeTab === 'paid' ? 'rgba(0,0,0,0.2)' : 'var(--bg3)',
|
background: activeTab === 'paid' ? 'rgba(0,0,0,0.2)' : 'var(--bg3)',
|
||||||
@@ -1887,7 +1896,7 @@ export default function TableDetailPage() {
|
|||||||
<div style={{ padding: '8px 0' }}>
|
<div style={{ padding: '8px 0' }}>
|
||||||
{paidItems.length === 0 ? (
|
{paidItems.length === 0 ? (
|
||||||
<p style={{ color: '#64748b', textAlign: 'center', padding: '24px 0', fontSize: 14 }}>
|
<p style={{ color: '#64748b', textAlign: 'center', padding: '24px 0', fontSize: 14 }}>
|
||||||
Δεν υπάρχουν πληρωμένα αντικείμενα
|
{t('detail.noPaid')}
|
||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
@@ -1973,7 +1982,7 @@ export default function TableDetailPage() {
|
|||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
||||||
}}
|
}}
|
||||||
>ΑΝΑΙΡΕΣΗ</button>
|
>{t('detail.revert.button')}</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -2029,7 +2038,7 @@ export default function TableDetailPage() {
|
|||||||
}}
|
}}
|
||||||
disabled={isOffline}
|
disabled={isOffline}
|
||||||
style={{ borderRadius: 999, flex: 1, opacity: isOffline ? 0.4 : 1 }}
|
style={{ borderRadius: 999, flex: 1, opacity: isOffline ? 0.4 : 1 }}
|
||||||
title={isOffline ? 'Μη διαθέσιμο offline' : undefined}
|
title={isOffline ? t('detail.notOffline') : undefined}
|
||||||
>
|
>
|
||||||
<span style={{ marginRight: 6 }}>✕</span>CLOSE
|
<span style={{ marginRight: 6 }}>✕</span>CLOSE
|
||||||
</button>
|
</button>
|
||||||
@@ -2042,12 +2051,12 @@ export default function TableDetailPage() {
|
|||||||
<div className="modal-overlay" onClick={() => setShowMergeModal(false)} style={{ alignItems: 'flex-end' }}>
|
<div className="modal-overlay" onClick={() => setShowMergeModal(false)} style={{ alignItems: 'flex-end' }}>
|
||||||
<div className="modal-sheet" onClick={e => e.stopPropagation()} style={{ borderRadius: '20px 20px 0 0', paddingBottom: 40, gap: 0 }}>
|
<div className="modal-sheet" onClick={e => e.stopPropagation()} style={{ borderRadius: '20px 20px 0 0', paddingBottom: 40, gap: 0 }}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<p style={{ fontSize: 17, fontWeight: 700, color: 'var(--text)', marginBottom: 20, paddingTop: 4 }}>Εμφάνιση Αντικειμένων</p>
|
<p style={{ fontSize: 17, fontWeight: 700, color: 'var(--text)', marginBottom: 20, paddingTop: 4 }}>{t('detail.view.title')}</p>
|
||||||
|
|
||||||
{[
|
{[
|
||||||
{ mode: MERGE_OFF, label: 'ΑΡΧΙΚΗ', desc: 'Ακριβώς όπως παραγγέλθηκαν' },
|
{ mode: MERGE_OFF, label: t('detail.view.off'), desc: t('detail.view.offDesc') },
|
||||||
{ mode: MERGE_IDENTICAL, label: 'ΣΥΓΧΩΝΕΥΣΗ ΠΑΡΟΜΟΙΩΝ', desc: 'Ίδιο προϊόν, ίδιες επιλογές, ίδια τιμή' },
|
{ mode: MERGE_IDENTICAL, label: t('detail.view.identical'), desc: t('detail.view.identicalDesc') },
|
||||||
{ mode: MERGE_SAME_ITEM, label: 'ΣΥΓΧΩΝΕΥΣΗ ΟΛΩΝ', desc: 'Ίδιο προϊόν με ίδια τελική τιμή' },
|
{ mode: MERGE_SAME_ITEM, label: t('detail.view.sameItem'), desc: t('detail.view.sameItemDesc') },
|
||||||
].map(({ mode, label, desc }) => {
|
].map(({ mode, label, desc }) => {
|
||||||
const active = mergeMode === mode
|
const active = mergeMode === mode
|
||||||
return (
|
return (
|
||||||
@@ -2082,7 +2091,7 @@ export default function TableDetailPage() {
|
|||||||
})}
|
})}
|
||||||
|
|
||||||
<button className="btn btn--secondary" style={{ width: '100%', marginTop: 20 }} onClick={() => setShowMergeModal(false)}>
|
<button className="btn btn--secondary" style={{ width: '100%', marginTop: 20 }} onClick={() => setShowMergeModal(false)}>
|
||||||
Άκυρο
|
{t('common.cancel')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2223,22 +2232,22 @@ export default function TableDetailPage() {
|
|||||||
<div className="modal-overlay" onClick={() => setRevertConfirm(null)}>
|
<div className="modal-overlay" onClick={() => setRevertConfirm(null)}>
|
||||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title">Αναίρεση Πληρωμής;</h2>
|
<h2 className="modal-title">{t('detail.revert.title')}</h2>
|
||||||
<p style={{ color: '#94a3b8', textAlign: 'center', marginBottom: 24 }}>
|
<p style={{ color: '#94a3b8', textAlign: 'center', marginBottom: 24 }}>
|
||||||
{revertConfirm.itemIds.length === 1
|
{revertConfirm.itemIds.length === 1
|
||||||
? '1 αντικείμενο θα επιστραφεί σε μη πληρωμένο.'
|
? t('detail.revert.items', { count: 1 })
|
||||||
: `${revertConfirm.itemIds.length} αντικείμενα θα επιστραφούν σε μη πληρωμένα.`}
|
: t('detail.revert.items', { count: revertConfirm.itemIds.length })}
|
||||||
</p>
|
</p>
|
||||||
<div style={{ display: 'flex', gap: 12 }}>
|
<div style={{ display: 'flex', gap: 12 }}>
|
||||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setRevertConfirm(null)}>
|
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setRevertConfirm(null)}>
|
||||||
Άκυρο
|
{t('common.cancel')}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className="btn btn--danger"
|
className="btn btn--danger"
|
||||||
style={{ flex: 1 }}
|
style={{ flex: 1 }}
|
||||||
onClick={() => revertPayment(revertConfirm.itemIds)}
|
onClick={() => revertPayment(revertConfirm.itemIds)}
|
||||||
>
|
>
|
||||||
Αναίρεση ✓
|
{t('detail.revert.confirm')} ✓
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2250,13 +2259,13 @@ export default function TableDetailPage() {
|
|||||||
<div className="modal-overlay" onClick={() => setConfirmClose(false)}>
|
<div className="modal-overlay" onClick={() => setConfirmClose(false)}>
|
||||||
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
<div className="modal-sheet" onClick={e => e.stopPropagation()}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title">Κλείσιμο παραγγελίας;</h2>
|
<h2 className="modal-title">{t('detail.close.title')}</h2>
|
||||||
<p style={{ color: '#94a3b8', textAlign: 'center', marginBottom: 24 }}>
|
<p style={{ color: '#94a3b8', textAlign: 'center', marginBottom: 24 }}>
|
||||||
Αυτή η ενέργεια δεν αναιρείται.
|
{t('detail.close.body')}
|
||||||
</p>
|
</p>
|
||||||
<div style={{ display: 'flex', gap: 12 }}>
|
<div style={{ display: 'flex', gap: 12 }}>
|
||||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setConfirmClose(false)}>
|
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setConfirmClose(false)}>
|
||||||
Άκυρο
|
{t('common.cancel')}
|
||||||
</button>
|
</button>
|
||||||
<button className="btn btn--danger" style={{ flex: 1 }} onClick={closeOrder}>
|
<button className="btn btn--danger" style={{ flex: 1 }} onClick={closeOrder}>
|
||||||
CLOSE
|
CLOSE
|
||||||
@@ -2300,8 +2309,8 @@ export default function TableDetailPage() {
|
|||||||
{/* Transfer picker */}
|
{/* Transfer picker */}
|
||||||
{actionsMode === 'transfer' && !pendingTable && (
|
{actionsMode === 'transfer' && !pendingTable && (
|
||||||
<TablePicker
|
<TablePicker
|
||||||
title="Μεταφορά Τραπεζιού"
|
title={t('detail.actions.transfer')}
|
||||||
subtitle="Επιλέξτε κενό τραπέζι"
|
subtitle={t('detail.move.pickFree')}
|
||||||
tables={transferTargets}
|
tables={transferTargets}
|
||||||
currentTableId={Number(tableId)}
|
currentTableId={Number(tableId)}
|
||||||
onSelect={t => setPendingTable({ table: t, mode: 'transfer' })}
|
onSelect={t => setPendingTable({ table: t, mode: 'transfer' })}
|
||||||
@@ -2313,8 +2322,8 @@ export default function TableDetailPage() {
|
|||||||
{/* Merge picker */}
|
{/* Merge picker */}
|
||||||
{actionsMode === 'merge' && !pendingTable && (
|
{actionsMode === 'merge' && !pendingTable && (
|
||||||
<TablePicker
|
<TablePicker
|
||||||
title="Συγχώνευση Τραπεζιού"
|
title={t('detail.actions.merge')}
|
||||||
subtitle="Τα αντικείμενα μεταφέρονται στο επιλεγμένο τραπέζι"
|
subtitle={t('detail.move.mergeSub')}
|
||||||
tables={mergeTargets}
|
tables={mergeTargets}
|
||||||
currentTableId={Number(tableId)}
|
currentTableId={Number(tableId)}
|
||||||
onSelect={t => setPendingTable({ table: t, mode: 'merge' })}
|
onSelect={t => setPendingTable({ table: t, mode: 'merge' })}
|
||||||
@@ -2326,8 +2335,8 @@ export default function TableDetailPage() {
|
|||||||
{/* Move items picker */}
|
{/* Move items picker */}
|
||||||
{actionsMode === 'move_items' && !pendingTable && (
|
{actionsMode === 'move_items' && !pendingTable && (
|
||||||
<TablePicker
|
<TablePicker
|
||||||
title="Μεταφορά Αντικειμένων"
|
title={t('detail.move.itemsTitle')}
|
||||||
subtitle={`Μεταφορά ${selectedIds.length} αντικειμένου${selectedIds.length !== 1 ? 'ων' : ''} σε τραπέζι`}
|
subtitle={t('detail.move.subtitle', { count: selectedIds.length })}
|
||||||
tables={moveItemsTargets}
|
tables={moveItemsTargets}
|
||||||
currentTableId={Number(tableId)}
|
currentTableId={Number(tableId)}
|
||||||
onSelect={t => setPendingTable({ table: t, mode: 'move_items' })}
|
onSelect={t => setPendingTable({ table: t, mode: 'move_items' })}
|
||||||
@@ -2342,21 +2351,21 @@ export default function TableDetailPage() {
|
|||||||
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title">
|
<h2 className="modal-title">
|
||||||
{pendingTable.mode === 'transfer' ? 'Επιβεβαίωση Μεταφοράς'
|
{pendingTable.mode === 'transfer' ? t('detail.move.confirmTransfer')
|
||||||
: pendingTable.mode === 'merge' ? 'Επιβεβαίωση Συγχώνευσης'
|
: pendingTable.mode === 'merge' ? t('detail.move.confirmMerge')
|
||||||
: 'Επιβεβαίωση Μεταφοράς Αντικειμένων'}
|
: t('detail.move.confirmItems')}
|
||||||
</h2>
|
</h2>
|
||||||
<p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 14, marginBottom: 4 }}>
|
<p style={{ textAlign: 'center', color: '#94a3b8', fontSize: 14, marginBottom: 4 }}>
|
||||||
{pendingTable.mode === 'transfer' ? 'Μεταφορά παραγγελίας στο τραπέζι'
|
{pendingTable.mode === 'transfer' ? t('detail.move.transferTo')
|
||||||
: pendingTable.mode === 'merge' ? 'Συγχώνευση παραγγελίας με το τραπέζι'
|
: pendingTable.mode === 'merge' ? t('detail.move.mergeWith')
|
||||||
: `Μεταφορά ${selectedIds.length} αντικειμένου${selectedIds.length !== 1 ? 'ων' : ''} στο τραπέζι`}
|
: t('detail.move.itemsTo', { count: selectedIds.length })}
|
||||||
</p>
|
</p>
|
||||||
<p style={{ textAlign: 'center', fontSize: 22, fontWeight: 700, color: 'var(--accent)', marginBottom: 20 }}>
|
<p style={{ textAlign: 'center', fontSize: 22, fontWeight: 700, color: 'var(--accent)', marginBottom: 20 }}>
|
||||||
{pendingTable.table.label || `T${pendingTable.table.number}`}
|
{pendingTable.table.label || `T${pendingTable.table.number}`}
|
||||||
</p>
|
</p>
|
||||||
<div style={{ display: 'flex', gap: 12 }}>
|
<div style={{ display: 'flex', gap: 12 }}>
|
||||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setPendingTable(null)}>
|
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setPendingTable(null)}>
|
||||||
Άκυρο
|
{t('common.cancel')}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className="btn btn--primary"
|
className="btn btn--primary"
|
||||||
@@ -2367,9 +2376,7 @@ export default function TableDetailPage() {
|
|||||||
else doMoveItems(pendingTable.table)
|
else doMoveItems(pendingTable.table)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{pendingTable.mode === 'transfer' ? 'Μεταφορά ✓'
|
{pendingTable.mode === 'merge' ? t('tables.actions.merge') : t('tables.actions.transfer')} ✓
|
||||||
: pendingTable.mode === 'merge' ? 'Συγχώνευση ✓'
|
|
||||||
: 'Μεταφορά ✓'}
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user