From 0f1a618ba6ec9a0ad94284639a83fb30e8ba460e Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 4 Jul 2024 22:34:43 +0800 Subject: [PATCH 1/2] show the payable amount --- .../ReportActionItem/ReportPreview.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/ReportActionItem/ReportPreview.tsx b/src/components/ReportActionItem/ReportPreview.tsx index 9693b982ec4a..26fa308f6f89 100644 --- a/src/components/ReportActionItem/ReportPreview.tsx +++ b/src/components/ReportActionItem/ReportPreview.tsx @@ -128,6 +128,7 @@ function ReportPreview({ const [isHoldMenuVisible, setIsHoldMenuVisible] = useState(false); const [requestType, setRequestType] = useState(); const [nonHeldAmount, fullAmount] = ReportUtils.getNonHeldAndFullAmount(iouReport, policy); + const hasOnlyHeldExpenses = ReportUtils.hasOnlyHeldExpenses(iouReport?.reportID ?? ''); const {isSmallScreenWidth} = useWindowDimensions(); const [paymentType, setPaymentType] = useState(); @@ -204,6 +205,18 @@ function ReportPreview({ } }; + const getSettlementAmount = () => { + if (hasOnlyHeldExpenses) { + return ''; + } + + if (ReportUtils.hasHeldExpenses(iouReport?.reportID) && canAllowSettlement) { + return nonHeldAmount; + } + + return CurrencyUtils.convertToDisplayString(reimbursableSpend, iouReport?.currency); + } + const getDisplayAmount = (): string => { if (totalDisplaySpend) { return CurrencyUtils.convertToDisplayString(totalDisplaySpend, iouReport?.currency); @@ -415,7 +428,7 @@ function ReportPreview({ {shouldShowSettlementButton && ( {isHoldMenuVisible && iouReport && requestType !== undefined && ( Date: Wed, 10 Jul 2024 11:48:09 +0800 Subject: [PATCH 2/2] prettier --- src/components/ReportActionItem/ReportPreview.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ReportActionItem/ReportPreview.tsx b/src/components/ReportActionItem/ReportPreview.tsx index 3e0111a3e63e..a435a5723670 100644 --- a/src/components/ReportActionItem/ReportPreview.tsx +++ b/src/components/ReportActionItem/ReportPreview.tsx @@ -214,7 +214,7 @@ function ReportPreview({ } return CurrencyUtils.convertToDisplayString(reimbursableSpend, iouReport?.currency); - } + }; const getDisplayAmount = (): string => { if (totalDisplaySpend) {