- fixed flow of submitting application;
This commit is contained in:
@@ -20,6 +20,9 @@ const getBandoLabel = (status) => {
|
|||||||
case 'AWAITING':
|
case 'AWAITING':
|
||||||
return __('In attesa', 'gepafin');
|
return __('In attesa', 'gepafin');
|
||||||
|
|
||||||
|
case 'AWAIT':
|
||||||
|
return __('In attesa', 'gepafin');
|
||||||
|
|
||||||
case 'EXPIRED':
|
case 'EXPIRED':
|
||||||
return __('Scaduto', 'gepafin');
|
return __('Scaduto', 'gepafin');
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ const getBandoSeverity = (status) => {
|
|||||||
case 'AWAITING':
|
case 'AWAITING':
|
||||||
return 'warning';
|
return 'warning';
|
||||||
|
|
||||||
|
case 'AWAIT':
|
||||||
|
return 'warning';
|
||||||
|
|
||||||
case 'EXPIRED':
|
case 'EXPIRED':
|
||||||
return 'closed';
|
return 'closed';
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { useParams } from 'react-router-dom';
|
|||||||
import { head, is, pluck, isEmpty, pathOr } from 'ramda';
|
import { head, is, pluck, isEmpty, pathOr } from 'ramda';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
import { TZDate } from '@date-fns/tz';
|
import { TZDate } from '@date-fns/tz';
|
||||||
import { klona } from 'klona';
|
|
||||||
|
|
||||||
// store
|
// store
|
||||||
import { storeSet, storeGet, useStore } from '../../store';
|
import { storeSet, storeGet, useStore } from '../../store';
|
||||||
@@ -86,7 +85,7 @@ const BandoApplication = () => {
|
|||||||
const activeStepIndex = activeStep - 1;
|
const activeStepIndex = activeStep - 1;
|
||||||
const values = getValues();
|
const values = getValues();
|
||||||
|
|
||||||
const onSubmit = () => {
|
const onValidate = () => {
|
||||||
const applId = getApplicationId();
|
const applId = getApplicationId();
|
||||||
storeSet.main.setAsyncRequest();
|
storeSet.main.setAsyncRequest();
|
||||||
formMsgs.current.clear();
|
formMsgs.current.clear();
|
||||||
@@ -94,6 +93,70 @@ const BandoApplication = () => {
|
|||||||
ApplicationService.validateApplication(applId, {}, validateApplicationCallback, errValidateApplicationCallback);
|
ApplicationService.validateApplication(applId, {}, validateApplicationCallback, errValidateApplicationCallback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onSubmit = () => {
|
||||||
|
const applId = getApplicationId();
|
||||||
|
storeSet.main.setAsyncRequest();
|
||||||
|
formMsgs.current.clear();
|
||||||
|
|
||||||
|
ApplicationService.updateStatusApplication(applId, {}, submitApplicationCallback, errSubmitApplicationCallback, [
|
||||||
|
['status', 'SUBMIT']
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
set404FromErrorResponse(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const validateApplicationCallback = (data) => {
|
const validateApplicationCallback = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
if (data.data.status) {
|
if (data.data.status) {
|
||||||
@@ -383,13 +446,19 @@ const BandoApplication = () => {
|
|||||||
|
|
||||||
const handleSetSignedDocumentFromFileupload = (fieldName, stateFieldData) => {
|
const handleSetSignedDocumentFromFileupload = (fieldName, stateFieldData) => {
|
||||||
setSignedPdfFile(stateFieldData);
|
setSignedPdfFile(stateFieldData);
|
||||||
if (!isEmpty(stateFieldData)) {
|
setApplicationStatus('READY');
|
||||||
|
|
||||||
|
/*if (!isEmpty(stateFieldData)) {
|
||||||
setVisibleConfirmation(true);
|
setVisibleConfirmation(true);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if ('SUBMIT' === applicationStatus) {
|
if ('SUBMIT' === applicationStatus) {
|
||||||
|
setVisibleConfirmation(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (['AWAIT', 'READY', 'SUBMIT'].includes(applicationStatus)) {
|
||||||
const applId = getApplicationId();
|
const applId = getApplicationId();
|
||||||
|
|
||||||
if (applId) {
|
if (applId) {
|
||||||
@@ -451,13 +520,14 @@ const BandoApplication = () => {
|
|||||||
|
|
||||||
<div className="appPage__content">
|
<div className="appPage__content">
|
||||||
<BlockingOverlay shouldDisplay={isAsyncRequest}/>
|
<BlockingOverlay shouldDisplay={isAsyncRequest}/>
|
||||||
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
<form className="appForm" onSubmit={handleSubmit(onValidate)}>
|
||||||
{'DRAFT' === applicationStatus
|
{'DRAFT' === applicationStatus
|
||||||
? <div className="appPageSection">
|
? <div className="appPageSection">
|
||||||
{actionBtns}
|
{actionBtns}
|
||||||
</div> : null}
|
</div> : null}
|
||||||
|
|
||||||
{'DRAFT' === applicationStatus
|
{'DRAFT' === applicationStatus
|
||||||
|
/*|| 'AWAIT' === applicationStatus*/
|
||||||
? formData.map(o => {
|
? formData.map(o => {
|
||||||
const label = head(o.settings.filter(o => o.name === 'label'));
|
const label = head(o.settings.filter(o => o.name === 'label'));
|
||||||
const text = head(o.settings.filter(o => o.name === 'text'));
|
const text = head(o.settings.filter(o => o.name === 'text'));
|
||||||
@@ -518,7 +588,7 @@ const BandoApplication = () => {
|
|||||||
})
|
})
|
||||||
: null}
|
: null}
|
||||||
|
|
||||||
{'AWAIT' === applicationStatus
|
{['AWAIT', 'READY', 'SUBMIT', 'EVALUATION'].includes(applicationStatus)
|
||||||
? <div className="appPageSection">
|
? <div className="appPageSection">
|
||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
<label>
|
<label>
|
||||||
@@ -534,7 +604,7 @@ const BandoApplication = () => {
|
|||||||
iconPos="right"/>
|
iconPos="right"/>
|
||||||
</div> : null}
|
</div> : null}
|
||||||
|
|
||||||
{'AWAIT' === applicationStatus
|
{['AWAIT', 'READY', 'SUBMIT', 'EVALUATION'].includes(applicationStatus)
|
||||||
? <div className="appPageSection">
|
? <div className="appPageSection">
|
||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
<label htmlFor="signedPdfFile">
|
<label htmlFor="signedPdfFile">
|
||||||
@@ -545,7 +615,7 @@ const BandoApplication = () => {
|
|||||||
<FileuploadApplicationSignedPdf
|
<FileuploadApplicationSignedPdf
|
||||||
setDataFn={handleSetSignedDocumentFromFileupload}
|
setDataFn={handleSetSignedDocumentFromFileupload}
|
||||||
fieldName="signedPdfFile"
|
fieldName="signedPdfFile"
|
||||||
disabled={is(Array, signedPdfFile) ? !isEmpty(signedPdfFile) : false}
|
disabled={['READY', 'SUBMIT', 'EVALUATION'].includes(applicationStatus)}
|
||||||
defaultValue={is(Array, signedPdfFile) ? signedPdfFile : []}
|
defaultValue={is(Array, signedPdfFile) ? signedPdfFile : []}
|
||||||
accept={['.p7m,application/pkcs7-mime,application/x-pkcs7-mime,.zip']}
|
accept={['.p7m,application/pkcs7-mime,application/x-pkcs7-mime,.zip']}
|
||||||
chooseLabel={__('Aggiungi documento', 'gepafin')}
|
chooseLabel={__('Aggiungi documento', 'gepafin')}
|
||||||
@@ -557,6 +627,16 @@ const BandoApplication = () => {
|
|||||||
</div>
|
</div>
|
||||||
: null}
|
: null}
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
disabled={'READY' !== applicationStatus}
|
||||||
|
onClick={onSubmit}
|
||||||
|
label={__('Invia', 'gepafin')}
|
||||||
|
icon="pi pi-download"
|
||||||
|
iconPos="right"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
{'DRAFT' === applicationStatus
|
{'DRAFT' === applicationStatus
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { is, uniq } from 'ramda';
|
|||||||
//import { storeSet, storeGet } from '../../../../store';
|
//import { storeSet, storeGet } from '../../../../store';
|
||||||
|
|
||||||
// api
|
// api
|
||||||
import ApplicationService from '../../../../service/application-service';
|
//import ApplicationService from '../../../../service/application-service';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
||||||
@@ -18,9 +18,12 @@ import { InputIcon } from 'primereact/inputicon';
|
|||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import { Calendar } from 'primereact/calendar';
|
import { Calendar } from 'primereact/calendar';
|
||||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
|
import AssignedApplicationService from '../../../../service/assigned-application-service';
|
||||||
|
import { useStore } from '../../../../store';
|
||||||
|
|
||||||
|
|
||||||
const MyEvaluationsTable = () => {
|
const MyEvaluationsTable = () => {
|
||||||
|
const userData = useStore().main.userData();
|
||||||
const [items, setItems] = useState(null);
|
const [items, setItems] = useState(null);
|
||||||
const [filters, setFilters] = useState(null);
|
const [filters, setFilters] = useState(null);
|
||||||
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||||
@@ -29,7 +32,7 @@ const MyEvaluationsTable = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLocalAsyncRequest(true);
|
setLocalAsyncRequest(true);
|
||||||
ApplicationService.getApplications(getCallback, errGetCallbacks, [['status', 'ASSIGNED']]);
|
AssignedApplicationService.getAssignedApplications(getCallback, errGetCallbacks, [['userId', userData.id]]);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const getCallback = (data) => {
|
const getCallback = (data) => {
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ const API_BASE_URL = process.env.REACT_APP_API_EXECUTION_ADDRESS;
|
|||||||
|
|
||||||
export default class AssignedApplicationService {
|
export default class AssignedApplicationService {
|
||||||
|
|
||||||
|
static getAssignedApplications = (id, callback, errCallback, queryParams) => {
|
||||||
|
NetworkService.get(`${API_BASE_URL}/assignedApplication`, callback, errCallback, queryParams);
|
||||||
|
};
|
||||||
|
|
||||||
static assignApplication = (id, callback, errCallback, queryParams) => {
|
static assignApplication = (id, callback, errCallback, queryParams) => {
|
||||||
NetworkService.post(`${API_BASE_URL}/assignedApplication/application/${id}`, {}, callback, errCallback, queryParams);
|
NetworkService.post(`${API_BASE_URL}/assignedApplication/application/${id}`, {}, callback, errCallback, queryParams);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user