feat(backend,waiter,terminal,manager): +1 on a sent line and changing a line's quantity

Owner 2026-11-23 (plan 6F.5). Product flag one_more_enabled (off by default; product editor).
POST /api/orders/{id}/items/{item}/again: a new line like the old one (choices, removed, note,
course), priced now, sent to the kitchen like any new line. Waiter app and the counter's table
panel: +1 beside such lines; the first tap arms it, more taps count up, 'Send +N' sends, 4 s idle
disarms (no stray sends).
POST /api/orders/{id}/items/{item}/quantity: venue setting orders.quantity_change (off | add_only |
add_and_remove, default off), key ordering.items.change_quantity (owner, store manager; Alembic 0049
grants it); up only changes the line, down cuts a cancelled part ('quantity lowered', split_from_id)
and prints a cancellation only when asked (the dialog presets yes while the kitchen hasn't finished).
Waiter: 'Change quantity' in a line's actions (now -> new, -/+). cut_part() now shared with split.
GET /api/orders/{id} items carry the product's one_more_enabled / unit_type, deal ids, split_from_id,
cancel_reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 08:26:46 +02:00
co-authored by Claude Opus 5.5
parent 0a353c5f97
commit 72e175ab73
35 changed files with 813 additions and 35 deletions
@@ -68,9 +68,27 @@ function OrderingSettings() {
itemLabel={o('quickNote')} placeholder={o('newQuickNote')} testId="settings-quick-notes" newTestId="quick-note" />
</SettingsCard>
<PriceChangeSettings s={s} />
<QuantitySettings s={s} />
</>)
}
/** A sent line's quantity changed without a new ticket (6F.5). Who may: ordering.items.change_quantity;
* lowering also needs ordering.orders.cancel ("What each role may do", a person's permissions). */
function QuantitySettings({ s }) {
const { t } = useTranslation('manager')
const q = k => t(`settings.quantity.${k}`)
const id = useId()
return (
<SettingsCard title={q('title')} description={q('intro')} testId="settings-quantity">
<SettingRow label={q('when')} hint={q('whenHint')} tip={q('whenTip')} htmlFor={id}>
<Select id={id} value={s.get('orders.quantity_change', 'off')} disabled={s.saving} data-testid="setting-orders.quantity_change"
onChange={e => s.save('orders.quantity_change', e.target.value)}
options={['off', 'add_only', 'add_and_remove'].map(v => ({ value: v, label: q(`modes.${v}`) }))} />
</SettingRow>
</SettingsCard>
)
}
/** Prices changed by hand (6F.3): the venue's switch, the reason, the quick reasons. Who may: the
* keys ordering.prices.modify / modify_sent ("What each role may do", a person's permissions). */
function PriceChangeSettings({ s }) {
@@ -43,6 +43,7 @@ export function InfoTab({ form, set, setForm, categories, prepZones }) {
<AllergensField value={form.allergens} onChange={v => set('allergens', v)} />
<Switch checked={form.is_available} onChange={v => set('is_available', v)} label={t('products.editor.available')} info={<InfoTip>{t('products.editor.availableTip')}</InfoTip>} description={t('products.editor.availableHint')} />
<Switch checked={form.quick_add_enabled} onChange={v => set('quick_add_enabled', v)} label={t('products.editor.quickAdd')} info={<InfoTip>{t('products.editor.quickAddTip')}</InfoTip>} description={t('products.editor.quickAddHint')} />
<Switch checked={form.one_more_enabled} onChange={v => set('one_more_enabled', v)} label={t('products.editor.oneMore')} info={<InfoTip>{t('products.editor.oneMoreTip')}</InfoTip>} description={t('products.editor.oneMoreHint')} data-testid="product-one-more" />
<MediaField value={form.image} onChange={image => set('image', image)} nameAfter={shownText(form.names, venue, form.name)} label={t('media.photo')} testid="product-photo" />
</div>
)
@@ -81,6 +81,7 @@ export function buildForm(p) {
cost_simple: p.cost_simple ?? '',
cost_breakdown: (p.cost_breakdown ?? []).map(e => ({ label: e.label, amount: e.amount })),
quick_add_enabled: p.quick_add_enabled ?? true,
one_more_enabled: !!p.one_more_enabled, // 6F.5
tags: [...(p.tags ?? [])],
is_service_item: !!p.is_service_item,
fiscal_name: p.fiscal_name ?? '',
@@ -143,6 +144,7 @@ export function buildBody(f, venue = 'el') {
cost_breakdown: f.cost_mode === 'detailed' && f.cost_breakdown.length
? f.cost_breakdown.map(e => ({ label: e.label, amount: num(e.amount) })) : null,
quick_add_enabled: f.quick_add_enabled,
one_more_enabled: !!f.one_more_enabled,
tags: f.tags,
is_service_item: f.is_service_item,
fiscal_name: f.fiscal_name.trim() || null,