feat(signage): stacks, menu and text widgets, widget order (owner review 2)

- Stacks: horizontal / vertical, 2-6 parts with % shares; each part shows
  a widget, a stack one level deep, or a whole Slides-library slide
- Menu widget (a board's list in its box), text widget, weather for
  tomorrow / the day after and in picture / degrees / both styles
- Widgets' order (arrows, drag with a drop line), drawn in list order;
  arrow keys move the picked widget from its card too
- Server: extras by widget path (QR links, menus, embedded slides),
  POST /preview/slide, resolve(keep_hidden) so hidden products stay
  greyed in the editor's list; screens told when an embedded slide changes
- Editor rows tidied: framed sliders, colours as fields, text look on one
  row, Switch boxed toggles from its whole frame

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 09:44:23 +02:00
co-authored by Claude Opus 5.5
parent 83551714f7
commit 1b993e4573
23 changed files with 1231 additions and 377 deletions
+9 -5
View File
@@ -34,8 +34,11 @@ def _rank(order: list[int]):
return lambda v: (0, pos[v]) if v in pos else (1, 0)
def resolve(db, content: dict, now=None) -> dict:
"""{"groups": [{"category": {id, name} | None, "items": [...]}], "count": n} for a menu slide."""
def resolve(db, content: dict, now=None, keep_hidden: bool = False) -> dict:
"""{"groups": [{"category": {id, name} | None, "items": [...]}], "count": n} for a menu slide.
keep_hidden (the editor's list, 2026-11-21): products hidden from the board (`exclude_ids`) stay
in the list marked `"hidden": true` (greyed there, shown again with a click); `count` and the
TV leave them out."""
from models.product import Category, Product, ProductCategory
from services import media as media_store
from services.pos_cart import unit_prices
@@ -55,7 +58,8 @@ def resolve(db, content: dict, now=None) -> dict:
ids = in_cats | set(content.get("product_ids") or [])
products = q.filter(Product.id.in_(ids)).all() if ids else []
excluded = set(content.get("exclude_ids") or [])
products = [p for p in products if p.id not in excluded]
if not keep_hidden:
products = [p for p in products if p.id not in excluded]
point = content.get("sales_point")
if point:
@@ -89,7 +93,7 @@ def resolve(db, content: dict, now=None) -> dict:
"description": text(p, p.digital_description or p.description or None, "description") if content.get("show_descriptions") else None,
"price": round(prices[p.id], 2) if p.id in prices else None,
"available": bool(p.is_available), "image": image["card"] if image else None,
"badge": badges.get(p.id)}
"badge": badges.get(p.id), **({"hidden": True} if p.id in excluded else {})}
if content.get("group_by_category", True):
groups: dict = {}
@@ -101,4 +105,4 @@ def resolve(db, content: dict, now=None) -> dict:
else:
ordered = sorted(products, key=lambda p: (prod_rank(p.id), cat_key(p.primary_category_id), prod_key(p)))
out = [{"category": None, "items": [item(p) for p in ordered]}] if ordered else []
return {"groups": out, "count": len(products)}
return {"groups": out, "count": len([p for p in products if p.id not in excluded])}