fix: add baseCurrency in sale & purchases data table.

This commit is contained in:
elforjani3
2021-01-08 23:59:14 +02:00
parent 0b70c7ba9f
commit e9222b87fd
7 changed files with 88 additions and 47 deletions

View File

@@ -7,11 +7,18 @@ import { CLASSES } from 'common/classes';
import BillFormHeaderFields from './BillFormHeaderFields';
import { PageFormBigNumber } from 'components';
import withSettings from 'containers/Settings/withSettings';
import { compose } from 'redux';
/**
* Fill form header.
*/
export default function BillFormHeader({ onBillNumberChanged }) {
function BillFormHeader({
onBillNumberChanged,
// #withSettings
baseCurrency,
}) {
const { values } = useFormikContext();
// Calculate the total due amount of bill entries.
@@ -25,8 +32,13 @@ export default function BillFormHeader({ onBillNumberChanged }) {
<PageFormBigNumber
label={'Due Amount'}
amount={totalDueAmount}
currencyCode={'LYD'}
currencyCode={baseCurrency}
/>
</div>
);
}
export default compose(
withSettings(({ organizationSettings }) => ({
baseCurrency: organizationSettings?.baseCurrency,
})),
)(BillFormHeader);

View File

@@ -23,6 +23,7 @@ import PaymentMadesEmptyStatus from './PaymentMadesEmptyStatus';
import withPaymentMade from './withPaymentMade';
import withPaymentMadeActions from './withPaymentMadeActions';
import withCurrentView from 'containers/Views/withCurrentView';
import withSettings from 'containers/Settings/withSettings';
/**
* Payment made datatable transactions.
@@ -38,6 +39,9 @@ function PaymentMadeDataTable({
// #withPaymentMadeActions
addPaymentMadesTableQueries,
// #withSettings
baseCurrency,
// #ownProps
onEditPaymentMade,
onDeletePaymentMade,
@@ -110,7 +114,8 @@ function PaymentMadeDataTable({
{
id: 'payment_number',
Header: formatMessage({ id: 'payment_number' }),
accessor: (row) => (row.payment_number ? `#${row.payment_number}` : null),
accessor: (row) =>
row.payment_number ? `#${row.payment_number}` : null,
width: 140,
className: 'payment_number',
},
@@ -124,7 +129,7 @@ function PaymentMadeDataTable({
{
id: 'amount',
Header: formatMessage({ id: 'amount' }),
accessor: (r) => <Money amount={r.amount} currency={'USD'} />,
accessor: (r) => <Money amount={r.amount} currency={baseCurrency} />,
width: 140,
className: 'amount',
},
@@ -238,4 +243,7 @@ export default compose(
paymentMadesCurrentViewId,
}),
),
withSettings(({ organizationSettings }) => ({
baseCurrency: organizationSettings?.baseCurrency,
})),
)(PaymentMadeDataTable);

View File

@@ -170,7 +170,7 @@ function PaymentMadeFormHeader({
className={'receive-full-amount'}
>
Receive full amount (
<Money amount={payableFullAmount} currency={'USD'} />)
<Money amount={payableFullAmount} currency={baseCurrency} />)
</a>
</FormGroup>
@@ -250,7 +250,7 @@ function PaymentMadeFormHeader({
<div class="big-amount">
<span class="big-amount__label">Amount Received</span>
<h1 class="big-amount__number">
<Money amount={amountPaid} currency={'USD'} />
<Money amount={amountPaid} currency={baseCurrency} />
</h1>
</div>
</div>