mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
feat: universal search.
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
|
||||
45
client/src/containers/Items/ItemsUniversalSearch.js
Normal file
45
client/src/containers/Items/ItemsUniversalSearch.js
Normal 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,
|
||||
});
|
||||
@@ -130,4 +130,4 @@ export function transformItemsTableState(tableState) {
|
||||
...transformTableStateToQuery(tableState),
|
||||
inactive_mode: tableState.inactiveMode,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user