-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Enable category field on unreported expenses #72457
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
Changes from all commits
86f00ae
378fc21
5d0610a
38fdd97
3bd7b71
f1eb259
895c2f8
2923446
78c426e
6f2b5c7
6cc0a02
94e662c
a9d0579
0b58837
122babf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -270,7 +270,7 @@ function MoneyRequestView({ | |
| // Flags for showing categories and tags | ||
| // transactionCategory can be an empty string | ||
| // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
| const shouldShowCategory = isPolicyExpenseChat && (categoryForDisplay || hasEnabledOptions(policyCategories ?? {})); | ||
| const shouldShowCategory = (isPolicyExpenseChat && (categoryForDisplay || hasEnabledOptions(policyCategories ?? {}))) || isExpenseUnreported; | ||
| // transactionTag can be an empty string | ||
| // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
| const shouldShowTag = isPolicyExpenseChat && (transactionTag || hasEnabledTags(policyTagLists)); | ||
|
|
@@ -309,6 +309,8 @@ function MoneyRequestView({ | |
| amountTitle = translate('iou.receiptStatusTitle'); | ||
| } | ||
|
|
||
| const shouldNavigateToUpgradePath = !policyForMovingExpenses && !shouldSelectPolicy; | ||
|
|
||
| const updatedTransactionDescription = useMemo(() => { | ||
| if (!updatedTransaction) { | ||
| return undefined; | ||
|
|
@@ -713,17 +715,28 @@ function MoneyRequestView({ | |
| shouldShowRightIcon={canEdit} | ||
| titleStyle={styles.flex1} | ||
| onPress={() => { | ||
| if (!policy) { | ||
| if (shouldNavigateToUpgradePath) { | ||
| Navigation.navigate( | ||
| ROUTES.MONEY_REQUEST_UPGRADE.getRoute({ | ||
| action: CONST.IOU.ACTION.EDIT, | ||
| iouType, | ||
| transactionID: transaction.transactionID, | ||
| reportID: report.reportID, | ||
| backTo: getReportRHPActiveRoute(), | ||
| upgradePath: CONST.UPGRADE_PATHS.CATEGORIES, | ||
| }), | ||
| ); | ||
| } else if (shouldSelectPolicy) { | ||
| Navigation.navigate( | ||
| ROUTES.SET_DEFAULT_WORKSPACE.getRoute( | ||
| ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute( | ||
| CONST.IOU.ACTION.EDIT, | ||
| iouType, | ||
| transaction.transactionID, | ||
| report.reportID, | ||
| getReportRHPActiveRoute(), | ||
| ), | ||
|
Comment on lines
+731
to
+737
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would leave it as it is for now |
||
| ), | ||
| ); | ||
| } else { | ||
| Navigation.navigate( | ||
| ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute(CONST.IOU.ACTION.EDIT, iouType, transaction.transactionID, report.reportID, getReportRHPActiveRoute()), | ||
|
|
@@ -854,7 +867,7 @@ function MoneyRequestView({ | |
| if (!canEditReport) { | ||
| return; | ||
| } | ||
| if (!policyForMovingExpenses && !shouldSelectPolicy) { | ||
| if (shouldNavigateToUpgradePath) { | ||
| Navigation.navigate( | ||
| ROUTES.MONEY_REQUEST_UPGRADE.getRoute({ | ||
| iouType, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -932,7 +932,7 @@ | |||||
|
|
||||||
| let conciergeReportID: OnyxEntry<string>; | ||||||
| Onyx.connect({ | ||||||
| key: ONYXKEYS.CONCIERGE_REPORT_ID, | ||||||
| callback: (value) => { | ||||||
| conciergeReportID = value; | ||||||
| }, | ||||||
|
|
@@ -940,7 +940,7 @@ | |||||
|
|
||||||
| const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon'; | ||||||
| Onyx.connect({ | ||||||
| key: ONYXKEYS.SESSION, | ||||||
| callback: (value) => { | ||||||
| // When signed out, val is undefined | ||||||
| if (!value) { | ||||||
|
|
@@ -958,7 +958,7 @@ | |||||
| let allPersonalDetailLogins: string[]; | ||||||
| let currentUserPersonalDetails: OnyxEntry<PersonalDetails>; | ||||||
| Onyx.connect({ | ||||||
| key: ONYXKEYS.PERSONAL_DETAILS_LIST, | ||||||
| callback: (value) => { | ||||||
| if (currentUserAccountID) { | ||||||
| currentUserPersonalDetails = value?.[currentUserAccountID] ?? undefined; | ||||||
|
|
@@ -970,14 +970,14 @@ | |||||
|
|
||||||
| let allReportsDraft: OnyxCollection<Report>; | ||||||
| Onyx.connect({ | ||||||
| key: ONYXKEYS.COLLECTION.REPORT_DRAFT, | ||||||
| waitForCollectionCallback: true, | ||||||
| callback: (value) => (allReportsDraft = value), | ||||||
| }); | ||||||
|
|
||||||
| let allPolicies: OnyxCollection<Policy>; | ||||||
| Onyx.connect({ | ||||||
| key: ONYXKEYS.COLLECTION.POLICY, | ||||||
| waitForCollectionCallback: true, | ||||||
| callback: (value) => (allPolicies = value), | ||||||
| }); | ||||||
|
|
@@ -985,7 +985,7 @@ | |||||
| let allReports: OnyxCollection<Report>; | ||||||
| let reportsByPolicyID: ReportByPolicyMap; | ||||||
| Onyx.connect({ | ||||||
| key: ONYXKEYS.COLLECTION.REPORT, | ||||||
| waitForCollectionCallback: true, | ||||||
| callback: (value) => { | ||||||
| allReports = value; | ||||||
|
|
@@ -1028,14 +1028,14 @@ | |||||
|
|
||||||
| let allBetas: OnyxEntry<Beta[]>; | ||||||
| Onyx.connect({ | ||||||
| key: ONYXKEYS.BETAS, | ||||||
| callback: (value) => (allBetas = value), | ||||||
| }); | ||||||
|
|
||||||
| let allTransactions: OnyxCollection<Transaction> = {}; | ||||||
| let reportsTransactions: Record<string, Transaction[]> = {}; | ||||||
| Onyx.connect({ | ||||||
| key: ONYXKEYS.COLLECTION.TRANSACTION, | ||||||
| waitForCollectionCallback: true, | ||||||
| callback: (value) => { | ||||||
| if (!value) { | ||||||
|
|
@@ -1061,7 +1061,7 @@ | |||||
|
|
||||||
| let allReportActions: OnyxCollection<ReportActions>; | ||||||
| Onyx.connect({ | ||||||
| key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, | ||||||
| waitForCollectionCallback: true, | ||||||
| callback: (actions) => { | ||||||
| if (!actions) { | ||||||
|
|
@@ -1074,7 +1074,7 @@ | |||||
| let allReportMetadata: OnyxCollection<ReportMetadata>; | ||||||
| const allReportMetadataKeyValue: Record<string, ReportMetadata> = {}; | ||||||
| Onyx.connect({ | ||||||
| key: ONYXKEYS.COLLECTION.REPORT_METADATA, | ||||||
| waitForCollectionCallback: true, | ||||||
| callback: (value) => { | ||||||
| if (!value) { | ||||||
|
|
@@ -4390,7 +4390,7 @@ | |||||
| isDeleteAction?: boolean, | ||||||
| isChatReportArchived = false, | ||||||
| outstandingReportsByPolicyID?: OutstandingReportsByPolicyIDDerivedValue, | ||||||
| isSearchPageOption?: boolean, | ||||||
| canMoveExpense = true, | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we're not checking here if it's unreported or not, we're just checking if it can be movable
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But later in the code |
||||||
| ): boolean { | ||||||
| // A list of fields that cannot be edited by anyone, once an expense has been settled | ||||||
| const restrictedFields: string[] = [ | ||||||
|
|
@@ -4475,13 +4475,7 @@ | |||||
| // Unreported transaction from OldDot can have the reportID as an empty string | ||||||
| const isUnreportedExpense = !transaction?.reportID || transaction?.reportID === CONST.REPORT.UNREPORTED_REPORT_ID; | ||||||
|
|
||||||
| const isUserWorkspaceMember = getActivePolicies(allPolicies ?? {}, currentUserEmail).filter((userPolicy) => isPaidGroupPolicyPolicyUtils(userPolicy)).length; | ||||||
|
|
||||||
| if (isUnreportedExpense && isSearchPageOption && isUserWorkspaceMember) { | ||||||
| return true; | ||||||
| } | ||||||
|
|
||||||
| if (isUnreportedExpense && !isSearchPageOption) { | ||||||
| if (isUnreportedExpense && canMoveExpense) { | ||||||
| return true; | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be
getReportRHPActiveRoute() || lastVisitedPath,same as report field.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it's working, is it? the report field is a bit different bc you move the expense to another report