From 6c22fd0a205d2badb6e1ec570e480c177a8c6c87 Mon Sep 17 00:00:00 2001 From: beatz174-bit Date: Sun, 23 Nov 2025 13:01:41 +1000 Subject: [PATCH] Use icon buttons for pick item actions --- src/components/PickItemRow.tsx | 33 +++++++++++++++++++--------- src/screens/ActivePickListScreen.tsx | 13 +++++++++++ 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/components/PickItemRow.tsx b/src/components/PickItemRow.tsx index 2c076cc..3c78592 100644 --- a/src/components/PickItemRow.tsx +++ b/src/components/PickItemRow.tsx @@ -1,5 +1,5 @@ -import { Add, Delete } from '@mui/icons-material'; -import { Button, Checkbox, IconButton, Stack, Typography } from '@mui/material'; +import { Add, Delete, Remove, SwapHoriz } from '@mui/icons-material'; +import { Checkbox, IconButton, Stack, Typography } from '@mui/material'; import { PickItem } from '../models/PickItem'; import { Product } from '../models/Product'; @@ -7,6 +7,7 @@ interface PickItemRowProps { item: PickItem; product?: Product | null; onIncrementQuantity: () => void; + onDecrementQuantity: () => void; onToggleCarton: () => void; onStatusChange: (status: PickItem['status']) => void; onDelete: () => void; @@ -16,6 +17,7 @@ export const PickItemRow = ({ item, product, onIncrementQuantity, + onDecrementQuantity, onToggleCarton, onStatusChange, onDelete, @@ -54,16 +56,27 @@ export const PickItemRow = ({ - - + + + + + + + + diff --git a/src/screens/ActivePickListScreen.tsx b/src/screens/ActivePickListScreen.tsx index 4c41850..ecc461e 100644 --- a/src/screens/ActivePickListScreen.tsx +++ b/src/screens/ActivePickListScreen.tsx @@ -29,6 +29,18 @@ export const ActivePickListScreen = () => { }); }; + const handleDecrementQuantity = async (itemId: string) => { + const existing = await db.pickItems.get(itemId); + if (!existing) return; + + const nextQuantity = Math.max(1, (existing.quantity || 1) - 1); + + await db.pickItems.update(itemId, { + quantity: nextQuantity, + updated_at: Date.now(), + }); + }; + const handleToggleCarton = async (itemId: string) => { const existing = await db.pickItems.get(itemId); if (!existing) return; @@ -73,6 +85,7 @@ export const ActivePickListScreen = () => { item={item} product={products.find((p) => p.id === item.product_id)} onIncrementQuantity={() => handleIncrementQuantity(item.id)} + onDecrementQuantity={() => handleDecrementQuantity(item.id)} onToggleCarton={() => handleToggleCarton(item.id)} onStatusChange={(status) => handleStatusChange(item.id, status)} onDelete={() => handleDeleteItem(item.id)}