From 70f6ed1c6ca08f7f5060174e47c50f4b2abebf9f Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Mon, 15 Jan 2024 18:10:36 +0200 Subject: [PATCH] fix: allow Manager to see Activity for all Member --- apps/web/app/hooks/features/useTimeDailyActivity.ts | 3 ++- apps/web/app/hooks/features/useTimeSlot.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web/app/hooks/features/useTimeDailyActivity.ts b/apps/web/app/hooks/features/useTimeDailyActivity.ts index 59aa81626..7b2fa9251 100644 --- a/apps/web/app/hooks/features/useTimeDailyActivity.ts +++ b/apps/web/app/hooks/features/useTimeDailyActivity.ts @@ -23,7 +23,7 @@ export function useTimeDailyActivity(type: string) { const todayStart = moment().startOf('day').toDate(); const todayEnd = moment().endOf('day').toDate(); const employeeId = profile.member?.employeeId ?? ''; - if (profile.userProfile?.id === user?.id) { + if (profile.userProfile?.id === user?.id || user?.role?.name?.toUpperCase() == 'MANAGER') { queryCall({ tenantId: user?.tenantId ?? '', organizationId: user?.employee.organizationId ?? '', @@ -48,6 +48,7 @@ export function useTimeDailyActivity(type: string) { profile.member?.employeeId, profile.userProfile?.id, user?.id, + user?.role?.name, user?.tenantId, user?.employee.organizationId, queryCall, diff --git a/apps/web/app/hooks/features/useTimeSlot.ts b/apps/web/app/hooks/features/useTimeSlot.ts index 92b2267d4..cb919849a 100644 --- a/apps/web/app/hooks/features/useTimeSlot.ts +++ b/apps/web/app/hooks/features/useTimeSlot.ts @@ -21,7 +21,7 @@ export function useTimeSlots() { const todayStart = moment().startOf('day').toDate(); const todayEnd = moment().endOf('day').toDate(); const employeeId = profile.member?.employeeId ?? ''; - if (profile.userProfile?.id === user?.id) { + if (profile.userProfile?.id === user?.id || user?.role?.name?.toUpperCase() == 'MANAGER') { queryCall({ tenantId: user?.tenantId ?? '', organizationId: user?.employee.organizationId ?? '', @@ -39,6 +39,7 @@ export function useTimeSlots() { profile.member?.employeeId, profile.userProfile?.id, user?.id, + user?.role?.name, user?.tenantId, user?.employee.organizationId, queryCall,