mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
fix(webapp): No currency in amount field on money in/out dialogs
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import { useFormikContext } from 'formik';
|
||||
import { useForeignAccount } from './utils';
|
||||
import { ExchangeRateMutedField } from '@/components';
|
||||
import { useMoneyOutFieldsContext } from './MoneyOutFieldsProvider';
|
||||
|
||||
/**
|
||||
* Money-out exchange rate field.
|
||||
* @returns {JSX.Element}
|
||||
*/
|
||||
export function MoneyOutExchangeRateField() {
|
||||
const { values } = useFormikContext();
|
||||
|
||||
const { account } = useMoneyOutFieldsContext();
|
||||
const isForeigAccount = useForeignAccount();
|
||||
|
||||
// Cannot continue if the account is not foreign account.
|
||||
if (!isForeigAccount) return null;
|
||||
|
||||
return (
|
||||
<ExchangeRateMutedField
|
||||
name={'exchange_rate'}
|
||||
fromCurrency={values?.currency_code}
|
||||
toCurrency={account?.currency_code}
|
||||
formGroupProps={{ label: '', inline: false }}
|
||||
date={values.date}
|
||||
exchangeRate={values.exchange_rate}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user