- updated condition for multi application for the same company and beneficiary;
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { is, isEmpty, isNil } from 'ramda';
|
||||
import { head, is, isEmpty, isNil } from 'ramda';
|
||||
import 'quill/dist/quill.core.css';
|
||||
|
||||
// store
|
||||
@@ -12,11 +12,13 @@ import getNumberWithCurrency from '../../helpers/getNumberWithCurrency';
|
||||
import getDateFromISOstring from '../../helpers/getDateFromISOstring';
|
||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||
import isDateTimeInPast from '../../helpers/isDateTimeInPast';
|
||||
|
||||
// api
|
||||
import BandoService from '../../service/bando-service';
|
||||
import FaqItemService from '../../service/faq-item-service';
|
||||
import ApplicationService from '../../service/application-service';
|
||||
import PreferredBandoService from '../../service/preferred-bando-service';
|
||||
|
||||
// components
|
||||
import { Skeleton } from 'primereact/skeleton';
|
||||
@@ -28,8 +30,6 @@ import { Message } from 'primereact/message';
|
||||
import { Toast } from 'primereact/toast';
|
||||
import { Editor } from 'primereact/editor';
|
||||
import { Dialog } from 'primereact/dialog';
|
||||
import PreferredBandoService from '../../service/preferred-bando-service';
|
||||
import isDateTimeInPast from '../../helpers/isDateTimeInPast';
|
||||
|
||||
const REACT_APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||
|
||||
@@ -244,7 +244,10 @@ const BandoViewBeneficiario = () => {
|
||||
const getApplCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
if (data.data.length) {
|
||||
setApplicationObj(data.data[0]);
|
||||
const nonRejectedAppl = head(data.data.filter(o => !['REJECTED'].includes(o.status)));
|
||||
if (nonRejectedAppl) {
|
||||
setApplicationObj(nonRejectedAppl);
|
||||
}
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
|
||||
@@ -204,25 +204,28 @@ const DomandaEditInstructorManager = () => {
|
||||
setData(getFormattedData(resp.data));
|
||||
setMotivation(resp.data.motivation);
|
||||
updateFlagsForSoccorso(resp.data);
|
||||
setFormData(resp.data.applicationEvaluationFormResponse.content);
|
||||
setFormId(resp.data.applicationEvaluationFormResponse.id);
|
||||
let formDataInitial = {};
|
||||
|
||||
if (resp.data.applicationEvaluationFormResponse.formFields) {
|
||||
const submitData = resp.data.applicationEvaluationFormResponse.formFields.map((o) => ({
|
||||
fieldId: o.fieldId,
|
||||
fieldValue: o.fieldValue
|
||||
}));
|
||||
formDataInitial = submitData.reduce((acc, cur) => {
|
||||
if (cur.fieldValue) {
|
||||
acc[cur.fieldId] = cur.fieldValue;
|
||||
}
|
||||
return acc;
|
||||
}, formDataInitial);
|
||||
if (resp.data.evaluationVersion === 'V2') {
|
||||
setFormData(resp.data.applicationEvaluationFormResponse.content);
|
||||
setFormId(resp.data.applicationEvaluationFormResponse.id);
|
||||
let formDataInitial = {};
|
||||
|
||||
if (resp.data.applicationEvaluationFormResponse.formFields) {
|
||||
const submitData = resp.data.applicationEvaluationFormResponse.formFields.map((o) => ({
|
||||
fieldId: o.fieldId,
|
||||
fieldValue: o.fieldValue
|
||||
}));
|
||||
formDataInitial = submitData.reduce((acc, cur) => {
|
||||
if (cur.fieldValue) {
|
||||
acc[cur.fieldId] = cur.fieldValue;
|
||||
}
|
||||
return acc;
|
||||
}, formDataInitial);
|
||||
}
|
||||
|
||||
reset();
|
||||
setFormInitialData(formDataInitial);
|
||||
}
|
||||
|
||||
reset();
|
||||
setFormInitialData(formDataInitial);
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user