diff --git a/client/src/components/report-center-modal/report-center-modal-filters-sorters-component.jsx b/client/src/components/report-center-modal/report-center-modal-filters-sorters-component.jsx index 98293a607..f544e63d6 100644 --- a/client/src/components/report-center-modal/report-center-modal-filters-sorters-component.jsx +++ b/client/src/components/report-center-modal/report-center-modal-filters-sorters-component.jsx @@ -1,9 +1,10 @@ -import {Button, Card, Col, Form, Input, InputNumber, Row, Select} from "antd"; +import {Button, Card, Checkbox, Col, Form, Input, InputNumber, Row, Select} from "antd"; import React, {useEffect, useState} from "react"; import {fetchFilterData} from "../../utils/RenderTemplate"; import {DeleteFilled} from "@ant-design/icons"; import {useTranslation} from "react-i18next"; import {getOperatorsByType} from "../../utils/graphQLmodifier"; +import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component"; export default function ReportCenterModalFiltersSortersComponent({form}) { return ( @@ -19,16 +20,19 @@ export default function ReportCenterModalFiltersSortersComponent({form}) { function RenderFilters({templateId, form}) { const [state, setState] = useState(null); const [visible, setVisible] = useState(false); + const [isLoading, setIsLoading] = useState(false); const {t} = useTranslation(); useEffect(() => { const fetch = async () => { + setIsLoading(true); const data = await fetchFilterData({name: templateId}); if (data?.success) { setState(data.data); } else { setState(null); } + setIsLoading(false); }; if (templateId) { @@ -37,11 +41,20 @@ function RenderFilters({templateId, form}) { }, [templateId]); - if (!templateId || !state) return null; - return ( - - + // Conditional display of filters and sorters + if (!templateId) return null; + if (isLoading) return ; + if (!state) return null; + // Filters and Sorters data available + return ( +
+ setVisible(e.target.checked)} + children={t('reportcenter.labels.advanced_filters')} + /> {visible && (
{state.filters && state.filters.length > 0 && ( @@ -256,6 +269,6 @@ function RenderFilters({templateId, form}) { )}
)} - +
); } \ No newline at end of file