{headerGroup.headers.map((column) => (
@@ -143,7 +143,7 @@ const Table = ({
e.more)}
+ schema={schema.filter((e) => e?.more)}
setTabs={setTabs}
tabs={tabs}
row={row.original}
@@ -159,7 +159,7 @@ const Table = ({
{/* {tabs?.length > 1 && editor} */}
{/* {tabs?.length > 1 && editor} */}
- 5 ? "w-full" : "hidden"}`}>
+ {/* 5 ? "w-full" : "hidden"}`}>
{footerGroups.map((footerGroup, index) => (
{footerGroup.headers.map((column, index) => (
@@ -173,7 +173,7 @@ const Table = ({
))}
))}
-
+ */}
);
};
diff --git a/src/components/Table/Layouts/Toolbar/components/GoToPage.js b/src/components/Table/Layouts/Toolbar/components/GoToPage.js
index 34a6908..08dea65 100644
--- a/src/components/Table/Layouts/Toolbar/components/GoToPage.js
+++ b/src/components/Table/Layouts/Toolbar/components/GoToPage.js
@@ -2,7 +2,7 @@ import React from "react";
const GoToPage = ({ pageIndex, gotoPage, pageOptions }) => {
return (
-
+
صفحه{" "}
-
+
);
diff --git a/src/components/Table/components/Columns/components/Buttons.js b/src/components/Table/components/Columns/components/Buttons.js
index 0b10873..819f929 100644
--- a/src/components/Table/components/Columns/components/Buttons.js
+++ b/src/components/Table/components/Columns/components/Buttons.js
@@ -28,9 +28,11 @@ const Buttons = ({
for (let i = 0; i < newList.length; i++) {
newList[i].isActive = false;
}
+ console.log("00000000000||0000000000000000");
+ console.log(row);
newList.push({
id: Math.floor(Math.random() * 10000),
- name: row.original.name,
+ name: row.original.firstName + " " + row.original.lastName,
isActive: true,
data: row,
element: "editor",
@@ -64,10 +66,10 @@ const Buttons = ({
-
+
{/* */}
diff --git a/src/components/Table/components/Columns/components/EditButtons.js b/src/components/Table/components/Columns/components/EditButtons.js
index 33a1317..648d778 100644
--- a/src/components/Table/components/Columns/components/EditButtons.js
+++ b/src/components/Table/components/Columns/components/EditButtons.js
@@ -35,7 +35,7 @@ const EditButtons = ({
{/* add new row */}
);
-}
\ No newline at end of file
+};
diff --git a/src/constants/defaultValues.js b/src/constants/defaultValues.js
index 501cf93..0c43f3b 100644
--- a/src/constants/defaultValues.js
+++ b/src/constants/defaultValues.js
@@ -1,9 +1,9 @@
export const ApiConfig = {
// apiKey: 'AIzaSyBBksq-Asxq2M4Ot-75X19IyrEYJqNBPcg',
// authDomain: 'dnvn.ir',
- baseUrl: 'https://new.andishmand.ir/api/v1',
+ baseUrl: "https://api.andishmand.ir/api/v1",
//baseUrl: 'http://localhost:3030/api/v1',
- loginURL: 'user/login',
- otploginURL: 'user/otp/login',
- logoutURL: 'user/logout',
-};
\ No newline at end of file
+ loginURL: "user/login",
+ otploginURL: "user/otp/login",
+ logoutURL: "user/logout",
+};
diff --git a/src/redux/actions/exam.js b/src/redux/actions/exam.js
index 770a61f..0e96c64 100644
--- a/src/redux/actions/exam.js
+++ b/src/redux/actions/exam.js
@@ -21,6 +21,10 @@ const exam = {
(data = {}) =>
async (dispatch) =>
await proxy.put("exam/confirm", data, { dispatch }),
+ start:
+ (data = {}) =>
+ async (dispatch) =>
+ await proxy.get("exam/start", data, { dispatch }),
emptySubexamList: (data = {}) => {
return (dispatch) => {
dispatch({
diff --git a/src/redux/proxy.js b/src/redux/proxy.js
index 4fefa20..ecd4831 100644
--- a/src/redux/proxy.js
+++ b/src/redux/proxy.js
@@ -48,7 +48,7 @@ class Proxy {
let response = await fetch();
switch (response.status) {
case 200:
- dispatch({ type: url, data: response.data.data, params });
+ dispatch({ type: url, data: response.data.data,schema:response.data.schema, params });
return response.data.data;
case 401:
if (await this.refresh()) {
diff --git a/src/redux/reducers/book.js b/src/redux/reducers/book.js
index 35f174c..fdf0aed 100644
--- a/src/redux/reducers/book.js
+++ b/src/redux/reducers/book.js
@@ -35,7 +35,7 @@ const grades = [
];
export default function book(state = initialState, action) {
- let { type, data } = action;
+ let { type, data, schema } = action;
switch (type) {
case "product/list":
let itemsSubject = (Array.isArray(data) ? data : []).map(
@@ -62,8 +62,16 @@ export default function book(state = initialState, action) {
};
case "product/info":
return { ...state, loading: false, info: data, error: null };
- case "product/schoolUser":
- return { ...state, loading: false, schoolUserList: data, error: null };
+ case "product/schoolUsers":
+ console.log("{{{{{{-..-}}}}}}}")
+ console.log(action)
+ return {
+ ...state,
+ loading: false,
+ schoolUserList: data,
+ schema: schema,
+ error: null,
+ };
case "book/lesson/active":
return {
...state,
diff --git a/src/redux/reducers/exam2.js b/src/redux/reducers/exam2.js
index 0dd2e81..14a9796 100644
--- a/src/redux/reducers/exam2.js
+++ b/src/redux/reducers/exam2.js
@@ -10,6 +10,7 @@ const initialState = {
preview: null,
subExamList: [],
lastSubExamAdd:null,
+ list:null,
confirm:null
};
export default function exam2(state = initialState, action) {
@@ -25,13 +26,15 @@ export default function exam2(state = initialState, action) {
case "exam/parentAdd":
toast.success("آزمون شما با موفقیت ثبت شد");
return { ...state, loading: false, error: null, lastExamAdd: data.id };
+ case "exam/start":
+ return { ...state, loading: false, list: data, error: null };
case "exam/subexamAdd":
toast.success("درخواست با موفقیت انجام شد");
return {
...state,
loading: false,
error: null,
- lastSubExamAdd:data.id,
+ lastSubExamAdd: data.id,
subExamList: [...state.subExamList, data.id],
};
case "empty_subexam_list":
diff --git a/src/view/Exam/EnterExam/desktop/index.js b/src/view/Exam/EnterExam/desktop/index.js
index a541e02..dc365de 100644
--- a/src/view/Exam/EnterExam/desktop/index.js
+++ b/src/view/Exam/EnterExam/desktop/index.js
@@ -18,6 +18,7 @@ import moment from "jalali-moment";
import { useEffect } from "react";
import { state } from "../../../../components/exam/Carousel/state";
import { exam } from "../../../../redux/actions";
+import {useNavigate} from "react-router-dom"
let gradeList = [
"اول",
@@ -33,14 +34,18 @@ let gradeList = [
"یازدهم",
"دوازدهم",
];
-const EnterExam = ({ ID, getExamInfo, examInfo }) => {
+const EnterExam = ({
+ ID,
+ getExamInfo,
+ examInfo,
+ startExam,
+ examData,
+ setDontShowNav,
+}) => {
// 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;
@@ -49,64 +54,32 @@ const EnterExam = ({ ID, getExamInfo, examInfo }) => {
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
- // })
+ //----------------------------------------
+ const startExamBtnhandler = () => {
+ startExam({
+ examId: ID,
+ });
+ };
+ let navigate = useNavigate();
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);
- // }
- });
+ if (examData) {
+ setDontShowNav(true);
+ navigate(`/myServices/azmoon_list/exam/${ID}`);
+ }
+ }, [examData]);
+
//-------------------------------------------
moment.locale("en");
return (
@@ -118,13 +91,15 @@ const EnterExam = ({ ID, getExamInfo, examInfo }) => {
نام آزمون:
{examInfo?.name}
-
-
- پایه تحصیلی:
-
- {gradeList[examInfo?.gradeId - 1]}
+ {examInfo?.gradeId && (
+
+
+ پایه تحصیلی:
+
+ {gradeList[examInfo?.gradeId - 1]}
+
-
+ )}
زمان آزمون:
@@ -205,12 +180,13 @@ const EnterExam = ({ ID, getExamInfo, examInfo }) => {
ایجاد شده توسط
موسسه فرهنگی مصباح نور
*/}
-
شروع آزمون
-
+
{/* {(new Date(data.date)>today) &&
{timer.d} روز و
@@ -227,10 +203,12 @@ const EnterExam = ({ ID, getExamInfo, examInfo }) => {
const mapStateToProps = (state) => ({
examInfo: state.exam2.info,
+ examData : state.exam2.list
});
const mapDispatchToProps = {
getExamInfo: exam.info,
+ startExam : exam.start
};
export default connect(mapStateToProps, mapDispatchToProps)(EnterExam);
diff --git a/src/view/Exam/EnterExam/index.js b/src/view/Exam/EnterExam/index.js
index beb967a..eecd795 100644
--- a/src/view/Exam/EnterExam/index.js
+++ b/src/view/Exam/EnterExam/index.js
@@ -2,13 +2,17 @@ import EnterExam from "./desktop";
import { useParams } from "react-router-dom";
// import MobileEnterExam from "../../component/mobile/azmoon-list/M_EnterExam";
import MobileEnterExam from "./mobile";
-const ENTER_EXAM = () => {
+const ENTER_EXAM = ({ setDontShowNav }) => {
const { id } = useParams();
return (
- {window.innerWidth > 1000 && }
- {window.innerWidth < 1000 && }
+ {window.innerWidth > 1000 && (
+
+ )}
+ {window.innerWidth < 1000 && (
+
+ )}
);
};
diff --git a/src/view/Exam/index.js b/src/view/Exam/index.js
index d489bc3..3a5c298 100644
--- a/src/view/Exam/index.js
+++ b/src/view/Exam/index.js
@@ -21,8 +21,10 @@ let l1 = [];
let i = 0;
let l2 = [];
-const Exam = ({ ID, isMobile }) => {
-// const state = useSelector((state) => state.default);
+const Exam = ({ ID, isMobile, examData }) => {
+ // const state = useSelector((state) => state.default);
+ console.log("rtttttttttttttttttttttttttt");
+ console.log(examData);
const [common_data] = useState(state);
// responsive-setting-for-choice-width----------------------------------
@@ -846,8 +848,9 @@ const Exam = ({ ID, isMobile }) => {
}
}
- return (
- isMobile ? :
+ return isMobile ? (
+
+ ) : (
<>
{data_list.map((item) => {
if (item.choices) {
@@ -867,15 +870,11 @@ const Exam = ({ ID, isMobile }) => {
-
- {data?.name || ""}
-
+ {data?.name || ""}
-
- {data?.text}
-
+ {data?.text}
@@ -1050,6 +1049,7 @@ const mapStateToProps = (state) => ({
cartProductsLength: state.userProduct.list?.filter(
(product) => product.condition < 2
)?.length,
+ examData : state.exam2.list
});
const mapDispatchToProps = {
diff --git a/src/view/Exam2/Exam.js b/src/view/Exam2/Exam.js
index 24437d6..67f4c37 100644
--- a/src/view/Exam2/Exam.js
+++ b/src/view/Exam2/Exam.js
@@ -1,19 +1,30 @@
import Header from "./Header";
import Questions from "./Questions";
import "./index.css";
+import { connect } from "react-redux";
-const Exam=()=>{
+const Exam = ({ examData }) => {
+ console.log("||||||||||||||||||||||||||||");
+ console.log(examData);
return (
-
+
);
-}
+};
-export default Exam;
\ No newline at end of file
+const mapStateToProps = (state) => ({
+ examData : state.exam2.list
+});
+
+const mapDispatchToProps = {
+
+};
+
+export default connect(mapStateToProps, mapDispatchToProps)(Exam);
\ No newline at end of file
diff --git a/src/view/Exam2/Questions.js b/src/view/Exam2/Questions.js
index 8b8351e..2cf9051 100644
--- a/src/view/Exam2/Questions.js
+++ b/src/view/Exam2/Questions.js
@@ -1,154 +1,192 @@
-import { useEffect, useState } from "react";
+import { useEffect, useMemo, useState } from "react";
import { RiErrorWarningLine } from "react-icons/ri";
import './index.css';
import img1 from "../../assets/img/4bea9a991c6b23d3dcaf231513ee94bd.jpg";
-let data = [
- {
- id: 1,
- text: "این سوال برای تست قرار داده میشود و ادامه پیدا میکند تا طول متن بلندتر شود و در پایان علامت سوال قرار میگیرد؟",
- img: null,
- choices: [
- "گزینه اول که درست نیست",
- "گزینه دوم که این هم درست نیست",
- "گزینه سوم",
- "همه گزینهها",
- ],
- guidance: null,
- choiceWidth: null,
- choiceHeight: null,
- },
- {
- id: 2,
- text: "این سوال برای تست قرار داده میشود و ادامه پیدا میکند تا طول متن بلندتر شود و در پایان علامت سوال قرار میگیرد؟",
- img: img1,
- choices: ["11", "22", "33", "44"],
- guidance:
- "راهنمایی در مورد این سوال: در رابطه با سوال بالا سعی کنید دقت لازم را بعمل آورده و تمامی گذاره ها را در نظر بگیرید",
- choiceWidth: null,
- choiceHeight: null,
- },
- {
- id: 3,
- text: null,
- img: img1,
- choices: [
- "گزینه کوتاه",
- "گزینه متوسط",
- "گزینه بلند",
- "گزینه خیلی خیلی خیلی خیلی خیلی بلـــــــند",
- ],
- guidance:
- "راهنمایی در مورد این سوال: در رابطه با سوال بالا سعی کنید دقت لازم را بعمل آورده و تمامی گذاره ها را در نظر بگیرید",
- choiceWidth: null,
- choiceHeight: null,
- },
- {
- id: 4,
- text: "این سوال برای تست قرار داده میشود و ادامه پیدا میکند تا طول متن بلندتر شود و در پایان علامت سوال قرار میگیرد؟",
- img: null,
- choices: [
- "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است ",
- "22",
- "33",
- "44",
- ],
- guidance: null,
- choiceWidth: null,
- choiceHeight: null,
- },
- // {
- // id: 5,
- // text: "این سوال برای تست قرار داده میشود و ادامه پیدا میکند تا طول متن بلندتر شود و در پایان علامت سوال قرار میگیرد؟",
- // img: "",
- // choices: [
- // "تیرتسیذر",
- // "22",
- // "بتربدر",
- // "تیدرتسر",
- // "تشدتنسدر",
- // "ستیذزتن"
- // ],
- // guidance:"",
- // choiceWidth: null,
- // choiceHeight: null,
- // },
-];
+// let data = [
+// {
+// id: 1,
+// text: "این سوال برای تست قرار داده میشود و ادامه پیدا میکند تا طول متن بلندتر شود و در پایان علامت سوال قرار میگیرد؟",
+// img: null,
+// choices: [
+// "گزینه اول که درست نیست",
+// "گزینه دوم که این هم درست نیست",
+// "گزینه سوم",
+// "همه گزینهها",
+// ],
+// guidance: null,
+// choiceWidth: null,
+// choiceHeight: null,
+// },
+// {
+// id: 2,
+// text: "این سوال برای تست قرار داده میشود و ادامه پیدا میکند تا طول متن بلندتر شود و در پایان علامت سوال قرار میگیرد؟",
+// img: img1,
+// choices: ["11", "22", "33", "44"],
+// guidance:
+// "راهنمایی در مورد این سوال: در رابطه با سوال بالا سعی کنید دقت لازم را بعمل آورده و تمامی گذاره ها را در نظر بگیرید",
+// choiceWidth: null,
+// choiceHeight: null,
+// },
+// {
+// id: 3,
+// text: null,
+// img: img1,
+// choices: [
+// "گزینه کوتاه",
+// "گزینه متوسط",
+// "گزینه بلند",
+// "گزینه خیلی خیلی خیلی خیلی خیلی بلـــــــند",
+// ],
+// guidance:
+// "راهنمایی در مورد این سوال: در رابطه با سوال بالا سعی کنید دقت لازم را بعمل آورده و تمامی گذاره ها را در نظر بگیرید",
+// choiceWidth: null,
+// choiceHeight: null,
+// },
+// {
+// id: 4,
+// text: "این سوال برای تست قرار داده میشود و ادامه پیدا میکند تا طول متن بلندتر شود و در پایان علامت سوال قرار میگیرد؟",
+// img: null,
+// choices: [
+// "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است ",
+// "22",
+// "33",
+// "44",
+// ],
+// guidance: null,
+// choiceWidth: null,
+// choiceHeight: null,
+// },
+// // {
+// // id: 5,
+// // text: "این سوال برای تست قرار داده میشود و ادامه پیدا میکند تا طول متن بلندتر شود و در پایان علامت سوال قرار میگیرد؟",
+// // img: "",
+// // choices: [
+// // "تیرتسیذر",
+// // "22",
+// // "بتربدر",
+// // "تیدرتسر",
+// // "تشدتنسدر",
+// // "ستیذزتن"
+// // ],
+// // guidance:"",
+// // choiceWidth: null,
+// // choiceHeight: null,
+// // },
+// ];
//badgeList-------------
let badgeList = ["الف", "ب", "ج", "د","هـ","ز"];
-const Questions = () => {
- const [Data, setData] = useState(data);
+const Questions = ({questions}) => {
+ const [Data, setData] = useState(null);
+ console.log("exam render-----------------")
+ console.log(Data);
const [fake, setFake] = useState(0);
+ const [layoutTrigger,setLayoutTrigger]=useState(0);
const [answerList, setAnswerList] = useState([]);
- //choice layout setting-& default answer-----------------
+ //create local data from api data -------------------------------------
+ const createChoices=(item)=>{
+ let list = [];
+ let options = [
+ item["question.option1"],
+ item["question.option2"],
+ item["question.option3"],
+ item["question.option4"],
+ item["question.option5"],
+ ];
+ for (let i = 0; i < item["question.type"]; i++) {
+ list.push(options[i]);
+ }
+ return(list)
+ }
useEffect(() => {
- let newData = Data;
- let defaultAnswers = [];
- let Choice = document.querySelectorAll(".Choice");
- let examSize = document.querySelector(".Choice-container").offsetWidth - 58;
- console.log(examSize);
- for (let i = 0; i < data.length; i++) {
- defaultAnswers.push("");
- console.log(i + 1 + ":-----------------------");
- //پیدا کردن تعداد گزینه ها
- let choiceNumber = data[i].choices.length;
- //پیدا کردن اندازه هر گزینه
- let wList = [];
- let hList = [];
- for (let j = 0; j < data[i].choices.length; j++) {
- let w = Choice[i * choiceNumber + j].offsetWidth;
- wList.push(w);
- let h = Choice[i * choiceNumber + j].offsetHeight;
- hList.push(h);
- }
- console.log("wList:");
- console.log(wList);
- wList.sort(function (a, b) {
- return b - a;
- });
- hList.sort(function (a, b) {
- return b - a;
+ let newList =[];
+ console.log("create data useEffect------------------------");
+ for (let i = 0; i < questions?.length; i++) {
+ newList.push({
+ id: questions[i]["question.id"],
+ text: questions[i]["question.text"],
+ fileId: questions[i]["question.fileId"],
+ choices: createChoices(questions[i]),
+ guidance: questions[i]["question.help"],
+ choiceWidth: null,
+ choiceHeight: null,
});
- console.log("wList:");
- console.log(wList);
- //پیدا کردن بزرگ ترین گزینه
- let wMax = wList[0];
- let hMax = hList[0];
- console.log("wMax:" + wMax);
- //چک کردن اندازه بزرگ ترین عضو با توجه به تعداد گزینه ها و اندازه صفحه و اعمال تنظیمات اندازه
- newData[i].choiceHeight = hMax;
- if (wMax < 0.23 * examSize && choiceNumber === 4) {
- newData[i].choiceWidth = 23;
- console.log("o");
- } else if (wMax < 0.32 * examSize && choiceNumber === 3) {
- newData[i].choiceWidth = 32;
- console.log("oo");
- } else if (wMax < 0.47 * examSize && choiceNumber === 2) {
- newData[i].choiceWidth = 48;
- console.log("ooo");
- } else if (wMax < 0.48 * examSize && choiceNumber === 4) {
- newData[i].choiceWidth = 48;
- console.log("oooo");
- } else if (wMax < 0.18 * examSize && choiceNumber === 5) {
- newData[i].choiceWidth = 18;
- console.log("oo");
- } else if (wMax < 0.15 * examSize && choiceNumber === 6) {
- newData[i].choiceWidth = 15;
- console.log("oo");
- } else {
- newData[i].choiceWidth = "full";
- console.log("ooooo");
+ }
+ setData(newList);
+ console.log("created data-----------------------");
+ console.log(newList);
+ setFake(Math.random()*10000);
+ setLayoutTrigger(Math.random() * 10000);
+ }, [questions]);
+ //--------------------------------------------------
+ //choice layout setting-& default answer-----------------
+ useEffect(() => {
+ console.log(
+ "choice layout setting-& default answer-----------------------"
+ );
+ console.log(Data);
+ if (Data) {
+ let newData = Data;
+ let data = Data;
+ let defaultAnswers = [];
+ let Choice = document.querySelectorAll(".Choice");
+ let examSize =
+ document.querySelector(".Choice-container")?.offsetWidth - 58;
+ for (let i = 0; i < data?.length; i++) {
+ defaultAnswers.push("");
+ //پیدا کردن تعداد گزینه ها
+ let choiceNumber = data[i].choices.length;
+ //پیدا کردن اندازه هر گزینه
+ let wList = [];
+ let hList = [];
+ for (let j = 0; j < data[i].choices.length; j++) {
+ let w = Choice[i * choiceNumber + j].offsetWidth;
+ wList.push(w);
+ let h = Choice[i * choiceNumber + j].offsetHeight;
+ hList.push(h);
+ }
+ console.log("wList:");
+ console.log(wList);
+ wList.sort(function (a, b) {
+ return b - a;
+ });
+ hList.sort(function (a, b) {
+ return b - a;
+ });
+ console.log("wList:");
+ console.log(wList);
+ //پیدا کردن بزرگ ترین گزینه
+ let wMax = wList[0];
+ let hMax = hList[0];
+ console.log("wMax:" + wMax);
+ //چک کردن اندازه بزرگ ترین عضو با توجه به تعداد گزینه ها و اندازه صفحه و اعمال تنظیمات اندازه
+ newData[i].choiceHeight = hMax;
+ if (wMax < 0.23 * examSize && choiceNumber === 4) {
+ newData[i].choiceWidth = 23;
+ } else if (wMax < 0.32 * examSize && choiceNumber === 3) {
+ newData[i].choiceWidth = 32;
+ } else if (wMax < 0.47 * examSize && choiceNumber === 2) {
+ newData[i].choiceWidth = 48;
+ } else if (wMax < 0.48 * examSize && choiceNumber === 4) {
+ newData[i].choiceWidth = 48;
+ } else if (wMax < 0.18 * examSize && choiceNumber === 5) {
+ newData[i].choiceWidth = 18;
+ } else if (wMax < 0.15 * examSize && choiceNumber === 6) {
+ newData[i].choiceWidth = 15;
+ } else {
+ newData[i].choiceWidth = "full";
+ }
}
+ setData(newData);
+ setAnswerList(defaultAnswers);
+ setFake(fake + 1);
}
- setData(newData);
- setAnswerList(defaultAnswers);
- setFake(fake + 1);
- }, []);
+ }, [questions, layoutTrigger]);
//choose choice-----------------------------
- const [counter,setCounter]=useState(0);
+ const [counter, setCounter] = useState(0);
const chooseHandler = (index, answer) => {
let list = answerList;
if (list[index] !== answer) {
@@ -158,7 +196,7 @@ const Questions = () => {
list[index] = answer;
} else {
list[index] = "";
- setCounter(counter-1);
+ setCounter(counter - 1);
}
setAnswerList(list);
setFake(fake + 1);
@@ -166,7 +204,7 @@ const Questions = () => {
return (
- {Data.map((item, index) => (
+ {Data?.map((item, index) => (
{/* -----question-text----------------------- */}
@@ -174,22 +212,22 @@ const Questions = () => {
{index + 1}
- {item.text && (
+ {item?.text && (
- {item.text}
+ {item?.text}
)}
{/* -----question-img----------------------- */}
- {item.img && (
+ {item?.fileId && (
@@ -199,7 +237,7 @@ const Questions = () => {
{/* -----choices----------------------------- */}
- {item.choices.map((choice, INDEX) => (
+ {item?.choices?.map((choice, INDEX) => (
{
- const [activeNote,setActiveNote]=useState(0);
+const ViewExamNote = ({ notes, questions }) => {
+ const [activeNote, setActiveNote] = useState(0);
const [activeFileId, setActiveFileId] = useState(null);
- const changeNoteHandler=(index,fileId)=>{
+ const changeNoteHandler = (index, fileId) => {
setActiveNote(index);
setActiveFileId(fileId);
- }
+ };
- useEffect(()=>{
+ useEffect(() => {
setActiveFileId(notes[0].fileId);
- },[notes])
+ }, [notes]);
- console.log("rrrrrrrrrrrr============")
+ console.log("rrrrrrrrrrrr============");
console.log(activeFileId);
const createOptions = (item) => {
@@ -63,11 +59,11 @@ const ViewExamNote = ({ notes ,questions}) => {
>
{/*
@@ -130,4 +126,4 @@ const ViewExamNote = ({ notes ,questions}) => {
);
};
-export default ViewExamNote
\ No newline at end of file
+export default ViewExamNote;
diff --git a/src/view/services/Budget.js b/src/view/services/Budget.js
index 086c1ec..a36e83e 100644
--- a/src/view/services/Budget.js
+++ b/src/view/services/Budget.js
@@ -1,14 +1,12 @@
-
import closeBtn from "../../assets/img/Group 1862.svg";
-
-import React from 'react'
+import React from "react";
const Budget = ({ setShowBudget, setBudgetFileId, budgetFileId }) => {
- const closeHandler=()=>{
+ const closeHandler = () => {
setShowBudget(false);
setBudgetFileId(false);
- }
+ };
return (
{
{budgetFileId && (
@@ -39,4 +37,4 @@ const Budget = ({ setShowBudget, setBudgetFileId, budgetFileId }) => {
);
};
-export default Budget
\ No newline at end of file
+export default Budget;
diff --git a/src/view/services/PaymentBox.js b/src/view/services/PaymentBox.js
index d0c4796..37364ac 100644
--- a/src/view/services/PaymentBox.js
+++ b/src/view/services/PaymentBox.js
@@ -144,12 +144,12 @@ const PaymentBox = ({
if (window.innerWidth > 1000) {
payment({
price: item.amount,
- redirectUrl: "https://new.andishmand.ir/services",
+ redirectUrl: "https://api.andishmand.ir/services",
});
} else {
payment({
price: item.amount,
- redirectUrl: "https://new.andishmand.ir/shoppingCart",
+ redirectUrl: "https://api.andishmand.ir/shoppingCart",
});
}
// payment({
diff --git a/src/view/services/service/index.js b/src/view/services/service/index.js
index 48a688d..a163000 100644
--- a/src/view/services/service/index.js
+++ b/src/view/services/service/index.js
@@ -13,7 +13,7 @@ const servicePopUp = ({
setShowBudget,
setBudgetFileId,
userInfo,
- pushToCart
+ pushToCart,
}) => {
console.log(")))))((((((((((");
console.log(content);
@@ -38,10 +38,10 @@ const servicePopUp = ({
console.log(childList);
console.log(parentLength);
if (parentLength === childList.length) {
- pushToCart({ productId :content.product.id,count:1});
+ pushToCart({ productId: content.product.id, count: 1 });
} else {
- for(let j=0;j
))}
- {rulesAccepted &&
-
- افزودن به سبد خرید
+ {rulesAccepted && (
+
- }
+ )}
)}
{content.id === 3 && (
@@ -288,7 +290,7 @@ const servicePopUp = ({
{content.id === 1 && (
diff --git a/src/view/user-management/index.js b/src/view/user-management/index.js
index 5586d97..87c824b 100644
--- a/src/view/user-management/index.js
+++ b/src/view/user-management/index.js
@@ -27,6 +27,8 @@ const UserManagement = ({
}, []);
// console.log(info);
console.log(schoolList);
+ console.log("==============^tabs^==============");
+ console.log(tabs);
useEffect(() => {
setTabs([
{
@@ -38,6 +40,8 @@ const UserManagement = ({
]);
}, []);
console.log("ProductManagement render---------------------------------");
+ console.log(info);
+ console.log(schoolUserList);
// console.log(tabs);
// const [tabs, setTabs] = useState([
// {
@@ -87,8 +91,8 @@ const UserManagement = ({
)}
({
- info: state[source].schoolUserList,
+ info: state[source],
tabs: state.table.tabs,
schoolList: state.book.list,
schoolUserList: state.book.schoolUserList,
diff --git a/src/view/user-management/layouts/Editor.js b/src/view/user-management/layouts/Editor.js
index bcb21da..55600a2 100644
--- a/src/view/user-management/layouts/Editor.js
+++ b/src/view/user-management/layouts/Editor.js
@@ -181,7 +181,7 @@ const datehandler=(value,mode)=>{
))}
{data ? "ثبت تغییرات" : "ثبت ردیف"}
|