feat(waiter): table bookings on the phone; shared ReasonPicker (platform-v2 step 4.8c)
- Waiter: Bookings (side drawer, for whoever has connect_orders.manage or reservations.manage, with the online-orders app on): requests made online are confirmed or declined with a reason the guest sees; confirmed ones are seated at a free table (its seats shown, a warning mark when the party is bigger) or cancelled / marked as a no-show; the food ordered ahead and its kitchen time; live updates. - Backend: the bookings routes take reservations.manage too (require_any). - @xenia/ui ReasonPicker + reasonText (gallery, unit test), first piece moved from the terminal (4.6 → 4.8): the counter's online reject and booking decline dialogs use it; the waiter loads @xenia/ui styles.css (the .x-* components; tokens as before). - Tests: waiter e2e +2 (request listed with the key, confirmed and seated from the phone); terminal.mjs and qr_table.mjs green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@ import { useState } from 'react'
|
||||
import { AlertTriangle, Ban, Banknote, Bike, Check, ChefHat, Clock, MapPin, MessageSquare, PackageCheck, Phone, ShoppingBag, Utensils } from 'lucide-react'
|
||||
import { errorMessage } from '@xenia/api'
|
||||
import { useFormat, useTranslation } from '@xenia/i18n'
|
||||
import { Button, Dialog, EmptyState, Input } from '@xenia/ui'
|
||||
import { Button, Dialog, EmptyState, ReasonPicker, reasonText } from '@xenia/ui'
|
||||
import client from '../../api/client'
|
||||
import { diffRows, finishWord as finishOf, kindOf, nextStep } from './logic/online'
|
||||
import { itemPayments, orderLines, orderSums, qtyLabel } from './logic/tables'
|
||||
@@ -190,7 +190,8 @@ function RejectDialog({ busy, error, onClose, onReject }) {
|
||||
const { t } = useTranslation('terminal')
|
||||
const [choice, setChoice] = useState(null)
|
||||
const [other, setOther] = useState('')
|
||||
const reason = choice === 'other' ? other.trim() : choice ? t(`pos.online.reasons.${choice}`) : ''
|
||||
const options = REASONS.map(r => ({ value: r, label: t(`pos.online.reasons.${r}`) }))
|
||||
const reason = reasonText(choice, options, other)
|
||||
return (
|
||||
<Dialog open size="sm" title={t('pos.online.rejectTitle')} onClose={busy ? undefined : onClose}
|
||||
footer={<>
|
||||
@@ -201,18 +202,8 @@ function RejectDialog({ busy, error, onClose, onReject }) {
|
||||
</>}>
|
||||
<div className="grid gap-2">
|
||||
<p className="text-body text-ink-2">{t('pos.online.rejectBody')}</p>
|
||||
<div className="grid gap-1" role="radiogroup" aria-label={t('pos.online.reason')}>
|
||||
{[...REASONS, 'other'].map(r => (
|
||||
<button key={r} type="button" role="radio" aria-checked={choice === r} onClick={() => setChoice(r)} data-testid={`reason-${r}`}
|
||||
className={`min-h-[var(--x-control-md)] px-3 rounded-control text-left text-body transition-colors duration-fast
|
||||
${choice === r ? 'bg-accent text-accent-fg' : 'bg-surface-2 text-ink hover:bg-surface-3'}`}>
|
||||
{t(`pos.online.reasons.${r}`)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{choice === 'other' && (
|
||||
<Input value={other} onChange={e => setOther(e.target.value)} maxLength={300} autoFocus aria-label={t('pos.online.reason')} data-testid="reason-text" />
|
||||
)}
|
||||
<ReasonPicker options={options} value={choice} onChange={setChoice} other={other} onOther={setOther}
|
||||
otherLabel={t('pos.online.reasons.other')} ariaLabel={t('pos.online.reason')} testIdPrefix="reason" />
|
||||
{error && <p role="alert" className="text-label text-danger-ink">{error}</p>}
|
||||
</div>
|
||||
</Dialog>
|
||||
|
||||
Reference in New Issue
Block a user