end_Questions
This commit is contained in:
parent
8d9a38e1a9
commit
9ff014dff9
22
src/Hooks/useKeyPress.tsx
Normal file
22
src/Hooks/useKeyPress.tsx
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
|
type ModifierKey = 'ctrlKey' | 'shiftKey' | 'altKey' | 'metaKey';
|
||||||
|
|
||||||
|
const useKeyPress = (targetKey: string, modifierKey: ModifierKey, callback: () => void) => {
|
||||||
|
useEffect(() => {
|
||||||
|
const handleKeyDown = (event: KeyboardEvent) => {
|
||||||
|
if (event[modifierKey] && event.key === targetKey) {
|
||||||
|
event.preventDefault();
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('keydown', handleKeyDown);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener('keydown', handleKeyDown);
|
||||||
|
};
|
||||||
|
}, [targetKey, modifierKey, callback]);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useKeyPress;
|
||||||
|
|
@ -24,7 +24,8 @@ const NavBar = () => {
|
||||||
|
|
||||||
const translateArray = translateOptions(search_array, t);
|
const translateArray = translateOptions(search_array, t);
|
||||||
const { course_id } = useParams<ParamsEnum>();
|
const { course_id } = useParams<ParamsEnum>();
|
||||||
|
console.log(location);
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const handelNavigate = () => {
|
const handelNavigate = () => {
|
||||||
|
|
@ -36,7 +37,7 @@ const NavBar = () => {
|
||||||
if (location.pathname === "/") {
|
if (location.pathname === "/") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
navigate(-1);
|
navigate(-1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const { handel_open_model } = useModalHandler();
|
const { handel_open_model } = useModalHandler();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import React, { useEffect } from "react";
|
||||||
import { Modal, Spin } from "antd";
|
import { Modal, Spin } from "antd";
|
||||||
import FormikForm from "../../Layout/Dashboard/FormikFormModel";
|
import FormikForm from "../../Layout/Dashboard/FormikFormModel";
|
||||||
import ModelBody from "./Model/Add";
|
import ModelBody from "./Model/Add";
|
||||||
import { getInitialValues, getValidationSchema ,getInitialValuesBase, getValidationSchemaBase} from "./Model/formUtil";
|
import { getInitialValues, getValidationSchema ,getInitialValuesBase, getValidationSchemaBase, processTags} from "./Model/formUtil";
|
||||||
import { useAddQuestion } from "../../api/Question";
|
import { useAddQuestion } from "../../api/Question";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
|
|
@ -13,36 +13,43 @@ import Header from "../../Components/exercise/Header";
|
||||||
import { Question } from "../../types/Item";
|
import { Question } from "../../types/Item";
|
||||||
import BaseForm from './Model/Malty/Add'
|
import BaseForm from './Model/Malty/Add'
|
||||||
import Form from './Model/Add'
|
import Form from './Model/Add'
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
|
||||||
const AddPage: React.FC = () => {
|
const AddPage: React.FC = () => {
|
||||||
|
|
||||||
|
|
||||||
const { mutate, isSuccess, isLoading ,mutateAsync} = useAddQuestion();
|
const { mutate, isSuccess, isLoading ,mutateAsync} = useAddQuestion();
|
||||||
const {object_to_edit} = useObjectToEdit()
|
const {object_to_edit,set_Tags_search} = useObjectToEdit()
|
||||||
|
|
||||||
const {subject_id} = useParams<ParamsEnum>()
|
const {subject_id} = useParams<ParamsEnum>()
|
||||||
const {isBseQuestion,set_isBseQuestion} = useObjectToEdit()
|
const {isBseQuestion,set_isBseQuestion} = useObjectToEdit()
|
||||||
|
|
||||||
const handleSubmit = (values: Question) => {
|
const handleSubmit = (values: Question) => {
|
||||||
const DataToSend = structuredClone(values);
|
const DataToSend = structuredClone(values);
|
||||||
|
console.log(DataToSend,"DataToSend");
|
||||||
|
set_Tags_search(null)
|
||||||
|
|
||||||
if(isBseQuestion){
|
if(isBseQuestion){
|
||||||
const newBseQuestion = {
|
const newBseQuestion = {
|
||||||
"subject_id" : subject_id,
|
"subject_id" : subject_id,
|
||||||
"content" : DataToSend?.content,
|
"content" : DataToSend?.content,
|
||||||
"image": DataToSend?.image ?? "",
|
"image": DataToSend?.image ?? "",
|
||||||
"max_mark" : DataToSend?.max_mark,
|
|
||||||
"min_mark_to_pass" : DataToSend?.min_mark_to_pass,
|
|
||||||
"isBase" : 1,
|
"isBase" : 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
mutateAsync(newBseQuestion).then((data)=>{
|
mutateAsync(newBseQuestion).then((data)=>{
|
||||||
const newBseQuestionId = (data as any )?.data?.id ;
|
const newBseQuestionId = (data as any )?.data?.id ;
|
||||||
const Questions = DataToSend?.Questions;
|
const Questions = DataToSend?.Questions;
|
||||||
|
|
||||||
|
|
||||||
Questions?.map((item:Question)=>{
|
Questions?.map((item:Question)=>{
|
||||||
|
const tags = processTags(item)
|
||||||
|
|
||||||
mutate({
|
mutate({
|
||||||
...item,
|
...item,
|
||||||
parent_id:newBseQuestionId,
|
parent_id:newBseQuestionId,
|
||||||
"subject_id" : subject_id,
|
"subject_id" : subject_id,
|
||||||
|
tags
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
@ -51,12 +58,16 @@ const AddPage: React.FC = () => {
|
||||||
|
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
mutate({ ...values, subject_id:subject_id });
|
const tags = processTags(DataToSend)
|
||||||
|
console.log(tags);
|
||||||
|
|
||||||
|
mutate({ ...values, subject_id:subject_id , tags });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(isSuccess){
|
if(isSuccess){
|
||||||
|
toast.success(t("validation.the_possess_done_successful"))
|
||||||
navigate(-1)
|
navigate(-1)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -132,3 +143,5 @@ const AddPage: React.FC = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AddPage;
|
export default AddPage;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { Modal, Spin } from "antd";
|
import { Modal, Spin } from "antd";
|
||||||
import FormikForm from "../../Layout/Dashboard/FormikFormModel";
|
import FormikForm from "../../Layout/Dashboard/FormikFormModel";
|
||||||
import { getInitialValues, getValidationSchema ,getInitialValuesBase, getValidationSchemaBase} from "./Model/formUtil";
|
import { getInitialValues, getValidationSchema ,getInitialValuesBase, getValidationSchemaBase, processTags} from "./Model/formUtil";
|
||||||
import { useAddQuestion, useGetAllQuestion, useUpdateQuestion } from "../../api/Question";
|
import { useAddQuestion, useGetAllQuestion, useUpdateQuestion } from "../../api/Question";
|
||||||
import { useQueryClient } from "react-query";
|
import { useQueryClient } from "react-query";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
@ -14,18 +14,19 @@ import Header from "../../Components/exercise/Header";
|
||||||
import Form from './Model/Edit'
|
import Form from './Model/Edit'
|
||||||
import BaseForm from './Model/Malty/Edit'
|
import BaseForm from './Model/Malty/Edit'
|
||||||
import { Question } from "../../types/Item";
|
import { Question } from "../../types/Item";
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
|
||||||
const EditPage: React.FC = () => {
|
const EditPage: React.FC = () => {
|
||||||
|
|
||||||
const {question_id,subject_id} = useParams<ParamsEnum>()
|
const {question_id,subject_id} = useParams<ParamsEnum>()
|
||||||
const {isBseQuestion,set_isBseQuestion} = useObjectToEdit()
|
const {isBseQuestion,set_isBseQuestion,set_Tags_search} = useObjectToEdit()
|
||||||
|
|
||||||
const { mutate, isSuccess, isLoading } = useUpdateQuestion();
|
const { mutate, isSuccess, isLoading } = useUpdateQuestion();
|
||||||
const { mutate:AddQuestion} = useAddQuestion();
|
const { mutate:AddQuestion} = useAddQuestion();
|
||||||
|
|
||||||
const {data,isLoading:dataLoading}= useGetAllQuestion({show:question_id})
|
const {data,isLoading:dataLoading}= useGetAllQuestion({show:question_id})
|
||||||
|
|
||||||
const {data:Questions,isLoading:QuestionsDataLoading}= useGetAllQuestion({parent_id:question_id})
|
const {data:Questions,isLoading:QuestionsDataLoading}= useGetAllQuestion({questionParentId:question_id})
|
||||||
|
|
||||||
const object_to_edit = {...data?.data,Questions:Questions?.data } ;
|
const object_to_edit = {...data?.data,Questions:Questions?.data } ;
|
||||||
|
|
||||||
|
|
@ -40,41 +41,52 @@ const EditPage: React.FC = () => {
|
||||||
|
|
||||||
const handleSubmit = (values: any) => {
|
const handleSubmit = (values: any) => {
|
||||||
const DataToSend = structuredClone(values);
|
const DataToSend = structuredClone(values);
|
||||||
|
set_Tags_search(null)
|
||||||
console.log(isBseQuestion);
|
console.log(DataToSend);
|
||||||
|
|
||||||
if(isBseQuestion){
|
if(isBseQuestion){
|
||||||
console.log(1);
|
console.log(1);
|
||||||
|
|
||||||
const UpdateBseQuestion = {
|
const UpdateBseQuestion = {
|
||||||
"id":DataToSend?.id,
|
"id":DataToSend?.id,
|
||||||
"content" : DataToSend?.content,
|
"content" : DataToSend?.content,
|
||||||
"image": DataToSend?.image ?? "",
|
"image": DataToSend?.image ?? "",
|
||||||
"max_mark" : DataToSend?.max_mark,
|
|
||||||
"min_mark_to_pass" : DataToSend?.min_mark_to_pass,
|
|
||||||
}
|
}
|
||||||
if( typeof UpdateBseQuestion?.image === "string"){
|
if( typeof UpdateBseQuestion?.image === "string"){
|
||||||
delete UpdateBseQuestion["image"]
|
delete UpdateBseQuestion["image"]
|
||||||
}
|
}
|
||||||
|
|
||||||
mutate(UpdateBseQuestion)
|
mutate(UpdateBseQuestion)
|
||||||
|
|
||||||
const Questions = DataToSend?.Questions;
|
const Questions = DataToSend?.Questions;
|
||||||
|
|
||||||
Questions?.map((item:Question)=>{
|
Questions?.map((item:Question)=>{
|
||||||
|
console.log(item);
|
||||||
|
|
||||||
const itemToSend = structuredClone(item);
|
const itemToSend = structuredClone(item);
|
||||||
const keysToRemove = ['image', 'answer_image'];
|
const keysToRemove = ['image', 'answer_image'];
|
||||||
const updatedObject = removeStringKeys(itemToSend, keysToRemove);
|
const updatedObject = removeStringKeys(itemToSend, keysToRemove);
|
||||||
console.log(updatedObject,"updatedObject");
|
console.log(updatedObject,"updatedObject");
|
||||||
if(updatedObject?.id){
|
if(updatedObject?.id){
|
||||||
|
const tags = processTags(updatedObject)
|
||||||
|
console.log(tags);
|
||||||
|
|
||||||
mutate({
|
mutate({
|
||||||
...updatedObject,
|
...updatedObject,
|
||||||
|
tags
|
||||||
|
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
|
const tags = processTags(updatedObject)
|
||||||
|
console.log(tags);
|
||||||
|
|
||||||
|
|
||||||
AddQuestion({
|
AddQuestion({
|
||||||
...updatedObject,
|
...updatedObject,
|
||||||
parent_id:UpdateBseQuestion?.id,
|
parent_id:UpdateBseQuestion?.id,
|
||||||
subject_id:subject_id
|
subject_id:subject_id,
|
||||||
|
tags
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -86,7 +98,10 @@ const EditPage: React.FC = () => {
|
||||||
|
|
||||||
const keysToRemove = ['image', 'answer_image'];
|
const keysToRemove = ['image', 'answer_image'];
|
||||||
const updatedObject = removeStringKeys(DataToSend, keysToRemove);
|
const updatedObject = removeStringKeys(DataToSend, keysToRemove);
|
||||||
mutate({ ...updatedObject });
|
delete updatedObject["parent_id"];
|
||||||
|
const tags = processTags(updatedObject)
|
||||||
|
console.log(tags);
|
||||||
|
mutate({ ...updatedObject,tags });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -99,6 +114,7 @@ const EditPage: React.FC = () => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(isSuccess){
|
if(isSuccess){
|
||||||
|
toast.success(t("validation.the_possess_done_successful"))
|
||||||
navigate(-1)
|
navigate(-1)
|
||||||
}
|
}
|
||||||
}, [isSuccess])
|
}, [isSuccess])
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import { Choice } from "../../../types/Item";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import DynamicTags from "./Tags/DynamicTags";
|
import DynamicTags from "./Tags/DynamicTags";
|
||||||
import { useGetAllQuestion } from "../../../api/Question";
|
import { useGetAllQuestion } from "../../../api/Question";
|
||||||
|
import useKeyPress from "../../../Hooks/useKeyPress";
|
||||||
|
|
||||||
const Form = () => {
|
const Form = () => {
|
||||||
const formik = useFormikContext();
|
const formik = useFormikContext();
|
||||||
|
|
@ -32,11 +33,18 @@ const Form = () => {
|
||||||
{
|
{
|
||||||
answer:null,
|
answer:null,
|
||||||
answer_image:null,
|
answer_image:null,
|
||||||
isCorrect:0
|
isCorrect:0,
|
||||||
|
|
||||||
}])
|
}])
|
||||||
}
|
}
|
||||||
const [t] = useTranslation()
|
const [t] = useTranslation()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
useKeyPress('q', 'ctrlKey', handleAddChoice);
|
||||||
|
const selectedInput = document.getElementById("choice_1")
|
||||||
|
console.log(selectedInput,"selectedInput");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Row className="w-100">
|
<Row className="w-100">
|
||||||
<div className="exercise_form">
|
<div className="exercise_form">
|
||||||
|
|
@ -55,12 +63,12 @@ const Form = () => {
|
||||||
{
|
{
|
||||||
(((formik?.values as any)?.QuestionOptions as Choice[])||[]) .map((item:Choice,index:number)=>{
|
(((formik?.values as any)?.QuestionOptions as Choice[])||[]) .map((item:Choice,index:number)=>{
|
||||||
|
|
||||||
return <ChoiceFields key={index} index={index} data={item}/>
|
return <ChoiceFields key={index} index={index} data={item}/>
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
<p className="add_new_button" >
|
<p className="add_new_button" >
|
||||||
<FaCirclePlus onClick={handleAddChoice} size={23} /> {t("header.add_new_choice")}
|
<FaCirclePlus onClick={handleAddChoice} size={23} /> {t("header.add_new_choice")}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<DynamicTags/>
|
<DynamicTags/>
|
||||||
|
|
|
||||||
94
src/Pages/question/Model/Delete.tsx
Normal file
94
src/Pages/question/Model/Delete.tsx
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { Input, Modal, Spin } from "antd";
|
||||||
|
import { useModalState } from "../../../zustand/Modal";
|
||||||
|
import { ModalEnum } from "../../../enums/Model";
|
||||||
|
import { useObjectToEdit } from "../../../zustand/ObjectToEditState";
|
||||||
|
import { useDeleteQuestion } from "../../../api/Question";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
const ModalForm: React.FC = () => {
|
||||||
|
const { isOpen, setIsOpen } = useModalState((state) => state);
|
||||||
|
const [inputValue, setInputValue] = useState("");
|
||||||
|
|
||||||
|
const { mutate, isLoading, isSuccess } = useDeleteQuestion();
|
||||||
|
const { object_to_edit, set_object_to_edit } = useObjectToEdit();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isSuccess) {
|
||||||
|
setIsOpen("");
|
||||||
|
setInputValue("");
|
||||||
|
}
|
||||||
|
}, [isSuccess, setIsOpen]);
|
||||||
|
|
||||||
|
const handleSubmit = () => {
|
||||||
|
mutate({
|
||||||
|
id: Number(object_to_edit?.id),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCancel = () => {
|
||||||
|
setInputValue("");
|
||||||
|
setIsOpen("");
|
||||||
|
set_object_to_edit({});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
// Step 2: Handle changes to the input field
|
||||||
|
setInputValue(e.target.value);
|
||||||
|
};
|
||||||
|
const [t] = useTranslation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Modal
|
||||||
|
className="ModalForm"
|
||||||
|
centered
|
||||||
|
width={"40vw"}
|
||||||
|
footer={null}
|
||||||
|
open={isOpen === ModalEnum?.QUESTION_DELETE}
|
||||||
|
onCancel={handleCancel}
|
||||||
|
>
|
||||||
|
<header>
|
||||||
|
{t("practical.delete")} ({object_to_edit?.max_mark}){" "}
|
||||||
|
</header>
|
||||||
|
<main className="main_modal">
|
||||||
|
<div className="ValidationField w-100 mb-5">
|
||||||
|
<label className="text ">
|
||||||
|
{t("practical.to_confirm_deletion_please_re_enter")}{" "}
|
||||||
|
{t("input.max_mark")} {t("models.Question")}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<Input
|
||||||
|
size="large"
|
||||||
|
type="text"
|
||||||
|
placeholder={`${t("practical.enter")} ${t("input.max_mark")} ${t("models.Question")} `}
|
||||||
|
value={inputValue}
|
||||||
|
onChange={handleChange}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="buttons">
|
||||||
|
<div onClick={handleCancel}>{t("practical.cancel")}</div>
|
||||||
|
<button
|
||||||
|
className={
|
||||||
|
object_to_edit?.max_mark !== inputValue ? "disabled_button" : ""
|
||||||
|
}
|
||||||
|
disabled={object_to_edit?.max_mark !== inputValue || isLoading}
|
||||||
|
onClick={handleSubmit}
|
||||||
|
>
|
||||||
|
{t("practical.delete")}
|
||||||
|
|
||||||
|
{isLoading && (
|
||||||
|
<span className="Spinier_Div">
|
||||||
|
<Spin />
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ModalForm;
|
||||||
|
|
@ -12,7 +12,7 @@ import DynamicTags from "./Tags/DynamicTags";
|
||||||
import { useGetAllQuestion } from "../../../api/Question";
|
import { useGetAllQuestion } from "../../../api/Question";
|
||||||
|
|
||||||
const Form = () => {
|
const Form = () => {
|
||||||
const formik = useFormikContext();
|
const formik = useFormikContext<any>();
|
||||||
const { isOpen } = useModalState((state) => state);
|
const { isOpen } = useModalState((state) => state);
|
||||||
// const {data} = useGetAllQuestion();
|
// const {data} = useGetAllQuestion();
|
||||||
|
|
||||||
|
|
@ -27,6 +27,8 @@ const Form = () => {
|
||||||
|
|
||||||
|
|
||||||
const handleAddChoice = () => {
|
const handleAddChoice = () => {
|
||||||
|
|
||||||
|
|
||||||
formik.setFieldValue('QuestionOptions', [...(formik?.values as any)?.QuestionOptions as Choice[],
|
formik.setFieldValue('QuestionOptions', [...(formik?.values as any)?.QuestionOptions as Choice[],
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ const ChoiceFields = ({index,data}:{index:number , data :Choice }) => {
|
||||||
<div className='ChoiceFields'>
|
<div className='ChoiceFields'>
|
||||||
|
|
||||||
|
|
||||||
<TextField className="textarea_exercise" placeholder={"choice"} label2={t(`input.choice`) + ` ` + `(${(getCharFromNumber(index))})` } name={index} type="TextArea" />
|
<TextField className="textarea_exercise" placeholder={"choice"} label2={t(`input.choice`) + ` ` + `(${(getCharFromNumber(index))})` } name={index} id={`choice_${index}`} type="TextArea" />
|
||||||
<File className="file_exercise" label={"attachment"} name={index} type="File" />
|
<File className="file_exercise" label={"attachment"} name={index} type="File" />
|
||||||
|
|
||||||
<CheckboxField className="" label="The_correct_answer" name={index} type="Checkbox" />
|
<CheckboxField className="" label="The_correct_answer" name={index} type="Checkbox" />
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ const TextField = ({
|
||||||
props,
|
props,
|
||||||
no_label,
|
no_label,
|
||||||
label_icon,
|
label_icon,
|
||||||
|
id,
|
||||||
className
|
className
|
||||||
}: any) => {
|
}: any) => {
|
||||||
const newName = `QuestionOptions[${name}].answer`
|
const newName = `QuestionOptions[${name}].answer`
|
||||||
|
|
@ -60,7 +61,7 @@ const TextField = ({
|
||||||
maxLength={1000}
|
maxLength={1000}
|
||||||
onChange={onChange || TextFilehandleChange}
|
onChange={onChange || TextFilehandleChange}
|
||||||
style={{height:120}}
|
style={{height:120}}
|
||||||
|
id={id}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ const Form = () => {
|
||||||
}, [isOpen]);
|
}, [isOpen]);
|
||||||
|
|
||||||
// console.log(formik?.errors);
|
// console.log(formik?.errors);
|
||||||
|
console.log(formik?.values?.Questions,"formik?.values?.Questions");
|
||||||
|
|
||||||
|
|
||||||
const handleAddChoice = (parent_index:number) => {
|
const handleAddChoice = (parent_index:number) => {
|
||||||
console.log(parent_index);
|
console.log(parent_index);
|
||||||
|
|
@ -64,57 +65,58 @@ const Form = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Row className="w-100">
|
<Row className="w-100">
|
||||||
<div className="exercise_form">
|
<div className="exercise_form">
|
||||||
|
|
||||||
<ValidationField className="textarea_exercise" name="content" label="main_question" type="TextArea" />
|
<ValidationField className="textarea_exercise" name="content" label="main_question" type="TextArea" />
|
||||||
<ValidationField className="file_exercise" name="image" label="attachment" type="File" />
|
<ValidationField className="file_exercise" name="image" label="attachment" type="File" />
|
||||||
|
|
||||||
<div className="">
|
{/* <div className="">
|
||||||
<ValidationField name="max_mark" label="max_mark" type="Number" className="inputSmall" disabled />
|
<ValidationField name="max_mark" label="max_mark" type="Number" className="inputSmall" disabled />
|
||||||
<ValidationField name="min_mark_to_pass" label="min_mark_to_pass" className="inputSmall" type="Number" />
|
<ValidationField name="min_mark_to_pass" label="min_mark_to_pass" className="inputSmall" type="Number" />
|
||||||
|
|
||||||
</div>
|
</div> */}
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div className=" flex ">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{
|
||||||
|
(((formik?.values as any)?.Questions)||[])?.map((item:Choice,parent_index:number)=>{
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div key={parent_index}>
|
||||||
|
|
||||||
|
<div className="exercise_form">
|
||||||
|
|
||||||
</div>
|
<QuestionFIeld key={parent_index} index={parent_index} data={item}/>
|
||||||
<div className=" flex ">
|
</div>
|
||||||
|
|
||||||
</div>
|
{
|
||||||
|
(((formik?.values as any)?.Questions?.[parent_index]?.QuestionOptions)||[]) .map((item:Choice,index:number)=>{
|
||||||
{
|
|
||||||
(((formik?.values as any)?.Questions as Choice[])||[]) .map((item:Choice,parent_index:number)=>{
|
return <ChoiceFields key={index} parent_index={parent_index} index={index} data={item}/>
|
||||||
|
}
|
||||||
return (
|
)
|
||||||
<div key={parent_index}>
|
}
|
||||||
|
<p className="add_new_button" >
|
||||||
<div className="exercise_form">
|
<FaCirclePlus onClick={()=> handleAddChoice(parent_index)} size={23} /> {t("header.add_new_choice")}
|
||||||
|
</p>
|
||||||
</div>
|
|
||||||
|
<DynamicTags parent_index={parent_index} />
|
||||||
{
|
</div>
|
||||||
(((formik?.values as any)?.Questions?.[parent_index]?.QuestionOptions as Choice[])||[]) .map((item:Choice,index:number)=>{
|
|
||||||
|
|
||||||
return <ChoiceFields key={index} parent_index={parent_index} index={index} data={item}/>
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
<p className="add_new_button" >
|
|
||||||
<FaCirclePlus onClick={()=> handleAddChoice(parent_index)} size={23} /> {t("header.add_new_choice")}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<DynamicTags parent_index={parent_index} />
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
)
|
||||||
<p className="add_new_button" >
|
}
|
||||||
<FaCirclePlus onClick={handleAddQuestion} size={23} /> {t("header.add_new_question")}
|
|
||||||
</p>
|
<p className="add_new_button" >
|
||||||
</Row>
|
<FaCirclePlus onClick={handleAddQuestion} size={23} /> {t("header.add_new_question")}
|
||||||
|
</p>
|
||||||
|
</Row>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,37 +28,38 @@ const Form = () => {
|
||||||
const [t] = useTranslation()
|
const [t] = useTranslation()
|
||||||
|
|
||||||
|
|
||||||
const handleAddChoice = (parent_index:number) => {
|
|
||||||
console.log(parent_index);
|
const handleAddChoice = (parent_index:number) => {
|
||||||
|
console.log(parent_index);
|
||||||
formik.setFieldValue(`Questions.[${parent_index}].QuestionOptions`, [...(formik?.values as any)?.Questions?.[parent_index].QuestionOptions,
|
console.log(formik?.values?.Questions);
|
||||||
|
formik.setFieldValue(`Questions.[${parent_index}].QuestionOptions`, [...(formik?.values as any)?.Questions?.[parent_index].QuestionOptions as Choice[],
|
||||||
{
|
|
||||||
answer:null,
|
|
||||||
answer_image:null,
|
|
||||||
isCorrect:0
|
|
||||||
}])
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const handleAddQuestion = () => {
|
|
||||||
formik.setFieldValue('Questions', [...(formik?.values as any)?.Questions,
|
|
||||||
|
|
||||||
{
|
{
|
||||||
content: "",
|
answer:null,
|
||||||
image: "",
|
answer_image:null,
|
||||||
parent: '',
|
isCorrect:0
|
||||||
isBase: 0,
|
|
||||||
max_mark: 1,
|
|
||||||
min_mark_to_pass: 1,
|
|
||||||
QuestionOptions: [{ answer: null, answer_image: null, isCorrect: 0 }],
|
|
||||||
tags: []
|
|
||||||
}])
|
}])
|
||||||
|
|
||||||
const max_mark = formik?.values?.max_mark + 1
|
|
||||||
|
|
||||||
formik.setFieldValue('max_mark', max_mark)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const handleAddQuestion = () => {
|
||||||
|
formik.setFieldValue('Questions', [...(formik?.values as any)?.Questions as Choice[],
|
||||||
|
|
||||||
|
{
|
||||||
|
content: "",
|
||||||
|
image: "",
|
||||||
|
parent: '',
|
||||||
|
isBase: 0,
|
||||||
|
max_mark: 1,
|
||||||
|
min_mark_to_pass: 1,
|
||||||
|
QuestionOptions: [{ answer: null, answer_image: null, isCorrect: 0 }],
|
||||||
|
tags: []
|
||||||
|
}])
|
||||||
|
|
||||||
|
const max_mark = formik?.values?.max_mark + 1
|
||||||
|
|
||||||
|
formik.setFieldValue('max_mark', max_mark)
|
||||||
|
}
|
||||||
console.log(formik?.values);
|
console.log(formik?.values);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -68,11 +69,11 @@ const Form = () => {
|
||||||
<ValidationField className="textarea_exercise" name="content" label="main_question" type="TextArea" />
|
<ValidationField className="textarea_exercise" name="content" label="main_question" type="TextArea" />
|
||||||
<ValidationField className="file_exercise" name="image" label="attachment" type="File" />
|
<ValidationField className="file_exercise" name="image" label="attachment" type="File" />
|
||||||
|
|
||||||
<div className="">
|
{/* <div className="">
|
||||||
<ValidationField name="max_mark" label="max_mark" type="Number" className="inputSmall" disabled />
|
<ValidationField name="max_mark" label="max_mark" type="Number" className="inputSmall" disabled />
|
||||||
<ValidationField name="min_mark_to_pass" label="min_mark_to_pass" className="inputSmall" type="Number" />
|
<ValidationField name="min_mark_to_pass" label="min_mark_to_pass" className="inputSmall" type="Number" />
|
||||||
|
|
||||||
</div>
|
</div> */}
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ const DynamicTags = ({parent_index}:{parent_index:number}) => {
|
||||||
const handleAddChoice = () => {
|
const handleAddChoice = () => {
|
||||||
const length = formik?.values?.Questions?.[parent_index]?.tags.length;
|
const length = formik?.values?.Questions?.[parent_index]?.tags.length;
|
||||||
const lastElement = formik?.values?.Questions?.[parent_index]?.tags[length - 1]?.name;
|
const lastElement = formik?.values?.Questions?.[parent_index]?.tags[length - 1]?.name;
|
||||||
|
set_Tags_search(null)
|
||||||
|
|
||||||
if(lastElement !== ""){
|
if(lastElement !== ""){
|
||||||
formik.setFieldValue(`Questions.[${parent_index}].tags`, [...(formik?.values as any)?.Questions?.[parent_index]?.tags as any[],
|
formik.setFieldValue(`Questions.[${parent_index}].tags`, [...(formik?.values as any)?.Questions?.[parent_index]?.tags as any[],
|
||||||
|
|
||||||
|
|
@ -40,7 +41,7 @@ const DynamicTags = ({parent_index}:{parent_index:number}) => {
|
||||||
|
|
||||||
const handleChoice = (item: any) => {
|
const handleChoice = (item: any) => {
|
||||||
|
|
||||||
const length = formik.values.tags.length;
|
const length = formik?.values?.Questions?.[parent_index]?.tags?.length;
|
||||||
console.log(currentTag);
|
console.log(currentTag);
|
||||||
|
|
||||||
formik.setFieldValue(`Questions.[${parent_index}].tags[${currentTag}]`, {...item,key:length});
|
formik.setFieldValue(`Questions.[${parent_index}].tags[${currentTag}]`, {...item,key:length});
|
||||||
|
|
@ -53,7 +54,7 @@ const handleChoice = (item: any) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='DynamicTags'>
|
<div className='DynamicTags'>
|
||||||
{formik?.values?.tags?.length < 1 &&
|
{formik?.values?.Questions?.[parent_index]?.tags?.length < 1 &&
|
||||||
|
|
||||||
<p className="add_new_button" >
|
<p className="add_new_button" >
|
||||||
<FaCirclePlus size={23} onClick={handleAddChoice} /> {t("header.add_tag")}
|
<FaCirclePlus size={23} onClick={handleAddChoice} /> {t("header.add_tag")}
|
||||||
|
|
@ -79,6 +80,7 @@ return (
|
||||||
{formik?.values?.Questions?.[parent_index]?.tags?.length > 0 &&
|
{formik?.values?.Questions?.[parent_index]?.tags?.length > 0 &&
|
||||||
|
|
||||||
<p className="add_new_button" >
|
<p className="add_new_button" >
|
||||||
|
|
||||||
<FaCirclePlus onClick={handleAddChoice} size={20} />
|
<FaCirclePlus onClick={handleAddChoice} size={20} />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@ const Tag = ({ data, index,parent_index }: { data: any, index: number,parent_ind
|
||||||
const DEBOUNCE_DELAY = 500;
|
const DEBOUNCE_DELAY = 500;
|
||||||
const formik = useFormikContext<any>();
|
const formik = useFormikContext<any>();
|
||||||
const { set_Tags_search ,set_currentTag,set_current_parent_index} = useObjectToEdit();
|
const { set_Tags_search ,set_currentTag,set_current_parent_index} = useObjectToEdit();
|
||||||
|
console.log(formik?.values?.Questions);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (inputRef.current) {
|
if (inputRef.current) {
|
||||||
inputRef.current.style.width = `${(formik?.values?.Questions?.[parent_index]?.tags[index]?.name?.length + 1) * 8}px`;
|
inputRef.current.style.width = `${(formik?.values?.Questions?.[parent_index]?.tags[index]?.name?.length + 1) * 8}px`;
|
||||||
|
|
@ -18,7 +19,9 @@ const Tag = ({ data, index,parent_index }: { data: any, index: number,parent_ind
|
||||||
|
|
||||||
const handleEditInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleEditInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
// console.log(e.target.value);
|
// console.log(e.target.value);
|
||||||
formik.setFieldValue(`Questions.[${parent_index}].tags[${index}].name`, e.target.value);
|
|
||||||
|
|
||||||
|
formik.setFieldValue(`Questions.[${parent_index}].tags[${index}]`, {key:parent_index, name :e.target.value , id:`${parent_index}_key`});
|
||||||
set_currentTag(index)
|
set_currentTag(index)
|
||||||
set_current_parent_index(parent_index)
|
set_current_parent_index(parent_index)
|
||||||
if (timeoutRef.current) {
|
if (timeoutRef.current) {
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,13 @@ const DynamicTags = () => {
|
||||||
name : Tags_search
|
name : Tags_search
|
||||||
})
|
})
|
||||||
const suggests = data?.data
|
const suggests = data?.data
|
||||||
|
console.log(Tags_search);
|
||||||
|
|
||||||
|
|
||||||
const handleAddChoice = () => {
|
const handleAddChoice = () => {
|
||||||
const length = formik?.values?.tags.length;
|
const length = formik?.values?.tags.length;
|
||||||
const lastElement = formik?.values?.tags[length - 1]?.name;
|
const lastElement = formik?.values?.tags[length - 1]?.name;
|
||||||
|
set_Tags_search(null)
|
||||||
if(lastElement !== ""){
|
if(lastElement !== ""){
|
||||||
formik.setFieldValue('tags', [...(formik?.values as any)?.tags as any[],
|
formik.setFieldValue('tags', [...(formik?.values as any)?.tags as any[],
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ const Tag = ({ data, index }: { data: any, index: number }) => {
|
||||||
// console.log(e.target.value);
|
// console.log(e.target.value);
|
||||||
formik.setFieldValue(`tags[${index}].name`, e.target.value);
|
formik.setFieldValue(`tags[${index}].name`, e.target.value);
|
||||||
// set_Tags_search(e.target.value)
|
// set_Tags_search(e.target.value)
|
||||||
|
formik.setFieldValue(`tags.[${index}]`, {key:index, name :e.target.value , id:`${index}_key`});
|
||||||
|
|
||||||
set_currentTag(index)
|
set_currentTag(index)
|
||||||
if (timeoutRef.current) {
|
if (timeoutRef.current) {
|
||||||
clearTimeout(timeoutRef.current);
|
clearTimeout(timeoutRef.current);
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,7 @@ export const getInitialValues = (objectToEdit: Question): any => {
|
||||||
image: objectToEdit?.image ?? "",
|
image: objectToEdit?.image ?? "",
|
||||||
subject_id: objectToEdit?.subject_id ?? '',
|
subject_id: objectToEdit?.subject_id ?? '',
|
||||||
isBase: objectToEdit?.isBase,
|
isBase: objectToEdit?.isBase,
|
||||||
max_mark: 1,
|
parent_id: objectToEdit?.parent_id ?? '',
|
||||||
min_mark_to_pass: 1,
|
|
||||||
parent: objectToEdit?.parent ?? '',
|
|
||||||
QuestionOptions: objectToEdit?.QuestionOptions ?? [],
|
QuestionOptions: objectToEdit?.QuestionOptions ?? [],
|
||||||
tags: tags ?? [],
|
tags: tags ?? [],
|
||||||
};
|
};
|
||||||
|
|
@ -26,8 +24,6 @@ export const getValidationSchema = () => {
|
||||||
return Yup.object().shape({
|
return Yup.object().shape({
|
||||||
image: Yup.string().nullable(),
|
image: Yup.string().nullable(),
|
||||||
content: Yup.string().required("validation.required"),
|
content: Yup.string().required("validation.required"),
|
||||||
max_mark: Yup.number().required("validation.required").min(Yup.ref("min_mark_to_pass"),"validation.max_mark_must_be_greater_than_min_mark_to_pass"),
|
|
||||||
min_mark_to_pass: Yup.number().required("validation.required"),
|
|
||||||
QuestionOptions: Yup.array().of(
|
QuestionOptions: Yup.array().of(
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
answer: Yup.string().required("validation.required"),
|
answer: Yup.string().required("validation.required"),
|
||||||
|
|
@ -46,7 +42,20 @@ export const getInitialValuesBase = (objectToEdit: Question): any => {
|
||||||
});
|
});
|
||||||
console.log(objectToEdit);
|
console.log(objectToEdit);
|
||||||
|
|
||||||
const questions = objectToEdit?.Questions ?? [];
|
const newQuestions = objectToEdit?.Questions?.map((item: any) => {
|
||||||
|
const tags = item?.tags?.map((tag: any) => ({
|
||||||
|
id: tag?.id,
|
||||||
|
name: tag?.name,
|
||||||
|
key: `${tag?.id}_key_${tag?.name}`
|
||||||
|
}));
|
||||||
|
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
tags
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const questions = newQuestions ?? [];
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -57,8 +66,7 @@ export const getInitialValuesBase = (objectToEdit: Question): any => {
|
||||||
isBase: objectToEdit?.isBase,
|
isBase: objectToEdit?.isBase,
|
||||||
max_mark: questions.length ?? 1,
|
max_mark: questions.length ?? 1,
|
||||||
min_mark_to_pass: 1,
|
min_mark_to_pass: 1,
|
||||||
parent: objectToEdit?.parent ?? '',
|
parent_id: objectToEdit?.parent_id ?? '',
|
||||||
tags: tags ?? [],
|
|
||||||
Questions: questions,
|
Questions: questions,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -88,3 +96,20 @@ export const getValidationSchemaBase = () => {
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export function processTags(DataToSend: any) {
|
||||||
|
const oldTags = DataToSend?.tags?.map((item: any, index: number) => {
|
||||||
|
if (typeof item?.id === "number") {
|
||||||
|
return item?.id;
|
||||||
|
}
|
||||||
|
}).filter((item:any) => item !== undefined);
|
||||||
|
|
||||||
|
const newTags = DataToSend?.tags?.map((item: any, index: number) => {
|
||||||
|
if (typeof item?.id === "string") {
|
||||||
|
return { name: item?.name };
|
||||||
|
}
|
||||||
|
}).filter((item:any) => item !== undefined);
|
||||||
|
|
||||||
|
return { new:newTags, old:oldTags };
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { lazy, Suspense } from 'react';
|
import { lazy, Suspense } from 'react';
|
||||||
import { Spin } from "antd";
|
import { Spin } from "antd";
|
||||||
|
import DeleteModel from './Model/Delete'
|
||||||
const Table = lazy(() => import('./Table'));
|
const Table = lazy(() => import('./Table'));
|
||||||
|
|
||||||
const TableHeader = () => {
|
const TableHeader = () => {
|
||||||
|
|
@ -17,6 +17,7 @@ const TableHeader = () => {
|
||||||
</header>
|
</header>
|
||||||
<Table />
|
<Table />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
<DeleteModel/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import { ParamsEnum } from "../../enums/params";
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const {subject_id} = useParams<ParamsEnum>()
|
const {subject_id} = useParams<ParamsEnum>()
|
||||||
const response = useGetAllQuestion({ subject_id:subject_id, pagination: true});
|
const response = useGetAllQuestion({ subject_id:subject_id, pagination: true });
|
||||||
|
|
||||||
return <DataTable response={response} useColumns={useColumns} />;
|
return <DataTable response={response} useColumns={useColumns} />;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,18 @@ import { ABILITIES_ENUM, ABILITIES_VALUES_ENUM } from "../../enums/abilities";
|
||||||
import { formatNumber } from "../../utils/formatNumber";
|
import { formatNumber } from "../../utils/formatNumber";
|
||||||
import { BsEyeFill } from "react-icons/bs";
|
import { BsEyeFill } from "react-icons/bs";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import { useModalState } from "../../zustand/Modal";
|
||||||
|
|
||||||
export const useColumns = () => {
|
export const useColumns = () => {
|
||||||
const { handel_open_model } = useModalHandler();
|
const { handel_open_model } = useModalHandler();
|
||||||
|
|
||||||
const { set_object_to_edit } = useObjectToEdit((state) => state);
|
const { set_object_to_edit } = useObjectToEdit((state) => state);
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
const { setIsOpen } = useModalState((state) => state);
|
||||||
|
|
||||||
const handelShow = (record: any) => {
|
const handelAdd = () => {
|
||||||
navigate(`${ABILITIES_ENUM.QUESTION}/${record?.id}`);
|
set_object_to_edit({})
|
||||||
|
navigate(`${ABILITIES_ENUM?.QUESTION}/add`)
|
||||||
};
|
};
|
||||||
|
|
||||||
const can_edit_Question = hasAbility(
|
const can_edit_Question = hasAbility(
|
||||||
|
|
@ -43,6 +46,8 @@ export const useColumns = () => {
|
||||||
);
|
);
|
||||||
const handelDelete = (data: any) => {
|
const handelDelete = (data: any) => {
|
||||||
set_object_to_edit(data);
|
set_object_to_edit(data);
|
||||||
|
setIsOpen(ModalEnum?.QUESTION_DELETE);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEdit = (record: any) => {
|
const handleEdit = (record: any) => {
|
||||||
|
|
@ -67,19 +72,18 @@ export const useColumns = () => {
|
||||||
align: "center",
|
align: "center",
|
||||||
render: (text, record) => record?.content,
|
render: (text, record) => record?.content,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: t("columns.description"),
|
title: t("columns.isBase"),
|
||||||
dataIndex: "description",
|
dataIndex: "isBase",
|
||||||
key: "description",
|
key: "isBase",
|
||||||
align: "center",
|
align: "center",
|
||||||
render: (text, record) => record?.max_mark,
|
render: (text, record) => record?.isBase === 1 ? t("practical.yes") : t ("practical.no"),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: can_add_Question ? (
|
title: can_add_Question ? (
|
||||||
<button
|
<button
|
||||||
onClick={() => navigate(`${ABILITIES_ENUM?.QUESTION}/add`) }
|
onClick={() => handelAdd() }
|
||||||
className="add_button"
|
className="add_button"
|
||||||
>
|
>
|
||||||
{t("practical.add")} {t("models.Question")} <FaPlus />
|
{t("practical.add")} {t("models.Question")} <FaPlus />
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ const KEY = "question";
|
||||||
|
|
||||||
export const useGetAllQuestion = (params?: any) =>
|
export const useGetAllQuestion = (params?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params);
|
useGetQuery(KEY, API.GET, params);
|
||||||
export const useAddQuestion = () => useAddMutation(KEY, API.ADD);
|
export const useAddQuestion = () => useAddMutation(KEY, API.ADD,false);
|
||||||
export const useUpdateQuestion = (params?: any) =>
|
export const useUpdateQuestion = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET,false);
|
||||||
export const useDeleteQuestion = (params?: any) =>
|
export const useDeleteQuestion = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllAbility = (params?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params);
|
useGetQuery(KEY, API.GET, params);
|
||||||
export const useAddAbility = () => useAddMutation(KEY, API.ADD);
|
export const useAddAbility = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateAbility = (params?: any) =>
|
export const useUpdateAbility = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteAbility = (params?: any) =>
|
export const useDeleteAbility = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,4 @@ export const useGetAllAbsence = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddAbsence = () => useAddMutation(KEY, API.ADD);
|
export const useAddAbsence = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateAbsence = (params?: any) =>
|
export const useUpdateAbsence = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export const useGetAllAdmin = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddAdmin = () => useAddMutation(KEY, API.ADD);
|
export const useAddAdmin = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateAdmin = (params?: any) =>
|
export const useUpdateAdmin = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
|
|
||||||
export const useDeleteAdmin = (params?: any) =>
|
export const useDeleteAdmin = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,4 @@ export const useGetAllAttendence = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddAttendence = () => useAddMutation(KEY, API.ADD);
|
export const useAddAttendence = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateAttendence = (params?: any) =>
|
export const useUpdateAttendence = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,4 @@ const API = {
|
||||||
LOGOUT: `logout`,
|
LOGOUT: `logout`,
|
||||||
};
|
};
|
||||||
export const useLoginAdmin = () =>
|
export const useLoginAdmin = () =>
|
||||||
useAddMutation(KEY, API.LOGIN, "تسجيل الدخول");
|
useAddMutation(KEY, API.LOGIN,false);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllBranch = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddBranch = () => useAddMutation(KEY, API.ADD);
|
export const useAddBranch = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateBranch = (params?: any) =>
|
export const useUpdateBranch = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteBranch = (params?: any) =>
|
export const useDeleteBranch = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// export const BaseURL = "http://192.168.1.108:8000/api/";
|
export const BaseURL = "http://192.168.1.108:8000/api/";
|
||||||
export const BaseURL = "http://127.0.0.1:8000/api/";
|
// export const BaseURL = "http://127.0.0.1:8000/api/";
|
||||||
|
|
||||||
// export const BaseURL = "https://school-back-dev.point-dev.net/api/";
|
// export const BaseURL = "https://school-back-dev.point-dev.net/api/";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllCourse = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddCourse = () => useAddMutation(KEY, API.ADD);
|
export const useAddCourse = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateCourse = (params?: any) =>
|
export const useUpdateCourse = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteCourse = (params?: any) =>
|
export const useDeleteCourse = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllCycle = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddCycle = () => useAddMutation(KEY, API.ADD);
|
export const useAddCycle = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateCycle = (params?: any) =>
|
export const useUpdateCycle = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteCycle = (params?: any) =>
|
export const useDeleteCycle = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllEduClass = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddEduClass = () => useAddMutation(KEY, API.ADD);
|
export const useAddEduClass = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateEduClass = (params?: any) =>
|
export const useUpdateEduClass = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteEduClass = (params?: any) =>
|
export const useDeleteEduClass = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllExam = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddExam = () => useAddMutation(KEY, API.ADD);
|
export const useAddExam = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateExam = (params?: any) =>
|
export const useUpdateExam = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteExam = (params?: any) =>
|
export const useDeleteExam = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllExamTypes = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddExamTypes = () => useAddMutation(KEY, API.ADD);
|
export const useAddExamTypes = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateExamTypes = (params?: any) =>
|
export const useUpdateExamTypes = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteExamTypes = (params?: any) =>
|
export const useDeleteExamTypes = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllexamle = (params?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params);
|
useGetQuery(KEY, API.GET, params);
|
||||||
export const useAddexamle = () => useAddMutation(KEY, API.ADD);
|
export const useAddexamle = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateexamle = (params?: any) =>
|
export const useUpdateexamle = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteexamle = (params?: any) =>
|
export const useDeleteexamle = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@ import { AxiosResponse } from "../../types/Axios";
|
||||||
function useAddMutation(
|
function useAddMutation(
|
||||||
key: string,
|
key: string,
|
||||||
url: string,
|
url: string,
|
||||||
message?: string,
|
toast:boolean = true
|
||||||
|
|
||||||
): UseMutationResult<AxiosResponse, unknown, any, unknown> {
|
): UseMutationResult<AxiosResponse, unknown, any, unknown> {
|
||||||
const axios = useAxios();
|
const axios = useAxios();
|
||||||
return useMutation<AxiosResponse, unknown, any, unknown>(
|
return useMutation<AxiosResponse, unknown, any, unknown>(
|
||||||
|
|
@ -18,6 +19,7 @@ function useAddMutation(
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "multipart/form-data",
|
"Content-Type": "multipart/form-data",
|
||||||
[HEADER_KEY]: key,
|
[HEADER_KEY]: key,
|
||||||
|
["X-Custom-Message"] : toast
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
|
|
|
||||||
|
|
@ -42,16 +42,22 @@ function useAxios() {
|
||||||
const method = response.config.method;
|
const method = response.config.method;
|
||||||
|
|
||||||
const key = response.config.headers[HEADER_KEY];
|
const key = response.config.headers[HEADER_KEY];
|
||||||
|
const isToasted = response.config.headers["X-Custom-Message"];
|
||||||
|
|
||||||
const ResponseMessage =
|
const ResponseMessage =
|
||||||
responseMsg || t("validation.the_possess_done_successful");
|
responseMsg || t("validation.the_possess_done_successful");
|
||||||
if (method !== AxiosQueryEnum?.GET) {
|
if (method !== AxiosQueryEnum?.GET) {
|
||||||
queryClient.invalidateQueries(key);
|
queryClient.invalidateQueries(key);
|
||||||
toast.success(ResponseMessage);
|
if(isToasted){
|
||||||
|
toast.success(ResponseMessage);
|
||||||
|
|
||||||
|
}
|
||||||
setValidation([{}]);
|
setValidation([{}]);
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
|
|
||||||
const status = error?.request?.status;
|
const status = error?.request?.status;
|
||||||
const errorMsg = error?.response?.data?.message;
|
const errorMsg = error?.response?.data?.message;
|
||||||
const errorField = error?.response?.data;
|
const errorField = error?.response?.data;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,8 @@ type DataToSend = {
|
||||||
function useDeleteMutation(
|
function useDeleteMutation(
|
||||||
key: any,
|
key: any,
|
||||||
url: string,
|
url: string,
|
||||||
message?: string,
|
toast:boolean = true
|
||||||
|
|
||||||
): UseMutationResult<AxiosResponse, unknown, DataToSend, unknown> {
|
): UseMutationResult<AxiosResponse, unknown, DataToSend, unknown> {
|
||||||
const axios = useAxios();
|
const axios = useAxios();
|
||||||
return useMutation<AxiosResponse, unknown, DataToSend, unknown>(
|
return useMutation<AxiosResponse, unknown, DataToSend, unknown>(
|
||||||
|
|
@ -18,6 +19,7 @@ function useDeleteMutation(
|
||||||
const { data } = await axios.delete(url + `/` + dataToSend?.id, {
|
const { data } = await axios.delete(url + `/` + dataToSend?.id, {
|
||||||
headers: {
|
headers: {
|
||||||
[HEADER_KEY]: key,
|
[HEADER_KEY]: key,
|
||||||
|
["X-Custom-Message"] : toast
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@ import { AxiosResponse } from "../../types/Axios";
|
||||||
const useUpdateMutation = (
|
const useUpdateMutation = (
|
||||||
key: string,
|
key: string,
|
||||||
url: string,
|
url: string,
|
||||||
message?: string,
|
toast:boolean = true
|
||||||
|
|
||||||
): UseMutationResult<AxiosResponse, any, any, any> => {
|
): UseMutationResult<AxiosResponse, any, any, any> => {
|
||||||
const axios = useAxios();
|
const axios = useAxios();
|
||||||
|
|
||||||
|
|
@ -27,6 +28,7 @@ const useUpdateMutation = (
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "multipart/form-data",
|
"Content-Type": "multipart/form-data",
|
||||||
[HEADER_KEY]: key,
|
[HEADER_KEY]: key,
|
||||||
|
["X-Custom-Message"] : toast
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,4 @@ export const useGetAllLateArrival = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddLateArrival = () => useAddMutation(KEY, API.ADD);
|
export const useAddLateArrival = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateLateArrival = (params?: any) =>
|
export const useUpdateLateArrival = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllLesson = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddLesson = () => useAddMutation(KEY, API.ADD);
|
export const useAddLesson = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateLesson = (params?: any) =>
|
export const useUpdateLesson = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteLesson = (params?: any) =>
|
export const useDeleteLesson = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllMark = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddMark = () => useAddMutation(KEY, API.ADD);
|
export const useAddMark = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateMark = (params?: any) =>
|
export const useUpdateMark = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteMark = (params?: any) =>
|
export const useDeleteMark = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllNote = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddNote = () => useAddMutation(KEY, API.ADD);
|
export const useAddNote = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateNote = (params?: any) =>
|
export const useUpdateNote = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteNote = (params?: any) =>
|
export const useDeleteNote = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ export const useGetAllPayment = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddPayment = () => useAddMutation(KEY, API.ADD);
|
export const useAddPayment = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdatePayment = (params?: any) =>
|
export const useUpdatePayment = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeletePayment = (params?: any) =>
|
export const useDeletePayment = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,4 @@ export const useGetAllPresence = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddPresence = () => useAddMutation(KEY, API.ADD);
|
export const useAddPresence = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdatePresence = (params?: any) =>
|
export const useUpdatePresence = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllRegistrationRecord = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddRegistrationRecord = () => useAddMutation(KEY, API.ADD);
|
export const useAddRegistrationRecord = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateRegistrationRecord = (params?: any) =>
|
export const useUpdateRegistrationRecord = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteRegistrationRecord = (params?: any) =>
|
export const useDeleteRegistrationRecord = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ export const useGetRole = (params?: any, options?: any) =>
|
||||||
|
|
||||||
export const useAddRole = () => useAddMutation(KEY, API.ADD);
|
export const useAddRole = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateRole = (params?: any) =>
|
export const useUpdateRole = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
|
|
||||||
export const useDeleteRole = (params?: any) =>
|
export const useDeleteRole = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllSemantics = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddSemantics = () => useAddMutation(KEY, API.ADD);
|
export const useAddSemantics = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateSemantics = (params?: any) =>
|
export const useUpdateSemantics = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteSemantics = (params?: any) =>
|
export const useDeleteSemantics = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,6 @@ export const useGetAllSession = (params?: any, options?: any) =>
|
||||||
useGetQuery(GetKey, API.GET, params, options);
|
useGetQuery(GetKey, API.GET, params, options);
|
||||||
export const useAddSession = () => useAddMutation(KEY, API.ADD);
|
export const useAddSession = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateSession = (params?: any) =>
|
export const useUpdateSession = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteSession = (params?: any) =>
|
export const useDeleteSession = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllSessionContent = (params?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params);
|
useGetQuery(KEY, API.GET, params);
|
||||||
export const useAddSessionContent = () => useAddMutation(KEY, API.ADD);
|
export const useAddSessionContent = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateSessionContent = (params?: any) =>
|
export const useUpdateSessionContent = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteSessionContent = (params?: any) =>
|
export const useDeleteSessionContent = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ export const useGetStudent = (params?: any, options?: any) =>
|
||||||
|
|
||||||
export const useAddStudent = () => useAddMutation(KEY, API.ADD);
|
export const useAddStudent = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateStudent = (params?: any) =>
|
export const useUpdateStudent = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
|
|
||||||
export const useDeleteStudent = (params?: any) =>
|
export const useDeleteStudent = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllSubject = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddSubject = () => useAddMutation(KEY, API.ADD);
|
export const useAddSubject = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateSubject = (params?: any) =>
|
export const useUpdateSubject = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteSubject = (params?: any) =>
|
export const useDeleteSubject = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllsummary = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddsummary = () => useAddMutation(KEY, API.ADD);
|
export const useAddsummary = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdatesummary = (params?: any) =>
|
export const useUpdatesummary = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeletesummary = (params?: any) =>
|
export const useDeletesummary = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllTag = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddTag = () => useAddMutation(KEY, API.ADD);
|
export const useAddTag = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateTag = (params?: any) =>
|
export const useUpdateTag = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteTag = (params?: any) =>
|
export const useDeleteTag = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllTeacher = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddTeacher = () => useAddMutation(KEY, API.ADD);
|
export const useAddTeacher = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateTeacher = (params?: any) =>
|
export const useUpdateTeacher = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteTeacher = (params?: any) =>
|
export const useDeleteTeacher = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export const useGetAllTerm = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddTerm = () => useAddMutation(KEY, API.ADD);
|
export const useAddTerm = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateTerm = (params?: any) =>
|
export const useUpdateTerm = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteTerm = (params?: any) =>
|
export const useDeleteTerm = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@ export const useGetAllUnit = (params?: any, options?: any) =>
|
||||||
useGetQuery(KEY, API.GET, params, options);
|
useGetQuery(KEY, API.GET, params, options);
|
||||||
export const useAddUnit = () => useAddMutation(KEY, API.ADD);
|
export const useAddUnit = () => useAddMutation(KEY, API.ADD);
|
||||||
export const useUpdateUnit = (params?: any) =>
|
export const useUpdateUnit = (params?: any) =>
|
||||||
useUpdateMutation(KEY, API.GET, params);
|
useUpdateMutation(KEY, API.GET);
|
||||||
export const useDeleteUnit = (params?: any) =>
|
export const useDeleteUnit = (params?: any) =>
|
||||||
useDeleteMutation(KEY, API.DELETE);
|
useDeleteMutation(KEY, API.DELETE);
|
||||||
|
|
|
||||||
|
|
@ -141,4 +141,8 @@ export enum ModalEnum {
|
||||||
TAGS_ADD = "TAGS.add",
|
TAGS_ADD = "TAGS.add",
|
||||||
TAGS_DELETE = "TAGS.delete",
|
TAGS_DELETE = "TAGS.delete",
|
||||||
|
|
||||||
|
|
||||||
|
///// Question
|
||||||
|
QUESTION_DELETE = "Question.delete",
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,10 @@
|
||||||
"username": "اسم المستخدم",
|
"username": "اسم المستخدم",
|
||||||
"email": "البريد الإلكتروني",
|
"email": "البريد الإلكتروني",
|
||||||
"description":"الوصف",
|
"description":"الوصف",
|
||||||
"lesson_count":"عدد الدروس"
|
"lesson_count":"عدد الدروس",
|
||||||
|
"max_mark":"العلامة الكاملة",
|
||||||
|
"min_mark_to_pass" : "علامة النجاح",
|
||||||
|
"isBase":"سؤال رئيسي"
|
||||||
},
|
},
|
||||||
"practical": {
|
"practical": {
|
||||||
"to_confirm_deletion_please_re_enter": "لتأكيد الحذف، يرجى إعادة الإدخال",
|
"to_confirm_deletion_please_re_enter": "لتأكيد الحذف، يرجى إعادة الإدخال",
|
||||||
|
|
@ -184,7 +187,9 @@
|
||||||
"importStudents": "استيراد ",
|
"importStudents": "استيراد ",
|
||||||
"overview": "نظرة عامة",
|
"overview": "نظرة عامة",
|
||||||
"presence": "الحضور",
|
"presence": "الحضور",
|
||||||
"add_new_role": "اضافة صلاحية جديدة"
|
"add_new_role": "اضافة صلاحية جديدة",
|
||||||
|
"yes":"نعم",
|
||||||
|
"no":"لا"
|
||||||
},
|
},
|
||||||
"Table": {
|
"Table": {
|
||||||
"header": "",
|
"header": "",
|
||||||
|
|
|
||||||
|
|
@ -308,7 +308,7 @@ export interface QuestionOption {
|
||||||
export interface Question {
|
export interface Question {
|
||||||
id: number;
|
id: number;
|
||||||
subject_id: number;
|
subject_id: number;
|
||||||
parent: any;
|
parent_id:number;
|
||||||
isBase: number;
|
isBase: number;
|
||||||
content: string;
|
content: string;
|
||||||
max_mark: number;
|
max_mark: number;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user