Skip to content

Commit

Permalink
Merge pull request #29473 from bernhardoj/fix/29458
Browse files Browse the repository at this point in the history
[CP Staging] Hide merchant and date field for split bill with scan
  • Loading branch information
mountiny authored Oct 12, 2023
2 parents a5041bf + d58756f commit 8295f59
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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,
};
Expand All @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/pages/iou/steps/MoneyRequestConfirmPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
() =>
Expand Down Expand Up @@ -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)}
Expand Down

0 comments on commit 8295f59

Please sign in to comment.