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

remove MoneyRequestTagPage #35136

Merged
merged 10 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
10 changes: 3 additions & 7 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,6 @@ const ROUTES = {
route: ':iouType/new/category/:reportID?',
getRoute: (iouType: string, reportID = '') => `${iouType}/new/category/${reportID}` as const,
},
MONEY_REQUEST_TAG: {
route: ':iouType/new/tag/:reportID?',
getRoute: (iouType: string, reportID = '') => `${iouType}/new/tag/${reportID}` as const,
},
MONEY_REQUEST_MERCHANT: {
route: ':iouType/new/merchant/:reportID?',
getRoute: (iouType: string, reportID = '') => `${iouType}/new/merchant/${reportID}` as const,
Expand Down Expand Up @@ -370,9 +366,9 @@ const ROUTES = {
getUrlWithBackToParam(`${action}/${iouType}/scan/${transactionID}/${reportID}`, backTo),
},
MONEY_REQUEST_STEP_TAG: {
route: 'create/:iouType/tag/:transactionID/:reportID',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, backTo = '') =>
getUrlWithBackToParam(`create/${iouType}/tag/${transactionID}/${reportID}`, backTo),
route: ':action/:iouType/tag/:transactionID/:reportID',
getRoute: (action: ValueOf<typeof CONST.IOU.ACTION>, iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, backTo = '') =>
getUrlWithBackToParam(`${action}/${iouType}/tag/${transactionID}/${reportID}`, backTo),
},
MONEY_REQUEST_STEP_WAYPOINT: {
route: ':action/:iouType/waypoint/:transactionID/:reportID/:pageIndex',
Expand Down
1 change: 0 additions & 1 deletion src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ const SCREENS = {
DATE: 'Money_Request_Date',
DESCRIPTION: 'Money_Request_Description',
CATEGORY: 'Money_Request_Category',
TAG: 'Money_Request_Tag',
MERCHANT: 'Money_Request_Merchant',
WAYPOINT: 'Money_Request_Waypoint',
EDIT_WAYPOINT: 'Money_Request_Edit_Waypoint',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -810,21 +810,30 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
rightLabel={canUseViolations && Boolean(policy.requiresCategory) ? translate('common.required') : ''}
/>
)}
{shouldShowTags && (
<MenuItemWithTopDescription
shouldShowRightIcon={!isReadOnly}
title={PolicyUtils.getCleanedTagName(iouTag)}
description={policyTagListName}
numberOfLinesTitle={2}
onPress={() =>
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_TAG.getRoute(iouType, transaction.transactionID, reportID, Navigation.getActiveRouteWithoutParams()))
}
style={[styles.moneyRequestMenuItem]}
disabled={didConfirm}
interactive={!isReadOnly}
rightLabel={canUseViolations && Boolean(policy.requiresTag) ? translate('common.required') : ''}
/>
)}
{shouldShowTags ||
(true && (
<MenuItemWithTopDescription
shouldShowRightIcon={!isReadOnly}
title={PolicyUtils.getCleanedTagName(iouTag)}
description={policyTagListName}
numberOfLinesTitle={2}
onPress={() =>
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_TAG.getRoute(
CONST.IOU.ACTION.CREATE,
iouType,
transaction.transactionID,
reportID,
Navigation.getActiveRouteWithoutParams(),
),
)
}
style={[styles.moneyRequestMenuItem]}
disabled={didConfirm}
interactive={!isReadOnly}
rightLabel={canUseViolations && Boolean(policy.requiresTag) ? translate('common.required') : ''}
/>
))}
{shouldShowTax && (
<MenuItemWithTopDescription
shouldShowRightIcon={!isReadOnly}
Expand Down
4 changes: 3 additions & 1 deletion src/components/ReportActionItem/MoneyRequestView.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@ function MoneyRequestView({report, parentReport, parentReportActions, policyCate
interactive={canEdit}
shouldShowRightIcon={canEdit}
titleStyle={styles.flex1}
onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.TAG))}
onPress={() =>
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_TAG.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.REQUEST, transaction.transactionID, report.reportID))
}
brickRoadIndicator={hasViolations('tag') ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''}
/>
{canUseViolations && <ViolationMessages violations={getViolationsForField('tag')} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator<MoneyRequestNa
[SCREENS.MONEY_REQUEST.DATE]: () => require('../../../pages/iou/MoneyRequestDatePage').default as React.ComponentType,
[SCREENS.MONEY_REQUEST.DESCRIPTION]: () => require('../../../pages/iou/MoneyRequestDescriptionPage').default as React.ComponentType,
[SCREENS.MONEY_REQUEST.CATEGORY]: () => require('../../../pages/iou/MoneyRequestCategoryPage').default as React.ComponentType,
[SCREENS.MONEY_REQUEST.TAG]: () => require('../../../pages/iou/MoneyRequestTagPage').default as React.ComponentType,
[SCREENS.MONEY_REQUEST.MERCHANT]: () => require('../../../pages/iou/MoneyRequestMerchantPage').default as React.ComponentType,
[SCREENS.IOU_SEND.ADD_BANK_ACCOUNT]: () => require('../../../pages/AddPersonalBankAccountPage').default as React.ComponentType,
[SCREENS.IOU_SEND.ADD_DEBIT_CARD]: () => require('../../../pages/settings/Wallet/AddDebitCardPage').default as React.ComponentType,
Expand Down
1 change: 0 additions & 1 deletion src/libs/Navigation/linkingConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ const linkingConfig: LinkingOptions<RootStackParamList> = {
[SCREENS.MONEY_REQUEST.CURRENCY]: ROUTES.MONEY_REQUEST_CURRENCY.route,
[SCREENS.MONEY_REQUEST.DESCRIPTION]: ROUTES.MONEY_REQUEST_DESCRIPTION.route,
[SCREENS.MONEY_REQUEST.CATEGORY]: ROUTES.MONEY_REQUEST_CATEGORY.route,
[SCREENS.MONEY_REQUEST.TAG]: ROUTES.MONEY_REQUEST_TAG.route,
[SCREENS.MONEY_REQUEST.MERCHANT]: ROUTES.MONEY_REQUEST_MERCHANT.route,
[SCREENS.MONEY_REQUEST.RECEIPT]: ROUTES.MONEY_REQUEST_RECEIPT.route,
[SCREENS.MONEY_REQUEST.DISTANCE]: ROUTES.MONEY_REQUEST_DISTANCE.route,
Expand Down
9 changes: 6 additions & 3 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,15 @@ type MoneyRequestNavigatorParamList = {
iouType: string;
reportID: string;
};
[SCREENS.MONEY_REQUEST.TAG]: {
[SCREENS.MONEY_REQUEST.STEP_TAX_AMOUNT]: {
iouType: string;
transactionID: string;
reportID: string;
backTo: string;
};
[SCREENS.MONEY_REQUEST.STEP_TAX_AMOUNT]: {
iouType: string;
[SCREENS.MONEY_REQUEST.STEP_TAG]: {
action: ValueOf<typeof CONST.IOU.ACTION>;
iouType: ValueOf<typeof CONST.IOU.TYPE>;
transactionID: string;
reportID: string;
backTo: string;
Expand Down
127 changes: 0 additions & 127 deletions src/pages/iou/MoneyRequestTagPage.js

This file was deleted.

15 changes: 12 additions & 3 deletions src/pages/iou/request/step/IOURequestStepTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Navigation from '@libs/Navigation/Navigation';
import * as PolicyUtils from '@libs/PolicyUtils';
import reportPropTypes from '@pages/reportPropTypes';
import * as IOU from '@userActions/IOU';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import IOURequestStepRoutePropTypes from './IOURequestStepRoutePropTypes';
Expand Down Expand Up @@ -44,7 +45,7 @@ function IOURequestStepTag({
policyTags,
report,
route: {
params: {transactionID, backTo},
params: {action, transactionID, backTo},
},
transaction: {tag},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In split bill requests, we save the draft data in splitDraftTransaction field instead of transaction field. But in here, we always get tag from transaction field. It causes this regression

}) {
Expand All @@ -54,6 +55,7 @@ function IOURequestStepTag({
// Fetches the first tag list of the policy
const tagListKey = _.first(_.keys(policyTags));
const policyTagListName = PolicyUtils.getTagListName(policyTags) || translate('common.tag');
const isEditting = action === CONST.IOU.ACTION.EDIT;
dukenv0307 marked this conversation as resolved.
Show resolved Hide resolved

const navigateBack = () => {
Navigation.goBack(backTo || ROUTES.HOME);
Expand All @@ -64,10 +66,17 @@ function IOURequestStepTag({
* @param {String} selectedTag.searchText
*/
const updateTag = (selectedTag) => {
if (selectedTag.searchText === tag) {
const isSelectedTag = selectedTag.searchText === tag;
const updatedTag = !isSelectedTag ? selectedTag.searchText : '';
if (isEditting) {
dukenv0307 marked this conversation as resolved.
Show resolved Hide resolved
IOU.updateMoneyRequestTag(transactionID, report.reportID, updatedTag);
Navigation.dismissModal();
return;
}
if (isSelectedTag) {
IOU.resetMoneyRequestTag_temporaryForRefactor(transactionID);
} else {
IOU.setMoneyRequestTag_temporaryForRefactor(transactionID, selectedTag.searchText);
IOU.setMoneyRequestTag_temporaryForRefactor(transactionID, updatedTag);
dukenv0307 marked this conversation as resolved.
Show resolved Hide resolved
}
navigateBack();
};
Expand Down
Loading