feat(connect): table bookings from the online ordering app; food fired to the kitchen before arrival
Plan phase 3S, step S.6. - Pull: "reservation" / "preorder" orders become Reservations waiting for an answer (status "requested"; services/online_reservations.py), with the food ordered ahead kept on the booking (items_json at the cloud's prices, the site's price check) — no order yet. Migration 0020 (reservations: online_order_cloud_id, online_ref, items_json, total, online_price_diff, fire_at, order_id, response_note). - Confirm → the food's fire time = booking time − fire minutes (setting); the fire worker (connect_orders, every 20 s) turns the food into an order at that time (needs an open business day; waits otherwise): kitchen tickets, KDS (reference and time). Early arrival fires at once. Seating moves the order to the table (refused if the table has an open order). Decline / cancel / no-show with a reason. Every step mirrored to the cloud. - Found: the KDS filter dropped every online order without an online status (SQL NULL in NOT(a AND b)) — made NULL-safe. - Counter: Online → Bookings (requests first, then upcoming), BookingPanel (confirm, decline with reasons, food and when it goes to the kitchen, seat at a free table, cancel, no-show); the Online badge and chime count booking requests. - Manager: Online ordering → Table bookings settings (on, food ahead, hours, slot, notice, days ahead, party size, fire minutes); the dashboard's reservations card confirms / declines online requests; the reservations router delegates online bookings' status steps. - Tests: tests/test_online_bookings.py (8), unit tests (terminal, manager), e2e: order app (book with food → the venue confirms), terminal (request → confirm → the two dishes reach the KDS at the fire time, not before → seated), manager (booking settings). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -51,15 +51,27 @@ test('moving rules and the test form', () => {
|
||||
})
|
||||
|
||||
test('online ordering settings: hours per day, any time, numbers', async () => {
|
||||
const { orderingBody, orderingToForm } = await import('../src/pages/online/feesLogic.js')
|
||||
const saved = { services: ['delivery'], hours: { 5: [['20:00', '02:00']] }, prep_minutes: 30, slot_minutes: 15, days_ahead: 1, asap: false }
|
||||
const { RES_DEFAULTS, orderingBody, orderingToForm } = await import('../src/pages/online/feesLogic.js')
|
||||
const saved = { services: ['delivery'], hours: { 5: [['20:00', '02:00']] }, prep_minutes: 30, slot_minutes: 15, days_ahead: 1, asap: false,
|
||||
reservations: RES_DEFAULTS }
|
||||
const form = orderingToForm(saved)
|
||||
assert.equal(form.anyTime, false)
|
||||
assert.deepEqual(form.days[5], [{ from: '20:00', to: '02:00' }])
|
||||
assert.deepEqual(orderingBody(form), saved)
|
||||
assert.deepEqual(orderingBody({ ...form, anyTime: true }).hours, {})
|
||||
const blank = orderingToForm(null)
|
||||
assert.deepEqual(orderingBody({ ...blank, prep_minutes: '' }), { services: [], hours: {}, prep_minutes: 20, slot_minutes: 15, days_ahead: 0, asap: true })
|
||||
assert.deepEqual(orderingBody({ ...blank, prep_minutes: '' }), { services: [], hours: {}, prep_minutes: 20, slot_minutes: 15, days_ahead: 0, asap: true, reservations: RES_DEFAULTS })
|
||||
form.days[0] = [{ from: '12:00', to: '12:00' }, { from: '', to: '15:00' }]
|
||||
assert.equal(orderingBody(form).hours['0'], undefined)
|
||||
})
|
||||
|
||||
test('table bookings online: settings round trip (S.6)', async () => {
|
||||
const { orderingBody, orderingToForm } = await import('../src/pages/online/feesLogic.js')
|
||||
const reservations = { enabled: true, with_food: true, hours: { 4: [['19:00', '23:30']] }, slot_minutes: 15, days_ahead: 14, notice_minutes: 90, party_max: 8, fire_minutes: 25 }
|
||||
const form = orderingToForm({ services: [], hours: {}, reservations })
|
||||
assert.equal(form.res.anyTime, false)
|
||||
assert.deepEqual(orderingBody(form).reservations, reservations)
|
||||
assert.deepEqual(orderingBody({ ...form, res: { ...form.res, enabled: false } }).reservations.with_food, false)
|
||||
assert.deepEqual(orderingBody({ ...form, res: { ...form.res, anyTime: true, party_max: '' } }).reservations,
|
||||
{ ...reservations, hours: {}, party_max: 10 })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user