|
|
|
@@ -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 = () => { |
|
|
|
/> |
|
|
|
</TableCell> |
|
|
|
<TableCell> |
|
|
|
<ReplenishmentItemEntryPlainText |
|
|
|
value={ |
|
|
|
selectedLine ? (selectedLine.itemName ?? selectedLine.itemNo ?? "") : "" |
|
|
|
<Autocomplete |
|
|
|
size="small" |
|
|
|
fullWidth |
|
|
|
options={sourceDo.lines} |
|
|
|
value={selectedLine} |
|
|
|
onChange={(_, newValue) => setSelectedLine(newValue)} |
|
|
|
getOptionLabel={(line) => line.itemName ?? line.itemNo ?? ""} |
|
|
|
isOptionEqualToValue={(a, b) => a.id === b.id} |
|
|
|
filterOptions={(options, { inputValue }) => |
|
|
|
filterSourceDoLines(options, inputValue) |
|
|
|
} |
|
|
|
renderInput={(params) => ( |
|
|
|
<ReplenishmentTextField |
|
|
|
{...params} |
|
|
|
placeholder={t("Replenishment item name")} |
|
|
|
InputProps={{ ...params.InputProps, disableUnderline: true }} |
|
|
|
/> |
|
|
|
)} |
|
|
|
sx={REPLENISHMENT_TABLE_AUTOCOMPLETE_SX} |
|
|
|
/> |
|
|
|
</TableCell> |
|
|
|
<TableCell align="right"> |
|
|
|
|