Przeglądaj źródła

DO補貨 search itemName

production
tommy 6 dni temu
rodzic
commit
10ad3fc3ea
3 zmienionych plików z 33 dodań i 10 usunięć
  1. +31
    -10
      src/components/DoSearch/DoReplenishmentTab.tsx
  2. +1
    -0
      src/i18n/en/do.json
  3. +1
    -0
      src/i18n/zh/do.json

+ 31
- 10
src/components/DoSearch/DoReplenishmentTab.tsx Wyświetl plik

@@ -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">


+ 1
- 0
src/i18n/en/do.json Wyświetl plik

@@ -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",


+ 1
- 0
src/i18n/zh/do.json Wyświetl plik

@@ -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",


Ładowanie…
Anuluj
Zapisz