|
|
@ -15,7 +15,7 @@ import { |
|
|
|
listAlphabet, |
|
|
|
listAlphabet, |
|
|
|
PRIMARY_COLOR, |
|
|
|
PRIMARY_COLOR, |
|
|
|
} from "../../../_constants/common"; |
|
|
|
} from "../../../_constants/common"; |
|
|
|
import { useEffect, useState } from "react"; |
|
|
|
import { useEffect, useState,useRef } from "react"; |
|
|
|
import { apiCaller, history } from "../../../_helpers"; |
|
|
|
import { apiCaller, history } from "../../../_helpers"; |
|
|
|
import { configConstants } from "../../../_constants"; |
|
|
|
import { configConstants } from "../../../_constants"; |
|
|
|
import { exportExcel } from "../../../_helpers/utils"; |
|
|
|
import { exportExcel } from "../../../_helpers/utils"; |
|
|
@ -41,12 +41,21 @@ export default function TeacherHome() { |
|
|
|
const [isEndOnlineClasses, setIsEndOnlineClasses] = useState(false); |
|
|
|
const [isEndOnlineClasses, setIsEndOnlineClasses] = useState(false); |
|
|
|
const [totalClass, setTotalClass] = useState(0) |
|
|
|
const [totalClass, setTotalClass] = useState(0) |
|
|
|
const [totalAssign, settotalAssign] = useState(0) |
|
|
|
const [totalAssign, settotalAssign] = useState(0) |
|
|
|
|
|
|
|
const listRef = useRef(null) |
|
|
|
|
|
|
|
|
|
|
|
const teacherName = !!teacherId |
|
|
|
const teacherName = !!teacherId |
|
|
|
? !!teacher_name ? decodeURIComponent(teacher_name) : '' |
|
|
|
? !!teacher_name ? decodeURIComponent(teacher_name) : '' |
|
|
|
: authentication?.user?.fullname; |
|
|
|
: authentication?.user?.fullname; |
|
|
|
const id = !!teacherId ? teacherId : authentication?.user?.id; |
|
|
|
const id = !!teacherId ? teacherId : authentication?.user?.id; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const scrollToTop = () => { |
|
|
|
|
|
|
|
if (listRef.current) { |
|
|
|
|
|
|
|
listRef.current.scrollTo({ |
|
|
|
|
|
|
|
top: 0, |
|
|
|
|
|
|
|
behavior: 'smooth',
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
const getData = async () => { |
|
|
|
const getData = async () => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
setIsLoading(true); |
|
|
|
setIsLoading(true); |
|
|
@ -88,6 +97,8 @@ export default function TeacherHome() { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const handleFilter = () => { |
|
|
|
const handleFilter = () => { |
|
|
|
|
|
|
|
scrollToTop() |
|
|
|
|
|
|
|
setOffsetOnline(0) |
|
|
|
setLoadMoreOnline(true) |
|
|
|
setLoadMoreOnline(true) |
|
|
|
setIsEndOnlineClasses(false) |
|
|
|
setIsEndOnlineClasses(false) |
|
|
|
setListClass([]) |
|
|
|
setListClass([]) |
|
|
@ -270,7 +281,7 @@ export default function TeacherHome() { |
|
|
|
<PrimaryButton onClick={handleExport}>Xuất excel</PrimaryButton> |
|
|
|
<PrimaryButton onClick={handleExport}>Xuất excel</PrimaryButton> |
|
|
|
)} |
|
|
|
)} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div onScroll={handleScroll} className="teacher-home-list-class teacher-home-right-p-h scrollbar-custom"> |
|
|
|
<div ref={listRef} onScroll={handleScroll} className="teacher-home-list-class teacher-home-right-p-h scrollbar-custom"> |
|
|
|
{listClass?.map((item) => { |
|
|
|
{listClass?.map((item) => { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div className="teacher-home-item-class" key={item?.class_id}> |
|
|
|
<div className="teacher-home-item-class" key={item?.class_id}> |
|
|
|