feat: printing problems shown and handled; printing set-up on v2 (platform-v2 step 6.10)

- a ticket that doesn't print is a problem for whoever sent it and the managers:
  GET /api/print-problems (the order, table, dishes, printer, since when, tries,
  last error, who sent it) and three ways out: print again, send to another
  printer, handled (services/print_problems.py; print_jobs.resolved_by /
  redirected_to, Alembic 0036); live event print.problems from the print paths
- phone: the red printer button opens the problems sheet, the table page warns
  (usePrintProblems replaces the 8 s poll); counter POS: a red button under the
  modes with the shared panel (@xenia/ordering PrintProblemsPanel + pure rules);
  manager: a card on the overview (top), the Tables page and the order page
- manager: Settings -> Printing (printers with reachability, test print, network
  scan; ticket layout + test ticket, beep, fonts with previews, dot leader,
  dividers) and Management -> Prep zones (cards + zone dialog with the ticket
  language, printers, copies, sorting, category order, kitchen screen) rebuilt in
  src/pages/printing; v1 PrintFontsTab, PrepZonesConfigPage, PendingPrints and
  /api/orders/pending-prints removed
- access: printer add/edit/delete/scan need core.settings.manage, prep zone
  changes catalog.menu.manage (were any dashboard user)
- tests: test_print_problems.py, @xenia/ordering printProblems, manager
  printing.test.mjs, e2e print_problems.mjs (done-when) + manager.mjs printing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 01:40:07 +02:00
