You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

236 lines
8.1 KiB

import "./index.css";
import { connect, useSelector } from "react-redux";
import { useState } from "react";
import img0 from "../../../../assets/azmoon-list/test.png";
import icon1 from "../../../../assets/azmoon-list/stickynote.png";
import icon2 from "../../../../assets/azmoon-list/teacher.png";
import icon3 from "../../../../assets/azmoon-list/clock.png";
import icon4 from "../../../../assets/azmoon-list/message-minus.png";
import icon5 from "../../../../assets/azmoon-list/Group893.png";
import icon6 from "../../../../assets/azmoon-list/people.png";
import icon7 from "../../../../assets/azmoon-list/profile-2user.png";
import icon8 from "../../../../assets/azmoon-list/message-text-2.png";
import avatar from "../../../../assets/azmoon-list/tushar-khandagale-dvtAuBHBAVQ-unsplash.jpg";
import { Link } from "react-router-dom";
import moment from "jalali-moment";
import { useEffect } from "react";
import { state } from "../../../../components/exam/Carousel/state";
import { exam } from "../../../../redux/actions";
let gradeList = [
"اول",
"دوم",
"سوم",
"چهارم",
"پنجم",
"ششم",
"هفتم",
"هشتم",
"نهم",
"دهم",
"یازدهم",
"دوازدهم",
];
const EnterExam = ({ ID, getExamInfo, examInfo }) => {
// const state = useSelector((state) => state.default);
console.log("Cheraaaaaaaaaaaaaa????????");
console.log(ID);
useEffect(() => {
getExamInfo({ id: ID });
}, []);
console.log(examInfo);
//------------------------------------------
const [common_data] = useState(state);
let data;
for (let i = 0; i < common_data.length; i++) {
if (common_data[i].id === Number(ID)) {
data = common_data[i];
}
}
console.log("cc:" + data);
//--today date--and timer setting-----------------------------
// let today = new Date();
// let examDate = new Date(data.date)
// let diff = (examDate-today)/1000;
// let d = Math.floor(diff/86400);
// let h = Math.floor((diff-(86400*d))/3600);
// let m = Math.floor((diff-(86400*d)-(h*3600))/60);
// let s = Math.floor(diff-(86400*d)-(h*3600)-(m*60));
// const [timer,setTimer]=useState({
// d,h,m,s
// })
useEffect(() => {
// console.log(sec);
// if (timer.s >= 0 && diff > 0) {
// setTimeout(() => {
// // console.log("okdkdokodkd");
// setTimer({
// d,
// h,
// m,
// s:s-1
// });
// if (timer.s === 0) {
// setTimer({
// d,
// h,
// m:m-1,
// s:59
// });
// }
// if (timer.m === 0) {
// setTimer({
// d,
// h:h-1,
// m:59,
// s:59
// });
// }
// if (timer.h === 0) {
// setTimer({
// d:d-1,
// h:23,
// m:59,
// s:59
// });
// }
// }, 1000);
// }
});
//-------------------------------------------
moment.locale("en");
return (
<div className="enter-exam">
<div
className="enter-exam-box"
style={window.innerWidth < 1000 ? { width: "95%" } : { width: "35%",height:"auto" }}
>
<div className="eeb-title-box">
<img className="eeb-title-box-img" src={img0} alt="title-box-img" />
<div className="eeb-title-box-title">به {examInfo?.name}</div>
<div className="eeb-title-box-subtitle">خوش آمدید</div>
</div>
<div className="eeb-name-box">
<img className="eeb-name-box-icon" src={icon1} alt="name-icon" />
<div className="eeb-name-box-label">نام آزمون:</div>
<div className="eeb-name-box-name">{examInfo?.name}</div>
</div>
<div className="eeb-level-box">
<img className="eeb-level-box-icon" src={icon2} alt="name-icon" />
<div className="eeb-level-box-label">پایه تحصیلی:</div>
<div className="eeb-level-box-level">
{gradeList[examInfo?.gradeId - 1]}
</div>
</div>
<div className="eeb-date-box">
<img className="eeb-date-box-icon" src={icon3} alt="name-icon" />
<div className="eeb-date-box-label">زمان آزمون:</div>
{examInfo?.startDate && (
<div className="eeb-date-box-date">
از{" "}
{examInfo?.startDate &&
moment(examInfo?.startDate, "YYYY/MM/DD")
.locale("fa")
.format("YYYY/MM/DD")}{" "}
تا{" "}
{examInfo?.endDate &&
moment(examInfo?.endDate, "YYYY/MM/DD")
.locale("fa")
.format("YYYY/MM/DD")}
</div>
)}
{!examInfo?.startDate && (
<div className="eeb-date-box-date">نامشخص</div>
)}
{/* <div className="eeb-date-box-time">
ساعت
</div> */}
</div>
<div
className="eeb-negetive-point-and-question-type-box"
style={{ display: "block" }}
>
<div className="eeb-np-box border-b border-[#F5F5F5]">
<img className="eeb-np-box-icon" src={icon4} alt="name-icon" />
<div className="eeb-np-box-label">نمره منفی:</div>
<div className="eeb-np-box-have">
{examInfo?.negativePoint && "دارد"}
{!examInfo?.negativePoint && "ندارد"}
</div>
</div>
<div className="eeb-qt-box">
<img className="eeb-qt-box-icon" src={icon5} alt="name-icon" />
<div className="eeb-qt-box-label">نوع سوالات:</div>
<div className="eeb-qt-box-type">تستی</div>
</div>
</div>
<div className="eeb-max-user-and-exam-type-box">
{/* <div className="eeb-mu-box">
<img className="eeb-mu-box-icon" src={icon6} alt="name-icon" />
<div className="eeb-mu-box-label">حدنصاب شرکت کنندگان: </div>
<div className="eeb-mu-box-number">{data?.capacity} نفر</div>
</div> */}
<div className="eeb-et-box">
<img className="eeb-et-box-icon" src={icon7} alt="name-icon" />
<div className="eeb-et-box-label">نوع شرکت در آزمون:</div>
<div className="eeb-et-box-type">
{data?.type === 1 && "انفرادی"}
{data?.type === 2 && "گروهی"}
</div>
</div>
</div>
{/* <div className="eeb-guide-box">
<img className="eeb-guide-box-icon" src={icon8} alt="name-icon" />
<div className="eeb-guide-box-label">فایل راهنما:</div>
<div className="eeb-guide-box-have">
{data?.guideFileId && "دارد"}
{!data?.guideFileId && "ندارد"} -
</div>
<Link to={data?.guideFileId || "#"} className="eeb-guide-box-link">
دریافت فایل
</Link>
</div> */}
{/* <div className="eeb-created-box">
<div className="eeb-created-box-img-container">
<img
className="eeb-created-box-icon"
src={avatar}
alt="name-icon"
/>
</div>
<div className="eeb-created-box-label">ایجاد شده توسط</div>
<div className="eeb-created-box-file">موسسه فرهنگی مصباح نور</div>
</div> */}
<Link
to={`/dashboard/azmoon_list/exam/${data?.id}`}
className="eeb-btn"
>
شروع آزمون
</Link>
{/* {(new Date(data.date)>today) &&
<div className="eeb-timer">
<div>{timer.d} روز و </div>
<div>{timer.h} ساعت و </div>
<div>{timer.m} دقیقه و </div>
<div>{timer.s} ثانیه </div>
<div>تا شروع آزمون</div>
</div>
} */}
</div>
</div>
);
};
const mapStateToProps = (state) => ({
examInfo: state.exam2.info,
});
const mapDispatchToProps = {
getExamInfo: exam.info,
};
export default connect(mapStateToProps, mapDispatchToProps)(EnterExam);