feat: localization universal search.

This commit is contained in:
a.bouhuolia
2021-08-21 19:14:24 +02:00
parent 42c0d6be95
commit 71e4a208d7
11 changed files with 24 additions and 12 deletions

View File

@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import { RESOURCES_TYPES } from 'common/resourcesTypes'; import { RESOURCES_TYPES } from 'common/resourcesTypes';
import withDrawerActions from '../Drawer/withDrawerActions'; import withDrawerActions from '../Drawer/withDrawerActions';
@@ -37,7 +38,7 @@ const manualJournalsToSearch = (manualJournal) => ({
*/ */
export const universalSearchJournalBind = () => ({ export const universalSearchJournalBind = () => ({
resourceType: RESOURCES_TYPES.MANUAL_JOURNAL, resourceType: RESOURCES_TYPES.MANUAL_JOURNAL,
optionItemLabel: 'Manual journal', optionItemLabel: intl.get('manual_journals'),
selectItemAction: JournalUniversalSearchSelectAction, selectItemAction: JournalUniversalSearchSelectAction,
itemSelect: manualJournalsToSearch, itemSelect: manualJournalsToSearch,
}); });

View File

@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import { RESOURCES_TYPES } from '../../common/resourcesTypes'; import { RESOURCES_TYPES } from '../../common/resourcesTypes';
import withDrawerActions from '../Drawer/withDrawerActions'; import withDrawerActions from '../Drawer/withDrawerActions';
@@ -35,7 +36,7 @@ const accountToSearch = (account) => ({
*/ */
export const universalSearchAccountBind = () => ({ export const universalSearchAccountBind = () => ({
resourceType: RESOURCES_TYPES.ACCOUNT, resourceType: RESOURCES_TYPES.ACCOUNT,
optionItemLabel: 'Account', optionItemLabel: intl.get('accounts'),
selectItemAction: AccountUniversalSearchItemSelect, selectItemAction: AccountUniversalSearchItemSelect,
itemSelect: accountToSearch, itemSelect: accountToSearch,
}); });

View File

@@ -1,3 +1,5 @@
import intl from 'react-intl-universal';
import { RESOURCES_TYPES } from '../../common/resourcesTypes'; import { RESOURCES_TYPES } from '../../common/resourcesTypes';
import withDrawerActions from '../Drawer/withDrawerActions'; import withDrawerActions from '../Drawer/withDrawerActions';
@@ -27,7 +29,7 @@ const customersToSearch = (contact) => ({
*/ */
export const universalSearchCustomerBind = () => ({ export const universalSearchCustomerBind = () => ({
resourceType: RESOURCES_TYPES.CUSTOMER, resourceType: RESOURCES_TYPES.CUSTOMER,
optionItemLabel: 'Customers', optionItemLabel: intl.get('customers'),
selectItemAction: CustomerUniversalSearchSelectAction, selectItemAction: CustomerUniversalSearchSelectAction,
itemSelect: customersToSearch, itemSelect: customersToSearch,
}); });

View File

@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import { RESOURCES_TYPES } from '../../common/resourcesTypes'; import { RESOURCES_TYPES } from '../../common/resourcesTypes';
import withDrawerActions from '../Drawer/withDrawerActions'; import withDrawerActions from '../Drawer/withDrawerActions';
@@ -39,7 +40,7 @@ const transfromItemsToSearch = (item) => ({
*/ */
export const universalSearchItemBind = () => ({ export const universalSearchItemBind = () => ({
resourceType: RESOURCES_TYPES.ITEM, resourceType: RESOURCES_TYPES.ITEM,
optionItemLabel: 'Items', optionItemLabel: intl.get('items'),
selectItemAction: ItemUniversalSearchSelectAction, selectItemAction: ItemUniversalSearchSelectAction,
itemSelect: transfromItemsToSearch, itemSelect: transfromItemsToSearch,
}); });

View File

@@ -1,9 +1,9 @@
import React from 'react'; import React from 'react';
import { MenuItem } from '@blueprintjs/core'; import { MenuItem } from '@blueprintjs/core';
import intl from 'react-intl-universal';
import { formattedAmount } from 'utils'; import { formattedAmount } from 'utils';
import { T, Icon, Choose, If } from 'components'; import { T, Icon, Choose, If } from 'components';
import intl from 'react-intl-universal';
import { RESOURCES_TYPES } from 'common/resourcesTypes'; import { RESOURCES_TYPES } from 'common/resourcesTypes';
import withDrawerActions from '../../Drawer/withDrawerActions'; import withDrawerActions from '../../Drawer/withDrawerActions';
@@ -109,7 +109,7 @@ const billsToSearch = (bill) => ({
export const universalSearchBillBind = () => ({ export const universalSearchBillBind = () => ({
resourceType: RESOURCES_TYPES.BILL, resourceType: RESOURCES_TYPES.BILL,
optionItemLabel: 'Bills', optionItemLabel: intl.get('bills'),
selectItemAction: BillUniversalSearchSelect, selectItemAction: BillUniversalSearchSelect,
itemRenderer: BillUniversalSearchItem, itemRenderer: BillUniversalSearchItem,
itemSelect: billsToSearch, itemSelect: billsToSearch,

View File

@@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { MenuItem } from '@blueprintjs/core'; import { MenuItem } from '@blueprintjs/core';
import intl from 'react-intl-universal';
import { Icon } from 'components'; import { Icon } from 'components';
@@ -72,7 +73,7 @@ const paymentMadeToSearch = (payment) => ({
*/ */
export const universalSearchPaymentMadeBind = () => ({ export const universalSearchPaymentMadeBind = () => ({
resourceType: RESOURCES_TYPES.PAYMENT_MADE, resourceType: RESOURCES_TYPES.PAYMENT_MADE,
optionItemLabel: 'Payment made', optionItemLabel: intl.get('payment_mades'),
selectItemAction: PaymentMadeUniversalSearchSelect, selectItemAction: PaymentMadeUniversalSearchSelect,
itemRenderer: PaymentMadeUniversalSearchItem, itemRenderer: PaymentMadeUniversalSearchItem,
itemSelect: paymentMadeToSearch, itemSelect: paymentMadeToSearch,

View File

@@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { MenuItem } from '@blueprintjs/core'; import { MenuItem } from '@blueprintjs/core';
import intl from 'react-intl-universal';
import { Choose, T, Icon } from 'components'; import { Choose, T, Icon } from 'components';
@@ -99,7 +100,7 @@ const transformEstimatesToSearch = (estimate) => ({
export const universalSearchEstimateBind = () => ({ export const universalSearchEstimateBind = () => ({
resourceType: RESOURCES_TYPES.ESTIMATE, resourceType: RESOURCES_TYPES.ESTIMATE,
optionItemLabel: 'Estimates', optionItemLabel: intl.get('estimates'),
selectItemAction: EstimateUniversalSearchSelect, selectItemAction: EstimateUniversalSearchSelect,
itemRenderer: EstimateUniversalSearchItem, itemRenderer: EstimateUniversalSearchItem,
itemSelect: transformEstimatesToSearch itemSelect: transformEstimatesToSearch

View File

@@ -114,7 +114,7 @@ export function InvoiceUniversalSearchItem(
*/ */
export const universalSearchInvoiceBind = () => ({ export const universalSearchInvoiceBind = () => ({
resourceType: RESOURCES_TYPES.INVOICE, resourceType: RESOURCES_TYPES.INVOICE,
optionItemLabel: 'Invoices', optionItemLabel: intl.get('invoices'),
selectItemAction: InvoiceUniversalSearchSelect, selectItemAction: InvoiceUniversalSearchSelect,
itemRenderer: InvoiceUniversalSearchItem, itemRenderer: InvoiceUniversalSearchItem,
itemSelect: transformInvoicesToSearch, itemSelect: transformInvoicesToSearch,

View File

@@ -1,5 +1,7 @@
import React from 'react'; import React from 'react';
import { MenuItem } from '@blueprintjs/core'; import { MenuItem } from '@blueprintjs/core';
import intl from 'react-intl-universal';
import { RESOURCES_TYPES } from "../../../common/resourcesTypes"; import { RESOURCES_TYPES } from "../../../common/resourcesTypes";
import withDrawerActions from "../../Drawer/withDrawerActions"; import withDrawerActions from "../../Drawer/withDrawerActions";
import { highlightText } from 'utils'; import { highlightText } from 'utils';
@@ -71,7 +73,7 @@ export function PaymentReceiveUniversalSearchItem(
*/ */
export const universalSearchPaymentReceiveBind = () => ({ export const universalSearchPaymentReceiveBind = () => ({
resourceType: RESOURCES_TYPES.PAYMENT_RECEIVE, resourceType: RESOURCES_TYPES.PAYMENT_RECEIVE,
optionItemLabel: 'Payment receive', optionItemLabel: intl.get('payment_receives'),
selectItemAction: PaymentReceiveUniversalSearchSelect, selectItemAction: PaymentReceiveUniversalSearchSelect,
itemRenderer: PaymentReceiveUniversalSearchItem, itemRenderer: PaymentReceiveUniversalSearchItem,
itemSelect: paymentReceivesToSearch, itemSelect: paymentReceivesToSearch,

View File

@@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal';
import { MenuItem } from '@blueprintjs/core'; import { MenuItem } from '@blueprintjs/core';
import { Icon, Choose, T } from 'components'; import { Icon, Choose, T } from 'components';
@@ -93,7 +94,7 @@ const transformReceiptsToSearch = (receipt) => ({
*/ */
export const universalSearchReceiptBind = () => ({ export const universalSearchReceiptBind = () => ({
resourceType: RESOURCES_TYPES.RECEIPT, resourceType: RESOURCES_TYPES.RECEIPT,
optionItemLabel: 'Receipts', optionItemLabel: intl.get('receipts'),
selectItemAction: ReceiptUniversalSearchSelect, selectItemAction: ReceiptUniversalSearchSelect,
itemRenderer: ReceiptUniversalSearchItem, itemRenderer: ReceiptUniversalSearchItem,
itemSelect: transformReceiptsToSearch, itemSelect: transformReceiptsToSearch,

View File

@@ -1,3 +1,5 @@
import intl from 'react-intl-universal';
import { RESOURCES_TYPES } from '../../common/resourcesTypes'; import { RESOURCES_TYPES } from '../../common/resourcesTypes';
import withDrawerActions from '../Drawer/withDrawerActions'; import withDrawerActions from '../Drawer/withDrawerActions';
@@ -25,7 +27,7 @@ const vendorToSearch = (contact) => ({
*/ */
export const universalSearchVendorBind = () => ({ export const universalSearchVendorBind = () => ({
resourceType: RESOURCES_TYPES.VENDOR, resourceType: RESOURCES_TYPES.VENDOR,
optionItemLabel: 'Vendor', optionItemLabel: intl.get('vendors'),
selectItemAction: VendorUniversalSearchSelectAction, selectItemAction: VendorUniversalSearchSelectAction,
itemSelect: vendorToSearch, itemSelect: vendorToSearch,
}); });