feat: delivery areas drawn on a map (plan 6R.G)
An area is a list of postcodes, a shape drawn on a map or a circle around a point. The fee engine (both copies, byte-identical) matches a shape only by the customer's pin, then postcodes; point-in-polygon (edges inside) and haversine circles; shared cases in fee_cases.json. - Alembic 0053: delivery_areas.kind / geometry, orders.online_lat / lng - /api/connect/fees: areas with kind + geometry (validated: 3-200 corners, 50 m - 50 km), the venue's place (PUT /venue-point, setting venue.location, sent to the cloud as fees.venue_point), preview by lat / lng - manager: DeliveryMap (Leaflet + OpenStreetMap tiles): draw / move / remove corners, circles, the venue on the map, an overview, test an order by a point - pulled online orders keep the pin; the site re-checks the fee with it; the counter links the pin to a map - tests: backend (shapes, venue point, pinned orders), manager logic, e2e manager.mjs and order_app.mjs 6R.G blocks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -45,7 +45,7 @@ The manager calls the API **same-origin, with relative paths**. The waiter app r
|
||||
| `local_backend/services/price_changes.py` | Prices changed by hand (6F.3): the venue switch `orders.price_change`, the keys, the reason, and one `PriceEventLog` row `manual_price` per change (stage cart / sent / served, approver) |
|
||||
| `local_backend/services/business_days.py`, `services/day_auto.py` | The one way to open / close the business day (the manager's buttons and the automatic loop, 6F.8). `day_auto` runs every minute from `main.py`'s lifespan: opening hours / a time / alert, closes only with no unclosed order (retry every 15 min), sticky alerts (`notifications.resolved_at`, `core.notifications.resolve`). Tests drive `tick(db, now=…)` with a fake clock |
|
||||
| `local_backend/core/sessions.py` | Sessions and sign-in rules; 6F.7: `auth.single_session_waiter` `ask` (the default; `auth.session_elsewhere`, `replace: true`), only the `waiter` client counts; `terminal_requires_username` (venue + `devices.require_username`) |
|
||||
| `local_backend/services/fees.py` | Delivery fee engine (phase 3S). **Byte-identical copy in `cloud-service/cloud_backend/services/fees.py`**: change both, and `tests/fixtures/fee_cases.json` in both; `tests/test_fees.py` fails if they differ |
|
||||
| `local_backend/services/fees.py` | Delivery fee engine (phase 3S). **Byte-identical copy in `cloud-service/cloud_backend/services/fees.py`**: change both, and `tests/fixtures/fee_cases.json` in both; `tests/test_fees.py` fails if they differ. **6R.G:** areas are `postcodes` \| `polygon` \| `circle` (`delivery_areas.kind` / `geometry`, Alembic 0053); a shape is matched only by the customer's pin (`point`); the venue's place is the setting `venue.location` (`routers/fees.py` `venue_point`, sent as `fees.venue_point`); the manager's map is `pages/online/DeliveryMap.jsx` (Leaflet + OpenStreetMap tiles, internet needed for the tiles only); pulled orders keep the pin (`orders.online_lat` / `online_lng`) |
|
||||
| `local_backend/services/sales.py`, `services/csv_export.py` | **How every report counts sales** (6.12a, 6.13c): sold = active, paid and tabbed lines (a tab line is sold, not paid), each net of what was refunded of it, system lines (the delivery fee) apart as fees; `Totals.on_tab`. **Split bills (6F.6), the settlement-line rule:** the lines settled by a split have status `split` and **are the sale** (products, categories, costs, the waiter); the split's **part lines** (`split_part` system lines) are **the money** (shift cash / card, payment methods, tabs, the day's takings) and never a product. Anything that picks lines by status uses `split_bills.sold_filter()` / `counts_as_sale()`; money paths keep reading `paid` lines. A refunded part comes off the settled lines by its share (`_split_refunds`). Every analytics endpoint, printed report and export uses it. Exports: UTF-8 mark, venue time with the zone in the header, `;` and decimal commas for a Greek venue |
|
||||
| `local_backend/services/tab_books.py` | **Tabs in the books** (6.13c, owner rule "every movement recorded"): a line put on a tab and a tab payment record the business day and the shift of whoever did it; `for_shift` / `for_day`. A shift's drawer adds the tab cash it received; money taken by someone with no shift is theirs, in the day, in no drawer |
|
||||
| `local_backend/services/refunds.py` | Refunds: their own records (`models/refund.py`), never edits of the paid items; shift / day totals subtract them |
|
||||
|
||||
Reference in New Issue
Block a user