From f59a890d143dda91de8c50528c3d7e20a6aacd09 Mon Sep 17 00:00:00 2001 From: Pkpedram Date: Sat, 26 Feb 2022 13:51:04 +0330 Subject: [PATCH] Listing Courses Of Questionaires Done --- src/components/selectedCourse/index.js | 42 +++++++++++++++++++ src/view/addExam/views/addQuestions.js | 58 +++++++++++++++++++++----- 2 files changed, 90 insertions(+), 10 deletions(-) create mode 100644 src/components/selectedCourse/index.js diff --git a/src/components/selectedCourse/index.js b/src/components/selectedCourse/index.js new file mode 100644 index 0000000..17e2e40 --- /dev/null +++ b/src/components/selectedCourse/index.js @@ -0,0 +1,42 @@ +import React from "react"; + +const SelectedCourse = ({openAnswerSheet, title, questionQuantity, coefficient, optionsQuantity }) => { + return( +
+
+ +

+ {title} +

+
+

+

تعداد سوالات

+ +

+

+

ضریب

+ +

+

+

تعداد گزینه

+ +

+

+

نمره منفی

+ +

+ + +
+ +
+

+ پاسخ برگ +

+
+ ) +} + +export default SelectedCourse; \ No newline at end of file diff --git a/src/view/addExam/views/addQuestions.js b/src/view/addExam/views/addQuestions.js index ba09edf..a9703b5 100644 --- a/src/view/addExam/views/addQuestions.js +++ b/src/view/addExam/views/addQuestions.js @@ -5,6 +5,7 @@ import Button from "../../../components/Button"; import DatePicker from "../../../components/Calendar/CalendarComponents/DatePicker"; import Checkbox from "../../../components/Checkbox"; import RangeDatePicker from "../../../components/RangeDatePicker"; +import SelectedCourse from "../../../components/selectedCourse"; const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) => { const [name, setName] = useState(null); @@ -13,6 +14,7 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) = const [questionarePopUp, setQuestionairePopUp] = useState(false); const [showCoursesInList, setShowCoursesInList] = useState([]); const [choosedQuestionaries, seChoosedQuestionaries] = useState([]); + const [selectedQuestionare, setSelectedQuestionare] = useState(null) console.log(choosedQuestionaries) useEffect(() => { @@ -64,12 +66,12 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) = }, { id: 2, - title: 'دفترچه عمومی', + title: 'دفترچه اختصاصی', numberOfQuestions: 60, courses: [ { sortId: 1, - title: 'ادبیات فارسی', + title: 'ریاضی', coefficient: 3, questionStart: 1, questionEnd: 20, @@ -77,7 +79,7 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) = }, { sortId: 2, - title: 'عربی', + title: 'فیزیک', coefficient: 3, questionStart: 21, questionEnd: 35, @@ -85,7 +87,7 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) = }, { sortId: 3, - title: 'دینی', + title: 'شیمی', coefficient: 2, questionStart: 36, questionEnd: 46, @@ -93,7 +95,7 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) = }, { sortId: 4, - title: 'زبان خارجه', + title: 'زیست ', coefficient: 1, questionStart: 47, questionEnd: 60, @@ -120,7 +122,7 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) = - +
{ questoinaresLists.map( @@ -145,7 +147,7 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) =

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

{ let newArray = [...showCoursesInList]; - + newArray[index] = !newArray[index]; @@ -191,7 +193,21 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) =

-
addExamState.type == 'bank' ? console.log('bank') : setQuestionairePopUp(true)}> + { + choosedQuestionaries.map( + (item => ( +
setSelectedQuestionare(item)}> + +

+ {item.title} +

+
+ )) + ) + } + +
addExamState.type == 'bank' ? console.log('bank') : setQuestionairePopUp(true)}>

+

@@ -204,8 +220,30 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) =
-
- {addExamState.type === 'bank' ? 'بانک سوالات' : 'دفترچه سوالات'} +
+ +
+ { + selectedQuestionare !== null && (<> +

+ {selectedQuestionare.title} +

+
+
+ + { + selectedQuestionare?.courses.map( + (item) => ( + + ) + ) + } +
+
+ ) + } +
+