diff --git a/centrifuge-app/src/pages/Loan/FinanceForm.tsx b/centrifuge-app/src/pages/Loan/FinanceForm.tsx index 78e8a8236..d13c48df9 100644 --- a/centrifuge-app/src/pages/Loan/FinanceForm.tsx +++ b/centrifuge-app/src/pages/Loan/FinanceForm.tsx @@ -197,160 +197,164 @@ function InternalFinanceForm({ <> {!maturityDatePassed && ( - - - - { - const principalValue = typeof val === 'number' ? Dec(val) : (val as Decimal) - if (maxAvailable !== UNLIMITED && principalValue.gt(maxAvailable)) { - return `Principal exceeds available financing` - } - return '' - })} - > - {({ field, form }: FieldProps) => { - return ( - form.setFieldValue('principal', value)} - onSetMax={ - maxAvailable !== UNLIMITED ? () => form.setFieldValue('principal', maxAvailable) : undefined - } - /> - ) - }} - - {source === 'other' && ( - - {({ field }: FieldProps) => { +
+ + + + { + const principalValue = typeof val === 'number' ? Dec(val) : (val as Decimal) + if (maxAvailable !== UNLIMITED && principalValue.gt(maxAvailable)) { + return `Principal exceeds available financing` + } + return '' + })} + > + {({ field, form }: FieldProps) => { return ( - + ) + }} + + )} + {source === 'reserve' && withdraw.render()} + + {poolFees.render()} + + + {isCashLoan(loan) ? 'Deposit amount' : 'Financing amount'} ( + {formatBalance(totalFinance, displayCurrency, 2)}) is greater than the available balance ( + {formatBalance(maxAvailable, displayCurrency, 2)}). + + + + There is an additional{' '} + {formatBalance( + new CurrencyBalance(pool.reserve.total.sub(pool.reserve.available), pool.currency.decimals), + displayCurrency + )}{' '} + available from repayments or deposits. This requires first executing the orders on the{' '} + Liquidity tab. + + + - + + Transaction summary + + - - {isCashLoan(loan) ? 'Deposit amount' : 'Financing amount'} + + + Available balance + + + + {maxAvailable === UNLIMITED ? 'No limit' : formatBalance(maxAvailable, displayCurrency, 2)} - {formatBalance(totalFinance, displayCurrency, 2)} - - {poolFees.renderSummary()} - + + + + {isCashLoan(loan) ? 'Deposit amount' : 'Financing amount'} + + {formatBalance(totalFinance, displayCurrency, 2)} + + - {source === 'reserve' ? ( - - - Stablecoins will be transferred to the designated withdrawal addresses on the specified networks. A - delay may occur before the transfer is completed. - - - ) : source === 'other' ? ( - - - Virtual accounting process. No onchain stablecoin transfers are expected. This action will lead to - an increase in the NAV of the pool. - - - ) : ( - - - Virtual accounting process. No onchain stablecoin transfers are expected. - - - )} - - + {poolFees.renderSummary()} + - - - + {source === 'reserve' ? ( + + + Stablecoins will be transferred to the designated withdrawal addresses on the specified networks. + A delay may occur before the transfer is completed. + + + ) : source === 'other' ? ( + + + Virtual accounting process. No onchain stablecoin transfers are expected. This action will lead to + an increase in the NAV of the pool. + + + ) : ( + + + Virtual accounting process. No onchain stablecoin transfers are expected. + + + )} + + + + + + +
)} @@ -577,12 +581,11 @@ export function useWithdraw(poolId: string, borrower: CombinedSubstrateAccount, amount={amount} /> ), - isValid: (_: { values: Pick }) => { + isValid: () => { const withdrawalAddresses = Object.values(selectedAddressIndexByCurrency).filter((index) => index !== -1) return source === 'reserve' ? amount.lte(totalAvailable) && !!withdrawalAddresses.length : true }, - getBatch: ({ values }: { values: Pick }) => { - if (!values.withdraw) return of([]) + getBatch: () => { const withdrawalAddresses = Object.values(selectedAddressIndexByCurrency).filter((index) => index !== -1) if (!withdrawalAddresses.length) return of([]) return combineLatest(