feat: online ordering settings (services, hours, preparation, slots) and the order app e2e (platform-v2 3S, S.4)

- connect_orders.ordering setting; GET/PUT /api/connect/fees/ordering (validated:
  services, hours per day incl. past midnight, preparation, slot minutes, days ahead,
  ASAP); pushed to the cloud with the menu (snapshot `ordering`).
- Manager: the Online ordering page gains "Services and hours" (OrderingSettings.jsx; logic
  in feesLogic.js, unit-tested); nav label "Online ordering".
- tests/e2e/order_app.mjs: a real cloud + the built order app in a phone-sized browser:
  takeaway and delivery placed, priced by the cloud (fee by area, minimum refused), the
  site moves the delivery to delivered and the page follows; a rejection with its reason;
  Greek. In run-all, with the order app's unit tests.
- Tests: backend +1 (406), manager unit +1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 13:39:13 +02:00
co-authored by Claude Opus 5.5
parent df27133af9
commit 8ea44d71aa
12 changed files with 507 additions and 11 deletions
@@ -102,3 +102,30 @@ export function previewBody(form) {
time: form.day === 'now' ? null : (form.time || null),
}
}
/** Online ordering settings (S.4) → the form: hours as editable rows per day. */
export function orderingToForm(o) {
const hours = o?.hours ?? {}
return {
services: o?.services ?? [], anyTime: Object.keys(hours).length === 0,
days: DAYS.map(d => (hours[String(d)] ?? []).map(([from, to]) => ({ from, to }))),
prep_minutes: String(o?.prep_minutes ?? 20), slot_minutes: String(o?.slot_minutes ?? 15),
days_ahead: String(o?.days_ahead ?? 0), asap: o?.asap ?? true,
}
}
/** The form → PUT /api/connect/fees/ordering. A day without ranges is closed (unless any time). */
export function orderingBody(form) {
const hours = {}
if (!form.anyTime) {
form.days.forEach((ranges, d) => {
const clean = ranges.filter(r => r.from && r.to && r.from !== r.to).map(r => [r.from, r.to])
if (clean.length) hours[String(d)] = clean
})
}
const int = (v, dflt) => (Number.isFinite(Number(v)) && String(v).trim() !== '' ? Math.round(Number(v)) : dflt)
return {
services: form.services, hours, prep_minutes: int(form.prep_minutes, 20), slot_minutes: int(form.slot_minutes, 15),
days_ahead: int(form.days_ahead, 0), asap: !!form.asap,
}
}