after refresh attednace page, now it able get employee default selectedproject. #63
@ -93,13 +93,14 @@ const AttendancePage = () => {
|
||||
}, [modelConfig, isCreateModalOpen]);
|
||||
useEffect(() => {
|
||||
setAttendances(attendance);
|
||||
}, [attendance]);
|
||||
useEffect(()=>{
|
||||
if(selectedProject == 1){
|
||||
dispatch(setProjectId(loginUser?.projects[0]))
|
||||
console.log(loginUser?.projects);
|
||||
}
|
||||
},[selectedProject,loginUser?.projects])
|
||||
}, [ attendance ] );
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedProject === 1 || selectedProject === undefined ) {
|
||||
dispatch(setProjectId(loginUser?.projects[0]));
|
||||
}
|
||||
}, [selectedProject, loginUser?.projects]);
|
||||
return (
|
||||
<>
|
||||
{isCreateModalOpen && modelConfig && (
|
||||
@ -159,7 +160,6 @@ useEffect(()=>{
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
|
||||
</div>
|
||||
</ul>
|
||||
<ul className="nav nav-tabs" role="tablist">
|
||||
@ -204,13 +204,18 @@ useEffect(()=>{
|
||||
{!projectLoading && !attendances && <span>Not Found</span>}
|
||||
|
||||
{activeTab === "all" && (
|
||||
<div className="tab-pane fade show active py-0">
|
||||
<Attendance
|
||||
attendance={attendances}
|
||||
handleModalData={handleModalData}
|
||||
getRole={getRole}
|
||||
/>
|
||||
</div>
|
||||
<>
|
||||
{!projectLoading && attendances.length === 0 && (
|
||||
<p>No Employee assigned yet.</p>
|
||||
)}
|
||||
<div className="tab-pane fade show active py-0">
|
||||
<Attendance
|
||||
attendance={attendances}
|
||||
handleModalData={handleModalData}
|
||||
getRole={getRole}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{activeTab === "logs" && (
|
||||
|
Loading…
x
Reference in New Issue
Block a user