From 6b41dc9413a41691dc57f96a9a0d21d9c72ec11e Mon Sep 17 00:00:00 2001 From: Amin Ghasempoor Date: Sun, 28 Sep 2025 11:01:07 +0000 Subject: [PATCH] Feature/reports refahi --- .../LoanDetails/FunctionalityCharts.jsx | 6 +-- .../LoanDetails/UniqDetailComponent.jsx | 2 +- .../reports/refahi/LoanDetails/index.jsx | 25 ++++++----- .../dashboard/reports/refahi/index.jsx | 6 +-- src/core/data/apiRoutes.js | 2 + src/core/data/sidebarMenu.jsx | 41 +++++++++---------- 6 files changed, 39 insertions(+), 43 deletions(-) diff --git a/src/components/dashboard/reports/refahi/LoanDetails/FunctionalityCharts.jsx b/src/components/dashboard/reports/refahi/LoanDetails/FunctionalityCharts.jsx index 56e159a..bf1f6ac 100644 --- a/src/components/dashboard/reports/refahi/LoanDetails/FunctionalityCharts.jsx +++ b/src/components/dashboard/reports/refahi/LoanDetails/FunctionalityCharts.jsx @@ -12,17 +12,13 @@ const FunctionalityCharts = ({ reportList, name }) => { {Object.entries(reportList).map(([entryKey, innerObject]) => { - let percentage = - innerObject.total_budget !== 0 - ? (innerObject.total_amount / innerObject.total_budget) * 100 - : 0; const numColumns = Object.entries(reportList).length; let columnSize = 12 / numColumns; return ( diff --git a/src/components/dashboard/reports/refahi/LoanDetails/UniqDetailComponent.jsx b/src/components/dashboard/reports/refahi/LoanDetails/UniqDetailComponent.jsx index aeb185e..d7a3c7a 100644 --- a/src/components/dashboard/reports/refahi/LoanDetails/UniqDetailComponent.jsx +++ b/src/components/dashboard/reports/refahi/LoanDetails/UniqDetailComponent.jsx @@ -33,7 +33,7 @@ const UniqDetailComponent = ({ item, percentage, title }) => { }} > {t("reports.dynamic_total_budget", { - total_budget: (item.total_budget / 1000000).toLocaleString("en"), + total_budget: item.total_budget ? (item.total_budget / 1000000).toLocaleString("en") : "-", })} diff --git a/src/components/dashboard/reports/refahi/LoanDetails/index.jsx b/src/components/dashboard/reports/refahi/LoanDetails/index.jsx index 2ea305a..aef94fe 100644 --- a/src/components/dashboard/reports/refahi/LoanDetails/index.jsx +++ b/src/components/dashboard/reports/refahi/LoanDetails/index.jsx @@ -3,10 +3,9 @@ import { useTranslations } from "next-intl"; import Filter from "../Filter"; import useChart from "@/lib/app/hooks/useChart"; import { - //GET_LOAN_EXPERTPROGRESS_CARTABLE_REFAHI , GET_LOAN_EXPERTPROGRESS_PLANING_COUNCIL_REFAHI, GET_LOAN_EXPERTPROGRESS_BANK_REPORT_REFAHI - GET_LOAN_EXPERTPROGRESS_BANK_REPORT, - GET_LOAN_EXPERTPROGRESS_CARTABLE, - GET_LOAN_EXPERTPROGRESS_PLANING_COUNCIL, + GET_LOAN_EXPERTPROGRESS_CARTABLE_REFAHI, + GET_LOAN_EXPERTPROGRESS_PLANING_COUNCIL_REFAHI, + GET_LOAN_EXPERTPROGRESS_BANK_REPORT_REFAHI, } from "@/core/data/apiRoutes"; import LoadingHardPage from "@/core/components/LoadingHardPage"; import AnalyticsIcon from "@mui/icons-material/Analytics"; @@ -21,21 +20,21 @@ const LoanDetails = () => { reportList: reportList1, setFilterOption: setFilterOption1, mutate: mutate1, - } = useChart(GET_LOAN_EXPERTPROGRESS_CARTABLE); + } = useChart(GET_LOAN_EXPERTPROGRESS_CARTABLE_REFAHI); const { errorReportList: errorReportList2, isLoadingReportList: isLoadingReportList2, reportList: reportList2, setFilterOption: setFilterOption2, mutate: mutate2, - } = useChart(GET_LOAN_EXPERTPROGRESS_PLANING_COUNCIL); + } = useChart(GET_LOAN_EXPERTPROGRESS_PLANING_COUNCIL_REFAHI); const { errorReportList: errorReportList3, isLoadingReportList: isLoadingReportList3, reportList: reportList3, setFilterOption: setFilterOption3, mutate: mutate3, - } = useChart(GET_LOAN_EXPERTPROGRESS_BANK_REPORT); + } = useChart(GET_LOAN_EXPERTPROGRESS_BANK_REPORT_REFAHI); return ( @@ -84,20 +83,20 @@ const LoanDetails = () => { ) : ( - + - + - + - + - + )} diff --git a/src/components/dashboard/reports/refahi/index.jsx b/src/components/dashboard/reports/refahi/index.jsx index 87a22b9..501d4fe 100644 --- a/src/components/dashboard/reports/refahi/index.jsx +++ b/src/components/dashboard/reports/refahi/index.jsx @@ -1,6 +1,6 @@ import LoanDetails from "./LoanDetails"; import ExcelExport from "./ExcelExport"; -import { GET_EXCEL_EXPORT, GET_EXCEL_EXPORT_status } from "@/core/data/apiRoutes"; +import { GET_EXCEL_EXPORT_REFAHI, GET_EXCEL_EXPORT_REFAHI_status } from "@/core/data/apiRoutes"; import { useTranslations } from "next-intl"; const DashboardReportsComponent = (props) => { @@ -9,12 +9,12 @@ const DashboardReportsComponent = (props) => { return ( <> diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js index 2817059..ade5a6b 100644 --- a/src/core/data/apiRoutes.js +++ b/src/core/data/apiRoutes.js @@ -168,6 +168,8 @@ export const GET_LOAN_EXPERTPROGRESS_CARTABLE_REFAHI = BASE_URL + "/dashboard/re export const GET_LOAN_EXPERTPROGRESS_PLANING_COUNCIL_REFAHI = BASE_URL + "/dashboard/reports/refahi/planning_council_reports"; export const GET_LOAN_EXPERTPROGRESS_BANK_REPORT_REFAHI = BASE_URL + "/dashboard/reports/refahi/bank_reports"; +export const GET_EXCEL_EXPORT_REFAHI = BASE_URL + "/dashboard/exports/refahi/expert_progress"; +export const GET_EXCEL_EXPORT_REFAHI_status = BASE_URL + "/dashboard/exports/refahi/loans_state"; export const GET_LOAN_REFERREDLOANS = BASE_URL + "/dashboard/reports/navgan/referred_loans"; // reports diff --git a/src/core/data/sidebarMenu.jsx b/src/core/data/sidebarMenu.jsx index 82058a6..d6765f6 100644 --- a/src/core/data/sidebarMenu.jsx +++ b/src/core/data/sidebarMenu.jsx @@ -28,27 +28,26 @@ const sidebarMenu = [ selected: false, permissions: ["all"], }, - // TODO : should un-command this part after reports get fixed - // { - // key: "sidebar.reports", - // name: "reports", - // secondary: "secondary.reports", - // type: "page", - // route: "/dashboard/reports/navgan", - // icon: , - // selected: false, - // permissions: ["view_reports_navgan"], - // }, - // { - // key: "sidebar.reports-refahi", - // name: "reports-refahi", - // secondary: "secondary.reports-refahi", - // type: "page", - // route: "/dashboard/reports/refahi", - // icon: , - // selected: false, - // permissions: ["view_reports_refahi"], - // }, + { + key: "sidebar.reports", + name: "reports", + secondary: "secondary.reports", + type: "page", + route: "/dashboard/reports/navgan", + icon: , + selected: false, + permissions: ["view_reports_navgan"], + }, + { + key: "sidebar.reports-refahi", + name: "reports-refahi", + secondary: "secondary.reports-refahi", + type: "page", + route: "/dashboard/reports/refahi", + icon: , + selected: false, + permissions: ["view_reports_refahi"], + }, { key: "sidebar.loan-history", secondary: "secondary.loan-history",