From db38b7f7c1703dac7765a84419cbac80af534a36 Mon Sep 17 00:00:00 2001 From: "cyril.tsui" Date: Fri, 8 Aug 2025 15:54:54 +0800 Subject: [PATCH] update --- src/components/PoDetail/PoDetail.tsx | 85 ++++++++++++++------------ src/components/PoDetail/PoInfoCard.tsx | 51 +++++++++++++++- 2 files changed, 95 insertions(+), 41 deletions(-) diff --git a/src/components/PoDetail/PoDetail.tsx b/src/components/PoDetail/PoDetail.tsx index d958351..3da787d 100644 --- a/src/components/PoDetail/PoDetail.tsx +++ b/src/components/PoDetail/PoDetail.tsx @@ -62,6 +62,7 @@ import QrModal from "./QrModal"; import { PlayArrow } from "@mui/icons-material"; import DoneIcon from "@mui/icons-material/Done"; import { getCustomWidth } from "@/app/utils/commonUtil"; +import PoInfoCard from "./PoInfoCard"; type Props = { po: PoResult; @@ -71,8 +72,8 @@ type Props = { type EntryError = | { - [field in keyof StockInLine]?: string; - } + [field in keyof StockInLine]?: string; + } | undefined; // type PolRow = TableRow, EntryError>; const PoDetail: React.FC = ({ po, qc, warehouse }) => { @@ -84,6 +85,7 @@ const PoDetail: React.FC = ({ po, qc, warehouse }) => { const [rows, setRows] = useState( purchaseOrder.pol || [], ); + const searchParams = useSearchParams(); // const [currPoStatus, setCurrPoStatus] = useState(purchaseOrder.status); @@ -186,7 +188,7 @@ const PoDetail: React.FC = ({ po, qc, warehouse }) => { {/* */} - {/* */} + {/* */} @@ -294,9 +296,9 @@ const PoDetail: React.FC = ({ po, qc, warehouse }) => { switch (field) { case FIRST_IN_FIELD: - return true; + return true; case SECOND_IN_FIELD: - return true; + return true; default: return false; // Default case } @@ -306,8 +308,8 @@ const PoDetail: React.FC = ({ po, qc, warehouse }) => { <> @@ -333,7 +335,7 @@ const PoDetail: React.FC = ({ po, qc, warehouse }) => { } }} /> - + = ({ po, qc, warehouse }) => { {/* tab 1 */} - - - {/* */} -
- - - {/* for the collapse button */} - {t("itemNo")} - {t("itemName")} - {t("qty")} - {t("processed")} - {t("uom")} - {t("total weight")} - {/* {t("weight unit")} */} - {t("price")} - {/* {t("expiryDate")} */} - {t("status")} - {/* start == true && firstInQty == null ? no hide : hide*/} - {/* {renderFieldCondition(FIRST_IN_FIELD) ? {t("receivedQty")} : undefined} */} - {/* start == true && firstInQty == null ? hide and disabled : no hide*/} - {/* {renderFieldCondition(SECOND_IN_FIELD) ? {t("dnQty")} : undefined} */} - {/* {"add icon button"} */} - - - - {rows.map((row) => ( - - ))} - -
- + + + + + + + {/* */} + + + + {/* for the collapse button */} + {t("itemNo")} + {t("itemName")} + {t("qty")} + {t("processed")} + {t("uom")} + {t("total weight")} + {/* {t("weight unit")} */} + {t("price")} + {/* {t("expiryDate")} */} + {t("status")} + {/* start == true && firstInQty == null ? no hide : hide*/} + {/* {renderFieldCondition(FIRST_IN_FIELD) ? {t("receivedQty")} : undefined} */} + {/* start == true && firstInQty == null ? hide and disabled : no hide*/} + {/* {renderFieldCondition(SECOND_IN_FIELD) ? {t("dnQty")} : undefined} */} + {/* {"add icon button"} */} + + + + {rows.map((row) => ( + + ))} + +
+
+
{/* tab 2 */} diff --git a/src/components/PoDetail/PoInfoCard.tsx b/src/components/PoDetail/PoInfoCard.tsx index 0b5688e..87fddd4 100644 --- a/src/components/PoDetail/PoInfoCard.tsx +++ b/src/components/PoDetail/PoInfoCard.tsx @@ -1,3 +1,5 @@ +import { PoResult } from "@/app/api/po"; +import { arrayToDateString } from "@/app/utils/formatUtil"; import { Box, Button, @@ -8,21 +10,66 @@ import { Tab, Tabs, TabsProps, + TextField, Typography, } from "@mui/material"; +import { useTranslation } from "react-i18next"; type Props = { // id?: number + po: PoResult; }; const PoInfoCard: React.FC = async ( { // id + po }, ) => { + + const { t } = useTranslation("purchaseOrder") return ( <> - - + + + + + + + + + + + + + + + + + );