chrone: sperate client and server to different repos.

This commit is contained in:
a.bouhuolia
2021-09-21 17:13:53 +02:00
parent e011b2a82b
commit 18df5530c7
10015 changed files with 17686 additions and 97524 deletions

View File

@@ -0,0 +1,49 @@
import intl from 'react-intl-universal';
import { RESOURCES_TYPES } from '../../common/resourcesTypes';
import withDrawerActions from '../Drawer/withDrawerActions';
/**
* Item univrsal search item select action.
*/
function ItemUniversalSearchSelectComponent({
// #ownProps
resourceType,
resourceId,
onAction,
// #withDrawerActions
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.ITEM) {
openDrawer('item-detail-drawer', { itemId: resourceId });
onAction && onAction();
}
return null;
}
export const ItemUniversalSearchSelectAction = withDrawerActions(
ItemUniversalSearchSelectComponent,
);
/**
* Transformes items to search.
* @param {*} item
* @returns
*/
const transfromItemsToSearch = (item) => ({
id: item.id,
text: item.name,
subText: item.code,
label: item.type,
reference: item,
});
/**
* Binds universal search invoice configure.
*/
export const universalSearchItemBind = () => ({
resourceType: RESOURCES_TYPES.ITEM,
optionItemLabel: intl.get('items'),
selectItemAction: ItemUniversalSearchSelectAction,
itemSelect: transfromItemsToSearch,
});