Browse Source

update item

MergeProblem1
Tommy\2Fi-Staff 2 weeks ago
parent
commit
cc68dfbb65
5 changed files with 13 additions and 15 deletions
  1. +1
    -0
      src/app/api/settings/item/index.ts
  2. +1
    -0
      src/components/CreateItem/CreateItemWrapper.tsx
  3. +9
    -13
      src/components/ItemsSearch/ItemsSearch.tsx
  4. +1
    -1
      src/i18n/zh/dashboard.json
  5. +1
    -1
      src/i18n/zh/items.json

+ 1
- 0
src/app/api/settings/item/index.ts View File

@@ -67,6 +67,7 @@ export type ItemsResult = {
export type Result = {
item: ItemsResult;
qcChecks: ItemQc[];
qcType?: string;
};
export const fetchAllItems = cache(async () => {
return serverFetchJson<ItemsResult[]>(`${BASE_API_URL}/items`, {


+ 1
- 0
src/components/CreateItem/CreateItemWrapper.tsx View File

@@ -51,6 +51,7 @@ const CreateItemWrapper: React.FC<Props> & 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,


+ 9
- 13
src/components/ItemsSearch/ItemsSearch.tsx View File

@@ -124,12 +124,13 @@ const ItemsSearch: React.FC<Props> = ({ 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<Column<ItemsResultWithStatus>[]>(
@@ -181,25 +182,20 @@ const ItemsSearch: React.FC<Props> = ({ items }) => {
);

const onReset = useCallback(() => {
setFilteredItems(items);
}, [items]);
setFilteredItems([]);
setFilterObj({});
setTotalCount(0);
}, []);

return (
<>
<SearchBox
criteria={searchCriteria}
onSearch={(query) => {
// 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}
/>


+ 1
- 1
src/i18n/zh/dashboard.json View File

@@ -65,7 +65,7 @@
"Last updated": "最後更新",
"Truck Schedule": "車輛班次",
"Time Remaining": "剩餘時間",
"No. of Shops": "門店數量",
"No. of Shops": "門店數量[提票數量]",
"Total Items": "總貨品數",
"Tickets Released": "已發放成品出倉單",
"First Ticket Start": "首單開始時間",


+ 1
- 1
src/i18n/zh/items.json View File

@@ -36,7 +36,7 @@
"LocationCode": "預設位置",
"DefaultLocationCode": "預設位置",
"Special Type": "特殊類型",
"None": "",
"None": "正常",
"isEgg": "雞蛋",
"isFee": "費用",
"isBag": "袋子",


Loading…
Cancel
Save