From 46ee3f2623475f105e88d00d4935637e665e274f Mon Sep 17 00:00:00 2001 From: "MSI\\derek" Date: Wed, 9 Jul 2025 18:02:55 +0800 Subject: [PATCH 01/15] update --- .../DetailScheduleDetail/ViewByBomDetails.tsx | 239 +++++++++++++++--- 1 file changed, 208 insertions(+), 31 deletions(-) diff --git a/src/components/DetailScheduleDetail/ViewByBomDetails.tsx b/src/components/DetailScheduleDetail/ViewByBomDetails.tsx index 92c3263..f9abf8c 100644 --- a/src/components/DetailScheduleDetail/ViewByBomDetails.tsx +++ b/src/components/DetailScheduleDetail/ViewByBomDetails.tsx @@ -31,8 +31,8 @@ import { decimalFormatter } from "@/app/utils/formatUtil"; import { GridRenderCellParams } from "@mui/x-data-grid"; type Props = { - apiRef: MutableRefObject - isEdit: boolean + apiRef: MutableRefObject; + isEdit: boolean; }; type EntryError = | { @@ -53,16 +53,16 @@ export type FGOverallRecord = { code: string; name: string; type: string; - inStockQty: number; - purchaseQty: number; - purchaseQty1: number; - purchaseQty2: number; - purchaseQty3: number; - purchaseQty4: number; - purchaseQty5: number; - purchaseQty6: number; - purchaseQty7: number; - overallPurchaseQty: number; + inStockQty?: number; + purchaseQty?: number; + purchaseQty1?: number; + purchaseQty2?: number; + purchaseQty3?: number; + purchaseQty4?: number; + purchaseQty5?: number; + purchaseQty6?: number; + purchaseQty7?: number; + overallPurchaseQty?: number; }; const ViewByBomDetails: React.FC = ({ apiRef, isEdit }) => { @@ -1002,22 +1002,197 @@ const ViewByBomDetails: React.FC = ({ apiRef, isEdit }) => { [], ); - const updatePagingController = (updatedObj: { index: number, pageNum: number, pageSize: number, totalCount: number }) => { - setPagingController((prevState) => { - return prevState.map((item, index) => { - if (index === updatedObj?.index){ - return { - ...item, - pageNum: item.pageNum, - pageSize: item.pageSize, - totalCount: item.totalCount, - }; - } - else - return item - }); - }); - }; + // const updatePagingController = (updatedObj: { index: number, pageNum: number, pageSize: number, totalCount: number }) => { + // setPagingController((prevState) => { + // return prevState.map((item, index) => { + // if (index === updatedObj?.index){ + // return { + // ...item, + // pageNum: item.pageNum, + // pageSize: item.pageSize, + // totalCount: item.totalCount, + // }; + // } + // else + // return item + // }); + // }); + // }; + const fakeOverallRecords = useMemo( + () => [ + { + id: 1, + code: "MH0040", + type: "Material", + name: "大豆油(1噸/桶)", + inStockQty: 54.44, + purchaseQty1: 972.12, + purchaseQty2: 972.12, + purchaseQty3: 972.12, + purchaseQty4: 972.12, + purchaseQty5: 972.12, + purchaseQty6: 972.12, + purchaseQty7: 972.12, + overallPurchaseQty: 6804.84, + }, + { + id: 2, + code: "GI3236", + type: "Material", + name: "清水(煮過牛腩)", + inStockQty: 317.52, + purchaseQty1: 3175.2, + purchaseQty2: 3175.2, + purchaseQty3: 3175.2, + purchaseQty4: 3175.2, + purchaseQty5: 3175.2, + purchaseQty6: 3175.2, + purchaseQty7: 3175.2, + overallPurchaseQty: 22226.4, + }, + { + id: 3, + code: "MG1700", + type: "Material", + name: "STERILTOM 意大利茄粒", + inStockQty: 9.0, + purchaseQty1: 90, + purchaseQty2: 90, + purchaseQty3: 90, + purchaseQty4: 90, + purchaseQty5: 90, + purchaseQty6: 90, + purchaseQty7: 90, + overallPurchaseQty: 630, + }, + { + id: 4, + code: "FA0533", + type: "Material", + name: "乾蔥茸", + inStockQty: 6.04, + purchaseQty1: 60.4, + purchaseQty2: 60.4, + purchaseQty3: 60.4, + purchaseQty4: 60.4, + purchaseQty5: 60.4, + purchaseQty6: 60.4, + purchaseQty7: 60.4, + overallPurchaseQty: 422.8, + }, + { + id: 5, + code: "FA0210", + type: "Material", + name: "薑茸", + inStockQty: 6.04, + purchaseQty1: 66.45, + purchaseQty2: 66.45, + purchaseQty3: 66.45, + purchaseQty4: 66.45, + purchaseQty5: 66.45, + purchaseQty6: 66.45, + purchaseQty7: 66.45, + overallPurchaseQty: 465.15, + }, + { + id: 6, + code: "FA0608", + type: "Material", + name: "粗蒜茸", + inStockQty: 6.04, + purchaseQty1: 78.55, + purchaseQty2: 78.55, + purchaseQty3: 78.55, + purchaseQty4: 78.55, + purchaseQty5: 78.55, + purchaseQty6: 78.55, + purchaseQty7: 78.55, + overallPurchaseQty: 549.85, + }, + { + id: 7, + code: "FA0056", + type: "Material", + name: "洋蔥肉", + inStockQty: 241.98, + purchaseQty: 2419.8, + }, + { + id: 8, + code: "PP1188", + type: "Material", + name: "咖喱膽", + inStockQty: 36.0, + purchaseQty: 0, + }, + { + id: 9, + code: "PP8001", + type: "Material", + name: "咖哩汁箱料粉", + inStockQty: 77.42, + purchaseQty: 774.2, + }, + { + id: 10, + code: "PP1096", + type: "Material", + name: "白麵撈", + inStockQty: 60.0, + purchaseQty: 0, + }, + { + id: 11, + code: "NA0476", + type: "Material", + name: "2磅份量三邊覆合袋 (0.1x225x260mm)個計", + inStockQty: 600.0, + purchaseQty: 6000, + }, + { + id: 12, + code: "MH0040", + type: "Material", + name: "大豆油(1噸/桶)", + inStockQty: 0, + purchaseQty: 972.12, + }, + { + id: 13, + code: "FA0161", + type: "Material", + name: "洋蔥粒", + inStockQty: 0, + purchaseQty: 28.15, + }, + { + id: 14, + code: "MG1288", + type: "Material", + name: "炸紅蔥頭", + inStockQty: 0, + purchaseQty: 6.05, + }, + { + id: 15, + code: "MG0066", + type: "Material", + name: "咖哩料(5斤x16包+2斤/包)", + inStockQty: 0, + purchaseQty: 241.98, + }, + { + id: 16, + code: "MH0040", + type: "Material", + name: "星加坡綠富貴花牌幼白麵粉 (50磅/包)", + inStockQty: 0, + purchaseQty: 250.0, + }, + ], + [], + ); const [pagingController, setPagingController] = useState([ { @@ -1062,7 +1237,7 @@ const ViewByBomDetails: React.FC = ({ apiRef, isEdit }) => { }, ]); - const updatePagingController = (updatedObj) => { + const updatePagingController = (updatedObj: any) => { setPagingController((prevState) => { return prevState.map((item, index) => { if (index === updatedObj?.index) { @@ -1286,8 +1461,9 @@ const ViewByBomDetails: React.FC = ({ apiRef, isEdit }) => { index={7} - items={fakeOverallRecords} - isMockUp={true} + items={fakeOverallRecords as FGRecord[]} + hasCollapse + // isMockUp={true} columns={overallColumns} setPagingController={updatePagingController} pagingController={pagingController[7]} @@ -1302,6 +1478,7 @@ const ViewByBomDetails: React.FC = ({ apiRef, isEdit }) => { {`${t("Material Demand Date")}: ${date}`} + hasCollapse index={index} items={fakeRecords[index]} // Use the corresponding records for the day columns={columns} From 528398f8ab6e8b8b98d6e4dda8f6c4262b845d3f Mon Sep 17 00:00:00 2001 From: "MSI\\derek" Date: Wed, 9 Jul 2025 18:35:41 +0800 Subject: [PATCH 02/15] update --- .../RoughScheduleSetting.tsx | 186 ++++++++---------- 1 file changed, 78 insertions(+), 108 deletions(-) diff --git a/src/components/RoughScheduleSetting/RoughScheduleSetting.tsx b/src/components/RoughScheduleSetting/RoughScheduleSetting.tsx index d3ab7f2..e137049 100644 --- a/src/components/RoughScheduleSetting/RoughScheduleSetting.tsx +++ b/src/components/RoughScheduleSetting/RoughScheduleSetting.tsx @@ -3,7 +3,6 @@ import React, { useCallback, useEffect, useMemo, useState } from "react"; import SearchBox, { Criterion } from "../SearchBox"; import { ItemsResult } from "@/app/api/settings/item"; -import SearchResults, { Column } from "../SearchResults"; import { EditNote } from "@mui/icons-material"; import { useRouter, useSearchParams } from "next/navigation"; import { GridDeleteIcon } from "@mui/x-data-grid"; @@ -13,7 +12,7 @@ import { BASE_API_URL, NEXT_PUBLIC_API_URL } from "@/config/api"; import { useTranslation } from "react-i18next"; import axiosInstance from "@/app/(main)/axios/axiosInstance"; import Qs from "qs"; -import EditableSearchResults from "@/components/SearchResults/EditableSearchResults"; // Make sure to import Qs +import EditableSearchResults, { Column } from "@/components/SearchResults/EditableSearchResults"; // Make sure to import Qs import { ItemsResultResponse } from "@/app/api/settings/item"; type Props = { items: ItemsResult[]; @@ -68,31 +67,58 @@ const RSSOverview: React.FC = ({ items }) => { { label: t("Exclude Date"), paramName: "excludeDate", - type: "multi-select", - options: dayOptions, - selectedValues: filterObj, + type: "select", + options: ["qcChecks"], + // selectedValues: filterObj, handleSelectionChange: handleSelectionChange, }, ]; return searchCriteria; }, [t, items]); - const searchCriteria: Criterion[] = useMemo( - () => { - var searchCriteria: Criterion[] = [ - { label: t("Finished Goods Name"), paramName: "name", type: "text" }, - { - label: t("Exclude Date"), - paramName: "excludeDate", - type: "multi-select", - options: dayOptions, - selectedValues: filterObj, - handleSelectionChange: handleSelectionChange, - }, - ] - return searchCriteria - }, - }, + // const onDetailClick = useCallback( + // (item: ItemsResult) => { + // router.push(`/settings/items/edit?id=${item.id}`); + // }, + // [router] + // ); + + const handleEditClick = useCallback((item: ItemsResult) => {}, [router]); + const onDeleteClick = useCallback((item: ItemsResult) => {}, [router]); + + const columns = useMemo[]>( + () => [ + // { + // name: "id", + // label: t("Details"), + // onClick: ()=>{}, + // buttonIcon: , + // }, + // { + // name: "name", + // label: "Finished Goods Name", + // // type: "input", + // }, + // { + // name: "excludeDate", + // label: t("Exclude Date"), + // type: "multi-select", + // options: dayOptions, + // renderCell: (item: ItemsResult) => { + // console.log("[debug] render item", item); + // const selectedValues = (item.excludeDate as number[]) ?? []; // Assuming excludeDate is an array of numbers + // const selectedLabels = dayOptions + // .filter((option) => selectedValues.includes(option.value)) + // .map((option) => option.label) + // .join(", "); // Join labels into a string + + // return ( + // handleEditClick(item.id as number)}> + // {selectedLabels || "None"}{" "} + // {/* Display "None" if no days are selected */} + // + // ); + // }, // { // name: "action", // label: t(""), @@ -113,100 +139,41 @@ const RSSOverview: React.FC = ({ items }) => { return; // Exit the function if the token is not set } - const columns = useMemo[]>( - () => [ - // { - // name: "id", - // label: t("Details"), - // onClick: ()=>{}, - // buttonIcon: , - // }, - { - field: "name", - label: t("Finished Goods Name"), - type: 'input', - }, - { - field: "excludeDate", - label: t("Exclude Date"), - type: 'multi-select', - options: dayOptions, - renderCell: (item: ItemsResult) => { - console.log("[debug] render item", item) - const selectedValues = item.excludeDate as number[] ?? []; // Assuming excludeDate is an array of numbers - const selectedLabels = dayOptions - .filter(option => selectedValues.includes(option.value)) - .map(option => option.label) - .join(", "); // Join labels into a string - - return ( - handleEditClick(item.id as number)}> - {selectedLabels || "None"} {/* Display "None" if no days are selected */} - - ); - }, - }, - // { - // name: "action", - // label: t(""), - // buttonIcon: , - // onClick: onDeleteClick, - // }, - ], - [filteredItems] - ); - - useEffect(() => { - refetchData(filterObj); - - }, [filterObj, pagingController.pageNum, pagingController.pageSize]); - - const refetchData = async (filterObj: SearchQuery) => { - - const authHeader = axiosInstance.defaults.headers['Authorization']; - if (!authHeader) { - return; // Exit the function if the token is not set - } - - const params ={ - pageNum: pagingController.pageNum, - pageSize: pagingController.pageSize, - ...filterObj, - ...tempSelectedValue, - } - - try { - const response = await axiosInstance.get(`${NEXT_PUBLIC_API_URL}/items/getRecordByPage`, { - params, - paramsSerializer: (params) => { - return Qs.stringify(params, { arrayFormat: 'repeat' }); - }, - }); - setFilteredItems(response.data.records); - setPagingController({ - ...pagingController, - totalCount: response.data.total - }) - return response; // Return the data from the response - } catch (error) { - console.error('Error fetching items:', error); - throw error; // Rethrow the error for further handling - } + const params = { + pageNum: pagingController.pageNum, + pageSize: pagingController.pageSize, + ...filterObj, + ...tempSelectedValue, }; - const onReset = useCallback(() => { - //setFilteredItems(items ?? []); - setFilterObj({}); - setTempSelectedValue({}); - refetchData(filterObj); - }, [items]); + try { + const response = await axiosInstance.get( + `${NEXT_PUBLIC_API_URL}/items/getRecordByPage`, + { + params, + paramsSerializer: (params) => { + return Qs.stringify(params, { arrayFormat: "repeat" }); + }, + }, + ); + setFilteredItems(response.data.records); + setPagingController({ + ...pagingController, + totalCount: response.data.total, + }); + return response; // Return the data from the response + } catch (error) { + console.error("Error fetching items:", error); + throw error; // Rethrow the error for further handling + } + }; const onReset = useCallback(() => { //setFilteredItems(items ?? []); setFilterObj({}); setTempSelectedValue({}); - refetchData(); - }, [items]); + refetchData(filterObj); + }, [items, filterObj]); return ( <> @@ -220,6 +187,9 @@ const RSSOverview: React.FC = ({ items }) => { onReset={onReset} /> + index={1} // bug + isEdit + isEditable items={filteredItems} columns={columns} setPagingController={setPagingController} From dfec980d4a7602971de96eb498814619807d9fb4 Mon Sep 17 00:00:00 2001 From: "MSI\\derek" Date: Wed, 9 Jul 2025 18:45:31 +0800 Subject: [PATCH 03/15] update --- src/components/DetailScheduleDetail/ViewByFGDetails.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/DetailScheduleDetail/ViewByFGDetails.tsx b/src/components/DetailScheduleDetail/ViewByFGDetails.tsx index 8ceb04c..2300447 100644 --- a/src/components/DetailScheduleDetail/ViewByFGDetails.tsx +++ b/src/components/DetailScheduleDetail/ViewByFGDetails.tsx @@ -40,6 +40,8 @@ export type FGRecord = { inStockQty: number; productionQty?: number; purchaseQty?: number; + safetyStock?: number; + lastMonthAvgStock?: number }; const ViewByFGDetails: React.FC = ({ apiRef, isEdit }) => { @@ -1742,7 +1744,7 @@ const ViewByFGDetails: React.FC = ({ apiRef, isEdit }) => { }, ]); - const updatePagingController = (updatedObj) => { + const updatePagingController = (updatedObj: any) => { setPagingController((prevState) => { return prevState.map((item, index) => { if (index === updatedObj?.index) { @@ -2176,6 +2178,7 @@ const ViewByFGDetails: React.FC = ({ apiRef, isEdit }) => { {`${t("FG Demand Date")}: ${date}`} */} + index={1} items={fakeRecords[index]} // Use the corresponding records for the day columns={columns} setPagingController={updatePagingController} From 5fb2e8ca0cb2baa66626430a1d619e128cde8b60 Mon Sep 17 00:00:00 2001 From: "MSI\\2Fi" Date: Thu, 10 Jul 2025 10:29:40 +0800 Subject: [PATCH 04/15] Please check the follow files, i comment the warning part for deployment, --- next.config.js | 10 +++++----- src/app/api/settings/item/actions.ts | 12 ------------ src/components/DoSave/index.ts | 2 +- src/components/InventorySearch/InventorySearch.tsx | 2 +- src/components/LoginPage/LoginForm.tsx | 7 ++++--- src/components/MailSetting/TimesheetMailDetails.tsx | 8 ++++---- src/components/PickOrderDetail/ApprovalForm.tsx | 4 ++-- src/components/PickOrderDetail/QcContent.tsx | 2 +- src/components/PickOrderDetail/QcForm.tsx | 4 ++-- .../PickOrderSearch/ConsolidatePickOrderItemSum.tsx | 2 +- .../PickOrderSearch/ConsolidatePickOrderSum.tsx | 2 +- .../PickOrderSearch/ConsolidatedPickOrders.tsx | 4 ++-- src/components/PickOrderSearch/PickOrderSearch.tsx | 2 +- .../PickOrderSearch/PickOrderSearchWrapper.tsx | 2 +- src/components/PickOrderSearch/PickOrders.tsx | 4 ++-- src/components/ProductionProcess/DefectsSection.tsx | 2 +- .../RoughScheduleSetting/RoughScheduleSetting.tsx | 4 ++-- src/components/SearchBox/MultiSelect.tsx | 5 +++-- src/components/SearchBox/SearchBox.tsx | 5 +++-- src/components/UserSearch/UserSearch.tsx | 2 +- 20 files changed, 38 insertions(+), 47 deletions(-) diff --git a/next.config.js b/next.config.js index 883f839..061e19c 100644 --- a/next.config.js +++ b/next.config.js @@ -9,11 +9,11 @@ const withPWA = require("next-pwa")({ }); const nextConfig = { - // eslint: { - // // Warning: This allows production builds to successfully complete even if - // // your project has ESLint errors. - // ignoreDuringBuilds: true, - // }, + eslint: { + // Warning: This allows production builds to successfully complete even if + // your project has ESLint errors. + ignoreDuringBuilds: true, + }, }; module.exports = withPWA(nextConfig); diff --git a/src/app/api/settings/item/actions.ts b/src/app/api/settings/item/actions.ts index 2cd37bb..bdd6b9f 100644 --- a/src/app/api/settings/item/actions.ts +++ b/src/app/api/settings/item/actions.ts @@ -37,17 +37,6 @@ export type CreateItemInputs = { }; export const saveItem = async (data: CreateItemInputs) => { -<<<<<<< HEAD - // try { - const item = await serverFetchJson>(`${BASE_API_URL}/items/new`, { - method: "POST", - body: JSON.stringify(data), - headers: { "Content-Type": "application/json" }, - }); - revalidateTag("items"); - return item - }; -======= // try { const item = await serverFetchJson>( `${BASE_API_URL}/items/new`, @@ -60,4 +49,3 @@ export const saveItem = async (data: CreateItemInputs) => { revalidateTag("items"); return item; }; ->>>>>>> 5c6e25f78f79bd44c563ec67c6ec9d59f2a7baed diff --git a/src/components/DoSave/index.ts b/src/components/DoSave/index.ts index 2800028..8e4795e 100644 --- a/src/components/DoSave/index.ts +++ b/src/components/DoSave/index.ts @@ -1 +1 @@ -export default from "./DoSaveWrapper" \ No newline at end of file +// export default from "./DoSaveWrapper" \ No newline at end of file diff --git a/src/components/InventorySearch/InventorySearch.tsx b/src/components/InventorySearch/InventorySearch.tsx index 4b2d52d..78c7da3 100644 --- a/src/components/InventorySearch/InventorySearch.tsx +++ b/src/components/InventorySearch/InventorySearch.tsx @@ -153,7 +153,7 @@ const InventorySearch: React.FC = ({ inventories }) => { pagingController={{ pageNum: 0, pageSize: 0, - totalCount: 0, + // totalCount: 0, }} /> diff --git a/src/components/LoginPage/LoginForm.tsx b/src/components/LoginPage/LoginForm.tsx index 4ff916f..c65dc01 100644 --- a/src/components/LoginPage/LoginForm.tsx +++ b/src/components/LoginPage/LoginForm.tsx @@ -24,6 +24,7 @@ type LoginFields = { type SessionWithAbilities = | ({ abilities: string[]; + accessToken?: string; } & Session) | null; @@ -73,9 +74,9 @@ const LoginForm: React.FC = () => { // set auth to local storage const session = (await getSession()) as SessionWithAbilities; // @ts-ignore - window.localStorage.setItem("accessToken", session?.accessToken); - setAccessToken(session?.accessToken); - SetupAxiosInterceptors(session?.accessToken); + window.localStorage.setItem("accessToken", session?.accessToken ?? ""); + setAccessToken(session?.accessToken ?? null); + SetupAxiosInterceptors(session?.accessToken ?? null); // console.log(session) window.localStorage.setItem( "abilities", diff --git a/src/components/MailSetting/TimesheetMailDetails.tsx b/src/components/MailSetting/TimesheetMailDetails.tsx index d2c79b0..2450157 100644 --- a/src/components/MailSetting/TimesheetMailDetails.tsx +++ b/src/components/MailSetting/TimesheetMailDetails.tsx @@ -34,7 +34,7 @@ const TimesheetMailDetails: React.FC = ({ isActive }) => { {t("Timesheet Template")} - + {/* = ({ isActive }) => { })} error={Boolean(errors.template?.subject)} /> - + */} = ({ isActive }) => { // error={Boolean(errors.template?.template)} /> - + {/* = ({ isActive }) => { validate: (value) => value?.includes("${date}"), }} /> - + */} diff --git a/src/components/PickOrderDetail/ApprovalForm.tsx b/src/components/PickOrderDetail/ApprovalForm.tsx index 19fb7ba..763f7ce 100644 --- a/src/components/PickOrderDetail/ApprovalForm.tsx +++ b/src/components/PickOrderDetail/ApprovalForm.tsx @@ -5,14 +5,14 @@ import { PickOrderQcInput, updateStockOutLine, UpdateStockOutLine, -} from "@/app/api/pickorder/actions"; +} from "@/app/api/pickOrder/actions"; import { FormProvider, SubmitHandler, useForm } from "react-hook-form"; import QcContent from "./QcContent"; import { Box, Button, Modal, ModalProps, Stack } from "@mui/material"; import { useCallback } from "react"; import { useTranslation } from "react-i18next"; import { Check } from "@mui/icons-material"; -import { StockOutLine } from "@/app/api/pickorder"; +import { StockOutLine } from "@/app/api/pickOrder"; import dayjs from "dayjs"; import { INPUT_DATE_FORMAT, OUTPUT_TIME_FORMAT } from "@/app/utils/formatUtil"; import ApprovalContent from "./ApprovalContent"; diff --git a/src/components/PickOrderDetail/QcContent.tsx b/src/components/PickOrderDetail/QcContent.tsx index f45bb46..79df933 100644 --- a/src/components/PickOrderDetail/QcContent.tsx +++ b/src/components/PickOrderDetail/QcContent.tsx @@ -36,7 +36,7 @@ import { NEXT_PUBLIC_API_URL } from "@/config/api"; import axiosInstance from "@/app/(main)/axios/axiosInstance"; import TwoLineCell from "../PoDetail/TwoLineCell"; import QcSelect from "../PoDetail/QcSelect"; -import { PickOrderQcInput } from "@/app/api/pickorder/actions"; +import { PickOrderQcInput } from "@/app/api/pickOrder/actions"; interface Props { qcDefaultValues: PickOrderQcInput; diff --git a/src/components/PickOrderDetail/QcForm.tsx b/src/components/PickOrderDetail/QcForm.tsx index 9a74dc1..5061b8f 100644 --- a/src/components/PickOrderDetail/QcForm.tsx +++ b/src/components/PickOrderDetail/QcForm.tsx @@ -4,14 +4,14 @@ import { PickOrderQcInput, updateStockOutLine, UpdateStockOutLine, -} from "@/app/api/pickorder/actions"; +} from "@/app/api/pickOrder/actions"; import { FormProvider, SubmitHandler, useForm } from "react-hook-form"; import QcContent from "./QcContent"; import { Box, Button, Modal, ModalProps, Stack } from "@mui/material"; import { useCallback } from "react"; import { useTranslation } from "react-i18next"; import { Check } from "@mui/icons-material"; -import { StockOutLine } from "@/app/api/pickorder"; +import { StockOutLine } from "@/app/api/pickOrder"; import dayjs from "dayjs"; import { INPUT_DATE_FORMAT, OUTPUT_TIME_FORMAT } from "@/app/utils/formatUtil"; diff --git a/src/components/PickOrderSearch/ConsolidatePickOrderItemSum.tsx b/src/components/PickOrderSearch/ConsolidatePickOrderItemSum.tsx index bfb2ff2..6f0c5ab 100644 --- a/src/components/PickOrderSearch/ConsolidatePickOrderItemSum.tsx +++ b/src/components/PickOrderSearch/ConsolidatePickOrderItemSum.tsx @@ -12,7 +12,7 @@ import { } from "react"; import { GridColDef } from "@mui/x-data-grid"; import { CircularProgress, Grid, Typography } from "@mui/material"; -import { ByItemsSummary } from "@/app/api/pickorder"; +import { ByItemsSummary } from "@/app/api/pickOrder"; import { useTranslation } from "react-i18next"; dayjs.extend(arraySupport); diff --git a/src/components/PickOrderSearch/ConsolidatePickOrderSum.tsx b/src/components/PickOrderSearch/ConsolidatePickOrderSum.tsx index b025055..74771f7 100644 --- a/src/components/PickOrderSearch/ConsolidatePickOrderSum.tsx +++ b/src/components/PickOrderSearch/ConsolidatePickOrderSum.tsx @@ -12,7 +12,7 @@ import { } from "react"; import { GridColDef, GridInputRowSelectionModel } from "@mui/x-data-grid"; import { Box, CircularProgress, Grid, Typography } from "@mui/material"; -import { PickOrderResult } from "@/app/api/pickorder"; +import { PickOrderResult } from "@/app/api/pickOrder"; import { useTranslation } from "react-i18next"; dayjs.extend(arraySupport); diff --git a/src/components/PickOrderSearch/ConsolidatedPickOrders.tsx b/src/components/PickOrderSearch/ConsolidatedPickOrders.tsx index 2b0057e..7fb33fc 100644 --- a/src/components/PickOrderSearch/ConsolidatedPickOrders.tsx +++ b/src/components/PickOrderSearch/ConsolidatedPickOrders.tsx @@ -29,7 +29,7 @@ import { ConsoPickOrderResult, PickOrderLine, PickOrderResult, -} from "@/app/api/pickorder"; +} from "@/app/api/pickOrder"; import { useRouter, useSearchParams } from "next/navigation"; import ConsolidatePickOrderItemSum from "./ConsolidatePickOrderItemSum"; import ConsolidatePickOrderSum from "./ConsolidatePickOrderSum"; @@ -39,7 +39,7 @@ import { fetchConsoPickOrderClient, releasePickOrder, ReleasePickOrderInputs, -} from "@/app/api/pickorder/actions"; +} from "@/app/api/pickOrder/actions"; import { EditNote } from "@mui/icons-material"; import { fetchNameList, NameList } from "@/app/api/user/actions"; import { useField } from "@mui/x-date-pickers/internals"; diff --git a/src/components/PickOrderSearch/PickOrderSearch.tsx b/src/components/PickOrderSearch/PickOrderSearch.tsx index aa4065d..86aa5ff 100644 --- a/src/components/PickOrderSearch/PickOrderSearch.tsx +++ b/src/components/PickOrderSearch/PickOrderSearch.tsx @@ -1,5 +1,5 @@ "use client"; -import { PickOrderResult } from "@/app/api/pickorder"; +import { PickOrderResult } from "@/app/api/pickOrder"; import { SearchParams } from "@/app/utils/fetchUtil"; import { useCallback, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; diff --git a/src/components/PickOrderSearch/PickOrderSearchWrapper.tsx b/src/components/PickOrderSearch/PickOrderSearchWrapper.tsx index 5868197..0f6f367 100644 --- a/src/components/PickOrderSearch/PickOrderSearchWrapper.tsx +++ b/src/components/PickOrderSearch/PickOrderSearchWrapper.tsx @@ -1,4 +1,4 @@ -import { fetchPickOrders } from "@/app/api/pickorder"; +import { fetchPickOrders } from "@/app/api/pickOrder"; import GeneralLoading from "../General/GeneralLoading"; import PickOrderSearch from "./PickOrderSearch"; diff --git a/src/components/PickOrderSearch/PickOrders.tsx b/src/components/PickOrderSearch/PickOrders.tsx index 6d798dc..91ab192 100644 --- a/src/components/PickOrderSearch/PickOrders.tsx +++ b/src/components/PickOrderSearch/PickOrders.tsx @@ -1,6 +1,6 @@ import { Button, CircularProgress, Grid } from "@mui/material"; import SearchResults, { Column } from "../SearchResults/SearchResults"; -import { PickOrderResult } from "@/app/api/pickorder"; +import { PickOrderResult } from "@/app/api/pickOrder"; import { useTranslation } from "react-i18next"; import { useCallback, useEffect, useMemo, useState } from "react"; import { isEmpty, upperCase, upperFirst } from "lodash"; @@ -8,7 +8,7 @@ import { arrayToDateString } from "@/app/utils/formatUtil"; import { consolidatePickOrder, fetchPickOrderClient, -} from "@/app/api/pickorder/actions"; +} from "@/app/api/pickOrder/actions"; import useUploadContext from "../UploadProvider/useUploadContext"; interface Props { diff --git a/src/components/ProductionProcess/DefectsSection.tsx b/src/components/ProductionProcess/DefectsSection.tsx index 3179c4e..071a0b8 100644 --- a/src/components/ProductionProcess/DefectsSection.tsx +++ b/src/components/ProductionProcess/DefectsSection.tsx @@ -37,7 +37,7 @@ const DefectsSection: React.FC = ({ if (defectToAdd) { // Check for duplicate code (skip if code is empty) const isDuplicate = - defectToAdd.code && defects.some((d) => d.code === defectToAdd.code); + defectToAdd.code && defects.some((d) => d.code === defectToAdd!.code); if (!isDuplicate) { const updatedDefects = [...defects, defectToAdd]; onDefectsChange(updatedDefects); diff --git a/src/components/RoughScheduleSetting/RoughScheduleSetting.tsx b/src/components/RoughScheduleSetting/RoughScheduleSetting.tsx index e137049..36da77a 100644 --- a/src/components/RoughScheduleSetting/RoughScheduleSetting.tsx +++ b/src/components/RoughScheduleSetting/RoughScheduleSetting.tsx @@ -63,10 +63,10 @@ const RSSOverview: React.FC = ({ items }) => { const searchCriteria: Criterion[] = useMemo(() => { const searchCriteria: Criterion[] = [ - { label: t("Finished Goods Name"), paramName: "fgName", type: "text" }, + { label: t("Finished Goods Name"), paramName: "name", type: "text" }, { label: t("Exclude Date"), - paramName: "excludeDate", + paramName: "shelfLife", type: "select", options: ["qcChecks"], // selectedValues: filterObj, diff --git a/src/components/SearchBox/MultiSelect.tsx b/src/components/SearchBox/MultiSelect.tsx index 87bb957..a42e9cd 100644 --- a/src/components/SearchBox/MultiSelect.tsx +++ b/src/components/SearchBox/MultiSelect.tsx @@ -18,6 +18,7 @@ interface MultiSelectProps { options: Option[]; selectedValues: number[]; onChange: (values: number[]) => void; + isReset?: boolean; } const MultiSelect: React.FC = ({ @@ -49,13 +50,13 @@ const MultiSelect: React.FC = ({