end_question
This commit is contained in:
parent
6c82ce644e
commit
2df73211a1
|
|
@ -19,7 +19,7 @@ const AddPage: React.FC = () => {
|
|||
|
||||
|
||||
const { mutate, isSuccess, isLoading ,mutateAsync} = useAddQuestion();
|
||||
const {object_to_edit,set_Tags_search} = useObjectToEdit()
|
||||
const {object_to_edit,set_Tags_search,set_object_to_edit} = useObjectToEdit()
|
||||
|
||||
const {subject_id} = useParams<ParamsEnum>()
|
||||
const {isBseQuestion,set_isBseQuestion} = useObjectToEdit()
|
||||
|
|
@ -68,7 +68,9 @@ const AddPage: React.FC = () => {
|
|||
useEffect(() => {
|
||||
if(isSuccess){
|
||||
toast.success(t("validation.the_possess_done_successful"))
|
||||
navigate(-1)
|
||||
// navigate(-1)
|
||||
set_object_to_edit(null)
|
||||
|
||||
|
||||
}
|
||||
}, [isSuccess])
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ const EditPage: React.FC = () => {
|
|||
if( typeof UpdateBseQuestion?.image === "string"){
|
||||
delete UpdateBseQuestion["image"]
|
||||
}
|
||||
console.log(UpdateBseQuestion);
|
||||
|
||||
mutate(UpdateBseQuestion)
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ const Form = () => {
|
|||
|
||||
|
||||
|
||||
useKeyPress('q', 'ctrlKey', handleAddChoice);
|
||||
// useKeyPress('q', 'ctrlKey', handleAddChoice);
|
||||
|
||||
|
||||
const handleFocusChoice = (index:number) => {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ const DynamicTags = () => {
|
|||
const handleAddChoice = () => {
|
||||
const length = formik?.values?.tags.length;
|
||||
const lastElement = formik?.values?.tags[length - 1]?.name;
|
||||
set_Tags_search(null)
|
||||
set_Tags_search
|
||||
if(lastElement !== ""){
|
||||
formik.setFieldValue('tags', [...(formik?.values as any)?.tags as any[],
|
||||
|
||||
|
|
|
|||
|
|
@ -64,8 +64,6 @@ export const getInitialValuesBase = (objectToEdit: Question): any => {
|
|||
image: objectToEdit?.image ?? "",
|
||||
subject_id: objectToEdit?.subject_id ?? '',
|
||||
isBase: objectToEdit?.isBase,
|
||||
max_mark: questions.length ?? 1,
|
||||
min_mark_to_pass: 1,
|
||||
parent_id: objectToEdit?.parent_id ?? '',
|
||||
Questions: questions,
|
||||
};
|
||||
|
|
@ -76,14 +74,10 @@ export const getValidationSchemaBase = () => {
|
|||
return Yup.object().shape({
|
||||
image: Yup.string().nullable(),
|
||||
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"),
|
||||
Questions: Yup.array().of(
|
||||
Yup.object().shape({
|
||||
image: Yup.string().nullable(),
|
||||
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(
|
||||
Yup.object().shape({
|
||||
answer: Yup.string().required("validation.required"),
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@
|
|||
display: flex;
|
||||
gap: 20px;
|
||||
margin-bottom: 29px;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.suggested{
|
||||
all: unset;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user