diff --git a/src/components/Accounts/AccountMultiSelect.js b/src/components/Accounts/AccountMultiSelect.js new file mode 100644 index 000000000..8e9d54882 --- /dev/null +++ b/src/components/Accounts/AccountMultiSelect.js @@ -0,0 +1,73 @@ +import React from 'react'; +import styled from 'styled-components'; +import { MenuItem } from '@blueprintjs/core'; +import { FMultiSelect } from '../Forms'; +import classNames from 'classnames'; +import { Classes } from '@blueprintjs/popover2'; + +/** + * + * @param {*} query + * @param {*} account + * @param {*} _index + * @param {*} exactMatch + * @returns + */ +const accountItemPredicate = (query, account, _index, exactMatch) => { + const normalizedTitle = account.name.toLowerCase(); + const normalizedQuery = query.toLowerCase(); + + if (exactMatch) { + return normalizedTitle === normalizedQuery; + } else { + return `${account.code}. ${normalizedTitle}`.indexOf(normalizedQuery) >= 0; + } +}; + +/** + * + * @param {*} account + * @param {*} param1 + * @returns + */ +const accountItemRenderer = ( + account, + { handleClick, modifiers, query }, + { isSelected }, +) => { + return ( + + ); +}; + +const accountSelectProps = { + itemPredicate: accountItemPredicate, + itemRenderer: accountItemRenderer, + valueAccessor: (item) => item.id, + labelAccessor: (item) => item.code, + tagRenderer: (item) => item.name, +}; + +/** + * branches mulit select. + * @param {*} param0 + * @returns {JSX.Element} + */ +export function AccountMultiSelect({ accounts, ...rest }) { + return ( + + ); +} diff --git a/src/components/Accounts/index.js b/src/components/Accounts/index.js new file mode 100644 index 000000000..791394be9 --- /dev/null +++ b/src/components/Accounts/index.js @@ -0,0 +1 @@ +export * from './AccountMultiSelect'; diff --git a/src/components/index.js b/src/components/index.js index 16e1003b6..c91a4f1a1 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -104,6 +104,7 @@ export * from './Warehouses'; export * from './Currencies'; export * from './FormTopbar' export * from './Paper'; +export * from './Accounts' const Hint = FieldHint; diff --git a/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js b/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js index 7f78410b5..833b156d9 100644 --- a/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js +++ b/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js @@ -95,9 +95,9 @@ function BillDetailActionsBar({ onClick={handleQuickBillPayment} /> - +