|
|
@ -1,4 +1,3 @@ |
|
|
|
|
|
|
|
|
|
|
|
import React, { useEffect, useState } from "react"; |
|
|
|
import React, { useEffect, useState } from "react"; |
|
|
|
import { connect } from "react-redux"; |
|
|
|
import { connect } from "react-redux"; |
|
|
|
import AnswerSheet from "../../../components/AnswerSheet"; |
|
|
|
import AnswerSheet from "../../../components/AnswerSheet"; |
|
|
@ -13,74 +12,101 @@ import { Droppable } from "react-beautiful-dnd"; |
|
|
|
import { Draggable } from "react-beautiful-dnd"; |
|
|
|
import { Draggable } from "react-beautiful-dnd"; |
|
|
|
import { toMap } from "draft-js/lib/DefaultDraftBlockRenderMap"; |
|
|
|
import { toMap } from "draft-js/lib/DefaultDraftBlockRenderMap"; |
|
|
|
|
|
|
|
|
|
|
|
const AddQuestionnaireExam = ({ grades, addExamState, dispatch, stepClick, backStep }) => { |
|
|
|
const AddQuestionnaireExam = ({ |
|
|
|
|
|
|
|
grades, |
|
|
|
|
|
|
|
addExamState, |
|
|
|
|
|
|
|
dispatch, |
|
|
|
|
|
|
|
stepClick, |
|
|
|
|
|
|
|
backStep, |
|
|
|
|
|
|
|
}) => { |
|
|
|
const [questionarePopUp, setQuestionairePopUp] = useState(false); |
|
|
|
const [questionarePopUp, setQuestionairePopUp] = useState(false); |
|
|
|
const [addCoursePopup, setAddCoursePopup] = useState(false); |
|
|
|
const [addCoursePopup, setAddCoursePopup] = useState(false); |
|
|
|
const [newQuestionaire, setNewQuestionaire] = useState({ |
|
|
|
const [newQuestionaire, setNewQuestionaire] = useState({ |
|
|
|
id: addExamState.questionnaires.length + 1, |
|
|
|
id: addExamState.questionnaires.length + 1, |
|
|
|
name: '', |
|
|
|
name: "", |
|
|
|
fileUrl: '', |
|
|
|
fileUrl: "", |
|
|
|
}); |
|
|
|
}); |
|
|
|
const [showCoursesInList, setShowCoursesInList] = useState([]); |
|
|
|
const [showCoursesInList, setShowCoursesInList] = useState([]); |
|
|
|
const [choosedQuestionaries, seChoosedQuestionaries] = useState([]); |
|
|
|
const [choosedQuestionaries, seChoosedQuestionaries] = useState([]); |
|
|
|
const [selectedQuestionare, setSelectedQuestionare] = useState({ |
|
|
|
const [selectedQuestionare, setSelectedQuestionare] = useState({ |
|
|
|
id: null, |
|
|
|
id: null, |
|
|
|
courses: [] |
|
|
|
courses: [], |
|
|
|
}); |
|
|
|
}); |
|
|
|
const [answers, setAnswers] = useState(null); |
|
|
|
const [answers, setAnswers] = useState(null); |
|
|
|
const [newCourse, setNewCourse] = useState({ |
|
|
|
const [newCourse, setNewCourse] = useState({ |
|
|
|
id: selectedQuestionare.courses.length + selectedQuestionare.id + 1, |
|
|
|
id: selectedQuestionare.courses.length + selectedQuestionare.id + 1, |
|
|
|
questionnaireId: selectedQuestionare.id, |
|
|
|
questionnaireId: selectedQuestionare.id, |
|
|
|
questionsQuantity: 20, |
|
|
|
questionsQuantity: 20, |
|
|
|
name: '', |
|
|
|
name: "", |
|
|
|
coefficient: 4 |
|
|
|
coefficient: 4, |
|
|
|
}) |
|
|
|
}); |
|
|
|
const [selectedCourse, setSelectedCourse] = useState({ |
|
|
|
const [selectedCourse, setSelectedCourse] = useState({ |
|
|
|
sortId: 1, |
|
|
|
sortId: 1, |
|
|
|
title: 'ادبیات فارسی', |
|
|
|
title: "ادبیات فارسی", |
|
|
|
coefficient: 3, |
|
|
|
coefficient: 3, |
|
|
|
questionStart: 1, |
|
|
|
questionStart: 1, |
|
|
|
questionEnd: 0, |
|
|
|
questionEnd: 0, |
|
|
|
|
|
|
|
}); |
|
|
|
}) |
|
|
|
|
|
|
|
// console.log(choosedQuestionaries)
|
|
|
|
// console.log(choosedQuestionaries)
|
|
|
|
// console.log(newQuestionaire)
|
|
|
|
// console.log(newQuestionaire)
|
|
|
|
// console.log(addExamState.questionnaires)
|
|
|
|
// console.log(addExamState.questionnaires)
|
|
|
|
console.log(newCourse) |
|
|
|
console.log(newCourse); |
|
|
|
console.log(selectedQuestionare) |
|
|
|
console.log(selectedQuestionare); |
|
|
|
console.log(selectedCourse.id) |
|
|
|
console.log(selectedCourse.id); |
|
|
|
console.log(answers) |
|
|
|
console.log(answers); |
|
|
|
|
|
|
|
|
|
|
|
const [fakeState, setFakeState] = useState(2); |
|
|
|
const [fakeState, setFakeState] = useState(2); |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
setSelectedCourse(selectedCourse) |
|
|
|
setSelectedCourse(selectedCourse); |
|
|
|
setFakeState(fakeState + 15) |
|
|
|
setFakeState(fakeState + 15); |
|
|
|
}, [addExamState]) |
|
|
|
}, [addExamState]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
// questoinaresLists.map(item => showCoursesInList.push(false));
|
|
|
|
// questoinaresLists.map(item => showCoursesInList.push(false));
|
|
|
|
if (answers !== null && answers !== []) { |
|
|
|
if (answers !== null && answers !== []) { |
|
|
|
answers.map(item => dispatch({ type: 'ADD_ANSWERS', payload: item })) |
|
|
|
answers.map((item) => dispatch({ type: "ADD_ANSWERS", payload: item })); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, [answers]); |
|
|
|
}, [answers]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
{ |
|
|
|
{questionarePopUp && ( |
|
|
|
questionarePopUp && <div className="w-full z-10 fixed h-screen backdrop-blur flex items-center -mt-10 justify-center"> |
|
|
|
<div className="w-full z-10 fixed h-screen backdrop-blur flex items-center -mt-10 justify-center"> |
|
|
|
<div className="w-1/2 bg-white rounded-xl flex flex-col shadow-lg p-6"> |
|
|
|
<div className="w-1/2 bg-white rounded-xl flex flex-col shadow-lg p-6"> |
|
|
|
<div className="w-full"> |
|
|
|
<div className="w-full"> |
|
|
|
<div className="w-8 h-8 text-white text-sm rounded-full cursor-pointer flex justify-center items-center bg-red52" onClick={() => setQuestionairePopUp(false)}> |
|
|
|
<div |
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 15.044 15.044"> |
|
|
|
className="w-8 h-8 text-white text-sm rounded-full cursor-pointer flex justify-center items-center bg-red52" |
|
|
|
<g id="vuesax_linear_card-remove" data-name="vuesax/linear/card-remove" transform="translate(-252.46 -511.461)"> |
|
|
|
onClick={() => setQuestionairePopUp(false)} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<svg |
|
|
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg" |
|
|
|
|
|
|
|
width="12" |
|
|
|
|
|
|
|
height="12" |
|
|
|
|
|
|
|
viewBox="0 0 15.044 15.044" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<g |
|
|
|
|
|
|
|
id="vuesax_linear_card-remove" |
|
|
|
|
|
|
|
data-name="vuesax/linear/card-remove" |
|
|
|
|
|
|
|
transform="translate(-252.46 -511.461)" |
|
|
|
|
|
|
|
> |
|
|
|
<g id="card-remove" transform="translate(253.309 512.31)"> |
|
|
|
<g id="card-remove" transform="translate(253.309 512.31)"> |
|
|
|
<path id="Vector" d="M0,13.347,13.347,0" fill="none" stroke="#fff" strokeLinecap="round" strokeWidth="2" /> |
|
|
|
<path |
|
|
|
<path id="Vector-2" data-name="Vector" d="M13.347,13.347,0,0" fill="none" stroke="#fff" strokeLinecap="round" strokeWidth="2" /> |
|
|
|
id="Vector" |
|
|
|
|
|
|
|
d="M0,13.347,13.347,0" |
|
|
|
|
|
|
|
fill="none" |
|
|
|
|
|
|
|
stroke="#fff" |
|
|
|
|
|
|
|
strokeLinecap="round" |
|
|
|
|
|
|
|
strokeWidth="2" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<path |
|
|
|
|
|
|
|
id="Vector-2" |
|
|
|
|
|
|
|
data-name="Vector" |
|
|
|
|
|
|
|
d="M13.347,13.347,0,0" |
|
|
|
|
|
|
|
fill="none" |
|
|
|
|
|
|
|
stroke="#fff" |
|
|
|
|
|
|
|
strokeLinecap="round" |
|
|
|
|
|
|
|
strokeWidth="2" |
|
|
|
|
|
|
|
/> |
|
|
|
</g> |
|
|
|
</g> |
|
|
|
</g> |
|
|
|
</g> |
|
|
|
</svg> |
|
|
|
</svg> |
|
|
@ -91,14 +117,33 @@ const AddQuestionnaireExam = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
</h1> |
|
|
|
</h1> |
|
|
|
<div className="w-full flex items-center flex-col mt-6 px-2 "> |
|
|
|
<div className="w-full flex items-center flex-col mt-6 px-2 "> |
|
|
|
<div className="flex justify-between w-full"> |
|
|
|
<div className="flex justify-between w-full"> |
|
|
|
<input type='text' placeholder="نام دفترچه..." className="w-4/5 p-4 ml-2 rounded border border-red52 h-12 text-red26 outline-none" |
|
|
|
<input |
|
|
|
onChange={e => setNewQuestionaire({ ...newQuestionaire, name: e.target.value })} /> |
|
|
|
type="text" |
|
|
|
<input type="file" placeholder="آپلود فایل دفترچه" className="bg-white items-center flex h-12 text-red26 outline-none" |
|
|
|
placeholder="نام دفترچه..." |
|
|
|
|
|
|
|
className="w-4/5 p-4 ml-2 rounded border border-red52 h-12 text-red26 outline-none" |
|
|
|
|
|
|
|
onChange={(e) => |
|
|
|
|
|
|
|
setNewQuestionaire({ |
|
|
|
|
|
|
|
...newQuestionaire, |
|
|
|
|
|
|
|
name: e.target.value, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<input |
|
|
|
|
|
|
|
type="file" |
|
|
|
|
|
|
|
placeholder="آپلود فایل دفترچه" |
|
|
|
|
|
|
|
className="bg-white items-center flex h-12 text-red26 outline-none" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="flex w-full justify-end pt-2"> |
|
|
|
<div className="flex w-full justify-end pt-2"> |
|
|
|
<button className="px-6 py-2 rounded-md bg-red52 text-white font-bold" |
|
|
|
<button |
|
|
|
onClick={() => { dispatch({ type: 'ADD_EXAM_QUESTIONAIRES', payload: newQuestionaire }); setQuestionairePopUp(false) }} |
|
|
|
className="px-6 py-2 rounded-md bg-red52 text-white font-bold" |
|
|
|
|
|
|
|
onClick={() => { |
|
|
|
|
|
|
|
dispatch({ |
|
|
|
|
|
|
|
type: "ADD_EXAM_QUESTIONAIRES", |
|
|
|
|
|
|
|
payload: newQuestionaire, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
setQuestionairePopUp(false); |
|
|
|
|
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
تایید |
|
|
|
تایید |
|
|
|
</button> |
|
|
|
</button> |
|
|
@ -159,37 +204,55 @@ const AddQuestionnaireExam = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
} */} |
|
|
|
} */} |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
} |
|
|
|
)} |
|
|
|
{ |
|
|
|
{addCoursePopup && ( |
|
|
|
addCoursePopup && |
|
|
|
|
|
|
|
<AddQuestionnaireCourse |
|
|
|
<AddQuestionnaireCourse |
|
|
|
closeOnClick={() => setAddCoursePopup(false)} |
|
|
|
closeOnClick={() => setAddCoursePopup(false)} |
|
|
|
nameOnChange={e => setNewCourse({ ...newCourse, name: e.target.value })} |
|
|
|
nameOnChange={(e) => |
|
|
|
coefficientOnChange={e => setNewCourse({ ...newCourse, coefficient: e.target.vlaue })} |
|
|
|
setNewCourse({ ...newCourse, name: e.target.value }) |
|
|
|
questionEnd={e => setNewCourse({ ...newCourse, questionEnd: e.target.value, questionnaireId: selectedQuestionare.id })} |
|
|
|
} |
|
|
|
questionStart={e => setNewCourse({ ...newCourse, questionStart: e.target.value, questionnaireId: selectedQuestionare.id, id: selectedQuestionare.id + selectedCourse.id + 1 })} |
|
|
|
coefficientOnChange={(e) => |
|
|
|
submitOnClick={() => { dispatch({ type: 'ADD_QUESTIONNAIRE_COURSES', payload: newCourse }); setAddCoursePopup(false); setFakeState(fakeState + 356) }} |
|
|
|
setNewCourse({ ...newCourse, coefficient: e.target.vlaue }) |
|
|
|
/> |
|
|
|
} |
|
|
|
|
|
|
|
questionEnd={(e) => |
|
|
|
|
|
|
|
setNewCourse({ |
|
|
|
|
|
|
|
...newCourse, |
|
|
|
|
|
|
|
questionEnd: e.target.value, |
|
|
|
|
|
|
|
questionnaireId: selectedQuestionare.id, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
questionStart={(e) => |
|
|
|
|
|
|
|
setNewCourse({ |
|
|
|
|
|
|
|
...newCourse, |
|
|
|
|
|
|
|
questionStart: e.target.value, |
|
|
|
|
|
|
|
questionnaireId: selectedQuestionare.id, |
|
|
|
|
|
|
|
id: selectedQuestionare.id + selectedCourse.id + 1, |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
submitOnClick={() => { |
|
|
|
|
|
|
|
dispatch({ type: "ADD_QUESTIONNAIRE_COURSES", payload: newCourse }); |
|
|
|
|
|
|
|
setAddCoursePopup(false); |
|
|
|
|
|
|
|
setFakeState(fakeState + 356); |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
)} |
|
|
|
<div className="flex py-10 items-start px-10 border-b border-gray-300"> |
|
|
|
<div className="flex py-10 items-start px-10 border-b border-gray-300"> |
|
|
|
<div className="flex flex-col w-1/6"> |
|
|
|
<div className="flex flex-col w-1/6"> |
|
|
|
<div className="text-blue3A text-lg font-bold text-right px-4 border-r-4 border-blue65"> |
|
|
|
<div className="text-blue3A text-lg font-bold text-right px-4 border-r-4 border-blue65"> |
|
|
|
تنظیمات آزمون |
|
|
|
تنظیمات آزمون |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<p className="text-sm text-right font-bold pt-4 text-gray-500">لطفا مشخضات آزمون را تکمیل کنید</p> |
|
|
|
<p className="text-sm text-right font-bold pt-4 text-gray-500"> |
|
|
|
|
|
|
|
لطفا مشخضات آزمون را تکمیل کنید |
|
|
|
|
|
|
|
</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="w-5/6 flex flex-row"> |
|
|
|
<div className="w-5/6 flex flex-row"> |
|
|
|
<DragDropContext |
|
|
|
<DragDropContext |
|
|
|
onDragEnd={(result) => { |
|
|
|
onDragEnd={(result) => { |
|
|
|
const { source, destination } = result; |
|
|
|
const { source, destination } = result; |
|
|
|
if (source.droppableId == 'Choosed_Questionnaires') { |
|
|
|
if (source.droppableId == "Choosed_Questionnaires") { |
|
|
|
// const data = {
|
|
|
|
// const data = {
|
|
|
|
// startIndex: choosedQuestion,
|
|
|
|
// startIndex: choosedQuestion,
|
|
|
|
// endIndex: destination.index
|
|
|
|
// endIndex: destination.index
|
|
|
@ -201,45 +264,54 @@ const AddQuestionnaireExam = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
const [removed] = aaa.splice(source.index, 1); |
|
|
|
const [removed] = aaa.splice(source.index, 1); |
|
|
|
|
|
|
|
|
|
|
|
aaa.splice(destination.index, 0, removed); |
|
|
|
aaa.splice(destination.index, 0, removed); |
|
|
|
dispatch({ type: 'CHANGE_QUESTIONNAIRES_ORDER', payload: aaa }) |
|
|
|
dispatch({ type: "CHANGE_QUESTIONNAIRES_ORDER", payload: aaa }); |
|
|
|
console.log(result) |
|
|
|
console.log(result); |
|
|
|
console.log(source.index) |
|
|
|
console.log(source.index); |
|
|
|
console.log(destination.index) |
|
|
|
console.log(destination.index); |
|
|
|
console.log(aaa) |
|
|
|
console.log(aaa); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
<Droppable droppableId="Choosed_Questionnaires" direction="horizontal" > |
|
|
|
<Droppable |
|
|
|
|
|
|
|
droppableId="Choosed_Questionnaires" |
|
|
|
|
|
|
|
direction="horizontal" |
|
|
|
|
|
|
|
> |
|
|
|
{(provided) => ( |
|
|
|
{(provided) => ( |
|
|
|
<div className="flex"> |
|
|
|
<div className="flex"> |
|
|
|
|
|
|
|
<div |
|
|
|
<div className=" flex " {...provided.droppableProps} ref={provided.innerRef}> |
|
|
|
className=" flex " |
|
|
|
{ |
|
|
|
{...provided.droppableProps} |
|
|
|
addExamState.questionnaires.map( |
|
|
|
ref={provided.innerRef} |
|
|
|
((item, index) => ( |
|
|
|
> |
|
|
|
<Draggable draggableId={`QUESTIONNAIRE_${item.id}`} index={index} key={`CHOOSED_QUESTIONNAIRE_${item.id}`}> |
|
|
|
{addExamState.questionnaires.map((item, index) => ( |
|
|
|
|
|
|
|
<Draggable |
|
|
|
|
|
|
|
draggableId={`QUESTIONNAIRE_${item.id}`} |
|
|
|
|
|
|
|
index={index} |
|
|
|
|
|
|
|
key={`CHOOSED_QUESTIONNAIRE_${item.id}`} |
|
|
|
|
|
|
|
> |
|
|
|
{(provided) => ( |
|
|
|
{(provided) => ( |
|
|
|
|
|
|
|
|
|
|
|
<div |
|
|
|
<div |
|
|
|
{...provided.draggableProps} {...provided.dragHandleProps} ref={provided.innerRef} |
|
|
|
{...provided.draggableProps} |
|
|
|
className={`flex flex-col ${selectedQuestionare.id === item.id ? 'bg-pinkF5 border border-red52 text-red52' : 'bg-white border border-gray-300 text-blue3A'} items-center justify-center w-36 h-32 mx-2 font-bold rounded-xl cursor-pointer`} |
|
|
|
{...provided.dragHandleProps} |
|
|
|
onClick={() => setSelectedQuestionare({ id: item.id, name: item.name, courses: item.courses})} |
|
|
|
ref={provided.innerRef} |
|
|
|
|
|
|
|
className={`flex flex-col ${ |
|
|
|
|
|
|
|
selectedQuestionare.id === item.id |
|
|
|
|
|
|
|
? "bg-pinkF5 border border-red52 text-red52" |
|
|
|
|
|
|
|
: "bg-white border border-gray-300 text-blue3A" |
|
|
|
|
|
|
|
} items-center justify-center w-36 h-32 mx-2 font-bold rounded-xl cursor-pointer`}
|
|
|
|
|
|
|
|
onClick={() => |
|
|
|
|
|
|
|
setSelectedQuestionare({ |
|
|
|
|
|
|
|
id: item.id, |
|
|
|
|
|
|
|
name: item.name, |
|
|
|
|
|
|
|
courses: item.courses, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
> |
|
|
|
> |
|
|
|
|
|
|
|
<p className="text-red52">دفترچه {item.name}</p> |
|
|
|
<p className="text-red52"> |
|
|
|
|
|
|
|
دفترچه {item.name} |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
)} |
|
|
|
)} |
|
|
|
|
|
|
|
|
|
|
|
</Draggable> |
|
|
|
</Draggable> |
|
|
|
)) |
|
|
|
))} |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
{provided.placeholder} |
|
|
|
{provided.placeholder} |
|
|
@ -248,84 +320,102 @@ const AddQuestionnaireExam = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
</Droppable> |
|
|
|
</Droppable> |
|
|
|
</DragDropContext> |
|
|
|
</DragDropContext> |
|
|
|
|
|
|
|
|
|
|
|
<div className="flex flex-col bg-white items-center justify-center w-36 h-32 mx-2 font-bold border border-gray-300 text-blue3A rounded-xl cursor-pointer" onClick={() => addExamState.type == 'bank' ? console.log('bank') : setQuestionairePopUp(true)}> |
|
|
|
<div |
|
|
|
<p className="" style={{ fontSize: '40px' }}> |
|
|
|
className="flex flex-col bg-white items-center justify-center w-36 h-32 mx-2 font-bold border border-gray-300 text-blue3A rounded-xl cursor-pointer" |
|
|
|
|
|
|
|
onClick={() => |
|
|
|
|
|
|
|
addExamState.type == "bank" |
|
|
|
|
|
|
|
? console.log("bank") |
|
|
|
|
|
|
|
: setQuestionairePopUp(true) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<p className="" style={{ fontSize: "40px" }}> |
|
|
|
+ |
|
|
|
+ |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
<p className=""> |
|
|
|
<p className=""> |
|
|
|
{addExamState.type == 'bank' ? 'افزودن درس' : 'افزودن دفترچه'} |
|
|
|
{addExamState.type == "bank" ? "افزودن درس" : "افزودن دفترچه"} |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div className="w-full flex px-10"> |
|
|
|
<div className="w-full flex px-10"> |
|
|
|
|
|
|
|
|
|
|
|
<div className="w-1/2 border-l flex flex-col border-gray-300 py-10"> |
|
|
|
<div className="w-1/2 border-l flex flex-col border-gray-300 py-10"> |
|
|
|
{ |
|
|
|
{selectedQuestionare.id !== null && ( |
|
|
|
selectedQuestionare.id !== null && (<> |
|
|
|
<> |
|
|
|
<h1 className="text-blue3A w-full font-bold text-lg text-right"> |
|
|
|
<h1 className="text-blue3A w-full font-bold text-lg text-right"> |
|
|
|
دفترچه {selectedQuestionare.name} |
|
|
|
دفترچه {selectedQuestionare.name} |
|
|
|
</h1> |
|
|
|
</h1> |
|
|
|
<div className="flex flex-col items-center overflow-x-hidden overflow-scroll" style={{ height: '500px' }}> |
|
|
|
<div |
|
|
|
|
|
|
|
className="flex flex-col items-center overflow-x-hidden overflow-scroll" |
|
|
|
|
|
|
|
style={{ height: "500px" }} |
|
|
|
|
|
|
|
> |
|
|
|
<div className="w-4/5 "> |
|
|
|
<div className="w-4/5 "> |
|
|
|
|
|
|
|
{addExamState.questionnaires |
|
|
|
{ |
|
|
|
.find((itm) => itm.id == selectedQuestionare.id) |
|
|
|
addExamState.questionnaires.find(itm => itm.id == selectedQuestionare.id)?.courses.map( |
|
|
|
?.courses.map((item) => ( |
|
|
|
(item) => ( |
|
|
|
<SelectedCourse |
|
|
|
<SelectedCourse title={item.name} coefficient={item.coefficient} questionQuantity={item.questionEnd - item.questionStart} |
|
|
|
title={item.name} |
|
|
|
onClick={() => { setSelectedCourse(item); console.log(selectedCourse) }} /> |
|
|
|
coefficient={item.coefficient} |
|
|
|
) |
|
|
|
questionQuantity={item.questionEnd - item.questionStart} |
|
|
|
) |
|
|
|
onClick={() => { |
|
|
|
} |
|
|
|
setSelectedCourse(item); |
|
|
|
|
|
|
|
console.log(selectedCourse); |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
))} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</>) |
|
|
|
</> |
|
|
|
} |
|
|
|
)} |
|
|
|
{selectedQuestionare.id !== null && |
|
|
|
{selectedQuestionare.id !== null && ( |
|
|
|
<div className="w-full flex justify-center mt-10"> |
|
|
|
<div className="w-full flex justify-center mt-10"> |
|
|
|
<button className=" bg-gray-300 text-xl text-gray-500 border-gray-500 w-1/3 h-12 rounded-xl border" onClick={() => setAddCoursePopup(true)}> |
|
|
|
<button |
|
|
|
|
|
|
|
className=" bg-gray-300 text-xl text-gray-500 border-gray-500 w-1/3 h-12 rounded-xl border" |
|
|
|
|
|
|
|
onClick={() => setAddCoursePopup(true)} |
|
|
|
|
|
|
|
> |
|
|
|
افزودن درس |
|
|
|
افزودن درس |
|
|
|
</button> |
|
|
|
</button> |
|
|
|
</div>} |
|
|
|
</div> |
|
|
|
|
|
|
|
)} |
|
|
|
</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 selectedCourseId={selectedCourse.id}
|
|
|
|
<AnswerSheet |
|
|
|
|
|
|
|
selectedCourseId={selectedCourse.id} |
|
|
|
selectedQId={selectedQuestionare.id} |
|
|
|
selectedQId={selectedQuestionare.id} |
|
|
|
questionEnd={selectedCourse.questionEnd} questionStart={selectedCourse.questionStart} |
|
|
|
questionEnd={selectedCourse.questionEnd} |
|
|
|
|
|
|
|
questionStart={selectedCourse.questionStart} |
|
|
|
passAnswers={data => dispatch({type: 'ADD_ANSWERS', payload: data})} /> |
|
|
|
passAnswers={(data) => |
|
|
|
|
|
|
|
dispatch({ type: "ADD_ANSWERS", payload: data }) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div className="flex w-full px-10 items-center justify-end"> |
|
|
|
<div className="flex w-full px-10 items-center justify-end"> |
|
|
|
<button className=' mx-6 h-12 mt-4 text-red52 font-bold flex items-center justify-center' onClick={() => backStep()}> بازگشت به مرحله قبل </button> |
|
|
|
<button |
|
|
|
|
|
|
|
className=" mx-6 h-12 mt-4 text-red52 font-bold flex items-center justify-center" |
|
|
|
|
|
|
|
onClick={() => backStep()} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{" "} |
|
|
|
|
|
|
|
بازگشت به مرحله قبل{" "} |
|
|
|
|
|
|
|
</button> |
|
|
|
<Button |
|
|
|
<Button |
|
|
|
title='مرحله بعدی' |
|
|
|
title="مرحله بعدی" |
|
|
|
className='w-1/12' |
|
|
|
className="w-1/12" |
|
|
|
onClick={() => { |
|
|
|
onClick={() => { |
|
|
|
|
|
|
|
stepClick(); |
|
|
|
stepClick() |
|
|
|
|
|
|
|
}} |
|
|
|
}} |
|
|
|
|
|
|
|
|
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</> |
|
|
|
</> |
|
|
|
) |
|
|
|
); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state) => ({ |
|
|
|
const mapStateToProps = (state) => ({ |
|
|
|
grades: state.publicApi.grades, |
|
|
|
grades: state.publicApi.grades, |
|
|
|
addExamState: state.addExamReduser |
|
|
|
addExamState: state.addExamReduser, |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps)(AddQuestionnaireExam); |
|
|
|
export default connect(mapStateToProps)(AddQuestionnaireExam); |