feat: staff and the schedule on v2; managers give staff passwords (platform-v2 step 6.11, KI-014)

- staff: PUT /api/waiters/{id}/password (set, change, or take away; 6+ chars)
  so the password sign-in mode works for everyone; PUT /{id}/pin with the PIN in
  the body (was in the address: reset-pin?pin= removed); PINs 4-6 digits when
  adding; a password can be given when adding; has_password on staff; editing
  clears emptied fields and keeps usernames unique; delete only without history
  (orders, items, shifts) and never yourself
- schedule: times checked (schedule.bad_time), one person's overlapping shifts
  refused (schedule.overlap, past midnight understood), everyone active can be
  scheduled (the kitchen too), changes need core.staff.manage
- manager: src/pages/staff (list with search and filters, person dialog with
  photo, PIN / password dialog, zones) and src/pages/schedule (by person, by
  hour with opening hours, shift dialog with clash check, view settings kept in
  the browser); the never-used "automatic start/close" switches dropped; v1
  StaffTab and SchedulePage removed; ApprovalsPage loads with useLiveQuery
- tests: test_staff_v2.py (done-when on a paired screen), staff.test.mjs, e2e
  manager.mjs (add, password, sign-in on a paired till, a shift and a clash)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 08:05:01 +02:00
co-authored by Claude Opus 5.5
parent f31bdf42aa
commit 6643614ff6
27 changed files with 1554 additions and 1794 deletions
+3
View File
@@ -21,6 +21,7 @@ class UserBase(BaseModel):
class UserCreate(UserBase):
pin: str
password: Optional[str] = None # 6.11: for the password sign-in mode (6+ characters)
class UserUpdate(BaseModel):
@@ -51,6 +52,7 @@ class UserOut(UserBase):
zone_assignments: List[WaiterZoneOut] = []
waiter_settings: Optional[str] = None # JSON blob — per-waiter settings + favorites
permissions: List[str] = [] # permission keys (D-7); superadmin: [] = implicit all
has_password: bool = False # 6.11: can sign in by password (never the password itself)
model_config = {"from_attributes": True}
@@ -65,6 +67,7 @@ class UserOut(UserBase):
if name != "permissions"}
data["zone_assignments"] = list(getattr(obj, "zone_assignments", None) or [])
data["permissions"] = sorted(user_keys(obj))
data["has_password"] = bool(getattr(obj, "password_hash", None))
return {k: v for k, v in data.items() if v is not None or k in ("full_name",)}