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:
@@ -9,7 +9,7 @@ import {
|
||||
Menu,
|
||||
MenuItem,
|
||||
} from '@blueprintjs/core';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import classNames from 'classnames';
|
||||
import { useFormikContext } from 'formik';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { Formik, Form } from 'formik';
|
||||
import { useIntl } from 'react-intl';
|
||||
import intl from 'react-intl-universal';
|
||||
import { omit, sumBy, pick, isEmpty, defaultTo } from 'lodash';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import classNames from 'classnames';
|
||||
@@ -40,7 +40,6 @@ function PaymentReceiveForm({
|
||||
baseCurrency,
|
||||
}) {
|
||||
const history = useHistory();
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
// Payment receive form context.
|
||||
const {
|
||||
@@ -77,7 +76,7 @@ function PaymentReceiveForm({
|
||||
nextPaymentNumber,
|
||||
paymentEntriesEditPage,
|
||||
paymentReceiveAutoIncrement,
|
||||
preferredDepositAccount
|
||||
preferredDepositAccount,
|
||||
],
|
||||
);
|
||||
|
||||
@@ -100,9 +99,7 @@ function PaymentReceiveForm({
|
||||
|
||||
if (totalPaymentAmount <= 0) {
|
||||
AppToaster.show({
|
||||
message: formatMessage({
|
||||
id: 'you_cannot_make_payment_with_zero_total_amount',
|
||||
}),
|
||||
message: intl.get('you_cannot_make_payment_with_zero_total_amount'),
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
setSubmitting(false);
|
||||
@@ -119,11 +116,11 @@ function PaymentReceiveForm({
|
||||
// Handle request response success.
|
||||
const onSaved = (response) => {
|
||||
AppToaster.show({
|
||||
message: formatMessage({
|
||||
id: paymentReceiveId
|
||||
message: intl.get(
|
||||
paymentReceiveId
|
||||
? 'the_payment_receive_transaction_has_been_edited'
|
||||
: 'the_payment_receive_transaction_has_been_created',
|
||||
}),
|
||||
),
|
||||
intent: Intent.SUCCESS,
|
||||
});
|
||||
setSubmitting(false);
|
||||
@@ -146,13 +143,13 @@ function PaymentReceiveForm({
|
||||
if (getError('PAYMENT_RECEIVE_NO_EXISTS')) {
|
||||
setFieldError(
|
||||
'payment_receive_no',
|
||||
formatMessage({ id: 'payment_number_is_not_unique' }),
|
||||
intl.get('payment_number_is_not_unique'),
|
||||
);
|
||||
}
|
||||
if (getError('PAYMENT_RECEIVE_NO_REQUIRED')) {
|
||||
setFieldError(
|
||||
'payment_receive_no',
|
||||
formatMessage({ id: 'payment_receive_number_required' }),
|
||||
intl.get('payment_receive_number_required'),
|
||||
);
|
||||
}
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import * as Yup from 'yup';
|
||||
import { formatMessage } from 'services/intl';
|
||||
import intl from 'react-intl-universal';
|
||||
import { DATATYPES_LENGTH } from 'common/dataTypes';
|
||||
|
||||
const Schema = Yup.object().shape({
|
||||
customer_id: Yup.string()
|
||||
.label(formatMessage({ id: 'customer_name_' }))
|
||||
.label(intl.get('customer_name_'))
|
||||
.required(),
|
||||
payment_date: Yup.date()
|
||||
.required()
|
||||
.label(formatMessage({ id: 'payment_date_' })),
|
||||
.label(intl.get('payment_date_')),
|
||||
deposit_account_id: Yup.number()
|
||||
.required()
|
||||
.label(formatMessage({ id: 'deposit_account_' })),
|
||||
.label(intl.get('deposit_account_')),
|
||||
full_amount: Yup.number().nullable(),
|
||||
payment_receive_no: Yup.string()
|
||||
.nullable()
|
||||
.max(DATATYPES_LENGTH.STRING)
|
||||
.label(formatMessage({ id: 'payment_receive_no_' })),
|
||||
.label(intl.get('payment_receive_no_')),
|
||||
reference_no: Yup.string().min(1).max(DATATYPES_LENGTH.STRING).nullable(),
|
||||
// statement: Yup.string().nullable().max(DATATYPES_LENGTH.TEXT),
|
||||
entries: Yup.array().of(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { FormGroup, TextArea } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import { FastField } from 'formik';
|
||||
import { Row, Col, Postbox } from 'components';
|
||||
import { CLASSES } from 'common/classes';
|
||||
|
||||
@@ -3,7 +3,7 @@ import { sumBy } from 'lodash';
|
||||
import { useFormikContext } from 'formik';
|
||||
import classNames from 'classnames';
|
||||
import { Money } from 'components';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
|
||||
import { CLASSES } from 'common/classes';
|
||||
import PaymentReceiveHeaderFields from './PaymentReceiveHeaderFields';
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
Button,
|
||||
} from '@blueprintjs/core';
|
||||
import { DateInput } from '@blueprintjs/datetime';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import { FastField, Field, useFormikContext, ErrorMessage } from 'formik';
|
||||
|
||||
import { useAutofocus } from 'hooks';
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useCallback } from 'react';
|
||||
import { CloudLoadingIndicator } from 'components';
|
||||
import classNames from 'classnames';
|
||||
import { useFormikContext } from 'formik';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
|
||||
import { CLASSES } from 'common/classes';
|
||||
import { usePaymentReceiveInnerContext } from './PaymentReceiveInnerProvider';
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import React from 'react';
|
||||
import moment from 'moment';
|
||||
import { useIntl } from 'react-intl';
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
import { Money } from 'components';
|
||||
import { MoneyFieldCell } from 'components/DataTableCells';
|
||||
import { safeSumBy, formattedAmount } from 'utils';
|
||||
import { formatMessage } from 'services/intl';
|
||||
|
||||
/**
|
||||
* Invoice date cell.
|
||||
@@ -59,7 +59,7 @@ function MoneyTableCell({ row: { original }, value }) {
|
||||
}
|
||||
|
||||
function DateFooterCell() {
|
||||
return formatMessage({id:'total'})
|
||||
return intl.get('total')
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +80,7 @@ export const usePaymentReceiveEntriesColumns = () => {
|
||||
className: 'index',
|
||||
},
|
||||
{
|
||||
Header: formatMessage({ id: 'Date' }),
|
||||
Header: intl.get('Date'),
|
||||
id: 'invoice_date',
|
||||
accessor: 'invoice_date',
|
||||
Cell: InvoiceDateCell,
|
||||
@@ -91,13 +91,13 @@ export const usePaymentReceiveEntriesColumns = () => {
|
||||
className: 'date',
|
||||
},
|
||||
{
|
||||
Header: formatMessage({ id: 'invocie_number' }),
|
||||
Header: intl.get('invocie_number'),
|
||||
accessor: InvNumberCellAccessor,
|
||||
disableSortBy: true,
|
||||
className: 'invoice_number',
|
||||
},
|
||||
{
|
||||
Header: formatMessage({ id: 'invoice_amount' }),
|
||||
Header: intl.get('invoice_amount'),
|
||||
accessor: 'amount',
|
||||
Footer: BalanceFooterCell,
|
||||
Cell: MoneyTableCell,
|
||||
@@ -106,7 +106,7 @@ export const usePaymentReceiveEntriesColumns = () => {
|
||||
className: 'invoice_amount',
|
||||
},
|
||||
{
|
||||
Header: formatMessage({ id: 'amount_due' }),
|
||||
Header: intl.get('amount_due'),
|
||||
accessor: 'due_amount',
|
||||
Footer: DueAmountFooterCell,
|
||||
Cell: MoneyTableCell,
|
||||
@@ -115,7 +115,7 @@ export const usePaymentReceiveEntriesColumns = () => {
|
||||
className: 'amount_due',
|
||||
},
|
||||
{
|
||||
Header: formatMessage({ id: 'payment_amount' }),
|
||||
Header: intl.get('payment_amount'),
|
||||
accessor: 'payment_amount',
|
||||
Cell: MoneyFieldCell,
|
||||
Footer: PaymentAmountFooterCell,
|
||||
@@ -124,6 +124,6 @@ export const usePaymentReceiveEntriesColumns = () => {
|
||||
className: 'payment_amount',
|
||||
},
|
||||
],
|
||||
[formatMessage],
|
||||
[],
|
||||
);
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { useHistory } from 'react-router';
|
||||
import { Alignment, Navbar, NavbarGroup } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import { pick } from 'lodash';
|
||||
|
||||
import { DashboardViewsTabs } from 'components';
|
||||
|
||||
@@ -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 PaymentReceivesEmptyStatus() {
|
||||
const history = useHistory();
|
||||
|
||||
@@ -8,7 +8,8 @@ import {
|
||||
MenuDivider,
|
||||
Position,
|
||||
} from '@blueprintjs/core';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import intl from 'react-intl-universal';
|
||||
import moment from 'moment';
|
||||
import { Money, Icon } from 'components';
|
||||
import { safeCallback } from 'utils';
|
||||
@@ -20,27 +21,27 @@ export function ActionsMenu({
|
||||
row: { original: paymentReceive },
|
||||
payload: { onEdit, onDelete, onDrawer },
|
||||
}) {
|
||||
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_payment_receive' })}
|
||||
text={intl.get('edit_payment_receive')}
|
||||
onClick={safeCallback(onEdit, paymentReceive)}
|
||||
/>
|
||||
<MenuItem
|
||||
icon={<Icon icon={'receipt-24'} iconSize={16} />}
|
||||
text={formatMessage({ id: 'payment_receive_paper' })}
|
||||
text={intl.get('payment_receive_paper')}
|
||||
onClick={safeCallback(onDrawer, paymentReceive)}
|
||||
/>
|
||||
<MenuItem
|
||||
text={formatMessage({ id: 'delete_payment_receive' })}
|
||||
text={intl.get('delete_payment_receive')}
|
||||
intent={Intent.DANGER}
|
||||
onClick={safeCallback(onDelete, paymentReceive)}
|
||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||
@@ -81,34 +82,34 @@ export function ActionsCell(props) {
|
||||
* Retrieve payment receives columns.
|
||||
*/
|
||||
export function usePaymentReceivesColumns() {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
|
||||
return React.useMemo(
|
||||
() => [
|
||||
{
|
||||
id: 'payment_date',
|
||||
Header: formatMessage({ id: 'payment_date' }),
|
||||
Header: intl.get('payment_date'),
|
||||
accessor: PaymentDateAccessor,
|
||||
width: 140,
|
||||
className: 'payment_date',
|
||||
},
|
||||
{
|
||||
id: 'customer',
|
||||
Header: formatMessage({ id: 'customer_name' }),
|
||||
Header: intl.get('customer_name'),
|
||||
accessor: 'customer.display_name',
|
||||
width: 160,
|
||||
className: 'customer_id',
|
||||
},
|
||||
{
|
||||
id: 'amount',
|
||||
Header: formatMessage({ id: 'amount' }),
|
||||
Header: intl.get('amount'),
|
||||
accessor: AmountAccessor,
|
||||
width: 120,
|
||||
className: 'amount',
|
||||
},
|
||||
{
|
||||
id: 'payment_receive_no',
|
||||
Header: formatMessage({ id: 'payment_receive_no' }),
|
||||
Header: intl.get('payment_receive_no'),
|
||||
accessor: (row) =>
|
||||
row.payment_receive_no ? `#${row.payment_receive_no}` : null,
|
||||
width: 140,
|
||||
@@ -116,19 +117,19 @@ export function usePaymentReceivesColumns() {
|
||||
},
|
||||
{
|
||||
id: 'deposit_account',
|
||||
Header: formatMessage({ id: 'deposit_account' }),
|
||||
Header: intl.get('deposit_account'),
|
||||
accessor: 'deposit_account.name',
|
||||
width: 140,
|
||||
className: 'deposit_account_id',
|
||||
},
|
||||
{
|
||||
id: 'reference_no',
|
||||
Header: formatMessage({ id: 'reference_no' }),
|
||||
Header: intl.get('reference_no'),
|
||||
accessor: 'reference_no',
|
||||
width: 140,
|
||||
className: 'reference_no',
|
||||
}
|
||||
],
|
||||
[formatMessage],
|
||||
[],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user