mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
WIP: Arabic localization.|
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import Dragzone from 'components/Dragzone';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
|
||||
/**
|
||||
* Vendor Attahment Tab.
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
Row,
|
||||
Col,
|
||||
} from 'components';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import { momentFormatter, tansformDateValue, inputIntent } from 'utils';
|
||||
import { useVendorFormContext } from './VendorFormProvider';
|
||||
|
||||
|
||||
@@ -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 { CLASSES } from 'common/classes';
|
||||
import { useFormikContext } from 'formik';
|
||||
|
||||
@@ -2,11 +2,12 @@ import React, { useMemo, useEffect } from 'react';
|
||||
import { Formik, Form } from 'formik';
|
||||
import moment from 'moment';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
import intl from 'react-intl-universal';
|
||||
import classNames from 'classnames';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
|
||||
import { CLASSES } from 'common/classes';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import AppToaster from 'components/AppToaster';
|
||||
import {
|
||||
CreateVendorFormSchema,
|
||||
@@ -86,8 +87,6 @@ function VendorForm({
|
||||
// History context.
|
||||
const history = useHistory();
|
||||
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
/**
|
||||
* Initial values in create and edit mode.
|
||||
*/
|
||||
@@ -111,11 +110,11 @@ function VendorForm({
|
||||
|
||||
const onSuccess = () => {
|
||||
AppToaster.show({
|
||||
message: formatMessage({
|
||||
id: isNewMode
|
||||
message: intl.get(
|
||||
isNewMode
|
||||
? 'the_vendor_has_been_created_successfully'
|
||||
: 'the_item_vendor_has_been_edited_successfully',
|
||||
}),
|
||||
),
|
||||
intent: Intent.SUCCESS,
|
||||
});
|
||||
setSubmitPayload(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as Yup from 'yup';
|
||||
import { formatMessage } from 'services/intl';
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
const Schema = Yup.object().shape({
|
||||
salutation: Yup.string().trim(),
|
||||
@@ -9,7 +9,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,14 +1,15 @@
|
||||
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';
|
||||
|
||||
/**
|
||||
* Vendor form after primary section.
|
||||
*/
|
||||
function VendorFormAfterPrimarySection() {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
|
||||
return (
|
||||
<div class="customer-form__after-primary-section-content">
|
||||
@@ -38,7 +39,7 @@ function VendorFormAfterPrimarySection() {
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<InputGroup
|
||||
intent={inputIntent({ error, touched })}
|
||||
placeholder={formatMessage({ id: 'work' })}
|
||||
placeholder={intl.get('work')}
|
||||
{...field}
|
||||
/>
|
||||
)}
|
||||
@@ -47,7 +48,7 @@ function VendorFormAfterPrimarySection() {
|
||||
{({ 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,
|
||||
FieldRequiredHint,
|
||||
@@ -20,7 +21,7 @@ import { useAutofocus } from 'hooks';
|
||||
*/
|
||||
function VendorFormPrimarySection() {
|
||||
const firstNameFieldRef = useAutofocus();
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
|
||||
return (
|
||||
<div className={'customer-form__primary-section-content'}>
|
||||
@@ -52,7 +53,7 @@ function VendorFormPrimarySection() {
|
||||
<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)}
|
||||
@@ -64,7 +65,7 @@ function VendorFormPrimarySection() {
|
||||
<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}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Tabs, Tab } 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 { CLASSES } from 'common/classes';
|
||||
|
||||
@@ -14,7 +15,7 @@ import CustomerNotePanel from 'containers/Customers/CustomerForm/CustomerNotePan
|
||||
* Vendor form tabs.
|
||||
*/
|
||||
export default function VendorTabs() {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
return (
|
||||
<div className={classNames(CLASSES.PAGE_FORM_TABS)}>
|
||||
<Tabs
|
||||
@@ -25,22 +26,22 @@ export default function VendorTabs() {
|
||||
>
|
||||
<Tab
|
||||
id={'financial'}
|
||||
title={formatMessage({ id: 'financial_details' })}
|
||||
title={intl.get('financial_details')}
|
||||
panel={<VendorFinanicalPanelTab />}
|
||||
/>
|
||||
<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={<VendorAttahmentTab />}
|
||||
/>
|
||||
</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 DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
@@ -31,7 +32,7 @@ function VendorActionsBar({
|
||||
setVendorsTableState,
|
||||
}) {
|
||||
const history = useHistory();
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
|
||||
// Vendors list context.
|
||||
const { vendorsViews } = useVendorsListContext();
|
||||
@@ -73,7 +74,7 @@ function VendorActionsBar({
|
||||
true ? (
|
||||
<T id={'filter'} />
|
||||
) : (
|
||||
`${9} ${formatMessage({ id: 'filters_applied' })}`
|
||||
`${9} ${intl.get('filters_applied')}`
|
||||
)
|
||||
}
|
||||
icon={<Icon icon="filter-16" iconSize={16} />}
|
||||
|
||||
@@ -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 VendorsEmptyStatus() {
|
||||
const history = useHistory();
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
Position,
|
||||
Intent,
|
||||
} from '@blueprintjs/core';
|
||||
import { useIntl } from 'react-intl';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Icon, Money } from 'components';
|
||||
import { safeCallback, firstLettersArgs } from 'utils';
|
||||
|
||||
@@ -19,28 +19,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_vendor' })}
|
||||
text={intl.get('edit_vendor')}
|
||||
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_vendor' })}
|
||||
text={intl.get('delete_vendor')}
|
||||
intent={Intent.DANGER}
|
||||
onClick={safeCallback(onDelete, original)}
|
||||
/>
|
||||
@@ -87,7 +87,7 @@ export function BalanceAccessor({ closing_balance, currency_code }) {
|
||||
* Retrieve the vendors table columns.
|
||||
*/
|
||||
export function useVendorsTableColumns() {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
|
||||
return React.useMemo(
|
||||
() => [
|
||||
@@ -102,33 +102,33 @@ export function useVendorsTableColumns() {
|
||||
},
|
||||
{
|
||||
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: 'work_phone',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
id: 'balance',
|
||||
Header: formatMessage({ id: 'receivable_balance' }),
|
||||
Header: intl.get('receivable_balance'),
|
||||
accessor: BalanceAccessor,
|
||||
className: 'receivable_balance',
|
||||
width: 100,
|
||||
}
|
||||
],
|
||||
[formatMessage],
|
||||
[],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback } from 'react';
|
||||
import { formatMessage } from 'services/intl';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import { AppToaster } from 'components';
|
||||
|
||||
@@ -7,9 +7,7 @@ import { AppToaster } from 'components';
|
||||
export const transformErrors = useCallback((errors) => {
|
||||
if (errors.some((e) => e.type === 'VENDOR.HAS.BILLS')) {
|
||||
AppToaster.show({
|
||||
message: formatMessage({
|
||||
id: 'vendor_has_bills',
|
||||
}),
|
||||
message: intl.get('vendor_has_bills'),
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,23 +1,18 @@
|
||||
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.find((error) => error.type === 'VENDOR.HAS.ASSOCIATED.BILLS')) {
|
||||
AppToaster.show({
|
||||
message: formatMessage({
|
||||
id: 'cannot_delete_vendor_that_has_associated_purchase_bills',
|
||||
}),
|
||||
message: intl.get('cannot_delete_vendor_that_has_associated_purchase_bills'),
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
if (errors.find((error) => error.type === 'VENDOR_HAS_TRANSACTIONS')) {
|
||||
AppToaster.show({
|
||||
message: formatMessage({
|
||||
id:
|
||||
'this_vendor_cannot_be_deleted_as_it_is_associated_with_transactions',
|
||||
}),
|
||||
message: intl.get('this_vendor_cannot_be_deleted_as_it_is_associated_with_transactions'),
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user