From 9f114ba499e1eff0a8042f39b91e9ac4d01df2b3 Mon Sep 17 00:00:00 2001 From: "CANCERYS\\kw093" Date: Tue, 25 Nov 2025 16:26:05 +0800 Subject: [PATCH] update --- src/components/PoDetail/PoDetail.tsx | 4 ++++ src/components/PoSearch/PoSearch.tsx | 12 +++++++--- .../ProductionProcessJobOrderDetail.tsx | 1 + src/components/SearchBox/SearchBox.tsx | 24 ++++++++++++------- .../SearchResults/SearchResults.tsx | 4 +++- 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/components/PoDetail/PoDetail.tsx b/src/components/PoDetail/PoDetail.tsx index 2af7c10..62159a7 100644 --- a/src/components/PoDetail/PoDetail.tsx +++ b/src/components/PoDetail/PoDetail.tsx @@ -266,6 +266,10 @@ const PoDetail: React.FC = ({ po, warehouse, printerCombo }) => { if (result) { console.log("%c Fetched PO:", "color:orange", result); setPurchaseOrder(result); + dnFormProps.reset({ + dnNo: "", + receiptDate: dayjsToDateString(dayjs()), + }); setRows(result.pol || []); if (result.pol && result.pol.length > 0) { if (result.id === selectedPoId && selectedRow?.id) { diff --git a/src/components/PoSearch/PoSearch.tsx b/src/components/PoSearch/PoSearch.tsx index 670e108..a9d6b82 100644 --- a/src/components/PoSearch/PoSearch.tsx +++ b/src/components/PoSearch/PoSearch.tsx @@ -66,9 +66,15 @@ const PoSearch: React.FC = ({ { label: t(`completed`), value: `completed` }, ], }, - { label: t("ETA"), label2: t("ETA To"), paramName: "estimatedArrivalDate", type: "dateRange", - preFilledValue: dayjsToDateString(dayjs(), "input") }, - + { label: t("ETA"), + label2: t("ETA To"), + paramName: "estimatedArrivalDate", + type: "dateRange", + preFilledValue: { + from: dayjsToDateString(dayjs(), "input"), + to: dayjsToDateString(dayjs(), "input"), + }, + }, ]; return searchCriteria; }, [t]); diff --git a/src/components/ProductionProcess/ProductionProcessJobOrderDetail.tsx b/src/components/ProductionProcess/ProductionProcessJobOrderDetail.tsx index 56635ff..4c281f6 100644 --- a/src/components/ProductionProcess/ProductionProcessJobOrderDetail.tsx +++ b/src/components/ProductionProcess/ProductionProcessJobOrderDetail.tsx @@ -378,6 +378,7 @@ const handleRelease = useCallback(() => { {t("Release")} )} + diff --git a/src/components/SearchBox/SearchBox.tsx b/src/components/SearchBox/SearchBox.tsx index 233e363..7a92a1d 100644 --- a/src/components/SearchBox/SearchBox.tsx +++ b/src/components/SearchBox/SearchBox.tsx @@ -39,7 +39,7 @@ interface BaseCriterion { paramName2?: T; // options?: T[] | string[]; defaultValue?: string; - preFilledValue?: string; + preFilledValue?: string | { from?: string; to?: string }; filterObj?: T; handleSelectionChange?: (selectedOptions: T[]) => void; } @@ -158,14 +158,22 @@ function SearchBox({ const preFilledInputs = useMemo(() => { const preFilledCriteria = criteria.reduce>( (acc, c) => { - if (c.preFilledValue !== undefined) { - return { - ...acc, - [c.paramName]: c.preFilledValue, - }; - } else return acc; + if (c.type === "dateRange" || c.type === "datetimeRange") { + if (typeof c.preFilledValue === "object" && c.preFilledValue !== null) { + return { + ...acc, + ...(c.preFilledValue.from ? { [c.paramName]: c.preFilledValue.from } : {}), + ...(c.preFilledValue.to ? { [`${c.paramName}To`]: c.preFilledValue.to } : {}), + }; + } + } + if (typeof c.preFilledValue === "string") { + return { ...acc, [c.paramName]: c.preFilledValue }; + } + return acc; }, - {} as Record,); + {} as Record, + ); return {...defaultInputs, ...preFilledCriteria} }, [defaultInputs]) diff --git a/src/components/SearchResults/SearchResults.tsx b/src/components/SearchResults/SearchResults.tsx index 1813134..562b044 100644 --- a/src/components/SearchResults/SearchResults.tsx +++ b/src/components/SearchResults/SearchResults.tsx @@ -221,12 +221,14 @@ function SearchResults({ event, ) => { console.log(event); - setRowsPerPage(+event.target.value); + const newSize = +event.target.value; + setRowsPerPage(newSize); setPage(0); if (setPagingController) { setPagingController({ ...(pagingController ?? defaultPagingController), pageNum: 1, + pageSize: newSize, }); } };