diff --git a/src/components/Dashboard/Dashboard.jsx b/src/components/Dashboard/Dashboard.jsx index 40a64fe4..3748c0a1 100644 --- a/src/components/Dashboard/Dashboard.jsx +++ b/src/components/Dashboard/Dashboard.jsx @@ -18,12 +18,18 @@ import ExpenseStatus from "./ExpenseStatus"; import ExpenseByProject from "./ExpenseByProject"; import ProjectStatistics from "../Project/ProjectStatistics"; import ServiceJobs from "./ServiceJobs"; +import { useHasUserPermission } from "../../hooks/useHasUserPermission"; +import { REGULARIZE_ATTENDANCE, SELF_ATTENDANCE, TEAM_ATTENDANCE } from "../../utils/constants"; const Dashboard = () => { // Get the selected project ID from Redux store const projectId = useSelector((store) => store.localVariables.projectId); const isAllProjectsSelected = projectId === null; + const canRegularize = useHasUserPermission(REGULARIZE_ATTENDANCE); + const canTeamAttendance = useHasUserPermission(TEAM_ATTENDANCE); + const canSelfAttendance = useHasUserPermission(SELF_ATTENDANCE); + return (
@@ -50,7 +56,7 @@ const Dashboard = () => {
- {!isAllProjectsSelected && ( + {!isAllProjectsSelected && (canRegularize || canTeamAttendance || canSelfAttendance) && (
diff --git a/src/pages/project/ProjectDetails.jsx b/src/pages/project/ProjectDetails.jsx index 132a03b1..b8ab45d6 100644 --- a/src/pages/project/ProjectDetails.jsx +++ b/src/pages/project/ProjectDetails.jsx @@ -25,6 +25,8 @@ import { useProjectAccess } from "../../hooks/useProjectAccess"; import "./ProjectDetails.css"; import ProjectOrganizations from "../../components/Project/ProjectOrganizations"; import ProjectStatistics from "../../components/Project/ProjectStatistics"; +import { useHasUserPermission } from "../../hooks/useHasUserPermission"; +import { REGULARIZE_ATTENDANCE, SELF_ATTENDANCE, TEAM_ATTENDANCE } from "../../utils/constants"; const ProjectDetails = () => { const projectId = useSelectedProject(); @@ -35,6 +37,10 @@ const ProjectDetails = () => { useProjectDetails(projectId); const { canView, loading: permsLoading } = useProjectAccess(projectId); + const canRegularize = useHasUserPermission(REGULARIZE_ATTENDANCE); + const canTeamAttendance = useHasUserPermission(TEAM_ATTENDANCE); + const canSelfAttendance = useHasUserPermission(SELF_ATTENDANCE); + useEffect(() => { if (!projectId && projectNames.length > 0) { @@ -82,15 +88,17 @@ const ProjectDetails = () => { return (
- -
+ +
- +
-
- -
+ {(canRegularize || canTeamAttendance || canSelfAttendance) && ( +
+ +
+ )}
);