Feat : button quay lại

uat
Quy_FE 3 months ago
parent 86a9f2f437
commit 4ccc74e332
  1. 12
      src/_screens/home/admin/index.js
  2. 1
      src/_screens/home/detail-grade/index.js
  3. 4
      src/_screens/home/detail-room-education/detailRoomEducation.style.scss
  4. 41
      src/_screens/home/detail-room-education/index.js
  5. 2
      src/_screens/home/education-department/index.js
  6. 7
      src/_screens/home/headmaster/index.js

@ -189,9 +189,15 @@ export default function AdminHome() {
const handleClickSchoolItem = (item) => {
saveCurrentState()
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 }
});
};
const handleSubmit = () => {

@ -196,6 +196,7 @@ export default function DetailGrade() {
icon={renderIconHome({ color: "#4D4D4D" })}
title={schoolName}
subtitles={[gradeName]}
isBack={true}
/>
<div className="container-page-header container-page-sidebar">
<div className="detail-grade-container bg-main-img">

@ -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;

@ -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 (
<div className="flex-1">
@ -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}
/>
<div className="container-page-header container-page-sidebar">
<div className="detail-room-education-container bg-sub-main-green-img">
@ -335,7 +363,12 @@ export default function DetailRoomEducation() {
</div>
<div className="detail-room-education-right-side">
<div className="detail-room-education-list-container">
<div className="d-flex detail-room-education-list-header">
<span style={{fontSize: '2rem', fontWeight: 700, padding: '0 3.2rem'}}>Danh sách trường</span>
<PrimaryButton onClick={handleExport}>
Xuất excel
</PrimaryButton>
</div>
<div className="flex gap-16 align-item-center" style={{padding: '1rem 3.2rem'}}>
<RootSelect
data={LIST_SCHOOL_YEAR}

@ -83,7 +83,7 @@ export default function EducationDepartmentHome() {
}
const goToDetailRoomEducation = (item) => {
history.push(replacePathParams(PATH.home.detailRoomEducation, {idRoom: item?.id}))
history.push(replacePathParams(PATH.home.detailRoomEducation, {idRoom: item?.id, isBack: true}))
}
useEffect(() => {

@ -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() {
<Header
icon={renderIconHome({ color: "#4D4D4D" })}
title={schoolName}
isBack={true}
isBack={isBack}
/>
<div className="container-page-header container-page-sidebar">
<div className="headmaster-home-container bg-main-img">

Loading…
Cancel
Save