From 00b7a544ba3d3f27a6df4f87437e9ea5f8cd228b Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Wed, 8 May 2024 08:57:59 +0200 Subject: [PATCH 1/9] add mark as cash button --- src/components/MoneyReportHeader.tsx | 12 ++++++------ src/components/MoneyRequestHeader.tsx | 13 +++++++++++++ src/languages/en.ts | 1 + src/languages/es.ts | 1 + src/libs/TransactionUtils.ts | 4 ++-- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 68fb0f12733b..11c8ff361537 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -105,7 +105,7 @@ function MoneyReportHeader({ const [isConfirmModalVisible, setIsConfirmModalVisible] = useState(false); const transactionIDs = TransactionUtils.getAllReportTransactions(moneyRequestReport?.reportID).map((transaction) => transaction.transactionID); - const haveAllPendingRTERViolation = TransactionUtils.haveAllPendingRTERViolation(transactionIDs); + const hasAllPendingRTERViolations = TransactionUtils.hasAllPendingRTERViolations(transactionIDs); const cancelPayment = useCallback(() => { if (!chatReport) { @@ -121,13 +121,13 @@ function MoneyReportHeader({ const shouldDisableApproveButton = shouldShowApproveButton && !ReportUtils.isAllowedToApproveExpenseReport(moneyRequestReport); - const shouldShowSettlementButton = !ReportUtils.isInvoiceReport(moneyRequestReport) && (shouldShowPayButton || shouldShowApproveButton) && !haveAllPendingRTERViolation; + const shouldShowSettlementButton = !ReportUtils.isInvoiceReport(moneyRequestReport) && (shouldShowPayButton || shouldShowApproveButton) && !hasAllPendingRTERViolations; - const shouldShowSubmitButton = isDraft && reimbursableSpend !== 0 && !haveAllPendingRTERViolation; + const shouldShowSubmitButton = isDraft && reimbursableSpend !== 0 && !hasAllPendingRTERViolations; const shouldDisableSubmitButton = shouldShowSubmitButton && !ReportUtils.isAllowedToSubmitDraftExpenseReport(moneyRequestReport); const isFromPaidPolicy = policyType === CONST.POLICY.TYPE.TEAM || policyType === CONST.POLICY.TYPE.CORPORATE; const shouldShowNextStep = !ReportUtils.isClosedExpenseReportWithNoExpenses(moneyRequestReport) && isFromPaidPolicy && !!nextStep?.message?.length; - const shouldShowAnyButton = shouldShowSettlementButton || shouldShowApproveButton || shouldShowSubmitButton || shouldShowNextStep; + const shouldShowAnyButton = shouldShowSettlementButton || shouldShowApproveButton || shouldShowSubmitButton || shouldShowNextStep || hasAllPendingRTERViolations; const bankAccountRoute = ReportUtils.getBankAccountRoute(chatReport); const formattedAmount = CurrencyUtils.convertToDisplayString(reimbursableSpend, moneyRequestReport.currency); const [nonHeldAmount, fullAmount] = ReportUtils.getNonHeldAndFullAmount(moneyRequestReport, policy); @@ -212,7 +212,7 @@ function MoneyReportHeader({ shouldShowBackButton={shouldUseNarrowLayout} onBackButtonPress={onBackButtonPress} // Shows border if no buttons or next steps are showing below the header - shouldShowBorderBottom={!(shouldShowAnyButton && shouldUseNarrowLayout) && !(shouldShowNextStep && !shouldUseNarrowLayout) && !haveAllPendingRTERViolation} + shouldShowBorderBottom={!(shouldShowAnyButton && shouldUseNarrowLayout) && !(shouldShowNextStep && !shouldUseNarrowLayout) && !hasAllPendingRTERViolations} shouldShowThreeDotsButton threeDotsMenuItems={threeDotsMenuItems} threeDotsAnchorPosition={styles.threeDotsPopoverOffsetNoCloseButton(windowWidth)} @@ -250,7 +250,7 @@ function MoneyReportHeader({ )} - {haveAllPendingRTERViolation && ( + {hasAllPendingRTERViolations && ( { if (parentReportAction) { @@ -244,6 +246,17 @@ function MoneyRequestHeader({ danger /> )} + {hasAllPendingRTERViolations && ( + +