diff --git a/src/redux/reducers/exam.js b/src/redux/reducers/exam.js index c1823e2..5299c15 100644 --- a/src/redux/reducers/exam.js +++ b/src/redux/reducers/exam.js @@ -8,8 +8,41 @@ const initialState = { endTime: '', description: '', type: 1, - courses: [], - questionnaires: [] + + questionnaires: [ + { + id:1, + name: 'عمومی', + fileUrl: '', + }, + { + id:2, + name: 'اختصاصی', + fileUrl: '', + } + ], + questionairesCourses: [ + { + id: 0, + questionnaireId: 1, + questionsQuantity:20, + name: 'دینی', + }, + { + id: 1, + questionnaireId: 2, + questionsQuantity:20, + name: 'ریاضی', + }, + + ], + + answers: [ + { + questionId: 1, + answer: 2, + } + ] } export default function addExamReduser(state = initialState, { type, payload }) { @@ -46,7 +79,7 @@ export default function addExamReduser(state = initialState, { type, payload }) case 'ADD_EXAM_QUESTIONAIRES': return { ...state, - payload + questionnaires: [...state.questionnaires, payload] } default: diff --git a/src/view/addExam/views/addQuestions.js b/src/view/addExam/views/addQuestions.js index b2f5c7d..564507a 100644 --- a/src/view/addExam/views/addQuestions.js +++ b/src/view/addExam/views/addQuestions.js @@ -13,9 +13,17 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) = const [type, setType] = useState(null); const [description, setDescription] = useState(null); const [questionarePopUp, setQuestionairePopUp] = useState(false); + const [newQuestionaire, setNewQuestionaire] = useState({ + id: addExamState.questionnaires.length + 1, + name: '', + fileUrl: '', + }); const [showCoursesInList, setShowCoursesInList] = useState([]); const [choosedQuestionaries, seChoosedQuestionaries] = useState([]); - const [selectedQuestionare, setSelectedQuestionare] = useState(null); + const [selectedQuestionare, setSelectedQuestionare] = useState({ + id: null, + courses: [] + }); const [selectedCourse, setSelectedCourse] = useState({ sortId: 1, title: 'ادبیات فارسی', @@ -25,6 +33,9 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) = }) console.log(choosedQuestionaries) + console.log(newQuestionaire) + console.log(addExamState.questionnaires) + useEffect(() => { questoinaresLists.map(item => showCoursesInList.push(false)); @@ -131,9 +142,25 @@ const AddQuestions = ({ grades, addExamState, dispatch, stepClick, backStep }) = - -
- {item.title} + {item.name}