From 33f64dfaafcb0b6a9fe81e2313b94541c984dddb Mon Sep 17 00:00:00 2001 From: "CANCERYS\\kw093" Date: Tue, 27 Oct 2026 17:24:50 +0800 Subject: [PATCH] ui update --- .../ApproverStockTakeAll.tsx | 75 +++++++++++++------ .../StockTakeRoundCardList.tsx | 8 +- 2 files changed, 56 insertions(+), 27 deletions(-) diff --git a/src/components/StockTakeManagement/ApproverStockTakeAll.tsx b/src/components/StockTakeManagement/ApproverStockTakeAll.tsx index bd50558f..ba046733 100644 --- a/src/components/StockTakeManagement/ApproverStockTakeAll.tsx +++ b/src/components/StockTakeManagement/ApproverStockTakeAll.tsx @@ -58,6 +58,7 @@ import { stockTakeQtyEndAdornment, StockTakeQtyWithUnit } from "./stockTakeQtyAd import StockTakeQtyGapHint from "./StockTakeQtyGapHint"; import { stockTakeHiddenOnHand, stockTakeQtyGapWarnText } from "./stockTakeQtyGapWarning"; import { useStockTakeQtyGapWarnPercent } from "./useStockTakeQtyGapWarnPercent"; +import { statusChipColor } from "./StockTakeRoundCardList"; import { useSession } from "next-auth/react"; import { SessionWithTokens } from "@/config/authConfig"; import { AUTH } from "@/authorities"; @@ -1176,7 +1177,12 @@ const ApproverStockTakeAll: React.FC = ({ }; /** Word-style: same location grouped under a heading (picker-like). */ const locationGroups = useMemo(() => { - const groups: { key: string; label: string; items: InventoryLotDetailResponse[] }[] = []; + const groups: { + key: string; + label: string; + sectionLabels: string[]; + items: InventoryLotDetailResponse[]; + }[] = []; const indexByKey = new Map(); for (const detail of sortedDetails) { const area = detail.warehouseArea?.trim() || ""; @@ -1192,9 +1198,17 @@ const ApproverStockTakeAll: React.FC = ({ if (idx == null) { idx = groups.length; indexByKey.set(key, idx); - groups.push({ key, label, items: [] }); + groups.push({ key, label, sectionLabels: [], items: [] }); } groups[idx].items.push(detail); + const sectionCode = detail.stockTakeSection?.trim() || ""; + if (sectionCode) { + const sectionDesc = detail.stockTakeSectionDescription?.trim() || ""; + const sectionLabel = sectionDesc ? `${sectionCode} (${sectionDesc})` : sectionCode; + if (!groups[idx].sectionLabels.includes(sectionLabel)) { + groups[idx].sectionLabels.push(sectionLabel); + } + } } return groups; }, [sortedDetails]); @@ -1252,16 +1266,22 @@ const ApproverStockTakeAll: React.FC = ({ { field: "uom", headerName: t("UOM"), - minWidth: 90, - flex: 0.4, + minWidth: 140, + flex: 0.75, sortable: false, - valueGetter: (params) => params.row.uom || "-", + align: "center", + headerAlign: "center", + renderCell: (params) => ( + + {params.row.uom || "-"} + + ), }, { field: "qtyBlock", headerName: t("Stock Take Qty Data and Variance Analysis"), - minWidth: 480, - flex: 3.2, + minWidth: 420, + flex: 2.7, sortable: false, renderCell: (params: GridRenderCellParams) => { const detail = params.row; @@ -1545,24 +1565,20 @@ const ApproverStockTakeAll: React.FC = ({ minWidth: 130, flex: 0.6, sortable: false, + align: "center", + headerAlign: "center", renderCell: (params) => { const raw = params.row.stockTakeRecordStatus; const status = String(raw ?? "").trim().toLowerCase(); - - const colorMap: Record = { - completed: "success", - notmatch: "warning", - pending: "info", - "not_match": "warning", - }; - return ( - + + + ); } }, @@ -1572,7 +1588,13 @@ const ApproverStockTakeAll: React.FC = ({ minWidth: 140, flex: 0.7, sortable: false, - valueGetter: (params) => params.row.stockTakerName || "-", + align: "center", + headerAlign: "center", + renderCell: (params) => ( + + {params.row.stockTakerName || "-"} + + ), }, { field: "actions", @@ -1580,6 +1602,8 @@ const ApproverStockTakeAll: React.FC = ({ minWidth: 110, flex: 0.9, sortable: false, + align: "center", + headerAlign: "center", renderCell: (params) => { const detail = params.row; const hasSecond = detail.secondStockTakeQty != null && detail.secondStockTakeQty >= 0; @@ -1587,7 +1611,7 @@ const ApproverStockTakeAll: React.FC = ({ qtySelection[detail.id] || (hasSecond ? "second" : "first"); return ( - + {mode === "pending" && ( <> @@ -2166,6 +2190,9 @@ const ApproverStockTakeAll: React.FC = ({ {t("Warehouse Location")}: {group.label} + {group.sectionLabels.length > 0 + ? ` ยท ${t("Stock Take Section code")}: ${group.sectionLabels.join(", ")}` + : ""} = ({ sx={{ backgroundColor: "transparent", "& .MuiDataGrid-columnHeaders": { backgroundColor: "#fff" }, - "& .MuiDataGrid-cell": { py: 1, alignItems: "flex-start" }, + "& .MuiDataGrid-cell": { py: 1, alignItems: "center" }, "& .MuiDataGrid-row": { minHeight: 96 }, }} /> diff --git a/src/components/StockTakeManagement/StockTakeRoundCardList.tsx b/src/components/StockTakeManagement/StockTakeRoundCardList.tsx index fb100fda..1e419fa8 100644 --- a/src/components/StockTakeManagement/StockTakeRoundCardList.tsx +++ b/src/components/StockTakeManagement/StockTakeRoundCardList.tsx @@ -308,9 +308,11 @@ const StockTakeRoundCardList: React.FC = ({ ) : null} - + {listView !== "history" ? ( + + ) : null}