diff --git a/src/_screens/home/detail-room-education/detailRoomEducation.style.scss b/src/_screens/home/detail-room-education/detailRoomEducation.style.scss
index 84d9315..dc9e28b 100644
--- a/src/_screens/home/detail-room-education/detailRoomEducation.style.scss
+++ b/src/_screens/home/detail-room-education/detailRoomEducation.style.scss
@@ -29,6 +29,10 @@
.detail-room-education-right-p-h {
padding-right: 32px;
}
+ .detail-room-education-list-header{
+ justify-content: space-between;
+ margin-right: 32px;
+ }
.detail-room-education-list-container {
padding: 2rem 0;
diff --git a/src/_screens/home/detail-room-education/index.js b/src/_screens/home/detail-room-education/index.js
index 033f92d..a02623a 100644
--- a/src/_screens/home/detail-room-education/index.js
+++ b/src/_screens/home/detail-room-education/index.js
@@ -16,7 +16,7 @@ import $ from "jquery";
import { useParams } from "react-router-dom";
export default function DetailRoomEducation() {
- const {idRoom} = useParams()
+ const {idRoom,isBack} = useParams()
const grade = useSelector((state) => state.grade);
const authentication = useSelector((state) => state.authentication);
const [dateStudentChart, setDateStudentChart] = useState(new Date())
@@ -190,9 +190,15 @@ export default function DetailRoomEducation() {
}
const goToDetailSchool = (item) => {
- history.push(replacePathParams(PATH.home.detailSchool, {schoolId: item?.organization_id}) +
- "?school_name=" +
- encodeURIComponent(item?.organization_name));
+ const schoolId = item?.organization_id;
+ const schoolName = encodeURIComponent(item?.organization_name);
+ const detailPath = replacePathParams(PATH.home.detailSchool, { schoolId});
+
+ history.push({
+ pathname: detailPath,
+ search: `?school_name=${schoolName}`,
+ state: { isBack: true }
+ });
}
useEffect(() => {
@@ -279,6 +285,27 @@ export default function DetailRoomEducation() {
setIsLoading(false);
}
};
+ const handleExport = () => {
+ const listHeader = [
+ 'Stt',
+ 'Tên trường',
+ 'Tiêu chí giao bài',
+ 'Tiêu chú tỷ lệ học sinh làm bài',
+ 'Mức độ hoàn thành tiêu chí',
+ 'Huyện',
+ 'Tỉnh'
+ ];
+ const listData = listOrganization.map((item, index) => [
+ index + 1,
+ item.organization_name || '',
+ item.criteria_level || 0,
+ item.student_done_per_level || 0,
+ item.assign_number_level || 0,
+ item.district || '',
+ item.province || '',
+ ]);
+ exportExcel(listHeader, listData, `Danh sách trường.xlsx`);
+ };
return (
@@ -286,6 +313,7 @@ export default function DetailRoomEducation() {
icon={renderIconHome({ color: "#4D4D4D" })}
title={"Phòng giáo dục " + authentication.user.province}
manager={true}
+ isBack={isBack}
/>
@@ -335,7 +363,12 @@ export default function DetailRoomEducation() {
-
Danh sách trường
+
+
Danh sách trường
+
+ Xuất excel
+
+
{
- history.push(replacePathParams(PATH.home.detailRoomEducation, {idRoom: item?.id}))
+ history.push(replacePathParams(PATH.home.detailRoomEducation, {idRoom: item?.id, isBack: true}))
}
useEffect(() => {
diff --git a/src/_screens/home/headmaster/index.js b/src/_screens/home/headmaster/index.js
index d1bd908..bcdab99 100644
--- a/src/_screens/home/headmaster/index.js
+++ b/src/_screens/home/headmaster/index.js
@@ -13,7 +13,7 @@ import {
TYPE_DISPATCH,
} from "../../../_constants/common";
import { apiCaller, history } from "../../../_helpers";
-import { useParams } from "react-router-dom";
+import { useLocation, useParams } from "react-router-dom";
import { exportExcel, replacePathParams } from "../../../_helpers/utils";
import { configConstants, PATH } from "../../../_constants";
import { useDispatch, useSelector } from "react-redux";
@@ -28,7 +28,8 @@ export default function HeadmasterHome() {
const params = new URLSearchParams(search);
const school_name = params.get("school_name");
const {schoolId} = useParams();
-
+ const location = useLocation();
+ const isBack = location.state?.isBack;
const authentication = useSelector((state) => state.authentication);
const grade = useSelector((state) => state.grade);
const dispatch = useDispatch()
@@ -254,7 +255,7 @@ export default function HeadmasterHome() {