diff --git a/src/components/PickItemRow.tsx b/src/components/PickItemRow.tsx index e719614..1eaf3b4 100644 --- a/src/components/PickItemRow.tsx +++ b/src/components/PickItemRow.tsx @@ -1,4 +1,4 @@ -import { Add, Delete, Inventory2, Remove } from '@mui/icons-material'; +import { Add, Close, Delete, Inventory2, Remove } from '@mui/icons-material'; import { Button, Checkbox, @@ -36,6 +36,7 @@ export const PickItemRow = ({ onDelete, }: PickItemRowProps) => { const [isConfirmOpen, setIsConfirmOpen] = useState(false); + const [isControlsOpen, setIsControlsOpen] = useState(false); const packagingLabel = item.is_carton ? product?.bulk_name ?? 'Carton' : product?.unit_type ?? 'Unit'; @@ -55,7 +56,22 @@ export const PickItemRow = ({ alignItems="center" justifyContent="space-between" spacing={1.5} - sx={{ p: 1, borderRadius: 1, bgcolor: 'background.paper', boxShadow: 1 }} + sx={{ + p: 1, + borderRadius: 1, + bgcolor: 'background.paper', + boxShadow: 1, + cursor: 'pointer', + }} + onClick={() => setIsControlsOpen(true)} + role="button" + tabIndex={0} + onKeyDown={(event) => { + if (event.key === 'Enter' || event.key === ' ') { + event.preventDefault(); + setIsControlsOpen(true); + } + }} > toggleStatus(event.target.checked)} inputProps={{ 'aria-label': 'Toggle picked status' }} + onClick={(event) => event.stopPropagation()} /> - - - {product?.name ?? 'Unknown product'} + + + + {product?.name ?? 'Unknown product'} + + + {item.quantity} {packagingLabel} + - Qty: {item.quantity} {packagingLabel} + Tap to adjust quantity and packaging - - `0 0 0 8px ${alpha(theme.palette.primary.main, 0.15)}` - : 'none', - }} + setIsControlsOpen(false)} + fullWidth + maxWidth="xs" + aria-labelledby="item-controls-title" + > + - - - - - - - - - setIsConfirmOpen(true)} - aria-label="Delete item" - > - - - + + {product?.name ?? 'Unknown product'} + + setIsControlsOpen(false)}> + + + + + + + Quantity: {item.quantity} {packagingLabel} + + + `0 0 0 8px ${alpha(theme.palette.primary.main, 0.15)}` + : 'none', + }} + > + + + + + + + + + setIsConfirmOpen(true)} + aria-label="Delete item" + > + + + + + +