Merge branch 'feature/reports_refahi' into 'develop'
Feature/reports refahi See merge request witel-front-end/loan-facilities/expert-v2!28
This commit is contained in:
@@ -12,17 +12,13 @@ const FunctionalityCharts = ({ reportList, name }) => {
|
||||
</Typography>
|
||||
<Grid container sx={{ width: "100%", mt: 3 }} spacing={1}>
|
||||
{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 (
|
||||
<Grid key={entryKey} item xs={12} sm={6} md={columnSize}>
|
||||
<UniqDetailComponent
|
||||
title={t(`reports.${entryKey}`)}
|
||||
percentage={percentage}
|
||||
percentage={innerObject.percentage}
|
||||
item={innerObject}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
@@ -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") : "-",
|
||||
})}
|
||||
</Typography>
|
||||
</Box>
|
||||
|
||||
@@ -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 (
|
||||
<Paper elevation={2} sx={{ width: "95%", mx: "auto", my: 2, pb: 2, background: "#f7f7f7e6" }}>
|
||||
@@ -84,20 +83,20 @@ const LoanDetails = () => {
|
||||
</Grid>
|
||||
) : (
|
||||
<Stack sx={{ width: "100%" }}>
|
||||
<FunctionalityCharts reportList={reportList1.bus} name={t("reports.report_build")} />
|
||||
<FunctionalityCharts reportList={reportList1.build} name={t("reports.report_build")} />
|
||||
<Divider />
|
||||
<FunctionalityCharts reportList={reportList1.minibus} name={t("reports.report_repair")} />
|
||||
<FunctionalityCharts reportList={reportList1.repair} name={t("reports.report_repair")} />
|
||||
<Divider />
|
||||
<FunctionalityCharts reportList={reportList2.bus} name={t("reports.planing_council_build")} />
|
||||
<FunctionalityCharts reportList={reportList2.build} name={t("reports.planing_council_build")} />
|
||||
<Divider />
|
||||
<FunctionalityCharts
|
||||
reportList={reportList2.minibus}
|
||||
reportList={reportList2.repair}
|
||||
name={t("reports.planing_council_repair")}
|
||||
/>
|
||||
<Divider />
|
||||
<FunctionalityCharts reportList={reportList3.bus} name={t("reports.bank_report_build")} />
|
||||
<FunctionalityCharts reportList={reportList3.build} name={t("reports.bank_report_build")} />
|
||||
<Divider />
|
||||
<FunctionalityCharts reportList={reportList3.minibus} name={t("reports.bank_report_repair")} />
|
||||
<FunctionalityCharts reportList={reportList3.repair} name={t("reports.bank_report_repair")} />
|
||||
</Stack>
|
||||
)}
|
||||
</Grid>
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<ExcelExport
|
||||
url={GET_EXCEL_EXPORT}
|
||||
url={GET_EXCEL_EXPORT_REFAHI}
|
||||
title={t("filters.excel_export_reports")}
|
||||
filenameStr={"گزارش عملکرد"}
|
||||
/>
|
||||
<ExcelExport
|
||||
url={GET_EXCEL_EXPORT_status}
|
||||
url={GET_EXCEL_EXPORT_REFAHI_status}
|
||||
title={t("filters.excel_export_reports_status")}
|
||||
filenameStr={"گزارش وضعیت وام های کشور"}
|
||||
/>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
// selected: false,
|
||||
// permissions: ["view_reports_navgan"],
|
||||
// },
|
||||
// {
|
||||
// key: "sidebar.reports-refahi",
|
||||
// name: "reports-refahi",
|
||||
// secondary: "secondary.reports-refahi",
|
||||
// type: "page",
|
||||
// route: "/dashboard/reports/refahi",
|
||||
// icon: <BarChartIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
// selected: false,
|
||||
// permissions: ["view_reports_refahi"],
|
||||
// },
|
||||
{
|
||||
key: "sidebar.reports",
|
||||
name: "reports",
|
||||
secondary: "secondary.reports",
|
||||
type: "page",
|
||||
route: "/dashboard/reports/navgan",
|
||||
icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
selected: false,
|
||||
permissions: ["view_reports_navgan"],
|
||||
},
|
||||
{
|
||||
key: "sidebar.reports-refahi",
|
||||
name: "reports-refahi",
|
||||
secondary: "secondary.reports-refahi",
|
||||
type: "page",
|
||||
route: "/dashboard/reports/refahi",
|
||||
icon: <BarChartIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
selected: false,
|
||||
permissions: ["view_reports_refahi"],
|
||||
},
|
||||
{
|
||||
key: "sidebar.loan-history",
|
||||
secondary: "secondary.loan-history",
|
||||
|
||||
Reference in New Issue
Block a user