mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
BC-4: feat: base currency withCurrentOrganization
This commit is contained in:
@@ -23,6 +23,7 @@ import ReceiptFormDialogs from './ReceiptFormDialogs';
|
||||
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
|
||||
|
||||
import { AppToaster } from 'components';
|
||||
import { compose, orderingLinesIndexes, transactionNumber } from 'utils';
|
||||
@@ -37,7 +38,9 @@ function ReceiptForm({
|
||||
receiptNumberPrefix,
|
||||
receiptAutoIncrement,
|
||||
preferredDepositAccount,
|
||||
baseCurrency,
|
||||
|
||||
// #withCurrentOrganization
|
||||
organization: { base_currency },
|
||||
}) {
|
||||
const history = useHistory();
|
||||
|
||||
@@ -59,7 +62,7 @@ function ReceiptForm({
|
||||
const initialValues = useMemo(
|
||||
() => ({
|
||||
...(!isEmpty(receipt)
|
||||
? { ...transformToEditForm(receipt), currency_code: baseCurrency }
|
||||
? { ...transformToEditForm(receipt), currency_code: base_currency }
|
||||
: {
|
||||
...defaultReceipt,
|
||||
...(receiptAutoIncrement && {
|
||||
@@ -67,7 +70,7 @@ function ReceiptForm({
|
||||
}),
|
||||
deposit_account_id: parseInt(preferredDepositAccount),
|
||||
entries: orderingLinesIndexes(defaultReceipt.entries),
|
||||
currency_code: baseCurrency,
|
||||
currency_code: base_currency,
|
||||
}),
|
||||
}),
|
||||
[receipt, preferredDepositAccount, nextReceiptNumber, receiptAutoIncrement],
|
||||
@@ -104,7 +107,7 @@ function ReceiptForm({
|
||||
...omit(values, ['receipt_number_manually', 'receipt_number']),
|
||||
...(values.receipt_number_manually && {
|
||||
receipt_number: values.receipt_number,
|
||||
currency_code: baseCurrency,
|
||||
currency_code: base_currency,
|
||||
}),
|
||||
closed: submitPayload.status,
|
||||
entries: entries.map((entry) => ({ ...omit(entry, ['total']) })),
|
||||
@@ -178,11 +181,11 @@ function ReceiptForm({
|
||||
|
||||
export default compose(
|
||||
withDashboardActions,
|
||||
withSettings(({ receiptSettings, organizationSettings }) => ({
|
||||
withSettings(({ receiptSettings }) => ({
|
||||
receiptNextNumber: receiptSettings?.nextNumber,
|
||||
receiptNumberPrefix: receiptSettings?.numberPrefix,
|
||||
receiptAutoIncrement: receiptSettings?.autoIncrement,
|
||||
preferredDepositAccount: receiptSettings?.preferredDepositAccount,
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
})),
|
||||
withCurrentOrganization(),
|
||||
)(ReceiptForm);
|
||||
|
||||
@@ -7,7 +7,7 @@ import { CLASSES } from 'common/classes';
|
||||
import { PageFormBigNumber } from 'components';
|
||||
import ReceiptFormHeaderFields from './ReceiptFormHeaderFields';
|
||||
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
|
||||
|
||||
import { getEntriesTotal } from 'containers/Entries/utils';
|
||||
import { compose } from 'redux';
|
||||
@@ -18,8 +18,8 @@ import { compose } from 'redux';
|
||||
function ReceiptFormHeader({
|
||||
// #ownProps
|
||||
onReceiptNumberChanged,
|
||||
// #withSettings
|
||||
baseCurrency,
|
||||
// #withCurrentOrganization
|
||||
organization: { base_currency },
|
||||
}) {
|
||||
const { values } = useFormikContext();
|
||||
|
||||
@@ -37,14 +37,10 @@ function ReceiptFormHeader({
|
||||
<PageFormBigNumber
|
||||
label={intl.get('due_amount')}
|
||||
amount={totalDueAmount}
|
||||
currencyCode={baseCurrency}
|
||||
currencyCode={base_currency}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withSettings(({ organizationSettings }) => ({
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
})),
|
||||
)(ReceiptFormHeader);
|
||||
export default compose(withCurrentOrganization())(ReceiptFormHeader);
|
||||
|
||||
@@ -13,7 +13,6 @@ import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import withReceipts from './withReceipts';
|
||||
import withReceiptsActions from './withReceiptsActions';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
|
||||
import { useReceiptsListContext } from './ReceiptsListProvider';
|
||||
import { useReceiptsTableColumns, ActionsMenu } from './components';
|
||||
@@ -28,9 +27,6 @@ function ReceiptsDataTable({
|
||||
// #withReceipts
|
||||
receiptTableState,
|
||||
|
||||
// #withSettings
|
||||
baseCurrency,
|
||||
|
||||
// #withAlertsActions
|
||||
openAlert,
|
||||
|
||||
@@ -128,7 +124,6 @@ function ReceiptsDataTable({
|
||||
onDrawer: handleDrawerReceipt,
|
||||
onViewDetails: handleViewDetailReceipt,
|
||||
onPrint: handlePrintInvoice,
|
||||
baseCurrency,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
@@ -142,7 +137,4 @@ export default compose(
|
||||
withReceipts(({ receiptTableState }) => ({
|
||||
receiptTableState,
|
||||
})),
|
||||
withSettings(({ organizationSettings }) => ({
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
})),
|
||||
)(ReceiptsDataTable);
|
||||
|
||||
Reference in New Issue
Block a user