Skip to content

Commit 27fc4e7

Browse files
authored
Merge pull request Expensify#68353 from parasharrajat/parasharrajat/change-approver-add
[Change Approver] Add support to Assign approver to an expense report
2 parents eabf2ae + c01c89d commit 27fc4e7

22 files changed

Lines changed: 352 additions & 40 deletions

src/CONST/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,6 +1219,7 @@ const CONST = {
12191219
RETRACTED: 'RETRACTED',
12201220
REOPENED: 'REOPENED',
12211221
REPORT_PREVIEW: 'REPORTPREVIEW',
1222+
REROUTE: 'REROUTE',
12221223
SELECTED_FOR_RANDOM_AUDIT: 'SELECTEDFORRANDOMAUDIT', // OldDot Action
12231224
SHARE: 'SHARE', // OldDot Action
12241225
STRIPE_PAID: 'STRIPEPAID', // OldDot Action

src/ROUTES.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,10 @@ const ROUTES = {
561561
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
562562
getRoute: (reportID: string, backTo?: string) => getUrlWithBackToParam(`r/${reportID}/change-approver` as const, backTo),
563563
},
564+
REPORT_CHANGE_APPROVER_ADD_APPROVER: {
565+
route: 'r/:reportID/change-approver/add',
566+
getRoute: (reportID: string) => `r/${reportID}/change-approver/add` as const,
567+
},
564568
SPLIT_BILL_DETAILS: {
565569
route: 'r/:reportID/split/:reportActionID',
566570
getRoute: (reportID: string | undefined, reportActionID: string, backTo?: string) => {

src/SCREENS.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ const SCREENS = {
778778
},
779779
REPORT_CHANGE_APPROVER: {
780780
ROOT: 'Report_Change_Approver_Root',
781+
ADD_APPROVER: 'Report_Change_Approver_Add_Approver',
781782
},
782783
TEST_TOOLS_MODAL: {
783784
ROOT: 'TestToolsModal_Root',

src/components/WorkspaceMembersSelectionList.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type SelectionListApprover = {
2727
login: string;
2828
rightElement?: React.ReactNode;
2929
icons: Icon[];
30+
value?: number;
3031
};
3132
type ApproverSection = SectionListData<SelectionListApprover, Section<SelectionListApprover>>;
3233

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
type AddReportApproverParams = {
2+
/** Expense reportID */
3+
reportID: string;
4+
/** Workspace member email */
5+
newApproverEmail: string;
6+
/** Action ID for optimistic took control action */
7+
reportActionID: string;
8+
};
9+
10+
export default AddReportApproverParams;

src/libs/API/parameters/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,5 +425,6 @@ export type {default as OpenUnreportedExpensesPageParams} from './OpenUnreported
425425
export type {default as VerifyTestDriveRecipientParams} from './VerifyTestDriveRecipientParams';
426426
export type {default as ExportSearchWithTemplateParams} from './ExportSearchWithTemplateParams';
427427
export type {default as AssignReportToMeParams} from './AssignReportToMeParams';
428+
export type {default as AddReportApproverParams} from './AddReportApproverParams';
428429
export type {default as EnableGlobalReimbursementsForUSDBankAccountParams} from './EnableGlobalReimbursementsForUSDBankAccountParams';
429430
export type {default as SendReminderForCorpaySignerInformationParams} from './SendReminderForCorpaySignerInformationParams';

src/libs/API/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ const WRITE_COMMANDS = {
505505
DELETE_VACATION_DELEGATE: 'DeleteVacationDelegate',
506506
IMPORT_PLAID_ACCOUNTS: 'ImportPlaidAccounts',
507507
ASSIGN_REPORT_TO_ME: 'AssignReportToMe',
508+
ADD_REPORT_APPROVER: 'AddReportApprover',
508509
} as const;
509510

510511
type WriteCommand = ValueOf<typeof WRITE_COMMANDS>;
@@ -1029,6 +1030,7 @@ type WriteCommandParameters = {
10291030
[WRITE_COMMANDS.CHANGE_TRANSACTIONS_REPORT]: Parameters.ChangeTransactionsReportParams;
10301031
[WRITE_COMMANDS.TRAVEL_SIGNUP_REQUEST]: null;
10311032
[WRITE_COMMANDS.ASSIGN_REPORT_TO_ME]: Parameters.AssignReportToMeParams;
1033+
[WRITE_COMMANDS.ADD_REPORT_APPROVER]: Parameters.AddReportApproverParams;
10321034
};
10331035

10341036
const READ_COMMANDS = {

src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ const ReportChangeWorkspaceModalStackNavigator = createModalStackNavigator<Repor
182182

183183
const ReportChangeApproverModalStackNavigator = createModalStackNavigator<ReportChangeApproverParamList>({
184184
[SCREENS.REPORT_CHANGE_APPROVER.ROOT]: () => require<ReactComponentModule>('../../../../pages/ReportChangeApproverPage').default,
185+
[SCREENS.REPORT_CHANGE_APPROVER.ADD_APPROVER]: () => require<ReactComponentModule>('../../../../pages/ReportAddApproverPage').default,
185186
});
186187

187188
const ReportSettingsModalStackNavigator = createModalStackNavigator<ReportSettingsNavigatorParamList>({

src/libs/Navigation/linkingConfig/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,6 +1645,7 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
16451645
[SCREENS.RIGHT_MODAL.REPORT_CHANGE_APPROVER]: {
16461646
screens: {
16471647
[SCREENS.REPORT_CHANGE_APPROVER.ROOT]: ROUTES.REPORT_CHANGE_APPROVER.route,
1648+
[SCREENS.REPORT_CHANGE_APPROVER.ADD_APPROVER]: ROUTES.REPORT_CHANGE_APPROVER_ADD_APPROVER.route,
16481649
},
16491650
},
16501651
},

src/libs/Navigation/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,6 +2330,9 @@ type ReportChangeApproverParamList = {
23302330
[SCREENS.REPORT_CHANGE_APPROVER.ROOT]: {
23312331
reportID: string;
23322332
};
2333+
[SCREENS.REPORT_CHANGE_APPROVER.ADD_APPROVER]: {
2334+
reportID: string;
2335+
};
23332336
};
23342337

23352338
type TestToolsModalModalNavigatorParamList = {

0 commit comments

Comments
 (0)