- added new fields;
- corrected route urls;
This commit is contained in:
@@ -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]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user