feat(balance sheet): add branch multi select.

This commit is contained in:
elforjani13
2022-02-16 18:07:04 +02:00
parent 3b642540f1
commit e9933031ae
7 changed files with 40 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { MenuItem } from '@blueprintjs/core';
import { MultiSelect as FMultiSelect } from 'blueprint-formik';
import { FMultiSelect } from '../Forms';
/**
*
@@ -17,7 +17,7 @@ const branchItemPredicate = (query, branch, _index, exactMatch) => {
if (exactMatch) {
return normalizedTitle === normalizedQuery;
} else {
return `${branch.name}. ${normalizedTitle}`.indexOf(normalizedQuery) >= 0;
return `${branch.code}. ${normalizedTitle}`.indexOf(normalizedQuery) >= 0;
}
};
@@ -32,17 +32,17 @@ const branchItemRenderer = (
{ handleClick, modifiers, query },
{ isSelected },
) => {
const text = `${branch.name}.${isSelected ? 'selected' : 'not-selected'}`;
// const text = `${branch.name}.${isSelected ? 'selected' : 'not-selected'}`;
return (
<MenuItem
active={modifiers.active}
disabled={modifiers.disabled}
icon={modifiers.selected ? 'tick' : 'blank'}
icon={isSelected ? 'tick' : 'blank'}
text={branch.name.toString()}
label={branch.name.toString()}
key={branch.id}
onClick={handleClick}
text={text}
/>
);
};
@@ -55,6 +55,11 @@ const branchSelectProps = {
tagRenderer: (item) => item.name,
};
export function BranchesMultiSelect({ branches, ...rest }) {
/**
* branches mulit select.
* @param {*} param0
* @returns
*/
export function BranchMultiSelect({ branches, ...rest }) {
return <FMultiSelect items={branches} {...branchSelectProps} {...rest} />;
}

View File

@@ -1 +1,2 @@
export * from './BranchSelect';
export * from './BranchSelect';
export * from './BranchMultiSelect'

View File

@@ -1 +0,0 @@
export * from './BranchesMultiSelect';

View File

@@ -5,6 +5,7 @@ import {
Checkbox,
RadioGroup,
Select,
MultiSelect
} from 'blueprint-formik';
export {
@@ -14,4 +15,5 @@ export {
Checkbox as FCheckbox,
RadioGroup as FRadioGroup,
Select as FSelect,
MultiSelect as FMultiSelect
};

View File

@@ -101,7 +101,6 @@ export * from './FeatureGuard';
export * from './ExchangeRate';
export * from './Branches';
export * from './Warehouses';
export * from './FMultiSelect'
const Hint = FieldHint;