From 69679db1be5e002b0813daefdf505d79cb88b0ca Mon Sep 17 00:00:00 2001 From: Vikas Nale Date: Tue, 10 Jun 2025 20:07:06 +0530 Subject: [PATCH] show change password button to self only --- src/pages/employee/EmployeeProfile.jsx | 70 ++++++++++++++------------ 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/src/pages/employee/EmployeeProfile.jsx b/src/pages/employee/EmployeeProfile.jsx index a4ad6aba..dfa88241 100644 --- a/src/pages/employee/EmployeeProfile.jsx +++ b/src/pages/employee/EmployeeProfile.jsx @@ -10,6 +10,8 @@ import { useEmployees, useEmployeesByProject, } from "../../hooks/useEmployees"; +import { useProfile } from "../../hooks/useProfile"; + import { useSelector } from "react-redux"; import EmployeeRepository from "../../repositories/EmployeeRepository"; import { ComingSoonPage } from "../Misc/ComingSoonPage"; @@ -20,6 +22,8 @@ import ManageEmployee from "../../components/Employee/ManageEmployee"; import { useChangePassword } from "../../components/Context/ChangePasswordContext"; const EmployeeProfile = () => { + const { profile } = useProfile(); + const projectID = useSelector((store) => store.localVariables.projectId); const { employeeId } = useParams(); // const {employee,loading} = useEmployeeProfile(employeeId) @@ -97,28 +101,28 @@ const EmployeeProfile = () => { if (loading) { return
Loading...
; } -const { openChangePassword } = useChangePassword(); + const { openChangePassword } = useChangePassword(); return ( - <> {showModal && (
-
+ <> + {" "} + {showModal && (
- +
+
+ +
+
-
-
)} - + )}
- Gender: + + Gender: + {currentEmployee?.gender || NA} @@ -231,9 +237,13 @@ const { openChangePassword } = useChangePassword(); - Address: + + Address: + - {currentEmployee?.currentAddress || NA} + {currentEmployee?.currentAddress || ( + NA + )} @@ -245,15 +255,14 @@ const { openChangePassword } = useChangePassword(); > Edit Profile - - - - + {currentEmployee?.id == profile?.employeeInfo?.id && ( + + )}
@@ -276,7 +285,6 @@ const { openChangePassword } = useChangePassword(); - ); };