feat(backend): KDS item claims across screens; zone screens only touch their own items (platform-v2 3.2c)

- order_items.claimed_by / claimed_at (Alembic 0015). POST/DELETE
  /api/kds/orders/{id}/items/{item}/claim (kds.bump): someone else's claim is refused
  (kds.item_claimed), letting go works for anyone with kds.bump; live kds_item_claimed.
  In progress claims for whoever did it; done/served/pending/declined clear the claim.
- Fix: order-level status and decline from a zone screen changed every zone's items;
  now only the screen's zone, and a zone screen sees the order status of its own items.
- Terminal: "I'm on it" / "Let go" on the selected card, the cook's name on claimed items.
- Tests: backend +6, terminal unit +1, terminal.mjs +6 with a second screen and cook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 20:25:34 +02:00
co-authored by Claude Opus 5.5
parent 77e0adbe9c
commit 6b237fd169
17 changed files with 384 additions and 29 deletions
+12 -1
View File
@@ -1,7 +1,7 @@
// One item on an order card: quantity badge, name, changes (− removed, + extras, → choices)
// and its note. On the selected card a tap moves it on, a long press declines it.
import { useRef } from 'react'
import { ArrowRight, Info, Minus, Plus } from 'lucide-react'
import { ArrowRight, Hand, Info, Minus, Plus } from 'lucide-react'
import { dedupeModifiers, formatQty, hasUnit } from '../logic/board'
import { KDS } from '../theme'
@@ -68,6 +68,17 @@ export default function ItemBlock({ item, focused, onBump, onDecline, fontScale
}}>
{item.product_name}
</span>
{item.claimed_by_name && !done && (
<span data-testid="item-claim" title={item.claimed_by_name} style={{
flexShrink: 0, maxWidth: '45%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
height: badgeH, display: 'inline-flex', alignItems: 'center', gap: 3, padding: `0 ${Math.round(6 * fs)}px`,
borderRadius: Math.round(5 * fs), background: KDS.progress, color: KDS.onStatus,
fontSize: Math.round(11 * fs), fontWeight: 700,
}}>
<Hand style={{ width: Math.round(11 * fs), height: Math.round(11 * fs), flexShrink: 0 }} />
{item.claimed_by_name}
</span>
)}
{focused && (
<span style={{
flexShrink: 0, width: 8, height: 8, borderRadius: 4, display: 'inline-block', marginTop: Math.round((badgeH - 8) / 2),