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 withDrawerActions from '../Drawer/withDrawerActions';
@@ -37,7 +38,7 @@ const manualJournalsToSearch = (manualJournal) => ({
*/
export const universalSearchJournalBind = () => ({
resourceType: RESOURCES_TYPES.MANUAL_JOURNAL,
optionItemLabel: 'Manual journal',
optionItemLabel: intl.get('manual_journals'),
selectItemAction: JournalUniversalSearchSelectAction,
itemSelect: manualJournalsToSearch,
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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