feat: product select
This commit is contained in:
@@ -55,7 +55,9 @@ const ProductSelect: FC<Props> = (props: Props) => {
|
|||||||
const filtered = (options as ComboboxItem[]).filter((option) => {
|
const filtered = (options as ComboboxItem[]).filter((option) => {
|
||||||
const product = products.find(product => product.id == parseInt(option.value));
|
const product = products.find(product => product.id == parseInt(option.value));
|
||||||
if (!product) return true;
|
if (!product) return true;
|
||||||
return product.name.toLowerCase().includes(search.toLowerCase()) || product.barcodes.some((value) => value.toLowerCase().includes(search.toLowerCase()));
|
return product.name.toLowerCase().includes(search.toLowerCase()) ||
|
||||||
|
product.barcodes.some((value) => value.toLowerCase().includes(search.toLowerCase())) ||
|
||||||
|
product.article?.toLowerCase() === search.toLowerCase();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -64,6 +66,7 @@ const ProductSelect: FC<Props> = (props: Props) => {
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<ObjectSelect
|
<ObjectSelect
|
||||||
|
limit={products.length > 500 ? 500 : Infinity}
|
||||||
renderOption={renderOption}
|
renderOption={renderOption}
|
||||||
searchable
|
searchable
|
||||||
{...restProps}
|
{...restProps}
|
||||||
|
|||||||
Reference in New Issue
Block a user