From 9509943a60c0d0b8bb27feaa0fe223bf39b67605 Mon Sep 17 00:00:00 2001 From: karimaldeen Date: Tue, 10 Sep 2024 12:29:57 +0300 Subject: [PATCH] add reseller --- src/Pages/Admin/Reseller/Add/Page.tsx | 28 + src/Pages/Admin/Reseller/Edit/Page.tsx | 9 + .../Reseller/{Model => Form}/FilterForm.tsx | 0 .../Reseller/{Model => Form}/ModelForm.tsx | 0 .../Reseller/{Model => Form}/formUtil.ts | 0 src/Pages/Admin/Reseller/Model/AddModel.tsx | 33 - src/Pages/Admin/Reseller/Model/EditModel.tsx | 37 -- src/Pages/Admin/Reseller/Page.tsx | 19 +- src/Pages/Admin/Reseller/index.tsx | 5 - src/Pages/Admin/Reseller/useTableColumns.tsx | 73 ++- src/Routes.tsx | 47 +- src/Styles/DataTable/FillterNav.scss | 4 +- src/Styles/Layout/NavBar.scss | 8 +- src/Styles/Pages/exercise.scss | 12 +- src/enums/Model.ts | 9 +- src/enums/abilities.ts | 2 +- src/translate/ar.json | 15 +- src/translate/en.json | 614 +----------------- src/types/ReSeller.ts | 50 ++ src/utils/hasAbilityFn.ts | 19 +- 20 files changed, 218 insertions(+), 766 deletions(-) create mode 100644 src/Pages/Admin/Reseller/Add/Page.tsx create mode 100644 src/Pages/Admin/Reseller/Edit/Page.tsx rename src/Pages/Admin/Reseller/{Model => Form}/FilterForm.tsx (100%) rename src/Pages/Admin/Reseller/{Model => Form}/ModelForm.tsx (100%) rename src/Pages/Admin/Reseller/{Model => Form}/formUtil.ts (100%) delete mode 100644 src/Pages/Admin/Reseller/Model/AddModel.tsx delete mode 100644 src/Pages/Admin/Reseller/Model/EditModel.tsx create mode 100644 src/types/ReSeller.ts diff --git a/src/Pages/Admin/Reseller/Add/Page.tsx b/src/Pages/Admin/Reseller/Add/Page.tsx new file mode 100644 index 0000000..8b58ae8 --- /dev/null +++ b/src/Pages/Admin/Reseller/Add/Page.tsx @@ -0,0 +1,28 @@ +import { useTranslation } from "react-i18next"; +import useSetPageTitle from "../../../../Hooks/useSetPageTitle"; +import PageHeader from "../../../../Layout/Dashboard/PageHeader"; +import { Suspense } from "react"; +import { Spin } from "antd"; +import { ModalEnum } from "../../../../enums/Model"; +import { canAddReSeller } from "../../../../utils/hasAbilityFn"; + + + +const TableHeader = () => { + const [t] = useTranslation(); + useSetPageTitle(t(`page_header.reseller`)); + return ( +
+ }> + + + +
+ ); +}; + +export default TableHeader; diff --git a/src/Pages/Admin/Reseller/Edit/Page.tsx b/src/Pages/Admin/Reseller/Edit/Page.tsx new file mode 100644 index 0000000..4c8f872 --- /dev/null +++ b/src/Pages/Admin/Reseller/Edit/Page.tsx @@ -0,0 +1,9 @@ +import React from 'react' + +const Page = () => { + return ( +
Page
+ ) +} + +export default Page \ No newline at end of file diff --git a/src/Pages/Admin/Reseller/Model/FilterForm.tsx b/src/Pages/Admin/Reseller/Form/FilterForm.tsx similarity index 100% rename from src/Pages/Admin/Reseller/Model/FilterForm.tsx rename to src/Pages/Admin/Reseller/Form/FilterForm.tsx diff --git a/src/Pages/Admin/Reseller/Model/ModelForm.tsx b/src/Pages/Admin/Reseller/Form/ModelForm.tsx similarity index 100% rename from src/Pages/Admin/Reseller/Model/ModelForm.tsx rename to src/Pages/Admin/Reseller/Form/ModelForm.tsx diff --git a/src/Pages/Admin/Reseller/Model/formUtil.ts b/src/Pages/Admin/Reseller/Form/formUtil.ts similarity index 100% rename from src/Pages/Admin/Reseller/Model/formUtil.ts rename to src/Pages/Admin/Reseller/Form/formUtil.ts diff --git a/src/Pages/Admin/Reseller/Model/AddModel.tsx b/src/Pages/Admin/Reseller/Model/AddModel.tsx deleted file mode 100644 index 4760fec..0000000 --- a/src/Pages/Admin/Reseller/Model/AddModel.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import React from "react"; -import { getInitialValues, getValidationSchema } from "./formUtil"; -import { ModalEnum } from "../../../../enums/Model"; -import LayoutModel from "../../../../Layout/Dashboard/LayoutModel"; -import { QueryStatusEnum } from "../../../../enums/QueryStatus"; -import ModelForm from "./ModelForm"; -import { useAddReseller } from "../../../../api/reseller"; - -const AddModel: React.FC = () => { - const { mutate, status } = useAddReseller(); - - const handleSubmit = (values: any) => { - mutate({ - ...values, - }); - }; - return ( - <> - - - - - ); -}; - -export default AddModel; diff --git a/src/Pages/Admin/Reseller/Model/EditModel.tsx b/src/Pages/Admin/Reseller/Model/EditModel.tsx deleted file mode 100644 index f112cc8..0000000 --- a/src/Pages/Admin/Reseller/Model/EditModel.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import React from "react"; -import { getInitialValues, getValidationSchema } from "./formUtil"; -import { ModalEnum } from "../../../../enums/Model"; -import LayoutModel from "../../../../Layout/Dashboard/LayoutModel"; -import ModelForm from "./ModelForm"; -import { QueryStatusEnum } from "../../../../enums/QueryStatus"; -import { useObjectToEdit } from "../../../../zustand/ObjectToEditState"; -import { useUpdateUser } from "../../../../api/user"; -import { useUpdateReseller } from "../../../../api/reseller"; - -const EditModel: React.FC = () => { - const { mutate, status } = useUpdateReseller(); - const { objectToEdit } = useObjectToEdit((state) => state); - - const handleSubmit = (values: any) => { - mutate({ - ...values, - }); - }; - return ( - <> - - - - - ); -}; - -export default EditModel; diff --git a/src/Pages/Admin/Reseller/Page.tsx b/src/Pages/Admin/Reseller/Page.tsx index 1628ac1..f041cc8 100644 --- a/src/Pages/Admin/Reseller/Page.tsx +++ b/src/Pages/Admin/Reseller/Page.tsx @@ -6,17 +6,15 @@ import { lazy, Suspense } from "react"; import { Spin } from "antd"; import { canAddReport, - canAddReseller, + canAddReSeller, canAddTags, } from "../../../utils/hasAbilityFn"; import useSetPageTitle from "../../../Hooks/useSetPageTitle"; import { useDeleteTag } from "../../../api/tags"; import PageHeader from "../../../Layout/Dashboard/PageHeader"; import FilterLayout from "../../../Layout/Dashboard/FilterLayout"; -import FilterForm from "./Model/FilterForm"; +import FilterForm from "./Form/FilterForm"; const Table = lazy(() => import("./Table")); -const AddModalForm = lazy(() => import("./Model/AddModel")); -const EditModalForm = lazy(() => import("./Model/EditModel")); const DeleteModalForm = lazy( () => import("../../../Layout/Dashboard/DeleteModels"), ); @@ -34,20 +32,21 @@ const TableHeader = () => { }> } - filterTitle="sidebar.reseller" + filterTitle="table.reseller" /> - - + ); diff --git a/src/Pages/Admin/Reseller/index.tsx b/src/Pages/Admin/Reseller/index.tsx index 447f22d..dc5a8ee 100644 --- a/src/Pages/Admin/Reseller/index.tsx +++ b/src/Pages/Admin/Reseller/index.tsx @@ -2,16 +2,11 @@ import { useColumns } from "./useTableColumns"; import Table from "./Table"; import { FaPlus } from "react-icons/fa"; - -import AddModalForm from "./Model/AddModel"; -import EditModalForm from "./Model/EditModel"; // import DeleteModalForm from "../../"; export { Table, useColumns, - AddModalForm, - EditModalForm, // DeleteModalForm, FaPlus, }; diff --git a/src/Pages/Admin/Reseller/useTableColumns.tsx b/src/Pages/Admin/Reseller/useTableColumns.tsx index 1d950a3..33223e4 100644 --- a/src/Pages/Admin/Reseller/useTableColumns.tsx +++ b/src/Pages/Admin/Reseller/useTableColumns.tsx @@ -1,59 +1,82 @@ import { TableColumnsType } from "antd"; -import { reseller } from "../../../types/Item"; +import { ReSeller } from "../../../types/ReSeller"; +import { FaPlus } from "react-icons/fa"; +import useModalHandler from "../../../utils/useModalHandler"; import { ModalEnum } from "../../../enums/Model"; import { useObjectToEdit } from "../../../zustand/ObjectToEditState"; -import { useModalState } from "../../../zustand/Modal"; import { useTranslation } from "react-i18next"; +import { ABILITIES_ENUM } from "../../../enums/abilities"; +import { useNavigate } from "react-router-dom"; import { - canDeleteReseller, - canDeleteUser, - canEditReseller, - canEditUser, + canAddReSeller, + canDeleteReSeller, + canEditReSeller, } from "../../../utils/hasAbilityFn"; import ActionButtons from "../../../Components/Table/ActionButtons"; +import ColumnsImage from "../../../Components/Columns/ColumnsImage"; export const useColumns = () => { - const [t] = useTranslation(); - - const { setIsOpen } = useModalState((state) => state); + const { handel_open_model } = useModalHandler(); const { setObjectToEdit } = useObjectToEdit((state) => state); - const handelDelete = (record: any) => { - setObjectToEdit(record); - setIsOpen(ModalEnum?.RESELLER_DELETE); - }; - const handleEdit = (record: any) => { - setObjectToEdit(record); - setIsOpen(ModalEnum?.RESELLER_EDIT); + const navigate = useNavigate(); + + + const handelDelete = (data: ReSeller) => { + setObjectToEdit(data); + handel_open_model(ModalEnum?.RE_SELLER_DELETE); }; - const columns: TableColumnsType = [ + const handleEdit = (record: ReSeller) => { + setObjectToEdit(record); + handel_open_model(ModalEnum?.RE_SELLER_EDIT); + }; + const [t] = useTranslation(); + + const columns: TableColumnsType = [ { title: t("columns.id"), dataIndex: "id", key: "id", align: "center", + render: (_text, record) => record?.id, }, { - title: t("columns.name"), - dataIndex: "name", - key: "name", + title: `${t("columns.first_name")}`, + dataIndex: "first_name", + key: "first_name", align: "center", + render: (_text, record) => record?.first_name, }, - { - title: t("columns.procedure"), + title: `${t("columns.last_name")}`, + dataIndex: "last_name", + key: "last_name", + align: "center", + render: (_text, record) => record?.last_name, + }, + { + title: `${t("columns.username")}`, + dataIndex: "username", + key: "username", + align: "center", + render: (_text, record) => record?.user?.username, + }, + { + title:"", + key: "actions", align: "center", - width: "25vw", render: (_text, record, index) => { return ( handelDelete(record)} onEdit={() => handleEdit(record)} + /> ); }, diff --git a/src/Routes.tsx b/src/Routes.tsx index d266080..2f7fb54 100644 --- a/src/Routes.tsx +++ b/src/Routes.tsx @@ -1,5 +1,5 @@ import { TCrudRoute, TMenuItem } from "./types/App"; -import { FaHome, FaMoneyBill } from "react-icons/fa"; +import { FaHome, FaMoneyBill, FaSellcast } from "react-icons/fa"; import React from "react"; const Dummy = React.lazy(() => import("./Pages/Home/Dummy")); @@ -21,6 +21,9 @@ const EditQuestionPage = React.lazy( const Report = React.lazy(() => import("./Pages/Admin/Report/Page")); const Student = React.lazy(() => import("./Pages/Admin/Student/Page")); +const ReSeller = React.lazy(() => import("./Pages/Admin/Reseller/Page")); +const AddReSeller = React.lazy(() => import("./Pages/Admin/Reseller/Add/Page")); +const EditReSeller = React.lazy(() => import("./Pages/Admin/Reseller/Edit/Page")); import { hasAbility } from "./utils/hasAbility"; import { ABILITIES_ENUM, ABILITIES_VALUES_ENUM } from "./enums/abilities"; @@ -78,6 +81,16 @@ export const menuItems: TMenuItem[] = [ abilities_value: ABILITIES_VALUES_ENUM.INDEX, prevPath: 0, }, + { + header: "page_header.reSeller", + element: , + icon: , + text: "sidebar.reseller", + path: `/${ABILITIES_ENUM?.RE_SELLER}`, + abilities: ABILITIES_ENUM?.RE_SELLER, + abilities_value: ABILITIES_VALUES_ENUM.INDEX, + prevPath: 0, + }, // { // header: "page_header.tags", // element: , @@ -183,22 +196,22 @@ export const CrudRoute: TCrudRoute[] = [ prevPath: 2, }, - // { - // header: "page_header.add_package", - // element: , - // path: `/${ABILITIES_ENUM?.Package}/add`, - // abilities: ABILITIES_ENUM?.Package, - // abilities_value: ABILITIES_VALUES_ENUM.INDEX, - // prevPath: 0, - // }, - // { - // header: "page_header.edit_package", - // element: , - // path: `/${ABILITIES_ENUM?.Package}/add`, - // abilities: ABILITIES_ENUM?.Package, - // abilities_value: ABILITIES_VALUES_ENUM.INDEX, - // prevPath: 0, - // }, + { + header: "page_header.add_reseller", + element: , + path: `/${ABILITIES_ENUM?.RE_SELLER}/add`, + abilities: ABILITIES_ENUM?.RE_SELLER, + abilities_value: ABILITIES_VALUES_ENUM.INDEX, + prevPath: 0, + }, + { + header: "page_header.edit_reseller", + element: , + path: `/${ABILITIES_ENUM?.RE_SELLER}/:id`, + abilities: ABILITIES_ENUM?.RE_SELLER, + abilities_value: ABILITIES_VALUES_ENUM.INDEX, + prevPath: 0, + }, ]; export const AppRoutes: Record = Object.fromEntries( diff --git a/src/Styles/DataTable/FillterNav.scss b/src/Styles/DataTable/FillterNav.scss index 975e2ce..108604b 100644 --- a/src/Styles/DataTable/FillterNav.scss +++ b/src/Styles/DataTable/FillterNav.scss @@ -47,9 +47,9 @@ .add_button { outline: none; border: none; - width: 10vw; + min-width: 120px; border-radius: 10px; - padding: 0.7vw; + padding: 10px; font-weight: bold; background: var(--primary); color: var(--white); diff --git a/src/Styles/Layout/NavBar.scss b/src/Styles/Layout/NavBar.scss index 96dbc27..b061827 100644 --- a/src/Styles/Layout/NavBar.scss +++ b/src/Styles/Layout/NavBar.scss @@ -32,8 +32,8 @@ align-items: flex-end; } img { - width: 3vw; - height: 3vw; + width: 40px; + height: 40px; } h6 { font-size: 0.8vw; @@ -57,8 +57,8 @@ color: #fff; } @include Flex; - width: 3vw; - height: 3vw; + width: 40px; + height: 40px; border: 2px solid var(--borderColor); border-radius: 10px; cursor: pointer; diff --git a/src/Styles/Pages/exercise.scss b/src/Styles/Pages/exercise.scss index 8adf239..30aba5f 100644 --- a/src/Styles/Pages/exercise.scss +++ b/src/Styles/Pages/exercise.scss @@ -193,11 +193,15 @@ width: 100%; } -.row > * { - padding-right: 0 !important; - padding-left: 0 !important; -} + .SelectTag { padding-inline: 20px; } + +.exercise_add{ + + .add_new_button{ + padding-inline: 20px !important; + } +} \ No newline at end of file diff --git a/src/enums/Model.ts b/src/enums/Model.ts index 588e108..65646d0 100644 --- a/src/enums/Model.ts +++ b/src/enums/Model.ts @@ -171,9 +171,10 @@ export enum ModalEnum { USER_ADD = "USER.add", USER_DELETE = "USER.delete", - ///reseller + /// ReSeller + RE_SELLER_EDIT = "ReSeller.edit", + RE_SELLER_ADD = "ReSeller.add", + RE_SELLER_DELETE = "ReSeller.delete", - RESELLER_EDIT = "RESELLER.edit", - RESELLER_ADD = "RESELLER.add", - RESELLER_DELETE = "RESELLER.delete", + } diff --git a/src/enums/abilities.ts b/src/enums/abilities.ts index 9adde37..03a4d58 100644 --- a/src/enums/abilities.ts +++ b/src/enums/abilities.ts @@ -45,7 +45,7 @@ export enum ABILITIES_ENUM { CURRICULUM = "curriculum", Report = "report", User = "user", - Reseller = "reseller", + RE_SELLER = "reseller", //// } diff --git a/src/translate/ar.json b/src/translate/ar.json index 86901b1..2fa5ec8 100644 --- a/src/translate/ar.json +++ b/src/translate/ar.json @@ -159,7 +159,8 @@ "question_options_count": "عدد الخيارات", "procedure": "اجراء", "icon": "الايقونة", - "canAnswersBeShuffled": "يمكن خلط الإجابات" + "canAnswersBeShuffled": "يمكن خلط الإجابات", + "first_name":"الاسم الأول" }, "practical": { "to_confirm_deletion_please_re_enter": "لتأكيد الحذف، يرجى إعادة الإدخال", @@ -274,7 +275,8 @@ "report": "تقرير", "user": "مستخدم", "user_details": "تفاصيل المستخدم", - "reseller_details": "تفاصيل اعادة البيع" + "reseller_details": "تفاصيل اعادة البيع", + "reseller":"البائعين" }, "education_class_actions": { "Student_Records": "سجلات الطلاب", @@ -692,7 +694,8 @@ "question": "السؤال", "report": "تقرير", "user": "مستخدم", - "student": "الطلاب" + "student": "الطلاب", + "reseller":"البائعين" }, "message": { "some_thing_went_wrong": "حدث خطأ ما", @@ -750,10 +753,12 @@ "edit_Question": "لوحة القيادة /تعديل اسئلة ", "grade": "الدرجات", "report": "تقرير", - "user": "مستخدم" + "user": "مستخدم", + "reseller":" لوحة القيادة / البائعين" }, "table": { - "student": "قائمة الطلاب" + "student": "قائمة الطلاب", + "reseller":"البائعين" }, "alphabet": { "A": "أ", diff --git a/src/translate/en.json b/src/translate/en.json index a8e1840..077404a 100644 --- a/src/translate/en.json +++ b/src/translate/en.json @@ -1,613 +1,3 @@ { - "main_page": "Main Page", - "dashboard": "dashboard", - - "validation": { - "required": "required", - "value_must_be_less_than_900000": "value_must_be_less_than_900000", - "type_required": "type_required", - "pleas_fill_all_label": "pleas Fill All Label", - "please_select_students": "please_select_students", - "please_fill_in_all_the_fields": "please_fill_in_all_the_fields", - "Invalid_email": "Invalid_email", - "Email_is_required": "Email_is_required", - "Password_is_required": "Password_is_required", - "Password_must_be_at_least_8_characters_long": "Password_must_be_at_least_8_characters_long", - "Nationality_is_required": "Nationality_is_required", - "Address_is_required": "Address_is_required", - "Place_of_birth_is_required": "Place_of_birth_is_required", - "Date_of_birth_is_required": "Date_of_birth_is_required", - "Mother's_name_is_required": "Mother's_name_is_required", - "Father's_name_is_required": "Father's_name_is_required", - "Last_name_is_required": "Last_name_is_required", - "First_name_is_required": "First_name_is_required", - "Religion_is_required": "Religion_is_required", - "Gender_is_required": "Gender_is_required", - "Attachment1_is_required": "Attachment1_is_required", - "Father's_job_is_required": "Father's_job_is_required", - "Mother's_phone_number_is_required": "Mother's_phone_number_is_required", - "Father's_phone_number_is_required": "Father's_phone_number_is_required", - "Mother's_job_is_required": "Mother's_job_is_required", - "justification_is_required": "justification_is_required", - "duration_is_required": "duration_is_required", - "pleas_do_any_changes": "pleas_do_any_changes", - "edit_session_content": "edit_session_content", - "Title_is_required": "Title_is_required", - "Exam_type_is_required": "Exam_type_is_required", - "Subject_is_required": "Subject_is_required", - "Maximum_grade_is_required": "Maximum_grade_is_required", - "Must_be_a_number": "Must_be_a_number", - "Value_must_not_exceed_10000": "Value_must_not_exceed_10000", - "Passing_grade_is_required": "Passing_grade_is_required", - "Date_is_required": "Date_is_required", - "Duration_is_required": "Duration_is_required", - "the_possess_done_successful": "the_possess_done_successful", - "some_thing_went_wrong": "some_thing_went_wrong", - "Due_date_must_be_before_assigning_date": "Due date must be before assigning date" - }, - "header": { - "register_students": "register_students", - "import_students": "import_students", - "move_student": "move_student", - "Student_added_successfully": "Student_added_successfully", - "the_student_has_been_added_Do_you_want_to_add_another_student": "the_student_has_been_added_Do_you_want_to_add_another_student", - "Add_a_new_student": "Add_a_new_student", - "Please enter all required data": "Please enter all required data", - "Back to Previous Step": "Back to Previous Step", - "Adding...": "Adding...", - "Next Step": "Next Step", - "Add Student": "Add Student", - "Attendance and absence of students": "Attendance and absence of students", - "see_more_details": "see_more_details", - "earlyDepartures": "earlyDepartures", - "Follow_the_curriculum": "Follow_the_curriculum", - "add_session_content": "add_session_content", - "add_session": "add_session", - "edit_session": "edit_session", - "classroom_behavior_of_students": "classroom_behavior_of_students", - "note_details": "note_details", - "student_homework": "student_homework", - "home_work_title": "home_work_title", - "subject": "subject", - "max_grade": "max_grade", - "student_count": "student_count", - "student_exam": "student_exam", - "student_name": "student_name", - "student_card": "student_card", - "Student_classroom_behavior": "Student_classroom_behavior", - "The_student_financial_situation": "The_student_financial_situation", - "Modify_student_information": "Modify_student_information", - "student_details": "student_details", - "student_status": "student_status", - - "parent_details": "parent_details", - "contact_details": "contact_details", - "additional_details": "additional_details", - "note_type": "note_type", - "student_payment": "student_payment", - "add_new_unit": "add_new_unit", - "add_new_lessons": "add_new_lessons", - "Student_Information": "Student_Information", - "Parent_Information": "Parent_Information", - "Contact_Information": "Contact_Information", - "Attachment_Images": "Attachment_Images", - "Weekly_Class_Schedule": "Weekly_Class_Schedule", - "Print_Schedule": "Print_Schedule", - "Welcome": "Welcome", - "Enter your email and password to log in": "Enter your email and password to log in", - "change_your_current_password": "change your current password", - "view_cycle_for_this_branch": "view cycle for this branch", - "view_term_for_this_cycle": "view term for this branch" - }, - "columns": { - "id": "id", - "name": "name", - "address": "address", - "contact_information": "contact_information", - "data": "data", - "details": "details", - "receipt_number": "receipt_number", - "payment_type": "payment_type", - "value": "value", - "subject_name": "subject_name", - "image": "image", - "card": "card", - "birthday": "birthday", - "last_name": "last_name", - "father_name": "father_name", - "sex": "sex", - "presence": "presence", - "teacher_name": "teacher_name", - "lesson_name": "lesson_name", - "session_start": "session_start", - "type": "type", - "title": "title", - "content": "content", - "assigning_date": "assigning_date", - "due_date": "due_date", - "mark": "mark", - "student_name": "student_name", - "absence": "absence", - "earlyDeparture": "earlyDeparture", - "lateArrival": "lateArrival", - "date": "date", - "starting_date": "starting_date", - "ending_date": "ending_date", - "term_type": "term_type", - "status": "status" - }, - "practical": { - "to_confirm_deletion_please_re_enter": "To confirm deletion, please re-enter", - - "back": "back", - "add": "add", - "edit": "edit", - "move": "move", - "skip": "skip", - "show": "show", - "save": "save", - "enter": "enter", - "delete": "delete", - "cancel": "cancel", - "search_here": "search_here", - "details": "details", - "export_students": "export_students", - "send_notification_to_course": "send_notification_to_course", - "Send_Direct_Notification": "Send_Direct_Notification", - "cancel_registration": "cancel_registration", - "send_notification_to_education_class": "send_notification_to_education_class", - "send_notification_to_student": "send_notification_to_student", - "status": "status", - "Step": "Step", - "login": "login", - "submite": "submite", - "index": "index", - "store": "store", - "update": "update", - "me": "me", - "importStudentData": "importStudentData", - "moveStudents": "moveStudents", - "importStudents": "importStudents", - "overview": "overview", - "presence": "presence" - }, - "Table": { - "header": "", - "info": "" - }, - "models": { - "teacher": "teacher", - "student": "student", - "students": "students", - "subject": "subject", - "education_class": "education_class", - "eduClass": "education_class", - - "session_content": "session_content", - "course": "course", - "payment": "payment", - "note": "note", - "homework": "homework", - "mark": "mark", - "exam": "exam", - "absence": "absence", - "late_arrival": "late_arrival", - "presence": "presence", - "earlyDeparture": "earlyDeparture", - "branch": "branch", - "cycle": "cycle", - "term": "term", - "role": "role", - - "Pass": "Pass", - "user": "User", - "branchAdmin": "Branch Admin", - "grade": "Grade", - "homeworkAttachment": "Homework Attachment", - "lateArrival": "Late Arrival", - "noteAttachment": "Note Attachment", - "session": "Session", - "sessionContent": "Session Content", - - "subjectAttachment": "Subject Attachment", - "unit": "Unit", - "lesson": "Lesson", - "exercise": "Exercise", - "exerciseAnswer": "Exercise Answer", - "tag": "Tag", - - "Exam": "Exam", - "ExamType": "Exam Type", - - "studentParent": "Student Parent", - "registrationRecord": "Registration Record", - "paymentOverview": "Payment Overview", - "subjectAttachmentType": "Subject Attachment Type", - "param": "Param", - "subjectProgress": "Subject Progress", - "main_page": "Main Page", - "tags_details": "tags details" - }, - "education_class_actions": { - "Student_Records": "Student_Records", - "Attendance": "Attendance", - "Permissions": "Permissions", - "Grades": "Grades", - "Notes": "Notes", - "Financial_Status": "Financial_Status", - "Assignments": "Assignments", - "Class_Schedule": "Class_Schedule", - "Curriculum_Follow_up": "Curriculum_Follow_up" - }, - - "input": { - "name": "name", - "address": "address", - "number": "number", - "price": "price", - "drag_and_drop_or_click_here_to_select_the_file": "Drag and drop or click here to select the file", - "Click_to_upload_the_image": "Click to upload the image", - "payment_type": "payment_type", - "details": "details", - "student_name": "student_name", - "receipt_number": "receipt_number", - "date": "date", - "value": "value", - "teacher_name": "teacher_name", - "sex": "sex", - "content": "content", - "type": "type", - "attachments": "attachments", - "send_notification_to_course": "send_notification_to_course", - "export_students": "export_students", - "password": "password", - "nationality": "nationality", - "religion": "religion", - "birthday": "birthday", - "birth_place": "birth_place", - "father_name": "father_name", - "father_job": "father_job", - "mother_name": "mother_name", - "mother_phone_number": "mother_phone_number", - "father_phone_number": "father_phone_number", - "mother_job": "mother_job", - "phone_number": "phone_number", - "additional_phone_number": "additional_phone_number", - "note": "note", - "school_document": "school_document", - "first_name": "first_name", - "last_name": "last_name", - "email": "email", - "student_status": "student_status", - "duration": "duration", - "justification": "justification", - "attachment": "attachment", - "session_name": "session_name", - "lesson_name": "lesson_name", - "title": "title", - "due_date": "due_date", - "assigning_date": "assigning_date", - "subject_name": "subject_name", - "exam_type": "exam_type", - "grade_to_pass": "grade_to_pass", - "max_grade": "max_grade", - "status": "status", - "departure_time": "departure_time", - "mark": "mark", - "image": "image", - "term": "term", - "session_start": "session_start", - "session_end": "session_end", - "academic_year": "academic_year", - "select_date": "select_date", - "School_Year": "School Year", - "Enter_branch_first": "Enter branch first", - "School_Term": "School Term", - "Enter_school_year_first": "Enter school year first", - "Username": "Username", - "Password": "Password", - "new_password": "new_password", - "old_password": "old_password", - "username": "username", - "starting_date": "starting_date", - "ending_date": "ending_date", - "term_type": "term_type", - "description": "description", - "abilities": "abilities" - }, - - "select": { - "Payments": { - "paid": "paid", - "to_be_paid": "to_be_paid", - "all_payment": "all_payment", - "dues": "dues" - }, - "Marks": { - "Not_Taken": "Not_Taken", - "Taken": "Taken" - }, - "Sex": { - "male": "male", - "female": "female", - "bi": "mix" - }, - "Religion": { - "muslim": "muslim", - "christianity": "christianity", - "other": "other" - }, - "nationalities": { - "Afghan": "Afghan", - "Albanian": "Albanian", - "Algerian": "Algerian", - "American": "American", - "Andorran": "Andorran", - "Angolan": "Angolan", - "Antiguans": "Antiguans", - "Argentinean": "Argentinean", - "Armenian": "Armenian", - "Australian": "Australian", - "Austrian": "Austrian", - "Azerbaijani": "Azerbaijani", - "Bahamian": "Bahamian", - "Bahraini": "Bahraini", - "Bangladeshi": "Bangladeshi", - "Barbadian": "Barbadian", - "Barbudans": "Barbudans", - "Batswana": "Batswana", - "Belarusian": "Belarusian", - "Belgian": "Belgian", - "Belizean": "Belizean", - "Beninese": "Beninese", - "Bhutanese": "Bhutanese", - "Bolivian": "Bolivian", - "Bosnian": "Bosnian", - "Brazilian": "Brazilian", - "British": "British", - "Bruneian": "Bruneian", - "Bulgarian": "Bulgarian", - "Burkinabe": "Burkinabe", - "Burmese": "Burmese", - "Burundian": "Burundian", - "Cambodian": "Cambodian", - "Cameroonian": "Cameroonian", - "Canadian": "Canadian", - "Cape Verdean": "Cape Verdean", - "Central African": "Central African", - "Chadian": "Chadian", - "Chilean": "Chilean", - "Chinese": "Chinese", - "Colombian": "Colombian", - "Comoran": "Comoran", - "Congolese": "Congolese", - "Costa Rican": "Costa Rican", - "Croatian": "Croatian", - "Cuban": "Cuban", - "Cypriot": "Cypriot", - "Czech": "Czech", - "Danish": "Danish", - "Djibouti": "Djibouti", - "Dominican": "Dominican", - "Dutch": "Dutch", - "East Timorese": "East Timorese", - "Ecuadorean": "Ecuadorean", - "Egyptian": "Egyptian", - "Emirian": "Emirian", - "Equatorial Guinean": "Equatorial Guinean", - "Eritrean": "Eritrean", - "Estonian": "Estonian", - "Ethiopian": "Ethiopian", - "Fijian": "Fijian", - "Filipino": "Filipino", - "Finnish": "Finnish", - "French": "French", - "Gabonese": "Gabonese", - "Gambian": "Gambian", - "Georgian": "Georgian", - "German": "German", - "Ghanaian": "Ghanaian", - "Greek": "Greek", - "Grenadian": "Grenadian", - "Guatemalan": "Guatemalan", - "Guinea-Bissauan": "Guinea-Bissauan", - "Guinean": "Guinean", - "Guyanese": "Guyanese", - "Haitian": "Haitian", - "Herzegovinian": "Herzegovinian", - "Honduran": "Honduran", - "Hungarian": "Hungarian", - "I-Kiribati": "I-Kiribati", - "Icelander": "Icelander", - "Indian": "Indian", - "Indonesian": "Indonesian", - "Iranian": "Iranian", - "Iraqi": "Iraqi", - "Irish": "Irish", - "palestine": "palestine", - "Italian": "Italian", - "Ivorian": "Ivorian", - "Jamaican": "Jamaican", - "Japanese": "Japanese", - "Jordanian": "Jordanian", - "Kazakhstani": "Kazakhstani", - "Kenyan": "Kenyan", - "Kittian and Nevisian": "Kittian and Nevisian", - "Kuwaiti": "Kuwaiti", - "Kyrgyz": "Kyrgyz", - "Laotian": "Laotian", - "Latvian": "Latvian", - "Lebanese": "Lebanese", - "Liberian": "Liberian", - "Libyan": "Libyan", - "Liechtensteiner": "Liechtensteiner", - "Lithuanian": "Lithuanian", - "Luxembourger": "Luxembourger", - "Macedonian": "Macedonian", - "Malagasy": "Malagasy", - "Malawian": "Malawian", - "Malaysian": "Malaysian", - "Maldivan": "Maldivan", - "Malian": "Malian", - "Maltese": "Maltese", - "Marshallese": "Marshallese", - "Mauritanian": "Mauritanian", - "Mauritian": "Mauritian", - "Mexican": "Mexican", - "Micronesian": "Micronesian", - "Moldovan": "Moldovan", - "Monacan": "Monacan", - "Mongolian": "Mongolian", - "Moroccan": "Moroccan", - "Mosotho": "Mosotho", - "Motswana": "Motswana", - "Mozambican": "Mozambican", - "Namibian": "Namibian", - "Nauruan": "Nauruan", - "Nepali": "Nepali", - "New Zealander": "New Zealander", - "Nicaraguan": "Nicaraguan", - "Nigerian": "Nigerian", - "Nigerien": "Nigerien", - "North Korean": "North Korean", - "Northern Irish": "Northern Irish", - "Norwegian": "Norwegian", - "Omani": "Omani", - "Pakistani": "Pakistani", - "Palauan": "Palauan", - "Panamanian": "Panamanian", - "Papua New Guinean": "Papua New Guinean", - "Paraguayan": "Paraguayan", - "Peruvian": "Peruvian", - "Polish": "Polish", - "Portuguese": "Portuguese", - "Qatari": "Qatari", - "Romanian": "Romanian", - "Russian": "Russian", - "Rwandan": "Rwandan", - "Saint Lucian": "Saint Lucian", - "Salvadoran": "Salvadoran", - "Samoan": "Samoan", - "San Marinese": "San Marinese", - "Sao Tomean": "Sao Tomean", - "Saudi": "Saudi", - "Scottish": "Scottish", - "Senegalese": "Senegalese", - "Serbian": "Serbian", - "Seychellois": "Seychellois", - "Sierra Leonean": "Sierra Leonean", - "Singaporean": "Singaporean", - "Slovakian": "Slovakian", - "Slovenian": "Slovenian", - "Solomon Islander": "Solomon Islander", - "Somali": "Somali", - "South African": "South African", - "South Korean": "South Korean", - "Spanish": "Spanish", - "Sri Lankan": "Sri Lankan", - "Sudanese": "Sudanese", - "Surinamer": "Surinamer", - "Swazi": "Swazi", - "Swedish": "Swedish", - "Swiss": "Swiss", - "Syrian": "Syrian", - "Taiwanese": "Taiwanese", - "Tajik": "Tajik", - "Tanzanian": "Tanzanian", - "Thai": "Thai", - "Togolese": "Togolese", - "Tongan": "Tongan", - "Trinidadian/Tobagonian": "Trinidadian/Tobagonian", - "Tunisian": "Tunisian", - "Turkish": "Turkish", - "Tuvaluan": "Tuvaluan", - "Ugandan": "Ugandan", - "Ukrainian": "Ukrainian", - "Uruguayan": "Uruguayan", - "Uzbekistani": "Uzbekistani", - "Venezuelan": "Venezuelan", - "Vietnamese": "Vietnamese", - "Welsh": "Welsh", - "Yemenite": "Yemenite", - "Zambian": "Zambian", - "Zimbabwean": "Zimbabwean" - }, - "Student_Type": { - "all_students": "all_students", - "absence": "absence", - "late_arrival": "late_arrival", - "presence": "presence", - "justified": "justified", - "not_justified": "not_justified", - "earlyDeparture": "earlyDeparture" - }, - "Note": { - "normal_note": "normal_note", - "alert_note": "alert_note", - "financial_note": "financial_note", - "positive_note": "positive_note", - "warning_note": "warning_note", - "academic_note": "academic_note", - "studying_note": "studying_note", - "organization_note": "organization_note", - "all_note": "all_note" - }, - "Exam": { - "Taken": "Taken", - "Not_Taken": "Not_Taken", - "all_student": "all_student" - }, - "Term_type": { - "first": "first", - "second": "second" - } - }, - "array": { - "Period": { - "Today": "Today", - "First": "First", - "Second": "Second", - "Third": "Third", - "Fourth": "Fourth", - "Fifth": "Fifth", - "Sixth": "Sixth", - "Seventh": "Seventh" - }, - "Days": { - "Sunday": "Sunday", - "Monday": "Monday", - "Tuesday": "Tuesday", - "Wednesday": "Wednesday", - "Thursday": "Thursday", - "Friday": "Friday", - "Saturday": "Saturday" - }, - "UserInfo": { - "course": "course", - "education_class": "education_class", - "nationality": "nationality", - "birthday": "birthday", - "warning": "warning", - "appreciation": "appreciation", - "alert": "alert" - } - }, - "sidebar": { - "dashboard": "dashboard", - "course": "course", - "teacher": "teacher", - "payment": "payment", - "student_details": "student_details", - "create_student": "create_student", - "course_details": "course_details", - "education_class_details": "education_class_details", - "subject_details": "subject_details", - "logout": "logout", - "branch": "branch", - "role": "role" - }, - "message": { - "some_thing_went_wrong": "some_thing_went_wrong", - "the_possess_done_successful": "the_possess_done_successful" - } -} + +} \ No newline at end of file diff --git a/src/types/ReSeller.ts b/src/types/ReSeller.ts new file mode 100644 index 0000000..dacee02 --- /dev/null +++ b/src/types/ReSeller.ts @@ -0,0 +1,50 @@ +import { Nullable } from "./App"; + +// Define the Teacher interface + + +interface ReSellerUser { + id: number; + username: string; + phone_number: string | null; + type: 'reseller' | 'other'; // Specify other types if needed +} + +interface ReSellerLocation { + lat: string; + lng: string; +} + +interface ContactInfo { + contact_number1: string; + contact_number2: string; + card_number: string | null; +} + + +export interface ReSeller { + id: number; + user: ReSellerUser; + first_name: string; + last_name: string; + location: ReSellerLocation; + contact_info: ContactInfo; + contact_number1 : string | number + contact_number2 : string | number +} + +export interface InitialValues { + id: number; + user: ReSellerUser; + first_name: string; + last_name: string; + location: ReSellerLocation; + lat: string | Number; + lng: string | Number; + contact_info: ContactInfo; + contact_number1 : string | number +contact_number2 : string | number +username : string +} + +export type ReSellerInitialValues = Partial>; diff --git a/src/utils/hasAbilityFn.ts b/src/utils/hasAbilityFn.ts index 1893ccb..99c0d46 100644 --- a/src/utils/hasAbilityFn.ts +++ b/src/utils/hasAbilityFn.ts @@ -620,18 +620,23 @@ export const canDeleteUser = hasAbility( ABILITIES_VALUES_ENUM.DELETE, ); -/// Reseller -export const canAddReseller = hasAbility( - ABILITIES_ENUM.Reseller, +/// ReSeller + +export const canAddReSeller = hasAbility( + ABILITIES_ENUM.RE_SELLER, ABILITIES_VALUES_ENUM.STORE, ); -export const canEditReseller = hasAbility( - ABILITIES_ENUM.Reseller, +export const canEditReSeller = hasAbility( + ABILITIES_ENUM.RE_SELLER, ABILITIES_VALUES_ENUM.UPDATE, ); -export const canDeleteReseller = hasAbility( - ABILITIES_ENUM.Reseller, +export const canDeleteReSeller = hasAbility( + ABILITIES_ENUM.RE_SELLER, ABILITIES_VALUES_ENUM.DELETE, ); +export const canShowReSeller = hasAbility( + ABILITIES_ENUM.RE_SELLER, + ABILITIES_VALUES_ENUM.SHOW, +);