diff --git a/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js b/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js index 7ededbe..f7656e9 100644 --- a/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js +++ b/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js @@ -8,7 +8,11 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) e.target.select(); } - const onChange = (value) => { + /*const onChange = (value) => { + table.options.meta?.updateData(index, id, value); + };*/ + + const onBlur = (value) => { table.options.meta?.updateData(index, id, value); }; @@ -16,8 +20,9 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) onChange(e.value)} + /*onValueChange={(e) => onChange(e.value)}*/ onFocus={onFocus} + onBlur={(e) => onBlur(e.target.value)} minFractionDigits={0} maxFractionDigits={2} locale='it-IT' diff --git a/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js b/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js index 7ededbe..4256294 100644 --- a/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js +++ b/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js @@ -8,7 +8,12 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) e.target.select(); } - const onChange = (value) => { + /*const onChange = (value) => { + console.log('table.options.meta', table.options.meta) + table.options.meta?.updateData(index, id, value); + };*/ + + const onBlur = (value) => { table.options.meta?.updateData(index, id, value); }; @@ -16,8 +21,9 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) onChange(e.value)} + /*onValueChange={(e) => onChange(e.value)}*/ onFocus={onFocus} + onBlur={(e) => onBlur(e.target.value)} minFractionDigits={0} maxFractionDigits={2} locale='it-IT' diff --git a/src/components/FormField/components/Table/index.js b/src/components/FormField/components/Table/index.js index 8edd2d7..0edcb06 100644 --- a/src/components/FormField/components/Table/index.js +++ b/src/components/FormField/components/Table/index.js @@ -122,13 +122,8 @@ const Table = ({ useEffect(() => { const stateFieldData = pathOr([], ['stateFieldData'], tableColumns); - /*const obj = stateFieldData - .reduce((acc, cur) => { - acc[cur.name] = '' - return acc; - }, {});*/ let rowsData = pathOr([], ['rowsData'], tableColumns); - //rowsData = isEmpty(rowsData) ? [obj] : rowsData; + setColumnsCfg(stateFieldData); setRowsCfg(rowsData); 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/DashboardBeneficiario/components/LatestBandiBeneficiarioTableAsync/index.js b/src/pages/DashboardBeneficiario/components/LatestBandiBeneficiarioTableAsync/index.js index f67380d..4140930 100644 --- a/src/pages/DashboardBeneficiario/components/LatestBandiBeneficiarioTableAsync/index.js +++ b/src/pages/DashboardBeneficiario/components/LatestBandiBeneficiarioTableAsync/index.js @@ -4,8 +4,12 @@ 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'; // tools import getTimeParsedFromString from '../../../../helpers/getTimeParsedFromString'; @@ -14,6 +18,7 @@ import getFormattedDateString from '../../../../helpers/getFormattedDateString'; import getBandoLabel from '../../../../helpers/getBandoLabel'; import getBandoSeverity from '../../../../helpers/getBandoSeverity'; import getQueryParamsForPaginatedEndpoint from '../../../../helpers/getQueryParamsForPaginatedEndpoint'; +import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse'; // components import { DataTable } from 'primereact/datatable'; @@ -24,11 +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'; -import PreferredBandoService from '../../../../service/preferred-bando-service'; -import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse'; 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 69144d4..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 LatestBandiTable from '../DashboardBeneficiario/components/LatestBandiTable'; +import LatestBandiBeneficiarioTableAsync from '../DashboardBeneficiario/components/LatestBandiBeneficiarioTableAsync'; const DashboardBeneficiarioConfidi = () => { const navigate = useNavigate(); @@ -108,7 +108,7 @@ const DashboardBeneficiarioConfidi = () => {

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

- +