diff --git a/src/components/DoSearch/DoReplenishmentTab.tsx b/src/components/DoSearch/DoReplenishmentTab.tsx index 17e014a..13f94d7 100644 --- a/src/components/DoSearch/DoReplenishmentTab.tsx +++ b/src/components/DoSearch/DoReplenishmentTab.tsx @@ -151,6 +151,16 @@ function lineUomDisplay(line?: DoDetailLine | null): string { return (line.shortUom ?? line.uomCode ?? line.uom ?? "").trim(); } +function filterSourceDoLines(lines: DoDetailLine[], inputValue: string): DoDetailLine[] { + const query = inputValue.trim().toLowerCase(); + if (!query) return lines; + return lines.filter((line) => { + const itemNo = (line.itemNo ?? "").toLowerCase(); + const itemName = (line.itemName ?? "").toLowerCase(); + return itemNo.includes(query) || itemName.includes(query); + }); +} + type DraftDoGroup = { sourceDoId: number; sourceDoCode: string; @@ -990,13 +1000,9 @@ const DoReplenishmentTab: React.FC = () => { onChange={(_, newValue) => setSelectedLine(newValue)} getOptionLabel={(line) => line.itemNo ?? ""} isOptionEqualToValue={(a, b) => a.id === b.id} - filterOptions={(options, { inputValue }) => { - const query = inputValue.trim().toLowerCase(); - if (!query) return options; - return options.filter((line) => - (line.itemNo ?? "").toLowerCase().includes(query), - ); - }} + filterOptions={(options, { inputValue }) => + filterSourceDoLines(options, inputValue) + } renderInput={(params) => { const { inputProps } = params; return ( @@ -1024,10 +1030,25 @@ const DoReplenishmentTab: React.FC = () => { /> - setSelectedLine(newValue)} + getOptionLabel={(line) => line.itemName ?? line.itemNo ?? ""} + isOptionEqualToValue={(a, b) => a.id === b.id} + filterOptions={(options, { inputValue }) => + filterSourceDoLines(options, inputValue) } + renderInput={(params) => ( + + )} + sx={REPLENISHMENT_TABLE_AUTOCOMPLETE_SX} /> diff --git a/src/i18n/en/do.json b/src/i18n/en/do.json index 56f9ce4..c23c21a 100644 --- a/src/i18n/en/do.json +++ b/src/i18n/en/do.json @@ -104,6 +104,7 @@ "Batch release replenishment info only": "Pending replenishments matching this search. For information only.", "Replenishment Entry": "Replenishment Entry", "Replenishment item code": "Item Code", + "Replenishment item name": "Item Name", "Replenishment Tracking": "Replenishment Tracking", "Required field": "Required field", "replenishmentDatePlaceholder": "YYYY-MM-DD", diff --git a/src/i18n/zh/do.json b/src/i18n/zh/do.json index a3dedc5..f078218 100644 --- a/src/i18n/zh/do.json +++ b/src/i18n/zh/do.json @@ -51,6 +51,7 @@ "Batch release replenishment info only": "以下為符合搜尋條件的待放單補貨,僅供查閱。", "Replenishment Entry": "補貨填表", "Replenishment item code": "貨品編號", + "Replenishment item name": "貨品名稱", "Replenishment Tracking": "補貨進度追蹤", "Required field": "為必填項", "replenishmentDatePlaceholder": "YYYY-MM-DD",