diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index b36f081..12a1600 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -523,8 +523,10 @@ "years": "سال های", "text_field_loading_provinces_list": "درحال دریافت استان ها", "text_field_error_fetching_provinces": "خطا در دریافت استان ها", + "filter_btn": "فیلتر", "filter": "اعمال فیلتر", "excel_export": "خروجی به اکسل", - "export": "دریافت" + "export": "دریافت", + "update_again": "بروزرسانی مجدد" } } diff --git a/src/components/dashboard/reports/ExcelExport/index.jsx b/src/components/dashboard/reports/ExcelExport/index.jsx index f095cc7..472d8b8 100644 --- a/src/components/dashboard/reports/ExcelExport/index.jsx +++ b/src/components/dashboard/reports/ExcelExport/index.jsx @@ -1,4 +1,13 @@ -import {Accordion, AccordionDetails, AccordionSummary, Box, Button, Stack, Typography} from "@mui/material"; +import { + Accordion, + AccordionDetails, + AccordionSummary, + Box, + Button, + CircularProgress, + Stack, + Typography +} from "@mui/material"; import FileUploadIcon from '@mui/icons-material/FileUpload'; import AssignmentIcon from '@mui/icons-material/Assignment'; import BackupIcon from '@mui/icons-material/Backup'; @@ -53,7 +62,11 @@ const ExcelExport = () => { ? `?${fields.map((option) => `${option.key}=${option.value}`).join('&')}` : ''; setSubmitting(true) - requestServer(`${GET_EXPORT}${queryString}`, 'GET', {auth: true, requestOptions: {responseType: 'blob'}}) + requestServer(`${GET_EXPORT}${queryString}`, 'GET', { + auth: true, + notification: false, + requestOptions: {responseType: 'blob'} + }) .then((response) => { const filename = `گزارش درخواست های وام ناوگان تاریخ_${moment().format('jYYYY_jMM_jDD')}.xlsx`; FileSaver.saveAs(response.data, filename); @@ -85,7 +98,13 @@ const ExcelExport = () => { + sx={{ + display: "flex", + flexDirection: {xs: "column", sm: "row"}, + justifyContent: "space-between", + alignItems: "center", + mx: "auto", + }}> {filter_by_province ? { diff --git a/src/components/dashboard/reports/Filter/ProvinceFilter.jsx b/src/components/dashboard/reports/Filter/ProvinceFilter.jsx index 16a1133..7dacacc 100644 --- a/src/components/dashboard/reports/Filter/ProvinceFilter.jsx +++ b/src/components/dashboard/reports/Filter/ProvinceFilter.jsx @@ -47,7 +47,7 @@ const ProvinceFilter = ({formik, multiple, setFilteredText}) => { ? formik.values.province_id.length === 0 : formik.values.province_id === ""; return ( - + {t("filters.choose_province")} { const t = useTranslations(); const filter_by_province = filterItem.find((item) => item.type === "province"); @@ -97,18 +97,27 @@ const Filter = ({title, filterItem, setFilterOption, isLoadingReportList, mutate - mutate()} - size="small"> - - - setExpanded((prevExpanded) => !prevExpanded)} - size="small"> - - + + mutate()} + size="small"> + + + + + setExpanded((prevExpanded) => !prevExpanded)} + size="small"> + + + - + {filter_by_province ? { const t = useTranslations(); @@ -20,34 +22,32 @@ const LoanDistribution = () => { isLoadingReportList={isLoadingReportList} mutate={mutate} /> - + {isLoadingReportList ? ( - - - - - {t("reports.loading_fetching_reports")} - - - + + } + loading={isLoadingReportList} + label={t("reports.loading_fetching_reports")} + width={100} + height={100} + sx={{position: "absolute", bgcolor: "#f7f7f7e6"}} + /> + ) : errorReportList ? ( - - {t("reports.error_fetching_reports")} + + {t("reports.error_fetching_reports")} ) : ( <> - + - + diff --git a/src/components/dashboard/reports/LoanProgress/index.jsx b/src/components/dashboard/reports/LoanProgress/index.jsx index a516d04..dadac1e 100644 --- a/src/components/dashboard/reports/LoanProgress/index.jsx +++ b/src/components/dashboard/reports/LoanProgress/index.jsx @@ -5,6 +5,7 @@ import {useTranslations} from "next-intl"; import useChart from "@/lib/app/hooks/useChart"; import {GET_PROVINCE_PROGRESS} from "@/core/data/apiRoutes"; import LoadingHardPage from "@/core/components/LoadingHardPage"; +import AnalyticsIcon from '@mui/icons-material/Analytics'; const LoanProgress = () => { const t = useTranslations(); @@ -20,19 +21,44 @@ const LoanProgress = () => { mutate={mutate} /> - - {isLoadingReportList ? ( - // - - ) : errorReportList ? ( - {t("reports.error_fetching_reports")} - ) : ( + {isLoadingReportList ? ( + + } + loading={isLoadingReportList} + label={t("reports.loading_fetching_reports")} + width={100} + height={100} + sx={{position: "absolute", bgcolor: "#f7f7f7e6"}} + /> + + ) : errorReportList ? ( + + {t("reports.error_fetching_reports")} + + ) : ( + - )} - + + )} ) diff --git a/src/lib/app/hooks/useChart.jsx b/src/lib/app/hooks/useChart.jsx index 707f21d..d1dd454 100644 --- a/src/lib/app/hooks/useChart.jsx +++ b/src/lib/app/hooks/useChart.jsx @@ -21,7 +21,7 @@ const useChart = (chart_url) => { isValidating, mutate } = useSWR(filterOption.length !== 0 ? `${chart_url}${queryString}` : "", fetcher, { - revalidateIfStale: false, + revalidateIfStale: true, revalidateOnFocus: false, revalidateOnReconnect: false, keepPreviousData: true