Skip to content

Commit 46dea00

Browse files
committed
fix user name not displayed correctly for employee users in reporting
1 parent 16fed4a commit 46dea00

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

resources/js/utils/useReporting.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import type {
66
AggregatedTimeEntriesQueryParams,
77
ReportingResponse,
88
} from '@/packages/api/src';
9-
import { getCurrentOrganizationId } from '@/utils/useUser';
9+
import {
10+
getCurrentOrganizationId,
11+
getCurrentRole,
12+
getCurrentUser,
13+
} from '@/utils/useUser';
1014
import { useNotificationsStore } from '@/utils/notification';
1115
import { useProjectsStore } from '@/utils/useProjects';
1216
import { useMembersStore } from '@/utils/useMembers';
@@ -106,6 +110,9 @@ export const useReportingStore = defineStore('reporting', () => {
106110
return projects.value.find((project) => project.id === key)?.name;
107111
}
108112
if (type === 'user') {
113+
if (getCurrentRole() === 'employee') {
114+
return getCurrentUser().name;
115+
}
109116
const memberStore = useMembersStore();
110117
const { members } = storeToRefs(memberStore);
111118
return members.value.find((member) => member.user_id === key)?.name;

resources/js/utils/useUser.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ function getCurrentUserId() {
1010
return page.props.auth.user.id;
1111
}
1212

13+
function getCurrentUser() {
14+
return page.props.auth.user;
15+
}
16+
1317
function getCurrentOrganizationId() {
1418
return page.props.auth.user.current_team_id;
1519
}
@@ -31,4 +35,5 @@ export {
3135
getCurrentUserId,
3236
getCurrentMembershipId,
3337
getCurrentRole,
38+
getCurrentUser,
3439
};

0 commit comments

Comments
 (0)