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:
2026-11-23 21:55:36 +02:00
co-authored by Claude Opus 5.5
parent 0840247768
commit 6f42e00684
25 changed files with 844 additions and 40 deletions
+7
View File
@@ -78,6 +78,13 @@ export default function OnlinePanel({ order, onChanged }) {
<div className="text-body-lg font-semibold">{order.customer.name}</div>
{order.customer.phone && <Detail icon={Phone}>{order.customer.phone}</Detail>}
{order.customer.address && <Detail icon={MapPin}>{order.customer.address}{order.area ? ` · ${order.area}` : ''}</Detail>}
{/* 6R.G: the customer's pin, opened in a map (the driver's phone or the browser) */}
{order.pin && (
<a href={`https://www.openstreetmap.org/?mlat=${order.pin.lat}&mlon=${order.pin.lng}#map=18/${order.pin.lat}/${order.pin.lng}`}
target="_blank" rel="noreferrer" className="text-label text-accent-ink underline" data-testid="online-pin">
{t('pos.online.pin')}
</a>
)}
{order.customer.notes && (
<div className="p-2 rounded-control bg-warning-soft text-warning-ink flex gap-2">
<MessageSquare size={16} className="mt-0.5 shrink-0" aria-hidden="true" /><span>{order.customer.notes}</span>