feat(manager): the venue's online ordering link and QR code on the Online ordering page

Plan phase 3S, step S.99.
- GET /api/connect/fees returns `links` {order, menu}: the ordering app and QR menu
  addresses, from the cloud's apps_url (heartbeat) and the site id.
- Manager: "Your ordering link" card (OrderingLink.jsx) on Online ordering: the address, its
  QR code, copy / open / print, to share or put on the website and window.
- Pack README: routers/fees.py row.
- Tests: the link (backend), the card (manager e2e).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 01:36:02 +02:00
co-authored by Claude Opus 5.5
parent 652e6a26af
commit 18d580d87c
8 changed files with 66 additions and 1 deletions
+5 -1
View File
@@ -247,8 +247,12 @@ def list_fees(db: Session = Depends(get_db), user=Depends(require(KEY))):
from services import system_products
fee_product = system_products.get(db, system_products.DELIVERY_FEE)
db.commit()
from config import settings
from services.table_qr import apps_url, menu_url
return {**fees_payload(db), "ordering": ordering_settings(db),
"fee_product": {**system_products.out(fee_product), "vat_groups": _vat_groups(db)}}
"fee_product": {**system_products.out(fee_product), "vat_groups": _vat_groups(db)},
# the venue's ordering link (S.99): to share, print or put on the website
"links": {"order": f"{apps_url()}/order/{settings.SITE_ID or ''}", "menu": menu_url()}}
def _vat_groups(db) -> list[dict]:
@@ -168,3 +168,11 @@ def test_kitchen_ticket_shows_the_reference_and_the_time(db, menu):
assert _place(order, "None") == "ORD-0605"
order.requested_for = None
assert _online_meta(order)[1] == ("For:", "As soon as possible")
def test_the_venues_ordering_link(client, owner_h, monkeypatch):
from services import cloud_sync
monkeypatch.setitem(cloud_sync.license_state, "apps_url", "https://menu.example.com")
monkeypatch.setattr(cloud_sync.settings, "SITE_ID", "taverna-1")
links = client.get("/api/connect/fees", headers=owner_h).json()["links"]
assert links == {"order": "https://menu.example.com/order/taverna-1", "menu": "https://menu.example.com/menu/taverna-1"}