'use client'; import { useState } from 'react'; import { Check } from 'lucide-react'; import BottomSheet from '@/components/BottomSheet'; import { getItemDisplayQty } from '@/lib/pocketbase'; import type { OrderItem } from '@/lib/types'; import { cn } from '@/lib/utils'; interface CollectPromptProps { poLabel: string; /** The PO's items still on the driver's list. */ items: OrderItem[]; onCollect: (items: OrderItem[]) => void; onClose: () => void; } // Shown right after an invoice photo uploads. The photo alone collects // nothing, and the green invoice button made it look done, so drivers left // lines "assigned" and off Collection Confirm. Works with or without the AI // match: it only lists what is still on the list. Every item starts ticked; // a short or different item is unticked and collected on its own card. export default function CollectPrompt({ poLabel, items, onCollect, onClose }: CollectPromptProps) { const [picked, setPicked] = useState>(() => new Set(items.map((i) => i.id))); const toggle = (id: string) => setPicked((prev) => { const next = new Set(prev); if (next.has(id)) next.delete(id); else next.add(id); return next; }); const chosen = items.filter((i) => picked.has(i.id)); return (

The photo is saved, but the items aren’t collected yet. Tick what you picked up.

Short or different from the PO? Untick it and use Collect on that item to enter what you got.

); }