|
|
@ -34,6 +34,11 @@ export default function DetailRoomEducation() { |
|
|
|
const [isLoadingStatisticCircle, setIsLoadingStatisticCircle] = useState(false); |
|
|
|
const [isLoadingStatisticCircle, setIsLoadingStatisticCircle] = useState(false); |
|
|
|
const [isLoadingStudentChart, setIsLoadingStudentChart] = useState(false); |
|
|
|
const [isLoadingStudentChart, setIsLoadingStudentChart] = useState(false); |
|
|
|
const [isLoadingTeacherChart, setIsLoadingTeacherChart] = useState(false); |
|
|
|
const [isLoadingTeacherChart, setIsLoadingTeacherChart] = useState(false); |
|
|
|
|
|
|
|
const [isLoadMoreOnline, setLoadMoreOnline] = useState(true); |
|
|
|
|
|
|
|
const [limitOnline] = useState(10); |
|
|
|
|
|
|
|
const [offsetOnline, setOffsetOnline] = useState(0); |
|
|
|
|
|
|
|
const [isEndOnlineClasses, setIsEndOnlineClasses] = useState(false); |
|
|
|
|
|
|
|
const [isLoading, setIsLoading] = useState(false); |
|
|
|
|
|
|
|
|
|
|
|
const getListOrganization = async () => { |
|
|
|
const getListOrganization = async () => { |
|
|
|
try { |
|
|
|
try { |
|
|
@ -211,6 +216,69 @@ export default function DetailRoomEducation() { |
|
|
|
} |
|
|
|
} |
|
|
|
}, [isLoadingListOrganization, isLoadingStatisticCircle, isLoadingStudentChart, isLoadingTeacherChart]) |
|
|
|
}, [isLoadingListOrganization, isLoadingStatisticCircle, isLoadingStudentChart, isLoadingTeacherChart]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleScroll = (e) => { |
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
e.target.scrollHeight - e.target.scrollTop < e.target.clientHeight + 5 && |
|
|
|
|
|
|
|
isLoadMoreOnline && |
|
|
|
|
|
|
|
!isLoading |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
if(listOrganization.length < limitOnline) return |
|
|
|
|
|
|
|
onLoadMoreClasses(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Load More Classes for Teacher
|
|
|
|
|
|
|
|
const onLoadMoreClasses = async () => { |
|
|
|
|
|
|
|
let offsetOnlineMore = offsetOnline + limitOnline; |
|
|
|
|
|
|
|
let listNext = []; |
|
|
|
|
|
|
|
setIsLoading(true); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
if (!isEndOnlineClasses) { |
|
|
|
|
|
|
|
const endPoint = `/report/api_report/getListOrganizationFromDistrictOrganization?organization_id=${ |
|
|
|
|
|
|
|
idRoom |
|
|
|
|
|
|
|
}${ |
|
|
|
|
|
|
|
!!schoolYear?.value ? `&year=${schoolYear?.value}` : "" |
|
|
|
|
|
|
|
}${ |
|
|
|
|
|
|
|
!!semester?.value ? `&semester=${semester?.value}` : "" |
|
|
|
|
|
|
|
}${ |
|
|
|
|
|
|
|
!!month?.value ? `&month=${month?.value}` : "" |
|
|
|
|
|
|
|
}&limit=${limitOnline}&offset=${offsetOnlineMore}`;
|
|
|
|
|
|
|
|
const res = await apiCaller( |
|
|
|
|
|
|
|
endPoint,
|
|
|
|
|
|
|
|
"GET", |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
null, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
configConstants.API_URL_SETEST, |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
// const endPoint = `/report/api_report/getOrganizationAndCriteria?limit=${limitOnline}&offset=${offsetOnlineMore}${
|
|
|
|
|
|
|
|
// queryParams.length ? `&${queryParams.join("&")}` : ""
|
|
|
|
|
|
|
|
// }`;
|
|
|
|
|
|
|
|
// const res = await apiCaller(endPoint, "GET");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!res.data){ |
|
|
|
|
|
|
|
setIsEndOnlineClasses(true); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
listNext = res?.data; |
|
|
|
|
|
|
|
setOffsetOnline(offsetOnline + limitOnline); |
|
|
|
|
|
|
|
if (res?.data?.length < limitOnline) { |
|
|
|
|
|
|
|
setLoadMoreOnline(false); |
|
|
|
|
|
|
|
if (res?.data?.length == 0) setLoadMoreOnline(false); |
|
|
|
|
|
|
|
setIsEndOnlineClasses(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
setIsEndOnlineClasses(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let listPrev = listOrganization; |
|
|
|
|
|
|
|
setListOrganization(listPrev?.concat(listNext)); |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
setIsLoading(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div className="flex-1"> |
|
|
|
<div className="flex-1"> |
|
|
@ -273,25 +341,25 @@ export default function DetailRoomEducation() { |
|
|
|
data={LIST_SCHOOL_YEAR} |
|
|
|
data={LIST_SCHOOL_YEAR} |
|
|
|
value={schoolYear} |
|
|
|
value={schoolYear} |
|
|
|
setValue={setSchoolYear} |
|
|
|
setValue={setSchoolYear} |
|
|
|
style={{flex: 1}} |
|
|
|
style={{flex: 1,maxWidth: '260px'}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<RootSelect |
|
|
|
<RootSelect |
|
|
|
data={LIST_SEMESTER} |
|
|
|
data={LIST_SEMESTER} |
|
|
|
value={semester} |
|
|
|
value={semester} |
|
|
|
setValue={changeSemester} |
|
|
|
setValue={changeSemester} |
|
|
|
style={{flex: 0.5}} |
|
|
|
style={{flex: 0.5,maxWidth: '200px'}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<RootSelect |
|
|
|
<RootSelect |
|
|
|
data={getListMonthBySemester(semester.value)} |
|
|
|
data={getListMonthBySemester(semester.value)} |
|
|
|
value={month} |
|
|
|
value={month} |
|
|
|
setValue={setMonth} |
|
|
|
setValue={setMonth} |
|
|
|
style={{flex: 0.5}} |
|
|
|
style={{flex: 0.5,maxWidth: '160px'}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<PrimaryButton onClick={handleFilter}> |
|
|
|
<PrimaryButton onClick={handleFilter}> |
|
|
|
Áp dụng |
|
|
|
Áp dụng |
|
|
|
</PrimaryButton> |
|
|
|
</PrimaryButton> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="detail-room-education-list detail-room-education-right-p-h scrollbar-custom"> |
|
|
|
<div onScroll={handleScroll} className="detail-room-education-list detail-room-education-right-p-h scrollbar-custom"> |
|
|
|
{!isLoadingListOrganization && !listOrganization?.length && ( |
|
|
|
{!isLoadingListOrganization && !listOrganization?.length && ( |
|
|
|
<p style={{fontSize: '1.8rem', fontWeight: 700}}> |
|
|
|
<p style={{fontSize: '1.8rem', fontWeight: 700}}> |
|
|
|
Không có trường nào |
|
|
|
Không có trường nào |
|
|
|