Skip to content
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

[CP Staging] Hide merchant and date field for split bill with scan #29473

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading