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. 43
      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) => { const handleClickSchoolItem = (item) => {
saveCurrentState() saveCurrentState()
history.push(replacePathParams(PATH.home.detailSchool, {schoolId: item?.organization_id}) + const schoolId = item?.organization_id;
"?school_name=" + const schoolName = encodeURIComponent(item?.organization_name);
encodeURIComponent(item?.organization_name)); const detailPath = replacePathParams(PATH.home.detailSchool, { schoolId});
history.push({
pathname: detailPath,
search: `?school_name=${schoolName}`,
state: { isBack: true }
});
}; };
const handleSubmit = () => { const handleSubmit = () => {

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

@ -29,6 +29,10 @@
.detail-room-education-right-p-h { .detail-room-education-right-p-h {
padding-right: 32px; padding-right: 32px;
} }
.detail-room-education-list-header{
justify-content: space-between;
margin-right: 32px;
}
.detail-room-education-list-container { .detail-room-education-list-container {
padding: 2rem 0; padding: 2rem 0;

@ -16,7 +16,7 @@ import $ from "jquery";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
export default function DetailRoomEducation() { export default function DetailRoomEducation() {
const {idRoom} = useParams() const {idRoom,isBack} = useParams()
const grade = useSelector((state) => state.grade); const grade = useSelector((state) => state.grade);
const authentication = useSelector((state) => state.authentication); const authentication = useSelector((state) => state.authentication);
const [dateStudentChart, setDateStudentChart] = useState(new Date()) const [dateStudentChart, setDateStudentChart] = useState(new Date())
@ -190,9 +190,15 @@ export default function DetailRoomEducation() {
} }
const goToDetailSchool = (item) => { const goToDetailSchool = (item) => {
history.push(replacePathParams(PATH.home.detailSchool, {schoolId: item?.organization_id}) + const schoolId = item?.organization_id;
"?school_name=" + const schoolName = encodeURIComponent(item?.organization_name);
encodeURIComponent(item?.organization_name)); const detailPath = replacePathParams(PATH.home.detailSchool, { schoolId});
history.push({
pathname: detailPath,
search: `?school_name=${schoolName}`,
state: { isBack: true }
});
} }
useEffect(() => { useEffect(() => {
@ -279,6 +285,27 @@ export default function DetailRoomEducation() {
setIsLoading(false); 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 ( return (
<div className="flex-1"> <div className="flex-1">
@ -286,6 +313,7 @@ export default function DetailRoomEducation() {
icon={renderIconHome({ color: "#4D4D4D" })} icon={renderIconHome({ color: "#4D4D4D" })}
title={"Phòng giáo dục " + authentication.user.province} title={"Phòng giáo dục " + authentication.user.province}
manager={true} manager={true}
isBack={isBack}
/> />
<div className="container-page-header container-page-sidebar"> <div className="container-page-header container-page-sidebar">
<div className="detail-room-education-container bg-sub-main-green-img"> <div className="detail-room-education-container bg-sub-main-green-img">
@ -335,7 +363,12 @@ export default function DetailRoomEducation() {
</div> </div>
<div className="detail-room-education-right-side"> <div className="detail-room-education-right-side">
<div className="detail-room-education-list-container"> <div className="detail-room-education-list-container">
<span style={{fontSize: '2rem', fontWeight: 700, padding: '0 3.2rem'}}>Danh sách trường</span> <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'}}> <div className="flex gap-16 align-item-center" style={{padding: '1rem 3.2rem'}}>
<RootSelect <RootSelect
data={LIST_SCHOOL_YEAR} data={LIST_SCHOOL_YEAR}

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

@ -13,7 +13,7 @@ import {
TYPE_DISPATCH, TYPE_DISPATCH,
} from "../../../_constants/common"; } from "../../../_constants/common";
import { apiCaller, history } from "../../../_helpers"; 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 { exportExcel, replacePathParams } from "../../../_helpers/utils";
import { configConstants, PATH } from "../../../_constants"; import { configConstants, PATH } from "../../../_constants";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
@ -28,7 +28,8 @@ export default function HeadmasterHome() {
const params = new URLSearchParams(search); const params = new URLSearchParams(search);
const school_name = params.get("school_name"); const school_name = params.get("school_name");
const {schoolId} = useParams(); const {schoolId} = useParams();
const location = useLocation();
const isBack = location.state?.isBack;
const authentication = useSelector((state) => state.authentication); const authentication = useSelector((state) => state.authentication);
const grade = useSelector((state) => state.grade); const grade = useSelector((state) => state.grade);
const dispatch = useDispatch() const dispatch = useDispatch()
@ -254,7 +255,7 @@ export default function HeadmasterHome() {
<Header <Header
icon={renderIconHome({ color: "#4D4D4D" })} icon={renderIconHome({ color: "#4D4D4D" })}
title={schoolName} title={schoolName}
isBack={true} isBack={isBack}
/> />
<div className="container-page-header container-page-sidebar"> <div className="container-page-header container-page-sidebar">
<div className="headmaster-home-container bg-main-img"> <div className="headmaster-home-container bg-main-img">

Loading…
Cancel
Save