co-authored by Claude Opus 5.5
parent 070c9cf625
commit f31bdf42aa
57 changed files with 2557 additions and 2221 deletions
+25
View File
@@ -130,5 +130,30 @@
"quantity": "Ποσότητα",
"missing": "Μένει να επιλέξετε: {{list}}"
}
},
"printProblems": {
"title": "Δελτία που δεν τυπώθηκαν",
"count_one": "{{count}} δελτίο δεν τυπώθηκε",
"count_other": "{{count}} δελτία δεν τυπώθηκαν",
"none": "Όλα τυπώθηκαν.",
"close": "Κλείσιμο",
"notOn": "Δεν τυπώθηκε στον {{printer}}",
"since": "από τις {{time}}",
"tries_one": "{{count}} προσπάθεια",
"tries_other": "{{count}} προσπάθειες",
"sentBy": "το έστειλε: {{names}}",
"retry": "Ξανά εκτύπωση",
"sendTo": "Αποστολή σε άλλον εκτυπωτή",
"send": "Αποστολή εκεί",
"handled": "Το χειρίστηκα",
"handledHint": "Ενημερώθηκε η κουζίνα αλλιώς: σταματούν οι προσπάθειες και οι ειδοποιήσεις.",
"stillNot": "Ακόμα δεν τυπώνει στον {{printer}}.",
"failed": "Δεν έγινε.",
"whatNow": "Τι κάνω",
"done": {
"retry": "Τυπώθηκε στον {{printer}}",
"redirect": "Τυπώθηκε στον {{printer}}",
"handled": "Σημειώθηκε ότι το χειριστήκατε"
}
}
}
+6 -1
View File
@@ -260,7 +260,8 @@
},
"print_job": {
"not_found": "Αυτή η εκτύπωση δεν υπάρχει πια.",
"not_pending": "Ακυρώνονται μόνο εκτυπώσεις που περιμένουν ακόμη."
"not_pending": "Ακυρώνονται μόνο εκτυπώσεις που περιμένουν ακόμη.",
"done": "Αυτό το δελτίο δεν περιμένει πια: τυπώθηκε ή το χειρίστηκε κάποιος σε άλλη οθόνη."
},
"table": {
"not_found": "Το τραπέζι δεν βρέθηκε.",
@@ -337,5 +338,9 @@
"bad_zone": "Αυτή η ζώνη δεν υπάρχει πια.",
"bad_background": "Το φόντο πρέπει να είναι εικόνα από τη βιβλιοθήκη πολυμέσων.",
"bad_layout": "Η διάταξη έχει ένα τραπέζι δύο φορές ή μια θέση που δεν είναι αριθμός."
},
"print": {
"printer_off": "Ο εκτυπωτής {{printer}} είναι απενεργοποιημένος στις ρυθμίσεις.",
"redirect_failed": "Ούτε ο {{printer}} το τύπωσε ({{error}}). Το δελτίο περιμένει ακόμα."
}
}
+226 -14
View File
@@ -1337,20 +1337,6 @@
"closed": "Κλειστή",
"cancelled": "Ακυρωμένη"
},
"prints": {
"title": "Εκκρεμείς εκτυπώσεις",
"count_one": "{{count}} παραγγελία δεν έχει σταλεί",
"count_other": "{{count}} παραγγελίες δεν έχουν σταλεί",
"all": "Αποστολή όλων",
"retries_one": "{{count}} επανάληψη",
"retries_other": "{{count}} επαναλήψεις",
"lines_one": "{{count}} αντ. εκκρεμεί",
"lines_other": "{{count}} αντ. εκκρεμούν",
"open": "Λεπτομέρειες",
"print": "Εκτύπωση",
"done": "Εκτυπώθηκε επιτυχώς",
"failed": "Αποτυχία: {{printers}}"
},
"notes": {
"title": "Σημειώσεις & εργασίες",
"counts": "{{notes}} σημειώσεις · {{todos}} εκκρεμείς εργασίες"
@@ -2353,6 +2339,232 @@
"save": "Αποθήκευση",
"saved": "Οι σημαίες αποθηκεύτηκαν",
"sent": "Σημαίες αποθηκεύτηκαν και το μήνυμα στάλθηκε"
},
"printHelp": "Τα δελτία ξαναδοκιμάζονται κάθε 8 δευτερόλεπτα μέχρι να τυπωθούν. Αν ένας εκτυπωτής είναι κλειστός ή χωρίς χαρτί, στείλτε τα σε άλλον, ή σημειώστε ότι τα χειριστήκατε όταν μάθει η κουζίνα."
},
"printing": {
"back": "Πίσω",
"save": "Αποθήκευση",
"close": "Κλείσιμο",
"up": "Πάνω",
"down": "Κάτω",
"zones": {
"title": "Ζώνες προετοιμασίας",
"intro": "Πού τυπώνεται το δελτίο κάθε πιάτου και πώς το χειρίζεται η οθόνη κουζίνας. Τα πιάτα μπαίνουν σε ζώνες από την επεξεργασία προϊόντος.",
"new": "Νέα ζώνη",
"none": "Δεν υπάρχουν ζώνες ακόμα",
"noneHint": "Φτιάξτε μία για την κουζίνα και μία για το μπαρ και βάλτε τα πιάτα σε αυτές.",
"edit": "Επεξεργασία {{name}}",
"delete": "Διαγραφή {{name}}",
"deleteTitle": "Διαγραφή {{name}};",
"deleteBody": "Τα πιάτα της δεν θα τυπώνονται πουθενά μέχρι να μπουν σε άλλη ζώνη.",
"deleteYes": "Διαγραφή",
"deleted": "Η ζώνη διαγράφηκε",
"main": "Κύριος",
"also": "Και",
"noPrinter": "Χωρίς εκτυπωτή",
"noPrinters": "Δεν υπάρχουν εκτυπωτές ακόμα: προσθέστε τους στις Ρυθμίσεις → Εκτύπωση.",
"newTitle": "Νέα ζώνη προετοιμασίας",
"editTitle": "{{name}}",
"created": "Η ζώνη δημιουργήθηκε",
"saved": "Η ζώνη αποθηκεύτηκε",
"about": "Η ζώνη",
"name": "Όνομα",
"namePh": "π.χ. Κουζίνα, Ψησταριά, Μπαρ",
"nameNeeded": "Δώστε όνομα στη ζώνη.",
"shown": "Όνομα στα μηνύματα",
"shownHint": "Τι βλέπει το προσωπικό όταν η ζώνη έχει κάτι έτοιμο (π.χ. «Κουζίνα»).",
"description": "Περιγραφή",
"language": "Γλώσσα δελτίου",
"languageHint": "Η γλώσσα που τυπώνονται τα δελτία της.",
"venueLanguage": "Η γλώσσα του καταστήματος",
"printers": "Εκτύπωση",
"auto": "Τι τυπώνεται",
"autoShort": {
"none": "Δεν τυπώνει",
"master": "Κύριος εκτυπωτής",
"all": "Όλοι οι εκτυπωτές της"
},
"autoHint": {
"none": "Τα πιάτα φαίνονται μόνο στην οθόνη κουζίνας.",
"master": "Ένα δελτίο στον κύριο εκτυπωτή.",
"all": "Ο κύριος και κάθε άλλος που είναι επιλεγμένος."
},
"mainPrinter": "Κύριος εκτυπωτής",
"mainHint": "Εκεί τυπώνεται το δελτίο.",
"printerNeeded": "Επιλέξτε τον εκτυπωτή των δελτίων.",
"secondPrinters": "Άλλοι εκτυπωτές",
"secondTip": "Χρησιμοποιούνται με το «Όλοι οι εκτυπωτές της», π.χ. ένα αντίγραφο για το πάσο.",
"mainCopies": "Αντίτυπα στον κύριο",
"secondCopies": "Αντίτυπα στους άλλους",
"ticket": "Το δελτίο",
"sort": "Σειρά των πιάτων",
"sortShort": {
"order_time": "Όπως παραγγέλθηκαν",
"item_count": "Τα περισσότερα πρώτα",
"alpha": "Αλφαβητικά"
},
"sortHint": {
"order_time": "Με τη σειρά που προστέθηκαν.",
"item_count": "Οι μεγαλύτερες ποσότητες πρώτα.",
"alpha": "Κατά όνομα."
},
"byCategory": "Ομαδοποίηση κατά κατηγορία",
"byCategoryTip": "Τα πιάτα της ίδιας κατηγορίας τυπώνονται μαζί, κάτω από το όνομά της.",
"categoryOrder": "Σειρά κατηγοριών",
"categoryOrderHint": "Οι κατηγορίες τυπώνονται με αυτή τη σειρά· οι υπόλοιπες ακολουθούν.",
"categoryOrderReset": "Η σειρά του μενού",
"checkboxes": "Κουτάκια",
"checkboxesTip": "Τυπώνει [ ] πριν από κάθε πιάτο, για να τα σημειώνουν οι μάγειρες.",
"kds": "Η οθόνη κουζίνας",
"startReady": "Ξεκινά ως έτοιμο",
"startReadyTip": "Τα πιάτα παραλείπουν το «σε αναμονή» και «σε προετοιμασία» και εμφανίζονται αμέσως έτοιμα (ποτά, μπύρες).",
"skipKds": "Παράκαμψη οθόνης κουζίνας",
"skipKdsTip": "Τα πιάτα περνούν κατευθείαν σε σερβιρισμένα και δεν εμφανίζονται στην οθόνη κουζίνας. Ενεργοποιεί και το «Ξεκινά ως έτοιμο».",
"readyServed": "Έτοιμο σημαίνει σερβιρισμένο",
"readyServedTip": "Όταν ο μάγειρας σημειώνει ένα πιάτο έτοιμο στην οθόνη, μετράει και ως σερβιρισμένο."
},
"printers": {
"title": "Εκτυπωτές",
"intro": "Οι εκτυπωτές κουζίνας και μπαρ στο δίκτυο του καταστήματος.",
"add": "Προσθήκη εκτυπωτή",
"find": "Εύρεση εκτυπωτών",
"none": "Δεν υπάρχουν εκτυπωτές ακόμα.",
"on": "{{name}} ενεργός",
"codepage": "Κωδικοσελίδα {{n}}",
"chars_one": "{{count}} χαρακτήρας ανά γραμμή",
"chars_other": "{{count}} χαρακτήρες ανά γραμμή",
"checking": "Έλεγχος…",
"answers": "Απαντά",
"noAnswer": "Δεν απαντά",
"test": "Δοκιμαστική εκτύπωση",
"testSent": "Η δοκιμαστική εκτύπωση στάλθηκε",
"testFailed": "Δεν τυπώθηκε: {{error}}",
"edit": "Επεξεργασία {{name}}",
"remove": "Αφαίρεση {{name}}",
"removeTitle": "Αφαίρεση {{name}};",
"removeBody": "Οι ζώνες που τυπώνουν εκεί θα χρειαστούν άλλον εκτυπωτή.",
"removeYes": "Αφαίρεση",
"removed": "Ο εκτυπωτής αφαιρέθηκε",
"addTitle": "Προσθήκη εκτυπωτή",
"editTitle": "{{name}}",
"added": "Ο εκτυπωτής προστέθηκε",
"saved": "Ο εκτυπωτής αποθηκεύτηκε",
"name": "Όνομα",
"namePh": "π.χ. Κουζίνα",
"address": "Διεύθυνση (IP)",
"addressHint": "Τυπώνεται στη σελίδα αυτοελέγχου του εκτυπωτή.",
"port": "Θύρα",
"model": "Μοντέλο",
"modelHint": "Ορίζει τα ελληνικά που καταλαβαίνει ο εκτυπωτής.",
"width": "Χαρακτήρες ανά γραμμή",
"widthHint": "48 για χαρτί 80 mm, 32 για 58 mm.",
"wrong": {
"name": "Δώστε όνομα στον εκτυπωτή.",
"ip_address": "Μια διεύθυνση όπως 192.168.1.50.",
"port": "Θύρα από 1 έως 65535 (συνήθως 9100).",
"line_width": "Από 20 έως 80."
},
"findTitle": "Εύρεση εκτυπωτών",
"findBody": "Ψάχνει στο δίκτυο συσκευές που απαντούν στη θύρα εκτύπωσης.",
"subnet": "Δίκτυο",
"scan": "Αναζήτηση",
"stop": "Διακοπή",
"scanned": "Ελέγχθηκαν {{done}} από {{total}} διευθύνσεις",
"scanStart": "Πατήστε Αναζήτηση.",
"foundNone": "Δεν βρέθηκαν εκτυπωτές.",
"scanFailed": "Η αναζήτηση δεν έγινε.",
"use": "Χρήση"
},
"ticket": {
"layout": "Διάταξη δελτίου",
"mode": "Διάταξη",
"modeTip": "Αναλυτικό: κάθε επιλογή σε δική της γραμμή, πιο ευανάγνωστο. Συμπαγές: επιλογές ίδιου τύπου στην ίδια γραμμή, λιγότερο χαρτί.",
"modes": {
"detailed": "Αναλυτικό",
"compact": "Συμπαγές"
},
"testHint": "Τυπώνει μια ψεύτικη παραγγελία με όλους τους τύπους επιλογών, για να δείτε τις ρυθμίσεις στο χαρτί.",
"testOn": "Εκτυπωτής για τη δοκιμή",
"testOrder": "Δοκιμαστικό δελτίο",
"testSent": "Στάλθηκε στον εκτυπωτή",
"fonts": "Γράμματα",
"fontsHint": "Μέγεθος, έντονα και κεφαλαία για κάθε μέρος του δελτίου. Οι αλλαγές ισχύουν από το επόμενο δελτίο.",
"groups": {
"header": "Η κορυφή",
"items": "Τα πιάτα",
"notes": "Σημειώσεις"
},
"parts": {
"order_number": "Αριθμός παραγγελίας",
"meta": "Τραπέζι · σερβιτόρος · ώρα",
"item_name": "Όνομα πιάτου",
"quick": "Γρήγορες προσθήκες (*)",
"pref": "Προτιμήσεις (>)",
"extra": "Έξτρα (+)",
"ingredient": "Αφαιρέσεις (-)",
"item_note": "Σημείωση πιάτου",
"order_note": "Σημείωση παραγγελίας"
},
"partsHint": {
"order_number": "Η επικεφαλίδα του δελτίου: «Παραγγελία #42».",
"meta": "Οι γραμμές κάτω από τον αριθμό.",
"item_name": "Κάθε πιάτο, με τις τελείες ως την ποσότητα.",
"quick": "Προσθήκες με ένα πάτημα.",
"pref": "Ψήσιμο, συνοδευτικά και άλλες επιλογές.",
"extra": "Έξτρα σε ένα πιάτο.",
"ingredient": "Γραμμές «ΧΩΡΙΣ».",
"item_note": "Ελεύθερο κείμενο για ένα πιάτο.",
"order_note": "Η σημείωση όλης της παραγγελίας."
},
"sizes": {
"0": "Κανονικά",
"16": "Ψηλά",
"32": "Πλατιά",
"48": "Ψηλά και πλατιά"
},
"bold": "Έντονα",
"caps": "ΚΕΦΑΛΑΙΑ",
"wideNote": "Τα πλατιά γράμματα χωράνε περίπου τους μισούς χαρακτήρες ανά γραμμή: κρατήστε τα για σύντομα κείμενα.",
"dots": "Τελείες",
"dotsHint": "Οι χαρακτήρες ανάμεσα στο πιάτο και την ποσότητα.",
"dotsSize": "Μέγεθος τελειών",
"dotsSample": "Μπριζόλα {{dots}} x2",
"dotStyles": {
"dot_space": "Τελείες με κενά",
"dot": "Τελείες",
"dash_space": "Παύλες με κενά",
"underscore": "Κάτω παύλες"
},
"divider": "Διαχωριστικά",
"dividerHint": "Η γραμμή ανάμεσα στα μέρη του δελτίου.",
"emptyLine": "(κενή γραμμή)",
"dividers": {
"dash": "Παύλες ( - )",
"equals": "Ίσον ( = )",
"star": "Αστερίσκοι ( * )",
"empty": "Κενή γραμμή"
}
},
"beep": {
"title": "Ήχος",
"intro": "Ο εκτυπωτής χτυπά για να ειδοποιήσει την κουζίνα ότι ήρθε δελτίο.",
"presets": {
"off": "Χωρίς ήχο",
"single": "Μία φορά",
"double": "Δύο φορές",
"triple": "Τρεις φορές",
"long": "Ένας μακρύς",
"custom": "Προσαρμοσμένο"
},
"n1": "Ήχος (× 100 ms)",
"n1Hint": "π.χ. 3 = 300 ms",
"n2": "Παύση (× 100 ms)",
"n2Hint": "Η παύση ανάμεσα στους ήχους",
"n3": "Φορές",
"n3Hint": "Πόσοι ήχοι",
"testHint": "Ακούστε τον σε έναν εκτυπωτή.",
"test": "Δοκιμή ήχου"
}
}
}
+25
View File
@@ -130,5 +130,30 @@
"quantity": "Quantity",
"missing": "Still to choose: {{list}}"
}
},
"printProblems": {
"title": "Tickets that didn't print",
"count_one": "{{count}} ticket didn't print",
"count_other": "{{count}} tickets didn't print",
"none": "Everything printed.",
"close": "Close",
"notOn": "Not printed on {{printer}}",
"since": "since {{time}}",
"tries_one": "{{count}} try",
"tries_other": "{{count}} tries",
"sentBy": "sent by {{names}}",
"retry": "Print again",
"sendTo": "Send to another printer",
"send": "Send there",
"handled": "Handled",
"handledHint": "Told the kitchen another way: stop trying and stop warning.",
"stillNot": "Still not printing on {{printer}}.",
"failed": "That didn't work.",
"whatNow": "What to do",
"done": {
"retry": "Printed on {{printer}}",
"redirect": "Printed on {{printer}}",
"handled": "Marked as handled"
}
}
}
+6 -1
View File
@@ -260,7 +260,8 @@
},
"print_job": {
"not_found": "That print job isn't there any more.",
"not_pending": "Only tickets still waiting to print can be cancelled."
"not_pending": "Only tickets still waiting to print can be cancelled.",
"done": "That ticket isn't waiting any more: it was printed or dealt with on another screen."
},
"table": {
"not_found": "Table not found.",
@@ -337,5 +338,9 @@
"bad_zone": "That zone no longer exists.",
"bad_background": "The background must be a picture from the media library.",
"bad_layout": "The layout has a table twice or a place that is not a number."
},
"print": {
"printer_off": "The printer {{printer}} is turned off in the settings.",
"redirect_failed": "{{printer}} didn't print it either ({{error}}). The ticket is still waiting."
}
}
+226 -14
View File
@@ -1337,20 +1337,6 @@
"closed": "Closed",
"cancelled": "Cancelled"
},
"prints": {
"title": "Waiting to print",
"count_one": "{{count}} order hasn't printed",
"count_other": "{{count}} orders haven't printed",
"all": "Print all",
"retries_one": "{{count}} retry",
"retries_other": "{{count}} retries",
"lines_one": "{{count}} line waiting",
"lines_other": "{{count}} lines waiting",
"open": "Details",
"print": "Print",
"done": "Printed",
"failed": "Didn't print: {{printers}}"
},
"notes": {
"title": "Notes & to-dos",
"counts": "{{notes}} notes · {{todos}} open to-dos"
@@ -2353,6 +2339,232 @@
"save": "Save",
"saved": "Flags saved",
"sent": "Flags saved and message sent"
},
"printHelp": "Tickets are tried again every 8 seconds until they print. If a printer is off or out of paper, send them to another one, or mark them handled once the kitchen knows."
},
"printing": {
"back": "Back",
"save": "Save",
"close": "Close",
"up": "Move up",
"down": "Move down",
"zones": {
"title": "Prep zones",
"intro": "Where each dish's ticket prints, and how the kitchen screen treats it. Dishes are put in zones in the product editor.",
"new": "New zone",
"none": "No prep zones yet",
"noneHint": "Make one for the kitchen and one for the bar, then put the dishes in them.",
"edit": "Edit {{name}}",
"delete": "Delete {{name}}",
"deleteTitle": "Delete {{name}}?",
"deleteBody": "Its dishes stop printing anywhere until they are put in another zone.",
"deleteYes": "Delete",
"deleted": "Zone deleted",
"main": "Main",
"also": "Also",
"noPrinter": "No printer",
"noPrinters": "There are no printers yet: add them in Settings → Printing.",
"newTitle": "New prep zone",
"editTitle": "{{name}}",
"created": "Zone made",
"saved": "Zone saved",
"about": "The zone",
"name": "Name",
"namePh": "e.g. Kitchen, Grill, Bar",
"nameNeeded": "Give the zone a name.",
"shown": "Name in messages",
"shownHint": "What staff see when this zone has something ready (e.g. \"Kitchen\").",
"description": "Description",
"language": "Ticket language",
"languageHint": "The language its tickets print in.",
"venueLanguage": "The venue's language",
"printers": "Printing",
"auto": "What prints",
"autoShort": {
"none": "Doesn't print",
"master": "Main printer",
"all": "All its printers"
},
"autoHint": {
"none": "The dishes only show on the kitchen screen.",
"master": "One ticket on the main printer.",
"all": "The main printer and every other one ticked."
},
"mainPrinter": "Main printer",
"mainHint": "Where the ticket prints.",
"printerNeeded": "Pick the printer the tickets go to.",
"secondPrinters": "Other printers",
"secondTip": "Used when \"All its printers\" is chosen, e.g. a copy for the pass.",
"mainCopies": "Copies on the main printer",
"secondCopies": "Copies on the others",
"ticket": "The ticket",
"sort": "Order of the dishes",
"sortShort": {
"order_time": "As ordered",
"item_count": "Most first",
"alpha": "A to Z"
},
"sortHint": {
"order_time": "In the order they were added.",
"item_count": "The largest quantities first.",
"alpha": "By name."
},
"byCategory": "Grouped by category",
"byCategoryTip": "Dishes of the same category print together, under its name.",
"categoryOrder": "Order of the categories",
"categoryOrderHint": "The categories print in this order; the rest follow.",
"categoryOrderReset": "Back to the menu's order",
"checkboxes": "Boxes to tick",
"checkboxesTip": "Prints [ ] before each dish, for the cooks to tick off.",
"kds": "The kitchen screen",
"startReady": "Start as ready",
"startReadyTip": "Dishes skip \"waiting\" and \"preparing\" and show as ready at once (drinks, beers).",
"skipKds": "Skip the kitchen screen",
"skipKdsTip": "Dishes go straight to served and never show on the kitchen screen. Turns on \"Start as ready\" too.",
"readyServed": "Ready means served",
"readyServedTip": "When the cook marks a dish ready on the kitchen screen, it counts as served too."
},
"printers": {
"title": "Printers",
"intro": "The kitchen and bar printers on the venue's network.",
"add": "Add a printer",
"find": "Find printers",
"none": "No printers yet.",
"on": "{{name}} on",
"codepage": "Code page {{n}}",
"chars_one": "{{count}} character a line",
"chars_other": "{{count}} characters a line",
"checking": "Checking…",
"answers": "Answers",
"noAnswer": "Doesn't answer",
"test": "Test print",
"testSent": "Test print sent",
"testFailed": "It didn't print: {{error}}",
"edit": "Edit {{name}}",
"remove": "Remove {{name}}",
"removeTitle": "Remove {{name}}?",
"removeBody": "Zones that print on it will need another printer.",
"removeYes": "Remove",
"removed": "Printer removed",
"addTitle": "Add a printer",
"editTitle": "{{name}}",
"added": "Printer added",
"saved": "Printer saved",
"name": "Name",
"namePh": "e.g. Kitchen",
"address": "Address (IP)",
"addressHint": "Printed on the printer's self-test page.",
"port": "Port",
"model": "Model",
"modelHint": "Sets the Greek letters the printer understands.",
"width": "Characters a line",
"widthHint": "48 for 80 mm paper, 32 for 58 mm.",
"wrong": {
"name": "Give the printer a name.",
"ip_address": "An address like 192.168.1.50.",
"port": "A port from 1 to 65535 (usually 9100).",
"line_width": "Between 20 and 80."
},
"findTitle": "Find printers",
"findBody": "Looks for devices on the network that answer on the printing port.",
"subnet": "Network",
"scan": "Search",
"stop": "Stop",
"scanned": "{{done}} of {{total}} addresses checked",
"scanStart": "Press Search to look.",
"foundNone": "No printers found.",
"scanFailed": "The search didn't work.",
"use": "Use"
},
"ticket": {
"layout": "Ticket layout",
"mode": "Layout",
"modeTip": "Detailed: each choice on its own line, easiest to read. Compact: choices of one kind on one line, less paper.",
"modes": {
"detailed": "Detailed",
"compact": "Compact"
},
"testHint": "Print a made-up order with every kind of choice, to see the settings on paper.",
"testOn": "Printer for the test",
"testOrder": "Print a test ticket",
"testSent": "Sent to the printer",
"fonts": "Letters",
"fontsHint": "Each part of the ticket's size, bold and capitals. Changes apply from the next ticket.",
"groups": {
"header": "The top",
"items": "The dishes",
"notes": "Notes"
},
"parts": {
"order_number": "Order number",
"meta": "Table · waiter · time",
"item_name": "Dish name",
"quick": "Quick add-ons (*)",
"pref": "Preferences (>)",
"extra": "Extras (+)",
"ingredient": "Left out (-)",
"item_note": "A dish's note",
"order_note": "The order's note"
},
"partsHint": {
"order_number": "The ticket's heading: \"Order #42\".",
"meta": "The lines under the number.",
"item_name": "Each dish, with the dot leader to its quantity.",
"quick": "Add-ons picked with one tap.",
"pref": "Cooking, sides and other choices.",
"extra": "Extras added to a dish.",
"ingredient": "\"WITHOUT\" lines.",
"item_note": "Free text written for one dish.",
"order_note": "The note for the whole order."
},
"sizes": {
"0": "Normal",
"16": "Tall",
"32": "Wide",
"48": "Tall and wide"
},
"bold": "Bold",
"caps": "CAPITALS",
"wideNote": "Wide letters fit about half as many characters on a line: keep it for short texts.",
"dots": "Dot leader",
"dotsHint": "The characters between a dish and its quantity.",
"dotsSize": "Dot leader size",
"dotsSample": "Steak {{dots}} x2",
"dotStyles": {
"dot_space": "Dots with spaces",
"dot": "Dots",
"dash_space": "Dashes with spaces",
"underscore": "Underscores"
},
"divider": "Dividers",
"dividerHint": "The line between the ticket's parts.",
"emptyLine": "(an empty line)",
"dividers": {
"dash": "Dashes ( - )",
"equals": "Equals ( = )",
"star": "Stars ( * )",
"empty": "An empty line"
}
},
"beep": {
"title": "Beep",
"intro": "The printer beeps to tell the kitchen a ticket came in.",
"presets": {
"off": "No beep",
"single": "Once",
"double": "Twice",
"triple": "Three times",
"long": "One long",
"custom": "Custom"
},
"n1": "On (× 100 ms)",
"n1Hint": "e.g. 3 = 300 ms",
"n2": "Off (× 100 ms)",
"n2Hint": "The pause between beeps",
"n3": "Times",
"n3Hint": "How many beeps",
"testHint": "Hear it on a printer.",
"test": "Test the beep"
}
}
}
+4 -2
View File
@@ -7,13 +7,15 @@
"main": "src/index.js",
"exports": {
".": "./src/index.js",
"./cart": "./src/cart.js"
"./cart": "./src/cart.js",
"./printProblems": "./src/printProblems.js"
},
"dependencies": {
"@xenia/access": "^0.0.0",
"@xenia/i18n": "^0.0.0",
"@xenia/ui": "^0.0.0",
"lucide-react": "^1.73.0"
"lucide-react": "^1.73.0",
"@xenia/api": "^0.0.0"
},
"scripts": {
"test": "node --test \"tests/*.test.mjs\""
@@ -0,0 +1,76 @@
// The tickets that didn't print (plan step 6.10), for the manager and the counter POS: per
// ticket where it belongs, which printer, since when, how many tries, what's on it and who sent
// it; then Print again, Send to another printer, or Handled (told the kitchen another way).
// `run(kind, problem, printerId)` does the request and resolves (or throws the API error);
// the list itself comes back through the live event, so this keeps no copy of it.
import { useState } from 'react'
import { CheckCheck, Printer, RotateCw, Send } from 'lucide-react'
import { errorMessage } from '@xenia/api'
import { useFormat, useTranslation } from '@xenia/i18n'
import { Button, Select } from '@xenia/ui'
import { itemsText, otherPrinters, placeOf } from './printProblems.js'
export function PrintProblemsPanel({ problems, printers = [], run, onOpen, showPlace = true }) {
return (
<ul className="divide-y divide-line" data-testid="print-problems">
{problems.map(p => (
<Problem key={p.job_id} problem={p} printers={printers} run={run} onOpen={onOpen} showPlace={showPlace} />
))}
</ul>
)
}
function Problem({ problem: p, printers, run, onOpen, showPlace }) {
const { t } = useTranslation('common')
const { formatTime } = useFormat()
const others = otherPrinters(p, printers)
const [to, setTo] = useState(others[0] ? String(others[0].id) : '')
const [busy, setBusy] = useState(null)
const [error, setError] = useState(null)
async function act(kind, printerId) {
setBusy(kind)
setError(null)
try { await run(kind, p, printerId) } catch (err) { setError(errorMessage(err, t)) } finally { setBusy(null) }
}
return (
<li className="px-4 py-3 grid gap-2" data-testid="print-problem" data-job={p.job_id} data-order={p.order_id}>
<div className="flex flex-wrap items-center gap-x-3 gap-y-1">
{showPlace && (
<button type="button" className="text-body-lg font-bold text-ink hover:underline disabled:no-underline" disabled={!onOpen} onClick={() => onOpen?.(p)}>
{placeOf(p)}
</button>
)}
<span className="inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-danger-soft text-danger-ink text-caption font-semibold">
<Printer size={12} aria-hidden="true" />{t('printProblems.notOn', { printer: p.printer.name })}
</span>
<span className="text-caption text-ink-2">
{t('printProblems.since', { time: formatTime(p.since) })} · {t('printProblems.tries', { count: p.attempts })}
{p.sent_by?.length > 0 && ` · ${t('printProblems.sentBy', { names: p.sent_by.join(', ') })}`}
</span>
</div>
<div className="text-body text-ink">{itemsText(p)}</div>
{p.error && <div className="text-caption text-ink-3 truncate" title={p.error}>{p.error}</div>}
<div className="flex flex-wrap items-center gap-2">
<Button size="sm" variant="secondary" icon={<RotateCw size={14} />} loading={busy === 'retry'} disabled={!!busy} onClick={() => act('retry')} data-testid="problem-retry">
{t('printProblems.retry')}
</Button>
{others.length > 0 && (
<span className="flex items-center gap-1">
<Select size="sm" value={to} onChange={e => setTo(e.target.value)} aria-label={t('printProblems.sendTo')} data-testid="problem-printer"
options={others.map(o => ({ value: String(o.id), label: o.name }))} />
<Button size="sm" icon={<Send size={14} />} loading={busy === 'redirect'} disabled={!!busy || !to} onClick={() => act('redirect', Number(to))} data-testid="problem-redirect">
{t('printProblems.send')}
</Button>
</span>
)}
<Button size="sm" variant="ghost" icon={<CheckCheck size={14} />} loading={busy === 'handled'} disabled={!!busy} onClick={() => act('handled')} data-testid="problem-handled"
title={t('printProblems.handledHint')}>
{t('printProblems.handled')}
</Button>
</div>
{error && <p role="alert" className="text-label text-danger-ink">{error}</p>}
</li>
)
}
+4 -1
View File
@@ -1,6 +1,9 @@
// @xenia/ordering (plan step 6.9): what a person chooses for a product and how it becomes a line
// the server prices (line ids, 4.4), one implementation for the counter POS, the menu tablet and
// the manager's ordering. Pure rules in ./cart (Node-testable); the dialog and the quote hook.
// the manager's ordering. Pure rules in ./cart (Node-testable); the dialog and the quote hook;
// printing problems (6.10): their pure rules and the panel the manager and the counter show.
export * from './cart.js'
export { ProductDialog } from './ProductDialog.jsx'
export { useQuote } from './useQuote.js'
export * from './printProblems.js'
export { PrintProblemsPanel } from './PrintProblemsPanel.jsx'
+43
View File
@@ -0,0 +1,43 @@
// Printing problems (plan step 6.10), as plain data for every app: GET /api/print-problems
// gives { problems, printers }; a problem is one ticket (an order's lines for one printer)
// that didn't print. Node-tested (tests/printProblems.test.mjs).
export const PRINT_EVENT = 'print.problems'
/** The problems of one order (the order and table pages show only theirs). */
export const problemsOf = (problems = [], orderId) => problems.filter(p => p.order_id === orderId)
/** The printers this ticket can be sent to instead (any but its own). */
export const otherPrinters = (problem, printers = []) => printers.filter(p => p.id !== problem.printer.id)
/** "2× Burger, Freddo": what the ticket holds. */
export function itemsText(problem) {
return problem.items.map(i => (i.quantity !== 1 || i.unit_type !== 'piece' ? `${i.quantity}× ${i.name}` : i.name)).join(', ')
}
/** Where the ticket belongs: the table's name, else the order number. */
export const placeOf = problem => problem.table_name || `#${problem.order_id}`
/** Minutes since the first try (whole minutes, never negative). */
export function minutesSince(problem, now = Date.now()) {
const t = problem.since ? new Date(/[zZ]|[+-]\d\d:?\d\d$/.test(problem.since) ? problem.since : `${problem.since}Z`).getTime() : now
return Math.max(0, Math.floor((now - t) / 60_000))
}
/** One line per printer with how many tickets wait on it (the counter's and the phones' summary). */
export function byPrinter(problems = []) {
const out = new Map()
for (const p of problems) {
const e = out.get(p.printer.id) ?? { printer: p.printer, count: 0 }
e.count += 1
out.set(p.printer.id, e)
}
return [...out.values()]
}
/** The request for an action: 'retry' | 'redirect' (with a printer) | 'handled'. → [url, body] */
export function actionRequest(kind, problem, printerId) {
const base = `/api/print-problems/${problem.job_id}`
if (kind === 'redirect') return [`${base}/redirect`, { printer_id: printerId }]
return [`${base}/${kind}`, {}]
}
@@ -0,0 +1,29 @@
// Printing problems as plain data (plan step 6.10).
import { test } from 'node:test'
import assert from 'node:assert/strict'
import { actionRequest, byPrinter, itemsText, minutesSince, otherPrinters, placeOf, problemsOf } from '../src/printProblems.js'
const p = (job, order, printer, extra = {}) => ({
job_id: job, order_id: order, table_name: null, printer: { id: printer, name: `P${printer}` },
items: [{ name: 'Burger', quantity: 2, unit_type: 'piece' }, { name: 'Freddo', quantity: 1, unit_type: 'piece' }],
since: '2026-11-19T10:00:00', ...extra,
})
test('what a ticket holds, where it belongs, how long it waits', () => {
const a = p(1, 7, 1, { table_name: 'T5' })
assert.equal(itemsText(a), '2× Burger, Freddo')
assert.equal(placeOf(a), 'T5')
assert.equal(placeOf(p(2, 8, 1)), '#8')
assert.equal(minutesSince(a, Date.parse('2026-11-19T10:07:30Z')), 7) // a time without a zone is UTC
assert.equal(minutesSince({ ...a, since: '2026-11-19T10:00:00+02:00' }, Date.parse('2026-11-19T08:03:00Z')), 3)
})
test('per order, per printer, the printers to send to, the requests', () => {
const list = [p(1, 7, 1), p(2, 7, 2), p(3, 8, 1)]
assert.deepEqual(problemsOf(list, 7).map(x => x.job_id), [1, 2])
assert.deepEqual(byPrinter(list).map(x => [x.printer.id, x.count]), [[1, 2], [2, 1]])
assert.deepEqual(otherPrinters(list[0], [{ id: 1 }, { id: 2 }, { id: 3 }]).map(x => x.id), [2, 3])
assert.deepEqual(actionRequest('redirect', list[0], 3), ['/api/print-problems/1/redirect', { printer_id: 3 }])
assert.deepEqual(actionRequest('handled', list[0]), ['/api/print-problems/1/handled', {}])
assert.deepEqual(actionRequest('retry', list[0]), ['/api/print-problems/1/retry', {}])
})