Compare commits
4 Commits
edd50bafad
...
c858803cb0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c858803cb0 | ||
|
|
de71606e88 | ||
|
|
05d0a12527 | ||
|
|
32f87910ea |
|
|
@ -27,6 +27,7 @@ const ImageBoxField = ({ name }: any) => {
|
|||
|
||||
const handleFileChange = (event: any) => {
|
||||
const file = event.target.files[0];
|
||||
|
||||
if (file) {
|
||||
const maxSize = 2 * 1024 * 1024;
|
||||
|
||||
|
|
@ -42,6 +43,8 @@ const ImageBoxField = ({ name }: any) => {
|
|||
|
||||
if (file) {
|
||||
generateImagePreview(file, setImagePreview);
|
||||
console.log(file,"file");
|
||||
|
||||
formik.setFieldValue(name, file);
|
||||
}
|
||||
};
|
||||
|
|
@ -55,7 +58,7 @@ const ImageBoxField = ({ name }: any) => {
|
|||
|
||||
const handleCancel = () => {
|
||||
setImagePreview("");
|
||||
formik.setFieldValue(name, "");
|
||||
formik.setFieldValue(name, null);
|
||||
|
||||
if (fileInputRef.current) {
|
||||
fileInputRef.current.value = "";
|
||||
|
|
|
|||
|
|
@ -9,20 +9,27 @@ const SelectTag: React.FC = () => {
|
|||
const [searchValue, setSearchValue] = useState<string>("");
|
||||
|
||||
const [fieldValue, setFieldValue] = useState<string>("");
|
||||
const [NewAdditionalData, setNewAdditionalData] = useState({})
|
||||
const formik = useFormikContext<any>();
|
||||
const handleChange = (value: string[]) => {
|
||||
console.log(value);
|
||||
|
||||
const handleChange = (value: any,option:any) => {
|
||||
const newSelectedOption = option?.pop()
|
||||
const newObject = {
|
||||
id:newSelectedOption?.id,
|
||||
name:newSelectedOption?.name
|
||||
}
|
||||
setNewAdditionalData(newObject)
|
||||
formik.setFieldValue("tags", value);
|
||||
setSearchValue("");
|
||||
setFieldValue("");
|
||||
};
|
||||
|
||||
const handleSearch = useDebounce((value: string) => {
|
||||
|
||||
setSearchValue(value);
|
||||
});
|
||||
|
||||
const handleFieldChange = (value: string) => {
|
||||
|
||||
setFieldValue(value);
|
||||
};
|
||||
|
||||
|
|
@ -42,11 +49,23 @@ const SelectTag: React.FC = () => {
|
|||
options.length < 1 && searchValue.length > 1 && !isLoading
|
||||
? [{ id: searchValue, name: searchValue }]
|
||||
: [];
|
||||
console.log(formik?.values?.tags,"formik?.values?.tags");
|
||||
|
||||
const value =
|
||||
formik?.values?.tags?.map((item: any) => item?.id ?? item) ?? [];
|
||||
|
||||
const AllOptions = [...options, ...additionalData];
|
||||
const AllOptions = [...options, ...additionalData,NewAdditionalData,...(formik?.values?.tags ?? {})];
|
||||
console.log(AllOptions,"AllOptions");
|
||||
|
||||
const uniqueOptions = Array.from(
|
||||
new Map(
|
||||
AllOptions
|
||||
.filter(item => Object.keys(item).length > 0) // Filter out empty objects
|
||||
.map(item => [item.id, item]) // Create [id, item] pairs to ensure uniqueness
|
||||
).values()
|
||||
);
|
||||
|
||||
console.log(uniqueOptions,"uniqueOptions");
|
||||
|
||||
return (
|
||||
<div className="SelectTag">
|
||||
|
|
@ -58,7 +77,7 @@ const SelectTag: React.FC = () => {
|
|||
placeholder=""
|
||||
fieldNames={{ label: "name", value: "id" }}
|
||||
onChange={handleChange}
|
||||
options={AllOptions}
|
||||
options={uniqueOptions}
|
||||
filterOption={false}
|
||||
loading={isLoading}
|
||||
notFoundContent={isLoading ? <Spin /> : t("practical.not_found")}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,34 @@ const Header = () => {
|
|||
const { values, setFieldValue, setValues } = useFormikContext<any>();
|
||||
const { isBseQuestion, setIsBseQuestion } = useObjectToEdit();
|
||||
const { setSavedQuestionData } = useObjectToEdit();
|
||||
console.log(values,"values");
|
||||
|
||||
|
||||
const isEdited = ()=>{
|
||||
|
||||
if(isBseQuestion || values?.isBase === 1){
|
||||
|
||||
const content = !values?.content ;
|
||||
const content_image = !values?.content_image ;
|
||||
const hint = !values?.hint ;
|
||||
const Questions = values?.Questions?.length <= 1 && values?.Questions?.[0]?.answers?.length === 0 ;
|
||||
|
||||
if(content && content_image && hint && Questions) {
|
||||
return false
|
||||
}
|
||||
}else{
|
||||
const content = !values?.content ;
|
||||
const content_image = !values?.content_image ;
|
||||
const hint = !values?.hint ;
|
||||
const answers = !values?.answers ;
|
||||
const tags = !(values?.tags?.length > 0) ;
|
||||
if(content && content_image && hint && answers && tags) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
console.log(isEdited(),"isEdited");
|
||||
|
||||
const handleChange = () => {
|
||||
setSavedQuestionData(null);
|
||||
|
|
@ -62,6 +90,8 @@ const Header = () => {
|
|||
</div>
|
||||
</article>
|
||||
<div>
|
||||
{
|
||||
isEdited() ?
|
||||
<Popconfirm
|
||||
title={t("header.this_will_un_do_all_your_changes")}
|
||||
okText={t("practical.yes")}
|
||||
|
|
@ -77,6 +107,23 @@ const Header = () => {
|
|||
: t("header.exercise")}
|
||||
|
||||
</Popconfirm>
|
||||
|
||||
|
||||
:
|
||||
|
||||
<>
|
||||
|
||||
|
||||
<GoArrowSwitch onClick={()=>confirm()} className="m-2" />
|
||||
{isBseQuestion || values?.isBase === 1
|
||||
? t("header.malty_exercise")
|
||||
: t("header.exercise")}
|
||||
</>
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ const FormikFormModel: React.FC<FormikFormProps> = ({
|
|||
>
|
||||
{(formik) => {
|
||||
useEffect(() => {
|
||||
if (isOpen === "") {
|
||||
if (isOpen === "" || isOpen === "isSuccess") {
|
||||
formik.setErrors({});
|
||||
formik.resetForm();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ const DataTable: React.FC<DataTableProps> = ({
|
|||
...props
|
||||
}) => {
|
||||
const data: any[] = response?.data?.data || [];
|
||||
const dataSource = useAddKeyToData(data);
|
||||
const columns = useColumns();
|
||||
const { pagination, handlePageChange } = usePagination(response?.data);
|
||||
const [t] = useTranslation();
|
||||
|
|
@ -28,7 +27,8 @@ const DataTable: React.FC<DataTableProps> = ({
|
|||
<Table
|
||||
style={{ minHeight: "300px" }}
|
||||
columns={columns}
|
||||
dataSource={dataSource}
|
||||
dataSource={data}
|
||||
rowKey={"id"}
|
||||
rowClassName={(record, index) => getRowClassName(record, index)}
|
||||
className="DataTable"
|
||||
loading={{
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
import { TableColumnsType } from "antd";
|
||||
import { FaPlus } from "react-icons/fa";
|
||||
import useModalHandler from "../../../utils/useModalHandler";
|
||||
import { ModalEnum } from "../../../enums/Model";
|
||||
import { useObjectToEdit } from "../../../zustand/ObjectToEditState";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { ABILITIES_ENUM } from "../../../enums/abilities";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import {
|
||||
canAddGrade,
|
||||
canDeleteGrade,
|
||||
canEditGrade,
|
||||
canShowGrade,
|
||||
|
|
@ -15,7 +12,6 @@ import {
|
|||
import ActionButtons from "../../../Components/Table/ActionButtons";
|
||||
import ColumnsImage from "../../../Components/Columns/ColumnsImage";
|
||||
import { Grade } from "../../../types/Grade";
|
||||
import { useFilterState } from "../../../Components/Utils/Filter/FilterState";
|
||||
import { useFilterStateState } from "../../../zustand/Filter";
|
||||
|
||||
export const useColumns = () => {
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ const AddPage: React.FC = () => {
|
|||
return false ;
|
||||
}
|
||||
if(haveImageOrContent){
|
||||
toast.error("validation.one_of_image_and_content_should_be_enter")
|
||||
toast.error(t("validation.one_of_image_and_content_should_be_enter"))
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +127,8 @@ const AddPage: React.FC = () => {
|
|||
const haveAnswers = answers?.length > 0;
|
||||
const haveMoreThanOneAnswer = haveAnswers && answers?.length > 1;
|
||||
const haveOneAnswerRight = haveMoreThanOneAnswer && answers?.some((item: any) => item?.isCorrect === 1 || item.isCorrect === true);
|
||||
const haveImageOrContent = haveOneAnswerRight && values?.answers?.some((item:any)=> !(item?.content) && !(item.content_image) )
|
||||
const haveImageOrContent = haveOneAnswerRight && answers?.some((item:any)=> !(item?.content) && !(item.content_image) )
|
||||
console.log(haveImageOrContent,"haveImageOrContent");
|
||||
|
||||
if (!haveAnswers) {
|
||||
toast.error(t("validation.it_should_have_more_than_one_answers"));
|
||||
|
|
@ -145,7 +146,7 @@ const AddPage: React.FC = () => {
|
|||
}
|
||||
|
||||
if(haveImageOrContent){
|
||||
toast.error("validation.one_of_image_and_content_should_be_enter")
|
||||
toast.error(t("validation.one_of_image_and_content_should_be_enter"))
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,8 @@ const EditPage: React.FC = () => {
|
|||
if (item?.id) {
|
||||
const itemToSend = structuredClone(item);
|
||||
const keysToRemove = ["content_image"];
|
||||
console.log(itemToSend,"itemToSend");
|
||||
|
||||
const updatedObject = removeStringKeys(itemToSend, keysToRemove);
|
||||
console.log(updatedObject, "updatedObject");
|
||||
|
||||
|
|
@ -96,16 +98,6 @@ const EditPage: React.FC = () => {
|
|||
const oldAnswers = [] as any;
|
||||
const newAnswers = [] as any;
|
||||
|
||||
if (updatedObject?.answers?.length > 0) {
|
||||
const isValidAnswers = updatedObject?.answers?.some(
|
||||
(answer: any) => answer?.isCorrect === 1,
|
||||
);
|
||||
|
||||
// if(!isValidAnswers){
|
||||
// toast.error(t("validation.at_least_one_answer_should_be_correct"));
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
updatedObject?.answers?.forEach((item: any) => {
|
||||
if (item?.id) {
|
||||
oldAnswers.push({ ...item, isCorrect: item?.isCorrect ? 1 : 0 });
|
||||
|
|
@ -118,7 +110,6 @@ const EditPage: React.FC = () => {
|
|||
new: newAnswers,
|
||||
};
|
||||
console.log(answers);
|
||||
|
||||
mutate({
|
||||
...updatedObject,
|
||||
answers,
|
||||
|
|
@ -127,7 +118,10 @@ const EditPage: React.FC = () => {
|
|||
} else {
|
||||
console.log(values?.id);
|
||||
|
||||
const tags = processTags(DataToSend);
|
||||
const tags = processTags(item);
|
||||
console.log(item,"DataToSend");
|
||||
|
||||
console.log(tags,"tags");
|
||||
mutateAdd({
|
||||
...item,
|
||||
subject_id: subject_id,
|
||||
|
|
@ -149,19 +143,17 @@ const EditPage: React.FC = () => {
|
|||
|
||||
const oldAnswers = [] as any;
|
||||
const newAnswers = [] as any;
|
||||
if (updatedObject?.answers?.length > 0) {
|
||||
// const isValidAnswers = updatedObject?.answers?.some((answer:any) => answer?.isCorrect === 1 || answer?.isCorrect === true)
|
||||
// const isValidAnswers2 = updatedObject?.answers?.filter((answer: any) => answer?.isCorrect === 1 || answer?.isCorrect === true ).length > 1;
|
||||
// console.log(isValidAnswers2);
|
||||
// console.log(isValidAnswers,"isValidAnswers");
|
||||
// if(!isValidAnswers || isValidAnswers2){
|
||||
// toast.error(t("validation.at_least_one_answer_should_be_correct"));
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
updatedObject?.answers?.forEach((item: any) => {
|
||||
if (item?.id) {
|
||||
console.log(item,"item");
|
||||
const deletedImage = item?.content_image === null
|
||||
if(deletedImage){
|
||||
oldAnswers.push({ ...item, isCorrect: item?.isCorrect ? 1 : 0, content_image:"" });
|
||||
|
||||
}else{
|
||||
oldAnswers.push({ ...item, isCorrect: item?.isCorrect ? 1 : 0 });
|
||||
|
||||
}
|
||||
} else {
|
||||
newAnswers.push({ ...item, isCorrect: item?.isCorrect ? 1 : 0 });
|
||||
}
|
||||
|
|
@ -181,7 +173,6 @@ const EditPage: React.FC = () => {
|
|||
};
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
const navigate = useNavigate();
|
||||
const handleCancel = () => {
|
||||
navigate(-1);
|
||||
|
|
@ -191,6 +182,7 @@ const EditPage: React.FC = () => {
|
|||
const handleValidateSingleQuestion = (values:any)=>{
|
||||
const haveMoreThanOneAnswer = values?.answers?.length > 1;
|
||||
const haveOneAnswerRight = haveMoreThanOneAnswer && values?.answers?.some((item:any)=> item?.isCorrect === 1 || item.isCorrect === true )
|
||||
const haveImageOrContent = haveOneAnswerRight && values?.answers?.some((item:any)=> !(item?.content) && !(item.content_image) )
|
||||
|
||||
if(!haveMoreThanOneAnswer){
|
||||
toast.error(t("validation.it_should_have_more_than_one_answers")) ;
|
||||
|
|
@ -200,6 +192,10 @@ const EditPage: React.FC = () => {
|
|||
toast.error(t("validation.it_should_have_more_than_one_correct_answers")) ;
|
||||
return false ;
|
||||
}
|
||||
if(haveImageOrContent){
|
||||
toast.error(t("validation.one_of_image_and_content_should_be_enter"))
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -210,6 +206,7 @@ const handleValidateBaseQuestion = (values: any) => {
|
|||
const haveMoreThanOneAnswer = haveAnswers && answers?.length > 1;
|
||||
const haveOneAnswerRight =
|
||||
haveMoreThanOneAnswer && answers?.some((item: any) => item?.isCorrect === 1 || item.isCorrect === true);
|
||||
const haveImageOrContent = haveOneAnswerRight && answers?.some((item:any)=> !(item?.content) && !(item.content_image) )
|
||||
|
||||
if (!haveAnswers) {
|
||||
toast.error(t("validation.it_should_have_more_than_one_answers"));
|
||||
|
|
@ -226,6 +223,12 @@ const handleValidateBaseQuestion = (values: any) => {
|
|||
return false;
|
||||
}
|
||||
|
||||
if(haveImageOrContent){
|
||||
toast.error(t("validation.one_of_image_and_content_should_be_enter"))
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,16 @@ const ChoiceFields = ({ index, data }: { index: number; data: Choice }) => {
|
|||
formik.setFieldValue("answers", updatedAnswers);
|
||||
};
|
||||
|
||||
const values = formik?.values?.answers?.[index] ;
|
||||
const handelCanDeleteAnswers = ()=>{
|
||||
const content = values?.content ;
|
||||
const content_image = values?.content_image ;
|
||||
if(!content && !content_image ){
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="ChoiceFields">
|
||||
|
|
@ -52,7 +62,17 @@ const ChoiceFields = ({ index, data }: { index: number; data: Choice }) => {
|
|||
name={index}
|
||||
type="Checkbox"
|
||||
/>
|
||||
{handelCanDeleteAnswers() ?
|
||||
<p className="delete_question_options" onClick={()=>{handleDeleteChoice()}}>
|
||||
{t("header.delete_choice")}
|
||||
<GoTrash
|
||||
className="trash_icon"
|
||||
|
||||
size={17}
|
||||
/>
|
||||
</p>
|
||||
|
||||
:
|
||||
<Popconfirm
|
||||
title={t("header.this_will_un_do_all_your_changes")}
|
||||
okText={t("practical.yes")}
|
||||
|
|
@ -72,6 +92,8 @@ const ChoiceFields = ({ index, data }: { index: number; data: Choice }) => {
|
|||
|
||||
|
||||
</Popconfirm>
|
||||
}
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,19 @@ const ChoiceFields = ({
|
|||
formik.setFieldValue(`Questions[${parent_index}].answers`, updatedAnswers);
|
||||
};
|
||||
|
||||
const values = formik.values.Questions?.[parent_index]?.answers?.[index] ;
|
||||
console.log(values,"values");
|
||||
|
||||
const handelCanDeleteAnswers = ()=>{
|
||||
const content = values?.content ;
|
||||
const content_image = values?.content_image ;
|
||||
if(!content && !content_image ){
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="ChoiceFields">
|
||||
|
|
@ -71,7 +84,19 @@ const ChoiceFields = ({
|
|||
parent_index={parent_index}
|
||||
/>
|
||||
|
||||
<Popconfirm
|
||||
|
||||
{handelCanDeleteAnswers() ?
|
||||
<p className="delete_question_options" onClick={()=>{handleDeleteChoice()}} >
|
||||
{t("header.delete_choice")}
|
||||
<GoTrash
|
||||
className="trash_icon"
|
||||
|
||||
size={17}
|
||||
/>
|
||||
</p>
|
||||
:
|
||||
|
||||
<Popconfirm
|
||||
title={t("header.this_will_un_do_all_your_changes")}
|
||||
okText={t("practical.yes")}
|
||||
cancelText={t("practical.no")}
|
||||
|
|
@ -89,6 +114,10 @@ const ChoiceFields = ({
|
|||
</p>
|
||||
|
||||
</Popconfirm>
|
||||
|
||||
}
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -94,6 +94,11 @@ const Form = () => {
|
|||
}
|
||||
}, [Success]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<Row className="w-100 exercise_form_container">
|
||||
<div className="exercise_form">
|
||||
|
|
|
|||
|
|
@ -29,6 +29,22 @@ const QuestionFIeld = ({ index, data }: { index: number; data: Choice }) => {
|
|||
formik.setFieldValue(`Questions`, updatedAnswers);
|
||||
};
|
||||
|
||||
|
||||
|
||||
const values = formik.values.Questions?.[index] ;
|
||||
console.log(values,"values");
|
||||
|
||||
const handelCanDeleteAnswers = ()=>{
|
||||
const content = values?.content ;
|
||||
const content_image = values?.content_image ;
|
||||
if(!content && !content_image ){
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="exercise_forms">
|
||||
|
|
@ -48,7 +64,22 @@ const QuestionFIeld = ({ index, data }: { index: number; data: Choice }) => {
|
|||
|
||||
<ImageBoxField name={`Questions.${index}.content_image`} />
|
||||
|
||||
{handelCanDeleteAnswers() ?
|
||||
<div className="answer_status" >
|
||||
<p className="delete_question_options" onClick={()=>{handleDeleteQuestion()}}>
|
||||
{t("header.delete_question")}
|
||||
<GoTrash
|
||||
className="trash_icon"
|
||||
|
||||
size={17}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
:
|
||||
|
||||
<div className="answer_status" >
|
||||
|
||||
<Popconfirm
|
||||
title={t("header.this_will_un_do_all_your_changes")}
|
||||
okText={t("practical.yes")}
|
||||
|
|
@ -68,6 +99,9 @@ const QuestionFIeld = ({ index, data }: { index: number; data: Choice }) => {
|
|||
</Popconfirm>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,16 @@ const MaltySelectTag = ({ parent_index }: { parent_index: number }) => {
|
|||
const [fieldValue, setFieldValue] = useState<string>("");
|
||||
const formik = useFormikContext<any>();
|
||||
const values = formik?.values?.Questions?.[parent_index]?.tags;
|
||||
const handleChange = (value: string[]) => {
|
||||
const [NewAdditionalData, setNewAdditionalData] = useState({})
|
||||
|
||||
const handleChange = (value: string[],option:any) => {
|
||||
const newSelectedOption = option?.pop()
|
||||
const newObject = {
|
||||
id:newSelectedOption?.id,
|
||||
name:newSelectedOption?.name
|
||||
}
|
||||
setNewAdditionalData(newObject)
|
||||
|
||||
formik.setFieldValue(`Questions.[${parent_index}].tags`, value);
|
||||
setSearchValue("");
|
||||
setFieldValue("");
|
||||
|
|
@ -40,13 +49,22 @@ const MaltySelectTag = ({ parent_index }: { parent_index: number }) => {
|
|||
options.length < 1 && searchValue.length > 1 && !isLoading
|
||||
? [{ id: searchValue, name: searchValue }]
|
||||
: [];
|
||||
console.log(formik?.values?.Questions[parent_index]?.tags,"formik?.values?.Questions[parent_index]?.tags");
|
||||
|
||||
const value =
|
||||
formik?.values?.Questions[parent_index]?.tags?.map(
|
||||
(item: any) => item?.id ?? item,
|
||||
) ?? [];
|
||||
|
||||
const AllOptions = [...options, ...additionalData];
|
||||
const AllOptions = [...options, ...additionalData,NewAdditionalData , ...(formik?.values?.Questions[parent_index]?.tags ?? [])];
|
||||
|
||||
const uniqueOptions = Array.from(
|
||||
new Map(
|
||||
AllOptions
|
||||
.filter(item => Object.keys(item).length > 0) // Filter out empty objects
|
||||
.map(item => [item.id, item]) // Create [id, item] pairs to ensure uniqueness
|
||||
).values()
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="SelectTag">
|
||||
|
|
@ -58,7 +76,7 @@ const MaltySelectTag = ({ parent_index }: { parent_index: number }) => {
|
|||
placeholder=""
|
||||
fieldNames={{ label: "name", value: "id" }}
|
||||
onChange={handleChange}
|
||||
options={AllOptions}
|
||||
options={uniqueOptions}
|
||||
filterOption={false}
|
||||
loading={isLoading}
|
||||
notFoundContent={isLoading ? <Spin /> : t("practical.not_found")}
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ export const getValidationSchemaBase = () => {
|
|||
|
||||
export function processTags(DataToSend: any) {
|
||||
console.log(DataToSend?.tags);
|
||||
console.log(DataToSend);
|
||||
|
||||
const oldTags = DataToSend?.tags
|
||||
?.map((item: any, index: number) => {
|
||||
|
|
|
|||
|
|
@ -7,14 +7,16 @@ import { handelImageState } from "../../../../utils/DataToSendImageState";
|
|||
import LayoutModel from "../../../../Layout/Dashboard/LayoutModel";
|
||||
import { QueryStatusEnum } from "../../../../enums/QueryStatus";
|
||||
import ModelForm from "./ModelForm";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { ParamsEnum } from "../../../../enums/params";
|
||||
|
||||
const ModalForm: React.FC = () => {
|
||||
const { objectToEdit } = useObjectToEdit((state) => state);
|
||||
|
||||
const { mutate, status } = useUpdateSubject();
|
||||
|
||||
const {subject_id} = useParams<ParamsEnum>()
|
||||
const handleSubmit = (values: any) => {
|
||||
const Data_to_send = { ...values };
|
||||
const Data_to_send = { ...values,subject_id };
|
||||
const handelImage = handelImageState(Data_to_send, "icon");
|
||||
mutate(handelImage);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import useFilter from "../../Components/FilterField/components/useFilter";
|
||||
import { Select } from "antd";
|
||||
|
||||
const Dummy = () => {
|
||||
const [t] = useTranslation();
|
||||
|
|
@ -8,12 +9,15 @@ const Dummy = () => {
|
|||
return (
|
||||
<div className="DummyHomePage">
|
||||
|
||||
<FilterButton/>
|
||||
{/* <FilterButton/>
|
||||
<FilterBody>
|
||||
karim
|
||||
</FilterBody>
|
||||
<Select
|
||||
style={{width:"200px"}}
|
||||
showSearch
|
||||
/> */}
|
||||
|
||||
karim2
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -96,15 +96,3 @@
|
|||
.model_sub_children{
|
||||
padding-bottom: 30px;
|
||||
}
|
||||
.ant-select-selection-search{
|
||||
// color: #6A7287 !important;
|
||||
// display: none !important;
|
||||
|
||||
}
|
||||
:where(.css-dev-only-do-not-override-oad6qy).ant-select-single.ant-select-lg .ant-select-selector .ant-select-selection-search{
|
||||
input{
|
||||
|
||||
}
|
||||
}
|
||||
:where(.css-dev-only-do-not-override-oad6qy).ant-select-single.ant-select-lg:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-search-input{
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
@import "./Layout.scss";
|
||||
@import "./SideBar.scss";
|
||||
@import "./DataTable.scss";
|
||||
|
||||
@import "./DataState.scss";
|
||||
@import "./PageHeader.scss";
|
||||
@import "./FilterLayout.scss";
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ function useAxios() {
|
|||
|
||||
build_Axios.interceptors.response.use(
|
||||
function (response: any) {
|
||||
console.log(response?.data);
|
||||
|
||||
const responseMsg = response?.data?.message;
|
||||
const method = response.config.method;
|
||||
|
||||
|
|
@ -53,7 +55,7 @@ function useAxios() {
|
|||
console.log(error?.response);
|
||||
|
||||
const status = error?.request?.status;
|
||||
const errorMsg = error?.response?.data?.message;
|
||||
const errorMsg = error?.response?.data?.error;
|
||||
const errorField = error?.response?.data;
|
||||
const method = error.config.method;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import { useQuery } from "react-query";
|
||||
import useAxios from "./useAxios";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { PaginationParams } from "../utils/PaginationParams";
|
||||
import { filterParams } from "../utils/filterParams";
|
||||
import { useFilterStateState } from "../../zustand/Filter";
|
||||
function useGetQuery(
|
||||
|
|
@ -13,11 +11,9 @@ function useGetQuery(
|
|||
const axios = useAxios();
|
||||
const { show, pagination, ...remainingParams } = params;
|
||||
|
||||
const location = useLocation();
|
||||
const { Filter ,setFilter } = useFilterStateState();
|
||||
const { Filter } = useFilterStateState();
|
||||
const page = Filter?.page ;
|
||||
const per_page = Filter?.per_page ;
|
||||
// const { per_page } = PaginationParams(location);
|
||||
|
||||
const paramToSend = pagination
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@
|
|||
"at_least_one_answer_should_be_correct": "يجب أن تكون إجابة واحدة صحيحة",
|
||||
"it_should_have_more_than_one_answers": "يجب أن يحتوي على أكثر من إجابة",
|
||||
"it_should_have_more_than_one_correct_answers": "يجب أن يحتوي على إجابة صحيحة",
|
||||
"File_size_exceeds_2_MB_limit.":"حجم الملف يتجاوز الحد الأقصى البالغ 2 ميجابايت"
|
||||
"File_size_exceeds_2_MB_limit.":"حجم الملف يتجاوز الحد الأقصى البالغ 2 ميجابايت",
|
||||
"one_of_image_and_content_should_be_enter":"يجب إدخال صورة أو محتوى واحد على الأقل"
|
||||
},
|
||||
"header": {
|
||||
"register_students": "تسجيل الطلاب",
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export function removeStringKeys(obj: any, keysToRemove: string[]): any {
|
|||
// Check if the value is a string or "null" and the key is in keysToRemove
|
||||
if (
|
||||
keysToRemove.includes(key) &&
|
||||
(typeof value === "string" || value === "null")
|
||||
(typeof value === "string")
|
||||
) {
|
||||
delete obj[key];
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user