From 4378134e3543e6ebcf0033b4e3039501d09ed84a Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Fri, 2 May 2025 09:27:11 +0200 Subject: [PATCH 01/13] - confidi only calls updated api implementation; --- .../components/LatestBandiTableAsync/index.js | 10 +++++++++- .../LatestBandiBeneficiarioTableAsync/index.js | 4 ++-- src/pages/DashboardBeneficiarioConfidi/index.js | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/pages/Dashboard/components/LatestBandiTableAsync/index.js b/src/pages/Dashboard/components/LatestBandiTableAsync/index.js index 60a62ef..cd73c46 100644 --- a/src/pages/Dashboard/components/LatestBandiTableAsync/index.js +++ b/src/pages/Dashboard/components/LatestBandiTableAsync/index.js @@ -25,6 +25,7 @@ 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); @@ -169,8 +170,15 @@ const LatestBandiTableAsync = () => { useEffect(() => { setLocalAsyncRequest(true); const paginationQuery = getPaginationQuery(); + const role = storeGet('getRole'); - BandoService.getBandiPaginated(paginationQuery, getCallback, errGetCallbacks); + if (role === 'ROLE_CONFIDI') { + BandoService.getBandiPaginated(paginationQuery, getCallback, errGetCallbacks, [ + ['onlyConfidiCall', true] + ]); + } else { + 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 f67380d..5862818 100644 --- a/src/pages/DashboardBeneficiario/components/LatestBandiBeneficiarioTableAsync/index.js +++ b/src/pages/DashboardBeneficiario/components/LatestBandiBeneficiarioTableAsync/index.js @@ -6,6 +6,7 @@ import translationStrings from '../../../../translationStringsForComponents'; // api import BandoService from '../../../../service/bando-service'; +import PreferredBandoService from '../../../../service/preferred-bando-service'; // tools import getTimeParsedFromString from '../../../../helpers/getTimeParsedFromString'; @@ -14,6 +15,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'; @@ -25,8 +27,6 @@ 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 [localAsyncRequest, setLocalAsyncRequest] = useState(false); diff --git a/src/pages/DashboardBeneficiarioConfidi/index.js b/src/pages/DashboardBeneficiarioConfidi/index.js index 69144d4..deeb738 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 LatestBandiTableAsync from '../Dashboard/components/LatestBandiTableAsync'; const DashboardBeneficiarioConfidi = () => { const navigate = useNavigate(); @@ -108,7 +108,7 @@ const DashboardBeneficiarioConfidi = () => {

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

- +
From bd0503e73600979ac2880f97d01e63aa7cc2e921 Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Fri, 2 May 2025 09:54:06 +0200 Subject: [PATCH 02/13] - re-added pagination endpoint for getting confidi calls; --- .../components/LatestBandiTable/index.js | 8 +++++--- .../components/LatestBandiTableAsync/index.js | 10 +--------- .../index.js | 19 ++++++++++++++++--- .../components/LatestBandiTable/index.js | 2 +- .../MyLatestSubmissionsTableAsync/index.js | 15 ++++++++------- .../DashboardBeneficiarioConfidi/index.js | 4 ++-- 6 files changed, 33 insertions(+), 25 deletions(-) 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')}

- +
From a4724ed5a82e9752a8dfcc5e0407860d9149dc05 Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Fri, 2 May 2025 10:02:33 +0200 Subject: [PATCH 03/13] - implemented versions for vat check api; --- src/pages/AddCompany/index.js | 48 +++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/src/pages/AddCompany/index.js b/src/pages/AddCompany/index.js index 6a21b84..bf8ede9 100644 --- a/src/pages/AddCompany/index.js +++ b/src/pages/AddCompany/index.js @@ -115,23 +115,43 @@ const AddCompany = () => { const checkVatCallback = (data) => { if (data.status === 'SUCCESS') { + const version = data.data.version; const resp = data.data.vatCheckResponse.data; if (!isEmpty(resp)) { - const firstItem = resp[0]; - const { - taxCode, vatCode, address, companyName, pec - } = firstItem; - const { streetName, zipCode, town } = address?.registeredOffice; + let formData = {}; - const formData = { - cap: zipCode, - pec, - email: pec, - city: town, - codiceFiscale: taxCode ? taxCode : vatCode, - address: streetName, - vatNumber: vatCode, - companyName + if (version === 'V2') { + const firstItem = resp[0]; + const { + taxCode, vatCode, address, companyName, pec + } = firstItem; + const { streetName, zipCode, town } = address?.registeredOffice; + + formData = { + cap: zipCode, + pec, + email: pec, + city: town, + codiceFiscale: taxCode ? taxCode : vatCode, + address: streetName, + vatNumber: vatCode, + companyName + } + } else { + const { + cap, cf, denominazione, piva, indirizzo, comune, dettaglio: { pec } + } = resp; + + formData = { + cap, + pec, + email: pec, + city: comune, + codiceFiscale: cf ? cf : piva, + address: indirizzo, + vatNumber: piva, + companyName: denominazione + } } Object.keys(formData).map(k => setValue(k, formData[k])); setVatCheckResponse(data.data.vatCheckResponse); From ec9db083adae026b5bf8e8c20de1d9a33444262f Mon Sep 17 00:00:00 2001 From: Noemi Pusceddu Date: Wed, 7 May 2025 11:08:15 +0200 Subject: [PATCH 04/13] add button --- package.json | 177 +++++++++--------- .../DomandeTablePreInstructorAsync/index.js | 21 ++- 2 files changed, 107 insertions(+), 91 deletions(-) diff --git a/package.json b/package.json index a463d6b..e9c3a7e 100644 --- a/package.json +++ b/package.json @@ -1,90 +1,91 @@ { - "name": "bflows-gepafin", - "version": "1.0.0", - "private": true, - "dependencies": { - "@babel/plugin-proposal-private-property-in-object": "7.21.11", - "@babel/preset-react": "7.26.3", - "@date-fns/tz": "1.2.0", - "@emailjs/browser": "4.4.1", - "@number-flow/react": "0.5.9", - "@sentry/browser": "9.11.0", - "@stomp/stompjs": "7.1.1", - "@tanstack/react-table": "8.21.2", - "@wordpress/i18n": "5.21.0", - "@wordpress/react-i18n": "4.21.0", - "codice-fiscale-js": "2.3.22", - "copy-to-clipboard": "3.3.3", - "deep-object-diff": "1.1.9", - "dompurify": "3.2.5", - "expression-language": "1.2.0", - "fast-deep-equal": "3.1.3", - "hotkeys-js": "3.13.9", - "html-react-parser": "5.2.3", - "jwt-decode": "4.0.0", - "klona": "2.0.6", - "leader-line-new": "1.1.9", - "luxon": "3.6.1", - "mathjs": "14.4.0", - "mustache": "4.2.0", - "object-path-immutable": "4.1.2", - "primeicons": "7.0.0", - "primereact": "10.9.4", - "quill": "2.0.3", - "ramda": "0.30.1", - "react": "19.1.0", - "react-dnd": "16.0.1", - "react-dnd-html5-backend": "16.0.1", - "react-dom": "19.1.0", - "react-hook-form": "7.55.0", - "react-router-dom": "7.5.0", - "react-scripts": "5.0.1", - "recharts": "2.15.2", - "sockjs-client": "1.6.1", - "validate.js": "0.13.1", - "zustand": "5.0.3", - "zustand-x": "6.1.0" - }, - "devDependencies": { - "@babel/cli": "7.27.0", - "@babel/core": "7.26.10", - "@babel/plugin-syntax-jsx": "7.25.9", - "@wordpress/babel-plugin-makepot": "6.21.0", - "babel-plugin-macros": "3.1.0", - "node-wp-i18n": "1.2.7", - "sass": "1.86.3", - "sass-loader": "16.0.5" - }, - "scripts": { - "start": "GENERATE_SOURCEMAP=false react-scripts start", - "start:dev": "cp environments/dev/* public/loaded-files && rm public/loaded-files/dev.env && cp environments/dev/dev.env .env && PORT=8000 react-scripts start --mode development", - "start:prod": "cp environments/prod/* public/loaded-files && rm public/loaded-files/prod.env && cp environments/prod/prod.env .env && react-scripts start --mode production", - "build": "react-scripts build", - "build:dev": "cp environments/dev/* public/loaded-files && rm public/loaded-files/dev.env && cp environments/dev/dev.env .env && react-scripts build --mode development", - "build:prod": "cp environments/prod/* public/loaded-files && rm public/loaded-files/prod.env && cp environments/prod/prod.env .env && react-scripts build --mode production", - "test": "react-scripts test", - "eject": "react-scripts eject", - "make-pot": "wpi18n makepot --domain-path=languages --domain=gepafin" - }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ], - "rules": { - "react-hooks/exhaustive-deps": "off" + "name": "bflows-gepafin", + "version": "1.0.0", + "private": true, + "dependencies": { + "@babel/plugin-proposal-private-property-in-object": "7.21.11", + "@babel/preset-react": "7.26.3", + "@date-fns/tz": "1.2.0", + "@emailjs/browser": "4.4.1", + "@number-flow/react": "0.5.9", + "@sentry/browser": "9.11.0", + "@stomp/stompjs": "7.1.1", + "@tanstack/react-table": "8.21.2", + "@wordpress/i18n": "5.21.0", + "@wordpress/react-i18n": "4.21.0", + "codice-fiscale-js": "2.3.22", + "copy-to-clipboard": "3.3.3", + "deep-object-diff": "1.1.9", + "dompurify": "3.2.5", + "expression-language": "1.2.0", + "fast-deep-equal": "3.1.3", + "hotkeys-js": "3.13.9", + "html-react-parser": "5.2.3", + "jwt-decode": "4.0.0", + "klona": "2.0.6", + "leader-line-new": "1.1.9", + "luxon": "3.6.1", + "mathjs": "14.4.0", + "mustache": "4.2.0", + "object-path-immutable": "4.1.2", + "primeicons": "7.0.0", + "primereact": "10.9.4", + "quill": "2.0.3", + "ramda": "0.30.1", + "react": "19.1.0", + "react-dnd": "16.0.1", + "react-dnd-html5-backend": "16.0.1", + "react-dom": "19.1.0", + "react-hook-form": "7.55.0", + "react-router-dom": "7.5.0", + "react-scripts": "5.0.1", + "recharts": "2.15.2", + "sockjs-client": "1.6.1", + "validate.js": "0.13.1", + "zustand": "5.0.3", + "zustand-x": "6.1.0" + }, + "devDependencies": { + "@babel/cli": "7.27.0", + "@babel/core": "7.26.10", + "@babel/plugin-syntax-jsx": "7.25.9", + "@wordpress/babel-plugin-makepot": "6.21.0", + "babel-plugin-macros": "3.1.0", + "node-wp-i18n": "1.2.7", + "sass": "1.86.3", + "sass-loader": "16.0.5" + }, + "scripts": { + "start": "GENERATE_SOURCEMAP=false react-scripts start", + "start2": "react-scripts start", + "start:dev": "cp environments/dev/* public/loaded-files && rm public/loaded-files/dev.env && cp environments/dev/dev.env .env && PORT=8000 react-scripts start --mode development", + "start:prod": "cp environments/prod/* public/loaded-files && rm public/loaded-files/prod.env && cp environments/prod/prod.env .env && react-scripts start --mode production", + "build": "react-scripts build", + "build:dev": "cp environments/dev/* public/loaded-files && rm public/loaded-files/dev.env && cp environments/dev/dev.env .env && react-scripts build --mode development", + "build:prod": "cp environments/prod/* public/loaded-files && rm public/loaded-files/prod.env && cp environments/prod/prod.env .env && react-scripts build --mode production", + "test": "react-scripts test", + "eject": "react-scripts eject", + "make-pot": "wpi18n makepot --domain-path=languages --domain=gepafin" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ], + "rules": { + "react-hooks/exhaustive-deps": "off" + } + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] } - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - } -} +} \ No newline at end of file diff --git a/src/pages/DashboardPreInstructor/components/DomandeTablePreInstructorAsync/index.js b/src/pages/DashboardPreInstructor/components/DomandeTablePreInstructorAsync/index.js index 5d64bac..a2e4228 100644 --- a/src/pages/DashboardPreInstructor/components/DomandeTablePreInstructorAsync/index.js +++ b/src/pages/DashboardPreInstructor/components/DomandeTablePreInstructorAsync/index.js @@ -131,6 +131,7 @@ const DomandeTablePreInstructorAsync = ({ userId = null, statuses = [] }) => { }; const actionsBodyTemplate = (rowData) => { + console.log('status', rowData.status) if (rowData.status === 'AWAITING') { return
) } } From 32db0412eca74bfccdd3b3c4a3006f8b9fc26828 Mon Sep 17 00:00:00 2001 From: Noemi Pusceddu Date: Thu, 8 May 2025 11:30:36 +0200 Subject: [PATCH 06/13] restriction to upload more files with same name in FileUploadAsync --- package.json | 177 +++++++++--------- .../components/FileuploadAsync/index.js | 49 ++++- 2 files changed, 128 insertions(+), 98 deletions(-) diff --git a/package.json b/package.json index a463d6b..e9c3a7e 100644 --- a/package.json +++ b/package.json @@ -1,90 +1,91 @@ { - "name": "bflows-gepafin", - "version": "1.0.0", - "private": true, - "dependencies": { - "@babel/plugin-proposal-private-property-in-object": "7.21.11", - "@babel/preset-react": "7.26.3", - "@date-fns/tz": "1.2.0", - "@emailjs/browser": "4.4.1", - "@number-flow/react": "0.5.9", - "@sentry/browser": "9.11.0", - "@stomp/stompjs": "7.1.1", - "@tanstack/react-table": "8.21.2", - "@wordpress/i18n": "5.21.0", - "@wordpress/react-i18n": "4.21.0", - "codice-fiscale-js": "2.3.22", - "copy-to-clipboard": "3.3.3", - "deep-object-diff": "1.1.9", - "dompurify": "3.2.5", - "expression-language": "1.2.0", - "fast-deep-equal": "3.1.3", - "hotkeys-js": "3.13.9", - "html-react-parser": "5.2.3", - "jwt-decode": "4.0.0", - "klona": "2.0.6", - "leader-line-new": "1.1.9", - "luxon": "3.6.1", - "mathjs": "14.4.0", - "mustache": "4.2.0", - "object-path-immutable": "4.1.2", - "primeicons": "7.0.0", - "primereact": "10.9.4", - "quill": "2.0.3", - "ramda": "0.30.1", - "react": "19.1.0", - "react-dnd": "16.0.1", - "react-dnd-html5-backend": "16.0.1", - "react-dom": "19.1.0", - "react-hook-form": "7.55.0", - "react-router-dom": "7.5.0", - "react-scripts": "5.0.1", - "recharts": "2.15.2", - "sockjs-client": "1.6.1", - "validate.js": "0.13.1", - "zustand": "5.0.3", - "zustand-x": "6.1.0" - }, - "devDependencies": { - "@babel/cli": "7.27.0", - "@babel/core": "7.26.10", - "@babel/plugin-syntax-jsx": "7.25.9", - "@wordpress/babel-plugin-makepot": "6.21.0", - "babel-plugin-macros": "3.1.0", - "node-wp-i18n": "1.2.7", - "sass": "1.86.3", - "sass-loader": "16.0.5" - }, - "scripts": { - "start": "GENERATE_SOURCEMAP=false react-scripts start", - "start:dev": "cp environments/dev/* public/loaded-files && rm public/loaded-files/dev.env && cp environments/dev/dev.env .env && PORT=8000 react-scripts start --mode development", - "start:prod": "cp environments/prod/* public/loaded-files && rm public/loaded-files/prod.env && cp environments/prod/prod.env .env && react-scripts start --mode production", - "build": "react-scripts build", - "build:dev": "cp environments/dev/* public/loaded-files && rm public/loaded-files/dev.env && cp environments/dev/dev.env .env && react-scripts build --mode development", - "build:prod": "cp environments/prod/* public/loaded-files && rm public/loaded-files/prod.env && cp environments/prod/prod.env .env && react-scripts build --mode production", - "test": "react-scripts test", - "eject": "react-scripts eject", - "make-pot": "wpi18n makepot --domain-path=languages --domain=gepafin" - }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ], - "rules": { - "react-hooks/exhaustive-deps": "off" + "name": "bflows-gepafin", + "version": "1.0.0", + "private": true, + "dependencies": { + "@babel/plugin-proposal-private-property-in-object": "7.21.11", + "@babel/preset-react": "7.26.3", + "@date-fns/tz": "1.2.0", + "@emailjs/browser": "4.4.1", + "@number-flow/react": "0.5.9", + "@sentry/browser": "9.11.0", + "@stomp/stompjs": "7.1.1", + "@tanstack/react-table": "8.21.2", + "@wordpress/i18n": "5.21.0", + "@wordpress/react-i18n": "4.21.0", + "codice-fiscale-js": "2.3.22", + "copy-to-clipboard": "3.3.3", + "deep-object-diff": "1.1.9", + "dompurify": "3.2.5", + "expression-language": "1.2.0", + "fast-deep-equal": "3.1.3", + "hotkeys-js": "3.13.9", + "html-react-parser": "5.2.3", + "jwt-decode": "4.0.0", + "klona": "2.0.6", + "leader-line-new": "1.1.9", + "luxon": "3.6.1", + "mathjs": "14.4.0", + "mustache": "4.2.0", + "object-path-immutable": "4.1.2", + "primeicons": "7.0.0", + "primereact": "10.9.4", + "quill": "2.0.3", + "ramda": "0.30.1", + "react": "19.1.0", + "react-dnd": "16.0.1", + "react-dnd-html5-backend": "16.0.1", + "react-dom": "19.1.0", + "react-hook-form": "7.55.0", + "react-router-dom": "7.5.0", + "react-scripts": "5.0.1", + "recharts": "2.15.2", + "sockjs-client": "1.6.1", + "validate.js": "0.13.1", + "zustand": "5.0.3", + "zustand-x": "6.1.0" + }, + "devDependencies": { + "@babel/cli": "7.27.0", + "@babel/core": "7.26.10", + "@babel/plugin-syntax-jsx": "7.25.9", + "@wordpress/babel-plugin-makepot": "6.21.0", + "babel-plugin-macros": "3.1.0", + "node-wp-i18n": "1.2.7", + "sass": "1.86.3", + "sass-loader": "16.0.5" + }, + "scripts": { + "start": "GENERATE_SOURCEMAP=false react-scripts start", + "start2": "react-scripts start", + "start:dev": "cp environments/dev/* public/loaded-files && rm public/loaded-files/dev.env && cp environments/dev/dev.env .env && PORT=8000 react-scripts start --mode development", + "start:prod": "cp environments/prod/* public/loaded-files && rm public/loaded-files/prod.env && cp environments/prod/prod.env .env && react-scripts start --mode production", + "build": "react-scripts build", + "build:dev": "cp environments/dev/* public/loaded-files && rm public/loaded-files/dev.env && cp environments/dev/dev.env .env && react-scripts build --mode development", + "build:prod": "cp environments/prod/* public/loaded-files && rm public/loaded-files/prod.env && cp environments/prod/prod.env .env && react-scripts build --mode production", + "test": "react-scripts test", + "eject": "react-scripts eject", + "make-pot": "wpi18n makepot --domain-path=languages --domain=gepafin" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ], + "rules": { + "react-hooks/exhaustive-deps": "off" + } + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] } - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - } -} +} \ No newline at end of file diff --git a/src/components/FormField/components/FileuploadAsync/index.js b/src/components/FormField/components/FileuploadAsync/index.js index b422c78..a1404e4 100644 --- a/src/components/FormField/components/FileuploadAsync/index.js +++ b/src/components/FormField/components/FileuploadAsync/index.js @@ -13,6 +13,8 @@ import { FileUpload } from 'primereact/fileupload'; import { Tag } from 'primereact/tag'; import { Button } from 'primereact/button'; import { head, isEmpty } from 'ramda'; +import { Messages } from 'primereact/messages'; + import { defaultMaxFileSize, mimeTypes } from '../../../../configData'; import getFormatedFileSizeText from '../../../../helpers/getFormatedFileSizeText'; @@ -42,24 +44,50 @@ const FileuploadAsync = ({ const [acceptFormats, setAcceptFormats] = useState(''); const [formatsForInput, setFormatsForInput] = useState(''); const inputRef = useRef(); + const messagesRef = useRef(null); const customBase64Uploader = (event) => { const formData = new FormData() + const filesToUpload = []; + const uploadedFiles = inputRef.current ? inputRef.current.getUploadedFiles() : []; + const currentFiles = stateFieldData; + for (const file of event.files) { - formData.append('file', file) + const isDuplicate = [...uploadedFiles, ...currentFiles].some( + (uploadedFile)=>uploadedFile.name === file.name + ); + + if(isDuplicate){ + messagesRef.current.show({ + severity: 'error', + summary: __('Attenzione', 'gepafin'), + detail: `Il file con nome "${file.name}" è già stato caricato.`, + life: 10000 + }); + + } else { + formData.append('file', file) + filesToUpload.push(file); + } + } - FileUploadService.uploadFile(sourceId, formData, callback, errorCallback, [ - ['documentType', doctype.toUpperCase()], - ['sourceType', source.toUpperCase()] - ]); + if(filesToUpload.length > 0){ + FileUploadService.uploadFile(sourceId, formData, callback, errorCallback, [ + ['documentType', doctype.toUpperCase()], + ['sourceType', source.toUpperCase()] + ]); + } }; - const callback = (data) => { + const callback = (data, uploadedFiles) => { if (data.status === 'SUCCESS') { - setStateFieldData(data.data); - const uploadedFiles = inputRef.current.getUploadedFiles(); - setDataFn(fieldName, [...uploadedFiles, ...data.data], { shouldValidate: true }); + setStateFieldData(prevState => [...prevState, ...data.data]); + const currentUploadedFiles = inputRef.current.getUploadedFiles() || []; + + inputRef.current.setUploadedFiles([...currentUploadedFiles, ...data.data]); inputRef.current.setFiles([]); + + setDataFn(fieldName, [...currentUploadedFiles, ...data.data], { shouldValidate: true }); } } @@ -160,7 +188,7 @@ const FileuploadAsync = ({ useEffect(() => { if (inputRef.current) { - inputRef.current.setUploadedFiles(defaultValue); + inputRef.current.setUploadedFiles(defaultValue); } setStateFieldData(defaultValue); }, [defaultValue]); @@ -186,6 +214,7 @@ const FileuploadAsync = ({ return ( sourceId && sourceId !== 0 ? <> +
+
+ +
diff --git a/src/pages/SoccorsoIstruttorioPreInstructor/components/SoccorsiPreInstructorTableAsync/index.js b/src/pages/SoccorsoIstruttorioPreInstructor/components/SoccorsiPreInstructorTableAsync/index.js index e612ccc..5d856a0 100644 --- a/src/pages/SoccorsoIstruttorioPreInstructor/components/SoccorsiPreInstructorTableAsync/index.js +++ b/src/pages/SoccorsoIstruttorioPreInstructor/components/SoccorsiPreInstructorTableAsync/index.js @@ -22,6 +22,7 @@ import ProperBandoLabel from '../../../../components/ProperBandoLabel'; import { Dropdown } from 'primereact/dropdown'; import { Tag } from 'primereact/tag'; import { Calendar } from 'primereact/calendar'; +import SoccorsoResendEmails from '../../../SoccorsoEditPreInstructor/components/SoccorsoResendEmails'; const SoccorsiPreInstructorTableAsync = ({ userId = null }) => { const [localAsyncRequest, setLocalAsyncRequest] = useState(false); @@ -94,10 +95,25 @@ const SoccorsiPreInstructorTableAsync = ({ userId = null }) => { }); }; + const updateRowData = useCallback((id, updateResponse) => { + const newItems = items.map((o) => { + if (o.id === id) { + o.emailSendResponse = updateResponse; + } + return o; + }) + setItems(newItems); + }, [items]); + const actionsBodyTemplate = (rowData) => { - return -