From 4fad7e03fcdd25727889517b6131726929a462dd Mon Sep 17 00:00:00 2001 From: JP Angelle Date: Sun, 1 Oct 2023 19:23:01 -0500 Subject: [PATCH] fix --- .../src/pages/Loan/ExternalFinanceForm.tsx | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx b/centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx index 7f69b635b3..7c0c68e23b 100644 --- a/centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx +++ b/centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx @@ -11,7 +11,7 @@ import { useFocusInvalidInput } from '../../utils/useFocusInvalidInput' import { useAvailableFinancing } from '../../utils/useLoans' import { useBorrower } from '../../utils/usePermissions' import { usePool } from '../../utils/usePools' -import { combine, max, maxPriceVariance, positiveNumber, settlementPrice } from '../../utils/validation' +import { combine, maxPriceVariance, positiveNumber, settlementPrice } from '../../utils/validation' type FinanceValues = { price: number | '' | Decimal @@ -75,6 +75,11 @@ export function ExternalFinanceForm({ loan }: { loan: ExternalLoan }) { validateOnMount: true, }) + const currentFace = + loan?.pricing && 'outstandingQuantity' in loan.pricing + ? loan.pricing.outstandingQuantity.toDecimal().mul(loan.pricing.notional.toDecimal()) + : null + const repayForm = useFormik({ initialValues: { price: '', @@ -212,22 +217,20 @@ export function ExternalFinanceForm({ loan }: { loan: ExternalLoan }) { To repay the asset, enter face value and settlement price of the transaction. - - - Outstanding - {/* outstandingDebt needs to be rounded down, b/c onSetMax displays the rounded down value as well */} - {formatBalance(loan.outstandingDebt, pool.currency.symbol, 2, 2)} - - + {currentFace ? ( + + + Current face + {formatBalance(currentFace, pool.currency.symbol, 2, 2)} + + + ) : null} {loan.status !== 'Created' && (debt.gt(0) ? ( - + {({ field, meta, form }: FieldProps) => { return (