diff --git a/src/pages/authentication/ChangePassword.jsx b/src/pages/authentication/ChangePassword.jsx index a0b7cebd..753340e4 100644 --- a/src/pages/authentication/ChangePassword.jsx +++ b/src/pages/authentication/ChangePassword.jsx @@ -212,15 +212,16 @@ const ChangePasswordPage = ({ onClose }) => {

Password must be:

- at least 8 characters long

- - must contain at least one uppercase letter + - must contain one uppercase, one lowercase letter, at least one + number, at least one special character

-

+ {/*

- must contain at least one lowercase letter

- must contain at least one number

- must contain at least one special character -

+

*/} diff --git a/src/pages/employee/EmployeeProfile.jsx b/src/pages/employee/EmployeeProfile.jsx index 4de20675..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"; @@ -17,7 +19,11 @@ 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 { profile } = useProfile(); + const projectID = useSelector((store) => store.localVariables.projectId); const { employeeId } = useParams(); // const {employee,loading} = useEmployeeProfile(employeeId) @@ -27,17 +33,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,179 +101,190 @@ const EmployeeProfile = () => { if (loading) { return
Loading...
; } - + const { openChangePassword } = useChangePassword(); return ( - <> {showModal && (
-
-
- + <> + {" "} + {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 - )} -
+ 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} -
+ + + Joining Date: + + + {currentEmployee?.joiningDate ? ( + new Date( + currentEmployee.joiningDate + ).toLocaleDateString() + ) : ( + NA + )} + + + + + Job Role: + + + {currentEmployee?.jobRole || NA} + + + + + Address: + + + {currentEmployee?.currentAddress || ( + NA + )} + + + + +
+ + {currentEmployee?.id == profile?.employeeInfo?.id && ( + + )}
-
-
-
-
- -
-
-
{renderContent()}
+
+
+ +
+
+
{renderContent()}
+
-
- ); };