From dd6d6966b8b9d097784edff390b95c12ff5a312a Mon Sep 17 00:00:00 2001 From: Pkpedram Date: Sat, 26 Feb 2022 12:08:17 +0330 Subject: [PATCH] Picking DAFTARCHES Allowd --- src/components/Checkbox/index.js | 3 +- src/view/addExam/views/addQuestions.js | 108 ++++++++++++++----------- 2 files changed, 63 insertions(+), 48 deletions(-) diff --git a/src/components/Checkbox/index.js b/src/components/Checkbox/index.js index f9d4f26..7ca8ec8 100644 --- a/src/components/Checkbox/index.js +++ b/src/components/Checkbox/index.js @@ -3,6 +3,7 @@ import './index.css'; export default function Checkbox(props) { // console.log(props) + // document.getElementById('ch'+props.name).checked === true && props.checkedFunction(); return (
@@ -17,7 +18,7 @@ export default function Checkbox(props) {
- +
-
+
{ questoinaresLists.map( - (item, index) => ( - <> -
- -

{item.title}

-

تعداد سوالات: {item.numberOfQuestions}

-

تعداد دروس: {item.courses.length}

-

{ - let newArray = [...showCoursesInList]; - - newArray[index] = !newArray[index]; - - - setShowCoursesInList(newArray) - - }}>نمایش دروس

- -
- { - showCoursesInList[index] &&
- { - item.courses.map((course) => ( -
-

- {course.title} -

-

- ضریب : {course.coefficient} -

-

( + <> +

+ + e.target.checked ? + seChoosedQuestionaries([...choosedQuestionaries, item]) + : + + + seChoosedQuestionaries(choosedQuestionaries.filter(itm => itm.id !== item.id)) + + + } + + /> +

{item.title}

+

تعداد سوالات: {item.numberOfQuestions}

+

تعداد دروس: {item.courses.length}

+

{ + let newArray = [...showCoursesInList]; + + newArray[index] = !newArray[index]; + + + setShowCoursesInList(newArray) + + }}>نمایش دروس

+ +
+ { + showCoursesInList[index] &&
+ { + item.courses.map((course) => ( +
+

+ {course.title} +

+

+ ضریب : {course.coefficient} +

+

از سوال {course.questionStart} تا سوال {course.questionEnd}

-
- ) ) - } + >از سوال {course.questionStart} تا سوال {course.questionEnd}

+
+ )) + }
- } - - ) + } + + ) ) }