|
|
@ -88,7 +88,11 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [sortedQuestionBank, setSortedQuestionBank] = useState(addExamState.questionBank); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
setSortedQuestionBank(addExamState.questionBank) |
|
|
|
|
|
|
|
}, [addExamState]) |
|
|
|
|
|
|
|
|
|
|
|
const [numberOfOptions, setNumberOfOptions] = useState(null); |
|
|
|
const [numberOfOptions, setNumberOfOptions] = useState(null); |
|
|
|
const [options, setOptions] = useState([]) |
|
|
|
const [options, setOptions] = useState([]) |
|
|
@ -147,7 +151,7 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
addExamState.courseBank.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-200"> |
|
|
|
<div className="w-full flex items-center py-2 justify-start border-b pl-8 border-gray-200"> |
|
|
|
<Checkbox name={`PICK_QUESTIONARE_${index}`} |
|
|
|
<Checkbox name={`PICK_QUESTIONARE_${index}`} |
|
|
|
onChange={(e) => |
|
|
|
onChange={(e) => |
|
|
|
e.target.checked ? |
|
|
|
e.target.checked ? |
|
|
@ -161,7 +165,7 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/> |
|
|
|
/> |
|
|
|
<h2 className="text-red26 font-bold">{item.title}</h2> |
|
|
|
<h2 className="text-red26 font-bold mr-4">{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={() => { |
|
|
@ -251,16 +255,27 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
{(provided) => ( |
|
|
|
{(provided) => ( |
|
|
|
<div |
|
|
|
<div |
|
|
|
{...provided.draggableProps} {...provided.dragHandleProps} ref={provided.innerRef} |
|
|
|
{...provided.draggableProps} {...provided.dragHandleProps} ref={provided.innerRef} |
|
|
|
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`} |
|
|
|
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 pt-4 w-36 h-32 mx-2 font-bold rounded-xl cursor-pointer`} |
|
|
|
onClick={() => setSelectedCourse(item)} |
|
|
|
onClick={() => setSelectedCourse(item)} |
|
|
|
> |
|
|
|
> |
|
|
|
<p className="w-full text-left px-4" > |
|
|
|
<div className="w-full flex justify-between items-center " style={{direction: 'ltr'}}> |
|
|
|
|
|
|
|
<div className=" rtl px-2 text-white bg-red52"> |
|
|
|
|
|
|
|
{item.selectedQuestions.length} سوال |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
selectedCourse.id == item.id && <p className=" text-left px-4" > |
|
|
|
<span onClick={() => { dispatch({ type: 'REMOVE_EXAM_COURSE', payload: item }); setSelectedCourse(null); setFakeState(fakeState + 24) }}> x </span> |
|
|
|
<span onClick={() => { dispatch({ type: 'REMOVE_EXAM_COURSE', payload: item }); setSelectedCourse(null); setFakeState(fakeState + 24) }}> x </span> |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<p className="text-red52"> |
|
|
|
<p className="text-red52"> |
|
|
|
{item.title} |
|
|
|
{item.title} |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
|
|
|
|
<div className="w-full flex justify-between px-2 pb-2"> |
|
|
|
|
|
|
|
<p className={`w-1/2 border-l text-center text-xs ${selectedCourse.id === item.id ? 'border-red52' : 'border-gray-300'} text-gray-400`}> ضریب {item.coefficient}</p> |
|
|
|
|
|
|
|
<p className="w-1/2 text-center text-xs font-light text-gray-400">{item.numberOfOptions} گزینه</p> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
)} |
|
|
|
)} |
|
|
@ -469,7 +484,9 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
|
|
|
|
|
|
|
|
<div className="px-2 pl-10 text-gray37 text-sm flex items-center "> |
|
|
|
<div className="px-2 pl-10 text-gray37 text-sm flex items-center "> |
|
|
|
|
|
|
|
|
|
|
|
<input type='search' placeholder="جستجو..." onChange={(e) => console.log(e.target.value)} |
|
|
|
<input type='search' placeholder="جستجو..." onChange={(e) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}} |
|
|
|
className="w-full h-10 flex px-4 items-center pt-1 outline-none rounded-md border border-gray-300 text-sm text-gray-600 mr-2" /> |
|
|
|
className="w-full h-10 flex px-4 items-center pt-1 outline-none rounded-md border border-gray-300 text-sm text-gray-600 mr-2" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
@ -484,7 +501,7 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
|
|
|
|
|
|
|
|
<div className="w-11/12" {...provided.droppableProps} ref={provided.innerRef}> |
|
|
|
<div className="w-11/12" {...provided.droppableProps} ref={provided.innerRef}> |
|
|
|
{ |
|
|
|
{ |
|
|
|
addExamState.questionBank?.filter(itm => itm.courseId == selectedCourse.id)?.map( |
|
|
|
sortedQuestionBank?.filter(itm => itm.courseId == selectedCourse.id)?.map( |
|
|
|
(course, index) => ( |
|
|
|
(course, index) => ( |
|
|
|
<Draggable draggableId={`_${course.questionId}`} index={course.questionId} key={`CHOOSED_QUESTIONS_${course.questionId}`}> |
|
|
|
<Draggable draggableId={`_${course.questionId}`} index={course.questionId} key={`CHOOSED_QUESTIONS_${course.questionId}`}> |
|
|
|
{(provided) => ( |
|
|
|
{(provided) => ( |
|
|
|