Fix : Add prepend and money field group to payment amount field.

This commit is contained in:
elforjani3
2020-11-22 12:28:22 +02:00
parent 29d5f7d74b
commit bdb524a248

View File

@@ -21,12 +21,15 @@ import {
FieldRequiredHint, FieldRequiredHint,
Icon, Icon,
InputPrependButton, InputPrependButton,
MoneyInputGroup,
InputPrependText,
Hint, Hint,
Money, Money,
} from 'components'; } from 'components';
import withCustomers from 'containers/Customers/withCustomers'; import withCustomers from 'containers/Customers/withCustomers';
import withAccounts from 'containers/Accounts/withAccounts'; import withAccounts from 'containers/Accounts/withAccounts';
import withSettings from 'containers/Settings/withSettings';
import withDialogActions from 'containers/Dialog/withDialogActions'; import withDialogActions from 'containers/Dialog/withDialogActions';
function PaymentReceiveFormHeader({ function PaymentReceiveFormHeader({
@@ -47,6 +50,9 @@ function PaymentReceiveFormHeader({
//#withAccouts //#withAccouts
accountsList, accountsList,
//#withSettings
baseCurrency,
// #withInvoices // #withInvoices
receivableInvoices, receivableInvoices,
// #ownProps // #ownProps
@@ -149,15 +155,17 @@ function PaymentReceiveFormHeader({
<ErrorMessage name="full_amount" {...{ errors, touched }} /> <ErrorMessage name="full_amount" {...{ errors, touched }} />
} }
> >
<InputGroup <ControlGroup>
intent={ <InputPrependText text={baseCurrency} />
errors.full_amount && touched.full_amount && Intent.DANGER <MoneyInputGroup
} value={values.full_amount}
minimal={true} inputGroupProps={{
value={values.full_amount} medium: true,
{...getFieldProps('full_amount')} onBlur: { handleFullAmountBlur },
onBlur={handleFullAmountBlur} ...getFieldProps('full_amount'),
/> }}
/>
</ControlGroup>
<a <a
onClick={handleReceiveFullAmountClick} onClick={handleReceiveFullAmountClick}
@@ -165,7 +173,7 @@ function PaymentReceiveFormHeader({
className={'receive-full-amount'} className={'receive-full-amount'}
> >
Receive full amount ( Receive full amount (
<Money amount={receivableFullAmount} currency={'USD'} />) <Money amount={receivableFullAmount} currency={baseCurrency} />)
</a> </a>
</FormGroup> </FormGroup>
@@ -269,7 +277,7 @@ function PaymentReceiveFormHeader({
<div class="big-amount"> <div class="big-amount">
<span class="big-amount__label">Amount Received</span> <span class="big-amount__label">Amount Received</span>
<h1 class="big-amount__number"> <h1 class="big-amount__number">
<Money amount={amountReceived} currency={'USD'} /> <Money amount={amountReceived} currency={baseCurrency} />
</h1> </h1>
</div> </div>
</div> </div>
@@ -285,5 +293,8 @@ export default compose(
withAccounts(({ accountsList }) => ({ withAccounts(({ accountsList }) => ({
accountsList, accountsList,
})), })),
withSettings(({ organizationSettings }) => ({
baseCurrency: organizationSettings?.baseCurrency,
})),
withDialogActions, withDialogActions,
)(PaymentReceiveFormHeader); )(PaymentReceiveFormHeader);