feat (lang) : add Contacts & Sales & Purchases.

This commit is contained in:
elforjani3
2021-06-06 20:32:55 +02:00
parent 366404e1d6
commit a70fd300f2
26 changed files with 161 additions and 122 deletions

View File

@@ -6,6 +6,7 @@ import React, {
useCallback,
} from 'react';
import Dragzone from 'components/Dragzone';
import { FormattedMessage as T } from 'react-intl';
function CustomerAttachmentTabs() {
return (
@@ -14,7 +15,7 @@ function CustomerAttachmentTabs() {
initialFiles={[]}
onDrop={null}
onDeleteFile={[]}
hint={'Attachments: Maxiumum size: 20MB'}
hint={<T id={'attachments_maximum'} />}
/>
</div>
);

View File

@@ -1,10 +1,11 @@
import React from 'react';
import { FormGroup, InputGroup, ControlGroup } from '@blueprintjs/core';
import { FastField, ErrorMessage } from 'formik';
import { FormattedMessage as T } from 'react-intl';
import { FormattedMessage as T, useIntl } from 'react-intl';
import { inputIntent } from 'utils';
export default function CustomerFormAfterPrimarySection({}) {
const { formatMessage } = useIntl();
return (
<div class="customer-form__after-primary-section-content">
{/*------------ Customer email -----------*/}
@@ -33,7 +34,7 @@ export default function CustomerFormAfterPrimarySection({}) {
{({ field, meta: { error, touched } }) => (
<InputGroup
intent={inputIntent({ error, touched })}
placeholder={'Work'}
placeholder={formatMessage({ id: 'work' })}
{...field}
/>
)}
@@ -43,7 +44,7 @@ export default function CustomerFormAfterPrimarySection({}) {
{({ field, meta: { error, touched } }) => (
<InputGroup
intent={inputIntent({ error, touched })}
placeholder={'Mobile'}
placeholder={formatMessage({id:'Mobile'})}
{...field}
/>
)}

View File

@@ -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 } from 'react-intl';
import { FormattedMessage as T, useIntl } from 'react-intl';
import {
Hint,
FieldRequiredHint,
@@ -19,7 +20,8 @@ import { useAutofocus } from 'hooks';
*/
export default function CustomerFormPrimarySection({}) {
const firstNameFieldRef = useAutofocus();
const { formatMessage } = useIntl();
return (
<div className={'customer-form__primary-section-content'}>
{/**-----------Customer type. -----------*/}
@@ -53,7 +55,7 @@ export default function CustomerFormPrimarySection({}) {
<FastField name={'first_name'}>
{({ field, meta: { error, touched } }) => (
<InputGroup
placeholder={'First Name'}
placeholder={formatMessage({ id: 'first_name' })}
intent={inputIntent({ error, touched })}
className={classNames('input-group--first-name')}
inputRef={(ref) => (firstNameFieldRef.current = ref)}
@@ -65,7 +67,7 @@ export default function CustomerFormPrimarySection({}) {
<FastField name={'last_name'}>
{({ field, meta: { error, touched } }) => (
<InputGroup
placeholder={'Last Name'}
placeholder={formatMessage({ id: 'last_name' })}
intent={inputIntent({ error, touched })}
className={classNames('input-group--last-name')}
{...field}

View File

@@ -2,17 +2,17 @@ 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';
export default function CustomersEmptyStatus() {
const history = useHistory();
return (
<EmptyStatus
title={"Create and manage your organization's customers."}
title={<T id={'create_and_manage_your_organization_s_customers'} />}
description={
<p>
Here a list of your organization products and services, to be used
when you create invoices or bills to your customers or vendors.
<T id={'here_a_list_of_your_organization_products_and_services'} />
</p>
}
action={
@@ -24,11 +24,11 @@ export default function CustomersEmptyStatus() {
history.push('/customers/new');
}}
>
New customer
<T id={'new_customer'} />
</Button>
<Button intent={Intent.NONE} large={true}>
Learn more
<T id={'learn_more'} />
</Button>
</>
}

View File

@@ -1,6 +1,7 @@
import React, { useCallback } from 'react';
import { DataTable } from 'components';
import { useInventoryAdjustmentsColumns, ActionsMenu } from './components';
import { formatMessage } from 'services/intl';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withInventoryAdjustmentActions from './withInventoryAdjustmentActions';
@@ -23,14 +24,14 @@ function InventoryAdjustmentDataTable({
openAlert,
// #ownProps
tableProps
tableProps,
}) {
const {
isAdjustmentsLoading,
isAdjustmentsFetching,
inventoryAdjustments,
pagination
pagination,
} = useInventoryAdjustmentsContext();
// Handle delete inventory adjustment transaction.
@@ -47,40 +48,35 @@ function InventoryAdjustmentDataTable({
setInventoryAdjustmentTableState({
pageSize,
pageIndex,
sortBy
})
sortBy,
});
},
[setInventoryAdjustmentTableState],
);
return (
return (
<DataTable
columns={columns}
data={inventoryAdjustments}
loading={isAdjustmentsLoading}
headerLoading={isAdjustmentsLoading}
progressBarLoading={isAdjustmentsFetching}
initialState={inventoryAdjustmentTableState}
noInitialFetch={true}
onFetchData={handleDataTableFetchData}
manualSortBy={true}
selectionColumn={true}
pagination={true}
pagesCount={pagination.pagesCount}
autoResetSortBy={false}
autoResetPage={false}
payload={{
onDelete: handleDeleteAdjustment,
}}
ContextMenu={ActionsMenu}
noResults={'There is no inventory adjustments transactions yet.'}
noResults={formatMessage({
id: 'there_is_no_inventory_adjustments_transactions_yet',
})}
{...tableProps}
/>
);

View File

@@ -2,16 +2,17 @@ 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';
export default function ItemsEmptyStatus() {
const history = useHistory();
return (
<EmptyStatus
title={'Manage the organizations services and products.'}
title={<T id={'manage_the_organization_s_services_and_products'} />}
description={
<p>
Here a list of your organization products and services, to be used when you create invoices or bills to your customers or vendors.
<T id={'here_a_list_of_your_organization_products_and_services'} />
</p>
}
action={
@@ -23,11 +24,11 @@ export default function ItemsEmptyStatus() {
history.push('/items/new');
}}
>
New Item
<T id={'new_item'} />
</Button>
<Button intent={Intent.NONE} large={true}>
Learn more
<T id={'learn_more'}/>
</Button>
</>
}

View File

@@ -12,7 +12,7 @@ import { inputIntent } from 'utils';
export default function BillFormFooter() {
return (
<div class={classNames(CLASSES.PAGE_FORM_FOOTER)}>
<Postbox title={'Bill details'} defaultOpen={false}>
<Postbox title={<T id={'bill_details'} />} defaultOpen={false}>
<Row>
<Col md={8}>
<FastField name={'note'}>
@@ -33,7 +33,7 @@ export default function BillFormFooter() {
initialFiles={[]}
// onDrop={onDropFiles}
// onDeleteFile={onDropFiles}
hint={'Attachments: Maxiumum size: 20MB'}
hint={<T id={'attachments_maximum'} />}
/>
</Col>
</Row>

View File

@@ -2,6 +2,7 @@ import React, { useMemo } from 'react';
import classNames from 'classnames';
import { sumBy } from 'lodash';
import { useFormikContext } from 'formik';
import { formatMessage } from 'services/intl';
import { CLASSES } from 'common/classes';
@@ -28,7 +29,7 @@ function BillFormHeader({
<div className={classNames(CLASSES.PAGE_FORM_HEADER)}>
<BillFormHeaderFields />
<PageFormBigNumber
label={'Due Amount'}
label={formatMessage({id:'due_amount'})}
amount={totalDueAmount}
currencyCode={baseCurrency}
/>

View File

@@ -2,16 +2,17 @@ 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';
export default function BillsEmptyStatus() {
const history = useHistory();
return (
<EmptyStatus
title={'Manage the organizations services and products.'}
title={<T id={'manage_the_organization_s_services_and_products'} />}
description={
<p>
Here a list of your organization products and services, to be used when you create invoices or bills to your customers or vendors.
<T id={'here_a_list_of_your_organization_products_and_services'} />
</p>
}
action={
@@ -23,11 +24,11 @@ export default function BillsEmptyStatus() {
history.push('/bills/new');
}}
>
New bill
<T id={'new_bill'} />
</Button>
<Button intent={Intent.NONE} large={true}>
Learn more
<T id={'learn_more'} />
</Button>
</>
}

View File

@@ -1,6 +1,7 @@
import React, { useCallback } from 'react';
import { CloudLoadingIndicator } from 'components';
import classNames from 'classnames';
import { FormattedMessage as T } from 'react-intl';
import { CLASSES } from 'common/classes';
import { DataTableEditable } from 'components';
@@ -42,9 +43,15 @@ export default function PaymentMadeEntriesTable({
// Detarmines the right no results message before selecting vendor and aftering
// selecting vendor id.
const noResultsMessage = vendor_id
? 'There is no payable bills for this vendor that can be applied for this payment'
: 'Please select a vendor to display all open bills for it.';
const noResultsMessage = vendor_id ? (
<T
id={
'there_is_no_payable_bills_for_this_vendor_that_can_be_applied_for_this_payment'
}
/>
) : (
<T id={'please_select_a_vendor_to_display_all_open_bills_for_it'} />
);
return (
<CloudLoadingIndicator isLoading={isNewEntriesFetching}>

View File

@@ -12,7 +12,7 @@ import { CLASSES } from 'common/classes';
export default function PaymentMadeFooter() {
return (
<div className={classNames(CLASSES.PAGE_FORM_FOOTER)}>
<Postbox title={'Payment made details'} defaultOpen={false}>
<Postbox title={<T id={'payment_made_details'} />} defaultOpen={false}>
<Row>
<Col md={8}>
{/* --------- Statement --------- */}

View File

@@ -4,9 +4,9 @@ import { useFormikContext } from 'formik';
import { sumBy } from 'lodash';
import { CLASSES } from 'common/classes';
import { compose } from 'utils';
import {
Money,
} from 'components';
import { Money } from 'components';
import { FormattedMessage as T } from 'react-intl';
import PaymentMadeFormHeaderFields from './PaymentMadeFormHeaderFields';
import withSettings from 'containers/Settings/withSettings';
@@ -18,7 +18,9 @@ function PaymentMadeFormHeader({
baseCurrency,
}) {
// Formik form context.
const { values: { entries } } = useFormikContext();
const {
values: { entries },
} = useFormikContext();
// Calculate the payment amount of the entries.
const amountPaid = useMemo(() => sumBy(entries, 'payment_amount'), [entries]);
@@ -30,7 +32,9 @@ function PaymentMadeFormHeader({
<div className={classNames(CLASSES.PAGE_FORM_HEADER_BIG_NUMBERS)}>
<div class="big-amount">
<span class="big-amount__label">Amount Received</span>
<span class="big-amount__label">
<T id={'amount_received'} />
</span>
<h1 class="big-amount__number">
<Money amount={amountPaid} currency={baseCurrency} />
</h1>

View File

@@ -157,7 +157,7 @@ function PaymentMadeFormHeaderFields({ baseCurrency }) {
small={true}
minimal={true}
>
Receive full amount (
<T id={'receive_full_amount'} /> (
<Money amount={payableFullAmount} currency={baseCurrency} />)
</Button>
</FormGroup>

View File

@@ -2,17 +2,17 @@ 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';
export default function PaymentMadesEmptyStatus() {
const history = useHistory();
return (
<EmptyStatus
title={'The organization does not have invoices, yet!'}
title={<T id={'the_organization_doesn_t_receive_money_yet'} />}
description={
<p>
It is a long established fact that a reader will be distracted by the
readable content of a page when looking at its layout.
<T id={'it_is_a_long_established_fact_that_a_reader'} />
</p>
}
action={
@@ -24,11 +24,11 @@ export default function PaymentMadesEmptyStatus() {
history.push('/payment-mades/new');
}}
>
New bill payment
<T id={'new_bill_payment'} />
</Button>
<Button intent={Intent.NONE} large={true}>
Learn more
<T id={'learn_more'} />
</Button>
</>
}

View File

@@ -1,37 +1,37 @@
import React from 'react';
import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
import { EmptyStatus } from 'components';
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';
export default function EstimatesEmptyStatus() {
const history = useHistory();
export default function EstimatesEmptyStatus() {
const history = useHistory();
return (
<EmptyStatus
title={'The organization does not have invoices, yet!'}
description={
<p>
It is a long established fact that a reader will be distracted by the
readable content of a page when looking at its layout.
</p>
}
action={
<>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/invoices/new');
}}
>
New sale invoice
</Button>
return (
<EmptyStatus
title={<T id={'the_organization_doesn_t_receive_money_yet'} />}
description={
<p>
<T id={'it_is_a_long_established_fact_that_a_reader'} />
</p>
}
action={
<>
<Button
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/invoices/new');
}}
>
<T id={'new_sale_invoice'} />
</Button>
<Button intent={Intent.NONE} large={true}>
Learn more
</Button>
</>
}
/>
);
}
<Button intent={Intent.NONE} large={true}>
<T id={'learn_more'} />
</Button>
</>
}
/>
);
}

View File

@@ -4,6 +4,7 @@ import { useIntl } from 'react-intl';
import { Money } from 'components';
import { MoneyFieldCell } from 'components/DataTableCells';
import { safeSumBy, formattedAmount } from 'utils';
import { formatMessage } from 'services/intl';
/**
* Invoice date cell.
@@ -58,14 +59,14 @@ function MoneyTableCell({ row: { original }, value }) {
}
function DateFooterCell() {
return 'Total';
return formatMessage({id:'total'})
}
/**
* Retrieve payment receive form entries columns.
*/
export const usePaymentReceiveEntriesColumns = () => {
const { formatMessage } = useIntl();
return React.useMemo(
() => [

View File

@@ -10,7 +10,7 @@ import { inputIntent } from 'utils';
export default function ReceiptFormFooter({}) {
return (
<div className={classNames(CLASSES.PAGE_FORM_FOOTER)}>
<Postbox title={'Invoice details'} defaultOpen={false}>
<Postbox title={<T id={'receipt_details'}/>} defaultOpen={false}>
<Row>
<Col md={8}>
{/* --------- Receipt message --------- */}
@@ -45,7 +45,8 @@ export default function ReceiptFormFooter({}) {
initialFiles={[]}
// onDrop={handleDropFiles}
// onDeleteFile={handleDeleteFile}
hint={'Attachments: Maxiumum size: 20MB'}
hint={<T id={'attachments_maximum'} />}
/>
</Col>
</Row>

View File

@@ -7,6 +7,8 @@ import { CLASSES } from 'common/classes';
import ReceiptFormHeaderFields from './ReceiptFormHeaderFields';
import { PageFormBigNumber } from 'components';
import { formatMessage } from 'services/intl';
import withSettings from 'containers/Settings/withSettings';
import { compose } from 'redux';
@@ -22,9 +24,10 @@ function ReceiptFormHeader({
const { values } = useFormikContext();
// Calculate the total due amount of bill entries.
const totalDueAmount = useMemo(() => sumBy(values.entries, 'total'), [
values.entries,
]);
const totalDueAmount = useMemo(
() => sumBy(values.entries, 'total'),
[values.entries],
);
return (
<div className={classNames(CLASSES.PAGE_FORM_HEADER)}>
@@ -32,7 +35,7 @@ function ReceiptFormHeader({
onReceiptNumberChanged={onReceiptNumberChanged}
/>
<PageFormBigNumber
label={'Due Amount'}
label={formatMessage({ id: 'due_amount' })}
amount={totalDueAmount}
currencyCode={baseCurrency}
/>

View File

@@ -2,16 +2,17 @@ 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';
export default function ReceiptsEmptyStatus() {
const history = useHistory();
return (
<EmptyStatus
title={'Manage the organizations services and products.'}
title={<T id={'manage_the_organization_s_services_and_products'} />}
description={
<p>
Here a list of your organization products and services, to be used when you create invoices or bills to your customers or vendors.
<T id={'here_a_list_of_your_organization_products_and_services'} />
</p>
}
action={
@@ -23,11 +24,11 @@ export default function ReceiptsEmptyStatus() {
history.push('/receipts/new');
}}
>
New receipt
<T id={'new_receipt'} />
</Button>
<Button intent={Intent.NONE} large={true}>
Learn more
<T id={'learn_more'}/>
</Button>
</>
}

View File

@@ -1,5 +1,6 @@
import React from 'react';
import Dragzone from 'components/Dragzone';
import { FormattedMessage as T } from 'react-intl';
/**
* Vendor Attahment Tab.
@@ -11,7 +12,7 @@ function VendorAttahmentTab() {
initialFiles={[]}
onDrop={null}
onDeleteFile={[]}
hint={'Attachments: Maxiumum size: 20MB'}
hint={<T id={'attachments_maximum'} />}
/>
</div>
);

View File

@@ -1,13 +1,15 @@
import React from 'react';
import { FormGroup, InputGroup, ControlGroup } from '@blueprintjs/core';
import { FastField, ErrorMessage } from 'formik';
import { FormattedMessage as T } from 'react-intl';
import { FormattedMessage as T, useIntl } from 'react-intl';
import { inputIntent } from 'utils';
/**
* Vendor form after primary section.
*/
function VendorFormAfterPrimarySection() {
const { formatMessage } = useIntl();
return (
<div class="customer-form__after-primary-section-content">
{/*------------ Vendor email -----------*/}
@@ -36,7 +38,7 @@ function VendorFormAfterPrimarySection() {
{({ field, meta: { error, touched } }) => (
<InputGroup
intent={inputIntent({ error, touched })}
placeholder={'Work'}
placeholder={formatMessage({ id: 'work' })}
{...field}
/>
)}
@@ -45,7 +47,7 @@ function VendorFormAfterPrimarySection() {
{({ field, meta: { error, touched } }) => (
<InputGroup
intent={inputIntent({ error, touched })}
placeholder={'Mobile'}
placeholder={formatMessage({ id: 'Mobile' })}
{...field}
/>
)}

View File

@@ -2,7 +2,7 @@ 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 } from 'react-intl';
import { FormattedMessage as T, useIntl } from 'react-intl';
import {
Hint,
FieldRequiredHint,
@@ -20,6 +20,7 @@ import { useAutofocus } from 'hooks';
*/
function VendorFormPrimarySection() {
const firstNameFieldRef = useAutofocus();
const { formatMessage } = useIntl();
return (
<div className={'customer-form__primary-section-content'}>
@@ -51,7 +52,7 @@ function VendorFormPrimarySection() {
<FastField name={'first_name'}>
{({ field, meta: { error, touched } }) => (
<InputGroup
placeholder={'First Name'}
placeholder={formatMessage({ id: 'first_name' })}
intent={inputIntent({ error, touched })}
className={classNames('input-group--first-name')}
inputRef={(ref) => (firstNameFieldRef.current = ref)}
@@ -63,7 +64,7 @@ function VendorFormPrimarySection() {
<FastField name={'last_name'}>
{({ field, meta: { error, touched } }) => (
<InputGroup
placeholder={'Last Name'}
placeholder={formatMessage({ id: 'last_name' })}
intent={inputIntent({ error, touched })}
className={classNames('input-group--last-name')}
{...field}

View File

@@ -2,17 +2,17 @@ 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';
export default function VendorsEmptyStatus() {
const history = useHistory();
return (
<EmptyStatus
title={"Create and manage your organization's vendors."}
title={<T id={'create_and_manage_your_organization_s_vendors'} />}
description={
<p>
Here a list of your organization products and services, to be used
when you create invoices or bills to your customers or vendors.
<T id={'here_a_list_of_your_organization_products_and_services'} />
</p>
}
action={
@@ -24,11 +24,11 @@ export default function VendorsEmptyStatus() {
history.push('/vendors/new');
}}
>
New vendor
<T id={'new_vendor'} />
</Button>
<Button intent={Intent.NONE} large={true}>
Learn more
<T id={'learn_more'} />
</Button>
</>
}