|
|
@ -23,26 +23,18 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
}); |
|
|
|
}); |
|
|
|
const [showCoursesInList, setShowCoursesInList] = useState([]); |
|
|
|
const [showCoursesInList, setShowCoursesInList] = useState([]); |
|
|
|
const [choosedQuestionaries, seChoosedQuestionaries] = useState([]); |
|
|
|
const [choosedQuestionaries, seChoosedQuestionaries] = useState([]); |
|
|
|
const [selectedQuestionare, setSelectedQuestionare] = useState({ |
|
|
|
const [selectedCourse, setSelectedCourse] = useState({ |
|
|
|
id: null,
|
|
|
|
id: null,
|
|
|
|
courses: [] |
|
|
|
title: '' |
|
|
|
}); |
|
|
|
}); |
|
|
|
const [answers, setAnswers] = useState(null); |
|
|
|
const [answers, setAnswers] = useState(null); |
|
|
|
const [newCourse, setNewCourse] = useState({ |
|
|
|
const [newCourse, setNewCourse] = useState({ |
|
|
|
id: addExamState.questionairesCourses.length + 1, |
|
|
|
id: addExamState.questionairesCourses.length + 1, |
|
|
|
questionnaireId: selectedQuestionare.id, |
|
|
|
questionnaireId: selectedCourse.id, |
|
|
|
questionsQuantity:20, |
|
|
|
questionsQuantity:20, |
|
|
|
name: '', |
|
|
|
name: '', |
|
|
|
coefficient: 4 |
|
|
|
coefficient: 4 |
|
|
|
}) |
|
|
|
}) |
|
|
|
const [selectedCourse, setSelectedCourse] = useState({ |
|
|
|
|
|
|
|
sortId: 1, |
|
|
|
|
|
|
|
title: 'ادبیات فارسی', |
|
|
|
|
|
|
|
coefficient: 3, |
|
|
|
|
|
|
|
questionStart: 1, |
|
|
|
|
|
|
|
questionEnd: 0, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
// console.log(choosedQuestionaries)
|
|
|
|
// console.log(choosedQuestionaries)
|
|
|
|
// console.log(newQuestionaire)
|
|
|
|
// console.log(newQuestionaire)
|
|
|
|
// console.log(addExamState.questionnaires)
|
|
|
|
// console.log(addExamState.questionnaires)
|
|
|
@ -86,43 +78,31 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
<h1 className="w-full text-right text-lg text-red52 font-bold pt-4"> |
|
|
|
<h1 className="w-full text-right text-lg text-red52 font-bold pt-4"> |
|
|
|
افزودن دفترچه |
|
|
|
افزودن دفترچه |
|
|
|
</h1> |
|
|
|
</h1> |
|
|
|
<div className="w-full flex items-center flex-col mt-6 px-2 "> |
|
|
|
|
|
|
|
<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"
|
|
|
|
|
|
|
|
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 className="flex w-full justify-end pt-2"> |
|
|
|
|
|
|
|
<button className="px-6 py-2 rounded-md bg-red52 text-white font-bold" |
|
|
|
|
|
|
|
onClick={() => {dispatch({type: 'ADD_EXAM_QUESTIONAIRES', payload: newQuestionaire}); setQuestionairePopUp(false) }} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
تایید |
|
|
|
|
|
|
|
</button> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* { |
|
|
|
{ |
|
|
|
questoinaresLists.map( |
|
|
|
addExamState.courseBank.map( |
|
|
|
(item, index) => ( |
|
|
|
(item, index) => ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<div className="w-full flex items-center py-2 justify-between border-b pl-8 border-gray-300"> |
|
|
|
<div className="w-full flex items-center py-2 justify-between border-b pl-8 border-gray-300"> |
|
|
|
<Checkbox name={`PICK_QUESTIONARE_${index}`} |
|
|
|
<Checkbox name={`PICK_QUESTIONARE_${index}`} |
|
|
|
onChange={(e) =>
|
|
|
|
onChange={(e) =>
|
|
|
|
e.target.checked ?
|
|
|
|
e.target.checked ?
|
|
|
|
seChoosedQuestionaries([...choosedQuestionaries, item]) |
|
|
|
dispatch({type: 'ADD_EXAM_COURSE', payload: item}) |
|
|
|
:
|
|
|
|
:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
seChoosedQuestionaries(choosedQuestionaries.filter(itm => itm.id !== item.id)) |
|
|
|
dispatch({type: 'REMOVE_EXAM_COURSE', payload: item}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/> |
|
|
|
/> |
|
|
|
<h2 className="text-red26 font-bold">{item.title}</h2> |
|
|
|
<h2 className="text-red26 font-bold">{item.title}</h2> |
|
|
|
<h4>تعداد سوالات: {item.numberOfQuestions}</h4> |
|
|
|
{/* <h4>تعداد سوالات: {item.numberOfQuestions}</h4> |
|
|
|
<p>تعداد دروس: {item.courses.length}</p> |
|
|
|
<p>تعداد دروس: {item.courses.length}</p> */} |
|
|
|
<p className="cursor-pointer" onClick={() => { |
|
|
|
{/* <p className="cursor-pointer" onClick={() => { |
|
|
|
let newArray = [...showCoursesInList]; |
|
|
|
let newArray = [...showCoursesInList]; |
|
|
|
|
|
|
|
|
|
|
|
newArray[index] = !newArray[index]; |
|
|
|
newArray[index] = !newArray[index]; |
|
|
@ -130,46 +110,28 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
|
|
|
|
|
|
|
|
setShowCoursesInList(newArray) |
|
|
|
setShowCoursesInList(newArray) |
|
|
|
|
|
|
|
|
|
|
|
}}>نمایش دروس</p> |
|
|
|
}}>نمایش دروس</p> */} |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{ |
|
|
|
|
|
|
|
showCoursesInList[index] && <div className="w-full flex flex-col"> |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
item.courses.map((course) => ( |
|
|
|
|
|
|
|
<div className="w-full flex items-center text-right px-8 py-1 border-b border-gray-100" key={`COURSE_IN_LIST__${course.sortId}`}> |
|
|
|
|
|
|
|
<p className="w-1/3"> |
|
|
|
|
|
|
|
{course.title} |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
<p className="w-1/3"> |
|
|
|
|
|
|
|
ضریب : {course.coefficient} |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
<p |
|
|
|
|
|
|
|
className="w-1/3" |
|
|
|
|
|
|
|
>از سوال {course.questionStart} تا سوال {course.questionEnd}</p> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</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 => setNewCourse({...newCourse, name: e.target.value})}
|
|
|
|
coefficientOnChange={e => setNewCourse({...newCourse, coefficient: e.target.vlaue})} |
|
|
|
// coefficientOnChange={e => setNewCourse({...newCourse, coefficient: e.target.vlaue})}
|
|
|
|
questionQuantityOnChange={e => setNewCourse({...newCourse, questionsQuantity: e.target.value, questionnaireId: selectedQuestionare.id})} |
|
|
|
// questionQuantityOnChange={e => setNewCourse({...newCourse, questionsQuantity: e.target.value, questionnaireId: selectedQuestionare.id})}
|
|
|
|
submitOnClick={() => {dispatch({type: 'ADD_QUESTIONNAIRE_COURSES', payload : newCourse}); setAddCoursePopup(false); setFakeState(fakeState + 356)} } |
|
|
|
// submitOnClick={() => {dispatch({type: 'ADD_QUESTIONNAIRE_COURSES', payload : newCourse}); setAddCoursePopup(false); setFakeState(fakeState + 356)} }
|
|
|
|
/> |
|
|
|
// />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -183,27 +145,30 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="w-5/6 flex flex-row"> |
|
|
|
<div className="w-5/6 flex flex-row"> |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
{addExamState.courses.length > 0 && |
|
|
|
addExamState.questionnaires.map( |
|
|
|
addExamState.courses.map( |
|
|
|
(item => ( |
|
|
|
(item => ( |
|
|
|
<div 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`} |
|
|
|
<div className={`flex flex-col ${selectedCourse.id === item.id ? 'bg-pinkF5 border border-red52 text-red52' : 'bg-white border border-gray-300 text-blue3A'} items-center justify-between pb-12 pt-2 w-36 h-32 mx-2 font-bold rounded-xl cursor-pointer`} |
|
|
|
onClick={() => setSelectedQuestionare({id : item.id,name: item.name, courses: addExamState.questionairesCourses.filter(itm => itm.questionnaireId == item.id)})} |
|
|
|
onClick={() => setSelectedCourse(item)} |
|
|
|
> |
|
|
|
> |
|
|
|
|
|
|
|
<p className="w-full text-left px-4" onClick={() => dispatch({type: 'REMOVE_EXAM_COURSE', payload: item})}> |
|
|
|
|
|
|
|
x |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
|
|
|
|
<p className="text-red52"> |
|
|
|
<p className="text-red52"> |
|
|
|
دفترچه {item.name} |
|
|
|
{item.title} |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
)) |
|
|
|
)) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
<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 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={() => setQuestionairePopUp(true)}> |
|
|
|
<p className="" style={{ fontSize: '40px' }}> |
|
|
|
<p className="" style={{ fontSize: '40px' }}> |
|
|
|
+ |
|
|
|
+ |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
<p className=""> |
|
|
|
<p className=""> |
|
|
|
{addExamState.type == 'bank' ? 'افزودن درس' : 'افزودن دفترچه'} |
|
|
|
افزودن درس |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
@ -214,7 +179,7 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
<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} |
|
|
@ -239,14 +204,18 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
<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 questionsQuantity={selectedCourse.questionsQuantity} optionsQuantity={4} selectedCourseId={selectedCourse.id} |
|
|
|
{/* <AnswerSheet questionsQuantity={selectedCourse.questionsQuantity} optionsQuantity={4} selectedCourseId={selectedCourse.id} |
|
|
|
passAnswers={data => {setAnswers(data); setFakeState(fakeState - 2)}}/> */} |
|
|
|
passAnswers={data => {setAnswers(data); setFakeState(fakeState - 2)}}/> */} |
|
|
|
|
|
|
|
{selectedCourse.id !== null && |
|
|
|
<Question /> |
|
|
|
addExamState.questionBank.filter(itm => itm.courseId == selectedCourse.id).map( |
|
|
|
|
|
|
|
(course) => (<Question data={course} />) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
{/* <Question /> */} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|