feat(manager): notification bell, sign-in/venue/print settings, log download (platform-v2 2.6f)

- Bell in the header: /api/platform/notifications with unread count, live via
  the new LiveProvider (one createLiveClient connection) on platform_notification
  and reconnect; mark read / all; warning+critical pop a toast.
- Settings: Sign-in card (manager/waiter/device modes, require username, one
  session per manager/waiter, username autofill) replaces the dead v1
  security.login_method card; new "Venue & language" tab (language, time zone);
  print alert threshold in Printing. Tab labels are i18n keys.
- Technical > Log files: list + download of the daily logs (owner-level).
  Backend: GET /api/system/logs, /api/system/logs/{date} (core.settings.manage),
  error system.log_not_found.
- Setup wizard asks staff language and time zone (setup/init stores them).
- @xenia/ui theme helpers (applyTheme, getStoredTheme); the manager stays light
  until phase 6 converts the older pages (owner decision 2026-11-14).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 09:01:26 +02:00
co-authored by Claude Opus 5.5
parent 92bc1b0113
commit 2426ffddad
36 changed files with 995 additions and 92 deletions
+28
View File
@@ -26,6 +26,8 @@ class SetupInitRequest(BaseModel):
venue_type: Optional[str] = None
venue_name: Optional[str] = None
pin: Optional[str] = None
language: Optional[str] = None # venue.language (2.6f): v2 defaults to English otherwise
timezone: Optional[str] = None # venue.timezone, IANA (the browser's zone)
class SetupInitResponse(BaseModel):
@@ -81,6 +83,16 @@ def setup_init(body: SetupInitRequest, db: Session = Depends(get_db)):
if existing:
raise HTTPException(status_code=status.HTTP_409_CONFLICT, detail="Username already taken.")
from core import i18n, timeutil
from core.errors import XeniaError
if body.language and not i18n.is_supported(body.language):
raise XeniaError("validation.unknown_language", language=body.language)
if body.timezone:
try:
timeutil.validate_tz(body.timezone)
except ValueError:
raise XeniaError("validation.unknown_timezone", timezone=body.timezone)
password_hash = bcrypt.hashpw(body.password.encode(), bcrypt.gensalt()).decode()
raw_pin = body.pin if (body.pin and body.pin.isdigit() and 4 <= len(body.pin) <= 6) else "0000"
@@ -100,6 +112,19 @@ def setup_init(body: SetupInitRequest, db: Session = Depends(get_db)):
db.add(user)
# Persist venue settings if provided
from models.settings import PosSettings
def _put(key, value):
row = db.query(PosSettings).filter(PosSettings.key == key).first()
if row:
row.value = value
row.updated_at = utcnow()
else:
db.add(PosSettings(key=key, value=value, updated_at=utcnow()))
if body.language:
_put("venue.language", body.language)
if body.timezone:
_put("venue.timezone", body.timezone)
if body.venue_name or body.venue_type:
from models.settings import PosSettings
from datetime import datetime, timezone
@@ -120,6 +145,9 @@ def setup_init(body: SetupInitRequest, db: Session = Depends(get_db)):
db.add(PosSettings(key="venue.type", value=body.venue_type, updated_at=now))
db.commit()
if body.language or body.timezone:
i18n.invalidate()
timeutil.invalidate()
db.refresh(user)
add_user_to_system_group(db, user.id)
return SetupInitResponse(ok=True)