-
-
-
-
- {isPicked ? '✔️' : null} {product?.name ?? 'Unknown product'}
-
-
- {item.quantity_units} units / {item.quantity_bulk} bulk
-
-
-
+
+ {product?.name ?? 'Unknown product'}
+
+ Qty: {item.quantity_units}
+
+
- } onClick={onIncrementUnit}>
- Unit
-
- } onClick={onIncrementBulk}>
- Bulk
-
- } onClick={onDelete}>
- Delete
-
+ {isCarton ? : null}
+
);
diff --git a/src/screens/ActivePickListScreen.tsx b/src/screens/ActivePickListScreen.tsx
index 3bce4ac..861e0b3 100644
--- a/src/screens/ActivePickListScreen.tsx
+++ b/src/screens/ActivePickListScreen.tsx
@@ -19,7 +19,7 @@ export const ActivePickListScreen = () => {
[areas, pickList?.area_id],
);
- const handleIncrement = async (itemId: string) => {
+ const handleIncrementQuantity = async (itemId: string) => {
const existing = await db.pickItems.get(itemId);
if (!existing) return;
await db.pickItems.update(itemId, {
@@ -28,11 +28,17 @@ export const ActivePickListScreen = () => {
});
};
- const handleToggleStatus = async (itemId: string) => {
+ const handleToggleCarton = async (itemId: string) => {
const existing = await db.pickItems.get(itemId);
if (!existing) return;
- const nextStatus = existing.status === 'picked' ? 'pending' : 'picked';
- await db.pickItems.update(itemId, { status: nextStatus, updated_at: Date.now() });
+ await db.pickItems.update(itemId, {
+ quantity_bulk: existing.quantity_bulk > 0 ? 0 : 1,
+ updated_at: Date.now(),
+ });
+ };
+
+ const handleSwipeLeft = async (itemId: string) => {
+ await db.pickItems.update(itemId, { status: 'picked', updated_at: Date.now() });
};
const handleDeleteItem = async (itemId: string) => {
@@ -62,10 +68,10 @@ export const ActivePickListScreen = () => {
key={item.id}
item={item}
product={products.find((p) => p.id === item.product_id)}
- onIncrementUnit={() => handleIncrementUnit(item.id)}
- onIncrementBulk={() => handleIncrementBulk(item.id)}
- onToggleStatus={() => handleToggleStatus(item.id)}
- onDelete={() => handleDeleteItem(item.id)}
+ onIncrementQuantity={() => handleIncrementQuantity(item.id)}
+ onToggleCarton={() => handleToggleCarton(item.id)}
+ onSwipeLeft={() => handleSwipeLeft(item.id)}
+ onSwipeRight={() => handleSwipeRight(item.id)}
/>
))}
diff --git a/src/screens/AddItemScreen.tsx b/src/screens/AddItemScreen.tsx
index 71e2f87..0985e7f 100644
--- a/src/screens/AddItemScreen.tsx
+++ b/src/screens/AddItemScreen.tsx
@@ -1,17 +1,18 @@
import {
Autocomplete,
Button,
+ Checkbox,
Container,
+ FormControlLabel,
+ InputAdornment,
Stack,
TextField,
Typography,
- InputAdornment,
} from '@mui/material';
import SearchIcon from '@mui/icons-material/Search';
import { useEffect, useMemo, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { v4 as uuidv4 } from 'uuid';
-import { NumericStepper } from '../components/NumericStepper';
import { usePickItems, useProducts } from '../hooks/dataHooks';
import { useDatabase } from '../context/DBProvider';
@@ -22,8 +23,8 @@ export const AddItemScreen = () => {
const products = useProducts();
const [selectedProduct, setSelectedProduct] = useState