feat: filter sellable and purchasable items.

This commit is contained in:
Ahmed Bouhuolia
2020-11-24 11:24:48 +02:00
parent 4cdaacfa61
commit a7e5401b7d
5 changed files with 51 additions and 16 deletions

View File

@@ -1,5 +1,7 @@
import React, { useCallback, useMemo } from 'react';
import { MenuItem, Button } from '@blueprintjs/core';
import { MenuItem } from '@blueprintjs/core';
import classNames from 'classnames';
import { CLASSES } from 'common/classes';
import ListSelect from 'components/ListSelect';
import { FormattedMessage as T } from 'react-intl';
@@ -9,6 +11,7 @@ export default function ContactsListField({
selectedContactId,
selectedContactType,
defautlSelectText = <T id={'select_contact'} />,
popoverFill = false,
}) {
// Contact item of select accounts field.
const contactRenderer = useCallback(
@@ -39,13 +42,16 @@ export default function ContactsListField({
items={items}
noResults={<MenuItem disabled={true} text="No results." />}
itemRenderer={contactRenderer}
popoverProps={{ minimal: true }}
filterable={true}
onItemSelect={onContactSelect}
labelProp={'display_name'}
selectedItem={`${selectedContactId}_${selectedContactType}`}
selectedItemProp={'_id'}
defaultText={defautlSelectText}
popoverProps={{ minimal: true, usePortal: !popoverFill }}
className={classNames(CLASSES.FORM_GROUP_LIST_SELECT, {
[CLASSES.SELECT_LIST_FILL_POPOVER]: popoverFill,
})}
/>
);
}