diff --git a/docs/README.md b/docs/README.md index f140008..ee0f424 100644 --- a/docs/README.md +++ b/docs/README.md @@ -45,6 +45,7 @@ The manager calls the API **same-origin, with relative paths**. The waiter app r | `local_backend/services/system_products.py`, `services/online_check.py` | Lines the system adds itself (phase 3S): the delivery fee is an order line whose product has `system_key` and `lifecycle_status = "system"` (never on a menu or in the catalogue, never added by hand, added printed + served so the kitchen never sees it; paid, counted, receipted and refunded like any line). The site's own price check of a pulled online order (`orders.online_price_diff`): shown, never applied — the customer pays the cloud's prices | | `local_backend/services/online_reservations.py` | Table bookings from the online ordering app (phase 3S): stored as `Reservation` rows (`requested` → `pending` confirmed / `declined`; `arrived`, `cancelled`, `no_show`), food ordered ahead kept on the booking (`items_json`) and turned into an order **only at the fire time** (`fire_worker`, a connect_orders module worker; needs an open business day) or on early arrival. Every step mirrors the cloud status. The counter's Online → Bookings and `/api/connect/bookings/*` use it; the reservations router delegates online bookings to it | | `local_backend/services/table_qr.py`, `services/qr_orders.py` | The QR menu at the table (phase 3S): every active table has a random `qr_token`; the menu snapshot carries only its sha256 (`qr`), so the cloud can check a code but never make one. A new code (rotate) kills the printed one at the next push (`/api/tables` and `/api/connect/qr` are in `MENU_PATHS`). A QR order with a valid table goes straight onto the table's open order (or a new one), to the kitchen, with a `qr_order` message to the table's waiters; the audit row `QR_ORDER` (note = the cloud ref) keeps repeats out. Manager page `/online/qr` | +| `local_backend/routers/fees.py` | The venue's online ordering settings (`connect_orders.ordering`: services, hours, slots, ASAP; `reservations`: bookings, food ahead, fire minutes), delivery areas and fee rules, the fee line's name/VAT, and the venue's links (`links.order`, `links.menu` from the cloud's `apps_url`). Everything here travels to the cloud in the menu snapshot (contract C-2) | | `local_backend/routers/ws.py` | Real-time event stream (seq + cursor replay) | | `waiter_pwa/src/config/server.js` | **Where the backend is**: active venue, `apiBase()`, `wsUrl()`, `assetUrl()`, `storageKey()`, `dbName()`, `deliveryMode()` | | `waiter_pwa/android/`, `capacitor.config.json` | Native Android app (Capacitor 8). See "Native Android app" below | diff --git a/local_backend/routers/fees.py b/local_backend/routers/fees.py index fbc5f76..db41cb8 100644 --- a/local_backend/routers/fees.py +++ b/local_backend/routers/fees.py @@ -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]: diff --git a/local_backend/tests/test_online_site_side.py b/local_backend/tests/test_online_site_side.py index c296e3e..a11304c 100644 --- a/local_backend/tests/test_online_site_side.py +++ b/local_backend/tests/test_online_site_side.py @@ -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"} diff --git a/manager_dashboard/src/pages/online/FeesPage.jsx b/manager_dashboard/src/pages/online/FeesPage.jsx index 3b491ae..933eb3f 100644 --- a/manager_dashboard/src/pages/online/FeesPage.jsx +++ b/manager_dashboard/src/pages/online/FeesPage.jsx @@ -14,6 +14,7 @@ import { SALES_POINTS } from '@xenia/access' import { Button, Dialog, EmptyState, Field, IconButton, Input, Select, Spinner, Switch } from '@xenia/ui' import client from '../../api/client' import FeeProductCard from './FeeProductCard' +import OrderingLink from './OrderingLink' import OrderingSettings from './OrderingSettings' import { ACTIONS, DAYS, describeRule, emptyRule, moveRule, parsePostcodes, previewBody, ruleBody, ruleProblems, ruleToForm } from './feesLogic' @@ -57,6 +58,8 @@ export default function FeesPage() {
{t('orderingLink.intro')}
+ {url} +