diff --git a/src/helpers/validators.js b/src/helpers/validators.js
index 8923b2b..d24c99d 100644
--- a/src/helpers/validators.js
+++ b/src/helpers/validators.js
@@ -1,3 +1,27 @@
-export const isVAT = (v) => {
+export const isPIVA = (v) => {
+ return false;
+}
+
+export const isCodiceFiscale = (v) => {
+ return false;
+}
+
+export const isCAP = (v) => {
+ return false;
+}
+
+export const isIBAN = (v) => {
+ return false;
+}
+
+export const isEmail = (v) => {
+ return false;
+}
+
+export const isEmailPEC = (v) => {
+ return false;
+}
+
+export const isUrl = (v) => {
return false;
}
\ No newline at end of file
diff --git a/src/pages/BandoApplication/index.js b/src/pages/BandoApplication/index.js
index ad3e8bc..2261841 100644
--- a/src/pages/BandoApplication/index.js
+++ b/src/pages/BandoApplication/index.js
@@ -12,7 +12,15 @@ import { storeSet, useStore } from '../../store';
import FormsService from '../../service/forms-service';
// tools
-import { isVAT } from '../../helpers/validators';
+import {
+ isPIVA,
+ isCodiceFiscale,
+ isCAP,
+ isIBAN,
+ isEmail,
+ isEmailPEC,
+ isUrl
+} from '../../helpers/validators';
// components
import { Skeleton } from 'primereact/skeleton';
@@ -22,6 +30,7 @@ import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
import { formData as testformData } from '../../tempData';
import BandoService from '../../service/bando-service';
+import ApplicationService from '../../service/application-service';
const BandoApplication = () => {
const { id } = useParams();
@@ -41,20 +50,16 @@ const BandoApplication = () => {
const values = getValues();
const validationFns = {
- isVAT
+ isPIVA,
+ isCodiceFiscale,
+ isCAP,
+ isIBAN,
+ isEmail,
+ isEmailPEC,
+ isUrl
}
- const onSubmit = (formData) => {
- /*const newFormData = Object.keys(formData).reduce((acc, cur) => {
- acc.push({
- 'fieldId': cur,
- 'fieldValue': formData[cur] && formData[cur].getMonth ? formData[cur].toISOString() : formData[cur]
- });
- return acc;
- }, []);
- console.log('newFormData', newFormData);
- console.log('errors', errors);*/
- };
+ const onSubmit = () => {};
const saveDraft = () => {
trigger();
@@ -70,7 +75,7 @@ const BandoApplication = () => {
console.log('errors', errors);
};
- const getBandoId = () => {
+ const getApplicationId = () => {
const parsed = parseInt(id)
return !isNaN(parsed) ? parsed : 0;
}
@@ -94,11 +99,11 @@ const BandoApplication = () => {
}
useEffect(() => {
- const bandoId = getBandoId();
+ const applId = getApplicationId();
- if (bandoId) {
+ if (applId) {
storeSet.main.setAsyncRequest();
- FormsService.getFormsForCall(bandoId, getCallback, errGetCallbacks);
+ ApplicationService.getApplication(applId, getCallback, errGetCallbacks);
}
}, [id]);
diff --git a/src/pages/BandoFormsEdit/components/BuilderElementItem/index.js b/src/pages/BandoFormsEdit/components/BuilderElementItem/index.js
index e888a6f..8f77591 100644
--- a/src/pages/BandoFormsEdit/components/BuilderElementItem/index.js
+++ b/src/pages/BandoFormsEdit/components/BuilderElementItem/index.js
@@ -4,7 +4,7 @@ import { ItemTypes } from '../ItemTypes';
import uniqid from '../../../../helpers/uniqid';
-const BuilderElementItem = ({ dbId, name, label }) => {
+const BuilderElementItem = ({ dbId, name, label, description = '' }) => {
const ref = useRef(null);
const [{ isDragging }, drag] = useDrag(() => ({
@@ -28,7 +28,11 @@ const BuilderElementItem = ({ dbId, name, label }) => {
drag(ref);
return (
-
+
{label}
)
diff --git a/src/pages/BandoFormsEdit/components/FormBuilder/index.js b/src/pages/BandoFormsEdit/components/FormBuilder/index.js
index 8a346c8..a095f57 100644
--- a/src/pages/BandoFormsEdit/components/FormBuilder/index.js
+++ b/src/pages/BandoFormsEdit/components/FormBuilder/index.js
@@ -38,6 +38,7 @@ const FormBuilder = () => {
dbId={item.id}
label={item.label}
name={item.name}
+ description={item.description}
/>
)
}, []);
diff --git a/src/pages/BandoViewBeneficiario/index.js b/src/pages/BandoViewBeneficiario/index.js
index fcc87ee..099cbfe 100644
--- a/src/pages/BandoViewBeneficiario/index.js
+++ b/src/pages/BandoViewBeneficiario/index.js
@@ -20,6 +20,7 @@ import BandoService from '../../service/bando-service';
import { Messages } from 'primereact/messages';
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
import FaqItemService from '../../service/faq-item-service';
+import ApplicationService from '../../service/application-service';
const BandoViewBeneficiario = () => {
const isAsyncRequest = useStore().main.isAsyncRequest();
@@ -27,12 +28,9 @@ const BandoViewBeneficiario = () => {
const navigate = useNavigate();
const [data, setData] = useState({});
const [newQuestion, setNewQuestion] = useState('');
+ const [isApplRequest, setIsApplRequest] = useState(true);
const bandoMsgs = useRef(null);
- const closePreview = () => {
- navigate(`/tenders/${id}`);
- }
-
const scaricaBando = () => {
}
@@ -100,14 +98,14 @@ const BandoViewBeneficiario = () => {
storeSet.main.unsetAsyncRequest();
}
- const getCallback = (data) => {
+ const getBandoCallback = (data) => {
if (data.status === 'SUCCESS') {
setData(getFormattedBandiData(data.data));
}
storeSet.main.unsetAsyncRequest();
}
- const errGetCallback = (data) => {
+ const errGetBandoCallback = (data) => {
if (bandoMsgs.current && data.message) {
bandoMsgs.current.show([
{
@@ -126,11 +124,33 @@ const BandoViewBeneficiario = () => {
return data;
};
+ const getApplCallback = (data) => {
+ if (data.status === 'SUCCESS') {
+ console.log(data.data)
+ }
+ storeSet.main.unsetAsyncRequest();
+ }
+
+ const errGetApplCallback = (data) => {
+ /*if (bandoMsgs.current && data.message) {
+ bandoMsgs.current.show([
+ {
+ sticky: true, severity: 'error', summary: '',
+ detail: data.message,
+ closable: true
+ }
+ ]);
+ }*/
+ set404FromErrorResponse(data);
+ storeSet.main.unsetAsyncRequest();
+ }
+
useEffect(() => {
const parsed = parseInt(id)
const bandoId = !isNaN(parsed) ? parsed : 0;
storeSet.main.setAsyncRequest();
- BandoService.getBando(bandoId, getCallback, errGetCallback);
+ BandoService.getBando(bandoId, getBandoCallback, errGetBandoCallback);
+ ApplicationService.getApplications(getApplCallback, errGetApplCallback)
}, [id]);
return (
@@ -289,6 +309,7 @@ const BandoViewBeneficiario = () => {
icon="pi pi-download" iconPos="right"/>
diff --git a/src/pages/DashboardBeneficiario/components/LatestBandiTable/index.js b/src/pages/DashboardBeneficiario/components/LatestBandiTable/index.js
index 82bf47d..b7243b0 100644
--- a/src/pages/DashboardBeneficiario/components/LatestBandiTable/index.js
+++ b/src/pages/DashboardBeneficiario/components/LatestBandiTable/index.js
@@ -138,7 +138,7 @@ const LatestBandiTable = () => {
};
const actionsBodyTemplate = (rowData) => {
- return
+ return
}
diff --git a/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js b/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js
index 2e940ed..d1db5af 100644
--- a/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js
+++ b/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js
@@ -38,8 +38,8 @@ const MyLatestSubmissionsTable = () => {
modify_date: '2024-08-30T00:00:00+00:00',
progress: 50,
status: 'DRAFT',
- id: 11,
- callId: 11
+ id: 33,
+ callId: 52
},
{
name: 'Bando Sostenibilità 2024',
@@ -47,8 +47,8 @@ const MyLatestSubmissionsTable = () => {
modify_date: '2024-08-15T00:00:00+00:00',
progress: 25,
status: 'DRAFT',
- id: 9,
- callId: 12
+ id: 34,
+ callId: 53
}
]
setItems(getFormattedBandiData(items));
@@ -140,7 +140,7 @@ const MyLatestSubmissionsTable = () => {
};
const actionsBodyTemplate = (rowData) => {
- return
+ return
}
diff --git a/src/routes.js b/src/routes.js
index e499e91..be72be5 100644
--- a/src/routes.js
+++ b/src/routes.js
@@ -28,35 +28,44 @@ const routes = ({ role }) => {
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
+ {'ROLE_BENEFICIARY' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
+ {'ROLE_BENEFICIARY' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
- {'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_BENEFICIARY' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
+ {'ROLE_BENEFICIARY' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
+ {'ROLE_BENEFICIARY' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
+ {'ROLE_BENEFICIARY' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
+ {'ROLE_BENEFICIARY' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
- }/>
-
- {'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_BENEFICIARY' === role ? : null}
}/>
+ {'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
}/>
+
+ {'ROLE_SUPER_ADMIN' === role ? : null}
+ {'ROLE_BENEFICIARY' === role ? : null}
+ }/>
}/>
{/*}/>*/}
diff --git a/src/service/application-service.js b/src/service/application-service.js
new file mode 100644
index 0000000..c07afc8
--- /dev/null
+++ b/src/service/application-service.js
@@ -0,0 +1,14 @@
+import { NetworkService } from './network-service';
+
+const API_BASE_URL = process.env.REACT_APP_API_EXECUTION_ADDRESS;
+
+export default class ApplicationService {
+
+ static getApplications = (callback, errCallback) => {
+ NetworkService.get(`${API_BASE_URL}/application`, callback, errCallback);
+ };
+
+ static getApplication = (id, callback, errCallback) => {
+ NetworkService.get(`${API_BASE_URL}/application/${id}`, callback, errCallback);
+ };
+}
diff --git a/src/tempData.js b/src/tempData.js
index 696ac79..a567f59 100644
--- a/src/tempData.js
+++ b/src/tempData.js
@@ -551,6 +551,157 @@ export const elementItems = [
maxSize: 100000,
custom: null
}
+ },
+ {
+ id: 11,
+ sortOrder: 11,
+ name: 'textinput',
+ label: 'Campo Partita IVA',
+ description: "Specifico per l'inserimento del numero di Partita IVA",
+ settings: [
+ {
+ name: "label",
+ value: "Partita IVA"
+ },
+ {
+ name: "placeholder",
+ value: ""
+ }
+ ],
+ validators: {
+ isRequired: true,
+ minLength: 11,
+ maxLength: 11,
+ custom: 'isPIVA'
+ }
+ },
+ {
+ id: 12,
+ sortOrder: 12,
+ name: 'textinput',
+ label: 'Campo Codice Fiscale',
+ description: "Specifico per l'inserimento del Codice Fiscale italiano per persone fisiche e giuridiche",
+ settings: [
+ {
+ name: "label",
+ value: "Codice Fiscale"
+ },
+ {
+ name: "placeholder",
+ value: ""
+ }
+ ],
+ validators: {
+ isRequired: true,
+ minLength: 11,
+ maxLength: 16,
+ custom: 'isCodiceFiscale'
+ }
+ },
+ {
+ id: 13,
+ sortOrder: 13,
+ name: 'numberinput',
+ label: 'Campo CAP',
+ description: "Per l'inserimento del Codice di Avviamento Postale",
+ settings: [
+ {
+ name: "label",
+ value: "CAP"
+ },
+ {
+ name: "placeholder",
+ value: ""
+ }
+ ],
+ validators: {
+ isRequired: true,
+ custom: 'isCAP'
+ }
+ },
+ {
+ id: 14,
+ sortOrder: 14,
+ name: 'textinput',
+ label: 'Campo IBAN',
+ description: "Per l'inserimento del codice IBAN",
+ settings: [
+ {
+ name: "label",
+ value: "IBAN"
+ },
+ {
+ name: "placeholder",
+ value: ""
+ }
+ ],
+ validators: {
+ isRequired: true,
+ custom: 'isIBAN'
+ }
+ },
+ {
+ id: 15,
+ sortOrder: 15,
+ name: 'textinput',
+ label: 'Campo Email',
+ description: "Per l'inserimento di indirizzi email standard (non PEC)",
+ settings: [
+ {
+ name: "label",
+ value: "nome@esempio.it"
+ },
+ {
+ name: "placeholder",
+ value: ""
+ }
+ ],
+ validators: {
+ isRequired: false,
+ custom: 'isEmail'
+ }
+ },
+ {
+ id: 16,
+ sortOrder: 16,
+ name: 'textinput',
+ label: 'Campo PEC',
+ description: "Specifico per l'inserimento di un indirizzo di Posta Elettronica Certificata",
+ settings: [
+ {
+ name: "label",
+ value: "nome@pec.it"
+ },
+ {
+ name: "placeholder",
+ value: ""
+ }
+ ],
+ validators: {
+ isRequired: false,
+ custom: 'isEmailPEC'
+ }
+ },
+ {
+ id: 17,
+ sortOrder: 17,
+ name: 'textinput',
+ label: 'Campo URL',
+ description: "Per l'inserimento di indirizzi web",
+ settings: [
+ {
+ name: "label",
+ value: "Indirizzo URL"
+ },
+ {
+ name: "placeholder",
+ value: ""
+ }
+ ],
+ validators: {
+ isRequired: false,
+ custom: 'isUrl'
+ }
}
]