Compare commits

..

No commits in common. '3a7f53ca9b3004f67f734448721299fa9a065623' and 'e219ced3011dc2c3ca540310402796015769d7e5' have entirely different histories.

  1. 2
      src/App.js
  2. 9
      src/assets/img/Group 1862.svg
  3. 2
      src/components/Checkbox/index.js
  4. 106
      src/components/Product/index.js
  5. 4
      src/components/header/Header.js
  6. 1
      src/components/nav/Nav.js
  7. 14
      src/redux/actions/exam.js
  8. 1
      src/redux/actions/index.js
  9. 26
      src/redux/reducers/exam.js
  10. 20
      src/redux/reducers/exam2.js
  11. 1
      src/redux/reducers/index.js
  12. 6
      src/view/Exam/EnterExam/desktop/index.css
  13. 222
      src/view/Exam/EnterExam/desktop/index.js
  14. 256
      src/view/addExam/views/AddDescription.js
  15. 3
      src/view/addExam/views/AddGradeGroup.js
  16. 4
      src/view/addExam/views/OkExam.js
  17. 304
      src/view/addExam/views/ViewExam.js
  18. 42
      src/view/services/Budget.js
  19. 50
      src/view/services/index.js
  20. 192
      src/view/services/service/index.js

@ -763,7 +763,7 @@ function App() {
<Route path="/contacts" element={<ContactUs />} /> <Route path="/contacts" element={<ContactUs />} />
<Route <Route
exact exact
path="/enter_exam/:id" path="/azmoon_list/enter_exam/:id"
element={<ENTER_EXAM />} element={<ENTER_EXAM />}
/> />
<Route <Route

@ -1,9 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="43" height="43" viewBox="0 0 43 43">
<g id="Group_1862" data-name="Group 1862" transform="translate(-1418 -250)">
<circle id="Ellipse_108" data-name="Ellipse 108" cx="21.5" cy="21.5" r="21.5" transform="translate(1418 250)" fill="#df1452"/>
<g id="Group_1861" data-name="Group 1861" transform="translate(-7 12)">
<path id="Vector" d="M0,12.683,12.683,0" transform="translate(1440.078 253.159)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
<path id="Vector-2" data-name="Vector" d="M12.683,12.683,0,0" transform="translate(1440.078 253.159)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 772 B

@ -18,7 +18,7 @@ export default function Checkbox(props) {
</svg> </svg>
<div className="checkbox-container"> <div className="checkbox-container">
<input defaultChecked={props.defaultChecked} className="checkbox-input" name={props.name} id={"ch"+props.name} type="checkbox" onClick={props.onclick} onChange={props.onChange}/> <input className="checkbox-input" name={props.name} id={"ch"+props.name} type="checkbox" onClick={props.onclick} onChange={props.onChange}/>
<label className="checkbox" htmlFor={"ch"+props.name}> <label className="checkbox" htmlFor={"ch"+props.name}>
<span> <span>
<svg width="12px" height="10px"> <svg width="12px" height="10px">

@ -44,8 +44,6 @@ const ProductDesign = ({
onClick, onClick,
product, product,
userInfo, userInfo,
setShowBudget,
setBudgetFileId,
}) => { }) => {
const [isHovering, setIsHovering] = useState(false); const [isHovering, setIsHovering] = useState(false);
// alert(catId); // alert(catId);
@ -54,12 +52,36 @@ const ProductDesign = ({
); );
console.log(userInfo); console.log(userInfo);
let rulesAccepted = userInfo.rulesAccepted; let rulesAccepted = userInfo.rulesAccepted;
const emkanat = [
//budgetHandler------------- {
const budgetHandler = (fileId) => { title: "دستشویی",
setShowBudget(true); isActive: true,
setBudgetFileId(fileId); },
}; {
title: "آب خوری",
isActive: true,
},
{
title: "تخته هوشمند",
isActive: true,
},
{
title: "کامپیوتر",
isActive: true,
},
{
title: "کتابخانه",
isActive: true,
},
{
title: "مشاوره تحصیلی",
isActive: true,
},
{
title: "آزمایشگاه",
isActive: false,
},
];
//completeProfule----------- //completeProfule-----------
const completeProfule = (id) => { const completeProfule = (id) => {
@ -354,50 +376,39 @@ const ProductDesign = ({
if (catId == 2) { if (catId == 2) {
return ( return (
<div <div
className={`flex flex-col pt-4 text-right rounded-xl justify-start w-full m-4 border border-red82OP ${ className={`flex cursor-pointer flex-col pt-4 text-right rounded-xl justify-start w-full m-4 border border-red82OP ${
isMobile && "w-11/12" isMobile && "w-11/12"
}`} }`}
style={{ width: !isMobile && "100%", direction: "rtl" }} style={{ width: !isMobile && "375px", direction: "rtl" }}
> >
<div className="border-b border-red82OP pb-2 px-4" onClick={onClick}> <div className="border-b border-red82OP pb-2 px-4" onClick={onClick}>
<h1 className="text-red52 text-lg font-bold">{productName}</h1> <h1 className="text-red52 text-lg font-bold">آزمون {productName}</h1>
<p className="text-red26 text-sm my-2">{product?.description}</p> <p className="text-red26 text-sm my-2">
در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط
در این قسمت قرار میگیرد
</p>
</div> </div>
<div <div
className="flex border-b border-red82OP text-center" className="flex border-b border-red82OP text-center"
// onClick={onClick} onClick={onClick}
> >
<div className="w-1/2 border-l border-red82OP py-2 "> <div className="w-1/2 border-l border-red82OP py-2 ">
<h1 className="font-bold text-red26"> <h1 className="font-bold text-red26">نوع آزمون : آنلاین</h1>
نوع آزمون : {product?.productType === 2 ? "حضوری" : "آنلاین"}
</h1>
</div> </div>
<div className="w-1/2 py-2 "> <div className="w-1/2 py-2 " onClick={onClick}>
<h1 <h1 className="font-bold text-red26">بودجه بندی آزمون</h1>
className="font-bold text-red26 cursor-pointer"
onClick={() => budgetHandler(product?.exam?.budgetFileId)}
>
بودجه بندی آزمون
</h1>
</div> </div>
</div> </div>
<div <div
className="flex border-b border-red82OP text-center text-xs" className="flex border-b border-red82OP text-center text-xs"
// onClick={onClick} onClick={onClick}
> >
<div <div
className="w-1/2 border-l border-red82OP py-2 " className="w-1/2 border-l border-red82OP py-2 "
// onClick={onClick} onClick={onClick}
> >
<h1 className="font-bold text-red26"> <h1 className="font-bold text-red26">تاریخ برگزاری : 1400/02/13</h1>
تاریخ برگزاری :{" "}
{product?.exam?.startDate
? moment(product?.exam?.startDate, "YYYY/MM/DD")
.locale("fa")
.format("YYYY/MM/DD")
: "نامشخص"}
</h1>
</div> </div>
<div className="w-1/2 py-2 " onClick={onClick}> <div className="w-1/2 py-2 " onClick={onClick}>
<h1 className="font-bold text-red26">تعداد آزمون : 18</h1> <h1 className="font-bold text-red26">تعداد آزمون : 18</h1>
@ -408,32 +419,11 @@ const ProductDesign = ({
<h1 className="font-black text-xl text-red52"> <h1 className="font-black text-xl text-red52">
{productPrice} تومان {productPrice} تومان
</h1> </h1>
<div> <div
{!rulesAccepted && ( className={`bg-pinkF5 text-red26 w-32 border-2 rounded-md border-red52 px-1 py-2 text-xs flex justify-center hover:bg-red52 hover:text-white
<Link
to="/register"
className="w-36 py-2 px-1 rounded-md text-white bg-[#F2F9FF] text-[#4C7FE3] flex items-center justify-center cursor-pointer text-xs text-center border-2 border-[#4C7FE3]"
onClick={() => {
completeProfule(product?.termId);
}}
>
تکمیل اطلاعات کاربری و افزودن به سبد خرید
</Link>
)}
{rulesAccepted && (
<div
className={`bg-pinkF5 text-red26 w-36 border-2 rounded-md border-red52 px-1 py-2 text-xs flex justify-center hover:bg-red52 hover:text-white
`} `}
> >
<button onClick={btnOnClick}>افزودن به سبد خرید</button> <button onClick={btnOnClick}>افزودن به سبد خرید</button>
</div>
)}
<div
className="w-36 py-2 px-1 rounded-md text-white bg-[#DF1452] text-white flex items-center justify-center cursor-pointer text-xs text-center border-2 border-pinkF5 mt-2"
onClick={onClick}
>
اطلاعات بیشتر
</div>
</div> </div>
</div> </div>
</div> </div>

@ -22,8 +22,12 @@ const Header = ({
user user
}) => { }) => {
let today = moment().locale("fa").format("YYYY/M/D"); let today = moment().locale("fa").format("YYYY/M/D");
console.log("today:");
console.log(today);
let weekday = new Date().getDay(); let weekday = new Date().getDay();
let weekdayList = ["یکشنبه", "دوشنبه", "سهشنبه", "چهارشنبه", 'پنجشنبه', 'جمعه', "شنبه"]; let weekdayList = ["یکشنبه", "دوشنبه", "سهشنبه", "چهارشنبه", 'پنجشنبه', 'جمعه', "شنبه"];
// console.log("weekday:");
// console.log(weekday);
const [menuPopup, setMenuPopup] = useState(false); const [menuPopup, setMenuPopup] = useState(false);
const [subMenu, setSubMenu] = useState(false); const [subMenu, setSubMenu] = useState(false);
const location = useLocation(); const location = useLocation();

@ -188,6 +188,7 @@ const Nav = ({ logOut, isMobile, isLogin, logout }) => {
const chaneNav = (id) => { const chaneNav = (id) => {
setNavId(id); setNavId(id);
let top = 100 / 6 + ((((id - 1) * 100) / 6) * 3) / 4; let top = 100 / 6 + ((((id - 1) * 100) / 6) * 3) / 4;
console.log(top);
document.querySelector(".back-item-img").style.top = `${top}%`; document.querySelector(".back-item-img").style.top = `${top}%`;
}; };
if (isMobile) { if (isMobile) {

@ -1,14 +0,0 @@
import proxy from "../proxy";
const exam = {
info:
(data = {}) =>
async (dispatch) =>
await proxy.get("exam/info", data, { dispatch }),
parentAdd:
(data = {}) =>
async (dispatch) =>
await proxy.post("exam/parentAdd", data, { dispatch }),
};
export default exam;

@ -13,7 +13,6 @@ export {default as scrollAction} from "./scroll";
export {default as qr} from "./qr"; export {default as qr} from "./qr";
export { default as userTransaction } from "./userTransaction"; export { default as userTransaction } from "./userTransaction";
export { default as term } from "./term"; export { default as term } from "./term";
export { default as exam } from "./exam";

@ -11,7 +11,6 @@ const initialState = {
endTime: '', endTime: '',
description: '', description: '',
type: 'bank', type: 'bank',
duration:null,
questionnaires: [ questionnaires: [
{ {
@ -197,6 +196,10 @@ const initialState = {
export const numOfinitQs = initialState.questionBank.length; export const numOfinitQs = initialState.questionBank.length;
export default function addExamReduser(state = initialState, { type, payload }) { export default function addExamReduser(state = initialState, { type, payload }) {
console.log(state.courses)
switch (type) { switch (type) {
case 'ADD_EXAM_GRADE_AND_GROUP': case 'ADD_EXAM_GRADE_AND_GROUP':
@ -208,18 +211,15 @@ export default function addExamReduser(state = initialState, { type, payload })
case 'ADD_EXAM_DESCRIPTION': case 'ADD_EXAM_DESCRIPTION':
return { return {
...state, ...state,
name: payload.name, name: payload.name,
startDate: new Date(), startDate: new Date(),
endDate: new Date(), endDate: new Date(),
startTime: "19:0", startTime: '19:0',
endTime: "", endTime: '',
description: payload.description, description: payload.description,
type: payload.type, type: payload.type
duration: payload.duration, }
startDate:payload.startDate,
endDate:payload.endDate
};
case 'ADD_EXAM_QUESTIONAIRES': case 'ADD_EXAM_QUESTIONAIRES':
return { return {

@ -1,20 +0,0 @@
import { toast } from "react-toastify";
const initialState = {
loading: false,
error: null,
info:null
};
export default function exam2(state = initialState, action) {
let { type, data } = action;
switch (type) {
case "exam/info":
return { ...state, loading: false, info: data, error: null };
case "exam/parentAdd":
return { ...state, loading: false, error: null };
default:
return state;
}
}

@ -13,4 +13,3 @@ export {default as qr} from "./qr";
export {default as addExamReduser} from "./exam"; export {default as addExamReduser} from "./exam";
export { default as userTransaction } from "./userTransaction"; export { default as userTransaction } from "./userTransaction";
export { default as term } from "./term"; export { default as term } from "./term";
export { default as exam2 } from "./exam2";

@ -185,7 +185,7 @@
.enter-exam-box{ .enter-exam-box{
height: auto; height: auto;
/* aspect-ratio: 0.7/1; */ aspect-ratio: 0.7/1;
margin-top: 50px; margin-top: 50px;
padding: 25px; padding: 25px;
border: 0px solid #EBEBEB; border: 0px solid #EBEBEB;
@ -211,8 +211,8 @@
.enter-exam-box{ .enter-exam-box{
/* width: 466px; */ /* width: 466px; */
/* height: 662px; */ /* height: 662px; */
/* height: 70vh; height: 70vh;
aspect-ratio: 0.7/1; */ aspect-ratio: 0.7/1;
margin-top: 110px; margin-top: 110px;
padding: 25px; padding: 25px;
border: 2px solid #EBEBEB; border: 2px solid #EBEBEB;

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

@ -13,165 +13,121 @@ const AddExamDescription = ({ grades, addExamState, dispatch, stepClick, backSte
const [name, setName] = useState(null); const [name, setName] = useState(null);
const [type, setType] = useState(null); const [type, setType] = useState(null);
const [description, setDescription] = useState(null); const [description, setDescription] = useState(null);
const [duration,setDuration]=useState(null);
const [date, setDate] = useState({ format: "MM/DD/YYYY" }); const payload = { name: name, description: description, type: type };
const [startDate,setStartDate]=useState(null); const CostumeDatePickerInput = ({ openCalendar, value, handleValueChange, title }) => {
const [endDate, setEndDate] = useState(null); return(
<input
const payload = {
name: name,
description: description,
type: type,
duration,
startDate,
endDate,
};
console.log("uuuuuuuuuuu")
const CostumeDatePickerInput = ({ openCalendar, value, handleValueChange, title,index }) => {
return (
<input
onFocus={openCalendar} onFocus={openCalendar}
value={value} value={value}
// onChange={(e) => changeHandler(e)} onChange={handleValueChange}
placeholder={title} placeholder={title}
className="create-exame-date-input w-full h-14 rounded-lg p-3 border border-gray-200 text-blue3A outline-blue-300" className="w-full h-14 rounded-lg p-3 border border-gray-200 text-blue3A outline-blue-300"
/> />
); )
}
const dateChangeHandler=(index)=>{
let inputs = document.querySelectorAll(".create-exame-date-input");
console.log(inputs[index].value);
let dateList = inputs[index].value.split(" ")[0].split("/");
let timeList = inputs[index].value.split(" ")[1].split(":");
console.log(dateList);
console.log(timeList);
console.log(Number(dateList[0]));
} }
return ( return (
<> <>
<div className="flex py-10 items-start px-10 border-b border-gray-300"> <div className="flex py-10 items-start px-10 border-b border-gray-300">
<div className="flex flex-col w-1/6"> <div className="flex flex-col w-1/6">
<div className="text-blue3A text-lg font-bold text-right px-4 border-r-4 border-blue65"> <div className="text-blue3A text-lg font-bold text-right px-4 border-r-4 border-blue65">
تنظیمات آزمون تنظیمات آزمون
</div>
<p className="text-sm text-right font-bold pt-4 text-gray-500"> </div>
لطفا مشخضات آزمون را تکمیل کنید <p className="text-sm text-right font-bold pt-4 text-gray-500">لطفا مشخضات آزمون را تکمیل کنید</p>
</p> </div>
</div>
<div className="flex w-5/6 pl-[10%] flex-col">
<div className="flex w-5/6 pl-[10%] flex-col"> <div className="flex items-center justify-between">
<div className="flex items-center justify-between"> <input type='text' placeholder="نام آزمون" className="w-1/2 bg-white px-4 h-14 border border-gray-300 rounded-lg text-blue3A outline-blue65"
<input onChange={(e) => setName(e.target.value)}
type="text" />
placeholder="نام آزمون" <DatePicker
className="w-1/2 bg-white px-4 h-14 border border-gray-300 rounded-lg text-blue3A outline-blue65" format="YYYY/MM/DD HH:mm:ss"
onChange={(e) => setName(e.target.value)}
/> calendar={persian}
<DatePicker locale={persian_fa}
format="YYYY/MM/DD HH:mm:ss" renderButton={(direction, handleClick) => (
calendar={persian} <button className="text-blue-500 font-bold mx-2" onClick={handleClick}>
locale={persian_fa} {direction === "right" ? ">" : "<"}
// onChange={() => dateChangeHandler(0)} </button>
onChange={setStartDate} )}
renderButton={(direction, handleClick) => (
<button render={<CostumeDatePickerInput title='تاریخ و زمان شروع آزمون'/>}
className="text-blue-500 font-bold mx-2" plugins={[
onClick={handleClick} <TimePicker hideSeconds position="bottom" />,
>
{direction === "right" ? ">" : "<"} ]}
</button> />
)} <DatePicker
render={ format="YYYY/MM/DD HH:mm:ss"
<CostumeDatePickerInput title="تاریخ و زمان شروع آزمون" />
} calendar={persian}
plugins={[<TimePicker hideSeconds={true} position="bottom" />]} locale={persian_fa}
/> renderButton={(direction, handleClick) => (
<DatePicker <button className="text-blue-500 font-bold mx-2" onClick={handleClick}>
format="YYYY/MM/DD HH:mm:ss" {direction === "right" ? ">" : "<"}
calendar={persian} </button>
locale={persian_fa} )}
onChange={setEndDate}
renderButton={(direction, handleClick) => ( render={<CostumeDatePickerInput title='تاریخ و زمان پایان آزمون'/>}
<button plugins={[
className="text-blue-500 font-bold mx-2" <TimePicker hideSeconds position="bottom" />,
onClick={handleClick}
> ]}
{direction === "right" ? ">" : "<"} />
</button> </div>
)} <textarea className="w-full mt-6 h-60 border border-gray-300 rounded-lg p-4 outline-blue65 text-blue3A" placeholder="توضیحات آزمون"
render={ onChange={(e) => setDescription(e.target.value)}
<CostumeDatePickerInput title="تاریخ و زمان پایان آزمون" /> >
}
plugins={[<TimePicker hideSeconds={true} position="bottom" />]} </textarea>
/>
</div>
<textarea
className="w-full mt-6 h-60 border border-gray-300 rounded-lg p-4 outline-blue65 text-blue3A" </div>
placeholder="توضیحات آزمون"
onChange={(e) => setDescription(e.target.value)}
></textarea>
<input
type="text"
placeholder="مدت زمان آزمون(دقیقه)"
className="w-1/3 bg-white px-4 h-14 border border-gray-300 rounded-lg text-blue3A outline-blue65 mt-6"
onChange={(e) => setDuration(e.target.value)}
/>
</div>
</div>
<div className="flex pt-10 items-start px-10 ">
<div className="flex flex-col w-1/6">
<div className="text-blue3A text-lg font-bold text-right px-4 border-r-4 border-blue65">
نوع آزمون
</div> </div>
<p className="text-sm text-right font-bold pt-4 text-gray-500">
لطفا یک مدل از آزمون را انتخاب کنید <div className="flex pt-10 items-start px-10 ">
</p> <div className="flex flex-col w-1/6">
</div> <div className="text-blue3A text-lg font-bold text-right px-4 border-r-4 border-blue65">
تنظیمات آزمون
<div className="flex w-5/6 flex-wrap">
<div </div>
className={`w-1/6 border ${ <p className="text-sm text-right font-bold pt-4 text-gray-500">لطفا یک مدل از آزمون را انتخاب کنید</p>
type == 1 </div>
? "border-red52 text-red52 bg-pinkF5"
: " border-gray-300 text-blue3A bg-white" <div className="flex w-5/6 flex-wrap">
} font-bold cursor-pointer py-10 m-4 rounded-xl`}
onClick={() => setType(1)} <div className={`w-1/6 border ${type == 'bank' ? 'border-red52 text-red52 bg-pinkF5' : ' border-gray-300 text-blue3A bg-white'} font-bold cursor-pointer py-10 m-4 rounded-xl`} onClick={() => setType('bank')}>
> بانک سوالات
بانک سوالات
</div>
<div className={`w-1/6 border ${type == 'pdf' ? 'border-red52 text-red52 bg-pinkF5' : ' border-gray-300 text-blue3A bg-white'} font-bold cursor-pointer py-10 m-4 rounded-xl`} onClick={() => setType('pdf')}>
دفترچه سوالات
</div>
</div>
</div> </div>
<div <div className="flex fixed bottom-10 left-0 w-full px-10 justify-end">
className={`w-1/6 border ${ <button className=' mx-2 h-12 mt-4 text-red52 font-bold flex items-center justify-center' onClick={() => backStep()}> بازگشت به مرحله قبل </button>
type == 2 <Button
? "border-red52 text-red52 bg-pinkF5" title='مرحله بعدی'
: " border-gray-300 text-blue3A bg-white" className='w-1/12'
} font-bold cursor-pointer py-10 m-4 rounded-xl`} onClick={() => {
onClick={() => setType(2)} dispatch({ type: 'ADD_EXAM_DESCRIPTION', payload });
> stepClick()
دفترچه سوالات }}
/>
</div> </div>
</div>
</div> </>
<div className="flex fixed bottom-10 left-0 w-full px-10 justify-end"> )
<button
className=" mx-2 h-12 mt-4 text-red52 font-bold flex items-center justify-center"
onClick={() => backStep()}
>
{" "}
بازگشت به مرحله قبل{" "}
</button>
<Button
title="مرحله بعدی"
className="w-1/12"
onClick={() => {
dispatch({ type: "ADD_EXAM_DESCRIPTION", payload });
stepClick();
}}
/>
</div>
</>
);
} }
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({

@ -2,7 +2,6 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import Button from "../../../components/Button"; import Button from "../../../components/Button";
import { exam } from "../../../redux/actions";
const AddGradeGroup = ({grades, addExamState, dispatch, stepClick}) => { const AddGradeGroup = ({grades, addExamState, dispatch, stepClick}) => {
const [examGrade, setExamGrade] = useState(null); const [examGrade, setExamGrade] = useState(null);
@ -83,6 +82,4 @@ const mapStateToProps = (state) => ({
addExamState: state.addExamReduser addExamState: state.addExamReduser
}) })
export default connect(mapStateToProps)(AddGradeGroup); export default connect(mapStateToProps)(AddGradeGroup);

@ -6,8 +6,6 @@ import AddQuestionnaireExam from "./addQuestionnaireExam";
import AddQuestionsFromBank from "./AddQuestionsFromBank"; import AddQuestionsFromBank from "./AddQuestionsFromBank";
const OkExam = ({ addExamState, stepClick, backStep }) => { const OkExam = ({ addExamState, stepClick, backStep }) => {
console.log("examInfo:----------------------------------------");
console.log(addExamState);
const grades = [ const grades = [
'', '',
'اول', 'اول',
@ -65,6 +63,4 @@ const mapStateToProps = (state) => ({
addExamState: state.addExamReduser addExamState: state.addExamReduser
}) })
export default connect(mapStateToProps)(OkExam); export default connect(mapStateToProps)(OkExam);

@ -9,186 +9,146 @@ import { Viewer } from '@react-pdf-viewer/core';
// Import the styles // Import the styles
import '@react-pdf-viewer/core/lib/styles/index.css'; import '@react-pdf-viewer/core/lib/styles/index.css';
import Preview from "../../../components/AnswerSheet/preview"; import Preview from "../../../components/AnswerSheet/preview";
import { exam } from "../../../redux/actions";
const ViewExam = ({ addExamState, stepClick, backStep }) => {
const ViewExam = ({ addExamState, stepClick, backStep, parentAdd }) => { useEffect(() => {
useEffect(() => { window.scrollTo(0, 0);
window.scrollTo(0, 0); console.log(addExamState.type)
console.log("oooooooooooooooooooooooooooooo"); }, [])
console.log(addExamState); const grades = [
}, []); '',
const grades = [ 'اول',
"", 'دوم',
"اول", 'سوم',
"دوم", 'چهارم',
"سوم", 'پنجم',
"چهارم", 'ششم',
"پنجم", 'هفتم',
"ششم", 'هشتم',
"هفتم", 'نهم',
"هشتم", 'دهم',
"نهم", 'یازدهم',
"دهم", 'دوازدهم',
"یازدهم", ]
"دوازدهم", const optionNum = [
]; '',
const optionNum = ["", "الف", "ب", "پ", "ت", "ث", "ج", "چ", "ح"]; 'الف',
'ب',
const [selectedCourse, setSelectedCourse] = useState( 'پ',
addExamState?.questionnaires[0] 'ت',
); 'ث',
'ج',
const [numPages, setNumPages] = useState(1); 'چ',
'ح',
function onDocumentLoadSuccess({ numPages }) {
setNumPages(numPages); ]
}
const [selectedCourse, setSelectedCourse] = useState(addExamState?.questionnaires[0]);
let questionCount = 0;
for(let i=0;i<addExamState.courses.length;i++){ const [numPages, setNumPages] = useState(1);
questionCount += addExamState.courses[i].selectedQuestions.length;
} function onDocumentLoadSuccess({ numPages }) {
setNumPages(numPages);
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>"); }
console.log(addExamState.startDate);
const submitHandler=()=>{ return (
parentAdd({
name: addExamState.name, <div className="w-[95%] flex flex-col mx-10">
description: addExamState.description, <div className="w-4/5 py-6 flex items-center">
startDate: addExamState.startDate, <h1 className="text-2xl font-bold ml-6">آزمون {addExamState.name}</h1>
endDate: addExamState.endDate, <h3 className="text-gray-500"> پایه {grades[addExamState.grade]}</h3>
duration: addExamState?.duration || 60, </div>
// duration:30, {addExamState.type !== 'pdf' ? <div className="w-full flex flex-col text-right">
type: addExamState.type, {
//questionCount: addExamState.questions.length, addExamState.courses.map((item, index) => (
questionCount, <div className={`flex flex-col w-full py-6 border-b-2 border-gray-400`}>
examGroupId: addExamState.groupId, <h1 className="text-xl">سوالات {item.title}</h1>
levelCriterion: null, <p className="text-gray-500 pt-2">ضریب {item.coefficient}</p>
budgetFileId:null {
}); item.selectedQuestions.map((question, idx) => (
// stepClick(); <div className={`flex flex-col w-full py-4 ${item.selectedQuestions.length !== idx + 1 && 'border-b border-gray-200'}`} key={`PISHNAMAYESH__${question.questionId}`}>
} {console.log(item.selectedQuestions.length)}
{console.log(idx + 1)}
return ( <div className="flex items-start pb-4">
<div className="w-[95%] flex flex-col mx-10"> <h1 className="text-xl">{question.title}</h1>
<div className="w-4/5 py-6 flex items-center"> <p className="w-1/12 pr-4">{question.score} نمره</p>
<h1 className="text-2xl font-bold ml-6">آزمون {addExamState.name}</h1> </div>
<h3 className="text-gray-500"> پایه {grades[addExamState.grade]}</h3> {
</div> question.options.map((option) => (
{addExamState.type !== "pdf" ? ( <div className="flex w-full my-2 items-center">
<div className="w-full flex flex-col text-right"> <div className={`${option.isAnswer ? 'bg-green-400 text-white' : 'bg-gray-300'} w-16 h-14 text-xl flex items-center justify-center rounded-xl rounded-l-none`}>
{addExamState.courses.map((item, index) => ( {optionNum[option.id]}
<div </div>
className={`flex flex-col w-full py-6 border-b-2 border-gray-400`} <div className={`w-1/4 flex items-center px-6 ${option.isAnswer ? 'bg-green-200' : 'bg-gray-200'} h-14 rounded-xl rounded-r-none`}>
> {option.title}
<h1 className="text-xl">سوالات {item.title}</h1> </div>
<p className="text-gray-500 pt-2">ضریب {item.coefficient}</p> </div>
{item.selectedQuestions.map((question, idx) => ( ))
<div }
className={`flex flex-col w-full py-4 ${ </div>
item.selectedQuestions.length !== idx + 1 && ))
"border-b border-gray-200" }
}`} </div>
key={`PISHNAMAYESH__${question.questionId}`} ))
> }
{console.log(item.selectedQuestions.length)} </div> :
{console.log(idx + 1)} addExamState.type === 'pdf' &&
<div className="flex items-start pb-4"> <div className="flex flex-col w-full items-center">
<h1 className="text-xl">{question.title}</h1> <h1 className="w-full text-right pb-4 text-lg font-bold">دفترچه ها</h1>
<p className="w-1/12 pr-4">{question.score} نمره</p> <div className="w-full flex flex-wrap">
</div> {
{question.options.map((option) => ( addExamState?.questionnaires?.map((item) => (
<div className="flex w-full my-2 items-center"> <div
<div
className={`${ className={`flex flex-col ${selectedCourse.id === item?.id ? 'bg-pinkF5 border border-red52 text-red52' : 'bg-white border border-gray-300 text-blue3A'} items-center justify-center w-36 h-32 mx-2 font-bold rounded-xl cursor-pointer`}
option.isAnswer onClick={() => setSelectedCourse(item)}
? "bg-green-400 text-white" >
: "bg-gray-300"
} w-16 h-14 text-xl flex items-center justify-center rounded-xl rounded-l-none`}
> <p className="text-red52">
{optionNum[option.id]} {item.name}
</div> </p>
<div </div>
className={`w-1/4 flex items-center px-6 ${ ))
option.isAnswer ? "bg-green-200" : "bg-gray-200" }
} h-14 rounded-xl rounded-r-none`} </div>
>
{option.title} <div className="flex w-full border-t border-gray-200 mt-10">
</div> <div className="w-1/2 border-l border-gray-200 py-20 " style={{ height: '750px' }}>
<Worker workerUrl="https://unpkg.com/pdfjs-dist@2.13.216/build/pdf.worker.min.js">
<Viewer fileUrl={selectedCourse.fileUrl} />
</Worker>
</div>
<div className="w-1/2 my-20 flex justify-center overflow-x-hidden overflow-scroll" style={{height: '600px'}}>
<div className="w-2/3">
<Preview answers={selectedCourse.answers}/>
</div>
</div>
</div> </div>
))}
</div> </div>
))}
}
<div className="w-full flex justify-end font-bold mt-6">
<button className="py-4 font-bold px-6 rounded-lg text-red52 mr-4"
onClick={() => backStep()}>
بازگشت به مرحله قبلی
</button>
<button className="bg-red52 py-4 px-6 rounded-lg text-white mr-4"
onClick={() => stepClick()}>
تایید آزمون
</button>
</div> </div>
))}
</div> </div>
) : (
addExamState.type === "pdf" && (
<div className="flex flex-col w-full items-center">
<h1 className="w-full text-right pb-4 text-lg font-bold">
دفترچه ها
</h1>
<div className="w-full flex flex-wrap">
{addExamState?.questionnaires?.map((item) => (
<div
className={`flex flex-col ${
selectedCourse.id === item?.id
? "bg-pinkF5 border border-red52 text-red52"
: "bg-white border border-gray-300 text-blue3A"
} items-center justify-center w-36 h-32 mx-2 font-bold rounded-xl cursor-pointer`}
onClick={() => setSelectedCourse(item)}
>
<p className="text-red52">{item.name}</p>
</div>
))}
</div>
<div className="flex w-full border-t border-gray-200 mt-10">
<div )
className="w-1/2 border-l border-gray-200 py-20 " }
style={{ height: "750px" }}
>
<Worker workerUrl="https://unpkg.com/pdfjs-dist@2.13.216/build/pdf.worker.min.js">
<Viewer fileUrl={selectedCourse.fileUrl} />
</Worker>
</div>
<div
className="w-1/2 my-20 flex justify-center overflow-x-hidden overflow-scroll"
style={{ height: "600px" }}
>
<div className="w-2/3">
<Preview answers={selectedCourse.answers} />
</div>
</div>
</div>
</div>
)
)}
<div className="w-full flex justify-end font-bold mt-6">
<button
className="py-4 font-bold px-6 rounded-lg text-red52 mr-4"
onClick={() => backStep()}
>
بازگشت به مرحله قبلی
</button>
<button
className="bg-red52 py-4 px-6 rounded-lg text-white mr-4"
onClick={submitHandler}
>
تایید آزمون
</button>
</div>
</div>
);
};
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
grades: state.publicApi.grades, grades: state.publicApi.grades,
addExamState: state.addExamReduser addExamState: state.addExamReduser
}) })
const mapDispatchToProps = { export default connect(mapStateToProps)(ViewExam);
parentAdd: exam.parentAdd,
};
export default connect(mapStateToProps, mapDispatchToProps)(ViewExam);

@ -1,42 +0,0 @@
import closeBtn from "../../assets/img/Group 1862.svg";
import React from 'react'
const Budget = ({ setShowBudget, setBudgetFileId, budgetFileId }) => {
const closeHandler=()=>{
setShowBudget(false);
setBudgetFileId(false);
}
return (
<div
className="w-[93.5vw] h-[93.5vh] fixed top-[6.5%] left-0 flex justify-center backdrop-blur bg-[#9999991A] overflow-y-auto z-[100]"
style={window.innerWidth < 1000 ? { width: "100%" } : null}
>
<img
src={closeBtn}
alt="closeBtn"
className="w-10 cursor-pointer absolute top-10 left-6"
onClick={closeHandler}
style={window.innerWidth < 1000 ? { top: "10px", left: "10px" } : null}
/>
<div className="w-[70%] mt-16">
{budgetFileId && (
<img
src={`https://new.andishmand.ir/api/v1/file/${budgetFileId}`}
alt=""
className="w-full"
/>
)}
{!budgetFileId && (
<div className="w-full text-xl text-cneter">
دیتایی برای نمایش وجود ندارد
</div>
)}
</div>
</div>
);
};
export default Budget

@ -24,7 +24,6 @@ import Games from "../dashboard2/Games";
import "./index.css"; import "./index.css";
import separate from "../../utils/separate"; import separate from "../../utils/separate";
import { toast } from "react-toastify"; import { toast } from "react-toastify";
import Budget from "./Budget";
const Services = ({ const Services = ({
isMobile, isMobile,
@ -164,7 +163,9 @@ const Services = ({
const [gameId, setGameId] = useState(5); const [gameId, setGameId] = useState(5);
const chooseGame = (id) => { const chooseGame = (id) => {
setGameId(id); setGameId(id);
console.log(selectedProductTypes);
}; };
console.log(gameId);
//productClickHandler------------------ //productClickHandler------------------
const productClickhandler = (product) => { const productClickhandler = (product) => {
@ -185,6 +186,7 @@ const Services = ({
if (gameId !== 5) { if (gameId !== 5) {
setPopUp(true); setPopUp(true);
} }
console.log(gameId);
}; };
//AddToCartHandler-------------------- //AddToCartHandler--------------------
@ -207,13 +209,11 @@ const Services = ({
//------------------------------------- //-------------------------------------
const [showPaymentBox, setShowPaymentBox] = useState(false); const [showPaymentBox, setShowPaymentBox] = useState(false);
const [showBudget,setShowBudget] = useState(false);
const [budgetFileId,setBudgetFileId] =useState(null);
//-======================== Desktop =========================================== //-======================== Desktop ===========================================
if (!isMobile) { if (!isMobile) {
return ( return (
<div <div
className="flex items-start justify-between relative" className="flex items-start justify-between"
style={{ width: "93.5%", direction: "rtl", height: "100vh" }} style={{ width: "93.5%", direction: "rtl", height: "100vh" }}
> >
{popup ? ( {popup ? (
@ -226,17 +226,8 @@ const Services = ({
price: popUpContent.price + val, price: popUpContent.price + val,
}) })
} }
setShowBudget={setShowBudget}
setBudgetFileId={setBudgetFileId}
/> />
) : null} ) : null}
{showBudget && (
<Budget
setShowBudget={setShowBudget}
setBudgetFileId={setBudgetFileId}
budgetFileId={budgetFileId}
/>
)}
<div <div
className="w-[76.5%] h-[100vh] flex flex-col justify-center pt-[3.5%]" className="w-[76.5%] h-[100vh] flex flex-col justify-center pt-[3.5%]"
// style={{ paddingTop:'5.5%', height: '100vh' }} // style={{ paddingTop:'5.5%', height: '100vh' }}
@ -331,8 +322,6 @@ const Services = ({
> >
{(selectedProductTypes.includes(4) || {(selectedProductTypes.includes(4) ||
selectedProductTypes.includes(7) || selectedProductTypes.includes(7) ||
selectedProductTypes.includes(3) ||
selectedProductTypes.includes(2) ||
selectedProductTypes.includes(1)) && ( selectedProductTypes.includes(1)) && (
<Product <Product
key={index} key={index}
@ -349,8 +338,6 @@ const Services = ({
teacher={product.vodTeacher} teacher={product.vodTeacher}
catId={gameId} catId={gameId}
userInfo={userInfo} userInfo={userInfo}
setShowBudget={setShowBudget}
setBudgetFileId={setBudgetFileId}
onClick={() => { onClick={() => {
productClickhandler(product); productClickhandler(product);
}} }}
@ -365,8 +352,6 @@ const Services = ({
))} ))}
{!selectedProductTypes.includes(4) && {!selectedProductTypes.includes(4) &&
!selectedProductTypes.includes(7) && !selectedProductTypes.includes(7) &&
!selectedProductTypes.includes(2) &&
!selectedProductTypes.includes(3) &&
!selectedProductTypes.includes(1) && !selectedProductTypes.includes(1) &&
gameId !== 6 && ( gameId !== 6 && (
<div className="w-full h-28 flex flex-col items-center justify-center mx-auto rounded"> <div className="w-full h-28 flex flex-col items-center justify-center mx-auto rounded">
@ -434,27 +419,6 @@ const Services = ({
else { else {
return ( return (
<div className="flex flex-col items-center mt-16 mb-40 rtl"> <div className="flex flex-col items-center mt-16 mb-40 rtl">
{popup ? (
<ServicePopUp
content={popUpContent}
closeOnClick={() => setPopUp(false)}
sendPrice={(val) =>
setPopUpContent({
...popUpContent,
price: popUpContent.price + val,
})
}
setShowBudget={setShowBudget}
setBudgetFileId={setBudgetFileId}
/>
) : null}
{showBudget && (
<Budget
setShowBudget={setShowBudget}
setBudgetFileId={setBudgetFileId}
budgetFileId={budgetFileId}
/>
)}
<Games <Games
selectedGames={selectedGames} selectedGames={selectedGames}
gameId={gameId} gameId={gameId}
@ -521,8 +485,6 @@ const Services = ({
<div className="w-[90%]" key={`PRODUCT__${gameId}__${index}`}> <div className="w-[90%]" key={`PRODUCT__${gameId}__${index}`}>
{(selectedProductTypes.includes(4) || {(selectedProductTypes.includes(4) ||
selectedProductTypes.includes(7) || selectedProductTypes.includes(7) ||
selectedProductTypes.includes(3) ||
selectedProductTypes.includes(2) ||
selectedProductTypes.includes(1)) && ( selectedProductTypes.includes(1)) && (
<Product <Product
key={index} key={index}
@ -545,16 +507,12 @@ const Services = ({
btnOnClick={() => { btnOnClick={() => {
AddToCartHandler(product); AddToCartHandler(product);
}} }}
setShowBudget={setShowBudget}
setBudgetFileId={setBudgetFileId}
/> />
)} )}
</div> </div>
))} ))}
{!selectedProductTypes.includes(4) && {!selectedProductTypes.includes(4) &&
!selectedProductTypes.includes(7) && !selectedProductTypes.includes(7) &&
!selectedProductTypes.includes(2) &&
!selectedProductTypes.includes(3) &&
!selectedProductTypes.includes(1) && !selectedProductTypes.includes(1) &&
gameId !== 6 && ( gameId !== 6 && (
<div className="w-full h-28 flex flex-col items-center justify-center mx-auto rounded"> <div className="w-full h-28 flex flex-col items-center justify-center mx-auto rounded">

@ -1,67 +1,23 @@
import moment from "jalali-moment";
import React from "react"; import React from "react";
import { connect } from "react-redux";
import Button from "../../../components/Button"; import Button from "../../../components/Button";
import Checkbox from "../../../components/Checkbox"; import Checkbox from "../../../components/Checkbox";
import { userProduct } from "../../../redux/actions";
import separate from "../../../utils/separate"; import separate from "../../../utils/separate";
const servicePopUp = ({ const servicePopUp = ({
content, content,
closeOnClick, closeOnClick,
addToCartFunction, addToCartFunction,
sendPrice, sendPrice,
setShowBudget,
setBudgetFileId,
userInfo,
pushToCart
}) => { }) => {
console.log(")))))((((((((((");
console.log(content);
const budgetHandler = (fileId) => {
setBudgetFileId(fileId);
setShowBudget(true);
};
//addToCartHandler------
let rulesAccepted = userInfo.rulesAccepted;
const addToCartHandler = () => {
let checkBoxes = document.querySelectorAll(".exam-child-checbox");
let childList = [];
let parentLength = content?.product?.childs?.length;
console.log("buying.....................");
for (let i = 0; i < checkBoxes.length; i++) {
if (checkBoxes[i].checked) {
childList.push(content?.product?.childs[i].id);
}
}
console.log(childList);
console.log(parentLength);
if (parentLength === childList.length) {
pushToCart({ productId :content.product.id,count:1});
} else {
for(let j=0;j<childList.length;j++){
pushToCart({productId:childList[j],count:1})
}
}
};
return ( return (
<div <div
className="flex justify-center w-full items-center fixed text-right z-30 backdrop-blur" className="flex justify-center w-full items-center fixed text-right z-30 backdrop-blur"
style={{ style={{
background: "rgba(0,0,0,0.1)", background: "rgba(0,0,0,0.1)",
height: "calc(100vh - 6.5vh)", height: "calc(100vh - 6.5vh)",
top: "8vh", top: "8.5vh",
}} }}
> >
<div <div className="bg-white flex flex-col w-1/2 rounded-2xl py-6 px-10">
className="bg-white flex flex-col w-1/2 rounded-2xl py-6 px-10"
style={
window.innerWidth < 1000
? { width: "95%", marginInline: "auto", paddingInline: "10px" }
: null
}
>
<div className="w-full"> <div className="w-full">
<div <div
className="w-8 h-8 text-white text-sm rounded-full cursor-pointer flex justify-center items-center bg-red52 mb-2" className="w-8 h-8 text-white text-sm rounded-full cursor-pointer flex justify-center items-center bg-red52 mb-2"
@ -172,7 +128,7 @@ const servicePopUp = ({
{content.classHour} دقیقه {content.classHour} دقیقه
</div> </div>
)} )}
{content?.product?.productType === 1 && ( {(content?.product?.productType ===1) && (
<div className="bg-gray-100 rounded w-full px-4 py-2 ml-2 text-red26"> <div className="bg-gray-100 rounded w-full px-4 py-2 ml-2 text-red26">
{/* {content?.product.?} */} {/* {content?.product.?} */}
رحلی کوچک رحلی کوچک
@ -183,97 +139,59 @@ const servicePopUp = ({
</div> </div>
)} )}
{content.id === 2 && ( {content.id === 2 && (
<div className="w-full"> <div className="flex w-11/12 flex-col rounded-xl border border-red82OP">
<div className="flex w-11/12 flex-col rounded-xl border border-red82OP"> <h1 className="px-2 py-6 border-b border-red82OP bg-blueFF rounded-t-xl pr-10 text-blueE3 text-xl font-bold">
<h1 className="px-2 py-6 border-b border-red82OP bg-blueFF rounded-t-xl pr-10 text-blueE3 text-xl font-bold"> آزمون {content.title}
{content.title} </h1>
</h1> <div
<div className="flex w-full border-b border-red82OP text-red26 text-sm font-bold"
className="flex w-full border-b border-red82OP text-red26 text-sm font-bold" style={{ direction: "rtl" }}
style={{ direction: "rtl" }} >
> <div className="w-1/4 flex justify-center py-4 border-l border-red82OP">
<div className="w-1/4 flex justify-center py-4 border-l border-red82OP"> نوع آزمون : آنلاین
نوع آزمون :{" "}
{content?.product?.exam?.productType === 2
? "حضوری"
: "مجازی"}
</div>
<div className="w-1/4 flex justify-center py-4 border-l border-red82OP">
تاریخ شروع :{" "}
{moment(content?.product?.exam?.startDate, "YYYY/MM/DD")
.locale("fa")
.format("YYYY/MM/DD")}
</div>
<div className="w-1/4 flex justify-center py-4 border-l border-red82OP">
تعداد آزمون : ۱۸
</div>
<div
className="w-1/4 flex items-center justify-center py-4 cursor-pointer"
onClick={() =>
budgetHandler(content?.product?.exam?.budgetFileId)
}
>
{" "}
بودجه بندی آزمون{" "}
</div>
</div> </div>
<div <div className="w-1/4 flex justify-center py-4 border-l border-red82OP">
className="flex w-full border-b border-red82OP text-red26 text-xs py-3 px-6 " تاریخ شروع : 1400/12/03
style={{ direction: "rtl" }}
>
<span className="text-red52 ml-1 font-bold">توجه:</span>
به صورت معمول تمامی آزمون ها برای شما خریداری خواهند شد مگر
اینکه شما به صورت دلخواه یک یا چند آزمون را انتخاب نمایید
</div> </div>
{content?.product?.childs?.map((item, index) => ( <div className="w-1/4 flex justify-center py-4 border-l border-red82OP">
<div تعداد آزمون : ۱۸
className="flex w-full items-center justify-between border-b border-red82OP font-bold text-red26 text-xs py-3 px-6 " </div>
style={{ direction: "rtl" }} <div className="w-1/4 flex items-center justify-center py-4 ">
> {" "}
<div className="flex items-center font-bold"> بودجه بندی آزمون{" "}
{/* <Checkbox </div>
name={`examPackage_${item.id}_${index}`} </div>
defaultChecked={true} <div
// onclick={(e) => className="flex w-full border-b border-red82OP text-red26 text-xs py-3 px-6 "
// e.target.checked style={{ direction: "rtl" }}
// ? sendPrice(item.price) >
// : sendPrice(-item.price) <span className="text-red52 ml-1 font-bold">توجه:</span>
// } به صورت معمول تمامی آزمون ها برای شما خریداری خواهند شد مگر
/> */} اینکه شما به صورت دلخواه یک یا چند آزمون را انتخاب نمایید
<input
type="checkbox"
name="exam-child-checbox"
className="exam-child-checbox w-5 h-5 rounded-sm ml-3 accent-[#DF1452]"
defaultChecked={true}
/>
<p>{item?.name}</p>
</div>
<p>
تاریخ :{" "}
{moment(item?.exam?.startDate, "YYYY/MM/DD")
.locale("fa")
.format("YYYY/MM/DD")}
</p>
{/* <p>ساعت : {item.time}</p> */}
<p
className="cursor-pointer"
onClick={() => budgetHandler(item?.exam?.budgetFileId)}
>
بودجه بندی !
</p>
<p>تعداد سوالات: {item?.exam?.questionCount}</p>
<p>{separate(item?.price)} تومان</p>
</div>
))}
</div> </div>
{rulesAccepted && <div className="w-full flex mt-5"> {content.examCont?.map((item, index) => (
<div <div
className="w-40 h-12 rounded bg-[#DF1452] flex items-center justify-center text-[#fff] cursor-pointer text-sm" className="flex w-full items-center justify-between border-b border-red82OP font-bold text-red26 text-xs py-3 px-6 "
onClick={addToCartHandler} style={{ direction: "rtl" }}
> >
افزودن به سبد خرید <div className="flex items-center font-bold">
<Checkbox
name={`examPackage_${item.id}_${index}`}
onclick={(e) =>
e.target.checked
? sendPrice(item.price)
: sendPrice(-item.price)
}
/>
<p>{item.title}</p>
</div>
<p>تاریخ : {item.date}</p>
<p>ساعت : {item.time}</p>
<p>بودجه بندی !</p>
<p>تعداد سوالات: {item.numberOfQ}</p>
<p>{separate(item.price)} تومان</p>
</div> </div>
</div>} ))}
</div> </div>
)} )}
@ -313,12 +231,4 @@ const servicePopUp = ({
); );
}; };
const mapStateToProps = (state) => ({ export default servicePopUp;
userInfo: state.user.status,
});
const mapDispatchToProps = {
pushToCart: userProduct.add,
};
export default connect(mapStateToProps, mapDispatchToProps)(servicePopUp);

Loading…
Cancel
Save