|
|
@ -11,10 +11,12 @@ import filterIcon from "../../../assets/img/filter.svg"; |
|
|
|
import Question from "../components/question"; |
|
|
|
import Question from "../components/question"; |
|
|
|
import { numOfinitQs } from "../../../redux/reducers/exam"; |
|
|
|
import { numOfinitQs } from "../../../redux/reducers/exam"; |
|
|
|
import AddQuestionPopUp from "../components/addQuestion"; |
|
|
|
import AddQuestionPopUp from "../components/addQuestion"; |
|
|
|
import { exam, lesson, question } from "../../../redux/actions"; |
|
|
|
import { category, exam, lesson, question } from "../../../redux/actions"; |
|
|
|
import { AiOutlineCloseCircle } from "react-icons/ai"; |
|
|
|
import { AiOutlineCloseCircle } from "react-icons/ai"; |
|
|
|
import loadingGiff from "../../../assets/img/Rolling-2s-223px.gif"; |
|
|
|
import loadingGiff from "../../../assets/img/Rolling-2s-223px.gif"; |
|
|
|
|
|
|
|
import { BsCheck2All } from "react-icons/bs"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let seCounter = 0; |
|
|
|
const AddQuestionsFromBank = ({ |
|
|
|
const AddQuestionsFromBank = ({ |
|
|
|
grades, |
|
|
|
grades, |
|
|
|
addExamState, |
|
|
|
addExamState, |
|
|
@ -32,7 +34,13 @@ const AddQuestionsFromBank = ({ |
|
|
|
removeQuestionFromBank, |
|
|
|
removeQuestionFromBank, |
|
|
|
removeExamQuestions, |
|
|
|
removeExamQuestions, |
|
|
|
getQuestionBackToBank, |
|
|
|
getQuestionBackToBank, |
|
|
|
submitHandler, |
|
|
|
addCategory, |
|
|
|
|
|
|
|
categoryAddList, |
|
|
|
|
|
|
|
addSubexam, |
|
|
|
|
|
|
|
examId, |
|
|
|
|
|
|
|
subExamList, |
|
|
|
|
|
|
|
subExamLoading, |
|
|
|
|
|
|
|
emptySubexamList, |
|
|
|
}) => { |
|
|
|
}) => { |
|
|
|
const [name, setName] = useState(null); |
|
|
|
const [name, setName] = useState(null); |
|
|
|
const [type, setType] = useState(null); |
|
|
|
const [type, setType] = useState(null); |
|
|
@ -52,7 +60,8 @@ const AddQuestionsFromBank = ({ |
|
|
|
title: "", |
|
|
|
title: "", |
|
|
|
selectedQuestions: [], |
|
|
|
selectedQuestions: [], |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
const [subexamAddPermission, setSubexamAddPermission] = useState(0); |
|
|
|
|
|
|
|
const [subexamAddPart, setSubexamAddPart] = useState(false); |
|
|
|
// console.log(choosedQuestionaries)
|
|
|
|
// console.log(choosedQuestionaries)
|
|
|
|
// console.log(newQuestionaire)
|
|
|
|
// console.log(newQuestionaire)
|
|
|
|
// console.log(addExamState.questionnaires)
|
|
|
|
// console.log(addExamState.questionnaires)
|
|
|
@ -63,6 +72,10 @@ const AddQuestionsFromBank = ({ |
|
|
|
console.log(choosedQuestion); |
|
|
|
console.log(choosedQuestion); |
|
|
|
console.log(selectedCourse.selectedQuestions); |
|
|
|
console.log(selectedCourse.selectedQuestions); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// useEffect(()=>{
|
|
|
|
|
|
|
|
// emptySubexamList();
|
|
|
|
|
|
|
|
// },[])
|
|
|
|
|
|
|
|
|
|
|
|
const [fakeState, setFakeState] = useState(2); |
|
|
|
const [fakeState, setFakeState] = useState(2); |
|
|
|
|
|
|
|
|
|
|
|
const payload = { name: name, description: description, type: type }; |
|
|
|
const payload = { name: name, description: description, type: type }; |
|
|
@ -173,10 +186,46 @@ const AddQuestionsFromBank = ({ |
|
|
|
addLesson({ name }); |
|
|
|
addLesson({ name }); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const submitLessons = () => { |
|
|
|
|
|
|
|
console.log("aaaaaaaaaaaaaaaa"); |
|
|
|
|
|
|
|
console.log(addExamState?.courses); |
|
|
|
|
|
|
|
for (let i = 0; i < addExamState?.courses?.length; i++) { |
|
|
|
|
|
|
|
addCategory({ |
|
|
|
|
|
|
|
title: addExamState?.courses[i].name, |
|
|
|
|
|
|
|
gradeId: addExamState?.grade, |
|
|
|
|
|
|
|
lessonId: addExamState?.courses[i].id, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
setSubexamAddPermission(1); |
|
|
|
|
|
|
|
setQuestionairePopUp(false); |
|
|
|
|
|
|
|
setSubexamAddPart(true); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// subexamAdd----------------------------------
|
|
|
|
|
|
|
|
const subexamAddHandler = (index) => { |
|
|
|
|
|
|
|
let inputs = document.querySelectorAll(`.subexamAddPart-input-${index}`); |
|
|
|
|
|
|
|
console.log(inputs[2].checked); |
|
|
|
|
|
|
|
seCounter = index; |
|
|
|
|
|
|
|
addSubexam({ |
|
|
|
|
|
|
|
pid: examId, |
|
|
|
|
|
|
|
name: addExamState?.courses[index].name, |
|
|
|
|
|
|
|
description: " ", |
|
|
|
|
|
|
|
categoryId: categoryAddList[index], |
|
|
|
|
|
|
|
questionType: Number(inputs[1].value), |
|
|
|
|
|
|
|
questionCount: Number(inputs[3].value), |
|
|
|
|
|
|
|
coefficient: Number(inputs[0].value), |
|
|
|
|
|
|
|
negativePoint: inputs[2].checked, |
|
|
|
|
|
|
|
ord: Number(inputs[4].value), |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const subexamPartFinalSubmit=()=>{ |
|
|
|
|
|
|
|
setSubexamAddPart(false); |
|
|
|
|
|
|
|
} |
|
|
|
const nextStephandler = () => { |
|
|
|
const nextStephandler = () => { |
|
|
|
submitHandler(); |
|
|
|
// submitHandler();
|
|
|
|
stepClick(); |
|
|
|
stepClick(); |
|
|
|
} |
|
|
|
}; |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div className="flex flex-col h-screen relative"> |
|
|
|
<div className="flex flex-col h-screen relative"> |
|
|
|
{questionarePopUp && ( |
|
|
|
{questionarePopUp && ( |
|
|
@ -249,7 +298,7 @@ const AddQuestionsFromBank = ({ |
|
|
|
</button> |
|
|
|
</button> |
|
|
|
<button |
|
|
|
<button |
|
|
|
className="p-2 px-4 bg-red52 text-white rounded-md shadow-md mr-2" |
|
|
|
className="p-2 px-4 bg-red52 text-white rounded-md shadow-md mr-2" |
|
|
|
onClick={() => setQuestionairePopUp(false)} |
|
|
|
onClick={submitLessons} |
|
|
|
> |
|
|
|
> |
|
|
|
ثبت دروس |
|
|
|
ثبت دروس |
|
|
|
</button> |
|
|
|
</button> |
|
|
@ -287,6 +336,101 @@ const AddQuestionsFromBank = ({ |
|
|
|
)} |
|
|
|
)} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
)} |
|
|
|
)} |
|
|
|
|
|
|
|
{subexamAddPart && ( |
|
|
|
|
|
|
|
<div className="w-full z-10 fixed h-screen backdrop-blur flex items-center top-0 justify-center "> |
|
|
|
|
|
|
|
<AiOutlineCloseCircle |
|
|
|
|
|
|
|
className="text-4xl text-red-600 cursor-pointer absolute top-6 left-20 z-20" |
|
|
|
|
|
|
|
onClick={() => setAddLessonPart(false)} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<div className="w-4/5 h-4/5 max-h-4/5 overflow-y-auto p-6 rounded-lg bg-[#fff] "> |
|
|
|
|
|
|
|
<div className="w-full rtl flex items-center mb-6"> |
|
|
|
|
|
|
|
<div className="w-2 h-7 bg-blue-500 ml-2"></div> |
|
|
|
|
|
|
|
<div className="text-xl tet-right"> |
|
|
|
|
|
|
|
تکمیل جزئیات دروس اضافه شده |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
{addExamState?.courses.map((item, index) => ( |
|
|
|
|
|
|
|
<div className="w-full pb-4 border-b border-gray-200 mb-3"> |
|
|
|
|
|
|
|
<div className="w-full text-right text-lg">{item.name}</div> |
|
|
|
|
|
|
|
<div className="w-full flex items-center justify-between mt-4"> |
|
|
|
|
|
|
|
<div className="flex items-center"> |
|
|
|
|
|
|
|
<div>ضریب</div> |
|
|
|
|
|
|
|
<input |
|
|
|
|
|
|
|
type="text" |
|
|
|
|
|
|
|
className={`subexamAddPart-input-${index} w-16 h-10 rounded border text-center mr-2`} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="flex items-center"> |
|
|
|
|
|
|
|
<div>تعداد گزینه</div> |
|
|
|
|
|
|
|
<input |
|
|
|
|
|
|
|
type="text" |
|
|
|
|
|
|
|
className={`subexamAddPart-input-${index} w-16 h-10 rounded border text-center mr-2`} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="flex items-center"> |
|
|
|
|
|
|
|
<div>نمره منفی</div> |
|
|
|
|
|
|
|
<input |
|
|
|
|
|
|
|
type="checkbox" |
|
|
|
|
|
|
|
className={`subexamAddPart-input-${index} w-10 h-10 rounded border text-center accent-red52 mr-2`} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="flex items-center"> |
|
|
|
|
|
|
|
<div>تعداد سوالات</div> |
|
|
|
|
|
|
|
<input |
|
|
|
|
|
|
|
type="text" |
|
|
|
|
|
|
|
className={`subexamAddPart-input-${index} w-16 h-10 rounded border text-center mr-2`} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="flex items-center"> |
|
|
|
|
|
|
|
<div>ترتیب</div> |
|
|
|
|
|
|
|
<input |
|
|
|
|
|
|
|
type="text" |
|
|
|
|
|
|
|
className={`subexamAddPart-input-${index} w-16 h-10 rounded border text-center mr-2`} |
|
|
|
|
|
|
|
defaultValue={index + 1} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
{!subExamLoading && ( |
|
|
|
|
|
|
|
<div |
|
|
|
|
|
|
|
className="w-24 h-10 flex items-center justify-center rounded bg-red52 text-white text-sm cursor-pointer" |
|
|
|
|
|
|
|
onClick={() => subexamAddHandler(index)} |
|
|
|
|
|
|
|
style={ |
|
|
|
|
|
|
|
subExamList[index] |
|
|
|
|
|
|
|
? { |
|
|
|
|
|
|
|
backgroundColor: "#84CC16", |
|
|
|
|
|
|
|
pointerEvents: "none", |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
: null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{subExamList[index] ? ( |
|
|
|
|
|
|
|
<BsCheck2All className="text-xl text-white" /> |
|
|
|
|
|
|
|
) : ( |
|
|
|
|
|
|
|
"ثبت اطلاعات" |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
{subExamLoading && seCounter === index && ( |
|
|
|
|
|
|
|
<div className="w-24 h-10 flex items-center justify-center rounded bg-red52 text-white text-sm"> |
|
|
|
|
|
|
|
<img |
|
|
|
|
|
|
|
src={loadingGiff} |
|
|
|
|
|
|
|
alt="loadingGiff" |
|
|
|
|
|
|
|
className="h-8" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
))} |
|
|
|
|
|
|
|
<div |
|
|
|
|
|
|
|
className="w-40 h-14 flex items-center justify-center rounded-lg bg-red52 text-white mt-10 mx-auto cursor-pointer" |
|
|
|
|
|
|
|
onClick={subexamPartFinalSubmit} |
|
|
|
|
|
|
|
style={subExamList?.length!==addExamState.courses?.length ? {filter:"grayscale(100%)",pointerEvents:'none'}:null} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
ثبت نهایی |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
)} |
|
|
|
{/* ====================================================================================== */} |
|
|
|
{/* ====================================================================================== */} |
|
|
|
<div className="flex py-3 items-center px-10 border-b border-gray-200"> |
|
|
|
<div className="flex py-3 items-center px-10 border-b border-gray-200"> |
|
|
|
<div className="flex flex-col w-1/6"> |
|
|
|
<div className="flex flex-col w-1/6"> |
|
|
@ -452,7 +596,7 @@ const AddQuestionsFromBank = ({ |
|
|
|
{selectedCourse.id !== null && ( |
|
|
|
{selectedCourse.id !== null && ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
{/* Picked Questions Top Bar */} |
|
|
|
{/* Picked Questions Top Bar */} |
|
|
|
<div className="w-full flex h-16 px-8 mb-3 justify-start pt-4 items-center"> |
|
|
|
{/* <div className="w-full flex h-16 px-8 mb-3 justify-start pt-4 items-center bg-black"> |
|
|
|
<h1 className="text-blue3A font-bold text-lg text-right pl-4"> |
|
|
|
<h1 className="text-blue3A font-bold text-lg text-right pl-4"> |
|
|
|
سوالات {selectedCourse.title} |
|
|
|
سوالات {selectedCourse.title} |
|
|
|
</h1> |
|
|
|
</h1> |
|
|
@ -494,7 +638,7 @@ const AddQuestionsFromBank = ({ |
|
|
|
/> |
|
|
|
/> |
|
|
|
<p>نمره منفی</p> |
|
|
|
<p>نمره منفی</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> */} |
|
|
|
|
|
|
|
|
|
|
|
<div |
|
|
|
<div |
|
|
|
className="flex flex-col items-center overflow-x-hidden overflow-scroll" |
|
|
|
className="flex flex-col items-center overflow-x-hidden overflow-scroll" |
|
|
@ -799,6 +943,10 @@ const mapStateToProps = (state) => ({ |
|
|
|
addExamState: state.addExamReduser, |
|
|
|
addExamState: state.addExamReduser, |
|
|
|
addLessonLoading: state.lesson.loading, |
|
|
|
addLessonLoading: state.lesson.loading, |
|
|
|
questionList: state.question.list, |
|
|
|
questionList: state.question.list, |
|
|
|
|
|
|
|
categoryAddList: state.category.addList, |
|
|
|
|
|
|
|
examId: state.exam2.lastExamAdd, |
|
|
|
|
|
|
|
subExamList: state.exam2.subExamList, |
|
|
|
|
|
|
|
subExamLoading: state.exam2.loading, |
|
|
|
// lessonList: state.lesson.list
|
|
|
|
// lessonList: state.lesson.list
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -812,6 +960,9 @@ const mapDispatchToProps = { |
|
|
|
removeExamQuestions: exam.removeExamQuestions, |
|
|
|
removeExamQuestions: exam.removeExamQuestions, |
|
|
|
getQuestionBackToBank: exam.getQuestionBackToBank, |
|
|
|
getQuestionBackToBank: exam.getQuestionBackToBank, |
|
|
|
changeQuestionOrder: exam.changeQuestionOrder, |
|
|
|
changeQuestionOrder: exam.changeQuestionOrder, |
|
|
|
|
|
|
|
addCategory: category.add, |
|
|
|
|
|
|
|
addSubexam: exam.subexamAdd, |
|
|
|
|
|
|
|
emptySubexamList : exam.emptySubexamList |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export default connect( |
|
|
|
export default connect( |
|
|
|