feat: universal search.

This commit is contained in:
a.bouhuolia
2021-08-21 18:59:49 +02:00
parent a7b0f1a8d2
commit 79c1b2ab67
82 changed files with 2497 additions and 317 deletions

View File

@@ -58,8 +58,8 @@ function ItemsActionsBar({
};
// Handle tab changing.
const handleTabChange = (viewId) => {
setItemsTableState({ customViewId: viewId.id || null });
const handleTabChange = (view) => {
setItemsTableState({ viewSlug: view ? view.slug : null });
};
// Handle cancel/confirm items bulk.
@@ -82,6 +82,8 @@ function ItemsActionsBar({
<NavbarGroup>
<DashboardActionViewsList
resourceName={'items'}
allMenuItem={true}
allMenuItemText={<T id={'all_items'} />}
views={itemsViews}
onChange={handleTabChange}
/>

View File

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

View File

@@ -130,4 +130,4 @@ export function transformItemsTableState(tableState) {
...transformTableStateToQuery(tableState),
inactive_mode: tableState.inactiveMode,
};
}
}