mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
fix: add baseCurrency in sale & purchases data table.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -23,6 +23,7 @@ import EstimatesEmptyStatus from './EstimatesEmptyStatus';
|
||||
import { statusAccessor } from './components';
|
||||
import withEstimates from './withEstimates';
|
||||
import withEstimateActions from './withEstimateActions';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
|
||||
// Estimates transactions datatable.
|
||||
function EstimatesDataTable({
|
||||
@@ -36,6 +37,9 @@ function EstimatesDataTable({
|
||||
// #withEstimatesActions
|
||||
addEstimatesTableQueries,
|
||||
|
||||
// #withSettings
|
||||
baseCurrency,
|
||||
|
||||
// #ownProps
|
||||
onEditEstimate,
|
||||
onDeleteEstimate,
|
||||
@@ -160,7 +164,7 @@ function EstimatesDataTable({
|
||||
{
|
||||
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',
|
||||
@@ -282,4 +286,7 @@ export default compose(
|
||||
estimatesCurrentViewId,
|
||||
}),
|
||||
),
|
||||
withSettings(({ organizationSettings }) => ({
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
})),
|
||||
)(EstimatesDataTable);
|
||||
|
||||
@@ -35,6 +35,7 @@ import withViewDetails from 'containers/Views/withViewDetails';
|
||||
import withInvoices from './withInvoices';
|
||||
import withInvoiceActions from './withInvoiceActions';
|
||||
import withCurrentView from 'containers/Views/withCurrentView';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
|
||||
// Invoices datatable.
|
||||
function InvoicesDataTable({
|
||||
@@ -47,6 +48,9 @@ function InvoicesDataTable({
|
||||
// #withInvoicesActions
|
||||
addInvoiceTableQueries,
|
||||
|
||||
// #withSettings
|
||||
baseCurrency,
|
||||
|
||||
// #OwnProps
|
||||
onEditInvoice,
|
||||
onDeleteInvoice,
|
||||
@@ -141,7 +145,7 @@ function InvoicesDataTable({
|
||||
{
|
||||
id: 'balance',
|
||||
Header: formatMessage({ id: 'balance' }),
|
||||
accessor: (r) => <Money amount={r.balance} currency={'USD'} />,
|
||||
accessor: (r) => <Money amount={r.balance} currency={baseCurrency} />,
|
||||
width: 140,
|
||||
className: 'balance',
|
||||
},
|
||||
@@ -263,5 +267,8 @@ export default compose(
|
||||
invoicesCurrentViewId,
|
||||
}),
|
||||
),
|
||||
withSettings(({ organizationSettings }) => ({
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
})),
|
||||
withViewDetails(),
|
||||
)(InvoicesDataTable);
|
||||
|
||||
@@ -28,6 +28,7 @@ import withViewDetails from 'containers/Views/withViewDetails';
|
||||
import withPaymentReceives from './withPaymentReceives';
|
||||
import withPaymentReceivesActions from './withPaymentReceivesActions';
|
||||
import withCurrentView from 'containers/Views/withCurrentView';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
|
||||
function PaymentReceivesDataTable({
|
||||
// #withPaymentReceives
|
||||
@@ -40,6 +41,9 @@ function PaymentReceivesDataTable({
|
||||
// #withPaymentReceivesActions
|
||||
addPaymentReceivesTableQueries,
|
||||
|
||||
// #withSettings
|
||||
baseCurrency,
|
||||
|
||||
// #OwnProps
|
||||
onEditPaymentReceive,
|
||||
onDeletePaymentReceive,
|
||||
@@ -146,7 +150,7 @@ function PaymentReceivesDataTable({
|
||||
{
|
||||
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',
|
||||
},
|
||||
@@ -186,40 +190,40 @@ function PaymentReceivesDataTable({
|
||||
const showEmptyStatus = [
|
||||
paymentReceivesCurrentViewId === -1,
|
||||
PaymentReceivesCurrentPage.length === 0,
|
||||
].every(condition => condition === true);
|
||||
].every((condition) => condition === true);
|
||||
|
||||
return (
|
||||
<div className={classNames(CLASSES.DASHBOARD_DATATABLE)}>
|
||||
<LoadingIndicator
|
||||
loading={paymentReceivesLoading && !isLoaded}
|
||||
mount={false}
|
||||
>
|
||||
<Choose>
|
||||
<Choose.When condition={showEmptyStatus}>
|
||||
<PaymentReceivesEmptyStatus />
|
||||
</Choose.When>
|
||||
<LoadingIndicator
|
||||
loading={paymentReceivesLoading && !isLoaded}
|
||||
mount={false}
|
||||
>
|
||||
<Choose>
|
||||
<Choose.When condition={showEmptyStatus}>
|
||||
<PaymentReceivesEmptyStatus />
|
||||
</Choose.When>
|
||||
|
||||
<Choose.Otherwise>
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={PaymentReceivesCurrentPage}
|
||||
onFetchData={handleDataTableFetchData}
|
||||
manualSortBy={true}
|
||||
selectionColumn={true}
|
||||
noInitialFetch={true}
|
||||
sticky={true}
|
||||
onSelectedRowsChange={handleSelectedRowsChange}
|
||||
rowContextMenu={onRowContextMenu}
|
||||
pagination={true}
|
||||
autoResetSortBy={false}
|
||||
autoResetPage={false}
|
||||
pagesCount={paymentReceivesPageination.pagesCount}
|
||||
initialPageSize={paymentReceivesTableQuery.page_size}
|
||||
initialPageIndex={paymentReceivesTableQuery.page - 1}
|
||||
/>
|
||||
</Choose.Otherwise>
|
||||
</Choose>
|
||||
</LoadingIndicator>
|
||||
<Choose.Otherwise>
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={PaymentReceivesCurrentPage}
|
||||
onFetchData={handleDataTableFetchData}
|
||||
manualSortBy={true}
|
||||
selectionColumn={true}
|
||||
noInitialFetch={true}
|
||||
sticky={true}
|
||||
onSelectedRowsChange={handleSelectedRowsChange}
|
||||
rowContextMenu={onRowContextMenu}
|
||||
pagination={true}
|
||||
autoResetSortBy={false}
|
||||
autoResetPage={false}
|
||||
pagesCount={paymentReceivesPageination.pagesCount}
|
||||
initialPageSize={paymentReceivesTableQuery.page_size}
|
||||
initialPageIndex={paymentReceivesTableQuery.page - 1}
|
||||
/>
|
||||
</Choose.Otherwise>
|
||||
</Choose>
|
||||
</LoadingIndicator>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -245,5 +249,8 @@ export default compose(
|
||||
paymentReceivesCurrentViewId,
|
||||
}),
|
||||
),
|
||||
withSettings(({ organizationSettings }) => ({
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
})),
|
||||
withViewDetails(),
|
||||
)(PaymentReceivesDataTable);
|
||||
|
||||
@@ -34,6 +34,7 @@ import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
|
||||
import withReceipts from './withReceipts';
|
||||
import withReceiptActions from './withReceiptActions';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
|
||||
function ReceiptsDataTable({
|
||||
// #withReceipts
|
||||
@@ -46,6 +47,9 @@ function ReceiptsDataTable({
|
||||
// #withReceiptsActions
|
||||
addReceiptsTableQueries,
|
||||
|
||||
// #withSettings
|
||||
baseCurrency,
|
||||
|
||||
// #ownProps
|
||||
loading,
|
||||
onEditReceipt,
|
||||
@@ -138,17 +142,10 @@ function ReceiptsDataTable({
|
||||
width: 140,
|
||||
className: 'deposit_account',
|
||||
},
|
||||
// {
|
||||
// id: 'send_to_email',
|
||||
// Header: formatMessage({ id: 'email' }),
|
||||
// accessor: 'send_to_email',
|
||||
// width: 140,
|
||||
// className: 'send_to_email',
|
||||
// },
|
||||
{
|
||||
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',
|
||||
@@ -287,4 +284,7 @@ export default compose(
|
||||
receiptsCurrentViewId,
|
||||
}),
|
||||
),
|
||||
withSettings(({ organizationSettings }) => ({
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
})),
|
||||
)(ReceiptsDataTable);
|
||||
|
||||
Reference in New Issue
Block a user