From 84ffc999f471e0083db67cb213ae224211cc450a Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sun, 14 Jan 2024 13:32:38 +0330 Subject: [PATCH 1/8] fixed bug --- .../layouts/Dashboard/Sidebar/SidebarList.jsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/components/layouts/Dashboard/Sidebar/SidebarList.jsx b/src/components/layouts/Dashboard/Sidebar/SidebarList.jsx index c8ad33c..f21b69a 100644 --- a/src/components/layouts/Dashboard/Sidebar/SidebarList.jsx +++ b/src/components/layouts/Dashboard/Sidebar/SidebarList.jsx @@ -64,18 +64,21 @@ export default function SidebarList({handleDrawerToggle}) { }, [selectedKey]); return ( - {itemMenu.map((itemArr, index) => ( + {itemMenu.map((itemArr, index) => { + let isDividerVisible = false; + return ( {itemArr.map((item) => - {(item.permissions.some((permission) => user?.permissions?.includes(permission)) || item.permissions.includes('all')) && + {(item.permissions.some((permission) => user?.permissions?.includes(permission)) || item.permissions.includes('all')) && <> } + /> + {isDividerVisible = true} + } )} - - ))} - - - ); + {isDividerVisible && } + ) + })} + ); } From 7066084c98ab4de40a20c1e18277852fe9617a74 Mon Sep 17 00:00:00 2001 From: AminGhasempoor Date: Sun, 14 Jan 2024 15:54:09 +0330 Subject: [PATCH 2/8] add description column on loan history form --- package.json | 2 +- public/locales/fa/app.json | 1 + .../dashboard/loan-history/Form/HistoryForm/TableContent.jsx | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c03278c..33261ac 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "dayjs": "^1.11.9", "eslint": "8.36.0", "file-saver": "^2.0.5", - "formik": "^2.2.9", + "formik": "^2.4.5", "fs-extra": "^11.1.1", "image-resize": "^1.3.2", "image-to-file-converter": "^1.0.6", diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 1cfa2f8..711f9c0 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -663,6 +663,7 @@ "Table_head_position": "سمت", "Table_head_action": "عملیات", "Table_head_file": "فایل پیوست", + "Table_head_expert_description": "توضیحات", "empty_history_detail": "سابقه ای برای این وام وجود ندارد" } } \ No newline at end of file diff --git a/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx b/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx index 34b1529..e71c6c5 100644 --- a/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx +++ b/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx @@ -69,6 +69,7 @@ const TableContent = ({rowId}) => { {t("LoanHistory.Table_head_date")} {t("LoanHistory.Table_head_position")} {t("LoanHistory.Table_head_action")} + {t("LoanHistory.Table_head_expert_description")} {t("LoanHistory.Table_head_file")} @@ -82,12 +83,13 @@ const TableContent = ({rowId}) => { '&:last-child td, &:last-child th': {border: 0} }} > - + {latest_history.expert.name} {moment(latest_history.created_at).locale("fa").format("HH:mm | yyyy/MM/DD")} {latest_history.expert.position} {latest_history.previous_state_name} + {latest_history.expert_description} {latest_history.attachment ? ( From 9e807614ecab8d32bf21b71e2f145fef5136216f Mon Sep 17 00:00:00 2001 From: Mohammad Jalali Date: Sun, 14 Jan 2024 17:45:54 +0330 Subject: [PATCH 3/8] bring structure and working on filters --- public/locales/fa/app.json | 5 + .../ExcelExport/index.jsx | 4 +- .../old-reports/Filter/ProvinceFilter.jsx | 111 ++++++++++++++ .../old-reports/Filter/YearFilter.jsx | 66 ++++++++ .../dashboard/old-reports/Filter/index.jsx | 144 ++++++++++++++++++ .../LoanDetails/RadialBarChart.jsx | 0 .../RadialBarSemiCircularChart.jsx | 46 ++++++ .../LoanDetails/RadialBarStrokedChart.jsx | 0 .../old-reports/LoanDetails/index.jsx | 37 +++++ .../LoanDistribution/PieChart.jsx | 0 .../LoanDistribution/PolarChart.jsx | 0 .../LoanDistribution/index.jsx | 2 +- .../LoanProgress/BarChart.jsx | 0 .../LoanProgress/index.jsx | 0 .../dashboard/old-reports/index.jsx | 16 ++ .../dashboard/reports/Filter/index.jsx | 7 +- .../RadialBarSemiCircularChart.jsx | 12 +- .../LoanDetails/functionalityCharts.jsx | 66 ++++++++ .../dashboard/reports/LoanDetails/index.jsx | 109 ++++++++++--- .../reports/LoanDetails/referredCharts.jsx | 0 src/components/dashboard/reports/index.jsx | 9 +- src/core/components/Chart.jsx | 3 +- src/core/data/apiRoutes.js | 2 + src/lib/app/hooks/useChart.jsx | 3 +- src/pages/dashboard/old-reports/index.jsx | 20 +++ src/pages/dashboard/reports/index.jsx | 2 +- 26 files changed, 615 insertions(+), 49 deletions(-) rename src/components/dashboard/{reports => old-reports}/ExcelExport/index.jsx (97%) create mode 100644 src/components/dashboard/old-reports/Filter/ProvinceFilter.jsx create mode 100644 src/components/dashboard/old-reports/Filter/YearFilter.jsx create mode 100644 src/components/dashboard/old-reports/Filter/index.jsx rename src/components/dashboard/{reports => old-reports}/LoanDetails/RadialBarChart.jsx (100%) create mode 100644 src/components/dashboard/old-reports/LoanDetails/RadialBarSemiCircularChart.jsx rename src/components/dashboard/{reports => old-reports}/LoanDetails/RadialBarStrokedChart.jsx (100%) create mode 100644 src/components/dashboard/old-reports/LoanDetails/index.jsx rename src/components/dashboard/{reports => old-reports}/LoanDistribution/PieChart.jsx (100%) rename src/components/dashboard/{reports => old-reports}/LoanDistribution/PolarChart.jsx (100%) rename src/components/dashboard/{reports => old-reports}/LoanDistribution/index.jsx (97%) rename src/components/dashboard/{reports => old-reports}/LoanProgress/BarChart.jsx (100%) rename src/components/dashboard/{reports => old-reports}/LoanProgress/index.jsx (100%) create mode 100644 src/components/dashboard/old-reports/index.jsx create mode 100644 src/components/dashboard/reports/LoanDetails/functionalityCharts.jsx create mode 100644 src/components/dashboard/reports/LoanDetails/referredCharts.jsx create mode 100644 src/pages/dashboard/old-reports/index.jsx diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 1cfa2f8..8eb5b34 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -603,6 +603,11 @@ "loading_permissions_list": "درحال دریافت لیست دسترسی ها" }, "reports": { + "dynamic_label": "{done} از {total} انجام شده", + "expert": "عملکرد کارشناس", + "transportation_assistant": "عملکرد معاون", + "province_manager": "عملکرد مدیر", + "bank": "عملکرد بانک", "loan_progress": "درصد پیشرفت تسویه وام", "loan_distribution": "درصد توزیع وام ها در هر مرحله", "filter_as": "فیلتر های اعمال شده", diff --git a/src/components/dashboard/reports/ExcelExport/index.jsx b/src/components/dashboard/old-reports/ExcelExport/index.jsx similarity index 97% rename from src/components/dashboard/reports/ExcelExport/index.jsx rename to src/components/dashboard/old-reports/ExcelExport/index.jsx index 472d8b8..bd9cb8e 100644 --- a/src/components/dashboard/reports/ExcelExport/index.jsx +++ b/src/components/dashboard/old-reports/ExcelExport/index.jsx @@ -12,8 +12,8 @@ import FileUploadIcon from '@mui/icons-material/FileUpload'; import AssignmentIcon from '@mui/icons-material/Assignment'; import BackupIcon from '@mui/icons-material/Backup'; import {useTranslations} from "next-intl"; -import ProvinceFilter from "@/components/dashboard/reports/Filter/ProvinceFilter"; -import YearFilter from "@/components/dashboard/reports/Filter/YearFilter"; +import ProvinceFilter from "@/components/dashboard/old-reports/Filter/ProvinceFilter"; +import YearFilter from "@/components/dashboard/old-reports/Filter/YearFilter"; import {useState} from "react"; import {useFormik} from "formik"; import {GET_EXPORT} from "@/core/data/apiRoutes"; diff --git a/src/components/dashboard/old-reports/Filter/ProvinceFilter.jsx b/src/components/dashboard/old-reports/Filter/ProvinceFilter.jsx new file mode 100644 index 0000000..7dacacc --- /dev/null +++ b/src/components/dashboard/old-reports/Filter/ProvinceFilter.jsx @@ -0,0 +1,111 @@ +import { + Box, + FormControl, + IconButton, + InputAdornment, + InputLabel, + MenuItem, + OutlinedInput, + Select, + Typography +} from "@mui/material"; +import {useTranslations} from "next-intl"; +import useProvince from "@/lib/app/hooks/useProvince"; +import ClearIcon from '@mui/icons-material/Clear'; + +const provinceList = [ + {name: "قزوین", id: 1}, + {name: "تبریز", id: 2}, + {name: "مشهد", id: 3} +] + +const ProvinceFilter = ({formik, multiple, setFilteredText}) => { + const {errorProvinceList, isLoadingProvinceList, provinceList} = useProvince(); + const t = useTranslations(); + const provinceChange = (event) => { + const {target: {value}} = event; + formik.handleChange(event); + formik.setFieldValue('province_id', value); + if (Array.isArray(value)) { + const province_names = [] + value.map((item) => { + province_names.push(provinceList.find(province => province.id === item).name) + }) + setFilteredText(prevState => ({ + ...prevState, + province: province_names.length !== 0 ? `| ${t("filters.provinces")}: ${province_names.join(' , ')}` : "" + })); + } else { + const selectedProvince = provinceList.find(province => province.id === value); + setFilteredText(prevState => ({ + ...prevState, + province: `| ${t("filters.province")}: ${selectedProvince.name}` + })); + } + }; + const needAdorment = multiple + ? formik.values.province_id.length === 0 : + formik.values.province_id === ""; + return ( + + {t("filters.choose_province")} + + + ) +}; + +export default ProvinceFilter; \ No newline at end of file diff --git a/src/components/dashboard/old-reports/Filter/YearFilter.jsx b/src/components/dashboard/old-reports/Filter/YearFilter.jsx new file mode 100644 index 0000000..a18e9db --- /dev/null +++ b/src/components/dashboard/old-reports/Filter/YearFilter.jsx @@ -0,0 +1,66 @@ +import {Box, Chip, FormControl, InputLabel, MenuItem, OutlinedInput, Select} from "@mui/material"; +import moment from "jalali-moment"; +import {useTranslations} from "next-intl"; +import {periodOfYear} from "@/core/utils/yearPeriodFinder"; + +const currentShamsiYear = moment().format('jYYYY'); +const shamsiYearList = Array.from({length: currentShamsiYear - 1399}, (_, index) => (currentShamsiYear - index).toString()); + +const YearFilter = ({formik, multiple, setFilteredText}) => { + const t = useTranslations(); + const yearChange = (event) => { + const {target: {value}} = event; + formik.handleChange(event); + formik.setFieldValue('date', value); + const {from, to} = periodOfYear(value); + formik.setFieldValue('from_date', from); + formik.setFieldValue('to_date', to); + if (Array.isArray(value)) { + setFilteredText(prevState => ({ + ...prevState, + year: `| ${t("filters.years")}: ${value.join(' , ')}` + })); + } else { + setFilteredText(prevState => ({ + ...prevState, + year: `| ${t("filters.year")}: ${value}` + })); + } + }; + return ( + + {t("filters.choose_year")} + + + ) +}; + +export default YearFilter; \ No newline at end of file diff --git a/src/components/dashboard/old-reports/Filter/index.jsx b/src/components/dashboard/old-reports/Filter/index.jsx new file mode 100644 index 0000000..f42d2aa --- /dev/null +++ b/src/components/dashboard/old-reports/Filter/index.jsx @@ -0,0 +1,144 @@ +import { + Accordion, + AccordionDetails, + AccordionSummary, + Box, + Button, + CircularProgress, + IconButton, + Stack, + Tooltip, + Typography +} from "@mui/material"; +import {useFormik} from "formik"; +import ProvinceFilter from "../Filter/ProvinceFilter"; +import YearFilter from "../Filter/YearFilter"; +import FilterAltIcon from '@mui/icons-material/FilterAlt'; +import EqualizerIcon from '@mui/icons-material/Equalizer'; +import {useTranslations} from "next-intl"; +import TroubleshootIcon from '@mui/icons-material/Troubleshoot'; +import CachedIcon from '@mui/icons-material/Cached'; +import {useEffect, useState} from "react"; +import moment from "jalali-moment"; +import {periodOfYear} from "@/core/utils/yearPeriodFinder"; + +const Filter = ({title, filterItem, setFilterOption, isLoadingReportList, mutate}) => { + const t = useTranslations(); + const filter_by_province = filterItem.find((item) => item.type === "province"); + const filter_by_year = filterItem.find((item) => item.type === "year"); + + const [expanded, setExpanded] = useState(false); + const [filteredText, setFilteredText] = useState({province: "", year: ""}); + const [stepValue, setStepValue] = useState({ + ...(filter_by_year && { + date: filter_by_year.multiple ? [] : `${moment().format('jYYYY')}` + }), + ...(filter_by_province && { + province_id: filter_by_province.multiple ? [] : "" + }), + from_date: periodOfYear(moment().format('jYYYY')).from, + to_date: periodOfYear(moment().format('jYYYY')).to + }) + + + const formik = useFormik({ + enableReinitialize: true, + initialValues: stepValue, onSubmit: (values, {setSubmitting}) => { + setStepValue(values) + const province = values.province_id; + const fields = [ + values.from_date ? {key: "from_date", value: values.from_date} : null, + values.to_date ? {key: "to_date", value: values.to_date} : null, + ...(Array.isArray(province) + ? province.length !== 0 + ? province.map((item, index) => ({key: `province_id[${index}]`, value: item})) + : [] + : province + ? [{key: "province_id", value: province}] + : [] + ), + ].filter(Boolean); + setFilterOption(fields) + }, + }); + + useEffect(() => { + const province = formik.values.province_id; + const fields = [ + formik.values.from_date ? {key: "from_date", value: formik.values.from_date} : null, + formik.values.to_date ? {key: "to_date", value: formik.values.to_date} : null, + ...(Array.isArray(province) + ? province.length !== 0 + ? province.map((item, index) => ({key: `province_id[${index}]`, value: item})) + : [] + : province + ? [{key: "province_id", value: province}] + : [] + ), + ].filter(Boolean); + setFilterOption(fields) + }, []); + + return ( + { + }} sx={{ + mb: 2, + borderBottom: 2, + borderBottomColor: "divider", + backgroundColor: "#f1f1f1", + }}> + + + + + {title} + + {filteredText.province} {filteredText.year} + + + + + mutate()} + size="small"> + + + + + setExpanded((prevExpanded) => !prevExpanded)} + size="small"> + + + + + + + + + {filter_by_province ? + : "" + } + {filter_by_year ? + : "" + } + + + + + + + ) +}; + +export default Filter; \ No newline at end of file diff --git a/src/components/dashboard/reports/LoanDetails/RadialBarChart.jsx b/src/components/dashboard/old-reports/LoanDetails/RadialBarChart.jsx similarity index 100% rename from src/components/dashboard/reports/LoanDetails/RadialBarChart.jsx rename to src/components/dashboard/old-reports/LoanDetails/RadialBarChart.jsx diff --git a/src/components/dashboard/old-reports/LoanDetails/RadialBarSemiCircularChart.jsx b/src/components/dashboard/old-reports/LoanDetails/RadialBarSemiCircularChart.jsx new file mode 100644 index 0000000..4a8fd11 --- /dev/null +++ b/src/components/dashboard/old-reports/LoanDetails/RadialBarSemiCircularChart.jsx @@ -0,0 +1,46 @@ +import Chart from "@/core/components/Chart"; +import {calculateGradientColor} from "@/core/utils/gradientColorHandler"; + +const RadialBarSemiCircularChart = ({data, label}) => { + const specialOption = { + title: { + text: undefined, + }, + plotOptions: { + radialBar: { + startAngle: -110, + endAngle: 110, + track: { + background: "#e7e7e7", + strokeWidth: '80%', + }, + dataLabels: { + name: { + fontSize: '20px', + offsetY: 110, + color: "#8c8c8c" + }, + value: { + offsetY: 50, + fontSize: '50px', + fontWeight: 500, + color: "#8c8c8c", + formatter: function (val) { + return val + "%"; + } + } + } + } + }, + fill: { + colors: calculateGradientColor(data) + }, + labels: [label], + }; + const series = [data] + return ( + + ) +}; + +export default RadialBarSemiCircularChart; \ No newline at end of file diff --git a/src/components/dashboard/reports/LoanDetails/RadialBarStrokedChart.jsx b/src/components/dashboard/old-reports/LoanDetails/RadialBarStrokedChart.jsx similarity index 100% rename from src/components/dashboard/reports/LoanDetails/RadialBarStrokedChart.jsx rename to src/components/dashboard/old-reports/LoanDetails/RadialBarStrokedChart.jsx diff --git a/src/components/dashboard/old-reports/LoanDetails/index.jsx b/src/components/dashboard/old-reports/LoanDetails/index.jsx new file mode 100644 index 0000000..0ba3c9b --- /dev/null +++ b/src/components/dashboard/old-reports/LoanDetails/index.jsx @@ -0,0 +1,37 @@ +import {Grid, Paper} from "@mui/material"; +import {useTranslations} from "next-intl"; +import RadialBarSemiCircularChart from "@/components/dashboard/old-reports/LoanDetails/RadialBarSemiCircularChart"; +import RadialBarStrokedChart from "@/components/dashboard/old-reports/LoanDetails/RadialBarStrokedChart"; + + +const LoanDetails = () => { + const t = useTranslations(); + return ( + + {/**/} + + + + + + + + + + + + + + + + ) +}; + +export default LoanDetails; \ No newline at end of file diff --git a/src/components/dashboard/reports/LoanDistribution/PieChart.jsx b/src/components/dashboard/old-reports/LoanDistribution/PieChart.jsx similarity index 100% rename from src/components/dashboard/reports/LoanDistribution/PieChart.jsx rename to src/components/dashboard/old-reports/LoanDistribution/PieChart.jsx diff --git a/src/components/dashboard/reports/LoanDistribution/PolarChart.jsx b/src/components/dashboard/old-reports/LoanDistribution/PolarChart.jsx similarity index 100% rename from src/components/dashboard/reports/LoanDistribution/PolarChart.jsx rename to src/components/dashboard/old-reports/LoanDistribution/PolarChart.jsx diff --git a/src/components/dashboard/reports/LoanDistribution/index.jsx b/src/components/dashboard/old-reports/LoanDistribution/index.jsx similarity index 97% rename from src/components/dashboard/reports/LoanDistribution/index.jsx rename to src/components/dashboard/old-reports/LoanDistribution/index.jsx index ff65cda..1e62597 100644 --- a/src/components/dashboard/reports/LoanDistribution/index.jsx +++ b/src/components/dashboard/old-reports/LoanDistribution/index.jsx @@ -2,7 +2,7 @@ import {Grid, Paper, Typography} from "@mui/material"; import PolarChart from "./PolarChart"; import Pie from "./PieChart"; import {useTranslations} from "next-intl"; -import Filter from "@/components/dashboard/reports/Filter"; +import Filter from "@/components/dashboard/old-reports/Filter"; import useChart from "@/lib/app/hooks/useChart"; import {GET_LOAN_DISTRIBUTION} from "@/core/data/apiRoutes"; import LoadingHardPage from "@/core/components/LoadingHardPage"; diff --git a/src/components/dashboard/reports/LoanProgress/BarChart.jsx b/src/components/dashboard/old-reports/LoanProgress/BarChart.jsx similarity index 100% rename from src/components/dashboard/reports/LoanProgress/BarChart.jsx rename to src/components/dashboard/old-reports/LoanProgress/BarChart.jsx diff --git a/src/components/dashboard/reports/LoanProgress/index.jsx b/src/components/dashboard/old-reports/LoanProgress/index.jsx similarity index 100% rename from src/components/dashboard/reports/LoanProgress/index.jsx rename to src/components/dashboard/old-reports/LoanProgress/index.jsx diff --git a/src/components/dashboard/old-reports/index.jsx b/src/components/dashboard/old-reports/index.jsx new file mode 100644 index 0000000..aa590b5 --- /dev/null +++ b/src/components/dashboard/old-reports/index.jsx @@ -0,0 +1,16 @@ +import LoanProgress from "@/components/dashboard/old-reports/LoanProgress"; +import LoanDistribution from "@/components/dashboard/old-reports/LoanDistribution"; +import ExcelExport from "@/components/dashboard/old-reports/ExcelExport"; + +const DashboardReportsComponent = (props) => { + return ( + <> + + + + {/**/} + + ) +}; + +export default DashboardReportsComponent; \ No newline at end of file diff --git a/src/components/dashboard/reports/Filter/index.jsx b/src/components/dashboard/reports/Filter/index.jsx index f42d2aa..36ef14d 100644 --- a/src/components/dashboard/reports/Filter/index.jsx +++ b/src/components/dashboard/reports/Filter/index.jsx @@ -20,13 +20,11 @@ import TroubleshootIcon from '@mui/icons-material/Troubleshoot'; import CachedIcon from '@mui/icons-material/Cached'; import {useEffect, useState} from "react"; import moment from "jalali-moment"; -import {periodOfYear} from "@/core/utils/yearPeriodFinder"; const Filter = ({title, filterItem, setFilterOption, isLoadingReportList, mutate}) => { const t = useTranslations(); const filter_by_province = filterItem.find((item) => item.type === "province"); const filter_by_year = filterItem.find((item) => item.type === "year"); - const [expanded, setExpanded] = useState(false); const [filteredText, setFilteredText] = useState({province: "", year: ""}); const [stepValue, setStepValue] = useState({ @@ -36,11 +34,10 @@ const Filter = ({title, filterItem, setFilterOption, isLoadingReportList, mutate ...(filter_by_province && { province_id: filter_by_province.multiple ? [] : "" }), - from_date: periodOfYear(moment().format('jYYYY')).from, - to_date: periodOfYear(moment().format('jYYYY')).to + from_date: "", + to_date: "" }) - const formik = useFormik({ enableReinitialize: true, initialValues: stepValue, onSubmit: (values, {setSubmitting}) => { diff --git a/src/components/dashboard/reports/LoanDetails/RadialBarSemiCircularChart.jsx b/src/components/dashboard/reports/LoanDetails/RadialBarSemiCircularChart.jsx index 4a8fd11..3417e8e 100644 --- a/src/components/dashboard/reports/LoanDetails/RadialBarSemiCircularChart.jsx +++ b/src/components/dashboard/reports/LoanDetails/RadialBarSemiCircularChart.jsx @@ -8,21 +8,21 @@ const RadialBarSemiCircularChart = ({data, label}) => { }, plotOptions: { radialBar: { - startAngle: -110, - endAngle: 110, + startAngle: -90, + endAngle: 90, track: { background: "#e7e7e7", strokeWidth: '80%', }, dataLabels: { name: { - fontSize: '20px', - offsetY: 110, + fontSize: '1.1rem', + offsetY: 20, color: "#8c8c8c" }, value: { - offsetY: 50, - fontSize: '50px', + offsetY: -50, + fontSize: '30px', fontWeight: 500, color: "#8c8c8c", formatter: function (val) { diff --git a/src/components/dashboard/reports/LoanDetails/functionalityCharts.jsx b/src/components/dashboard/reports/LoanDetails/functionalityCharts.jsx new file mode 100644 index 0000000..200544d --- /dev/null +++ b/src/components/dashboard/reports/LoanDetails/functionalityCharts.jsx @@ -0,0 +1,66 @@ +import {Grid, Typography} from "@mui/material"; +import {useTranslations} from "next-intl"; +import LoadingHardPage from "@/core/components/LoadingHardPage"; +import AnalyticsIcon from "@mui/icons-material/Analytics"; +import RadialBarSemiCircularChart from "@/components/dashboard/reports/LoanDetails/RadialBarSemiCircularChart"; + +const FunctionalityCharts = () => { + const t = useTranslations(); + const DataItemsName = [ + {id: "expert", name: t("reports.expert")}, + {id: "transportation_assistant", name: t("reports.transportation_assistant")}, + {id: "province_manager", name: t("reports.province_manager")}, + {id: "bank", name: t("reports.bank")} + ] + + return ( + + {isLoadingReportList ? ( + + } + loading={isLoadingReportList} + label={t("reports.loading_fetching_reports")} + width={100} + height={100} + sx={{position: "absolute", bgcolor: "#f7f7f7e6"}} + /> + + ) : errorReportList ? ( + + {t("reports.error_fetching_reports")} + + ) : ( + <> + { + Object.entries(reportList).map(([entryKey, innerObject]) => { + let percentage = innerObject.total !== 0 ? (innerObject.total - innerObject.pending) / innerObject.total * 100 : 0; + const ItemName = DataItemsName.find(item => item.id === entryKey).name; + return ( + + {ItemName} + + + ) + }) + } + + )} + + ) +}; + +export default FunctionalityCharts; diff --git a/src/components/dashboard/reports/LoanDetails/index.jsx b/src/components/dashboard/reports/LoanDetails/index.jsx index aaf5090..b0e9b9a 100644 --- a/src/components/dashboard/reports/LoanDetails/index.jsx +++ b/src/components/dashboard/reports/LoanDetails/index.jsx @@ -1,37 +1,96 @@ -import {Grid, Paper} from "@mui/material"; +import {Grid, Paper, Typography} from "@mui/material"; import {useTranslations} from "next-intl"; +import Filter from "@/components/dashboard/reports/Filter"; +import useChart from "@/lib/app/hooks/useChart"; +import {GET_LOAN_EXPERTPROGRESS, GET_LOAN_REFERREDLOANS} from "@/core/data/apiRoutes"; +import LoadingHardPage from "@/core/components/LoadingHardPage"; +import AnalyticsIcon from "@mui/icons-material/Analytics"; import RadialBarSemiCircularChart from "@/components/dashboard/reports/LoanDetails/RadialBarSemiCircularChart"; -import RadialBarStrokedChart from "@/components/dashboard/reports/LoanDetails/RadialBarStrokedChart"; - const LoanDetails = () => { const t = useTranslations(); + const DataItemsName = [ + {id: "expert", name: t("reports.expert")}, + {id: "transportation_assistant", name: t("reports.transportation_assistant")}, + {id: "province_manager", name: t("reports.province_manager")}, + {id: "bank", name: t("reports.bank")} + ] + + const { + errorReportList: errorReportList1, + isLoadingReportList: isLoadingReportList1, + reportList: reportList1, + setFilterOption: setFilterOption1, + mutate: mutate1 + } = useChart(GET_LOAN_EXPERTPROGRESS); + + // Use the useChart hook for the second API route + const { + errorReportList: errorReportList2, + isLoadingReportList: isLoadingReportList2, + reportList: reportList2, + setFilterOption: setFilterOption2, + mutate: mutate2 + } = useChart(GET_LOAN_REFERREDLOANS); + return ( - {/**/} - - - - - - - - - - - - - + + + {isLoadingReportList1 ? ( + + } + loading={isLoadingReportList1} + label={t("reports.loading_fetching_reports")} + width={100} + height={100} + sx={{position: "absolute", bgcolor: "#f7f7f7e6"}} + /> + + ) : errorReportList1 ? ( + + {t("reports.error_fetching_reports")} + + ) : ( + <> + { + Object.entries(reportList1).map(([entryKey, innerObject]) => { + let percentage = innerObject.total !== 0 ? (innerObject.total - innerObject.pending) / innerObject.total * 100 : 0; + const ItemName = DataItemsName.find(item => item.id === entryKey).name; + return ( + + {ItemName} + + + ) + }) + } + + )} ) }; -export default LoanDetails; \ No newline at end of file +export default LoanDetails; diff --git a/src/components/dashboard/reports/LoanDetails/referredCharts.jsx b/src/components/dashboard/reports/LoanDetails/referredCharts.jsx new file mode 100644 index 0000000..e69de29 diff --git a/src/components/dashboard/reports/index.jsx b/src/components/dashboard/reports/index.jsx index 134393a..93c5721 100644 --- a/src/components/dashboard/reports/index.jsx +++ b/src/components/dashboard/reports/index.jsx @@ -1,14 +1,9 @@ -import LoanProgress from "@/components/dashboard/reports/LoanProgress"; -import LoanDistribution from "@/components/dashboard/reports/LoanDistribution"; -import ExcelExport from "@/components/dashboard/reports/ExcelExport"; +import LoanDetails from "@/components/dashboard/reports/LoanDetails"; const DashboardReportsComponent = (props) => { return ( <> - - - - {/**/} + ) }; diff --git a/src/core/components/Chart.jsx b/src/core/components/Chart.jsx index 86e5d85..31ae246 100644 --- a/src/core/components/Chart.jsx +++ b/src/core/components/Chart.jsx @@ -13,6 +13,7 @@ const Chart = ({chartId, type, series, specialOption}) => { const options = { chart: { id: chartId, + offsetY: -30, locales: [chartLang], defaultLocale: languageApp, fontFamily: languageList[0].fontFamily, @@ -26,7 +27,7 @@ const Chart = ({chartId, type, series, specialOption}) => { }, ...(specialOption ? specialOption : {}) } - return + return }; export default Chart; diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js index 615dda4..0201cfd 100644 --- a/src/core/data/apiRoutes.js +++ b/src/core/data/apiRoutes.js @@ -225,6 +225,8 @@ export const GET_PERMISSIONS_LIST = export const GET_EXPORT = BASE_URL + "/dashboard/exports/navgan" export const GET_PROVINCE_PROGRESS = BASE_URL + "/dashboard/reports/navgan/province_progress" export const GET_LOAN_DISTRIBUTION = BASE_URL + "/dashboard/reports/navgan/loan_distribution" +export const GET_LOAN_EXPERTPROGRESS = BASE_URL + "/dashboard/reports/navgan/expert_progress" +export const GET_LOAN_REFERREDLOANS = BASE_URL + "/dashboard/reports/navgan/referred_loans" // reports //loan history diff --git a/src/lib/app/hooks/useChart.jsx b/src/lib/app/hooks/useChart.jsx index d1dd454..5aac9e2 100644 --- a/src/lib/app/hooks/useChart.jsx +++ b/src/lib/app/hooks/useChart.jsx @@ -20,13 +20,14 @@ const useChart = (chart_url) => { data, isValidating, mutate - } = useSWR(filterOption.length !== 0 ? `${chart_url}${queryString}` : "", fetcher, { + } = useSWR(filterOption.length !== 0 ? `${chart_url}${queryString}` : chart_url, fetcher, { revalidateIfStale: true, revalidateOnFocus: false, revalidateOnReconnect: false, keepPreviousData: true }); + return { reportList: data, isLoadingReportList: isValidating, diff --git a/src/pages/dashboard/old-reports/index.jsx b/src/pages/dashboard/old-reports/index.jsx new file mode 100644 index 0000000..58e75e5 --- /dev/null +++ b/src/pages/dashboard/old-reports/index.jsx @@ -0,0 +1,20 @@ +import DashboardReportsComponent from "src/components/dashboard/old-reports"; +import {parse} from "next-useragent"; + +export default function Reports() { + return ( + + ); +} + +export async function getServerSideProps({req, locale}) { + const {isBot} = parse(req.headers["user-agent"]); + return { + props: { + messages: (await import(`&/locales/${locale}/app.json`)).default, + title: "Dashboard.reports", + isBot, + layout: {name: 'DashboardLayout', props: {permissions: ["view_reports_navgan"]}} + }, + }; +} diff --git a/src/pages/dashboard/reports/index.jsx b/src/pages/dashboard/reports/index.jsx index 7a7de52..2e13d50 100644 --- a/src/pages/dashboard/reports/index.jsx +++ b/src/pages/dashboard/reports/index.jsx @@ -1,4 +1,4 @@ -import DashboardReportsComponent from "@/components/dashboard/reports"; +import DashboardReportsComponent from "src/components/dashboard/reports"; import {parse} from "next-useragent"; export default function Reports() { From 3728e116916d97fd31069ab13bc75f0d16b3acfa Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Mon, 15 Jan 2024 10:22:03 +0330 Subject: [PATCH 4/8] change dialog history in loan history page --- .../Form/HistoryForm/PrintHistory.jsx | 26 ++-- .../Form/HistoryForm/TableContent.jsx | 142 +++++++++--------- .../loan-history/Form/HistoryForm/index.jsx | 2 +- 3 files changed, 82 insertions(+), 88 deletions(-) diff --git a/src/components/dashboard/loan-history/Form/HistoryForm/PrintHistory.jsx b/src/components/dashboard/loan-history/Form/HistoryForm/PrintHistory.jsx index 79af47c..438bff5 100644 --- a/src/components/dashboard/loan-history/Form/HistoryForm/PrintHistory.jsx +++ b/src/components/dashboard/loan-history/Form/HistoryForm/PrintHistory.jsx @@ -19,21 +19,17 @@ const PrintHistory = ({attachment}) => { } - return ( - - ) + return () } export default PrintHistory \ No newline at end of file diff --git a/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx b/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx index e71c6c5..d9382a1 100644 --- a/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx +++ b/src/components/dashboard/loan-history/Form/HistoryForm/TableContent.jsx @@ -33,79 +33,77 @@ const TableContent = ({rowId}) => { }) }, []); - return ( - + return ( {error ? ({t("LoanHistory.Table_history_error")}) : - (isLoading ? () : ( - historyDetails.latest_histories.length === 0 ? ( - {t("LoanHistory.empty_history_detail")} - ) : ( - - - - - - {t("LoanHistory.Table_head_name")} - {t("LoanHistory.Table_head_date")} - {t("LoanHistory.Table_head_position")} - {t("LoanHistory.Table_head_action")} - {t("LoanHistory.Table_head_expert_description")} - {t("LoanHistory.Table_head_file")} - - - - { - historyDetails.latest_histories.map((latest_history, index) => { - return ( - - - {latest_history.expert.name} - - {moment(latest_history.created_at).locale("fa").format("HH:mm | yyyy/MM/DD")} - {latest_history.expert.position} - {latest_history.previous_state_name} - {latest_history.expert_description} - - {latest_history.attachment ? ( - - ) : null} - - - ) - }) - } - -
-
-
- ) - )) - } + padding: 2, display: "flex", alignItems: "center", justifyContent: "center" + }}>{t("LoanHistory.Table_history_error")}) : (isLoading ? ( + ) : (historyDetails.latest_histories.length === 0 ? ({t("LoanHistory.empty_history_detail")}) : ( + + + + + {t("LoanHistory.Table_head_name")} + {t("LoanHistory.Table_head_date")} + {t("LoanHistory.Table_head_position")} + {t("LoanHistory.Table_head_action")} + {t("LoanHistory.Table_head_expert_description")} + {t("LoanHistory.Table_head_file")} + + + + + + {historyDetails.latest_histories[0].expert.name} + + {moment(historyDetails.latest_histories[0].created_at).locale("fa").format("HH:mm | yyyy/MM/DD")} + {historyDetails.latest_histories[0].expert.position} + {historyDetails.state_name} + {historyDetails.latest_histories[0].expert_description} + + {historyDetails.latest_histories[0].attachments.map(attachment => )} + + + {historyDetails.latest_histories.map((latest_history, index) => { + const _name = historyDetails.latest_histories.length > (index + 1) ? historyDetails.latest_histories[index + 1].expert.name : '-' + const _created_at = historyDetails.latest_histories.length > (index + 1) ? moment(historyDetails.latest_histories[index + 1].created_at).locale("fa").format("HH:mm | yyyy/MM/DD") : '-' + const _position = historyDetails.latest_histories.length > (index + 1) ? historyDetails.latest_histories[index + 1].expert.position : '-' + const _expert_description = historyDetails.latest_histories.length > (index + 1) ? historyDetails.latest_histories[index + 1].expert_description : '-' + const _attachments = historyDetails.latest_histories.length > (index + 1) ? historyDetails.latest_histories[index + 1].attachments : [] + return ( + {_name} + {_created_at} + {_position} + {latest_history.previous_state_name} + {_expert_description} + + {_attachments.map(attachment => )} + + ) + })} + +
+
+
)))}
) diff --git a/src/components/dashboard/loan-history/Form/HistoryForm/index.jsx b/src/components/dashboard/loan-history/Form/HistoryForm/index.jsx index de20f60..a7f8eef 100644 --- a/src/components/dashboard/loan-history/Form/HistoryForm/index.jsx +++ b/src/components/dashboard/loan-history/Form/HistoryForm/index.jsx @@ -19,7 +19,7 @@ const History = ({rowId, mutate}) => { - {t("LoanHistory.history")} From 61703d745eca8d3ae60add157d002e9f11a3d0f8 Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Mon, 15 Jan 2024 13:47:44 +0330 Subject: [PATCH 5/8] add permission view_dashboard_stats in dashboard first page --- src/pages/dashboard/index.jsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pages/dashboard/index.jsx b/src/pages/dashboard/index.jsx index 0e309c3..a736442 100644 --- a/src/pages/dashboard/index.jsx +++ b/src/pages/dashboard/index.jsx @@ -1,7 +1,14 @@ import DashboardFirstComponent from "@/components/dashboard/first"; import {parse} from "next-useragent"; +import useUser from "@/lib/app/hooks/useUser"; export default function Dashboard() { + const {user} = useUser(); + + const hasPermission = user?.permissions?.includes("view_dashboard_stats") + + if (!hasPermission) return null + return ( ); From 3519057a62ea705a78c81ebc5c9302a9b991c20b Mon Sep 17 00:00:00 2001 From: Mohammad Jalali Date: Mon, 15 Jan 2024 15:56:43 +0330 Subject: [PATCH 6/8] complete reports with filtering and both part of referred and functionality --- public/locales/fa/app.json | 6 +- .../dashboard/reports/Filter/index.jsx | 1 - .../LoanDetails/FunctionalityCharts.jsx | 41 ++++++++++++ .../RadialBarSemiCircularChart.jsx | 12 ++-- .../reports/LoanDetails/ReferredCharts.jsx | 60 +++++++++++++++++ .../LoanDetails/functionalityCharts.jsx | 66 ------------------- .../dashboard/reports/LoanDetails/index.jsx | 64 +++++++----------- .../reports/LoanDetails/referredCharts.jsx | 0 8 files changed, 134 insertions(+), 116 deletions(-) create mode 100644 src/components/dashboard/reports/LoanDetails/FunctionalityCharts.jsx create mode 100644 src/components/dashboard/reports/LoanDetails/ReferredCharts.jsx delete mode 100644 src/components/dashboard/reports/LoanDetails/functionalityCharts.jsx delete mode 100644 src/components/dashboard/reports/LoanDetails/referredCharts.jsx diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 8eb5b34..0746af1 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -603,7 +603,11 @@ "loading_permissions_list": "درحال دریافت لیست دسترسی ها" }, "reports": { - "dynamic_label": "{done} از {total} انجام شده", + "dynamic_label_functionality": "{done} از {total} انجام شده", + "dynamic_total_budget": "ابلاغ تسهیلات: {total_budget} میلیون ریال", + "dynamic_label_referred": "{count} فقره در مجموع {total_amount} میلیون ریال", + "referred_loans_to_bank": "ارسال مدیرکل به بانک", + "paid_loans": "پرداخت شده بانک", "expert": "عملکرد کارشناس", "transportation_assistant": "عملکرد معاون", "province_manager": "عملکرد مدیر", diff --git a/src/components/dashboard/reports/Filter/index.jsx b/src/components/dashboard/reports/Filter/index.jsx index 36ef14d..3a84d2f 100644 --- a/src/components/dashboard/reports/Filter/index.jsx +++ b/src/components/dashboard/reports/Filter/index.jsx @@ -73,7 +73,6 @@ const Filter = ({title, filterItem, setFilterOption, isLoadingReportList, mutate : [] ), ].filter(Boolean); - setFilterOption(fields) }, []); return ( diff --git a/src/components/dashboard/reports/LoanDetails/FunctionalityCharts.jsx b/src/components/dashboard/reports/LoanDetails/FunctionalityCharts.jsx new file mode 100644 index 0000000..937fc34 --- /dev/null +++ b/src/components/dashboard/reports/LoanDetails/FunctionalityCharts.jsx @@ -0,0 +1,41 @@ +import {Grid, Typography} from "@mui/material"; +import {useTranslations} from "next-intl"; +import RadialBarSemiCircularChart from "@/components/dashboard/reports/LoanDetails/RadialBarSemiCircularChart"; + +const FunctionalityCharts = ({reportList}) => { + const t = useTranslations(); + const DataItemsName = [ + {id: "expert", name: t("reports.expert")}, + {id: "transportation_assistant", name: t("reports.transportation_assistant")}, + {id: "province_manager", name: t("reports.province_manager")}, + {id: "bank", name: t("reports.bank")} + ] + return ( + + { + Object.entries(reportList).map(([entryKey, innerObject]) => { + let percentage = innerObject.total !== 0 ? (innerObject.total - innerObject.pending) / innerObject.total * 100 : 0; + const ItemName = DataItemsName.find(item => item.id === entryKey).name; + return ( + + {ItemName} + `${val}%`} + label={t("reports.dynamic_label_functionality", { + total: (innerObject.total).toLocaleString("en"), + done: (innerObject.total - innerObject.pending).toLocaleString("en") + })}/> + + ) + }) + } + + ) +}; + +export default FunctionalityCharts; diff --git a/src/components/dashboard/reports/LoanDetails/RadialBarSemiCircularChart.jsx b/src/components/dashboard/reports/LoanDetails/RadialBarSemiCircularChart.jsx index 3417e8e..c37f3b9 100644 --- a/src/components/dashboard/reports/LoanDetails/RadialBarSemiCircularChart.jsx +++ b/src/components/dashboard/reports/LoanDetails/RadialBarSemiCircularChart.jsx @@ -1,7 +1,7 @@ import Chart from "@/core/components/Chart"; import {calculateGradientColor} from "@/core/utils/gradientColorHandler"; -const RadialBarSemiCircularChart = ({data, label}) => { +const RadialBarSemiCircularChart = ({data, label, formatter}) => { const specialOption = { title: { text: undefined, @@ -16,18 +16,16 @@ const RadialBarSemiCircularChart = ({data, label}) => { }, dataLabels: { name: { - fontSize: '1.1rem', - offsetY: 20, + fontSize: '1rem', + offsetY: 30, color: "#8c8c8c" }, value: { - offsetY: -50, + offsetY: -30, fontSize: '30px', fontWeight: 500, color: "#8c8c8c", - formatter: function (val) { - return val + "%"; - } + formatter: formatter } } } diff --git a/src/components/dashboard/reports/LoanDetails/ReferredCharts.jsx b/src/components/dashboard/reports/LoanDetails/ReferredCharts.jsx new file mode 100644 index 0000000..7f29513 --- /dev/null +++ b/src/components/dashboard/reports/LoanDetails/ReferredCharts.jsx @@ -0,0 +1,60 @@ +import {Box, Grid, Typography} from "@mui/material"; +import RadialBarSemiCircularChart from "@/components/dashboard/reports/LoanDetails/RadialBarSemiCircularChart"; +import {useTranslations} from "next-intl"; // Make sure to import React if it's not already imported + +const ReferredCharts = ({reportList}) => { + const t = useTranslations(); + const DataItemsName = [ + {id: "referred_loans_to_bank", name: t("reports.referred_loans_to_bank")}, + {id: "paid_loans", name: t("reports.paid_loans")} + ]; + + return ( + + {Object.entries(reportList).map(([entryKey, innerObject]) => { + const ItemName = DataItemsName.find(item => item.id === entryKey).name; + return ( + + + {ItemName} + + + {innerObject.map((item, index) => { + let percentage = item.total_amount !== 0 ? item.total_amount / innerObject.total_budget * 100 : 0; + return ( + + + {item.vehicle_type} + + {t("reports.dynamic_total_budget", { + total_budget: (item.total_budget / 1000000).toLocaleString("en"), + })} + + + `${val}%`} + label={t("reports.dynamic_label_referred", { + count: (item.count).toLocaleString("en"), + total_amount: (item.total_amount / 1000000).toLocaleString("en") + })}/> + + ); + })} + + + ); + })} + + ); +}; + +export default ReferredCharts; \ No newline at end of file diff --git a/src/components/dashboard/reports/LoanDetails/functionalityCharts.jsx b/src/components/dashboard/reports/LoanDetails/functionalityCharts.jsx deleted file mode 100644 index 200544d..0000000 --- a/src/components/dashboard/reports/LoanDetails/functionalityCharts.jsx +++ /dev/null @@ -1,66 +0,0 @@ -import {Grid, Typography} from "@mui/material"; -import {useTranslations} from "next-intl"; -import LoadingHardPage from "@/core/components/LoadingHardPage"; -import AnalyticsIcon from "@mui/icons-material/Analytics"; -import RadialBarSemiCircularChart from "@/components/dashboard/reports/LoanDetails/RadialBarSemiCircularChart"; - -const FunctionalityCharts = () => { - const t = useTranslations(); - const DataItemsName = [ - {id: "expert", name: t("reports.expert")}, - {id: "transportation_assistant", name: t("reports.transportation_assistant")}, - {id: "province_manager", name: t("reports.province_manager")}, - {id: "bank", name: t("reports.bank")} - ] - - return ( - - {isLoadingReportList ? ( - - } - loading={isLoadingReportList} - label={t("reports.loading_fetching_reports")} - width={100} - height={100} - sx={{position: "absolute", bgcolor: "#f7f7f7e6"}} - /> - - ) : errorReportList ? ( - - {t("reports.error_fetching_reports")} - - ) : ( - <> - { - Object.entries(reportList).map(([entryKey, innerObject]) => { - let percentage = innerObject.total !== 0 ? (innerObject.total - innerObject.pending) / innerObject.total * 100 : 0; - const ItemName = DataItemsName.find(item => item.id === entryKey).name; - return ( - - {ItemName} - - - ) - }) - } - - )} - - ) -}; - -export default FunctionalityCharts; diff --git a/src/components/dashboard/reports/LoanDetails/index.jsx b/src/components/dashboard/reports/LoanDetails/index.jsx index b0e9b9a..1178246 100644 --- a/src/components/dashboard/reports/LoanDetails/index.jsx +++ b/src/components/dashboard/reports/LoanDetails/index.jsx @@ -1,20 +1,15 @@ -import {Grid, Paper, Typography} from "@mui/material"; +import {Divider, Grid, Paper, Stack, Typography} from "@mui/material"; import {useTranslations} from "next-intl"; import Filter from "@/components/dashboard/reports/Filter"; import useChart from "@/lib/app/hooks/useChart"; import {GET_LOAN_EXPERTPROGRESS, GET_LOAN_REFERREDLOANS} from "@/core/data/apiRoutes"; import LoadingHardPage from "@/core/components/LoadingHardPage"; import AnalyticsIcon from "@mui/icons-material/Analytics"; -import RadialBarSemiCircularChart from "@/components/dashboard/reports/LoanDetails/RadialBarSemiCircularChart"; +import FunctionalityCharts from "@/components/dashboard/reports/LoanDetails/FunctionalityCharts"; +import ReferredCharts from "@/components/dashboard/reports/LoanDetails/ReferredCharts"; const LoanDetails = () => { const t = useTranslations(); - const DataItemsName = [ - {id: "expert", name: t("reports.expert")}, - {id: "transportation_assistant", name: t("reports.transportation_assistant")}, - {id: "province_manager", name: t("reports.province_manager")}, - {id: "bank", name: t("reports.bank")} - ] const { errorReportList: errorReportList1, @@ -36,26 +31,30 @@ const LoanDetails = () => { return ( { + setFilterOption1(fields); + setFilterOption2(fields) + }} + isLoadingReportList={isLoadingReportList1 || isLoadingReportList2} + mutate={() => { + mutate1(); + mutate2() + }} /> - {isLoadingReportList1 ? ( + {isLoadingReportList1 || isLoadingReportList2 ? ( } - loading={isLoadingReportList1} + loading={isLoadingReportList1 || isLoadingReportList2} label={t("reports.loading_fetching_reports")} width={100} height={100} sx={{position: "absolute", bgcolor: "#f7f7f7e6"}} /> - ) : errorReportList1 ? ( + ) : errorReportList1 || errorReportList2 ? ( { }}>{t("reports.error_fetching_reports")} ) : ( - <> - { - Object.entries(reportList1).map(([entryKey, innerObject]) => { - let percentage = innerObject.total !== 0 ? (innerObject.total - innerObject.pending) / innerObject.total * 100 : 0; - const ItemName = DataItemsName.find(item => item.id === entryKey).name; - return ( - - {ItemName} - - - ) - }) - } - - )} + + + + + + ) + } ) diff --git a/src/components/dashboard/reports/LoanDetails/referredCharts.jsx b/src/components/dashboard/reports/LoanDetails/referredCharts.jsx deleted file mode 100644 index e69de29..0000000 From d65eb261ed2483f08ded1f150d226092eaafa700 Mon Sep 17 00:00:00 2001 From: Mohammad Jalali Date: Mon, 15 Jan 2024 16:02:21 +0330 Subject: [PATCH 7/8] update pages import type --- src/pages/dashboard/old-reports/index.jsx | 2 +- src/pages/dashboard/reports/index.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/dashboard/old-reports/index.jsx b/src/pages/dashboard/old-reports/index.jsx index 58e75e5..31e36cd 100644 --- a/src/pages/dashboard/old-reports/index.jsx +++ b/src/pages/dashboard/old-reports/index.jsx @@ -1,4 +1,4 @@ -import DashboardReportsComponent from "src/components/dashboard/old-reports"; +import DashboardReportsComponent from "@/components/dashboard/old-reports"; import {parse} from "next-useragent"; export default function Reports() { diff --git a/src/pages/dashboard/reports/index.jsx b/src/pages/dashboard/reports/index.jsx index 2e13d50..7a7de52 100644 --- a/src/pages/dashboard/reports/index.jsx +++ b/src/pages/dashboard/reports/index.jsx @@ -1,4 +1,4 @@ -import DashboardReportsComponent from "src/components/dashboard/reports"; +import DashboardReportsComponent from "@/components/dashboard/reports"; import {parse} from "next-useragent"; export default function Reports() { From 0f0934c0ca8dba4d6f8c851e97e310205a5ac5b0 Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Mon, 15 Jan 2024 16:23:44 +0330 Subject: [PATCH 8/8] change version --- example.env.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example.env.local b/example.env.local index d7db66e..cbea825 100644 --- a/example.env.local +++ b/example.env.local @@ -1,5 +1,5 @@ NEXT_PUBLIC_API_NAME = "Loan Facilities Dashboard" -NEXT_PUBLIC_API_VERSION = "1.28.6" +NEXT_PUBLIC_API_VERSION = "1.29.0" NEXT_PUBLIC_DEFAULT_LANGUAGE = "fa" NEXT_PUBLIC_DEFAULT_DIRECTION = "rtl"