diff --git a/src/pages/employee/EmployeeProfile.jsx b/src/pages/employee/EmployeeProfile.jsx
index 8bf3e7f5..a215bba0 100644
--- a/src/pages/employee/EmployeeProfile.jsx
+++ b/src/pages/employee/EmployeeProfile.jsx
@@ -3,9 +3,13 @@ import EmpProfile from "../../components/Employee/EmpProfile";
import axios from "axios";
import Breadcrumb from "../../components/common/Breadcrumb";
import EmployeeNav from "../../components/Employee/EmployeeNav";
-import { useSearchParams,useParams } from "react-router-dom";
+import { useSearchParams, useParams } from "react-router-dom";
import { getCachedData } from "../../slices/apiDataManager";
-import { useEmployeeProfile, useEmployees, useEmployeesByProject } from "../../hooks/useEmployees";
+import {
+ useEmployeeProfile,
+ useEmployees,
+ useEmployeesByProject,
+} from "../../hooks/useEmployees";
import { useSelector } from "react-redux";
import EmployeeRepository from "../../repositories/EmployeeRepository";
import { ComingSoonPage } from "../Misc/ComingSoonPage";
@@ -13,41 +17,33 @@ import { useNavigate } from "react-router-dom";
import Avatar from "../../components/common/Avatar";
import AttendancesEmployeeRecords from "./AttendancesEmployeeRecords";
const EmployeeProfile = () => {
-
- const projectID = useSelector((store)=>store.localVariables.projectId)
- const {employeeId} = useParams();
+ const projectID = useSelector((store) => store.localVariables.projectId);
+ const { employeeId } = useParams();
// const {employee,loading} = useEmployeeProfile(employeeId)
- const [loading,setLoading] = useState(true)
+ const [loading, setLoading] = useState(true);
- const [SearchParams] = useSearchParams()
- const tab = SearchParams.get( "for" )
+ const [SearchParams] = useSearchParams();
+ const tab = SearchParams.get("for");
const [activePill, setActivePill] = useState(tab);
- const[currentEmployee,setCurrentEmployee] = useState()
+ const [currentEmployee, setCurrentEmployee] = useState();
-
const handlePillClick = (pillKey) => {
setActivePill(pillKey);
};
- const fetchEmployeeProfile = async( employeeID ) =>
- {
- try
- {
- const resp = await EmployeeRepository.getEmployeeProfile( employeeID )
- setCurrentEmployee( resp.data )
- setLoading(false)
-
- } catch ( err )
- {
- setLoading(false)
-
+ const fetchEmployeeProfile = async (employeeID) => {
+ try {
+ const resp = await EmployeeRepository.getEmployeeProfile(employeeID);
+ setCurrentEmployee(resp.data);
+ setLoading(false);
+ } catch (err) {
+ setLoading(false);
}
- }
+ };
useEffect(() => {
- if ( employeeId )
- {
- fetchEmployeeProfile(employeeId)
+ if (employeeId) {
+ fetchEmployeeProfile(employeeId);
}
}, [employeeId]);
@@ -58,42 +54,40 @@ const EmployeeProfile = () => {
case "attendance": {
return (
<>
-
-
+
>
);
}
case "dcoument": {
return (
<>
-
- >
+
+ >
);
break;
}
case "activities": {
return (
<>
-
- >
+
+ >
);
break;
}
default:
- return <>
-
- >;
+ return (
+ <>
+
+ >
+ );
}
};
-
-
if (loading) {
return
Loading...
;
}
-
return (
{
-
Employee Info
+
+ Employee Info
+
Email: |
- {currentEmployee?.email || NA} |
+
+ {currentEmployee?.email || NA}
+ |
- Phone Number: |
- {currentEmployee?.phoneNumber || NA} |
+
+ Phone Number:
+ |
+
+ {currentEmployee?.phoneNumber || NA}
+ |
- Emergency Contact Person: |
- {currentEmployee?.emergencyContactPerson || NA} |
+
+ Emergency Contact Person:
+ |
+
+ {currentEmployee?.emergencyContactPerson || (
+ NA
+ )}
+ |
- Emergency Contact Number: |
- {currentEmployee?.emergencyPhoneNumber || NA} |
+
+ Emergency Contact Number:
+ |
+
+ {currentEmployee?.emergencyPhoneNumber || (
+ NA
+ )}
+ |
Gender: |
- {currentEmployee?.gender || NA} |
+
+ {currentEmployee?.gender || NA}
+ |
- Birth Date: |
- {currentEmployee?.birthDate ? new Date(currentEmployee.birthDate).toLocaleDateString() : NA} |
+
+ Birth Date:
+ |
+
+ {currentEmployee?.birthDate ? (
+ new Date(
+ currentEmployee.birthDate
+ ).toLocaleDateString()
+ ) : (
+ NA
+ )}
+ |
-
- Joining Date: |
- {currentEmployee?.joiningDate ? new Date(currentEmployee.joiningDate).toLocaleDateString() : NA} |
+
+ Joining Date:
+ |
+
+ {currentEmployee?.joiningDate ? (
+ new Date(
+ currentEmployee.joiningDate
+ ).toLocaleDateString()
+ ) : (
+ NA
+ )}
+ |
- Job Role: |
- {currentEmployee?.jobRole || NA} |
+
+ Job Role:
+ |
+
+ {currentEmployee?.jobRole || NA}
+ |
Address: |
- {currentEmployee?.currentAddress || NA} |
+
+ {currentEmployee?.currentAddress || NA}
+ |
-