feat(backend,manager): the business day opens and closes by itself (opening hours, a time, or only an alert)

- services/day_auto.py: a minute loop (venue time, offline) opens the day when the opening
  hours start (or at business_day.auto_open_time) and closes it when they end (or at
  auto_close_time); 'alert' only tells the managers. Offsets before / after, one day across
  the break or one per span, spans past midnight belong to the day they start, a day closed
  by hand isn't reopened in the same span, a restart catches up the open (until the business
  date changes for 'time') and alerts a missed close instead of doing it late.
- The close runs only when no order of the day is unclosed (Q-10): otherwise a sticky alert
  and a new try every 15 minutes. A locked / expired license turns the open into an alert.
- Sticky notifications: notifications.resolved_at + core.notifications.resolve(); the
  alerts resolve when the day opens / closes (by hand or by itself).
- services/business_days.py: the one open / close path (the routes and the loop); days opened
  or closed by the system have no opener / closer and opened_auto / closed_auto (Alembic 0052).
- Manager: Settings -> Operation "Opening and closing the day"; the bell's action buttons
  ("Open now", "Go to the overview"); Reports -> Days marks days opened / closed by itself.

Plan platform-v2 6F.8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 13:17:15 +02:00
co-authored by Claude Opus 5.5
parent 7706bf2470
commit 096bd53dbd
21 changed files with 856 additions and 117 deletions
+47 -2
View File
@@ -368,7 +368,12 @@
"empty": "Τίποτα καινούργιο. Εδώ εμφανίζονται ειδοποιήσεις για την άδεια, την εκτύπωση και την υποστήριξη.",
"markAll": "Όλες διαβασμένες",
"times_one": "{{count}} φορά",
"times_other": "{{count}} φορές"
"times_other": "{{count}} φορές",
"dayOpened": "Η ημέρα άνοιξε",
"actions": {
"open_day": "Άνοιγμα τώρα",
"overview": "Στην επισκόπηση"
}
},
"settings": {
"saved": "Αποθηκεύτηκε",
@@ -797,6 +802,43 @@
},
"max": "Μέγιστα ίσα μέρη",
"maxHint": "Τα μέρη ξεκινούν από τους πελάτες του τραπεζιού, όταν υπάρχουν."
},
"autoDay": {
"title": "Άνοιγμα και κλείσιμο της ημέρας",
"intro": "Η εργάσιμη ημέρα μπορεί να ανοίγει και να κλείνει μόνη της, στο ωράριο (σελίδα Πρόγραμμα) ή σε δική της ώρα. Δουλεύει και χωρίς ίντερνετ.",
"open": "Η ημέρα ανοίγει",
"openHint": "Μια ημέρα που έκλεισε υπεύθυνος με το χέρι δεν ξανανοίγει πριν το επόμενο άνοιγμα.",
"openTip": "Στο ωράριο: η ημέρα ανοίγει όταν αρχίζει το ωράριο. Σε ώρα: κάθε μέρα εκείνη την ώρα, όποιο κι αν είναι το ωράριο. Μόνο ειδοποίηση: οι υπεύθυνοι παίρνουν μήνυμα που μένει μέχρι να ανοίξει η ημέρα, με κουμπί «Άνοιγμα τώρα».",
"close": "Η ημέρα κλείνει",
"closeHint": "Κλείνει μόνο όταν έχουν κλείσει όλα τα τραπέζια· αλλιώς ειδοποιείστε και ξαναδοκιμάζει κάθε 15 λεπτά.",
"closeTip": "Οι ανοιχτές βάρδιες τελειώνουν όπως σε χειροκίνητο κλείσιμο. Αν ο server ήταν κλειστός την ώρα του κλεισίματος, η ημέρα δεν κλείνει αργότερα μόνη της: ειδοποιείστε.",
"modes": {
"open": {
"off": "Με το χέρι",
"schedule": "Μόνη της στο ωράριο",
"time": "Μόνη της σε ώρα",
"alert": "Μόνο ειδοποίηση στο ωράριο"
},
"close": {
"off": "Με το χέρι",
"schedule": "Μόνη της στο τέλος του ωραρίου",
"time": "Μόνη της σε ώρα",
"alert": "Μόνο ειδοποίηση στο τέλος του ωραρίου"
}
},
"openTime": "Ανοίγει στις",
"closeTime": "Κλείνει στις",
"openOffset": "Άνοιγμα νωρίτερα",
"closeOffset": "Κλείσιμο αργότερα",
"offsetNone": "Ακριβώς στο ωράριο",
"before_one": "{{count}} λεπτό πριν",
"before_other": "{{count}} λεπτά πριν",
"after_one": "{{count}} λεπτό μετά",
"after_other": "{{count}} λεπτά μετά",
"ignoreBreak": "Μία ημέρα και με διάλειμμα",
"ignoreBreakHint": "Κλειστό: το διάλειμμα ανάμεσα σε δύο διαστήματα κλείνει την ημέρα και το επόμενο ανοίγει νέα.",
"ignoreBreakTip": "Με ωράριο 12:00–16:00 και 19:00–23:00: ανοιχτό = μία ημέρα 12:00–23:00· κλειστό = δύο ημέρες.",
"noHours": "Δεν υπάρχει ακόμα ωράριο: ορίστε το στη σελίδα Πρόγραμμα, αλλιώς δεν γίνεται τίποτα."
}
},
"logs": {
@@ -4082,7 +4124,10 @@
"anyTable": "Κάθε τραπέζι",
"cancelledLines": "Ακυρωμένες γραμμές",
"ordersCount_one": "{{count}} παραγγελία · {{total}}",
"ordersCount_other": "{{count}} παραγγελίες · {{total}}"
"ordersCount_other": "{{count}} παραγγελίες · {{total}}",
"autoBoth": "Άνοιξε και έκλεισε μόνη της",
"autoOpened": "Άνοιξε μόνη της",
"autoClosed": "Έκλεισε μόνη της"
},
"traffic": {
"orders": "Παραγγελίες",
+47 -2
View File
@@ -368,7 +368,12 @@
"empty": "Nothing new. Licence, printing and support alerts show up here.",
"markAll": "Mark all as read",
"times_one": "{{count}} time",
"times_other": "{{count}} times"
"times_other": "{{count}} times",
"dayOpened": "The day is open",
"actions": {
"open_day": "Open now",
"overview": "Go to the overview"
}
},
"settings": {
"saved": "Saved",
@@ -797,6 +802,43 @@
},
"max": "The most equal parts",
"maxHint": "The parts start at the table's customers when it has some."
},
"autoDay": {
"title": "Opening and closing the day",
"intro": "The business day can open and close by itself, at the opening hours (Schedule page) or at a time of its own. It works without the internet.",
"open": "The day opens",
"openHint": "A day a manager closed by hand isn't reopened before the next opening.",
"openTip": "At the opening hours: the day opens when the hours start. At a time: every day at that time, whatever the hours. Only alert: managers get a message that stays until the day is opened, with an \"Open now\" button.",
"close": "The day closes",
"closeHint": "Closes only when every table is closed; otherwise you're alerted and it tries again every 15 minutes.",
"closeTip": "Open shifts end as with a manual close. If the server was off at closing time, the day isn't closed later by itself: you're alerted instead.",
"modes": {
"open": {
"off": "By hand",
"schedule": "By itself at the opening hours",
"time": "By itself at a time",
"alert": "Only alert at the opening hours"
},
"close": {
"off": "By hand",
"schedule": "By itself at the end of the opening hours",
"time": "By itself at a time",
"alert": "Only alert at the end of the opening hours"
}
},
"openTime": "Opens at",
"closeTime": "Closes at",
"openOffset": "Open earlier",
"closeOffset": "Close later",
"offsetNone": "Exactly at the hours",
"before_one": "{{count}} minute before",
"before_other": "{{count}} minutes before",
"after_one": "{{count}} minute after",
"after_other": "{{count}} minutes after",
"ignoreBreak": "One day across the break",
"ignoreBreakHint": "Off: the break between two opening spans closes the day and the next span opens a new one.",
"ignoreBreakTip": "With hours 12:00–16:00 and 19:00–23:00: on = one day from 12:00 to 23:00; off = two days.",
"noHours": "No opening hours yet: set them on the Schedule page, or nothing happens."
}
},
"logs": {
@@ -4082,7 +4124,10 @@
"anyTable": "Any table",
"cancelledLines": "Cancelled lines",
"ordersCount_one": "{{count}} order · {{total}}",
"ordersCount_other": "{{count}} orders · {{total}}"
"ordersCount_other": "{{count}} orders · {{total}}",
"autoBoth": "Opened and closed by itself",
"autoOpened": "Opened by itself",
"autoClosed": "Closed by itself"
},
"traffic": {
"orders": "Orders",