feat(cashflow): exchange rate muted.

This commit is contained in:
elforjani13
2022-03-07 16:38:14 +02:00
parent 51c7a0fcd8
commit d12e35f649
11 changed files with 136 additions and 89 deletions

View File

@@ -18,6 +18,7 @@ import {
Icon,
Col,
Row,
If,
InputPrependButton,
FeatureCan,
BranchSelect,
@@ -41,6 +42,7 @@ import { useMoneyOutDialogContext } from '../MoneyOutDialogProvider';
import {
useObserveTransactionNoSettings,
useSetPrimaryBranchToForm,
useForeignAccount,
BranchRowDivider,
} from '../utils';
import withSettings from 'containers/Settings/withSettings';
@@ -61,6 +63,7 @@ function OtherExpnseFormFields({
// Money in dialog context.
const { accounts, account, branches } = useMoneyOutDialogContext();
const isForeigAccount = useForeignAccount();
const { values } = useFormikContext();
const amountFieldRef = useAutofocus();
@@ -197,7 +200,7 @@ function OtherExpnseFormFields({
className={'form-group--amount'}
>
<ControlGroup>
<InputPrependText text={values.currency_code} />
<InputPrependText text={account.currency_code} />
<MoneyInputGroup
value={value}
@@ -212,16 +215,17 @@ function OtherExpnseFormFields({
</FormGroup>
)}
</FastField>
{/*------------ exchange rate -----------*/}
<ExchangeRateMutedField
name={'exchange_rate'}
fromCurrency={values?.currency_code}
toCurrency={account?.currency_code}
formGroupProps={{ label: '', inline: false }}
exchangeRate={values.exchange_rate}
/>
<If condition={isForeigAccount}>
{/*------------ exchange rate -----------*/}
<ExchangeRateMutedField
name={'exchange_rate'}
fromCurrency={values.currency_code}
toCurrency={account.currency_code}
formGroupProps={{ label: '', inline: false }}
date={values.date}
exchangeRate={values.exchange_rate}
/>
</If>
<Row>
<Col xs={5}>
{/*------------ other expense account -----------*/}