diff --git a/client/src/components/ContactsListField.js b/client/src/components/ContactsListField.js new file mode 100644 index 000000000..7e73470f2 --- /dev/null +++ b/client/src/components/ContactsListField.js @@ -0,0 +1,51 @@ +import React, { useCallback, useState } from 'react'; +import { + MenuItem, + Button, +} from '@blueprintjs/core'; +import ListSelect from 'components/ListSelect'; +import { FormattedMessage as T } from 'react-intl'; + +export default function ContactsListField({ + contacts, + onContactSelected, + error, + initialContact, + defautlSelectText = () +}) { + const [selectedContact, setSelectedContact] = useState( + initialContact || null + ); + + const contactTypeLabel = (contactType) => { + switch(contactType) { + case 'customer': + return 'Customer'; + case 'vendor': + return 'Vendor'; + } + }; + // Contact item of select accounts field. + const contactItem = useCallback((item, { handleClick, modifiers, query }) => ( + + ), []); + + const onContactSelect = useCallback((contact) => { + setSelectedContact(contact.id); + onContactSelected && onContactSelected(contact.id); + }, [setSelectedContact, onContactSelected]); + + return ( + } + itemRenderer={contactItem} + popoverProps={{ minimal: true }} + filterable={true} + onItemSelect={onContactSelect} + labelProp={'display_name'} + selectedItem={selectedContact} + selectedItemProp={'id'} + defaultText={defautlSelectText} /> + ); +} \ No newline at end of file diff --git a/client/src/components/Dashboard/DashboardTopbar.js b/client/src/components/Dashboard/DashboardTopbar.js index ecc9940dd..53e792c8d 100644 --- a/client/src/components/Dashboard/DashboardTopbar.js +++ b/client/src/components/Dashboard/DashboardTopbar.js @@ -7,6 +7,8 @@ import { NavbarDivider, Button, Classes, + Tooltip, + Position, } from '@blueprintjs/core'; import { FormattedMessage as T } from 'react-intl'; @@ -56,25 +58,27 @@ function DashboardTopbar({
-