From cc68dfbb65048a2db989cb8abcec7e9d06912848 Mon Sep 17 00:00:00 2001 From: "Tommy\\2Fi-Staff" Date: Mon, 19 Jan 2026 00:33:49 +0800 Subject: [PATCH] update item --- src/app/api/settings/item/index.ts | 1 + .../CreateItem/CreateItemWrapper.tsx | 1 + src/components/ItemsSearch/ItemsSearch.tsx | 22 ++++++++----------- src/i18n/zh/dashboard.json | 2 +- src/i18n/zh/items.json | 2 +- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/app/api/settings/item/index.ts b/src/app/api/settings/item/index.ts index a30af00..cdb7cce 100644 --- a/src/app/api/settings/item/index.ts +++ b/src/app/api/settings/item/index.ts @@ -67,6 +67,7 @@ export type ItemsResult = { export type Result = { item: ItemsResult; qcChecks: ItemQc[]; + qcType?: string; }; export const fetchAllItems = cache(async () => { return serverFetchJson(`${BASE_API_URL}/items`, { diff --git a/src/components/CreateItem/CreateItemWrapper.tsx b/src/components/CreateItem/CreateItemWrapper.tsx index 095eff8..343e6bf 100644 --- a/src/components/CreateItem/CreateItemWrapper.tsx +++ b/src/components/CreateItem/CreateItemWrapper.tsx @@ -51,6 +51,7 @@ const CreateItemWrapper: React.FC & SubComponents = async ({ id }) => { qcChecks: qcChecks, qcChecks_active: activeRows, qcCategoryId: item.qcCategory?.id, + qcType: result.qcType, store_id: item?.store_id, warehouse: item?.warehouse, area: item?.area, diff --git a/src/components/ItemsSearch/ItemsSearch.tsx b/src/components/ItemsSearch/ItemsSearch.tsx index 9da740b..112a95d 100644 --- a/src/components/ItemsSearch/ItemsSearch.tsx +++ b/src/components/ItemsSearch/ItemsSearch.tsx @@ -124,12 +124,13 @@ const ItemsSearch: React.FC = ({ items }) => { ); useEffect(() => { - refetchData(filterObj); + // Only refetch when paging changes AND we have already searched (filterObj has been set by search) + if (Object.keys(filterObj).length > 0 || filteredItems.length > 0) { + refetchData(filterObj); + } }, [ - filterObj, pagingController.pageNum, pagingController.pageSize, - refetchData, ]); const columns = useMemo[]>( @@ -181,25 +182,20 @@ const ItemsSearch: React.FC = ({ items }) => { ); const onReset = useCallback(() => { - setFilteredItems(items); - }, [items]); + setFilteredItems([]); + setFilterObj({}); + setTotalCount(0); + }, []); return ( <> { - // setFilteredItems( - // items.filter((pm) => { - // return ( - // pm.code.toLowerCase().includes(query.code.toLowerCase()) && - // pm.name.toLowerCase().includes(query.name.toLowerCase()) - // ); - // }) - // ); setFilterObj({ ...query, }); + refetchData(query); }} onReset={onReset} /> diff --git a/src/i18n/zh/dashboard.json b/src/i18n/zh/dashboard.json index 0eb797a..c2cf9d7 100644 --- a/src/i18n/zh/dashboard.json +++ b/src/i18n/zh/dashboard.json @@ -65,7 +65,7 @@ "Last updated": "最後更新", "Truck Schedule": "車輛班次", "Time Remaining": "剩餘時間", - "No. of Shops": "門店數量", + "No. of Shops": "門店數量[提票數量]", "Total Items": "總貨品數", "Tickets Released": "已發放成品出倉單", "First Ticket Start": "首單開始時間", diff --git a/src/i18n/zh/items.json b/src/i18n/zh/items.json index 613ac3e..288c7b8 100644 --- a/src/i18n/zh/items.json +++ b/src/i18n/zh/items.json @@ -36,7 +36,7 @@ "LocationCode": "預設位置", "DefaultLocationCode": "預設位置", "Special Type": "特殊類型", -"None": "無", +"None": "正常", "isEgg": "雞蛋", "isFee": "費用", "isBag": "袋子",