diff --git a/src/pages/Dashboard/components/LatestBandiTable/index.js b/src/pages/Dashboard/components/LatestBandiTable/index.js index 0334758..f8758d4 100644 --- a/src/pages/Dashboard/components/LatestBandiTable/index.js +++ b/src/pages/Dashboard/components/LatestBandiTable/index.js @@ -5,6 +5,10 @@ import { uniq } from 'ramda'; // api import BandoService from '../../../../service/bando-service'; +// tools +import getTimeParsedFromString from '../../../../helpers/getTimeParsedFromString'; +import getTimeFromISOstring from '../../../../helpers/getTimeFromISOstring'; + // components import { FilterMatchMode, FilterOperator } from 'primereact/api'; import { DataTable } from 'primereact/datatable'; @@ -13,10 +17,8 @@ import { Button } from 'primereact/button'; import { Calendar } from 'primereact/calendar'; import ProperBandoLabel from '../../../../components/ProperBandoLabel'; import { Link } from 'react-router-dom'; -import translationStrings from '../../../../translationStringsForComponents'; -import getTimeParsedFromString from '../../../../helpers/getTimeParsedFromString'; -import getTimeFromISOstring from '../../../../helpers/getTimeFromISOstring'; +import translationStrings from '../../../../translationStringsForComponents'; const LatestBandiTable = () => { const [items, setItems] = useState(null); diff --git a/src/pages/Dashboard/components/LatestBandiTableAsync/index.js b/src/pages/Dashboard/components/LatestBandiTableAsync/index.js index cd73c46..60a62ef 100644 --- a/src/pages/Dashboard/components/LatestBandiTableAsync/index.js +++ b/src/pages/Dashboard/components/LatestBandiTableAsync/index.js @@ -25,7 +25,6 @@ import ProperBandoLabel from '../../../../components/ProperBandoLabel'; import { Dropdown } from 'primereact/dropdown'; import { Tag } from 'primereact/tag'; import { Calendar } from 'primereact/calendar'; -import { storeGet } from '../../../../store'; const LatestBandiTableAsync = () => { const [localAsyncRequest, setLocalAsyncRequest] = useState(false); @@ -170,15 +169,8 @@ const LatestBandiTableAsync = () => { useEffect(() => { setLocalAsyncRequest(true); const paginationQuery = getPaginationQuery(); - const role = storeGet('getRole'); - if (role === 'ROLE_CONFIDI') { - BandoService.getBandiPaginated(paginationQuery, getCallback, errGetCallbacks, [ - ['onlyConfidiCall', true] - ]); - } else { - BandoService.getBandiPaginated(paginationQuery, getCallback, errGetCallbacks); - } + BandoService.getBandiPaginated(paginationQuery, getCallback, errGetCallbacks); }, [lazyState]); return ( diff --git a/src/pages/DashboardBeneficiario/components/LatestBandiBeneficiarioTableAsync/index.js b/src/pages/DashboardBeneficiario/components/LatestBandiBeneficiarioTableAsync/index.js index 5862818..4140930 100644 --- a/src/pages/DashboardBeneficiario/components/LatestBandiBeneficiarioTableAsync/index.js +++ b/src/pages/DashboardBeneficiario/components/LatestBandiBeneficiarioTableAsync/index.js @@ -4,6 +4,9 @@ import { Link } from 'react-router-dom'; import translationStrings from '../../../../translationStringsForComponents'; +// store +import { storeGet, useStoreValue } from '../../../../store'; + // api import BandoService from '../../../../service/bando-service'; import PreferredBandoService from '../../../../service/preferred-bando-service'; @@ -26,9 +29,9 @@ import { Dropdown } from 'primereact/dropdown'; import { Tag } from 'primereact/tag'; import { Calendar } from 'primereact/calendar'; import { isNil } from 'ramda'; -import { storeGet } from '../../../../store'; const LatestBandiBeneficiarioTableAsync = () => { + const chosenCompanyId = useStoreValue('chosenCompanyId'); const [localAsyncRequest, setLocalAsyncRequest] = useState(false); const [items, setItems] = useState(null); const [totalRecordsNum, setTotalRecordsNum] = useState(0); @@ -197,9 +200,19 @@ const LatestBandiBeneficiarioTableAsync = () => { useEffect(() => { setLocalAsyncRequest(true); const paginationQuery = getPaginationQuery(); + const role = storeGet('getRole'); - BandoService.getBandiPaginated(paginationQuery, getCallback, errGetCallbacks); - }, [lazyState]); + if (role === 'ROLE_CONFIDI') { + BandoService.getBandiPaginated(paginationQuery, getCallback, errGetCallbacks, [ + ['companyId', chosenCompanyId], + ['onlyConfidiCall', true] + ]); + } else { + BandoService.getBandiPaginated(paginationQuery, getCallback, errGetCallbacks, [ + ['companyId', chosenCompanyId] + ]); + } + }, [lazyState, chosenCompanyId]); return (
diff --git a/src/pages/DashboardBeneficiario/components/LatestBandiTable/index.js b/src/pages/DashboardBeneficiario/components/LatestBandiTable/index.js index 596643e..ca40eda 100644 --- a/src/pages/DashboardBeneficiario/components/LatestBandiTable/index.js +++ b/src/pages/DashboardBeneficiario/components/LatestBandiTable/index.js @@ -33,7 +33,7 @@ const LatestBandiTable = () => { useEffect(() => { setLoading(true); - const role = storeGet('getRole') + const role = storeGet('getRole'); if (role === 'ROLE_CONFIDI') { BandoService.getBandi(getCallback, errGetCallbacks, [ diff --git a/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTableAsync/index.js b/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTableAsync/index.js index 2a29a85..bc189c9 100644 --- a/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTableAsync/index.js +++ b/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTableAsync/index.js @@ -31,7 +31,6 @@ import { ProgressBar } from 'primereact/progressbar'; const MyLatestSubmissionsTableAsync = () => { const chosenCompanyId = useStoreValue('chosenCompanyId'); - const companies = useStoreValue('companies'); const [localAsyncRequest, setLocalAsyncRequest] = useState(false); const [items, setItems] = useState(null); const [totalRecordsNum, setTotalRecordsNum] = useState(0); @@ -194,13 +193,15 @@ const MyLatestSubmissionsTableAsync = () => { }; useEffect(() => { - setLocalAsyncRequest(true); - const paginationQuery = getPaginationQuery(); + if (chosenCompanyId && chosenCompanyId !== 0) { + setLocalAsyncRequest(true); + const paginationQuery = getPaginationQuery(); - ApplicationService.getApplicationsPaginated(paginationQuery, getCallback, errGetCallbacks, [ - ['companyId', chosenCompanyId] - ]); - }, [lazyState, chosenCompanyId, companies]); + ApplicationService.getApplicationsPaginated(paginationQuery, getCallback, errGetCallbacks, [ + ['companyId', chosenCompanyId] + ]); + } + }, [lazyState, chosenCompanyId]); return (
diff --git a/src/pages/DashboardBeneficiarioConfidi/index.js b/src/pages/DashboardBeneficiarioConfidi/index.js index deeb738..7bd03bb 100644 --- a/src/pages/DashboardBeneficiarioConfidi/index.js +++ b/src/pages/DashboardBeneficiarioConfidi/index.js @@ -14,7 +14,7 @@ import DashboardService from '../../service/dashboard-service'; import { Button } from 'primereact/button'; import ErrorBoundary from '../../components/ErrorBoundary'; import MyLatestSubmissionsTableAsync from '../DashboardBeneficiario/components/MyLatestSubmissionsTableAsync'; -import LatestBandiTableAsync from '../Dashboard/components/LatestBandiTableAsync'; +import LatestBandiBeneficiarioTableAsync from '../DashboardBeneficiario/components/LatestBandiBeneficiarioTableAsync'; const DashboardBeneficiarioConfidi = () => { const navigate = useNavigate(); @@ -108,7 +108,7 @@ const DashboardBeneficiarioConfidi = () => {

{__('Bandi disponibili', 'gepafin')}

- +