Answer Sheet Changes

main
Pedram Keshavarzi 3 years ago
parent 38e7771575
commit 37efa111ea
  1. 6
      src/components/AnswerSheet/index.js
  2. 4
      src/components/selectedCourse/index.js
  3. 15
      src/view/addExam/views/addQuestions.js

@ -21,7 +21,7 @@ const AnswerSheet = ({questionsQuantity, optionsQuantity }) => {
setOptions(optionsArray); setOptions(optionsArray);
setData(array) setData(array)
console.log(data, options) console.log(data, options)
}, []) }, [questionsQuantity])
return( return(
<div className="w-full flex flex-col border border-gray-200 rounded-xl bg-white"> <div className="w-full flex flex-col border border-gray-200 rounded-xl bg-white">
@ -44,7 +44,9 @@ const AnswerSheet = ({questionsQuantity, optionsQuantity }) => {
setData(newArray) setData(newArray)
console.log(data) console.log(data)
}} /> }} >
</p>
) )

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
const SelectedCourse = ({ openAnswerSheet, title, questionQuantity, coefficient, optionsQuantity }) => { const SelectedCourse = ({ onClick, title, questionQuantity, coefficient, optionsQuantity }) => {
return ( return (
<div className="w-full border border-gray-400 rounded-xl bg-white flex items-center justify-between px-6 py-8 mt-8"> <div className="w-full border border-gray-400 rounded-xl bg-white flex items-center justify-between px-6 py-8 mt-8">
<div className="flex flex-col w-full"> <div className="flex flex-col w-full">
@ -32,7 +32,7 @@ const SelectedCourse = ({ openAnswerSheet, title, questionQuantity, coefficient,
</textarea> </textarea>
</div> </div>
<h1 className="w-40 text-center text-lg text-blue3A font-bold cursor-pointer" onClick={openAnswerSheet}> <h1 className="w-40 text-center text-lg text-blue3A font-bold cursor-pointer" onClick={onClick}>
پاسخ برگ پاسخ برگ
</h1> </h1>
</div> </div>

@ -15,7 +15,15 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) =
const [questionarePopUp, setQuestionairePopUp] = useState(false); const [questionarePopUp, setQuestionairePopUp] = useState(false);
const [showCoursesInList, setShowCoursesInList] = useState([]); const [showCoursesInList, setShowCoursesInList] = useState([]);
const [choosedQuestionaries, seChoosedQuestionaries] = useState([]); const [choosedQuestionaries, seChoosedQuestionaries] = useState([]);
const [selectedQuestionare, setSelectedQuestionare] = useState(null) const [selectedQuestionare, setSelectedQuestionare] = useState(null);
const [selectedCourse, setSelectedCourse] = useState({
sortId: 1,
title: 'ادبیات فارسی',
coefficient: 3,
questionStart: 1,
questionEnd: 0,
})
console.log(choosedQuestionaries) console.log(choosedQuestionaries)
useEffect(() => { useEffect(() => {
@ -235,7 +243,8 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) =
{ {
selectedQuestionare?.courses.map( selectedQuestionare?.courses.map(
(item) => ( (item) => (
<SelectedCourse title={item.title} coefficient={item.coefficient} questionQuantity={item.questionEnd - item.questionStart + 1}/> <SelectedCourse title={item.title} coefficient={item.coefficient} questionQuantity={item.questionEnd - item.questionStart + 1}
onClick={() => {setSelectedCourse(item); console.log(selectedCourse)}}/>
) )
) )
} }
@ -246,7 +255,7 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) =
</div> </div>
<div className="w-1/2 flex justify-center"> <div className="w-1/2 flex justify-center">
<div className="w-4/5 py-8"> <div className="w-4/5 py-8">
<AnswerSheet questionsQuantity={30} optionsQuantity={4}/> <AnswerSheet questionsQuantity={selectedCourse.questionEnd - selectedCourse.questionStart + 1} optionsQuantity={4}/>
</div> </div>
</div> </div>

Loading…
Cancel
Save