mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
feat (invoice detail): deatil exhange rate item.
This commit is contained in:
33
src/components/DetailExchangeRate.js
Normal file
33
src/components/DetailExchangeRate.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { DetailItem } from 'components';
|
||||||
|
import intl from 'react-intl-universal';
|
||||||
|
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import { createSelector } from 'reselect';
|
||||||
|
import { isEqual } from 'lodash';
|
||||||
|
|
||||||
|
const organizationBaseCurrecy = createSelector(
|
||||||
|
(state) => {
|
||||||
|
const tenantId = state.authentication.tenantId;
|
||||||
|
return state.organizations.data[tenantId];
|
||||||
|
},
|
||||||
|
(organization) => organization?.base_currency,
|
||||||
|
);
|
||||||
|
|
||||||
|
export function ExchangeRateDetailItem({
|
||||||
|
// #ownProps
|
||||||
|
exchangeRate,
|
||||||
|
toCurrency,
|
||||||
|
}) {
|
||||||
|
const fromCurrency = useSelector(organizationBaseCurrecy);
|
||||||
|
|
||||||
|
if (isEqual(fromCurrency, toCurrency)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DetailItem label={intl.get('invoice.details.exchange_rate')}>
|
||||||
|
1 {fromCurrency} = {exchangeRate} {toCurrency}
|
||||||
|
</DetailItem>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -55,6 +55,7 @@ import AvaterCell from './AvaterCell';
|
|||||||
import { ItemsMultiSelect } from './Items';
|
import { ItemsMultiSelect } from './Items';
|
||||||
import MoreMenuItems from './MoreMenutItems';
|
import MoreMenuItems from './MoreMenutItems';
|
||||||
import CustomSelectList from './CustomSelectList';
|
import CustomSelectList from './CustomSelectList';
|
||||||
|
import { ExchangeRateDetailItem } from './DetailExchangeRate';
|
||||||
|
|
||||||
export * from './Dialog';
|
export * from './Dialog';
|
||||||
export * from './Menu';
|
export * from './Menu';
|
||||||
@@ -169,4 +170,5 @@ export {
|
|||||||
AvaterCell,
|
AvaterCell,
|
||||||
MoreMenuItems,
|
MoreMenuItems,
|
||||||
CustomSelectList,
|
CustomSelectList,
|
||||||
|
ExchangeRateDetailItem,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import {
|
|||||||
CommercialDocHeader,
|
CommercialDocHeader,
|
||||||
CommercialDocTopHeader,
|
CommercialDocTopHeader,
|
||||||
CustomerDrawerLink,
|
CustomerDrawerLink,
|
||||||
|
// DetailExchangeRate,
|
||||||
|
ExchangeRateDetailItem,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
||||||
import { InvoiceDetailsStatus } from './utils';
|
import { InvoiceDetailsStatus } from './utils';
|
||||||
@@ -59,6 +61,10 @@ export default function InvoiceDetailHeader() {
|
|||||||
<DetailItem label={intl.get('invoice.details.invoice_no')}>
|
<DetailItem label={intl.get('invoice.details.invoice_no')}>
|
||||||
{invoice.invoice_no}
|
{invoice.invoice_no}
|
||||||
</DetailItem>
|
</DetailItem>
|
||||||
|
<ExchangeRateDetailItem
|
||||||
|
exchangeRate={invoice?.exchange_rate}
|
||||||
|
toCurrency={invoice?.currency_code}
|
||||||
|
/>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
|
|||||||
@@ -1222,6 +1222,7 @@
|
|||||||
"invoice.details.payment_amount": "Payment amount",
|
"invoice.details.payment_amount": "Payment amount",
|
||||||
"invoice.details.invoice_message": "Invoice Message",
|
"invoice.details.invoice_message": "Invoice Message",
|
||||||
"invoice.details.invoice_no": "Invoice #",
|
"invoice.details.invoice_no": "Invoice #",
|
||||||
|
"invoice.details.exchange_rate": "Exchange rate",
|
||||||
"bill.drawer.title": "Bill details {number}",
|
"bill.drawer.title": "Bill details {number}",
|
||||||
"bill.details.reference": "Reference #",
|
"bill.details.reference": "Reference #",
|
||||||
"bill.details.bill_number": "Bill #",
|
"bill.details.bill_number": "Bill #",
|
||||||
|
|||||||
Reference in New Issue
Block a user