diff --git a/.vscode/settings.json b/.vscode/settings.json index 7dd37a8..cf06499 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,8 +25,9 @@ "Viewelement", "webp", "Xmark", + "ZAKER", "zustand", "مطلوب" ], "vite.https": true -} +} \ No newline at end of file diff --git a/index.html b/index.html index f840f01..fda984e 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@ /> - NERD DASHBOARD + ZAKER DASHBOARD diff --git a/src/Components/Layout/Navbar/NavBarRightSide.tsx b/src/Components/Layout/Navbar/NavBarRightSide.tsx index 61319b9..0d07a80 100644 --- a/src/Components/Layout/Navbar/NavBarRightSide.tsx +++ b/src/Components/Layout/Navbar/NavBarRightSide.tsx @@ -38,7 +38,7 @@ const NavBarRightSide = () => { icon={} /> (Navigate('/notifications'))} + onClick={()=>(Navigate('/notifications'))} className="NotificationsIcon" note="notification" color="#E0E0E0" diff --git a/src/Pages/Admin/Notifications/AddNotification/Model/AddModel.tsx b/src/Pages/Admin/Notifications/AddNotification/Model/AddModel.tsx new file mode 100644 index 0000000..d16c8dd --- /dev/null +++ b/src/Pages/Admin/Notifications/AddNotification/Model/AddModel.tsx @@ -0,0 +1,33 @@ +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 { useAddNotification } from "../../../../../api/notification"; + +const AddModel: React.FC = () => { + const { mutate, status } = useAddNotification(); + + const handleSubmit = (values: any) => { + mutate({ + ...values, + }); + }; + return ( + <> + + + + + ); +}; + +export default AddModel; diff --git a/src/Pages/Admin/Notifications/AddNotification/Model/EditModel.tsx b/src/Pages/Admin/Notifications/AddNotification/Model/EditModel.tsx new file mode 100644 index 0000000..ae5ff00 --- /dev/null +++ b/src/Pages/Admin/Notifications/AddNotification/Model/EditModel.tsx @@ -0,0 +1,38 @@ +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 { handelImageState } from "../../../../../utils/DataToSendImageState"; +import { useUpdateNotification } from "../../../../../api/notification"; + +const EditModel: React.FC = () => { + const { mutate, status } = useUpdateNotification(); + const { objectToEdit } = useObjectToEdit((state) => state); + + const handleSubmit = (values: any) => { + const Data_to_send = { ...values }; + const handelImage = handelImageState(Data_to_send, "icon"); + mutate(handelImage); + }; + + return ( + <> + + + + + ); +}; + +export default EditModel; diff --git a/src/Pages/Admin/Notifications/AddNotification/Model/FilterForm.tsx b/src/Pages/Admin/Notifications/AddNotification/Model/FilterForm.tsx new file mode 100644 index 0000000..44b63f7 --- /dev/null +++ b/src/Pages/Admin/Notifications/AddNotification/Model/FilterForm.tsx @@ -0,0 +1,20 @@ +import React from "react"; +import ValidationField from "../../../../../Components/ValidationField/ValidationField"; +import { Col, Row } from "reactstrap"; +import { useFormikContext } from "formik"; + +const FilterForm = () => { + const formik = useFormikContext(); + + return ( +
+ + + + + +
+ ); +}; + +export default FilterForm; diff --git a/src/Pages/Admin/Notifications/AddNotification/Model/ModelForm.tsx b/src/Pages/Admin/Notifications/AddNotification/Model/ModelForm.tsx new file mode 100644 index 0000000..ffc98ae --- /dev/null +++ b/src/Pages/Admin/Notifications/AddNotification/Model/ModelForm.tsx @@ -0,0 +1,20 @@ +import { Col, Row } from "reactstrap"; +import ValidationField from "../../../../../Components/ValidationField/ValidationField"; + +const Form = () => { + return ( + + + + + + + + + + + + ); +}; + +export default Form; diff --git a/src/Pages/Admin/Notifications/AddNotification/Model/formUtil.ts b/src/Pages/Admin/Notifications/AddNotification/Model/formUtil.ts new file mode 100644 index 0000000..0497cda --- /dev/null +++ b/src/Pages/Admin/Notifications/AddNotification/Model/formUtil.ts @@ -0,0 +1,28 @@ +import * as Yup from "yup"; +import { Grade, GradeInitialValues } from "../../../../../types/Grade"; +import { Notification } from "../../../../../types/Notification"; + +export const getInitialValues = ( + objectToEdit: Partial, +): any => { + return { + id: objectToEdit?.id, + title: objectToEdit?.title ?? "", + seen: objectToEdit?.seen ?? "", + body: objectToEdit?.body ?? "", + notifiable_type: objectToEdit?.notifiable_type ?? "", + + + }; +}; + +export const getValidationSchema = () => { + // validate input + return Yup.object().shape({ + title: Yup.string().required("validation.required"), + seen: Yup.string().required("validation.required"), + body: Yup.string().required("validation.required"), + notifiable_type: Yup.string().required("validation.required"), + + }); +}; diff --git a/src/Pages/Admin/Notifications/AddNotification/Page.tsx b/src/Pages/Admin/Notifications/AddNotification/Page.tsx new file mode 100644 index 0000000..151b82d --- /dev/null +++ b/src/Pages/Admin/Notifications/AddNotification/Page.tsx @@ -0,0 +1,49 @@ +import { useTranslation } from "react-i18next"; +import { lazy, Suspense } from "react"; +import { Spin } from "antd"; +import useSetPageTitle from "../../../../Hooks/useSetPageTitle"; +import { ModalEnum } from "../../../../enums/Model"; +import PageHeader from "../../../../Layout/Dashboard/PageHeader"; +import FilterLayout from "../../../../Layout/Dashboard/FilterLayout"; +import FilterForm from "./Model/FilterForm"; +import { canAddNotification } from "../../../../utils/hasAbilityFn"; +import { useDeleteNotification } from "../../../../api/notification"; + +const Table = lazy(() => import("./Table")); +const AddModalForm = lazy(() => import("./Model/AddModel")); +const EditModalForm = lazy(() => import("./Model/EditModel")); +const DeleteModalForm = lazy( + () => import("../../../../Layout/Dashboard/DeleteModels"), +); + +const TableHeader = () => { + const [t] = useTranslation(); + const deleteMutation = useDeleteNotification(); + + useSetPageTitle([ + {name:`${t(`page_header.home`)}`, path:"/"}, + {name:`${t(`page_header.notification`)}`, path:"notification"} + ]); + + return ( +
+ }> + + } filterTitle="table.notification" /> + + + + + + + ); +}; + +export default TableHeader; diff --git a/src/Pages/Admin/Notifications/AddNotification/Table.tsx b/src/Pages/Admin/Notifications/AddNotification/Table.tsx new file mode 100644 index 0000000..5aed141 --- /dev/null +++ b/src/Pages/Admin/Notifications/AddNotification/Table.tsx @@ -0,0 +1,24 @@ +import { useColumns } from "./useTableColumns"; +import React from "react"; +import DataTable from "../../../../Layout/Dashboard/Table/DataTable"; +import { useFilterState } from "../../../../Components/Utils/Filter/FilterState"; +import { useFilterStateState } from "../../../../zustand/Filter"; +import { useGetAllNotification } from "../../../../api/notification"; + +const App: React.FC = () => { + const { filterState } = useFilterState(); + const { Filter } = useFilterStateState(); + const name = Filter?.name ; + const sort_by = Filter?.sort_by ; + + const response = useGetAllNotification({ + pagination: true, + ...filterState, + name:filterState.name || name, + sort_by + }); + + return ; +}; + +export default App; diff --git a/src/Pages/Admin/Notifications/AddNotification/useTableColumns.tsx b/src/Pages/Admin/Notifications/AddNotification/useTableColumns.tsx new file mode 100644 index 0000000..d446938 --- /dev/null +++ b/src/Pages/Admin/Notifications/AddNotification/useTableColumns.tsx @@ -0,0 +1,95 @@ +import { TableColumnsType } from "antd"; +import useModalHandler from "../../../../utils/useModalHandler"; +import { ModalEnum } from "../../../../enums/Model"; +import { useObjectToEdit } from "../../../../zustand/ObjectToEditState"; +import { useTranslation } from "react-i18next"; +import { useNavigate } from "react-router-dom"; +import { + canDeleteNotification, + canEditNotification, +} from "../../../../utils/hasAbilityFn"; +import ActionButtons from "../../../../Components/Table/ActionButtons"; +import ColumnsImage from "../../../../Components/Columns/ColumnsImage"; +import { useFilterStateState } from "../../../../zustand/Filter"; +import { Notification } from "../../../../types/Notification"; + +export const useColumns = () => { + const { handel_open_model } = useModalHandler(); + + const { setObjectToEdit } = useObjectToEdit((state) => state); + const navigate = useNavigate(); + const { setFilter } = useFilterStateState(); + + + + const handelShow = (record: Notification) => { + setFilter({}) + navigate(`${record?.id}`); + }; + + const handelDelete = (data: Notification) => { + setObjectToEdit(data); + handel_open_model(ModalEnum?.NOTIFICATION_DELETE); + }; + + const handleEdit = (record: Notification) => { + setObjectToEdit(record); + handel_open_model(ModalEnum?.NOTIFICATION_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.body")}`, + dataIndex: "body", + key: "body", + align: "center", + render: (_text, record) => record?.body, + ellipsis:true + }, + { + title: `${t("columns.seen")}`, + dataIndex: "seen", + key: "seen", + align: "center", + render: (_text, record) => record?.seen, + ellipsis:true + }, + { + title: `${t("columns.notifiable_type")}`, + dataIndex: "notifiable_type", + key: "notifiable_type", + align: "center", + render: (_text, record) => record?.notifiable_type, + ellipsis:true + }, + { + + title: t("columns.procedure"), + key: "actions", + align: "center", + width: "25vw", + render: (_text, record, index) => { + return ( + handelDelete(record)} + onEdit={() => handleEdit(record)} + onShow={() => handelShow(record)} + /> + ); + }, + }, + ]; + + return columns; +}; diff --git a/src/Pages/Admin/Notifications/Page.tsx b/src/Pages/Admin/Notifications/Page.tsx index b2eec17..8fb0b22 100644 --- a/src/Pages/Admin/Notifications/Page.tsx +++ b/src/Pages/Admin/Notifications/Page.tsx @@ -27,7 +27,7 @@ const Page = () => {

{t("header.notifications")}

diff --git a/src/Pages/Admin/Report/Model/FilterForm.tsx b/src/Pages/Admin/Report/Model/FilterForm.tsx index 86bb23c..0cf69ef 100644 --- a/src/Pages/Admin/Report/Model/FilterForm.tsx +++ b/src/Pages/Admin/Report/Model/FilterForm.tsx @@ -1,19 +1,31 @@ import React from "react"; import ValidationField from "../../../../Components/ValidationField/ValidationField"; import { Col, Row } from "reactstrap"; +import { useGetAllStudent } from "../../../../api/student"; +import { useGetAllQuestion } from "../../../../api/Question"; const FilterForm = () => { + const {data:StudentData} = useGetAllStudent(); + const {data:QuestionData} = useGetAllQuestion(); + + console.log(QuestionData?.data); + return (
- - - - - - + + ({ + ...e, + fullName: `${e.first_name} ${e.last_name}` + }))} + fieldNames={{ + label: "fullName", + value: "id" + }}/> + ); diff --git a/src/Pages/Admin/Report/Page.tsx b/src/Pages/Admin/Report/Page.tsx index 33d9d49..80b3c07 100644 --- a/src/Pages/Admin/Report/Page.tsx +++ b/src/Pages/Admin/Report/Page.tsx @@ -33,8 +33,8 @@ const TableHeader = () => { }> } diff --git a/src/Pages/Admin/Report/Show/Page.tsx b/src/Pages/Admin/Report/Show/Page.tsx new file mode 100644 index 0000000..b8f3902 --- /dev/null +++ b/src/Pages/Admin/Report/Show/Page.tsx @@ -0,0 +1,15 @@ +import React from 'react' +import ReportInfo from './ReportInfo'; +const EditQuestionPage = React.lazy( + () => import("../../question/EditPage"), + ); +const Page = () => { + return ( + <> + + + + ) +} + +export default Page \ No newline at end of file diff --git a/src/Pages/Admin/Report/Show/ReportInfo.tsx b/src/Pages/Admin/Report/Show/ReportInfo.tsx new file mode 100644 index 0000000..463195f --- /dev/null +++ b/src/Pages/Admin/Report/Show/ReportInfo.tsx @@ -0,0 +1,25 @@ +import React from 'react' +import { useGetAllReport } from '../../../../api/report' +import { useTranslation } from 'react-i18next' +import { ParamsEnum } from '../../../../enums/params'; +import { useParams } from 'react-router-dom'; + +const ReportInfo = () => { + const {report_id} = useParams(); + + const {data} = useGetAllReport({ + show:report_id + }) + const {t} = useTranslation(); + + return ( +
+
+

{t("practical.student_name")} :

{!!data?.data?.student?.first_name ?data?.data?.student?.first_name + " " + data?.data?.student?.last_name: " "}

+

{t("practical.report_content")} :

{data?.data?.content}

+
+
+ ) +} + +export default ReportInfo \ No newline at end of file diff --git a/src/Pages/Admin/Report/useTableColumns.tsx b/src/Pages/Admin/Report/useTableColumns.tsx index 34780af..778270d 100644 --- a/src/Pages/Admin/Report/useTableColumns.tsx +++ b/src/Pages/Admin/Report/useTableColumns.tsx @@ -1,11 +1,14 @@ import { TableColumnsType } from "antd"; -import { report } from "../../../types/Item"; import { ModalEnum } from "../../../enums/Model"; import { useObjectToEdit } from "../../../zustand/ObjectToEditState"; import { useModalState } from "../../../zustand/Modal"; import { useTranslation } from "react-i18next"; -import { canDeleteReport, canEditReport } from "../../../utils/hasAbilityFn"; +import { canDeleteReport, canEditReport, canShowReport } from "../../../utils/hasAbilityFn"; import ActionButtons from "../../../Components/Table/ActionButtons"; +import ColumnsImage from "../../../Components/Columns/ColumnsImage"; +import { useFilterStateState } from "../../../zustand/Filter"; +import { useNavigate } from "react-router-dom"; +import { Report } from "../../../types/Report"; export const useColumns = () => { const [t] = useTranslation(); @@ -13,26 +16,57 @@ export const useColumns = () => { const { setIsOpen } = useModalState((state) => state); const { setObjectToEdit } = useObjectToEdit((state) => state); - const handelDelete = (record: any) => { - setObjectToEdit(record); - setIsOpen(ModalEnum?.REPORT_DELETE); - }; - const handleEdit = (record: any) => { - setObjectToEdit(record); - setIsOpen(ModalEnum?.REPORT_EDIT); + + const navigate = useNavigate(); + const { setFilter } = useFilterStateState(); + + const handelShow = (record: any) => { + setFilter({}) + navigate(`${record?.id+"/"+record?.question?.id}`); + console.log(record); + + }; - const columns: TableColumnsType = [ + const columns: TableColumnsType = [ + { - title: t("columns.id"), - dataIndex: "id", - key: "id", + title: t("columns.content"), + dataIndex: "content", + key: "content", align: "center", }, { - title: t("columns.name"), - dataIndex: "name", - key: "name", + title: t("columns.created_at"), + dataIndex: "created_at", + key: "created_at", + align: "center", + }, + // { + // title: t("columns.image"), + // dataIndex: "image", + // key: "image", + // align: "center", + // render: (_text: any, record: Report) => { + // let str = record?.image; + + // return ; + // }, + // }, + { + title: t("columns.question_name"), + dataIndex: "question_id", + key: "question_id", + render: (_text: any, record: any) => record?.question?.content, + ellipsis:true, + align: "center", + }, + + { + title: t("columns.student_name"), + dataIndex: "student_id", + key: "student_id", + render: (_text: any, record: any) => !!record?.student?.first_name ? record?.student?.first_name + " " +record?.student?.last_name : "" , align: "center", }, @@ -42,14 +76,15 @@ export const useColumns = () => { align: "center", width: "25vw", render: (_text, record, index) => { + return ( + !!record?.question?.id ? handelDelete(record)} - onEdit={() => handleEdit(record)} + onShow={() => handelShow(record)} /> + : " " ); }, }, diff --git a/src/Routes.tsx b/src/Routes.tsx index e0975da..fefcf26 100644 --- a/src/Routes.tsx +++ b/src/Routes.tsx @@ -41,7 +41,9 @@ const EditReSeller = React.lazy(() => import("./Pages/Admin/Reseller/Edit/Page") const User = React.lazy(() => import("./Pages/Admin/User/Page")); const QuestionBank = React.lazy(() => import("./Pages/Admin/QuestionBank/Page")); -const Notifications = React.lazy(() => import("./Pages/Admin/Notifications/Page")); +const AllNotifications = React.lazy(() => import("./Pages/Admin/Notifications/Page")); +const Notifications = React.lazy(() => import("./Pages/Admin/Notifications/AddNotification/Page")); + const Profile = React.lazy(() => import("./Pages/Admin/Profile/Page")); const Setting = React.lazy(() => import("./Pages/Admin/Setting/Page")); @@ -51,6 +53,7 @@ const Roles = React.lazy(() => import("./Pages/Admin/Roles/Page")); const Coupon = React.lazy(() => import("./Pages/Admin/Coupon/Page")); const Report = React.lazy(() => import("./Pages/Admin/Report/Page")); +const ShowReport = React.lazy(() => import("./Pages/Admin/Report/Show/Page")); const Param = React.lazy(() => import("./Pages/Admin/Param/Page")); /// RESELLER /// @@ -69,6 +72,7 @@ import { TbCategory } from "react-icons/tb"; import { UserTypeEnum } from "./enums/UserType"; import { FaTags } from "react-icons/fa6"; import { CiSquareQuestion } from "react-icons/ci"; +import { IoNotifications } from "react-icons/io5"; export const menuItems: TMenuItem[] = [ { @@ -156,17 +160,26 @@ export const menuItems: TMenuItem[] = [ prevPath: 0, }, - // { - // header: "page_header.report", - // element: , - // icon: , - // text: "sidebar.report", - // path: `/${ABILITIES_ENUM?.Report}`, - // abilities: ABILITIES_ENUM?.Report, - // abilities_value: ABILITIES_VALUES_ENUM.INDEX, - // prevPath: 0, - // }, - + { + header: "page_header.report", + element: , + icon: , + text: "sidebar.report", + path: `/${ABILITIES_ENUM?.Report}`, + abilities: ABILITIES_ENUM?.Report, + abilities_value: ABILITIES_VALUES_ENUM.INDEX, + prevPath: 0, + }, + { + header: "page_header.add_notification", + element: , + icon: , + text: "sidebar.notification", + path: `/add_${ABILITIES_ENUM?.NOTIFICATIONS}`, + abilities: ABILITIES_ENUM?.NOTIFICATIONS, + abilities_value: ABILITIES_VALUES_ENUM.INDEX, + prevPath: 0, + }, // { // header: "page_header.param", // element: , @@ -358,7 +371,7 @@ export const CrudRoute: TCrudRoute[] = [ }, { header: "page_header.notifications", - element: , + element: , path: `/${ABILITIES_ENUM?.NOTIFICATIONS}`, abilities: ABILITIES_ENUM?.NOTIFICATIONS, abilities_value: ABILITIES_VALUES_ENUM.INDEX, @@ -416,6 +429,16 @@ export const CrudRoute: TCrudRoute[] = [ type:UserTypeEnum.RE_SELLER }, + + { + header: "page_header.report", + element: , + path: `/${ABILITIES_ENUM?.Report}/:${ParamsEnum?.REPORT_ID}/:${ParamsEnum?.QUESTION_ID}`, + abilities: ABILITIES_ENUM?.Report, + abilities_value: ABILITIES_VALUES_ENUM.INDEX, + prevPath: 0, + + }, ]; export const AppRoutes: Record = Object.fromEntries( diff --git a/src/Styles/Pages/Report.scss b/src/Styles/Pages/Report.scss new file mode 100644 index 0000000..697a918 --- /dev/null +++ b/src/Styles/Pages/Report.scss @@ -0,0 +1,24 @@ +.report_info{ + display: flex;align-items: center; + width: 98%; + margin-inline: auto; + margin-block: 10px; + div{ + padding: 20px; + width: 100%; + display: flex; + // align-items: center; + flex-direction: column; + gap: 20px; + h4{ + color: var(--text); + display: flex;align-items: center; + gap: 20px; + font-weight: bold; + p{ + font-size: 20px; + color: var(--subtext) !important; + } + } + } +} \ No newline at end of file diff --git a/src/Styles/Pages/index.scss b/src/Styles/Pages/index.scss index e0073ab..54c7e19 100644 --- a/src/Styles/Pages/index.scss +++ b/src/Styles/Pages/index.scss @@ -16,3 +16,5 @@ @import './collections.scss'; @import './setting.scss'; @import './sales.scss'; +@import './Report.scss'; + diff --git a/src/api/config.ts b/src/api/config.ts index c880d8b..88c6bac 100644 --- a/src/api/config.ts +++ b/src/api/config.ts @@ -1,4 +1,4 @@ -export const BaseURL = "https://nerd-back.point-dev.net/api/"; -// export const BaseURL = "http://192.168.1.106:8000/api/"; +// export const BaseURL = "https://nerd-back.point-dev.net/api/"; +export const BaseURL = "http://192.168.43.153:8080/api/"; export const HEADER_KEY = "X-Custom-Query-Key"; diff --git a/src/api/notification.ts b/src/api/notification.ts new file mode 100644 index 0000000..494d3f8 --- /dev/null +++ b/src/api/notification.ts @@ -0,0 +1,20 @@ +import useAddMutation from "./helper/useAddMutation"; +import useDeleteMutation from "./helper/useDeleteMutation"; +import useGetQuery from "./helper/useGetQuery"; +import useUpdateMutation from "./helper/useUpdateMutation"; + +const API = { + GET: "/notification", + ADD: "/notification", + DELETE: "/notification", + UPDATE: "/notification", +}; + +const KEY = "notification"; + +export const useGetAllNotification = (params?: any, options?: any) => + useGetQuery(KEY, API.GET, params, options); +export const useAddNotification = () => useAddMutation(KEY, API.ADD); +export const useUpdateNotification = (params?: any) => useUpdateMutation(KEY, API.GET); +export const useDeleteNotification = (params?: any) => + useDeleteMutation(KEY, API.DELETE); diff --git a/src/api/report.ts b/src/api/report.ts index a30d2dc..1ab0072 100644 --- a/src/api/report.ts +++ b/src/api/report.ts @@ -14,6 +14,9 @@ const KEY = "report"; export const useGetAllReport = (params?: any, options?: any) => useGetQuery(KEY, API.GET, params, options); + + + export const useAddReport = () => useAddMutation(KEY, API.ADD); export const useUpdateReport = (params?: any) => useUpdateMutation(KEY, API.GET); diff --git a/src/config/AppKey.ts b/src/config/AppKey.ts index 18c5308..ebdf408 100644 --- a/src/config/AppKey.ts +++ b/src/config/AppKey.ts @@ -1,4 +1,4 @@ -export const PROJECT_NAME = "SCHOOL_DASHBOARD_EXERCISE"; +export const PROJECT_NAME = "ZAKER_EXERCISE"; export const LANGUAGE_KEY = PROJECT_NAME + "_LANGUAGE"; export const Currency = "ل.س"; diff --git a/src/enums/Model.ts b/src/enums/Model.ts index ac7f393..6aa0ef6 100644 --- a/src/enums/Model.ts +++ b/src/enums/Model.ts @@ -249,4 +249,11 @@ export enum ModalEnum { Financial_Collection_EDIT = "Financial_Collection.edit", Financial_Collection_ADD = "Financial_Collection.add", Financial_Collection_DELETE = "Financial_Collection.delete", + + ///NOTIFICATION + + NOTIFICATION_EDIT = "NOTIFICATION.edit", + NOTIFICATION_ADD = "NOTIFICATION.add", + NOTIFICATION_DELETE = "NOTIFICATION.delete", + } diff --git a/src/enums/params.ts b/src/enums/params.ts index e566f69..47c81cb 100644 --- a/src/enums/params.ts +++ b/src/enums/params.ts @@ -16,6 +16,7 @@ export enum ParamsEnum { CITY_ID = "city_id", Collection_ID = "collection_id", Manager_ID = "manager_id", + REPORT_ID = "report_id" // RESELLER_ID = "reseller_id", diff --git a/src/translate/ar.json b/src/translate/ar.json index c9e2730..cb1f73f 100644 --- a/src/translate/ar.json +++ b/src/translate/ar.json @@ -243,7 +243,8 @@ "unit":"الوحدة", "lesson":"الدرس", "code":"رمز", - "due_to":"صالح الى" + "due_to":"صالح الى", + "question_name":"اسم السؤال" }, "practical": { "to_confirm_deletion_please_re_enter": "لتأكيد الحذف، يرجى إعادة الإدخال", @@ -326,7 +327,9 @@ "sale":"بيع", "financial_collection":"التحصيلات", "show_collection":"حصيلة", - "does_not_exist_notification":"عذرا لا يوجد إشعارات..." + "does_not_exist_notification":"عذرا لا يوجد إشعارات...", + "student_name":"اسم الطالب", + "report_content":"محتوى التقرير" }, "Table": { "header": "", @@ -422,7 +425,8 @@ "financial_collection":"التحصيلات", "show_collection":"حصيلة", "city":"مدينة", - "financialCollection":"التحصيلات" + "financialCollection":"التحصيلات", + "notification":"الاشعارات" }, "education_class_actions": { "Student_Records": "سجلات الطلاب", @@ -565,7 +569,8 @@ "activation_date":"تاريخ التنشيط", "expiration_date":"تاريخ الالغاء", "package":"حزمة", - "contact_number":"رقم الهاتف" + "contact_number":"رقم الهاتف", + "question_content":"محتوى السؤال" }, "select": { "enums": { @@ -904,7 +909,8 @@ "Area":"المنطقة", "city":"مدينة", "coupon":"قسيمة", - "financial_collection":"التحصيلات" + "financial_collection":"التحصيلات", + "notification":"الاشعارات" }, "message": { "some_thing_went_wrong": "حدث خطأ ما", @@ -956,7 +962,8 @@ "edit_reseller":"تعديل البائع", "Coupon":"قسيمة", "financial_collection":"التحصيلات", - "show_collection":"حصيلة" + "show_collection":"حصيلة", + "notification":"الاشعارات" }, "page_header": { "home": "لوحة القيادة", @@ -1014,7 +1021,8 @@ "city":"مدينة", "questionBank":"بنك الأسئلة", "roles":"الدور", - "coupon":"قسيمة" + "coupon":"قسيمة", + "notification":"الاشعارات" }, "table": { "student": "قائمة الطلاب", diff --git a/src/types/Item.ts b/src/types/Item.ts index 3c58ee3..ca713ff 100644 --- a/src/types/Item.ts +++ b/src/types/Item.ts @@ -320,11 +320,7 @@ export interface Question { meta?:{} } -export type report = { - id: number; - key?: number; - name: string; -}; + export type user = { id: number; diff --git a/src/types/Notification.ts b/src/types/Notification.ts new file mode 100644 index 0000000..c816f62 --- /dev/null +++ b/src/types/Notification.ts @@ -0,0 +1,14 @@ +import { Nullable } from "./App"; + +// Define the Teacher interface + +export interface Notification { + id: number; // Unique identifier for the user + name: string; // Name of the user + title:string; + body:string; + seen:string; + notifiable_type:string; + + +} \ No newline at end of file diff --git a/src/types/Report.ts b/src/types/Report.ts new file mode 100644 index 0000000..7997556 --- /dev/null +++ b/src/types/Report.ts @@ -0,0 +1,13 @@ +import { Nullable } from "./App"; + +// Define the Teacher interface + + +export type Report = { + id: number; // Unique identifier for the user + content: string; // Name of the user + image: any; // URL of the user's icon + question_id: number; // URL of the user's icon + student_id: number; // URL of the user's icon + +}; diff --git a/src/utils/hasAbilityFn.ts b/src/utils/hasAbilityFn.ts index 903e1d5..e8bace6 100644 --- a/src/utils/hasAbilityFn.ts +++ b/src/utils/hasAbilityFn.ts @@ -547,12 +547,7 @@ export const canAddStatus = hasAbility(ABILITIES_ENUM.ABSENCE, ABILITIES_VALUES_ENUM.STORE) && hasAbility(ABILITIES_ENUM.LATE_ARRIVAL, ABILITIES_VALUES_ENUM.STORE); -/// notification -export const canAddNotification = hasAbility( - ABILITIES_ENUM.NOTE, - ABILITIES_VALUES_ENUM.STORE, -); /// MarksReport @@ -694,6 +689,10 @@ export const canDeleteReport = hasAbility( ABILITIES_ENUM.Report, ABILITIES_VALUES_ENUM.DELETE, ); +export const canShowReport = hasAbility( + ABILITIES_ENUM.Report, + ABILITIES_VALUES_ENUM.SHOW, +); /// User @@ -844,4 +843,31 @@ export const canDeleteFinancial_Collection = hasAbility( export const canShowCollection = hasAbility( ABILITIES_ENUM.Collections, ABILITIES_VALUES_ENUM.SHOW, +); + + + + + +///// Notification + +export const canAddNotification = hasAbility( + ABILITIES_ENUM.EDUCATION_CLASS, + ABILITIES_VALUES_ENUM.STORE, +); +export const canEditNotification = hasAbility( + ABILITIES_ENUM.EDUCATION_CLASS, + ABILITIES_VALUES_ENUM.UPDATE, +); +export const canDeleteNotification = hasAbility( + ABILITIES_ENUM.EDUCATION_CLASS, + ABILITIES_VALUES_ENUM.DELETE, +); +export const canShowNotification = hasAbility( + ABILITIES_ENUM.EDUCATION_CLASS, + ABILITIES_VALUES_ENUM.SHOW, +); +export const canIndexNotification = hasAbility( + ABILITIES_ENUM.EDUCATION_CLASS, + ABILITIES_VALUES_ENUM.INDEX, ); \ No newline at end of file