diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index e69366b..be37df8 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -629,6 +629,7 @@ "provinces": "استان های", "province": "استان", "all_provinces": "تمامی استان ها", + "excel_export_reports": "خروجی به اکسل گزارش عملکرد", "year": "سال", "years": "سال های", "text_field_loading_provinces_list": "درحال دریافت استان ها", diff --git a/src/components/dashboard/reports/ExcelExport/index.jsx b/src/components/dashboard/reports/ExcelExport/index.jsx new file mode 100644 index 0000000..21ddaeb --- /dev/null +++ b/src/components/dashboard/reports/ExcelExport/index.jsx @@ -0,0 +1,63 @@ +import {Accordion, AccordionSummary, Box, Button, CircularProgress, Stack, Typography} from "@mui/material"; +import AssignmentIcon from '@mui/icons-material/Assignment'; +import BackupIcon from '@mui/icons-material/Backup'; +import {useTranslations} from "next-intl"; +import {GET_EXCEL_EXPORT} from "@/core/data/apiRoutes"; +import moment from "jalali-moment"; +import FileSaver from 'file-saver'; +import useRequest from "@/lib/app/hooks/useRequest"; +import {useState} from "react"; + +const ExcelExport = () => { + const t = useTranslations(); + const requestServer = useRequest(); + const [loading, setLoading] = useState(false); + + const clickHandler = () => { + setLoading(true) + requestServer(GET_EXCEL_EXPORT, 'get', { + auth: true, + requestOptions: {responseType: 'blob'} + }).then((response) => { + const filename = `گزارش عملکرد_${moment().format('jYYYY_jMM_jDD')}.xlsx`; + FileSaver.saveAs(response.data, filename); + }).catch(() => { + }).finally(() => { + setLoading(false) + }) + } + + return ( + + + + + + + + {t("filters.excel_export_reports")} + + + + + + + + ) +}; + +export default ExcelExport; \ No newline at end of file diff --git a/src/components/dashboard/reports/LoanDetails/FunctionalityCharts.jsx b/src/components/dashboard/reports/LoanDetails/FunctionalityCharts.jsx index 937fc34..b161a42 100644 --- a/src/components/dashboard/reports/LoanDetails/FunctionalityCharts.jsx +++ b/src/components/dashboard/reports/LoanDetails/FunctionalityCharts.jsx @@ -14,7 +14,7 @@ const FunctionalityCharts = ({reportList}) => { { Object.entries(reportList).map(([entryKey, innerObject]) => { - let percentage = innerObject.total !== 0 ? (innerObject.total - innerObject.pending) / innerObject.total * 100 : 0; + let percentage = innerObject.total !== 0 && innerObject.pending !== 64 ? (innerObject.total - innerObject.pending) / innerObject.total * 100 : 0; const ItemName = DataItemsName.find(item => item.id === entryKey).name; return ( { return ( <> + ) diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js index 39868f6..4b55607 100644 --- a/src/core/data/apiRoutes.js +++ b/src/core/data/apiRoutes.js @@ -225,6 +225,7 @@ export const GET_PERMISSIONS_LIST = // reports export const GET_EXPORT = BASE_URL + "/dashboard/exports/navgan" +export const GET_EXCEL_EXPORT = BASE_URL + "" 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"