-
- {product?.name ?? 'Unknown product'}
-
- Qty: {item.quantity_units}
-
-
+
+ toggleStatus(event.target.checked)}
+ inputProps={{ 'aria-label': 'Toggle picked status' }}
+ />
+
+
+ {product?.name ?? 'Unknown product'}
+
+
+ Qty: {item.quantity} {packagingLabel}
+
+
+
+
- {isCarton ? : null}
-
+
+ } onClick={onIncrementQuantity}>
+ Add 1
+
+
+
+
);
diff --git a/src/db/index.ts b/src/db/index.ts
index 4b07329..5a78de7 100644
--- a/src/db/index.ts
+++ b/src/db/index.ts
@@ -112,8 +112,12 @@ export class StockFillDB extends Dexie {
if (hasNewFields) return undefined;
- const legacyUnits = Number((item as PickItem).quantity_units ?? 0);
- const legacyBulk = Number((item as PickItem).quantity_bulk ?? 0);
+ const legacyUnits = Number(
+ (item as PickItem & { quantity_units?: number }).quantity_units ?? 0,
+ );
+ const legacyBulk = Number(
+ (item as PickItem & { quantity_bulk?: number }).quantity_bulk ?? 0,
+ );
if (legacyUnits > 0 && legacyBulk > 0) {
await tx.table('pickItems').update(item.id, {
@@ -148,6 +152,56 @@ export class StockFillDB extends Dexie {
}),
);
});
+
+ this.version(6)
+ .stores({
+ products: 'id, name, category, &barcode, archived, created_at, updated_at',
+ areas: 'id, name, created_at, updated_at',
+ pickLists: 'id, area_id, created_at, completed_at',
+ pickItems:
+ 'id, pick_list_id, product_id, status, is_carton, quantity, created_at, updated_at',
+ categories: 'id, name, created_at, updated_at',
+ })
+ .upgrade(async (tx) => {
+ const items = await tx.table('pickItems').toArray();
+ const now = Date.now();
+
+ await Promise.all(
+ items.map(async (item) => {
+ const legacyUnits = Number((item as PickItem & { quantity_units?: number }).quantity_units ?? 0);
+ const legacyBulk = Number((item as PickItem & { quantity_bulk?: number }).quantity_bulk ?? 0);
+ const hasQuantity = typeof (item as PickItem).quantity === 'number';
+ const hasCartonFlag = typeof (item as PickItem).is_carton === 'boolean';
+
+ const updateData: Partial