diff --git a/web/dashboard/src/components/pos2/pos2-screen.tsx b/web/dashboard/src/components/pos2/pos2-screen.tsx index dacad91..209f5fd 100644 --- a/web/dashboard/src/components/pos2/pos2-screen.tsx +++ b/web/dashboard/src/components/pos2/pos2-screen.tsx @@ -13,7 +13,7 @@ import { Search, Plus, Minus, Trash2, Send, CreditCard, Pause, SplitSquareHorizontal, X, WifiOff, ShoppingCart, Users, Coffee, ArrowRight, LayoutGrid, Armchair, Banknote, Check, Delete, ReceiptText, ShoppingBag, Loader2, RotateCcw, - BadgePercent, Sparkles, Home, + BadgePercent, Sparkles, Home, StickyNote, } from "lucide-react"; import { cn } from "@/lib/utils"; import { notify } from "@/lib/notify"; @@ -101,6 +101,7 @@ export function Pos2Screen() { const addItem = useCartStore((s) => s.addItem); const updateQty = useCartStore((s) => s.updateQty); const removeItem = useCartStore((s) => s.removeItem); + const setNotes = useCartStore((s) => s.setNotes); const setTableId = useCartStore((s) => s.setTableId); const setOrderType = useCartStore((s) => s.setOrderType); const hydrateFromOrder = useCartStore((s) => s.hydrateFromOrder); @@ -320,6 +321,7 @@ export function Pos2Screen() { cafeId, lines: live, subtotal, discount, tax, total, count, pendingCount, onBump: (id: string, d: number) => { const l = items.find((x) => x.menuItem.id === id); if (l) updateQty(id, l.quantity + d); }, onRemove: removeItem, onSend: send, onPay: openPay, onSplit: openPay, + onNote: (id: string, notes: string) => setNotes(id, notes), }; // ── TABLE BOARD ──────────────────────────────────────────────────────────── @@ -669,15 +671,17 @@ function Pos2Extras({ cafeId }: { cafeId: string }) { } // ── Order ticket ───────────────────────────────────────────────────────────── -type TicketLine = { menuItem: MenuItem; quantity: number }; +type TicketLine = { menuItem: MenuItem; quantity: number; notes?: string }; function Ticket({ - cafeId, lines, subtotal, discount, tax, total, count, pendingCount, onBump, onRemove, onSend, onPay, onSplit, + cafeId, lines, subtotal, discount, tax, total, count, pendingCount, onBump, onRemove, onNote, onSend, onPay, onSplit, }: { cafeId: string; lines: TicketLine[]; subtotal: number; discount: number; tax: number; total: number; count: number; pendingCount: number; onBump: (id: string, d: number) => void; onRemove: (id: string) => void; + onNote: (id: string, notes: string) => void; onSend: () => void; onPay: () => void; onSplit: () => void; }) { + const [noteFor, setNoteFor] = useState(null); return (
@@ -690,23 +694,45 @@ function Ticket({ ) : (
    {lines.map((l) => ( -
  • -
    -

    {l.menuItem.name}

    -

    {fmt(l.menuItem.price)} تومان

    -
    -
    - + {fmt(l.quantity)} + +
    + - {fmt(l.quantity)} -
- + {noteFor === l.menuItem.id || l.notes ? ( + onNote(l.menuItem.id, e.target.value)} + placeholder="یادداشت برای آشپزخانه (مثلاً بدون شکر)" + autoFocus={noteFor === l.menuItem.id} + maxLength={200} + dir="rtl" + className="mt-2 w-full rounded-lg border border-border/70 bg-background px-2.5 py-1.5 text-sm outline-none focus:border-primary" + /> + ) : null} ))}