From a480c3b111403e39202e065d9ee66374877570ae Mon Sep 17 00:00:00 2001 From: Umesh Desai Date: Tue, 10 Jun 2025 12:39:34 +0530 Subject: [PATCH] Adding Change Password button on Employee Profile Page. --- src/pages/employee/EmployeeProfile.jsx | 325 +++++++++++++------------ 1 file changed, 167 insertions(+), 158 deletions(-) diff --git a/src/pages/employee/EmployeeProfile.jsx b/src/pages/employee/EmployeeProfile.jsx index 4de20675..a4ad6aba 100644 --- a/src/pages/employee/EmployeeProfile.jsx +++ b/src/pages/employee/EmployeeProfile.jsx @@ -17,6 +17,8 @@ import { useNavigate } from "react-router-dom"; import Avatar from "../../components/common/Avatar"; import AttendancesEmployeeRecords from "./AttendancesEmployeeRecords"; import ManageEmployee from "../../components/Employee/ManageEmployee"; +import { useChangePassword } from "../../components/Context/ChangePasswordContext"; + const EmployeeProfile = () => { const projectID = useSelector((store) => store.localVariables.projectId); const { employeeId } = useParams(); @@ -27,17 +29,17 @@ const EmployeeProfile = () => { const tab = SearchParams.get("for"); const [activePill, setActivePill] = useState(tab); const [currentEmployee, setCurrentEmployee] = useState(); - const [showModal, setShowModal] = useState(false); + const [showModal, setShowModal] = useState(false); const handlePillClick = (pillKey) => { setActivePill(pillKey); }; - const closeModal = () => { - setShowModal(false); - fetchEmployeeProfile(employeeId); - }; - const handleShow = () => setShowModal(true); + const closeModal = () => { + setShowModal(false); + fetchEmployeeProfile(employeeId); + }; + const handleShow = () => setShowModal(true); const fetchEmployeeProfile = async (employeeID) => { try { @@ -95,177 +97,184 @@ const EmployeeProfile = () => { if (loading) { return
Loading...
; } - +const { openChangePassword } = useChangePassword(); return ( <> {showModal && (
-
-
- -
+ className={`modal fade ${showModal ? "show" : ""} `} + tabIndex="-1" + role="dialog" + style={{ display: showModal ? "block" : "none" }} + aria-hidden={!showModal} + > +
+
+
-
)} +
+
)} -
- +
+ -
-
-
-
-
-
-
-
- -
-

{`${currentEmployee?.firstName} ${currentEmployee?.lastName}`}

+
+
+
+
+
+
+
+
+ +
+

{`${currentEmployee?.firstName} ${currentEmployee?.lastName}`}

+
-
-
-
-
- Employee Info -
- - - - - - - - - - - - - - - - - - +
+
+
+ Employee Info +
+
Email: - {currentEmployee?.email || NA} -
- Phone Number: - - {currentEmployee?.phoneNumber || NA} -
- Emergency Contact Person: - - {currentEmployee?.emergencyContactPerson || ( - NA - )} -
- Emergency Contact Number: - - {currentEmployee?.emergencyPhoneNumber || ( - NA - )} -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Email: + {currentEmployee?.email || NA} +
+ Phone Number: + + {currentEmployee?.phoneNumber || NA} +
+ Emergency Contact Person: + + {currentEmployee?.emergencyContactPerson || ( + NA + )} +
+ Emergency Contact Number: + + {currentEmployee?.emergencyPhoneNumber || ( + NA + )} +
Gender: + {currentEmployee?.gender || NA} +
+ Birth Date: + + {currentEmployee?.birthDate ? ( + new Date( + currentEmployee.birthDate + ).toLocaleDateString() + ) : ( + NA + )} +
+ Joining Date: + + {currentEmployee?.joiningDate ? ( + new Date( + currentEmployee.joiningDate + ).toLocaleDateString() + ) : ( + NA + )} +
+ Job Role: + + {currentEmployee?.jobRole || NA} +
Address: + {currentEmployee?.currentAddress || NA} +
+
+ + + - - Gender: - - {currentEmployee?.gender || NA} - - - - - Birth Date: - - - {currentEmployee?.birthDate ? ( - new Date( - currentEmployee.birthDate - ).toLocaleDateString() - ) : ( - NA - )} - - - - - Joining Date: - - - {currentEmployee?.joiningDate ? ( - new Date( - currentEmployee.joiningDate - ).toLocaleDateString() - ) : ( - NA - )} - - - - - Job Role: - - - {currentEmployee?.jobRole || NA} - - - - Address: - - {currentEmployee?.currentAddress || NA} - - - -
-
-
-
-
- -
-
-
{renderContent()}
+
+
+ +
+
+
{renderContent()}
+
-
);