diff --git a/src/Components/CustomFields/SelectTag.tsx b/src/Components/CustomFields/SelectTag.tsx index 4aafca7..5d3a902 100644 --- a/src/Components/CustomFields/SelectTag.tsx +++ b/src/Components/CustomFields/SelectTag.tsx @@ -7,6 +7,7 @@ import { useFormikContext } from "formik"; const SelectTag: React.FC = () => { const [searchValue, setSearchValue] = useState(""); + const [fieldValue, setFieldValue] = useState(""); const formik = useFormikContext(); const handleChange = (value: string[]) => { diff --git a/src/Components/ValidationField/View/Default.tsx b/src/Components/ValidationField/View/Default.tsx index 5a0db12..9ea3beb 100644 --- a/src/Components/ValidationField/View/Default.tsx +++ b/src/Components/ValidationField/View/Default.tsx @@ -17,7 +17,7 @@ const Default = ({ label_icon, ...props }: any) => { - const { errorMsg, isError, t } = useFormField(name, props); + const { errorMsg, isError, t,formik } = useFormField(name, props); return (
diff --git a/src/Layout/Dashboard/FilterLayout.tsx b/src/Layout/Dashboard/FilterLayout.tsx index d3b1106..4331642 100644 --- a/src/Layout/Dashboard/FilterLayout.tsx +++ b/src/Layout/Dashboard/FilterLayout.tsx @@ -46,7 +46,7 @@ const FilterLayout = ({
setIsOpen(true)}> - {t("ترتيب حسب")} + {t("header.filter")}
@@ -63,9 +63,9 @@ const FilterLayout = ({
-

{t("صف لكل صفحة")}

+

{t("header.per_page")}

-

{t("ادخالات")}

+

{t("header.entries")}

diff --git a/src/Layout/Dashboard/PageHeader.tsx b/src/Layout/Dashboard/PageHeader.tsx index 3d380ac..ce95f02 100644 --- a/src/Layout/Dashboard/PageHeader.tsx +++ b/src/Layout/Dashboard/PageHeader.tsx @@ -28,7 +28,6 @@ const PageHeader = ({ const { handel_open_model } = useModalHandler(); const { t } = useTranslation(); - const { PageTitle } = usePageTitleState((state) => state); const PrevPath = getPrevPathRoute(location.pathname); const handelNavigate = () => { if (PrevPath === 0) { @@ -39,11 +38,13 @@ const PageHeader = ({ const handleNavigateToPage = (location: string) => { navigate(location); }; + console.log(); + const {PageTitle} = usePageTitleState() return (
-

{t(`sidebar.${pageTitle}`)}

+

{t(`PageTitle.${pageTitle}`)}

{PageTitle} @@ -59,7 +60,7 @@ const PageHeader = ({ className="add_button" > - {t(`models.${pageTitle}`)} + {t(`practical.add`)}
)} diff --git a/src/Pages/Admin/Grade/Page.tsx b/src/Pages/Admin/Grade/Page.tsx index a65f26a..a168a31 100644 --- a/src/Pages/Admin/Grade/Page.tsx +++ b/src/Pages/Admin/Grade/Page.tsx @@ -32,7 +32,7 @@ const TableHeader = () => { /> } - filterTitle="sidebar.grade" + filterTitle="table.grade" /> diff --git a/src/Pages/Admin/Reseller/Add/Page.tsx b/src/Pages/Admin/Reseller/Add/Page.tsx index 8b58ae8..fb41ab6 100644 --- a/src/Pages/Admin/Reseller/Add/Page.tsx +++ b/src/Pages/Admin/Reseller/Add/Page.tsx @@ -5,21 +5,47 @@ import { Suspense } from "react"; import { Spin } from "antd"; import { ModalEnum } from "../../../../enums/Model"; import { canAddReSeller } from "../../../../utils/hasAbilityFn"; +import PersonalDetailsForm from "../Form/PersonalDetailsForm"; +import { Formik ,Form} from "formik"; +import { getInitialValues, getValidationSchema } from "../Form/formUtils"; +import TitleDetailsForm from "../Form/TitleDetailsForm"; +import AttachmentForm from "../Form/AttachmentForm"; const TableHeader = () => { const [t] = useTranslation(); - useSetPageTitle(t(`page_header.reseller`)); + useSetPageTitle(t(`page_header.add_reseller`)); + const handelSubmit = (values:any)=>{ + console.log(values,"values"); + + } return (
}> +
+ +
+ + + +
+ + +
+ +
+
); diff --git a/src/Pages/Admin/Reseller/Form/AttachmentForm.tsx b/src/Pages/Admin/Reseller/Form/AttachmentForm.tsx new file mode 100644 index 0000000..1d5fe60 --- /dev/null +++ b/src/Pages/Admin/Reseller/Form/AttachmentForm.tsx @@ -0,0 +1,24 @@ +import React from 'react' +import { useTranslation } from 'react-i18next' +import { FaImage } from 'react-icons/fa' +import ImageBoxField from './ImageBoxField/ImageBoxField'; + +const AttachmentForm = () => { + const [t] = useTranslation(); + + return ( +
+
+ +

{t("header.attachment")}

+
+
+ + + +
+
+ ) +} + +export default AttachmentForm \ No newline at end of file diff --git a/src/Pages/Admin/Reseller/Form/ImageBoxField/ImageBoxField.scss b/src/Pages/Admin/Reseller/Form/ImageBoxField/ImageBoxField.scss new file mode 100644 index 0000000..20a6418 --- /dev/null +++ b/src/Pages/Admin/Reseller/Form/ImageBoxField/ImageBoxField.scss @@ -0,0 +1,37 @@ +.ImageBoxField { + .ImageBox { + width: 120px; + height: 120px; + display: flex; + align-items: center; + justify-content: center; + border: max(1.5px, 0.1vw) dashed #a9c3f1; + margin-block: 10px; + border-radius: 5px; + .ImageBoxIcon { + cursor: pointer; + } + .imagePreview { + max-width: 99%; + height: auto; + max-height: 99%; + object-fit: contain; + border-radius: 5px; + } + } + .ImageHeader { + display: flex; + align-items: center; + justify-content: flex-end; + gap: 10px; + } + + .ImageCancelIcon { + width: 16px !important; + height: 16px !important; + } + .ImageBoxIcon { + width: 20px !important; + height: 20px !important; + } +} diff --git a/src/Pages/Admin/Reseller/Form/ImageBoxField/ImageBoxField.tsx b/src/Pages/Admin/Reseller/Form/ImageBoxField/ImageBoxField.tsx new file mode 100644 index 0000000..e647ca8 --- /dev/null +++ b/src/Pages/Admin/Reseller/Form/ImageBoxField/ImageBoxField.tsx @@ -0,0 +1,87 @@ +import { useFormikContext } from "formik"; +import { useState, useRef, useEffect } from "react"; +import "./ImageBoxField.scss"; +import ImageIcon from "./ImageIcon"; +import ImageCancelIcon from "./ImageCancelIcon"; +import { generateImagePreview } from "./generateImagePreview"; +import { getNestedValue } from "../../../../../utils/getNestedValue"; +import { useTranslation } from "react-i18next"; + +// Helper function to generate image preview from a File + +const ImageBoxField = ({ name }: any) => { + const formik = useFormikContext(); + const value = getNestedValue(formik.values, name); + const [imagePreview, setImagePreview] = useState(null); + const fileInputRef = useRef(null); + + useEffect(() => { + if (value instanceof File) { + generateImagePreview(value, setImagePreview); + } else if (typeof value === "string") { + setImagePreview(value); + } else { + setImagePreview(null); + } + }, [value]); + + const handleFileChange = (event: any) => { + const file = event.target.files[0]; + if (file) { + generateImagePreview(file, setImagePreview); + formik.setFieldValue(name, file); + } + }; + + const handleButtonClick = () => { + const fileInput = fileInputRef.current; + if (fileInput) { + fileInput.click(); + } + }; + + const handleCancel = () => { + setImagePreview(""); + formik.setFieldValue(name, ""); + + if (fileInputRef.current) { + fileInputRef.current.value = ""; + } + }; + const [t] = useTranslation() + return ( +
+
{t(`input.${name}`)}
+
+ {imagePreview ? ( + <> + + + + ) : ( +
hidden
+ )} +
+
+ {imagePreview ? ( + Preview + ) : ( + + )} +
+ +
+ ); +}; + +export default ImageBoxField; diff --git a/src/Pages/Admin/Reseller/Form/ImageBoxField/ImageCancelIcon.tsx b/src/Pages/Admin/Reseller/Form/ImageBoxField/ImageCancelIcon.tsx new file mode 100644 index 0000000..d42ba53 --- /dev/null +++ b/src/Pages/Admin/Reseller/Form/ImageBoxField/ImageCancelIcon.tsx @@ -0,0 +1,18 @@ +import React from "react"; + +interface ImageCancelIconProps extends React.HTMLAttributes {} + +const ImageCancelIcon: React.FC = (props) => { + return ( +
+ + + +
+ ); +}; + +export default ImageCancelIcon; diff --git a/src/Pages/Admin/Reseller/Form/ImageBoxField/ImageIcon.tsx b/src/Pages/Admin/Reseller/Form/ImageBoxField/ImageIcon.tsx new file mode 100644 index 0000000..4ca597a --- /dev/null +++ b/src/Pages/Admin/Reseller/Form/ImageBoxField/ImageIcon.tsx @@ -0,0 +1,18 @@ +import React from "react"; + +interface ImageIconProps extends React.HTMLAttributes {} + +const ImageIcon: React.FC = (props) => { + return ( +
+ + + +
+ ); +}; + +export default ImageIcon; diff --git a/src/Pages/Admin/Reseller/Form/ImageBoxField/generateImagePreview.ts b/src/Pages/Admin/Reseller/Form/ImageBoxField/generateImagePreview.ts new file mode 100644 index 0000000..3f754d3 --- /dev/null +++ b/src/Pages/Admin/Reseller/Form/ImageBoxField/generateImagePreview.ts @@ -0,0 +1,10 @@ +export const generateImagePreview = ( + file: File, + setImagePreview: (result: string) => void, +) => { + const reader = new FileReader(); + reader.onloadend = () => { + setImagePreview(reader.result as string); + }; + reader.readAsDataURL(file); +}; diff --git a/src/Pages/Admin/Reseller/Form/ModelForm.tsx b/src/Pages/Admin/Reseller/Form/ModelForm.tsx deleted file mode 100644 index 5a72fe4..0000000 --- a/src/Pages/Admin/Reseller/Form/ModelForm.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { Col, Row } from "reactstrap"; -import ValidationField from "../../../../Components/ValidationField/ValidationField"; - -const Form = () => { - return ( - -
- - - - ); -}; - -export default Form; diff --git a/src/Pages/Admin/Reseller/Form/PersonalDetailsForm.tsx b/src/Pages/Admin/Reseller/Form/PersonalDetailsForm.tsx new file mode 100644 index 0000000..e53ec3c --- /dev/null +++ b/src/Pages/Admin/Reseller/Form/PersonalDetailsForm.tsx @@ -0,0 +1,33 @@ +import React from 'react' +import { useTranslation } from 'react-i18next' +import { FaStore } from 'react-icons/fa' +import ValidationField from '../../../../Components/ValidationField/ValidationField'; + +const PersonalDetailsForm = () => { + const [t] = useTranslation(); + + return ( +
+
+ +

{t("header.personal_information")}

+
+
+ + + + + + + + + + + + +
+
+ ) +} + +export default PersonalDetailsForm \ No newline at end of file diff --git a/src/Pages/Admin/Reseller/Form/TitleDetailsForm.tsx b/src/Pages/Admin/Reseller/Form/TitleDetailsForm.tsx new file mode 100644 index 0000000..af2e265 --- /dev/null +++ b/src/Pages/Admin/Reseller/Form/TitleDetailsForm.tsx @@ -0,0 +1,24 @@ +import React from 'react' +import { useTranslation } from 'react-i18next' +import { FaRegAddressBook } from 'react-icons/fa' +import ValidationField from '../../../../Components/ValidationField/ValidationField'; + +const TitleDetailsForm = () => { + const [t] = useTranslation(); + + return ( +
+
+ +

{t("header.address")}

+
+
+ + + +
+
+ ) +} + +export default TitleDetailsForm \ No newline at end of file diff --git a/src/Pages/Admin/Reseller/Form/formUtil.ts b/src/Pages/Admin/Reseller/Form/formUtils.ts similarity index 52% rename from src/Pages/Admin/Reseller/Form/formUtil.ts rename to src/Pages/Admin/Reseller/Form/formUtils.ts index 9ae0147..8dc46f6 100644 --- a/src/Pages/Admin/Reseller/Form/formUtil.ts +++ b/src/Pages/Admin/Reseller/Form/formUtils.ts @@ -1,13 +1,17 @@ import * as Yup from "yup"; -export const getInitialValues = (objectToEdit: any): any => { + +export const getInitialValues = ( + objectToEdit: Partial, +) => { return { - id: objectToEdit?.id ?? null, + id: objectToEdit?.id ?? null , name: objectToEdit?.name ?? null, }; }; export const getValidationSchema = () => { + // validate input return Yup.object().shape({ - name: Yup.string().required("validation.required"), + }); }; diff --git a/src/Pages/Admin/Reseller/Page.tsx b/src/Pages/Admin/Reseller/Page.tsx index f041cc8..e2aaea5 100644 --- a/src/Pages/Admin/Reseller/Page.tsx +++ b/src/Pages/Admin/Reseller/Page.tsx @@ -23,7 +23,6 @@ const SearchField = lazy( ); const TableHeader = () => { - const { handel_open_model } = useModalHandler(); const [t] = useTranslation(); useSetPageTitle(t(`page_header.reseller`)); const deleteMutation = useDeleteTag(); diff --git a/src/Pages/Admin/Unit/Page.tsx b/src/Pages/Admin/Unit/Page.tsx index 7e65f94..dabb5a6 100644 --- a/src/Pages/Admin/Unit/Page.tsx +++ b/src/Pages/Admin/Unit/Page.tsx @@ -24,7 +24,7 @@ const TableHeader = () => { const [t] = useTranslation(); const deleteMutation = useDeleteUnit(); - const { subject_id, grade_id, curriculum_id } = useParams(); + const { subject_id, grade_id } = useParams(); const { data: Subject } = useGetAllSubject({ show: subject_id, @@ -39,28 +39,24 @@ const TableHeader = () => { const SubjectName = Subject?.data?.name ?? ""; useSetPageTitle( t(`page_header.grade`) + - "/" + - gradeName + - "/" + - t(`PageTitle.subject`) + - "/" + - SubjectName + - "/" + - t("PageTitle.unit"), + " / " + + ` ${t("header.subject_of_class")} (${gradeName})` + + " / " + + SubjectName ); return (
}> } - filterTitle="sidebar.unit" - /> + filterTitle={` ${gradeName} (${SubjectName}) `} + />
diff --git a/src/Pages/Admin/lesson/Page.tsx b/src/Pages/Admin/lesson/Page.tsx index e84835e..3726f5e 100644 --- a/src/Pages/Admin/lesson/Page.tsx +++ b/src/Pages/Admin/lesson/Page.tsx @@ -44,31 +44,26 @@ const TableHeader = () => { useSetPageTitle( t(`page_header.grade`) + - "/" + - gradeName + - "/" + - t(`PageTitle.subject`) + - "/" + + " / " + + ` ${t("header.subject_of_class")} (${gradeName})` + + " / " + SubjectName + - "/" + - t("PageTitle.unit") + - "/" + - unitName + - "/" + - t("PageTitle.lesson"), + " / " + + unitName ); + return (
}> } - filterTitle="sidebar.lesson" + filterTitle={` ${SubjectName} (${unitName}) `} />
diff --git a/src/Pages/Admin/question/AddPage.tsx b/src/Pages/Admin/question/AddPage.tsx index 3b439e9..87f983c 100644 --- a/src/Pages/Admin/question/AddPage.tsx +++ b/src/Pages/Admin/question/AddPage.tsx @@ -1,4 +1,4 @@ -import React, { Suspense, lazy } from "react"; +import React, { Suspense, lazy, useEffect } from "react"; import { Spin } from "antd"; import FormikForm from "../../../Layout/Dashboard/FormikFormModel"; import { @@ -18,16 +18,19 @@ import Header from "../../../Components/exercise/Header"; import { Question } from "../../../types/Item"; import BaseForm from "./Model/Malty/Form"; import ModelForm from "./Model/ModelForm"; +import { toast } from "react-toastify"; +import { useFormikContext } from "formik"; const AcceptModal = lazy(() => import("./Model/AcceptModal")); const AddPage: React.FC = () => { const { mutateAsync } = useAddQuestionAsync(); - const { mutate, isLoading } = useAddQuestion(); + const { mutate, isLoading ,isSuccess} = useAddQuestion(); const { isBseQuestion, setTagsSearch, objectToEdit, + setSuccess } = useObjectToEdit(); @@ -35,8 +38,9 @@ const AddPage: React.FC = () => { const { subject_id, lesson_id } = useParams(); +console.log(objectToEdit,"objectToEdit"); - + const handleSubmit = ( values: any, { resetForm }: { resetForm: () => void }, @@ -70,7 +74,14 @@ const AddPage: React.FC = () => { }; }); console.log(answers); - + if(answers?.length > 0){ + const isValidAnswers = answers?.some((answer:any) => answer?.isCorrect === 1) + + if(!isValidAnswers){ + toast.error(t("validation.at_least_one_answer_should_be_correct")); + return; + } + } mutate({ ...item, parent_id: newBseQuestionId, @@ -84,13 +95,25 @@ const AddPage: React.FC = () => { }); } else { const tags = processTags(DataToSend); - const answers = values?.answers?.map((item: any, index: number) => { + console.log(item,"item"); + return { order: index, ...item, }; }); + + if(answers?.length > 0){ + + const isValidAnswers = answers?.some((answer:any) => answer?.isCorrect === 1) + + if(!isValidAnswers){ + toast.error(t("validation.at_least_one_answer_should_be_correct")); + return; + } + } + const NewQuestion = { ...values, subject_id: subject_id, @@ -115,6 +138,13 @@ const AddPage: React.FC = () => { + useEffect(() => { + console.log("all api success"); + if(isSuccess){ + + setSuccess(true ) + } +}, [isSuccess]) if (isBseQuestion) { return ( diff --git a/src/Pages/Admin/question/EditPage.tsx b/src/Pages/Admin/question/EditPage.tsx index cb7bd1b..fc4a811 100644 --- a/src/Pages/Admin/question/EditPage.tsx +++ b/src/Pages/Admin/question/EditPage.tsx @@ -100,7 +100,16 @@ const EditPage: React.FC = () => { const tags = processTags(updatedObject); 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}); @@ -139,13 +148,21 @@ const EditPage: React.FC = () => { const updatedObject = removeStringKeys(DataToSend, keysToRemove); delete updatedObject["parent_id"]; const tags = processTags(updatedObject); - if (!updatedObject?.content_image) { + if (!values?.content_image) { updatedObject["content_image"] = ""; } 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}); @@ -168,12 +185,12 @@ const EditPage: React.FC = () => { navigate(-1); }; - useEffect(() => { - if (isSuccess) { - toast.success(t("validation.the_possess_done_successful")); - navigate(-1); - } - }, [isSuccess]); + // useEffect(() => { + // if (isSuccess) { + // toast.success(t("validation.the_possess_done_successful")); + // navigate(-1); + // } + // }, [isSuccess]); if (dataLoading || QuestionsDataLoading) { return ; diff --git a/src/Pages/Admin/question/Model/Malty/Form.tsx b/src/Pages/Admin/question/Model/Malty/Form.tsx index 89f3db1..e42b0a0 100644 --- a/src/Pages/Admin/question/Model/Malty/Form.tsx +++ b/src/Pages/Admin/question/Model/Malty/Form.tsx @@ -18,13 +18,6 @@ const Form = () => { const formik = useFormikContext(); const { setSuccess, Success, setSavedQuestionData } = useObjectToEdit(); - useEffect(() => { - if (Success) { - formik.setErrors({}); - formik.resetForm({ values: {} }); - setSuccess(false); - } - }, [Success]); useEffect(() => { setSavedQuestionData(formik.values); diff --git a/src/Pages/Admin/question/Model/ModelForm.tsx b/src/Pages/Admin/question/Model/ModelForm.tsx index 5799f9a..a147784 100644 --- a/src/Pages/Admin/question/Model/ModelForm.tsx +++ b/src/Pages/Admin/question/Model/ModelForm.tsx @@ -16,21 +16,10 @@ import { toast } from "react-toastify"; const Form = () => { const [t] = useTranslation(); const formik = useFormikContext(); - const { setSuccess, Success, setSavedQuestionData } = useObjectToEdit(); + const { setSuccess, Success } = useObjectToEdit(); - useEffect(() => { - if (Success) { - formik.setErrors({}); - formik.resetForm({ values: {} }); - setSuccess(false); - } - }, [Success]); - useEffect(() => { - console.log(formik.values, "formik.values"); - setSavedQuestionData(formik.values); - }, [formik?.values]); const handleAddChoice = (fromKeyCombination:boolean = false ) => { @@ -54,8 +43,20 @@ const Form = () => { handleAddChoice(true) }); +console.log(Success); + useEffect(() => { + console.log(Success); + + if(Success){ + formik?.setValues({}) + formik.setErrors({}) + setSuccess(false) + console.log(formik.errors); + + } +}, [Success]) return ( diff --git a/src/Pages/Admin/question/Model/formUtil.ts b/src/Pages/Admin/question/Model/formUtil.ts index e2ce669..9352a46 100644 --- a/src/Pages/Admin/question/Model/formUtil.ts +++ b/src/Pages/Admin/question/Model/formUtil.ts @@ -1,7 +1,6 @@ import * as Yup from "yup"; import { Question } from "../../../../types/Item"; -import { getLocalStorage } from "../../../../utils/LocalStorage"; -import { QUESTION_OBJECT_KEY } from "../../../../config/AppKey"; + export const getInitialValues = (objectToEdit: Question): any => { const tags = objectToEdit?.tags?.map((item: any, index: number) => { @@ -35,7 +34,7 @@ export const getValidationSchema = () => { isCorrect: Yup.boolean(), }), ) - .nullable("Params are required"), + }); }; diff --git a/src/Pages/Admin/question/Page.tsx b/src/Pages/Admin/question/Page.tsx index 79245e3..905fd74 100644 --- a/src/Pages/Admin/question/Page.tsx +++ b/src/Pages/Admin/question/Page.tsx @@ -46,29 +46,21 @@ const TableHeader = () => { useSetPageTitle( t(`page_header.grade`) + - "/" + - gradeName + - "/" + - t(`PageTitle.subject`) + - "/" + + " / " + + ` ${t("header.subject_of_class")} (${gradeName})` + + " / " + SubjectName + - "/" + - t("PageTitle.unit") + - "/" + - unitName + - "/" + - t("PageTitle.lesson") + - "/" + - LessonName + - "/" + - t("PageTitle.question"), + " / " + + unitName + + " / " + + LessonName ); return (
}> { /> } - filterTitle="sidebar.question" - /> + filterTitle={` ${unitName} (${LessonName}) `} />
{ render: (text, record) => record?.isBase ? t("practical.yes") : t("practical.no"), }, - { - title: t("columns.canAnswersBeShuffled"), - dataIndex: "canAnswersBeShuffled", - key: "canAnswersBeShuffled", - align: "center", - render: (text, record) => - record?.canAnswersBeShuffled ? t("practical.yes") : t("practical.no"), - }, { title: "#", diff --git a/src/Pages/Admin/subject/Table/Page.tsx b/src/Pages/Admin/subject/Table/Page.tsx index 9f48809..db996dc 100644 --- a/src/Pages/Admin/subject/Table/Page.tsx +++ b/src/Pages/Admin/subject/Table/Page.tsx @@ -34,22 +34,20 @@ const TableWithHeader = () => { const gradeName = grade?.data?.name ?? ""; useSetPageTitle( t(`page_header.grade`) + - "/" + - `${gradeName}` + - "/" + - t(`PageTitle.subject`), + " / " + + ` ${t("header.subject_of_class")} (${gradeName})` ); return (
} - filterTitle="sidebar.subjects" + filterTitle={`${t("header.subject_of_class")} (${gradeName})`} />
diff --git a/src/Styles/App/classNames.scss b/src/Styles/App/classNames.scss index 25f2f37..dd44031 100644 --- a/src/Styles/App/classNames.scss +++ b/src/Styles/App/classNames.scss @@ -297,3 +297,26 @@ button:disabled { .VisibleHidden { visibility: hidden; } + + + +.bg2{ + background: var(--bg2); +} +.header_form{ + display: flex; + align-items: center; + gap: 20px; + padding: 20px; + h4{ + font-size: 20px; + + } + svg{ + background: var(--bg); + padding: 10px; + width: 40px; + height: 40px; + } +} + diff --git a/src/Styles/Layout/SideBar.scss b/src/Styles/Layout/SideBar.scss index 19f7a49..bb42bf5 100644 --- a/src/Styles/Layout/SideBar.scss +++ b/src/Styles/Layout/SideBar.scss @@ -79,7 +79,7 @@ align-items: center; cursor: pointer; gap: 5%; - padding: 0.7vw 1vw; + padding: 12px; border-radius: 5px; a { font-size: 0.9vw; @@ -98,7 +98,9 @@ } .side_bar_setting { - gap: 0.5vw; + display: flex; + flex-direction: column; + gap: 10px; padding-inline: 7%; p { @@ -111,8 +113,8 @@ align-items: center; justify-content: start; background: inherit; - font-size: 0.8vw; - height: 2.5vw; + font-size: 20px; + // height: 2.5vw; width: 80%; font-weight: bold; margin-inline: auto; @@ -121,6 +123,7 @@ border: none; color: var(--borderColor); font-size: 16px; + span { cursor: pointer; } diff --git a/src/Styles/Pages/index.scss b/src/Styles/Pages/index.scss index dc3680a..7c8444d 100644 --- a/src/Styles/Pages/index.scss +++ b/src/Styles/Pages/index.scss @@ -9,3 +9,4 @@ @import "./subject.scss"; @import "./Marks.scss"; @import "./exercise.scss"; +@import './reSeller.scss'; \ No newline at end of file diff --git a/src/Styles/Pages/reSeller.scss b/src/Styles/Pages/reSeller.scss new file mode 100644 index 0000000..4bfdaa8 --- /dev/null +++ b/src/Styles/Pages/reSeller.scss @@ -0,0 +1,50 @@ + .main_form_body{ + display: flex; + flex-wrap: wrap; + background: var(--bg); + padding: 40px 10px; + >*{ + // max-width: 30%; + flex-basis: 33%; + + + } + } + + + .AttachmentForm{ + .main_form_body{ + padding: 30px 50px; + gap: 40px; + >*{ + // max-width: 30%; + flex-basis: 10%; + + + } + } + } + + .resellerButton{ + display: flex; + align-items: center; + justify-content: flex-end; + gap: 20px; + padding: 20px; + button{ + all: unset; + cursor: pointer; + padding: 8px 26px; + font-size: 15px; + border-radius: 5px; + background: var(--primary); + color: var(--white); + &:first-child{ + background: #F2F4F8; + color: #515B73; + box-shadow: 0px 0px 4px rgb(0, 0, 0,.08); + } + + } + + } \ No newline at end of file diff --git a/src/api/Question.ts b/src/api/Question.ts index 5243313..4458a60 100644 --- a/src/api/Question.ts +++ b/src/api/Question.ts @@ -19,6 +19,6 @@ export const useAddQuestion = () => useAddMutation(KEY, API.ADD, true); export const useAddQuestionAsync = () => useAddMutation(KEY2, API.ADD); export const useUpdateQuestion = (params?: any) => - useUpdateMutation(KEY, API.GET, false); + useUpdateMutation(KEY, API.GET, true); export const useDeleteQuestion = (params?: any) => useDeleteMutation(KEY, API.DELETE); diff --git a/src/api/helper/useGetQuery.ts b/src/api/helper/useGetQuery.ts index a417147..fedca51 100644 --- a/src/api/helper/useGetQuery.ts +++ b/src/api/helper/useGetQuery.ts @@ -23,8 +23,8 @@ function useGetQuery( const { page, per_page } = PaginationParams(location); const paramToSend = pagination - ? { page: page, per_page: per_page, ...remainingParams , sort_by,name } - : { ...remainingParams ,sort_by,name}; + ? { page: page, per_page: per_page, name,...remainingParams , sort_by } + : { name,...remainingParams ,sort_by}; const filteredParams = filterParams(paramToSend); diff --git a/src/translate/ar.json b/src/translate/ar.json index 561d58e..3ca9b5d 100644 --- a/src/translate/ar.json +++ b/src/translate/ar.json @@ -45,7 +45,8 @@ "Due_date_must_be_before_assigning_date": "يجب أن يكون تاريخ الاستحقاق بعد تاريخ التعيين", "grade_to_pass_must_be_less_than_max_grade": "يجب أن تكون درجة النجاح أقل من الحد الأقصى للدرجة", "max_mark_must_be_greater_than_min_mark_to_pass": "يجب ان تكون اكبر من علامة النجاح", - "Sorry, the question must have at least one option": "عذرًا، يجب أن يحتوي السؤال على خيار واحد على الأقل" + "Sorry, the question must have at least one option": "عذرًا، يجب أن يحتوي السؤال على خيار واحد على الأقل", + "at_least_one_answer_should_be_correct":"يجب أن تكون إجابة واحدة على الأقل صحيحة" }, "header": { "register_students": "تسجيل الطلاب", @@ -115,7 +116,14 @@ "add_question": "اضافة سؤال", "new_choice_have_been_added": "تم إضافة خيار جديد", "new_question_have_been_added": "تم إضافة سؤال جديد", - "sort_by":"ترتيب حسب" + "sort_by":"ترتيب حسب", + "filter":"تصفية", + "per_page":"صف لكل صفحة", + "entries":"ادخالات", + "personal_information":"المعلومات الشخصية", + "address":"العنوان", + "attachment":"المرفق", + "subject_of_class":"مواد الصف" }, "columns": { "id": "الرقم التعريفي", @@ -182,7 +190,7 @@ "save": "حفظ", "enter": "ادخال", "delete": "حذف", - "cancel": "إلغاء", + "cancel": "إلغاء الأمر", "search_here": "بحث", "details": "تفاصيل", "export_students": "تصدير الطلاب", @@ -392,7 +400,17 @@ "hint_question": "شرح السؤال", "_": "", "key": "المفتاح", - "canAnswersBeShuffled": "يمكن خلط الإجابات" + "canAnswersBeShuffled": "يمكن خلط الإجابات", + "ID Number": "رقم الهوية", + "Addition Date": "تاريخ الإضافة", + "Status": "الحالة", + "Full Name": "الاسم الثلاثي", + "Phone Number": "رقم الهاتف", + "Mobile Number": "رقم الموبايل", + "Seller Percentage": "نسبة البائع", + "city":"المحافظة", + "personal_image":"صورة شخصية", + "id_image":"صورة الهوية" }, "select": { "Payments": { @@ -739,12 +757,14 @@ "edit": "تعديل", "questions": "اسئلة", "lesson": "الدرس", - "subject": "مواد", + "subjects": "مواد", "curriculum": "مقرر", "question": "السؤال", "user": "مستخدم", "param": "معامل", - "student_package": "حزمة الطالب" + "student_package": "حزمة الطالب", + "add_reseller":"إضافة بائع", + "grade":"الصفوف" }, "page_header": { "dashboard": "لوحة القيادة / الصفحة الرئيسية", @@ -775,16 +795,19 @@ "Question": "لوحة القيادة /اسئلة ", "add_Question": "لوحة القيادة /إضافة اسئلة ", "edit_Question": "لوحة القيادة /تعديل اسئلة ", - "grade": "الصفوف", + "grade": "لوحة القيادة / الصفوف", "report": "تقرير", "user": "مستخدم", "reseller": " لوحة القيادة / البائعين", + "add_reseller": " لوحة القيادة / البائعين / إضافة بائع ", "param": "معامل", "student_package": "حزمة الطالب" }, "table": { "student": "قائمة الطلاب", - "reseller": "البائعين" + "reseller": "البائعين", + "grade":"قائمة الصفوف", + "subjects":"مواد الصف" }, "alphabet": { "A": "A",