mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -38,7 +38,7 @@ export default function MakeJournalEntriesFooter({
|
|||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
className={'button-secondary ml1'}
|
className={'button-secondary ml1'}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onSubmitClick({ publish: false, redirect: false });
|
onSubmitClick({ publish: false, redirect: true });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<T id={'save_as_draft'} />
|
<T id={'save_as_draft'} />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { useEffect, useState, useMemo, useCallback } from 'react';
|
import React, { useEffect, useState, useMemo, useCallback } from 'react';
|
||||||
import { Route, Switch, useHistory, withRouter } from 'react-router-dom';
|
import { Route, Switch, useHistory, withRouter } from 'react-router-dom';
|
||||||
import { useQuery } from 'react-query';
|
import { queryCache, useQuery } from 'react-query';
|
||||||
import { Alert, Intent } from '@blueprintjs/core';
|
import { Alert, Intent } from '@blueprintjs/core';
|
||||||
import AppToaster from 'components/AppToaster';
|
import AppToaster from 'components/AppToaster';
|
||||||
import {
|
import {
|
||||||
@@ -53,6 +53,7 @@ function ManualJournalsTable({
|
|||||||
const [deleteManualJournal, setDeleteManualJournal] = useState(false);
|
const [deleteManualJournal, setDeleteManualJournal] = useState(false);
|
||||||
const [selectedRows, setSelectedRows] = useState([]);
|
const [selectedRows, setSelectedRows] = useState([]);
|
||||||
const [bulkDelete, setBulkDelete] = useState(false);
|
const [bulkDelete, setBulkDelete] = useState(false);
|
||||||
|
const [publishManualJournal, setPublishManualJournal] = useState(false);
|
||||||
|
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
|
|
||||||
@@ -176,19 +177,36 @@ function ManualJournalsTable({
|
|||||||
[addManualJournalsTableQueries],
|
[addManualJournalsTableQueries],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handlePublishJournal = useCallback(
|
// Handle publish manual Journal click.
|
||||||
(journal) => {
|
const handlePublishMaunalJournal = useCallback(
|
||||||
requestPublishManualJournal(journal.id).then(() => {
|
(jouranl) => {
|
||||||
|
setPublishManualJournal(jouranl);
|
||||||
|
},
|
||||||
|
[setPublishManualJournal],
|
||||||
|
);
|
||||||
|
|
||||||
|
// Handle cancel manual journal alert.
|
||||||
|
const handleCancelPublishMaunalJournal = useCallback(() => {
|
||||||
|
setPublishManualJournal(false);
|
||||||
|
}, [setPublishManualJournal]);
|
||||||
|
|
||||||
|
// Handle publish manual journal confirm.
|
||||||
|
const handleConfirmPublishManualJournal = useCallback(() => {
|
||||||
|
requestPublishManualJournal(publishManualJournal.id)
|
||||||
|
.then(() => {
|
||||||
|
setPublishManualJournal(false);
|
||||||
AppToaster.show({
|
AppToaster.show({
|
||||||
message: formatMessage({
|
message: formatMessage({
|
||||||
id: 'the_manual_journal_id_has_been_published',
|
id: 'the_manual_journal_has_been_published',
|
||||||
}),
|
}),
|
||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
|
queryCache.invalidateQueries('manual-journals-table');
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
setPublishManualJournal(false);
|
||||||
});
|
});
|
||||||
},
|
}, [publishManualJournal, requestPublishManualJournal, formatMessage]);
|
||||||
[requestPublishManualJournal, formatMessage],
|
|
||||||
);
|
|
||||||
|
|
||||||
// Handle selected rows change.
|
// Handle selected rows change.
|
||||||
const handleSelectedRowsChange = useCallback(
|
const handleSelectedRowsChange = useCallback(
|
||||||
@@ -223,7 +241,7 @@ function ManualJournalsTable({
|
|||||||
<ManualJournalsDataTable
|
<ManualJournalsDataTable
|
||||||
onDeleteJournal={handleDeleteJournal}
|
onDeleteJournal={handleDeleteJournal}
|
||||||
onEditJournal={handleEditJournal}
|
onEditJournal={handleEditJournal}
|
||||||
onPublishJournal={handlePublishJournal}
|
onPublishJournal={handlePublishMaunalJournal}
|
||||||
onSelectedRowsChange={handleSelectedRowsChange}
|
onSelectedRowsChange={handleSelectedRowsChange}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
@@ -260,6 +278,18 @@ function ManualJournalsTable({
|
|||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
</Alert>
|
</Alert>
|
||||||
|
<Alert
|
||||||
|
cancelButtonText={<T id={'cancel'} />}
|
||||||
|
confirmButtonText={<T id={'publish'} />}
|
||||||
|
intent={Intent.WARNING}
|
||||||
|
isOpen={publishManualJournal}
|
||||||
|
onCancel={handleCancelPublishMaunalJournal}
|
||||||
|
onConfirm={handleConfirmPublishManualJournal}
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
<T id={'are_sure_to_publish_this_manual_journal'} />
|
||||||
|
</p>
|
||||||
|
</Alert>
|
||||||
</DashboardPageContent>
|
</DashboardPageContent>
|
||||||
</DashboardInsider>
|
</DashboardInsider>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ const CustomerBillingAddress = ({}) => {
|
|||||||
inline={true}
|
inline={true}
|
||||||
helperText={<ErrorMessage name="shipping_address_2" />}
|
helperText={<ErrorMessage name="shipping_address_2" />}
|
||||||
>
|
>
|
||||||
<InputGroup {...field} />
|
<TextArea {...field} />
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
</FastField>
|
</FastField>
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
import React, { useCallback, useState } from 'react';
|
import React, { useCallback, useState } from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { FormGroup, Position, Classes } from '@blueprintjs/core';
|
import { FormGroup, Position, Classes, ControlGroup } from '@blueprintjs/core';
|
||||||
import { DateInput } from '@blueprintjs/datetime';
|
import { DateInput } from '@blueprintjs/datetime';
|
||||||
import { FastField, ErrorMessage } from 'formik';
|
import { FastField, ErrorMessage } from 'formik';
|
||||||
import { MoneyInputGroup, CurrencySelectList, Row, Col } from 'components';
|
import {
|
||||||
|
MoneyInputGroup,
|
||||||
|
InputPrependText,
|
||||||
|
CurrencySelectList,
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
} from 'components';
|
||||||
import { FormattedMessage as T } from 'react-intl';
|
import { FormattedMessage as T } from 'react-intl';
|
||||||
|
|
||||||
import withCurrencies from 'containers/Currencies/withCurrencies';
|
import withCurrencies from 'containers/Currencies/withCurrencies';
|
||||||
@@ -21,20 +27,7 @@ function CustomerFinancialPanel({
|
|||||||
|
|
||||||
customerId,
|
customerId,
|
||||||
}) {
|
}) {
|
||||||
const [selectedItems, setSelectedItems] = useState();
|
|
||||||
|
|
||||||
const onItemsSelect = useCallback(
|
|
||||||
(filedName) => {
|
|
||||||
return (filed) => {
|
|
||||||
setSelectedItems({
|
|
||||||
...selectedItems,
|
|
||||||
[filedName]: filed,
|
|
||||||
});
|
|
||||||
// setFieldValue(filedName, filed.currency_code);
|
|
||||||
};
|
|
||||||
},
|
|
||||||
[selectedItems],
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
<div className={'tab-panel--financial'}>
|
<div className={'tab-panel--financial'}>
|
||||||
<Row>
|
<Row>
|
||||||
@@ -52,7 +45,6 @@ function CustomerFinancialPanel({
|
|||||||
<DateInput
|
<DateInput
|
||||||
{...momentFormatter('YYYY/MM/DD')}
|
{...momentFormatter('YYYY/MM/DD')}
|
||||||
value={tansformDateValue(value)}
|
value={tansformDateValue(value)}
|
||||||
// onChange={}
|
|
||||||
popoverProps={{ position: Position.BOTTOM, minimal: true }}
|
popoverProps={{ position: Position.BOTTOM, minimal: true }}
|
||||||
disabled={customerId}
|
disabled={customerId}
|
||||||
/>
|
/>
|
||||||
@@ -62,7 +54,12 @@ function CustomerFinancialPanel({
|
|||||||
|
|
||||||
{/*------------ Opening balance -----------*/}
|
{/*------------ Opening balance -----------*/}
|
||||||
<FastField name={'opening_balance'}>
|
<FastField name={'opening_balance'}>
|
||||||
{({ field, field: { value }, meta: { error, touched } }) => (
|
{({
|
||||||
|
form: { values },
|
||||||
|
field,
|
||||||
|
field: { value },
|
||||||
|
meta: { error, touched },
|
||||||
|
}) => (
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={<T id={'opening_balance'} />}
|
label={<T id={'opening_balance'} />}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
@@ -72,13 +69,15 @@ function CustomerFinancialPanel({
|
|||||||
intent={inputIntent({ error, touched })}
|
intent={inputIntent({ error, touched })}
|
||||||
inline={true}
|
inline={true}
|
||||||
>
|
>
|
||||||
<MoneyInputGroup
|
<ControlGroup>
|
||||||
value={value}
|
<InputPrependText text={values.currency_code} />
|
||||||
prefix={'$'}
|
<MoneyInputGroup
|
||||||
inputGroupProps={{ fill: true }}
|
value={value}
|
||||||
disabled={customerId}
|
inputGroupProps={{ fill: true }}
|
||||||
{...field}
|
disabled={customerId}
|
||||||
/>
|
{...field}
|
||||||
|
/>
|
||||||
|
</ControlGroup>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
</FastField>
|
</FastField>
|
||||||
@@ -98,7 +97,9 @@ function CustomerFinancialPanel({
|
|||||||
<CurrencySelectList
|
<CurrencySelectList
|
||||||
currenciesList={currenciesList}
|
currenciesList={currenciesList}
|
||||||
selectedCurrencyCode={value}
|
selectedCurrencyCode={value}
|
||||||
onCurrencySelected={onItemsSelect('currency_code')}
|
onCurrencySelected={(currency) => {
|
||||||
|
form.setFieldValue('currency_code', currency.currency_code);
|
||||||
|
}}
|
||||||
disabled={customerId}
|
disabled={customerId}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import withCustomerDetail from 'containers/Customers/withCustomerDetail';
|
|||||||
import withCustomersActions from 'containers/Customers/withCustomersActions';
|
import withCustomersActions from 'containers/Customers/withCustomersActions';
|
||||||
import withMediaActions from 'containers/Media/withMediaActions';
|
import withMediaActions from 'containers/Media/withMediaActions';
|
||||||
import withCustomers from 'containers/Customers//withCustomers';
|
import withCustomers from 'containers/Customers//withCustomers';
|
||||||
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
import useMedia from 'hooks/useMedia';
|
import useMedia from 'hooks/useMedia';
|
||||||
|
|
||||||
import { compose, transformToForm } from 'utils';
|
import { compose, transformToForm } from 'utils';
|
||||||
@@ -73,6 +74,9 @@ function CustomerForm({
|
|||||||
// #withCustomerDetail
|
// #withCustomerDetail
|
||||||
customer,
|
customer,
|
||||||
|
|
||||||
|
// #withSettings
|
||||||
|
baseCurrency,
|
||||||
|
|
||||||
// #withCustomersActions
|
// #withCustomersActions
|
||||||
requestSubmitCustomer,
|
requestSubmitCustomer,
|
||||||
requestEditCustomer,
|
requestEditCustomer,
|
||||||
@@ -151,6 +155,7 @@ function CustomerForm({
|
|||||||
const initialValues = useMemo(
|
const initialValues = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
...defaultInitialValues,
|
...defaultInitialValues,
|
||||||
|
currency_code: baseCurrency,
|
||||||
...transformToForm(customer, defaultInitialValues),
|
...transformToForm(customer, defaultInitialValues),
|
||||||
}),
|
}),
|
||||||
[customer, defaultInitialValues],
|
[customer, defaultInitialValues],
|
||||||
@@ -250,7 +255,7 @@ function CustomerForm({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={classNames(CLASSES.PAGE_FORM_TABS)}>
|
<div className={classNames(CLASSES.PAGE_FORM_TABS)}>
|
||||||
<CustomersTabs customerId={customerId} />
|
<CustomersTabs customer={customerId} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<CustomerFloatingActions
|
<CustomerFloatingActions
|
||||||
@@ -271,6 +276,9 @@ export default compose(
|
|||||||
withCustomers(({ customers }) => ({
|
withCustomers(({ customers }) => ({
|
||||||
customers,
|
customers,
|
||||||
})),
|
})),
|
||||||
|
withSettings(({ organizationSettings }) => ({
|
||||||
|
baseCurrency: organizationSettings?.baseCurrency,
|
||||||
|
})),
|
||||||
withDashboardActions,
|
withDashboardActions,
|
||||||
withCustomersActions,
|
withCustomersActions,
|
||||||
withMediaActions,
|
withMediaActions,
|
||||||
|
|||||||
@@ -6,14 +6,7 @@ import CustomerAttachmentTabs from './CustomerAttachmentTabs';
|
|||||||
import CustomerFinancialPanel from './CustomerFinancialPanel';
|
import CustomerFinancialPanel from './CustomerFinancialPanel';
|
||||||
import CustomerNotePanel from './CustomerNotePanel';
|
import CustomerNotePanel from './CustomerNotePanel';
|
||||||
|
|
||||||
export default function CustomersTabs({
|
export default function CustomersTabs({ customer }) {
|
||||||
setFieldValue,
|
|
||||||
getFieldProps,
|
|
||||||
errors,
|
|
||||||
values,
|
|
||||||
touched,
|
|
||||||
customerId,
|
|
||||||
}) {
|
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -27,7 +20,7 @@ export default function CustomersTabs({
|
|||||||
<Tab
|
<Tab
|
||||||
id={'financial'}
|
id={'financial'}
|
||||||
title={formatMessage({ id: 'financial_details' })}
|
title={formatMessage({ id: 'financial_details' })}
|
||||||
panel={<CustomerFinancialPanel />}
|
panel={<CustomerFinancialPanel customerId={customer} />}
|
||||||
/>
|
/>
|
||||||
<Tab
|
<Tab
|
||||||
id={'address'}
|
id={'address'}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { connect } from 'react-redux';
|
|||||||
import { getCustomerById } from 'store/customers/customers.reducer';
|
import { getCustomerById } from 'store/customers/customers.reducer';
|
||||||
|
|
||||||
const mapStateToProps = (state, props) => ({
|
const mapStateToProps = (state, props) => ({
|
||||||
customerDetail: getCustomerById(state, props.customerId),
|
customer: getCustomerById(state, props.customerId),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps);
|
export default connect(mapStateToProps);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ const Schema = Yup.object().shape({
|
|||||||
.trim()
|
.trim()
|
||||||
.min(1)
|
.min(1)
|
||||||
.max(DATATYPES_LENGTH.TEXT)
|
.max(DATATYPES_LENGTH.TEXT)
|
||||||
|
.nullable()
|
||||||
.label(formatMessage({ id: 'description' })),
|
.label(formatMessage({ id: 'description' })),
|
||||||
publish: Yup.boolean().label(formatMessage({ id: 'publish' })),
|
publish: Yup.boolean().label(formatMessage({ id: 'publish' })),
|
||||||
categories: Yup.array().of(
|
categories: Yup.array().of(
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ function BillsDataTable({
|
|||||||
{
|
{
|
||||||
id: 'bill_number',
|
id: 'bill_number',
|
||||||
Header: formatMessage({ id: 'bill_number' }),
|
Header: formatMessage({ id: 'bill_number' }),
|
||||||
accessor: (row) => `#${row.bill_number}`,
|
accessor: (row) => (row.bill_number ? `#${row.bill_number}` : null),
|
||||||
width: 140,
|
width: 140,
|
||||||
className: 'bill_number',
|
className: 'bill_number',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ function PaymentMadeDataTable({
|
|||||||
{
|
{
|
||||||
id: 'payment_number',
|
id: 'payment_number',
|
||||||
Header: formatMessage({ id: 'payment_number' }),
|
Header: formatMessage({ id: 'payment_number' }),
|
||||||
accessor: (row) => `#${row.payment_number}`,
|
accessor: (row) => (row.payment_number ? `#${row.payment_number}` : null),
|
||||||
width: 140,
|
width: 140,
|
||||||
className: 'payment_number',
|
className: 'payment_number',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ const Schema = Yup.object().shape({
|
|||||||
payment_number: Yup.string()
|
payment_number: Yup.string()
|
||||||
.nullable()
|
.nullable()
|
||||||
.max(DATATYPES_LENGTH.STRING)
|
.max(DATATYPES_LENGTH.STRING)
|
||||||
|
.nullable()
|
||||||
.label(formatMessage({ id: 'payment_no_' })),
|
.label(formatMessage({ id: 'payment_no_' })),
|
||||||
reference: Yup.string().min(1).max(DATATYPES_LENGTH.STRING).nullable(),
|
reference: Yup.string().min(1).max(DATATYPES_LENGTH.STRING).nullable(),
|
||||||
description: Yup.string().max(DATATYPES_LENGTH.TEXT),
|
description: Yup.string().max(DATATYPES_LENGTH.TEXT),
|
||||||
|
|||||||
@@ -163,7 +163,6 @@ function PaymentMadeFormHeader({
|
|||||||
label={<T id={'payment_no'} />}
|
label={<T id={'payment_no'} />}
|
||||||
inline={true}
|
inline={true}
|
||||||
className={('form-group--payment_number', Classes.FILL)}
|
className={('form-group--payment_number', Classes.FILL)}
|
||||||
labelInfo={<FieldRequiredHint />}
|
|
||||||
intent={
|
intent={
|
||||||
errors.payment_number && touched.payment_number && Intent.DANGER
|
errors.payment_number && touched.payment_number && Intent.DANGER
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useEffect, useMemo, useCallback } from 'react';
|
import React, { useState, useEffect, useMemo, useCallback } from 'react';
|
||||||
import { Button } from '@blueprintjs/core';
|
import { Button } from '@blueprintjs/core';
|
||||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { sumBy } from 'lodash';
|
import { sumBy } from 'lodash';
|
||||||
@@ -26,7 +26,7 @@ const CellRenderer = (content, type) => (props) => {
|
|||||||
|
|
||||||
const TotalCellRederer = (content, type) => (props) => {
|
const TotalCellRederer = (content, type) => (props) => {
|
||||||
if (props.data.length === props.row.index + 1) {
|
if (props.data.length === props.row.index + 1) {
|
||||||
return <Money amount={props.cell.row.original[type]} currency={'USD'} />
|
return <Money amount={props.cell.row.original[type]} currency={'USD'} />;
|
||||||
}
|
}
|
||||||
return content(props);
|
return content(props);
|
||||||
};
|
};
|
||||||
@@ -40,15 +40,17 @@ export default function PaymentMadeItemsTableEditor({
|
|||||||
onUpdateData,
|
onUpdateData,
|
||||||
data,
|
data,
|
||||||
errors,
|
errors,
|
||||||
noResultsMessage
|
noResultsMessage,
|
||||||
}) {
|
}) {
|
||||||
const transformedData = useMemo(() => {
|
const transformedData = useMemo(() => {
|
||||||
const rows = [ ...data ];
|
const rows = [...data];
|
||||||
const totalRow = {
|
const totalRow = {
|
||||||
due_amount: sumBy(data, 'due_amount'),
|
due_amount: sumBy(data, 'due_amount'),
|
||||||
payment_amount: sumBy(data, 'payment_amount'),
|
payment_amount: sumBy(data, 'payment_amount'),
|
||||||
};
|
};
|
||||||
if (rows.length > 0) { rows.push(totalRow) }
|
if (rows.length > 0) {
|
||||||
|
rows.push(totalRow);
|
||||||
|
}
|
||||||
return rows;
|
return rows;
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
@@ -80,7 +82,7 @@ export default function PaymentMadeItemsTableEditor({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: formatMessage({ id: 'bill_number' }),
|
Header: formatMessage({ id: 'bill_number' }),
|
||||||
accessor: (row) => `#${row?.bill_number}`,
|
accessor: (row) => `#${row?.bill_number || ''}`,
|
||||||
Cell: CellRenderer(EmptyDiv, 'bill_number'),
|
Cell: CellRenderer(EmptyDiv, 'bill_number'),
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
className: 'bill_number',
|
className: 'bill_number',
|
||||||
@@ -116,7 +118,7 @@ export default function PaymentMadeItemsTableEditor({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const rowClassNames = useCallback(
|
const rowClassNames = useCallback(
|
||||||
(row) => ({ 'row--total': localData.length === row.index + 1 }),
|
(row) => ({ 'row--total': localData.length === row.index + 1 }),
|
||||||
[localData],
|
[localData],
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -129,7 +131,7 @@ export default function PaymentMadeItemsTableEditor({
|
|||||||
columnId,
|
columnId,
|
||||||
value,
|
value,
|
||||||
);
|
);
|
||||||
newRows.splice(-1,1); // removes the total row.
|
newRows.splice(-1, 1); // removes the total row.
|
||||||
|
|
||||||
setLocalData(newRows);
|
setLocalData(newRows);
|
||||||
onUpdateData && onUpdateData(newRows);
|
onUpdateData && onUpdateData(newRows);
|
||||||
@@ -138,10 +140,12 @@ export default function PaymentMadeItemsTableEditor({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(
|
<div
|
||||||
CLASSES.DATATABLE_EDITOR,
|
className={classNames(
|
||||||
CLASSES.DATATABLE_EDITOR_ITEMS_ENTRIES,
|
CLASSES.DATATABLE_EDITOR,
|
||||||
)}>
|
CLASSES.DATATABLE_EDITOR_ITEMS_ENTRIES,
|
||||||
|
)}
|
||||||
|
>
|
||||||
<DataTable
|
<DataTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={localData}
|
data={localData}
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ const MIN_LINES_NUMBER = 4;
|
|||||||
|
|
||||||
const defaultEstimate = {
|
const defaultEstimate = {
|
||||||
index: 0,
|
index: 0,
|
||||||
item_id: null,
|
item_id: '',
|
||||||
rate: null,
|
rate: '',
|
||||||
discount: 0,
|
discount: 0,
|
||||||
quantity: null,
|
quantity: '',
|
||||||
description: '',
|
description: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ function EstimatesDataTable({
|
|||||||
{
|
{
|
||||||
id: 'estimate_number',
|
id: 'estimate_number',
|
||||||
Header: formatMessage({ id: 'estimate_number' }),
|
Header: formatMessage({ id: 'estimate_number' }),
|
||||||
accessor: (row) => `#${row.estimate_number}`,
|
accessor: (row) => (row.estimate_number ? `#${row.estimate_number}` : null),
|
||||||
width: 140,
|
width: 140,
|
||||||
className: 'estimate_number',
|
className: 'estimate_number',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ const MIN_LINES_NUMBER = 4;
|
|||||||
|
|
||||||
const defaultInvoice = {
|
const defaultInvoice = {
|
||||||
index: 0,
|
index: 0,
|
||||||
item_id: null,
|
item_id: '',
|
||||||
rate: null,
|
rate: '',
|
||||||
discount: 0,
|
discount: 0,
|
||||||
quantity: null,
|
quantity: '',
|
||||||
description: '',
|
description: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ function InvoicesDataTable({
|
|||||||
{
|
{
|
||||||
id: 'invoice_no',
|
id: 'invoice_no',
|
||||||
Header: formatMessage({ id: 'invoice_no__' }),
|
Header: formatMessage({ id: 'invoice_no__' }),
|
||||||
accessor: (row) => `#${row.invoice_no}`,
|
accessor: (row) => (row.invoice_no ? `#${row.invoice_no}` : null),
|
||||||
width: 140,
|
width: 140,
|
||||||
className: 'invoice_no',
|
className: 'invoice_no',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -109,10 +109,10 @@ function PaymentReceiveForm({
|
|||||||
|
|
||||||
// Default payment receive entry.
|
// Default payment receive entry.
|
||||||
const defaultPaymentReceiveEntry = {
|
const defaultPaymentReceiveEntry = {
|
||||||
id: null,
|
id: '',
|
||||||
payment_amount: null,
|
payment_amount: '',
|
||||||
invoice_id: null,
|
invoice_id: '',
|
||||||
due_amount: null,
|
due_amount: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
// Form initial values.
|
// Form initial values.
|
||||||
|
|||||||
@@ -21,12 +21,15 @@ import {
|
|||||||
FieldRequiredHint,
|
FieldRequiredHint,
|
||||||
Icon,
|
Icon,
|
||||||
InputPrependButton,
|
InputPrependButton,
|
||||||
|
MoneyInputGroup,
|
||||||
|
InputPrependText,
|
||||||
Hint,
|
Hint,
|
||||||
Money,
|
Money,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
|
|
||||||
import withCustomers from 'containers/Customers/withCustomers';
|
import withCustomers from 'containers/Customers/withCustomers';
|
||||||
import withAccounts from 'containers/Accounts/withAccounts';
|
import withAccounts from 'containers/Accounts/withAccounts';
|
||||||
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
|
|
||||||
function PaymentReceiveFormHeader({
|
function PaymentReceiveFormHeader({
|
||||||
@@ -47,6 +50,9 @@ function PaymentReceiveFormHeader({
|
|||||||
//#withAccouts
|
//#withAccouts
|
||||||
accountsList,
|
accountsList,
|
||||||
|
|
||||||
|
//#withSettings
|
||||||
|
baseCurrency,
|
||||||
|
|
||||||
// #withInvoices
|
// #withInvoices
|
||||||
receivableInvoices,
|
receivableInvoices,
|
||||||
// #ownProps
|
// #ownProps
|
||||||
@@ -150,15 +156,17 @@ function PaymentReceiveFormHeader({
|
|||||||
<ErrorMessage name="full_amount" {...{ errors, touched }} />
|
<ErrorMessage name="full_amount" {...{ errors, touched }} />
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<ControlGroup>
|
||||||
intent={
|
<InputPrependText text={baseCurrency} />
|
||||||
errors.full_amount && touched.full_amount && Intent.DANGER
|
<MoneyInputGroup
|
||||||
}
|
value={values.full_amount}
|
||||||
minimal={true}
|
inputGroupProps={{
|
||||||
value={values.full_amount}
|
medium: true,
|
||||||
{...getFieldProps('full_amount')}
|
onBlur: { handleFullAmountBlur },
|
||||||
onBlur={handleFullAmountBlur}
|
...getFieldProps('full_amount'),
|
||||||
/>
|
}}
|
||||||
|
/>
|
||||||
|
</ControlGroup>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
onClick={handleReceiveFullAmountClick}
|
onClick={handleReceiveFullAmountClick}
|
||||||
@@ -166,7 +174,7 @@ function PaymentReceiveFormHeader({
|
|||||||
className={'receive-full-amount'}
|
className={'receive-full-amount'}
|
||||||
>
|
>
|
||||||
Receive full amount (
|
Receive full amount (
|
||||||
<Money amount={receivableFullAmount} currency={'USD'} />)
|
<Money amount={receivableFullAmount} currency={baseCurrency} />)
|
||||||
</a>
|
</a>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
@@ -270,7 +278,7 @@ function PaymentReceiveFormHeader({
|
|||||||
<div class="big-amount">
|
<div class="big-amount">
|
||||||
<span class="big-amount__label">Amount Received</span>
|
<span class="big-amount__label">Amount Received</span>
|
||||||
<h1 class="big-amount__number">
|
<h1 class="big-amount__number">
|
||||||
<Money amount={amountReceived} currency={'USD'} />
|
<Money amount={amountReceived} currency={baseCurrency} />
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -286,5 +294,8 @@ export default compose(
|
|||||||
withAccounts(({ accountsList }) => ({
|
withAccounts(({ accountsList }) => ({
|
||||||
accountsList,
|
accountsList,
|
||||||
})),
|
})),
|
||||||
|
withSettings(({ organizationSettings }) => ({
|
||||||
|
baseCurrency: organizationSettings?.baseCurrency,
|
||||||
|
})),
|
||||||
withDialogActions,
|
withDialogActions,
|
||||||
)(PaymentReceiveFormHeader);
|
)(PaymentReceiveFormHeader);
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ const CellRenderer = (content, type) => (props) => {
|
|||||||
|
|
||||||
const TotalCellRederer = (content, type) => (props) => {
|
const TotalCellRederer = (content, type) => (props) => {
|
||||||
if (props.data.length === props.row.index + 1) {
|
if (props.data.length === props.row.index + 1) {
|
||||||
return <Money amount={props.cell.row.original[type]} currency={'USD'} />
|
return <Money amount={props.cell.row.original[type]} currency={'USD'} />;
|
||||||
}
|
}
|
||||||
return content(props);
|
return content(props);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function PaymentReceiveItemsTableEditor ({
|
export default function PaymentReceiveItemsTableEditor({
|
||||||
onClickClearAllLines,
|
onClickClearAllLines,
|
||||||
onUpdateData,
|
onUpdateData,
|
||||||
data,
|
data,
|
||||||
@@ -39,12 +39,14 @@ export default function PaymentReceiveItemsTableEditor ({
|
|||||||
noResultsMessage,
|
noResultsMessage,
|
||||||
}) {
|
}) {
|
||||||
const transformedData = useMemo(() => {
|
const transformedData = useMemo(() => {
|
||||||
const rows = [ ...data ];
|
const rows = [...data];
|
||||||
const totalRow = {
|
const totalRow = {
|
||||||
due_amount: sumBy(data, 'due_amount'),
|
due_amount: sumBy(data, 'due_amount'),
|
||||||
payment_amount: sumBy(data, 'payment_amount'),
|
payment_amount: sumBy(data, 'payment_amount'),
|
||||||
};
|
};
|
||||||
if (rows.length > 0) { rows.push(totalRow) }
|
if (rows.length > 0) {
|
||||||
|
rows.push(totalRow);
|
||||||
|
}
|
||||||
return rows;
|
return rows;
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
@@ -81,7 +83,7 @@ export default function PaymentReceiveItemsTableEditor ({
|
|||||||
Header: formatMessage({ id: 'invocie_number' }),
|
Header: formatMessage({ id: 'invocie_number' }),
|
||||||
accessor: (row) => {
|
accessor: (row) => {
|
||||||
const invNumber = row?.invoice_no || row?.id;
|
const invNumber = row?.invoice_no || row?.id;
|
||||||
return `#INV-${invNumber}`;
|
return `#INV-${invNumber || ''}`;
|
||||||
},
|
},
|
||||||
Cell: CellRenderer(EmptyDiv, 'invoice_no'),
|
Cell: CellRenderer(EmptyDiv, 'invoice_no'),
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
@@ -121,7 +123,7 @@ export default function PaymentReceiveItemsTableEditor ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const rowClassNames = useCallback(
|
const rowClassNames = useCallback(
|
||||||
(row) => ({ 'row--total': localData.length === row.index + 1 }),
|
(row) => ({ 'row--total': localData.length === row.index + 1 }),
|
||||||
[localData],
|
[localData],
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -144,10 +146,12 @@ export default function PaymentReceiveItemsTableEditor ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(
|
<div
|
||||||
CLASSES.DATATABLE_EDITOR,
|
className={classNames(
|
||||||
CLASSES.DATATABLE_EDITOR_ITEMS_ENTRIES,
|
CLASSES.DATATABLE_EDITOR,
|
||||||
)}>
|
CLASSES.DATATABLE_EDITOR_ITEMS_ENTRIES,
|
||||||
|
)}
|
||||||
|
>
|
||||||
<DataTable
|
<DataTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={localData}
|
data={localData}
|
||||||
@@ -170,5 +174,4 @@ export default function PaymentReceiveItemsTableEditor ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -43,10 +43,10 @@ const MIN_LINES_NUMBER = 4;
|
|||||||
|
|
||||||
const defaultReceipt = {
|
const defaultReceipt = {
|
||||||
index: 0,
|
index: 0,
|
||||||
item_id: null,
|
item_id: '',
|
||||||
rate: null,
|
rate: '',
|
||||||
discount: 0,
|
discount: 0,
|
||||||
quantity: null,
|
quantity: '',
|
||||||
description: '',
|
description: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ function ReceiptsDataTable({
|
|||||||
{
|
{
|
||||||
id: 'receipt_number',
|
id: 'receipt_number',
|
||||||
Header: formatMessage({ id: 'receipt_number' }),
|
Header: formatMessage({ id: 'receipt_number' }),
|
||||||
accessor: (row) => `#${row.receipt_number}`,
|
accessor: (row) => (row.receipt_number ? `#${row.receipt_number}` : null),
|
||||||
width: 140,
|
width: 140,
|
||||||
className: 'receipt_number',
|
className: 'receipt_number',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { FormGroup, Position, Classes } from '@blueprintjs/core';
|
import { FormGroup, ControlGroup, Position, Classes } from '@blueprintjs/core';
|
||||||
import { DateInput } from '@blueprintjs/datetime';
|
import { DateInput } from '@blueprintjs/datetime';
|
||||||
import { FastField, ErrorMessage } from 'formik';
|
import { FastField, ErrorMessage } from 'formik';
|
||||||
import { MoneyInputGroup, CurrencySelectList, Row, Col } from 'components';
|
import {
|
||||||
|
MoneyInputGroup,
|
||||||
|
InputPrependText,
|
||||||
|
CurrencySelectList,
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
} from 'components';
|
||||||
import { FormattedMessage as T } from 'react-intl';
|
import { FormattedMessage as T } from 'react-intl';
|
||||||
|
|
||||||
import withCurrencies from 'containers/Currencies/withCurrencies';
|
import withCurrencies from 'containers/Currencies/withCurrencies';
|
||||||
@@ -50,7 +56,12 @@ function VendorFinanicalPanelTab({
|
|||||||
</FastField>
|
</FastField>
|
||||||
{/*------------ Opening balance -----------*/}
|
{/*------------ Opening balance -----------*/}
|
||||||
<FastField name={'opening_balance'}>
|
<FastField name={'opening_balance'}>
|
||||||
{({ field, field: { value }, meta: { error, touched } }) => (
|
{({
|
||||||
|
form: { values },
|
||||||
|
field,
|
||||||
|
field: { value },
|
||||||
|
meta: { error, touched },
|
||||||
|
}) => (
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={<T id={'opening_balance'} />}
|
label={<T id={'opening_balance'} />}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
@@ -60,16 +71,19 @@ function VendorFinanicalPanelTab({
|
|||||||
intent={inputIntent({ error, touched })}
|
intent={inputIntent({ error, touched })}
|
||||||
inline={true}
|
inline={true}
|
||||||
>
|
>
|
||||||
<MoneyInputGroup
|
<ControlGroup>
|
||||||
value={value}
|
<InputPrependText text={values.currency_code } />
|
||||||
onChange={field.onChange}
|
<MoneyInputGroup
|
||||||
prefix={'$'}
|
value={value}
|
||||||
inputGroupProps={{
|
onChange={field.onChange}
|
||||||
fill: true,
|
prefix={'$'}
|
||||||
...field,
|
inputGroupProps={{
|
||||||
}}
|
fill: true,
|
||||||
disabled={vendorId}
|
...field,
|
||||||
/>
|
}}
|
||||||
|
disabled={vendorId}
|
||||||
|
/>
|
||||||
|
</ControlGroup>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
</FastField>
|
</FastField>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import VendorFloatingActions from './VendorFloatingActions';
|
|||||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||||
import withVendorDetail from './withVendorDetail';
|
import withVendorDetail from './withVendorDetail';
|
||||||
import withVendorActions from './withVendorActions';
|
import withVendorActions from './withVendorActions';
|
||||||
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
|
|
||||||
import { compose, transformToForm } from 'utils';
|
import { compose, transformToForm } from 'utils';
|
||||||
|
|
||||||
@@ -73,6 +74,9 @@ function VendorForm({
|
|||||||
requestSubmitVendor,
|
requestSubmitVendor,
|
||||||
requestEditVendor,
|
requestEditVendor,
|
||||||
|
|
||||||
|
// #withSettings
|
||||||
|
baseCurrency,
|
||||||
|
|
||||||
// #OwnProps
|
// #OwnProps
|
||||||
vendorId,
|
vendorId,
|
||||||
}) {
|
}) {
|
||||||
@@ -88,6 +92,7 @@ function VendorForm({
|
|||||||
const initialValues = useMemo(
|
const initialValues = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
...defaultInitialValues,
|
...defaultInitialValues,
|
||||||
|
currency_code: baseCurrency,
|
||||||
...transformToForm(vendor, defaultInitialValues),
|
...transformToForm(vendor, defaultInitialValues),
|
||||||
}),
|
}),
|
||||||
[defaultInitialValues],
|
[defaultInitialValues],
|
||||||
@@ -181,5 +186,8 @@ function VendorForm({
|
|||||||
export default compose(
|
export default compose(
|
||||||
withVendorDetail(),
|
withVendorDetail(),
|
||||||
withDashboardActions,
|
withDashboardActions,
|
||||||
|
withSettings(({ organizationSettings }) => ({
|
||||||
|
baseCurrency: organizationSettings?.baseCurrency,
|
||||||
|
})),
|
||||||
withVendorActions,
|
withVendorActions,
|
||||||
)(VendorForm);
|
)(VendorForm);
|
||||||
|
|||||||
@@ -203,8 +203,8 @@ export default {
|
|||||||
'The journal #{number} has been successfully edited.',
|
'The journal #{number} has been successfully edited.',
|
||||||
the_journal_has_been_successfully_deleted:
|
the_journal_has_been_successfully_deleted:
|
||||||
'The journal has been successfully deleted',
|
'The journal has been successfully deleted',
|
||||||
the_manual_journal_id_has_been_published:
|
the_manual_journal_has_been_published:
|
||||||
'The manual journal id has been published',
|
'The manual journal has been published',
|
||||||
the_journals_has_been_successfully_deleted:
|
the_journals_has_been_successfully_deleted:
|
||||||
'The journals has been successfully deleted ',
|
'The journals has been successfully deleted ',
|
||||||
credit: 'Credit',
|
credit: 'Credit',
|
||||||
@@ -842,4 +842,6 @@ export default {
|
|||||||
vendor_has_bills: 'Vendor has bills',
|
vendor_has_bills: 'Vendor has bills',
|
||||||
the_item_has_been_edited_successfully: 'The item has been edited successfully.',
|
the_item_has_been_edited_successfully: 'The item has been edited successfully.',
|
||||||
you_cannot_make_payment_with_zero_total_amount: 'You cannot record payment transaction with zero total amount',
|
you_cannot_make_payment_with_zero_total_amount: 'You cannot record payment transaction with zero total amount',
|
||||||
|
are_sure_to_publish_this_manual_journal:
|
||||||
|
'Are you sure you want to publish this manual journal?',
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user