diff --git a/client/src/containers/Expenses/ExpenseForm.js b/client/src/containers/Expenses/ExpenseForm.js index 5191b8530..f319d0386 100644 --- a/client/src/containers/Expenses/ExpenseForm.js +++ b/client/src/containers/Expenses/ExpenseForm.js @@ -22,6 +22,7 @@ import withExpenseDetail from 'containers/Expenses/withExpenseDetail'; import withAccountsActions from 'containers/Accounts/withAccountsActions'; import withDashboardActions from 'containers/Dashboard/withDashboardActions'; import withMediaActions from 'containers/Media/withMediaActions'; +import withSettings from 'containers/Settings/withSettings'; import AppToaster from 'components/AppToaster'; import Dragzone from 'components/Dragzone'; @@ -53,12 +54,14 @@ function ExpenseForm({ //#withExpenseDetail expense, + // #withSettings + baseCurrency, + // #own Props expenseId, onFormSubmit, onCancelForm, }) { - const isNewMode = !expenseId; const [payload, setPayload] = useState({}); @@ -150,7 +153,7 @@ function ExpenseForm({ payment_date: moment(new Date()).format('YYYY-MM-DD'), description: '', reference_no: '', - currency_code: '', + currency_code: baseCurrency, categories: [...repeatValue(defaultCategory, MIN_LINES_NUMBER)], }), [defaultCategory], @@ -407,4 +410,7 @@ export default compose( withDashboardActions, withMediaActions, withExpenseDetail(), + withSettings(({ organizationSettings }) => ({ + baseCurrency: organizationSettings?.baseCurrency, + })), )(ExpenseForm); diff --git a/client/src/containers/Expenses/ExpenseFormHeader.js b/client/src/containers/Expenses/ExpenseFormHeader.js index 08443e305..0b921d92d 100644 --- a/client/src/containers/Expenses/ExpenseFormHeader.js +++ b/client/src/containers/Expenses/ExpenseFormHeader.js @@ -26,14 +26,21 @@ import withAccounts from 'containers/Accounts/withAccounts'; import withCustomers from 'containers/Customers/withCustomers'; function ExpenseFormHeader({ + // #ownProps errors, touched, setFieldValue, getFieldProps, values, + + //withCurrencies currenciesList, + + // #withAccounts accountsList, accountsTypes, + + // #withCustomers customers, }) { const [selectedItems, setSelectedItems] = useState({}); @@ -175,6 +182,7 @@ function ExpenseFormHeader({ currenciesList={currenciesList} selectedCurrencyCode={values.currency_code} onCurrencySelected={onItemsSelect('currency_code')} + defaultSelectText={values.currency_code} />