diff --git a/public/images/pie-chart.png b/public/images/pie-chart.png new file mode 100644 index 0000000..1a581de Binary files /dev/null and b/public/images/pie-chart.png differ diff --git a/public/images/rial.png b/public/images/rial.png new file mode 100644 index 0000000..fd9d24e Binary files /dev/null and b/public/images/rial.png differ diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index c4fcf77..1cfa2f8 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -121,7 +121,12 @@ "edit_profile": "ویرایش پروفایل", "expert_management": "مدیریت کارشناسان", "user_management_page": "مدیریت کاربر", - "loan_history": "کارتابل نظارت" + "loan_history": "کارتابل نظارت", + "total_number_loan_offers": "تعداد کل وام های پیشنهادی", + "total_amount_proposed_loan": "مبلغ کل وام های پیشنهادی", + "total_number_requests": "تعداد کل درخواست ها", + "total_amount_approved_loans": "مبلغ کل وام های تصویب شده", + "number_approved_loans": "تعداد وام های تصویب شده" }, "MuiDatePicker": { "date_picker_birthday": "تاریخ" diff --git a/src/components/dashboard/first/index.jsx b/src/components/dashboard/first/index.jsx index 43b6c87..310569f 100644 --- a/src/components/dashboard/first/index.jsx +++ b/src/components/dashboard/first/index.jsx @@ -1,90 +1,246 @@ import FullPageLayout from "@/layouts/FullPageLayout"; import CenterLayout from "@/layouts/CenterLayout"; -import {Box, Divider, Stack, Typography} from "@mui/material"; -import {useEffect, useState} from "react"; +import {Box, Stack, Typography, Card, CardContent, CardHeader, useTheme, useMediaQuery} from "@mui/material"; +import { useEffect, useState } from "react"; import useRequest from "@/lib/app/hooks/useRequest"; +import {useTranslations} from "next-intl"; +import {GET_LOAN_STATISTICS} from "@/core/data/apiRoutes"; const DashboardFirstComponent = () => { - const requestServer = useRequest({auth: true, notification: false}); - const [data, setData] = useState(null); + const theme = useTheme(); + const t = useTranslations(); + const requestServer = useRequest({ auth: true, notification: false }); + const [data, setData] = useState(null); + const isXL = useMediaQuery(theme.breakpoints.up('xl')); - useEffect(() => { - requestServer(`${process.env.NEXT_PUBLIC_BASE_URL}/dashboard/reports/navgan/statistics`, "get") - .then((res) => { - setData(res.data.data); - }) - .catch(() => { - }); - }, []); + useEffect(() => { + requestServer( + `${GET_LOAN_STATISTICS}`, + "get" + ) + .then((res) => { + setData(res.data.data); + }) + .catch(() => {}); + }, []); - if (!data) return ""; + if (!data) return ""; - return (<> - - - - وام های واجد شرایط - + + + + + + + - تعداد کل - - {Number(data.totalApprovedLoans).toLocaleString("en")} - - - وام های پیشنهادی - - تعداد کل - + {Number(data.proposedCount).toLocaleString("en")} - - + + + + + + + - مبلغ کل (میلیون ریال) - - {Number(data.totalProposedAmount / 1000000).toLocaleString("en")} + + {(Number(data.totalProposedAmount)/1000000).toLocaleString("en")} + + {t("million_rial")} + - - وام های تصویب شده - + + + + + + + - تعداد کل - + + {Number(data.totalApprovedLoans).toLocaleString("en")} + + + + + + + + + + + {(Number(data.totalApprovedAmount) / 1000000).toLocaleString("en")} + + {t("million_rial")} + + + + + + + + + + + {Number(data.approvedCount).toLocaleString("en")} - - - مبلغ کل (میلیون ریال) - - {Number(data.totalApprovedAmount / 1000000).toLocaleString("en")} - - - - - - ); + + + + + + + + + ); }; export default DashboardFirstComponent; \ No newline at end of file diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js index e96af16..615dda4 100644 --- a/src/core/data/apiRoutes.js +++ b/src/core/data/apiRoutes.js @@ -231,3 +231,7 @@ export const GET_LOAN_DISTRIBUTION = BASE_URL + "/dashboard/reports/navgan/loan_ export const GET_LOAN_HISTORY = BASE_URL + "/dashboard/navgan_loans" export const GET_HISTORY_DETAIL = BASE_URL + "/dashboard/navgan_loans" export const EXPORT_LOAN_HISTORY = BASE_URL + "/dashboard/navgan_loans/export" + +// loan statistics +export const GET_LOAN_STATISTICS = BASE_URL + "/dashboard/reports/navgan/statistics" +