- added new fields;

- corrected route urls;
This commit is contained in:
Vitalii Kiiko
2024-09-16 10:50:59 +02:00
parent 0972c0d753
commit cf149485e0
10 changed files with 266 additions and 37 deletions

View File

@@ -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]);