import { Add, Delete, Remove, SwapHoriz } from '@mui/icons-material'; import { Button, Checkbox, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, IconButton, Stack, Typography, } from '@mui/material'; import { useState } from 'react'; import { PickItem } from '../models/PickItem'; import { Product } from '../models/Product'; interface PickItemRowProps { item: PickItem; product?: Product | null; onIncrementQuantity: () => void; onDecrementQuantity: () => void; onToggleCarton: () => void; onStatusChange: (status: PickItem['status']) => void; onDelete: () => void; } export const PickItemRow = ({ item, product, onIncrementQuantity, onDecrementQuantity, onToggleCarton, onStatusChange, onDelete, }: PickItemRowProps) => { const [isConfirmOpen, setIsConfirmOpen] = useState(false); const packagingLabel = item.is_carton ? product?.bulk_name ?? 'Carton' : product?.unit_type ?? 'Unit'; const toggleStatus = (checked: boolean) => { onStatusChange(checked ? 'picked' : 'pending'); }; const handleConfirmDelete = () => { onDelete(); setIsConfirmOpen(false); }; return ( toggleStatus(event.target.checked)} inputProps={{ 'aria-label': 'Toggle picked status' }} /> {product?.name ?? 'Unknown product'} Qty: {item.quantity} {packagingLabel} setIsConfirmOpen(false)} aria-labelledby="confirm-delete-title" aria-describedby="confirm-delete-description" > Delete item {`Are you sure you want to delete ${product?.name ?? 'this product'} from the pick list?`} ); };