import React,{useState,useEffect} from "react"; 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 { getCachedData } from "../../slices/apiDataManager"; import { useEmployeeProfile, useEmployees, useEmployeesByProject } from "../../hooks/useEmployees"; import { useSelector } from "react-redux"; import EmployeeRepository from "../../repositories/EmployeeRepository"; const EmployeeProfile = () => { const projectID = useSelector((store)=>store.localVariables.projectId) const {employeeId} = useParams(); // const {employee,loading} = useEmployeeProfile(employeeId) const [loading,setLoading] = useState(true) const [SearchParams] = useSearchParams() const tab = SearchParams.get( "for" ) const [activePill, setActivePill] = useState(tab); 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 ) { console.log( "Faild to fetch employee data,", err ) setLoading(false) } } useEffect(() => { if ( employeeId ) { fetchEmployeeProfile(employeeId) } }, [employeeId]); const renderContent = () => { if (loading) return
Account
{/*attendance component
{/* Teams */}activites components
); break; } default: returnWe're currently working on this feature and will have it ready shortly. Thank you for your patience!
{`${currentEmployee?.firstName} ${currentEmployee?.lastName}`}