Feature/reports refahi
This commit is contained in:
@@ -12,17 +12,13 @@ const FunctionalityCharts = ({ reportList, name }) => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<Grid container sx={{ width: "100%", mt: 3 }} spacing={1}>
|
<Grid container sx={{ width: "100%", mt: 3 }} spacing={1}>
|
||||||
{Object.entries(reportList).map(([entryKey, innerObject]) => {
|
{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;
|
const numColumns = Object.entries(reportList).length;
|
||||||
let columnSize = 12 / numColumns;
|
let columnSize = 12 / numColumns;
|
||||||
return (
|
return (
|
||||||
<Grid key={entryKey} item xs={12} sm={6} md={columnSize}>
|
<Grid key={entryKey} item xs={12} sm={6} md={columnSize}>
|
||||||
<UniqDetailComponent
|
<UniqDetailComponent
|
||||||
title={t(`reports.${entryKey}`)}
|
title={t(`reports.${entryKey}`)}
|
||||||
percentage={percentage}
|
percentage={innerObject.percentage}
|
||||||
item={innerObject}
|
item={innerObject}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const UniqDetailComponent = ({ item, percentage, title }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("reports.dynamic_total_budget", {
|
{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>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -3,10 +3,9 @@ import { useTranslations } from "next-intl";
|
|||||||
import Filter from "../Filter";
|
import Filter from "../Filter";
|
||||||
import useChart from "@/lib/app/hooks/useChart";
|
import useChart from "@/lib/app/hooks/useChart";
|
||||||
import {
|
import {
|
||||||
//GET_LOAN_EXPERTPROGRESS_CARTABLE_REFAHI , GET_LOAN_EXPERTPROGRESS_PLANING_COUNCIL_REFAHI, GET_LOAN_EXPERTPROGRESS_BANK_REPORT_REFAHI
|
GET_LOAN_EXPERTPROGRESS_CARTABLE_REFAHI,
|
||||||
GET_LOAN_EXPERTPROGRESS_BANK_REPORT,
|
GET_LOAN_EXPERTPROGRESS_PLANING_COUNCIL_REFAHI,
|
||||||
GET_LOAN_EXPERTPROGRESS_CARTABLE,
|
GET_LOAN_EXPERTPROGRESS_BANK_REPORT_REFAHI,
|
||||||
GET_LOAN_EXPERTPROGRESS_PLANING_COUNCIL,
|
|
||||||
} from "@/core/data/apiRoutes";
|
} from "@/core/data/apiRoutes";
|
||||||
import LoadingHardPage from "@/core/components/LoadingHardPage";
|
import LoadingHardPage from "@/core/components/LoadingHardPage";
|
||||||
import AnalyticsIcon from "@mui/icons-material/Analytics";
|
import AnalyticsIcon from "@mui/icons-material/Analytics";
|
||||||
@@ -21,21 +20,21 @@ const LoanDetails = () => {
|
|||||||
reportList: reportList1,
|
reportList: reportList1,
|
||||||
setFilterOption: setFilterOption1,
|
setFilterOption: setFilterOption1,
|
||||||
mutate: mutate1,
|
mutate: mutate1,
|
||||||
} = useChart(GET_LOAN_EXPERTPROGRESS_CARTABLE);
|
} = useChart(GET_LOAN_EXPERTPROGRESS_CARTABLE_REFAHI);
|
||||||
const {
|
const {
|
||||||
errorReportList: errorReportList2,
|
errorReportList: errorReportList2,
|
||||||
isLoadingReportList: isLoadingReportList2,
|
isLoadingReportList: isLoadingReportList2,
|
||||||
reportList: reportList2,
|
reportList: reportList2,
|
||||||
setFilterOption: setFilterOption2,
|
setFilterOption: setFilterOption2,
|
||||||
mutate: mutate2,
|
mutate: mutate2,
|
||||||
} = useChart(GET_LOAN_EXPERTPROGRESS_PLANING_COUNCIL);
|
} = useChart(GET_LOAN_EXPERTPROGRESS_PLANING_COUNCIL_REFAHI);
|
||||||
const {
|
const {
|
||||||
errorReportList: errorReportList3,
|
errorReportList: errorReportList3,
|
||||||
isLoadingReportList: isLoadingReportList3,
|
isLoadingReportList: isLoadingReportList3,
|
||||||
reportList: reportList3,
|
reportList: reportList3,
|
||||||
setFilterOption: setFilterOption3,
|
setFilterOption: setFilterOption3,
|
||||||
mutate: mutate3,
|
mutate: mutate3,
|
||||||
} = useChart(GET_LOAN_EXPERTPROGRESS_BANK_REPORT);
|
} = useChart(GET_LOAN_EXPERTPROGRESS_BANK_REPORT_REFAHI);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper elevation={2} sx={{ width: "95%", mx: "auto", my: 2, pb: 2, background: "#f7f7f7e6" }}>
|
<Paper elevation={2} sx={{ width: "95%", mx: "auto", my: 2, pb: 2, background: "#f7f7f7e6" }}>
|
||||||
@@ -84,20 +83,20 @@ const LoanDetails = () => {
|
|||||||
</Grid>
|
</Grid>
|
||||||
) : (
|
) : (
|
||||||
<Stack sx={{ width: "100%" }}>
|
<Stack sx={{ width: "100%" }}>
|
||||||
<FunctionalityCharts reportList={reportList1.bus} name={t("reports.report_build")} />
|
<FunctionalityCharts reportList={reportList1.build} name={t("reports.report_build")} />
|
||||||
<Divider />
|
<Divider />
|
||||||
<FunctionalityCharts reportList={reportList1.minibus} name={t("reports.report_repair")} />
|
<FunctionalityCharts reportList={reportList1.repair} name={t("reports.report_repair")} />
|
||||||
<Divider />
|
<Divider />
|
||||||
<FunctionalityCharts reportList={reportList2.bus} name={t("reports.planing_council_build")} />
|
<FunctionalityCharts reportList={reportList2.build} name={t("reports.planing_council_build")} />
|
||||||
<Divider />
|
<Divider />
|
||||||
<FunctionalityCharts
|
<FunctionalityCharts
|
||||||
reportList={reportList2.minibus}
|
reportList={reportList2.repair}
|
||||||
name={t("reports.planing_council_repair")}
|
name={t("reports.planing_council_repair")}
|
||||||
/>
|
/>
|
||||||
<Divider />
|
<Divider />
|
||||||
<FunctionalityCharts reportList={reportList3.bus} name={t("reports.bank_report_build")} />
|
<FunctionalityCharts reportList={reportList3.build} name={t("reports.bank_report_build")} />
|
||||||
<Divider />
|
<Divider />
|
||||||
<FunctionalityCharts reportList={reportList3.minibus} name={t("reports.bank_report_repair")} />
|
<FunctionalityCharts reportList={reportList3.repair} name={t("reports.bank_report_repair")} />
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import LoanDetails from "./LoanDetails";
|
import LoanDetails from "./LoanDetails";
|
||||||
import ExcelExport from "./ExcelExport";
|
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";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const DashboardReportsComponent = (props) => {
|
const DashboardReportsComponent = (props) => {
|
||||||
@@ -9,12 +9,12 @@ const DashboardReportsComponent = (props) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ExcelExport
|
<ExcelExport
|
||||||
url={GET_EXCEL_EXPORT}
|
url={GET_EXCEL_EXPORT_REFAHI}
|
||||||
title={t("filters.excel_export_reports")}
|
title={t("filters.excel_export_reports")}
|
||||||
filenameStr={"گزارش عملکرد"}
|
filenameStr={"گزارش عملکرد"}
|
||||||
/>
|
/>
|
||||||
<ExcelExport
|
<ExcelExport
|
||||||
url={GET_EXCEL_EXPORT_status}
|
url={GET_EXCEL_EXPORT_REFAHI_status}
|
||||||
title={t("filters.excel_export_reports_status")}
|
title={t("filters.excel_export_reports_status")}
|
||||||
filenameStr={"گزارش وضعیت وام های کشور"}
|
filenameStr={"گزارش وضعیت وام های کشور"}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -168,6 +168,8 @@ export const GET_LOAN_EXPERTPROGRESS_CARTABLE_REFAHI = BASE_URL + "/dashboard/re
|
|||||||
export const GET_LOAN_EXPERTPROGRESS_PLANING_COUNCIL_REFAHI =
|
export const GET_LOAN_EXPERTPROGRESS_PLANING_COUNCIL_REFAHI =
|
||||||
BASE_URL + "/dashboard/reports/refahi/planning_council_reports";
|
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_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";
|
export const GET_LOAN_REFERREDLOANS = BASE_URL + "/dashboard/reports/navgan/referred_loans";
|
||||||
// reports
|
// reports
|
||||||
|
|
||||||
|
|||||||
@@ -28,27 +28,26 @@ const sidebarMenu = [
|
|||||||
selected: false,
|
selected: false,
|
||||||
permissions: ["all"],
|
permissions: ["all"],
|
||||||
},
|
},
|
||||||
// TODO : should un-command this part after reports get fixed
|
{
|
||||||
// {
|
key: "sidebar.reports",
|
||||||
// key: "sidebar.reports",
|
name: "reports",
|
||||||
// name: "reports",
|
secondary: "secondary.reports",
|
||||||
// secondary: "secondary.reports",
|
type: "page",
|
||||||
// type: "page",
|
route: "/dashboard/reports/navgan",
|
||||||
// route: "/dashboard/reports/navgan",
|
icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||||
// icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
selected: false,
|
||||||
// selected: false,
|
permissions: ["view_reports_navgan"],
|
||||||
// permissions: ["view_reports_navgan"],
|
},
|
||||||
// },
|
{
|
||||||
// {
|
key: "sidebar.reports-refahi",
|
||||||
// key: "sidebar.reports-refahi",
|
name: "reports-refahi",
|
||||||
// name: "reports-refahi",
|
secondary: "secondary.reports-refahi",
|
||||||
// secondary: "secondary.reports-refahi",
|
type: "page",
|
||||||
// type: "page",
|
route: "/dashboard/reports/refahi",
|
||||||
// route: "/dashboard/reports/refahi",
|
icon: <BarChartIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||||
// icon: <BarChartIcon sx={{ width: "inherit", height: "inherit" }} />,
|
selected: false,
|
||||||
// selected: false,
|
permissions: ["view_reports_refahi"],
|
||||||
// permissions: ["view_reports_refahi"],
|
},
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
key: "sidebar.loan-history",
|
key: "sidebar.loan-history",
|
||||||
secondary: "secondary.loan-history",
|
secondary: "secondary.loan-history",
|
||||||
|
|||||||
Reference in New Issue
Block a user