From 251c76fbdf8e4f23291c768acb214ebeeaacae08 Mon Sep 17 00:00:00 2001 From: beatz174-bit Date: Sun, 23 Nov 2025 13:37:32 +1000 Subject: [PATCH] Remove redundant pick list quantity controls --- src/screens/ActivePickListScreen.tsx | 47 +++------------------------- 1 file changed, 5 insertions(+), 42 deletions(-) diff --git a/src/screens/ActivePickListScreen.tsx b/src/screens/ActivePickListScreen.tsx index 74e96b4..522e02d 100644 --- a/src/screens/ActivePickListScreen.tsx +++ b/src/screens/ActivePickListScreen.tsx @@ -1,9 +1,7 @@ import { Autocomplete, Button, - Checkbox, Container, - FormControlLabel, InputAdornment, Stack, TextField, @@ -29,8 +27,6 @@ export const ActivePickListScreen = () => { const navigate = useNavigate(); const [selectedProduct, setSelectedProduct] = useState(null); const [query, setQuery] = useState(''); - const [quantity, setQuantity] = useState(1); - const [isCarton, setIsCarton] = useState(false); const areaName = useMemo( () => areas.find((area) => area.id === pickList?.area_id)?.name ?? 'Area', @@ -54,11 +50,6 @@ export const ActivePickListScreen = () => { } }, [filteredProducts, selectedProduct]); - useEffect(() => { - setQuantity(1); - setIsCarton(false); - }, [selectedProduct]); - const handleIncrementQuantity = async (itemId: string) => { const existing = await db.pickItems.get(itemId); if (!existing) return; @@ -101,15 +92,15 @@ export const ActivePickListScreen = () => { }; const addOrUpdateItem = async (product: Product) => { - if (!id || quantity <= 0) return; + if (!id) return; const existing = items.find( - (item) => item.product_id === product.id && item.is_carton === isCarton, + (item) => item.product_id === product.id && item.is_carton === false, ); if (existing) { await db.pickItems.update(existing.id, { - quantity: existing.quantity + quantity, + quantity: existing.quantity + 1, updated_at: Date.now(), }); } else { @@ -117,8 +108,8 @@ export const ActivePickListScreen = () => { id: uuidv4(), pick_list_id: id, product_id: product.id, - quantity, - is_carton: isCarton, + quantity: 1, + is_carton: false, status: 'pending', created_at: Date.now(), updated_at: Date.now(), @@ -127,24 +118,12 @@ export const ActivePickListScreen = () => { setSelectedProduct(null); setQuery(''); - setQuantity(1); - setIsCarton(false); }; const returnToLists = () => { navigate('/pick-lists'); }; - const packagingLabel = isCarton - ? selectedProduct?.bulk_name ?? 'Cartons' - : selectedProduct?.unit_type ?? 'Units'; - const quantityHelperText = selectedProduct - ? `Enter ${packagingLabel.toLowerCase()} to pick` - : 'Select a product to add it to the list'; - const cartonCheckboxLabel = selectedProduct?.bulk_name - ? `Carton (${selectedProduct.bulk_name})` - : 'Carton pick'; - return ( @@ -195,22 +174,6 @@ export const ActivePickListScreen = () => { /> )} /> - - setQuantity(Math.max(1, Number(event.target.value)))} - inputProps={{ min: 1 }} - helperText={quantityHelperText} - fullWidth - /> - setIsCarton(event.target.checked)} />} - label={cartonCheckboxLabel} - disabled={!selectedProduct} - /> - Selecting a product immediately adds it to the pick list.