Skip to content

Commit

Permalink
Do not allow editing date and merchant of send money
Browse files Browse the repository at this point in the history
  • Loading branch information
mountiny committed Oct 11, 2023
1 parent 110993f commit 35d5cfa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ function MoneyRequestConfirmationList(props) {
const {translate, toLocaleDigit} = useLocalize();

const isTypeRequest = props.iouType === CONST.IOU.MONEY_REQUEST_TYPE.REQUEST;
const isTypeSend = props.iouType === CONST.IOU.MONEY_REQUEST_TYPE.SEND;

const {unit, rate, currency} = props.mileageRate;
const distance = lodashGet(transaction, 'routes.route0.distance', 0);
Expand All @@ -210,6 +211,10 @@ function MoneyRequestConfirmationList(props) {
const [shouldExpandFields, toggleShouldExpandFields] = useReducer((state) => !state, false);
const shouldShowAllFields = props.isDistanceRequest || shouldExpandFields || !shouldShowSmartScanFields;

// In Send Money flow, we don't allow the Merchant or Date to be edited.
const shouldShowDate = shouldShowAllFields && !isTypeSend;
const shouldShowMerchant = shouldShowAllFields && !isTypeSend;

// Fetches the first tag list of the policy
const policyTag = PolicyUtils.getTag(props.policyTags);
const policyTagList = lodashGet(policyTag, 'tags', {});
Expand Down Expand Up @@ -549,7 +554,7 @@ function MoneyRequestConfirmationList(props) {
)}
{shouldShowAllFields && (
<>
{shouldShowSmartScanFields && (
{shouldShowDate && (
<MenuItemWithTopDescription
shouldShowRightIcon={!props.isReadOnly && isTypeRequest}
title={props.iouCreated || format(new Date(), CONST.DATE.FNS_FORMAT_STRING)}
Expand All @@ -571,7 +576,7 @@ function MoneyRequestConfirmationList(props) {
disabled={didConfirm || props.isReadOnly || !isTypeRequest}
/>
)}
{shouldShowSmartScanFields && (
{shouldShowMerchant && (
<MenuItemWithTopDescription
shouldShowRightIcon={!props.isReadOnly && isTypeRequest}
title={props.iouMerchant}
Expand Down

0 comments on commit 35d5cfa

Please sign in to comment.