-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Create report from reported expense #71808
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
b34ff54
5807de0
6f5af51
1b565d5
5659f17
7bb478b
7e4a8f9
68a9e9f
95c459f
1ee3740
6e316a2
9b39362
afc4f20
6ef8ab6
ee256a6
8b88e03
fbd7ad4
30c33a4
40eb2ff
8dc9a54
5e3a865
71824a8
6977450
4117047
0e02838
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 |
|---|---|---|
|
|
@@ -42,9 +42,9 @@ type WorkspaceListItem = { | |
| type NewReportWorkspaceSelectionPageProps = PlatformStackScreenProps<NewReportWorkspaceSelectionNavigatorParamList, typeof SCREENS.NEW_REPORT_WORKSPACE_SELECTION.ROOT>; | ||
|
|
||
| function NewReportWorkspaceSelectionPage({route}: NewReportWorkspaceSelectionPageProps) { | ||
| const {isMovingExpenses} = route.params ?? {}; | ||
| const {isMovingExpenses, backTo} = route.params ?? {}; | ||
| const {isOffline} = useNetwork(); | ||
| const {selectedTransactions, clearSelectedTransactions} = useSearchContext(); | ||
| const {selectedTransactions, selectedTransactionIDs, clearSelectedTransactions} = useSearchContext(); | ||
| const styles = useThemeStyles(); | ||
| const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState(''); | ||
| const {translate, localeCompare} = useLocalize(); | ||
|
|
@@ -87,34 +87,41 @@ function NewReportWorkspaceSelectionPage({route}: NewReportWorkspaceSelectionPag | |
| } | ||
| const optimisticReportID = createNewReport(currentUserPersonalDetails, isASAPSubmitBetaEnabled, hasViolations, policyID); | ||
| const selectedTransactionsKeys = Object.keys(selectedTransactions); | ||
| if (isMovingExpenses && !!selectedTransactionsKeys.length) { | ||
|
|
||
| if (isMovingExpenses && (!!selectedTransactionsKeys.length || !!selectedTransactionIDs.length)) { | ||
| const reportNextStep = allReportNextSteps?.[`${ONYXKEYS.COLLECTION.NEXT_STEP}${optimisticReportID}`]; | ||
| changeTransactionsReport( | ||
| selectedTransactionsKeys, | ||
| selectedTransactionsKeys.length ? selectedTransactionsKeys : selectedTransactionIDs, | ||
|
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 are we doing here?
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 either use the keys or IDs. We either save the whole selectedTransactions objects or IDs only in the search context |
||
| optimisticReportID, | ||
| isASAPSubmitBetaEnabled, | ||
| currentUserPersonalDetails?.accountID ?? CONST.DEFAULT_NUMBER_ID, | ||
| currentUserPersonalDetails?.email ?? '', | ||
| policies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`], | ||
| reportNextStep, | ||
| ); | ||
| clearSelectedTransactions(); | ||
| if (selectedTransactionIDs.length) { | ||
| clearSelectedTransactions(true); | ||
| } else if (selectedTransactionsKeys.length) { | ||
| clearSelectedTransactions(); | ||
| } | ||
| Navigation.dismissModal(); | ||
| Navigation.goBack(ROUTES.SEARCH_ROOT.getRoute({query: buildCannedSearchQuery()})); | ||
| Navigation.goBack(backTo ?? ROUTES.SEARCH_ROOT.getRoute({query: buildCannedSearchQuery()})); | ||
| return; | ||
| } | ||
| navigateToNewReport(optimisticReportID); | ||
| }, | ||
| [ | ||
| allReportNextSteps, | ||
| clearSelectedTransactions, | ||
| currentUserPersonalDetails, | ||
| isASAPSubmitBetaEnabled, | ||
| hasViolations, | ||
| selectedTransactions, | ||
| isMovingExpenses, | ||
| selectedTransactionIDs, | ||
| navigateToNewReport, | ||
| allReportNextSteps, | ||
| policies, | ||
| selectedTransactions, | ||
| hasViolations, | ||
| clearSelectedTransactions, | ||
| backTo, | ||
| ], | ||
| ); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -152,7 +152,7 @@ function IOURequestEditReportCommon({ | |||||
| const headerMessage = useMemo(() => (searchValue && !reportOptions.length ? translate('common.noResultsFound') : ''), [searchValue, reportOptions, translate]); | ||||||
|
|
||||||
| const createReportOption = useMemo(() => { | ||||||
| if (!createReport || isUnreported === false) { | ||||||
| if (!createReport || isUnreported) { | ||||||
|
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
Shouldn't this be like that?
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 hoding it for now for unreported |
||||||
| return undefined; | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
We already have
isPolicyAuditorin PolicyUtilsThere 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.
We should also update
isPolicyAuditormethod to usegetPolicyRoleas is using similiar logic inside.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.
@parasharrajat yeaah, but it uses employees list 😅 so another one I cannot use. I don't want to change the util either, because getPolicyRole returns policy?.role when it exists and I guess this util is used to check other members for being auditor
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.
Here is reads policy first
but it is fine.