- save progress;
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
} from '../../helpers/validators';
|
||||
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||
import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText';
|
||||
|
||||
// components
|
||||
import { Skeleton } from 'primereact/skeleton';
|
||||
@@ -36,7 +37,7 @@ import ApplicationSteps from './ApplicationSteps';
|
||||
import BlockingOverlay from '../../components/BlockingOverlay';
|
||||
import { Dialog } from 'primereact/dialog';
|
||||
import FileuploadApplicationSignedPdf from '../../components/FileuploadApplicationSignedPdf';
|
||||
import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText';
|
||||
|
||||
import { defaultMaxFileSize } from '../../configData';
|
||||
|
||||
const BandoApplication = () => {
|
||||
@@ -47,7 +48,6 @@ const BandoApplication = () => {
|
||||
const [bandoTitle, setBandoTitle] = useState('');
|
||||
const [formId, setFormId] = useState('');
|
||||
const [totalSteps, setTotalSteps] = useState(0);
|
||||
//const [completedSteps, setCompletedSteps] = useState(0);
|
||||
const [visibleConfirmation, setVisibleConfirmation] = useState(false);
|
||||
const [applicationStatus, setApplicationStatus] = useState('');
|
||||
const [activeStep, setActiveStep] = useState(1);
|
||||
@@ -91,68 +91,9 @@ const BandoApplication = () => {
|
||||
storeSet.main.setAsyncRequest();
|
||||
formMsgs.current.clear();
|
||||
|
||||
/*ApplicationService.updateStatusApplication(applId, {}, submitApplicationCallback, errSubmitApplicationCallback, [
|
||||
['status', 'SUBMIT']
|
||||
]);*/
|
||||
ApplicationService.validateApplication(applId, {}, validateApplicationCallback, errValidateApplicationCallback);
|
||||
};
|
||||
|
||||
/*const submitApplicationCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
if (data.data.status) {
|
||||
setApplicationStatus(data.data.status); // ask why not 'applicationStatus'?
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const errSubmitApplicationCallback = (data) => {
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
if (data.status === 'VALIDATION_ERROR') {
|
||||
if (formMsgs.current) {
|
||||
formMsgs.current.show([
|
||||
{
|
||||
id: '99',
|
||||
sticky: true, severity: 'error', summary: '',
|
||||
detail: data.data.join(', '),
|
||||
closable: true
|
||||
}
|
||||
]);
|
||||
}
|
||||
} else if (data.status === 'EXCEPTION_ERROR') {
|
||||
if (formMsgs.current) {
|
||||
formMsgs.current.show([
|
||||
{
|
||||
id: '99',
|
||||
sticky: true, severity: 'error', summary: '',
|
||||
detail: data.message,
|
||||
closable: true
|
||||
}
|
||||
]);
|
||||
}
|
||||
} else if (data.status === 'BAD_REQUEST') {
|
||||
if (formMsgs.current) {
|
||||
formMsgs.current.show([
|
||||
{
|
||||
id: '99',
|
||||
sticky: true, severity: 'error', summary: '',
|
||||
detail: data.message,
|
||||
closable: true
|
||||
}
|
||||
]);
|
||||
}
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
summary: '',
|
||||
detail: data.message
|
||||
});
|
||||
}
|
||||
} else {
|
||||
set404FromErrorResponse(data);
|
||||
}
|
||||
}*/
|
||||
|
||||
const validateApplicationCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
if (data.data.status) {
|
||||
@@ -461,7 +402,8 @@ const BandoApplication = () => {
|
||||
useEffect(() => {
|
||||
if (formInitialData) {
|
||||
//reset();
|
||||
Object.keys(formInitialData).map(k => setValue(k, formInitialData[k]))
|
||||
Object.keys(formInitialData).map(k => setValue(k, formInitialData[k]));
|
||||
trigger();
|
||||
}
|
||||
}, [formInitialData]);
|
||||
|
||||
@@ -487,7 +429,7 @@ const BandoApplication = () => {
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
{'SUBMIT' !== applicationStatus
|
||||
{'DRAFT' === applicationStatus
|
||||
? <ApplicationSteps totalSteps={totalSteps} activeStepIndex={activeStepIndex}/>
|
||||
: null}
|
||||
|
||||
@@ -510,12 +452,12 @@ const BandoApplication = () => {
|
||||
<div className="appPage__content">
|
||||
<BlockingOverlay shouldDisplay={isAsyncRequest}/>
|
||||
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
||||
{'SUBMIT' !== applicationStatus
|
||||
{'DRAFT' === applicationStatus
|
||||
? <div className="appPageSection">
|
||||
{actionBtns}
|
||||
</div> : null}
|
||||
|
||||
{'SUBMIT' !== applicationStatus
|
||||
{'DRAFT' === applicationStatus
|
||||
? formData.map(o => {
|
||||
const label = head(o.settings.filter(o => o.name === 'label'));
|
||||
const text = head(o.settings.filter(o => o.name === 'text'));
|
||||
@@ -576,7 +518,7 @@ const BandoApplication = () => {
|
||||
})
|
||||
: null}
|
||||
|
||||
{'SUBMIT' === applicationStatus
|
||||
{'AWAIT' === applicationStatus
|
||||
? <div className="appPageSection">
|
||||
<div className="appForm__field">
|
||||
<label>
|
||||
@@ -585,14 +527,14 @@ const BandoApplication = () => {
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
disabled={'SUBMIT' !== applicationStatus}
|
||||
disabled={'SUBMIT' === applicationStatus}
|
||||
onClick={onDownloadApplicationPdf}
|
||||
label={__('Scarica PDF', 'gepafin')}
|
||||
icon="pi pi-download"
|
||||
iconPos="right"/>
|
||||
</div> : null}
|
||||
|
||||
{'SUBMIT' === applicationStatus
|
||||
{'AWAIT' === applicationStatus
|
||||
? <div className="appPageSection">
|
||||
<div className="appForm__field">
|
||||
<label htmlFor="signedPdfFile">
|
||||
@@ -617,12 +559,12 @@ const BandoApplication = () => {
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
{'SUBMIT' !== applicationStatus
|
||||
{'DRAFT' === applicationStatus
|
||||
? <div className="appPageSection__hr">
|
||||
<span>{__('Azioni rapide', 'gepafin')}</span>
|
||||
</div> : null}
|
||||
|
||||
{'SUBMIT' !== applicationStatus
|
||||
{'DRAFT' === applicationStatus
|
||||
? <div className="appPageSection">
|
||||
{actionBtns}
|
||||
</div> : null}
|
||||
|
||||
Reference in New Issue
Block a user