mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
WIP: Arabic localization.|
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { FormGroup, InputGroup, TextArea } from '@blueprintjs/core';
|
||||
import { Row, Col } from 'components';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import { FastField, ErrorMessage } from 'formik';
|
||||
import { inputIntent } from 'utils';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import React, {
|
||||
useCallback,
|
||||
} from 'react';
|
||||
import Dragzone from 'components/Dragzone';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
|
||||
function CustomerAttachmentTabs() {
|
||||
return (
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
Row,
|
||||
Col,
|
||||
} from 'components';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
|
||||
import { useCustomerFormContext } from './CustomerFormProvider';
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
Menu,
|
||||
MenuItem,
|
||||
} from '@blueprintjs/core';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import classNames from 'classnames';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { useFormikContext } from 'formik';
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useMemo } from 'react';
|
||||
import { Formik, Form } from 'formik';
|
||||
import moment from 'moment';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import { useIntl } from 'react-intl';
|
||||
import intl from 'react-intl-universal';
|
||||
import classNames from 'classnames';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
|
||||
@@ -75,7 +75,7 @@ function CustomerForm({
|
||||
|
||||
// const isNewMode = !customerId;
|
||||
const history = useHistory();
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
|
||||
/**
|
||||
* Initial values in create and edit mode.
|
||||
@@ -98,11 +98,11 @@ function CustomerForm({
|
||||
|
||||
const onSuccess = () => {
|
||||
AppToaster.show({
|
||||
message: formatMessage({
|
||||
id: isNewMode
|
||||
message: intl.get(
|
||||
isNewMode
|
||||
? 'the_customer_has_been_created_successfully'
|
||||
: 'the_item_customer_has_been_edited_successfully',
|
||||
}),
|
||||
),
|
||||
intent: Intent.SUCCESS,
|
||||
});
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import * as Yup from 'yup';
|
||||
import { formatMessage } from 'services/intl';
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
const Schema = Yup.object().shape({
|
||||
customer_type: Yup.string()
|
||||
.required()
|
||||
.trim()
|
||||
.label(formatMessage({ id: 'customer_type_' })),
|
||||
.label(intl.get('customer_type_')),
|
||||
salutation: Yup.string().trim(),
|
||||
first_name: Yup.string().trim(),
|
||||
last_name: Yup.string().trim(),
|
||||
@@ -13,7 +13,7 @@ const Schema = Yup.object().shape({
|
||||
display_name: Yup.string()
|
||||
.trim()
|
||||
.required()
|
||||
.label(formatMessage({ id: 'display_name_' })),
|
||||
.label(intl.get('display_name_')),
|
||||
|
||||
email: Yup.string().email().nullable(),
|
||||
work_phone: Yup.number(),
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import React from 'react';
|
||||
import { FormGroup, InputGroup, ControlGroup } from '@blueprintjs/core';
|
||||
import { FastField, ErrorMessage } from 'formik';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import intl from 'react-intl-universal';
|
||||
import { inputIntent } from 'utils';
|
||||
|
||||
export default function CustomerFormAfterPrimarySection({}) {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
return (
|
||||
<div class="customer-form__after-primary-section-content">
|
||||
{/*------------ Customer email -----------*/}
|
||||
@@ -34,7 +35,7 @@ export default function CustomerFormAfterPrimarySection({}) {
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<InputGroup
|
||||
intent={inputIntent({ error, touched })}
|
||||
placeholder={formatMessage({ id: 'work' })}
|
||||
placeholder={intl.get('work')}
|
||||
{...field}
|
||||
/>
|
||||
)}
|
||||
@@ -44,7 +45,7 @@ export default function CustomerFormAfterPrimarySection({}) {
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<InputGroup
|
||||
intent={inputIntent({ error, touched })}
|
||||
placeholder={formatMessage({id:'Mobile'})}
|
||||
placeholder={intl.get('Mobile')}
|
||||
{...field}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -2,7 +2,8 @@ import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { FormGroup, InputGroup, ControlGroup } from '@blueprintjs/core';
|
||||
import { FastField, Field, ErrorMessage } from 'formik';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
import {
|
||||
Hint,
|
||||
@@ -20,7 +21,7 @@ import { useAutofocus } from 'hooks';
|
||||
*/
|
||||
export default function CustomerFormPrimarySection({}) {
|
||||
const firstNameFieldRef = useAutofocus();
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
|
||||
return (
|
||||
<div className={'customer-form__primary-section-content'}>
|
||||
@@ -55,7 +56,7 @@ export default function CustomerFormPrimarySection({}) {
|
||||
<FastField name={'first_name'}>
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<InputGroup
|
||||
placeholder={formatMessage({ id: 'first_name' })}
|
||||
placeholder={intl.get('first_name')}
|
||||
intent={inputIntent({ error, touched })}
|
||||
className={classNames('input-group--first-name')}
|
||||
inputRef={(ref) => (firstNameFieldRef.current = ref)}
|
||||
@@ -67,7 +68,7 @@ export default function CustomerFormPrimarySection({}) {
|
||||
<FastField name={'last_name'}>
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<InputGroup
|
||||
placeholder={formatMessage({ id: 'last_name' })}
|
||||
placeholder={intl.get('last_name')}
|
||||
intent={inputIntent({ error, touched })}
|
||||
className={classNames('input-group--last-name')}
|
||||
{...field}
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { FormGroup, TextArea, Classes } from '@blueprintjs/core';
|
||||
import { FastField, ErrorMessage } from 'formik';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import { inputIntent } from 'utils';
|
||||
|
||||
export default function CustomerNotePanel({ errors, touched, getFieldProps }) {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { RadioGroup, Radio, FormGroup } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import intl from 'react-intl-universal';
|
||||
import { FastField } from 'formik';
|
||||
|
||||
import { handleStringChange, saveInvoke } from 'utils';
|
||||
@@ -11,7 +12,7 @@ import { handleStringChange, saveInvoke } from 'utils';
|
||||
*/
|
||||
export default function RadioCustomer(props) {
|
||||
const { onChange, ...rest } = props;
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
|
||||
return (
|
||||
<FastField name={'customer_type'}>
|
||||
@@ -29,9 +30,9 @@ export default function RadioCustomer(props) {
|
||||
})}
|
||||
selectedValue={value}
|
||||
>
|
||||
<Radio label={formatMessage({ id: 'business' })} value="business" />
|
||||
<Radio label={intl.get('business')} value="business" />
|
||||
<Radio
|
||||
label={formatMessage({ id: 'individual' })}
|
||||
label={intl.get('individual')}
|
||||
value="individual"
|
||||
/>
|
||||
</RadioGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Tabs, Tab } from '@blueprintjs/core';
|
||||
import { useIntl } from 'react-intl';
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
import CustomerAddressTabs from './CustomerAddressTabs';
|
||||
import CustomerAttachmentTabs from './CustomerAttachmentTabs';
|
||||
@@ -8,7 +8,7 @@ import CustomerFinancialPanel from './CustomerFinancialPanel';
|
||||
import CustomerNotePanel from './CustomerNotePanel';
|
||||
|
||||
export default function CustomersTabs() {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -20,22 +20,22 @@ export default function CustomersTabs() {
|
||||
>
|
||||
<Tab
|
||||
id={'financial'}
|
||||
title={formatMessage({ id: 'financial_details' })}
|
||||
title={intl.get('financial_details')}
|
||||
panel={<CustomerFinancialPanel />}
|
||||
/>
|
||||
<Tab
|
||||
id={'address'}
|
||||
title={formatMessage({ id: 'address' })}
|
||||
title={intl.get('address')}
|
||||
panel={<CustomerAddressTabs />}
|
||||
/>
|
||||
<Tab
|
||||
id="notes"
|
||||
title={formatMessage({ id: 'notes' })}
|
||||
title={intl.get('notes')}
|
||||
panel={<CustomerNotePanel />}
|
||||
/>
|
||||
<Tab
|
||||
id={'attachement'}
|
||||
title={formatMessage({ id: 'attachement' })}
|
||||
title={intl.get('attachement')}
|
||||
panel={<CustomerAttachmentTabs />}
|
||||
/>
|
||||
</Tabs>
|
||||
|
||||
@@ -9,7 +9,8 @@ import {
|
||||
Position,
|
||||
PopoverInteractionKind,
|
||||
} from '@blueprintjs/core';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import intl from 'react-intl-universal';
|
||||
import classNames from 'classnames';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
|
||||
@@ -41,7 +42,7 @@ function CustomerActionsBar({
|
||||
const history = useHistory();
|
||||
|
||||
// React intl
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
|
||||
// Customers list context.
|
||||
const { customersViews } = useCustomersListContext();
|
||||
@@ -85,7 +86,7 @@ function CustomerActionsBar({
|
||||
>
|
||||
<Button
|
||||
className={classNames(Classes.MINIMAL, 'button--filter')}
|
||||
text={`${formatMessage({ id: 'filters_applied' })}`}
|
||||
text={`${intl.get('filters_applied')}`}
|
||||
icon={<Icon icon="filter-16" iconSize={16} />}
|
||||
/>
|
||||
</Popover>
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { Button, Intent } from '@blueprintjs/core';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { EmptyStatus } from 'components';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
|
||||
export default function CustomersEmptyStatus() {
|
||||
const history = useHistory();
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
import { Icon, Money } from 'components';
|
||||
import { safeCallback } from 'utils';
|
||||
import { firstLettersArgs } from 'utils';
|
||||
import { useIntl } from 'react-intl';
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
/**
|
||||
* Actions menu.
|
||||
@@ -20,28 +20,28 @@ export function ActionsMenu({
|
||||
row: { original },
|
||||
payload: { onEdit, onDelete, onDuplicate },
|
||||
}) {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
|
||||
return (
|
||||
<Menu>
|
||||
<MenuItem
|
||||
icon={<Icon icon="reader-18" />}
|
||||
text={formatMessage({ id: 'view_details' })}
|
||||
text={intl.get('view_details')}
|
||||
/>
|
||||
<MenuDivider />
|
||||
<MenuItem
|
||||
icon={<Icon icon="pen-18" />}
|
||||
text={formatMessage({ id: 'edit_customer' })}
|
||||
text={intl.get('edit_customer')}
|
||||
onClick={safeCallback(onEdit, original)}
|
||||
/>
|
||||
<MenuItem
|
||||
icon={<Icon icon="duplicate-16" />}
|
||||
text={formatMessage({ id: 'duplicate' })}
|
||||
text={intl.get('duplicate')}
|
||||
onClick={safeCallback(onDuplicate, original)}
|
||||
/>
|
||||
<MenuItem
|
||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||
text={formatMessage({ id: 'delete_customer' })}
|
||||
text={intl.get('delete_customer')}
|
||||
intent={Intent.DANGER}
|
||||
onClick={safeCallback(onDelete, original)}
|
||||
/>
|
||||
@@ -74,7 +74,7 @@ export function BalanceAccessor(row) {
|
||||
* Retrieve customers table columns.
|
||||
*/
|
||||
export function useCustomersTableColumns() {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
|
||||
return useMemo(
|
||||
() => [
|
||||
@@ -89,33 +89,33 @@ export function useCustomersTableColumns() {
|
||||
},
|
||||
{
|
||||
id: 'display_name',
|
||||
Header: formatMessage({ id: 'display_name' }),
|
||||
Header: intl.get('display_name'),
|
||||
accessor: 'display_name',
|
||||
className: 'display_name',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
id: 'company_name',
|
||||
Header: formatMessage({ id: 'company_name' }),
|
||||
Header: intl.get('company_name'),
|
||||
accessor: 'company_name',
|
||||
className: 'company_name',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
id: 'work_phone',
|
||||
Header: formatMessage({ id: 'work_phone' }),
|
||||
Header: intl.get('work_phone'),
|
||||
accessor: PhoneNumberAccessor,
|
||||
className: 'phone_number',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
id: 'balance',
|
||||
Header: formatMessage({ id: 'receivable_balance' }),
|
||||
Header: intl.get('receivable_balance'),
|
||||
accessor: BalanceAccessor,
|
||||
className: 'receivable_balance',
|
||||
width: 100,
|
||||
},
|
||||
],
|
||||
[formatMessage],
|
||||
[],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import React from 'react';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import { AppToaster } from 'components';
|
||||
import { formatMessage } from 'services/intl';
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
export const transformErrors = (errors) => {
|
||||
if (errors.some((e) => e.type === 'CUSTOMER.HAS.SALES_INVOICES')) {
|
||||
AppToaster.show({
|
||||
message: formatMessage({
|
||||
id: 'customer_has_sales_invoices',
|
||||
}),
|
||||
message: intl.get('customer_has_sales_invoices'),
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
@@ -16,18 +14,13 @@ export const transformErrors = (errors) => {
|
||||
errors.find((error) => error.type === 'SOME.CUSTOMERS.HAVE.SALES_INVOICES')
|
||||
) {
|
||||
AppToaster.show({
|
||||
message: formatMessage({
|
||||
id: 'some_customers_have_sales_invoices',
|
||||
}),
|
||||
message: intl.get('some_customers_have_sales_invoices'),
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
if (errors.find((error) => error.type === 'CUSTOMER_HAS_TRANSACTIONS')) {
|
||||
AppToaster.show({
|
||||
message: formatMessage({
|
||||
id:
|
||||
'this_customer_cannot_be_deleted_as_it_is_associated_with_transactions',
|
||||
}),
|
||||
message: intl.get('this_customer_cannot_be_deleted_as_it_is_associated_with_transactions'),
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user