-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show scan status bar when one of the receipt is scanning in expense report #42240
Changes from 3 commits
5c03f26
a62d0e8
7d2cc3e
df9bdfc
ef0f367
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -104,6 +104,7 @@ function MoneyReportHeader({ | |||||||||||||
const isDraft = ReportUtils.isOpenExpenseReport(moneyRequestReport); | ||||||||||||||
const [isConfirmModalVisible, setIsConfirmModalVisible] = useState(false); | ||||||||||||||
|
||||||||||||||
const hasScanningReceipt = ReportUtils.getTransactionsWithReceipts(moneyRequestReport.reportID).some((transaction) => TransactionUtils.isReceiptBeingScanned(transaction)); | ||||||||||||||
const transactionIDs = TransactionUtils.getAllReportTransactions(moneyRequestReport?.reportID).map((transaction) => transaction.transactionID); | ||||||||||||||
const allHavePendingRTERViolation = TransactionUtils.allHavePendingRTERViolation(transactionIDs); | ||||||||||||||
|
||||||||||||||
|
@@ -126,13 +127,14 @@ function MoneyReportHeader({ | |||||||||||||
const shouldShowSubmitButton = isDraft && reimbursableSpend !== 0 && !allHavePendingRTERViolation; | ||||||||||||||
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 && !allHavePendingRTERViolation; | ||||||||||||||
const shouldShowNextStep = | ||||||||||||||
!ReportUtils.isClosedExpenseReportWithNoExpenses(moneyRequestReport) && isFromPaidPolicy && !!nextStep?.message?.length && !allHavePendingRTERViolation && !hasScanningReceipt; | ||||||||||||||
const shouldShowAnyButton = shouldShowSettlementButton || shouldShowApproveButton || shouldShowSubmitButton || shouldShowNextStep; | ||||||||||||||
const bankAccountRoute = ReportUtils.getBankAccountRoute(chatReport); | ||||||||||||||
const formattedAmount = CurrencyUtils.convertToDisplayString(reimbursableSpend, moneyRequestReport.currency); | ||||||||||||||
const [nonHeldAmount, fullAmount] = ReportUtils.getNonHeldAndFullAmount(moneyRequestReport, policy); | ||||||||||||||
const displayedAmount = ReportUtils.hasHeldExpenses(moneyRequestReport.reportID) && canAllowSettlement ? nonHeldAmount : formattedAmount; | ||||||||||||||
const isMoreContentShown = shouldShowNextStep || (shouldShowAnyButton && shouldUseNarrowLayout); | ||||||||||||||
const isMoreContentShown = shouldShowNextStep || hasScanningReceipt || (shouldShowAnyButton && shouldUseNarrowLayout); | ||||||||||||||
|
||||||||||||||
const confirmPayment = (type?: PaymentMethodType | undefined) => { | ||||||||||||||
if (!type) { | ||||||||||||||
|
@@ -212,7 +214,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) && !allHavePendingRTERViolation} | ||||||||||||||
shouldShowBorderBottom={!isMoreContentShown && !allHavePendingRTERViolation} | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bernhardoj hmm.. Looks like I am missing something here. Can you please help me understand why we need to replace the existing conditions with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm trying to simplify it. We need to set Without simplifying:
If we reverse this (!isMoreContentShown), it becomes,
repositioned:
You can see that Next step component is put outside of the HeaderWithBackButton, no matter whether it's App/src/components/MoneyReportHeader.tsx Lines 335 to 339 in 8375abe
App/src/components/MoneyReportHeader.tsx Line 303 in 8375abe
So, we don't want the extra border bottom from the HeaderWithBackButton anymore. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. That helps. |
||||||||||||||
shouldShowThreeDotsButton | ||||||||||||||
threeDotsMenuItems={threeDotsMenuItems} | ||||||||||||||
threeDotsAnchorPosition={styles.threeDotsPopoverOffsetNoCloseButton(windowWidth)} | ||||||||||||||
|
@@ -301,6 +303,20 @@ function MoneyReportHeader({ | |||||||||||||
<MoneyReportHeaderStatusBar nextStep={nextStep} /> | ||||||||||||||
</View> | ||||||||||||||
)} | ||||||||||||||
{hasScanningReceipt && ( | ||||||||||||||
<MoneyRequestHeaderStatusBar | ||||||||||||||
title={ | ||||||||||||||
<Icon | ||||||||||||||
src={Expensicons.ReceiptScan} | ||||||||||||||
height={variables.iconSizeSmall} | ||||||||||||||
width={variables.iconSizeSmall} | ||||||||||||||
fill={theme.icon} | ||||||||||||||
/> | ||||||||||||||
} | ||||||||||||||
description={translate('iou.receiptScanInProgressDescription')} | ||||||||||||||
shouldShowBorderBottom={false} | ||||||||||||||
/> | ||||||||||||||
)} | ||||||||||||||
</View> | ||||||||||||||
{isHoldMenuVisible && requestType !== undefined && ( | ||||||||||||||
<ProcessMoneyReportHoldMenu | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done