From d58756f5ad9d08d2ad98d09a17471f4dbd7a59f6 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 13 Oct 2023 02:07:28 +0800 Subject: [PATCH] hide merchant and date field for split bill with scan --- src/components/MoneyRequestConfirmationList.js | 12 +++++++++--- src/pages/iou/steps/MoneyRequestConfirmPage.js | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index 98ec01de16f8..d6fd80057c25 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -141,6 +141,9 @@ const propTypes = { /** Whether the money request is a distance request */ isDistanceRequest: PropTypes.bool, + /** Whether the money request is a scan request */ + isScanRequest: PropTypes.bool, + /** Whether we should show the amount, date, and merchant fields. */ shouldShowSmartScanFields: PropTypes.bool, @@ -182,6 +185,7 @@ const defaultProps = { transaction: {}, mileageRate: {unit: CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES, rate: 0, currency: 'USD'}, isDistanceRequest: false, + isScanRequest: false, shouldShowSmartScanFields: true, isPolicyExpenseChat: false, }; @@ -197,6 +201,8 @@ function MoneyRequestConfirmationList(props) { const isSplitBill = props.iouType === CONST.IOU.MONEY_REQUEST_TYPE.SPLIT; const isTypeSend = props.iouType === CONST.IOU.MONEY_REQUEST_TYPE.SEND; + const isSplitWithScan = isSplitBill && props.isScanRequest; + const {unit, rate, currency} = props.mileageRate; const distance = lodashGet(transaction, 'routes.route0.distance', 0); const shouldCalculateDistanceAmount = props.isDistanceRequest && props.iouAmount === 0; @@ -211,9 +217,9 @@ function MoneyRequestConfirmationList(props) { // Do not hide fields in case of send money request const shouldShowAllFields = props.isDistanceRequest || shouldExpandFields || !props.shouldShowSmartScanFields || isTypeSend || props.isEditingSplitBill; - // In Send Money flow, we don't allow the Merchant or Date to be edited. For distance requests, don't show the merchant as there's already another "Distance" menu item - const shouldShowDate = shouldShowAllFields && !isTypeSend; - const shouldShowMerchant = shouldShowAllFields && !isTypeSend && !props.isDistanceRequest; + // In Send Money and Split Bill with Scan flow, we don't allow the Merchant or Date to be edited. For distance requests, don't show the merchant as there's already another "Distance" menu item + const shouldShowDate = shouldShowAllFields && !isTypeSend && !isSplitWithScan; + const shouldShowMerchant = shouldShowAllFields && !isTypeSend && !props.isDistanceRequest && !isSplitWithScan; // Fetches the first tag list of the policy const policyTag = PolicyUtils.getTag(props.policyTags); diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index de0e0a16c214..ea7d477717f7 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -66,6 +66,7 @@ function MoneyRequestConfirmPage(props) { const prevMoneyRequestId = useRef(props.iou.id); const iouType = useRef(lodashGet(props.route, 'params.iouType', '')); const isDistanceRequest = MoneyRequestUtils.isDistanceRequest(iouType.current, props.selectedTab); + const isScanRequest = MoneyRequestUtils.isScanRequest(props.selectedTab); const reportID = useRef(lodashGet(props.route, 'params.reportID', '')); const participants = useMemo( () => @@ -378,6 +379,7 @@ function MoneyRequestConfirmPage(props) { bankAccountRoute={ReportUtils.getBankAccountRoute(props.report)} iouMerchant={props.iou.merchant} iouCreated={props.iou.created} + isScanRequest={isScanRequest} isDistanceRequest={isDistanceRequest} listStyles={[StyleUtils.getMaximumHeight(windowHeight / 3)]} shouldShowSmartScanFields={_.isEmpty(props.iou.receiptPath)}