- fixed displaying tables;
- fixed uploading signed pdf for application; - added downloading modullistica archive; - added basic table related validator;
This commit is contained in:
@@ -20,7 +20,7 @@ import {
|
||||
isEmail,
|
||||
isEmailPEC,
|
||||
isUrl,
|
||||
isMarcaDaBollo
|
||||
isMarcaDaBollo, minChecks, maxChecks, nonEmptyTables
|
||||
} from '../../helpers/validators';
|
||||
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||
@@ -34,7 +34,7 @@ import { Messages } from 'primereact/messages';
|
||||
import ApplicationSteps from './ApplicationSteps';
|
||||
import BlockingOverlay from '../../components/BlockingOverlay';
|
||||
import { Dialog } from 'primereact/dialog';
|
||||
//import FileuploadApplicationSignedPdf from '../../components/FileuploadApplicationSignedPdf';
|
||||
import FileuploadApplicationSignedPdf from '../../components/FileuploadApplicationSignedPdf';
|
||||
|
||||
const BandoApplication = () => {
|
||||
const { id } = useParams();
|
||||
@@ -47,8 +47,7 @@ const BandoApplication = () => {
|
||||
const [visibleConfirmation, setVisibleConfirmation] = useState(false);
|
||||
const [applicationStatus, setApplicationStatus] = useState('');
|
||||
const [activeStep, setActiveStep] = useState(1);
|
||||
// TODO
|
||||
//const [signedPdfFile, setSignedPdfFile] = useState([]);
|
||||
const [signedPdfFile, setSignedPdfFile] = useState([]);
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const toast = useRef(null);
|
||||
const formMsgs = useRef(null);
|
||||
@@ -75,7 +74,10 @@ const BandoApplication = () => {
|
||||
isEmail,
|
||||
isEmailPEC,
|
||||
isUrl,
|
||||
isMarcaDaBollo
|
||||
isMarcaDaBollo,
|
||||
minChecks,
|
||||
maxChecks,
|
||||
nonEmptyTables
|
||||
}
|
||||
const activeStepIndex = activeStep - 1;
|
||||
const values = getValues();
|
||||
@@ -362,8 +364,32 @@ const BandoApplication = () => {
|
||||
|
||||
const errPdfCallback = (data) => {
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const getSignedPdfCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setSignedPdfFile([data.data]);
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const errSignedPdfCallbacks = (data) => {
|
||||
//set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if ('SUBMIT' === applicationStatus) {
|
||||
const applId = getApplicationId();
|
||||
|
||||
if (applId) {
|
||||
storeSet.main.setAsyncRequest();
|
||||
ApplicationService.getApplicationSignedPdf(applId, getSignedPdfCallback, errSignedPdfCallbacks);
|
||||
}
|
||||
}
|
||||
}, [applicationStatus])
|
||||
|
||||
useEffect(() => {
|
||||
if (formInitialData) {
|
||||
reset();
|
||||
@@ -455,6 +481,13 @@ const BandoApplication = () => {
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
/*if (o.name === 'table') {
|
||||
validations.required = true;
|
||||
validations.validate = {
|
||||
nonEmptyTables: (v) => nonEmptyTables(v)
|
||||
};
|
||||
}*/
|
||||
//console.log('validations', validations, o.name)
|
||||
|
||||
return ['paragraph'].includes(o.name) && text
|
||||
@@ -498,18 +531,17 @@ const BandoApplication = () => {
|
||||
iconPos="right"/>
|
||||
</div> : null}
|
||||
|
||||
{/*{'SUBMIT' === applicationStatus
|
||||
{'SUBMIT' === applicationStatus
|
||||
? <div className="appPageSection">
|
||||
<div className="appForm__field">
|
||||
<label htmlFor="signedPdfFile">
|
||||
{__('Carica documento della domanda firmato', 'gepafin')}
|
||||
<span className="appForm__field--required">*</span>
|
||||
(.p7m)
|
||||
</label>
|
||||
<FileuploadApplicationSignedPdf
|
||||
setDataFn={setSignedPdfFile}
|
||||
fieldName="signedPdfFile"
|
||||
defaultValue={signedPdfFile}
|
||||
defaultValue={is(Array, signedPdfFile) ? signedPdfFile : []}
|
||||
accept={['.p7m,application/pkcs7-mime,application/x-pkcs7-mime']}
|
||||
chooseLabel={__('Aggiungi documento', 'gepafin')}
|
||||
multiple={false}
|
||||
@@ -518,7 +550,7 @@ const BandoApplication = () => {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
: null}*/}
|
||||
: null}
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user