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

@@ -62,9 +62,9 @@ function CustomerActionsBar({
openAlert('customers-bulk-delete', { customersIds: customersSelectedRows });
};
const handleTabChange = (viewId) => {
const handleTabChange = (view) => {
setCustomersTableState({
customViewId: viewId.id || null,
viewSlug: view ? view.slug : null,
});
};
// Handle inactive switch changing.
@@ -82,6 +82,8 @@ function CustomerActionsBar({
<DashboardActionViewsList
resourceName={'customers'}
views={customersViews}
allMenuItem={true}
allMenuItemText={<T id={'all'} />}
onChange={handleTabChange}
/>
<NavbarDivider />

View File

@@ -0,0 +1,33 @@
import { RESOURCES_TYPES } from '../../common/resourcesTypes';
import withDrawerActions from '../Drawer/withDrawerActions';
function CustomerUniversalSearchSelectComponent({ resourceType, resourceId }) {
if (resourceType === RESOURCES_TYPES.CUSTOMER) {
}
return null;
}
const CustomerUniversalSearchSelectAction = withDrawerActions(
CustomerUniversalSearchSelectComponent
);
/**
* Transformes customers to search.
* @param {*} contact
* @returns
*/
const customersToSearch = (contact) => ({
text: contact.display_name,
label: contact.formatted_balance,
reference: contact,
});
/**
* Binds universal search invoice configure.
*/
export const universalSearchCustomerBind = () => ({
resourceType: RESOURCES_TYPES.CUSTOMER,
optionItemLabel: 'Customers',
selectItemAction: CustomerUniversalSearchSelectAction,
itemSelect: customersToSearch,
});