diff --git a/src/langs/fa.json b/src/langs/fa.json
index 64f597c..7c9f371 100644
--- a/src/langs/fa.json
+++ b/src/langs/fa.json
@@ -103,7 +103,15 @@
"add_access": "دسترسی سریع تازه ایجاد کنید.",
"danak_learning": "آموزش داناک",
"see_all": "دیدن همه",
- "create_new_access": "ایجاد دسترسی سریع"
+ "create_new_access": "ایجاد دسترسی سریع",
+ "services": "سرویس ها",
+ "service": "سرویس",
+ "customers": "مشتریان",
+ "customer": "مشتری",
+ "invoices": "صورت حساب ها",
+ "new_invoice": "صورت حساب جدید",
+ "ads": "تبلیغات",
+ "active_ads": "تبلیغ فعال"
},
"all": "همه",
"service": {
diff --git a/src/pages/home/Home.tsx b/src/pages/home/Home.tsx
index e21ad25..3ae8333 100644
--- a/src/pages/home/Home.tsx
+++ b/src/pages/home/Home.tsx
@@ -1,127 +1,64 @@
import { FC } from 'react'
-import BannerImage from '../../assets/images/banner.png'
import { useTranslation } from 'react-i18next'
-import { ArrowLeft, Element3, Messages3, NotificationStatus, Teacher } from 'iconsax-react'
+import { Element3, Messages3, NotificationStatus, People, Receipt2 } from 'iconsax-react'
import ItemDashboard from './components/ItemDashboard'
-import TitleLine from '../../components/TitleLine'
-import AccessbilityImage from '../../assets/images/accessbility.jpg'
-import BoxNewAccessbility from './components/BoxNewAccessbility'
-import DanakLearning from './components/DanakLearning'
-import { Carousel } from "@material-tailwind/react";
+import { useGetDashboard } from './hooks/useHomeData'
const Home: FC = () => {
const { t } = useTranslation('global')
+ const getDashboard = useGetDashboard()
return (
-
null} nextArrow={() => null} autoplay={false} className="rounded-xl h-fit dltr" placeholder="" onPointerEnterCapture={() => { }} onPointerLeaveCapture={() => { }} >
-
-

-
-
-
-
-
-
-
- سفارش نرمافزار اختصاصی: سرمایهای برای آینده یا فقط هزینهای برای امروز؟
-
-
- ۸ دقیقه مطالعه
-
-
-
-
-
-
-

-
-
-
-
-
-
-
- سفارش نرمافزار اختصاصی: سرمایهای برای آینده یا فقط هزینهای برای امروز؟
-
-
- ۸ دقیقه مطالعه
-
-
-
-
-
-
}
color='#00D16C'
- count={4}
- description={t('home.active_service')}
+ count={getDashboard.data?.data?.danakServicesCount}
+ description={t('home.service')}
+ />
+
+ }
+ color='#00D16C'
+ count={getDashboard.data?.data?.customersCount}
+ description={t('home.customer')}
/>
}
color='#FF7B00'
- count={4}
+ count={getDashboard.data?.data?.unreadTickets}
description={t('home.unread_messages')}
/>
}
color='#FF0000'
- count={4}
- description={t('home.unread_announcement')}
+ count={getDashboard.data?.data?.adsCount}
+ description={t('home.active_ads')}
/>
}
+ title={t('home.invoices')}
+ icon={}
color='#0047FF'
- count={4}
- description={t('home.learning')}
+ count={getDashboard.data?.data?.invoicesCount}
+ description={t('home.new_invoice')}
/>
-
-
-
-
-
-

-
- {t('home.add_access')}
-
-
-
-
-
-
-
)
}
diff --git a/src/pages/home/components/ItemDashboard.tsx b/src/pages/home/components/ItemDashboard.tsx
index f83b6ab..f9ab263 100644
--- a/src/pages/home/components/ItemDashboard.tsx
+++ b/src/pages/home/components/ItemDashboard.tsx
@@ -11,7 +11,7 @@ type Props = {
const ItemDashboard: FC = (props: Props) => {
return (
-
+
{props.icon}
diff --git a/src/pages/home/hooks/useHomeData.ts b/src/pages/home/hooks/useHomeData.ts
new file mode 100644
index 0000000..c2e0289
--- /dev/null
+++ b/src/pages/home/hooks/useHomeData.ts
@@ -0,0 +1,9 @@
+import { useQuery } from "@tanstack/react-query";
+import * as api from "../service/HomeService";
+
+export const useGetDashboard = () => {
+ return useQuery({
+ queryKey: ["dashboard"],
+ queryFn: api.getDashboard,
+ });
+};
diff --git a/src/pages/home/service/HomeService.ts b/src/pages/home/service/HomeService.ts
new file mode 100644
index 0000000..1ff8895
--- /dev/null
+++ b/src/pages/home/service/HomeService.ts
@@ -0,0 +1,6 @@
+import axios from "../../../config/axios";
+
+export const getDashboard = async () => {
+ const { data } = await axios.get(`/dashboards/reports`);
+ return data;
+};