From 7f100dc967d68d837bd5e58b02557bb757e48a20 Mon Sep 17 00:00:00 2001 From: vhu-axelor <146069039+vhu-axelor@users.noreply.github.com> Date: Fri, 9 Feb 2024 12:04:31 +0100 Subject: [PATCH] fix: number timesheet to validate refresh issue (#401) * RM#75115 --- .../TimesheetDetailsButtons/TimesheetDetailsButtons.tsx | 4 ++-- .../TimesheetRefusalPopup/TimesheetRefusalPopup.tsx | 4 ++-- packages/apps/hr/src/features/timesheetSlice.js | 5 ++++- .../apps/hr/src/screens/timesheet/TimesheetListScreen.js | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/apps/hr/src/components/molecules/TimesheetDetailsButtons/TimesheetDetailsButtons.tsx b/packages/apps/hr/src/components/molecules/TimesheetDetailsButtons/TimesheetDetailsButtons.tsx index 854e4a1081..c703798905 100644 --- a/packages/apps/hr/src/components/molecules/TimesheetDetailsButtons/TimesheetDetailsButtons.tsx +++ b/packages/apps/hr/src/components/molecules/TimesheetDetailsButtons/TimesheetDetailsButtons.tsx @@ -77,7 +77,7 @@ const TimesheetDetailsButtons = ({ timesheetId: timesheet.id, version: timesheet.version, toStatus: 'confirm', - userId: user.id, + user: user, }), ) } @@ -116,7 +116,7 @@ const TimesheetDetailsButtons = ({ timesheetId: timesheet.id, version: timesheet.version, toStatus: 'validate', - userId: user.id, + user: user, }), ) } diff --git a/packages/apps/hr/src/components/templates/TimesheetRefusalPopup/TimesheetRefusalPopup.tsx b/packages/apps/hr/src/components/templates/TimesheetRefusalPopup/TimesheetRefusalPopup.tsx index 6d6429219a..0a5387a569 100644 --- a/packages/apps/hr/src/components/templates/TimesheetRefusalPopup/TimesheetRefusalPopup.tsx +++ b/packages/apps/hr/src/components/templates/TimesheetRefusalPopup/TimesheetRefusalPopup.tsx @@ -44,11 +44,11 @@ const TimesheetRefusalPopup = ({ version: timesheet.version, toStatus: 'refuse', groundForRefusal: refusalMessage, - userId: user.id, + user: user, }), ); }, - [dispatch, timesheet, user.id], + [dispatch, timesheet, user], ); return ( diff --git a/packages/apps/hr/src/features/timesheetSlice.js b/packages/apps/hr/src/features/timesheetSlice.js index 90567d9e8c..790d9eb00e 100644 --- a/packages/apps/hr/src/features/timesheetSlice.js +++ b/packages/apps/hr/src/features/timesheetSlice.js @@ -126,7 +126,10 @@ export const updateTimesheetStatus = createAsyncThunk( dispatch(fetchTimesheetById({timesheetId: data.timesheetId})); }) .then(() => { - dispatch(fetchTimesheet({userId: data.userId})); + dispatch(fetchTimesheet({userId: data.user.id})); + }) + .then(() => { + dispatch(fetchTimesheetToValidate({user: data.user})); }); }, ); diff --git a/packages/apps/hr/src/screens/timesheet/TimesheetListScreen.js b/packages/apps/hr/src/screens/timesheet/TimesheetListScreen.js index 63527b742c..2243192ea9 100644 --- a/packages/apps/hr/src/screens/timesheet/TimesheetListScreen.js +++ b/packages/apps/hr/src/screens/timesheet/TimesheetListScreen.js @@ -58,7 +58,7 @@ const TimesheetListScreen = ({navigation}) => { timesheetId: timesheet.id, version: timesheet.version, toStatus: toStatus, - userId: user.id, + user: user, }), ), [dispatch, user],