Merge branch 'develop' into feature/documents-page

This commit is contained in:
Vitalii Kiiko
2025-02-13 15:05:52 +01:00
5 changed files with 33 additions and 14 deletions

View File

@@ -62,6 +62,7 @@ const BandoApplication = () => {
const [applicationStatus, setApplicationStatus] = useState(''); const [applicationStatus, setApplicationStatus] = useState('');
const [activeStep, setActiveStep] = useState(1); const [activeStep, setActiveStep] = useState(1);
const [signedPdfFile, setSignedPdfFile] = useState([]); const [signedPdfFile, setSignedPdfFile] = useState([]);
const [isRequestForApplData, setIsRequestForApplData] = useState(false);
const isAsyncRequest = useStore().main.isAsyncRequest(); const isAsyncRequest = useStore().main.isAsyncRequest();
const toast = useRef(null); const toast = useRef(null);
const formMsgs = useRef(null); const formMsgs = useRef(null);
@@ -390,10 +391,12 @@ const BandoApplication = () => {
setFormInitialData(formDataInitial); setFormInitialData(formDataInitial);
} }
storeSet.main.unsetAsyncRequest(); storeSet.main.unsetAsyncRequest();
setIsRequestForApplData(false);
} }
const errGetApplFormCallbacks = (data) => { const errGetApplFormCallbacks = (data) => {
storeSet.main.unsetAsyncRequest(); storeSet.main.unsetAsyncRequest();
setIsRequestForApplData(false);
if (data.status === 'VALIDATION_ERROR') { if (data.status === 'VALIDATION_ERROR') {
if (toast.current) { if (toast.current) {
toast.current.show({ toast.current.show({
@@ -568,6 +571,15 @@ const BandoApplication = () => {
}, [formValues]); }, [formValues]);
useEffect(() => { useEffect(() => {
if ('DRAFT' === applicationStatus && !isRequestForApplData) {
const applId = getApplicationId();
if (applId) {
storeSet.main.setAsyncRequest();
ApplicationService.getApplicationForm(applId, getApplFormCallback, errGetApplFormCallbacks);
}
}
if ('SUBMIT' === applicationStatus) { if ('SUBMIT' === applicationStatus) {
setVisibleConfirmation(true); setVisibleConfirmation(true);
} }
@@ -595,6 +607,7 @@ const BandoApplication = () => {
if (applId) { if (applId) {
storeSet.main.setAsyncRequest(); storeSet.main.setAsyncRequest();
setIsRequestForApplData(true);
ApplicationService.getApplicationForm(applId, getApplFormCallback, errGetApplFormCallbacks); ApplicationService.getApplicationForm(applId, getApplFormCallback, errGetApplFormCallbacks);
} }
}, [id, chosenCompanyId]); }, [id, chosenCompanyId]);

View File

@@ -324,6 +324,7 @@ const BandoViewBeneficiario = () => {
]); ]);
if (REACT_APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE') { if (REACT_APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE') {
storeSet.main.setAsyncRequest(); storeSet.main.setAsyncRequest();
setApplicationObj(true);
ApplicationService.getApplications(getApplCallback, errGetApplCallback, [ ApplicationService.getApplications(getApplCallback, errGetApplCallback, [
['callId', bandoId], ['callId', bandoId],
['companyId', chosenCompanyId] ['companyId', chosenCompanyId]
@@ -339,6 +340,8 @@ const BandoViewBeneficiario = () => {
} }
}, [data]); }, [data]);
console.log('applicationObj', applicationObj)
return ( return (
<div className="appPage"> <div className="appPage">
{!isAsyncRequest && !isEmpty(data) {!isAsyncRequest && !isEmpty(data)
@@ -524,12 +527,14 @@ const BandoViewBeneficiario = () => {
onClick={scaricaModulistica} onClick={scaricaModulistica}
label={__('Scarica Bando Completo e Modulistica', 'gepafin')} label={__('Scarica Bando Completo e Modulistica', 'gepafin')}
icon="pi pi-download" iconPos="right"/> icon="pi pi-download" iconPos="right"/>
<Button {applicationObj.status && applicationObj.status === 'APPROVED'
type="button" ? null
disabled={isExpired || isAsyncRequest || chosenCompanyId === 0} : <Button
onClick={submitApplication} type="button"
label={submitBtnLabel()} disabled={isExpired || isAsyncRequest || chosenCompanyId === 0}
icon={submitBtnIcon()} iconPos="right"/> onClick={submitApplication}
label={submitBtnLabel()}
icon={submitBtnIcon()} iconPos="right"/>}
<Button <Button
type="button" type="button"
disabled={isExpired} disabled={isExpired}

View File

@@ -122,6 +122,7 @@ const DomandaEditInstructorManager = () => {
const updateFlagsForSoccorso = useCallback((data) => { const updateFlagsForSoccorso = useCallback((data) => {
let nonRatedFilesLength = 0; let nonRatedFilesLength = 0;
let nonRatedAmmendFilesLength = 0;
if (data.files) { if (data.files) {
const nonRatedFiles = data.files const nonRatedFiles = data.files
@@ -134,10 +135,10 @@ const DomandaEditInstructorManager = () => {
const nonRatedFiles = data.amendmentDetails const nonRatedFiles = data.amendmentDetails
.map(el => el.valid) .map(el => el.valid)
.filter(v => isNil(v)); .filter(v => isNil(v));
nonRatedFilesLength = nonRatedFiles.length; nonRatedAmmendFilesLength = nonRatedFiles.length;
} }
setAllFilesRated(nonRatedFilesLength === 0); setAllFilesRated(nonRatedFilesLength === 0 && nonRatedAmmendFilesLength === 0);
if (data.evaluationVersion === 'V1') { if (data.evaluationVersion === 'V1') {
if (data.checklist) { if (data.checklist) {
@@ -891,7 +892,7 @@ const DomandaEditInstructorManager = () => {
storeSet.main.setAsyncRequest(); storeSet.main.setAsyncRequest();
ApplicationEvaluationService.getEvaluationVersionByApplId(entityId, getVersion, errGetVersion); ApplicationEvaluationService.getEvaluationVersionByApplId(entityId, getVersion, errGetVersion);
AmendmentsService.getSoccorsoByApplId(entityId, getAmendmentsCallback, errGetAmendmentsCallback, [ AmendmentsService.getSoccorsoByApplId(entityId, getAmendmentsCallback, errGetAmendmentsCallback, [
['statuses', 'AWAITING'] ['statuses', ['AWAITING', 'RESPONSE_RECEIVED']]
]); ]);
}, [id]); }, [id]);

View File

@@ -892,7 +892,7 @@ const DomandaEditPreInstructor = () => {
storeSet.main.setAsyncRequest(); storeSet.main.setAsyncRequest();
ApplicationEvaluationService.getEvaluationVersionByApplId(entityId, getVersion, errGetVersion); ApplicationEvaluationService.getEvaluationVersionByApplId(entityId, getVersion, errGetVersion);
AmendmentsService.getSoccorsoByApplId(entityId, getAmendmentsCallback, errGetAmendmentsCallback, [ AmendmentsService.getSoccorsoByApplId(entityId, getAmendmentsCallback, errGetAmendmentsCallback, [
['statuses', 'AWAITING'] ['statuses', ['AWAITING', 'RESPONSE_RECEIVED']]
]); ]);
}, [id]); }, [id]);

View File

@@ -17,6 +17,7 @@ import ApplicationService from '../../service/application-service';
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse'; import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
import getBandoLabel from '../../helpers/getBandoLabel'; import getBandoLabel from '../../helpers/getBandoLabel';
import getDateFromISOstring from '../../helpers/getDateFromISOstring'; import getDateFromISOstring from '../../helpers/getDateFromISOstring';
import getEmailTemplateForSoccorso from '../../helpers/getStrippedHtmlBodyTags';
// components // components
import { Button } from 'primereact/button'; import { Button } from 'primereact/button';
@@ -26,7 +27,6 @@ import { Dialog } from 'primereact/dialog';
import FormField from '../../components/FormField'; import FormField from '../../components/FormField';
import SoccorsoComunications from '../SoccorsoEditPreInstructor/components/SoccorsoComunications'; import SoccorsoComunications from '../SoccorsoEditPreInstructor/components/SoccorsoComunications';
import { Editor } from 'primereact/editor'; import { Editor } from 'primereact/editor';
import getEmailTemplateForSoccorso from '../../helpers/getStrippedHtmlBodyTags';
const SoccorsoEditBeneficiario = () => { const SoccorsoEditBeneficiario = () => {
const isAsyncRequest = useStore().main.isAsyncRequest(); const isAsyncRequest = useStore().main.isAsyncRequest();
@@ -60,7 +60,7 @@ const SoccorsoEditBeneficiario = () => {
const entityId = !isNaN(parsedId) ? parsedId : 0; const entityId = !isNaN(parsedId) ? parsedId : 0;
AmendmentsService.getSoccorsoByApplId(entityId, getCallback, errGetCallback, [ AmendmentsService.getSoccorsoByApplId(entityId, getCallback, errGetCallback, [
['statuses', 'AWAITING'] ['statuses', 'AWAITING,RESPONSE_RECEIVED']
]); ]);
}, [id]); }, [id]);
@@ -324,10 +324,10 @@ const SoccorsoEditBeneficiario = () => {
</div> : null} </div> : null}
{data.id {data.id
? <div className="appPageSection"> ? <div className="appPageSection__emailTemplate">
<h2>{__('Dettagli richiesta', 'gepafin')}</h2> <h2>{__('Dettagli richiesta', 'gepafin')}</h2>
<h3>{__('Note e spiegazioni', 'gepafin')}</h3> <h3>{__('Note e spiegazioni', 'gepafin')}</h3>
<div>{getEmailTemplateForSoccorso(data.emailTemplate, data.note)}</div> {getEmailTemplateForSoccorso(data.emailTemplate, data.note)}
</div> : null} </div> : null}
{data.id {data.id