diff --git a/.env b/.env
index a20f615..19e0993 100644
--- a/.env
+++ b/.env
@@ -1,4 +1,4 @@
VITE_TOKEN_NAME = 'admin_token'
VITE_REFRESH_TOKEN_NAME = 'admin_refresh_token'
# VITE_BASE_URL = 'https://api.danakcorp.com'
-VITE_BASE_URL = 'http://192.168.99.181:3500'
\ No newline at end of file
+VITE_BASE_URL = 'http://10.73.49.88:3500'
\ No newline at end of file
diff --git a/src/config/Pages.ts b/src/config/Pages.ts
index 67426c0..72b72ec 100644
--- a/src/config/Pages.ts
+++ b/src/config/Pages.ts
@@ -156,4 +156,7 @@ export const Pages = {
subscriptions: {
list: "/customers/subscriptions",
},
+ reseller: {
+ list: "/reseller/list",
+ },
};
diff --git a/src/langs/fa.json b/src/langs/fa.json
index 0fcc45c..180a4e3 100644
--- a/src/langs/fa.json
+++ b/src/langs/fa.json
@@ -85,7 +85,15 @@
"subscriptions": "اشتراک ها",
"financial": "مالی",
"dmail": "دی میل",
- "domain": "دامنه"
+ "domain": "دامنه",
+ "reseller": "نماینده",
+ "resellers": "نمایندگان"
+ },
+ "reseller": {
+ "list": "لیست نمایندکان",
+ "add_new": "افزودن نماینده جدید",
+ "name": "نام نمایندگی",
+ "user": "کاربر"
},
"dmail": {
"domain": "لیست دامنه ها"
diff --git a/src/pages/reseller/List.tsx b/src/pages/reseller/List.tsx
new file mode 100644
index 0000000..c9403e5
--- /dev/null
+++ b/src/pages/reseller/List.tsx
@@ -0,0 +1,70 @@
+import { type FC } from 'react'
+import { useTranslation } from 'react-i18next'
+import { Link } from 'react-router-dom'
+import { Pages } from '../../config/Pages'
+import Button from '../../components/Button'
+import { Add } from 'iconsax-react'
+import { useGetResellers } from './hooks/useResellerData'
+import PageLoading from '../../components/PageLoading'
+import Td from '../../components/Td'
+import { ResellerItemType } from './types/Types'
+
+const ResellerList: FC = () => {
+
+ const { t } = useTranslation('global')
+ const getReseller = useGetResellers()
+
+ return (
+
+
+
+ {t('reseller.list')}
+
+
+
+
+
+
+
+ {
+ getReseller.isPending ?
+
+ :
+
+
+
+
+ |
+ |
+
+
+
+ {
+ getReseller?.data?.data?.map((item: ResellerItemType) => {
+ return (
+
+ |
+ |
+
+ )
+ })
+ }
+
+
+
+ }
+
+
+ )
+}
+
+export default ResellerList
\ No newline at end of file
diff --git a/src/pages/reseller/hooks/useResellerData.ts b/src/pages/reseller/hooks/useResellerData.ts
new file mode 100644
index 0000000..0b6dc52
--- /dev/null
+++ b/src/pages/reseller/hooks/useResellerData.ts
@@ -0,0 +1,9 @@
+import { useQuery } from "@tanstack/react-query";
+import * as api from "../service/ResellerService";
+
+export const useGetResellers = () => {
+ return useQuery({
+ queryKey: ["resellers"],
+ queryFn: api.getResellers,
+ });
+};
diff --git a/src/pages/reseller/service/ResellerService.ts b/src/pages/reseller/service/ResellerService.ts
new file mode 100644
index 0000000..578d121
--- /dev/null
+++ b/src/pages/reseller/service/ResellerService.ts
@@ -0,0 +1,6 @@
+import axios from "../../../config/axios";
+
+export const getResellers = async () => {
+ const { data } = await axios.get(`/reseller`);
+ return data;
+};
diff --git a/src/pages/reseller/types/Types.ts b/src/pages/reseller/types/Types.ts
new file mode 100644
index 0000000..2a3d1bc
--- /dev/null
+++ b/src/pages/reseller/types/Types.ts
@@ -0,0 +1,8 @@
+import { UserItemType } from "../../users/types/UserTypes";
+
+export type ResellerItemType = {
+ createdAt: string;
+ id: string;
+ name: string;
+ owner: UserItemType;
+};
diff --git a/src/router/Main.tsx b/src/router/Main.tsx
index 7a331c0..7df24db 100644
--- a/src/router/Main.tsx
+++ b/src/router/Main.tsx
@@ -91,6 +91,7 @@ import DkalaSmsCountList from '../pages/dkala/shop/SmsCountList.tsx'
import UpdateShop from '../pages/dkala/shop/Update.tsx'
import SubscriptionsList from '../pages/subscriptions/List.tsx'
import Domains from '../pages/dmail/Domains.tsx'
+import ResellerList from '../pages/reseller/List.tsx'
// import WarningsList from '../pages/dmenu/reports/List' // TODO: Create this component
const MainRouter: FC = () => {
@@ -198,6 +199,8 @@ const MainRouter: FC = () => {
} />
} />
+
+ } />
diff --git a/src/shared/SideBar.tsx b/src/shared/SideBar.tsx
index b2663c8..5863623 100644
--- a/src/shared/SideBar.tsx
+++ b/src/shared/SideBar.tsx
@@ -2,7 +2,7 @@ import { FC, useEffect, useState } from 'react'
import LogoImage from '../assets/images/logo.svg'
import LogoSmall from '../assets/images/logo-small.svg'
import { useTranslation } from 'react-i18next'
-import { Card, Code, CodeCircle, DocumentLike, DocumentText, Element3, Gallery, Headphone, Home2, Logout, Messages3, Money3, NotificationStatus, People, Profile, Receipt21, Setting2, SmsTracking, Teacher, TicketDiscount, UserSquare, Activity, Icon, Category, Warning2, Building, Sms, Chart21, ArrowDown2, Global } from 'iconsax-react'
+import { Card, Code, CodeCircle, DocumentLike, DocumentText, Element3, Gallery, Headphone, Home2, Logout, Messages3, Money3, NotificationStatus, People, Profile, Receipt21, Setting2, SmsTracking, Teacher, TicketDiscount, UserSquare, Activity, Icon, Category, Warning2, Building, Sms, Chart21, ArrowDown2, Global, UserTick } from 'iconsax-react'
import SideBarItem from './SideBarItem'
import { useLocation } from 'react-router-dom'
import { Pages } from '../config/Pages'
@@ -326,6 +326,43 @@ const SideBar: FC = () => {
}
+ {
+ adminPermissions?.data?.permissions?.some((permission: { name: string }) => permission.name === 'reseller') &&
+ <>
+ handleOpenMenu('reseller')} className={clx(
+ 'mt-10 px-12 text-header text-sm font-normal cursor-pointer',
+ hasSubMenu && 'px-2 text-center',
+ !hasSubMenu && 'flex gap-2 items-center'
+ )}>
+ {t('sidebar.reseller')}
+
+
+
+
+
+
+ }
+ title={t('sidebar.resellers')}
+ isActive={isActive('reseller/list')}
+ link={Pages.reseller.list}
+ activeName='reseller'
+ />
+
+
+ >
+ }
+