feat: product select

This commit is contained in:
2024-09-03 15:20:44 +03:00
parent 51635c1dc0
commit 56a52dbf86

View File

@@ -55,7 +55,9 @@ const ProductSelect: FC<Props> = (props: Props) => {
const filtered = (options as ComboboxItem[]).filter((option) => {
const product = products.find(product => product.id == parseInt(option.value));
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 (
<ObjectSelect
limit={products.length > 500 ? 500 : Infinity}
renderOption={renderOption}
searchable
{...restProps}