- added new settings for call;
- added duplciate form field functionality to form builder; - added improvements to form builder; - fixed issue with saving data in evaluation;
This commit is contained in:
@@ -53,6 +53,10 @@
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
line-height: 21px;
|
line-height: 21px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.meta {
|
.meta {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -116,7 +120,7 @@
|
|||||||
border: 1px solid var(--button-secondary-borderColor);
|
border: 1px solid var(--button-secondary-borderColor);
|
||||||
background-color: var(--button-secondary-borderColor);
|
background-color: var(--button-secondary-borderColor);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 10px;
|
padding: 20px 10px;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
color: white;
|
color: white;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { head, isNil, pathOr } from 'ramda';
|
import { head, isNil, pathOr } from 'ramda';
|
||||||
|
import getNumberFormatted from '../../../../../../../helpers/getNumberFormatted';
|
||||||
|
|
||||||
const LastRowCell = ({columnId, lastRowCfg, columnMeta = {}, tableValue = []}) => {
|
const LastRowCell = ({columnId, lastRowCfg, columnMeta = {}, tableValue = []}) => {
|
||||||
const cellData = head(lastRowCfg.filter(o => !isNil(o[columnId])));
|
const cellData = head(lastRowCfg.filter(o => !isNil(o[columnId])));
|
||||||
@@ -8,7 +9,7 @@ const LastRowCell = ({columnId, lastRowCfg, columnMeta = {}, tableValue = []}) =
|
|||||||
cellValue = pathOr(0, ['total'], tableValue);
|
cellValue = pathOr(0, ['total'], tableValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return <td>{cellValue}</td>;
|
return <td>{getNumberFormatted(cellValue)}</td>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default LastRowCell;
|
export default LastRowCell;
|
||||||
@@ -6,7 +6,6 @@ import { head, isEmpty, isNil, pathOr, sum } from 'ramda';
|
|||||||
// components
|
// components
|
||||||
import DefaultCell from './components/DefaultCell';
|
import DefaultCell from './components/DefaultCell';
|
||||||
import LastRowCell from './components/LastRowCell';
|
import LastRowCell from './components/LastRowCell';
|
||||||
import getNumberFormatted from '../../../../../helpers/getNumberFormatted';
|
|
||||||
|
|
||||||
const RenderTable = ({ tableValue = {}, columnsCfg, lastRowCfg, setTableValueFn, disabled }) => {
|
const RenderTable = ({ tableValue = {}, columnsCfg, lastRowCfg, setTableValueFn, disabled }) => {
|
||||||
const rows = pathOr([], ['rows'], tableValue)
|
const rows = pathOr([], ['rows'], tableValue)
|
||||||
@@ -32,7 +31,7 @@ const RenderTable = ({ tableValue = {}, columnsCfg, lastRowCfg, setTableValueFn,
|
|||||||
.map(v => isEmpty(v) || isNil(v) ? 0 : v);
|
.map(v => isEmpty(v) || isNil(v) ? 0 : v);
|
||||||
|
|
||||||
if (cellValue === 'sum') {
|
if (cellValue === 'sum') {
|
||||||
total = getNumberFormatted(sum(getAllRowsValues));
|
total = sum(getAllRowsValues);
|
||||||
} else {
|
} else {
|
||||||
total = 0;
|
total = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,105 +50,195 @@ export const dynamicDataOptions = {
|
|||||||
export const protocolType = [
|
export const protocolType = [
|
||||||
{
|
{
|
||||||
'id': 1,
|
'id': 1,
|
||||||
'name': 'PROTOCOLLO IN ENTRATA'
|
'name': 'PROTOCOLLO ENTRATA'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': 2,
|
'id': 2,
|
||||||
'name': 'PROTOCOLLO IN USCITA'
|
'name': 'PROTOCOLLO USCITA'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': 3,
|
'id': 3,
|
||||||
'name': 'DOCUMENTO INTERNO'
|
'name': 'DOCUMENTO INTERNO'
|
||||||
},
|
},
|
||||||
{
|
/*{
|
||||||
'id': 1003,
|
'id': 1003,
|
||||||
'name': 'PROTOCOLLO INTERNO '
|
'name': 'PROTOCOLLO INTERNO '
|
||||||
}
|
}*/
|
||||||
];
|
];
|
||||||
|
|
||||||
export const classificationType = [
|
export const classificationType = [
|
||||||
{
|
{
|
||||||
'idClassificazione': 1,
|
'idClassificazione': 101,
|
||||||
'name': 'BILANCIO',
|
'name': 'BILANCIO',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 2,
|
'idClassificazione': 102,
|
||||||
'name': 'DICHHIARAZIONE DEI REDDITI',
|
'name': 'DICHHIARAZIONE DEI REDDITI',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 3,
|
'idClassificazione': 103,
|
||||||
'name': 'SITUAZIONE CONTABILE',
|
'name': 'SITUAZIONE CONTABILE',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 4,
|
'idClassificazione': 104,
|
||||||
'name': 'PROSPETTO CONTO ECONOMICO',
|
'name': 'PROSPETTO CONTO ECONOMICO',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 5,
|
'idClassificazione': 105,
|
||||||
'name': 'CENTRALE DEI RISCHI',
|
'name': 'CENTRALE DEI RISCHI',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 6,
|
'idClassificazione': 106,
|
||||||
'name': 'RELAZIONE AZIENDALE ILLUSTRATIVA (MOD R1C, R1I, R1R, R1R A SECONDO DEI ',
|
'name': 'RELAZIONE AZIENDALE ILLUSTRATIVA (MOD R1C, R1I, R1R, R1S A SECONDA DEI SETTORI)',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 7,
|
'idClassificazione': 107,
|
||||||
'name': 'DOCUMENTO IDENTITA\'',
|
'name': 'DOCUMENTO IDENTITA\'',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 8,
|
'idClassificazione': 108,
|
||||||
'name': 'MODELLO SP1',
|
'name': 'MODELLO SP1',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 9,
|
'idClassificazione': 109,
|
||||||
'name': 'PRIVACY',
|
'name': 'PRIVACY',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 10,
|
'idClassificazione': 110,
|
||||||
'name': 'DOCUMENTAZIONE CHE ATTESTA POSSIBILITA\' DI RILASCIARE GAA FAVORE',
|
'name': 'DOCUMENTAZIONE CHE ATTESTA POSSIBILITA\' DI RILASCIARE GARANZIE A FAVORE DI TERZI (ES. STATUTO, VISURA…)',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 11,
|
'idClassificazione': 111,
|
||||||
'name': 'MODELLO AR1 D.LG 231/2007',
|
'name': 'MODELLO AR1 D.LG 231/2007',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 12,
|
'idClassificazione': 112,
|
||||||
'name': 'DOCUMENTO IDENTITA\' FIRMATORIO DICHHIARAZIONE SOSTITUTIVA',
|
'name': 'DOCUMENTO IDENTITA\' FIRMATARIO DICHIARAZIONE SOSTITUTIVA',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 13,
|
'idClassificazione': 113,
|
||||||
'name': 'PRIVACY FIRMATARIO DICHHIARAZIONE SOSTITUTIVA',
|
'name': 'PRIVACY FIRMATARIO DICHIARAZIONE SOSTITUTIVA',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 14,
|
'idClassificazione': 114,
|
||||||
'name': 'NULLAOSTA ANTIMAFIA',
|
'name': 'NULLAOSTA ANTIMAFIA',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 1,
|
'idClassificazione': 115,
|
||||||
'name': 'LETTERA ESITO DELIBERA',
|
'name': 'VISURA CRIF',
|
||||||
'idTipoprotocollo': 2
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 2,
|
'idClassificazione': 116,
|
||||||
|
'name': 'DURC',
|
||||||
|
'idTipoprotocollo': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 117,
|
||||||
|
'name': 'STATO PATRIMONIALE E CONTO ECONOMICO',
|
||||||
|
'idTipoprotocollo': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 118,
|
||||||
|
'name': 'DOCUMENTAZIONE FISCALE E CONTABILE',
|
||||||
|
'idTipoprotocollo': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 119,
|
||||||
|
'name': 'BILANCIO GRUPPO IMPRESE',
|
||||||
|
'idTipoprotocollo': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 121,
|
||||||
|
'name': 'DICHIARAZIONE DEI REDDITI GARANTI',
|
||||||
|
'idTipoprotocollo': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 122,
|
||||||
|
'name': 'CENTRALE DEI RISCHI GARANTI',
|
||||||
|
'idTipoprotocollo': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 123,
|
||||||
|
'name': 'BILANCIO / DICHIARAZIONE REDDITI GARANTI',
|
||||||
|
'idTipoprotocollo': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 125,
|
||||||
|
'name': 'CONTRATTO FIRMATO DAL CLIENTE',
|
||||||
|
'idTipoprotocollo': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 126,
|
||||||
|
'name': 'CONTRATTO FIRMATO DA GEPAFIN',
|
||||||
|
'idTipoprotocollo': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 128,
|
||||||
|
'name': 'ALLEGATO 4',
|
||||||
|
'idTipoprotocollo': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 129,
|
||||||
|
'name': 'ATTESTAZIONE PREGIUDIZIEVOLI',
|
||||||
|
'idTipoprotocollo': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 130,
|
||||||
|
'name': 'DELIBERA BANCA',
|
||||||
|
'idTipoprotocollo': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 131,
|
||||||
|
'name': 'ALTRO',
|
||||||
|
'idTipoprotocollo': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 202,
|
||||||
'name': 'LETTERA DI GARANZIA',
|
'name': 'LETTERA DI GARANZIA',
|
||||||
'idTipoprotocollo': 1
|
'idTipoprotocollo': 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'idClassificazione': 3,
|
'idClassificazione': 127,
|
||||||
|
'name': 'FATTURA',
|
||||||
|
'idTipoprotocollo': 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 201,
|
||||||
|
'name': 'LETTERA ESITO DELIBERA',
|
||||||
|
'idTipoprotocollo': 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 204,
|
||||||
|
'name': 'LETTERA TRASPARENZA',
|
||||||
|
'idTipoprotocollo': 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 205,
|
||||||
|
'name': 'CONTRATTO',
|
||||||
|
'idTipoprotocollo': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 124,
|
||||||
|
'name': 'STAMPA PROPOSTA DELIBERA',
|
||||||
|
'idTipoprotocollo': 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'idClassificazione': 203,
|
||||||
'name': 'GENERICO',
|
'name': 'GENERICO',
|
||||||
'idTipoprotocollo': 3
|
'idTipoprotocollo': 3
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import getTimeParsedFromString from '../../../../helpers/getTimeParsedFromString
|
|||||||
import formatDateString from '../../../../helpers/formatDateString';
|
import formatDateString from '../../../../helpers/formatDateString';
|
||||||
import EvaluationFormsService from '../../../../service/evaluation-forms-service';
|
import EvaluationFormsService from '../../../../service/evaluation-forms-service';
|
||||||
|
|
||||||
|
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||||
|
|
||||||
const BandoEditFormStep1 = forwardRef(function ({ initialData, setInitialData, getFormErrors, status }, ref) {
|
const BandoEditFormStep1 = forwardRef(function ({ initialData, setInitialData, getFormErrors, status }, ref) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [aimedToOptions, setAimedToOptions] = useState([]);
|
const [aimedToOptions, setAimedToOptions] = useState([]);
|
||||||
@@ -51,7 +53,8 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, setInitialData, g
|
|||||||
const values = getValues();
|
const values = getValues();
|
||||||
const toast = useRef(null);
|
const toast = useRef(null);
|
||||||
|
|
||||||
const onSubmit = () => {};
|
const onSubmit = () => {
|
||||||
|
};
|
||||||
|
|
||||||
const onSaveDraft = () => {
|
const onSaveDraft = () => {
|
||||||
trigger();
|
trigger();
|
||||||
@@ -198,7 +201,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, setInitialData, g
|
|||||||
![
|
![
|
||||||
'descriptionShort', 'descriptionLong', 'documentationRequested', 'threshold',
|
'descriptionShort', 'descriptionLong', 'documentationRequested', 'threshold',
|
||||||
'aimedTo', 'criteria', 'docs', 'checklist', 'faq', 'amount', 'amountMin', 'amountMax',
|
'aimedTo', 'criteria', 'docs', 'checklist', 'faq', 'amount', 'amountMin', 'amountMax',
|
||||||
'email', 'phoneNumber', 'checkList', 'images'
|
'email', 'phoneNumber', 'checkList', 'images', 'numberOfCheck', 'productId'
|
||||||
].includes(fieldName)
|
].includes(fieldName)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,6 +480,35 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, setInitialData, g
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="appForm__cols">
|
||||||
|
<FormField
|
||||||
|
type="numberinput"
|
||||||
|
disabled={shouldDisableField('numberOfCheck')}
|
||||||
|
fieldName="numberOfCheck"
|
||||||
|
label={__('Quantità dei checklist per creare un soccorso', 'gepafin')}
|
||||||
|
control={control}
|
||||||
|
errors={errors}
|
||||||
|
defaultValue={values['numberOfCheck']}
|
||||||
|
config={{
|
||||||
|
required: __('È obbligatorio', 'gepafin'),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
||||||
|
? <FormField
|
||||||
|
type="numberinput"
|
||||||
|
disabled={shouldDisableField('productId')}
|
||||||
|
fieldName="productId"
|
||||||
|
label={__('Prodotto ID dentro Odessa', 'gepafin')}
|
||||||
|
control={control}
|
||||||
|
errors={errors}
|
||||||
|
defaultValue={values['productId']}
|
||||||
|
config={{
|
||||||
|
required: __('È obbligatorio', 'gepafin'),
|
||||||
|
}}
|
||||||
|
/> : null}
|
||||||
|
</div>
|
||||||
|
|
||||||
<FormFieldRepeaterFaq
|
<FormFieldRepeaterFaq
|
||||||
data={values['faq']}
|
data={values['faq']}
|
||||||
disabled={shouldDisableField('faq')}
|
disabled={shouldDisableField('faq')}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse
|
|||||||
import BandoEditFormActions from '../BandoEditFormActions';
|
import BandoEditFormActions from '../BandoEditFormActions';
|
||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
import FormBuilder from '../../../BandoFormsEdit/components/FormBuilder';
|
import FormBuilder from '../../../BandoFormsEdit/components/FormBuilder';
|
||||||
import { elementItems } from '../../../../tempData';
|
//import { elementItems } from '../../../../tempData';
|
||||||
|
|
||||||
|
|
||||||
const BandoEditFormStep3 = forwardRef(function () {
|
const BandoEditFormStep3 = forwardRef(function () {
|
||||||
@@ -77,8 +77,8 @@ const BandoEditFormStep3 = forwardRef(function () {
|
|||||||
|
|
||||||
const getElementItemsCallback = (data) => {
|
const getElementItemsCallback = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
storeSet.main.elementItems(elementItems.sort((a, b) => a.sortOrder - b.sortOrder));
|
//storeSet.main.elementItems(elementItems.sort((a, b) => a.sortOrder - b.sortOrder));
|
||||||
//storeSet.main.elementItems(data.data.sort((a, b) => a.sortOrder - b.sortOrder));
|
storeSet.main.elementItems(data.data.sort((a, b) => a.sortOrder - b.sortOrder));
|
||||||
}
|
}
|
||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ const BandoEditFormStep3 = forwardRef(function () {
|
|||||||
<div className="appForm">
|
<div className="appForm">
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<DndProvider backend={HTML5Backend}>
|
<DndProvider backend={HTML5Backend}>
|
||||||
<FormBuilder bandoStatus={bandoStatus}/>
|
<FormBuilder callStatus={bandoStatus} context="call"/>
|
||||||
</DndProvider>
|
</DndProvider>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
import React, { useEffect, useRef, useState } from 'react'
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import { useDrag, useDrop } from 'react-dnd'
|
import { useDrag, useDrop } from 'react-dnd'
|
||||||
import { ItemTypes } from '../ItemTypes';
|
import { ItemTypes } from '../ItemTypes';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { head, isEmpty } from 'ramda';
|
import { head, isEmpty } from 'ramda';
|
||||||
|
import { klona } from 'klona';
|
||||||
|
|
||||||
// store
|
// store
|
||||||
import { storeSet, useStore } from '../../../../store';
|
import { storeSet, useStore } from '../../../../store';
|
||||||
|
|
||||||
|
// tools
|
||||||
|
import uniqid from '../../../../helpers/uniqid';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import { Tag } from 'primereact/tag';
|
import { Tag } from 'primereact/tag';
|
||||||
@@ -19,6 +23,8 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
|
|||||||
const element = head(elements.filter(o => o.id === id));
|
const element = head(elements.filter(o => o.id === id));
|
||||||
const [isVariable, setIsVariable] = useState('secondary');
|
const [isVariable, setIsVariable] = useState('secondary');
|
||||||
const [isFormula, setIsFormula] = useState('secondary');
|
const [isFormula, setIsFormula] = useState('secondary');
|
||||||
|
const [variableName, setVariableName] = useState('secondary');
|
||||||
|
const [formulaName, setFormulaName] = useState('secondary');
|
||||||
const [isRequestedAmount, setIsRequestedAmount] = useState(false);
|
const [isRequestedAmount, setIsRequestedAmount] = useState(false);
|
||||||
const [isDelegation, setIsDelegation] = useState(false);
|
const [isDelegation, setIsDelegation] = useState(false);
|
||||||
|
|
||||||
@@ -97,6 +103,18 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
|
|||||||
storeSet.main.activeElement(id);
|
storeSet.main.activeElement(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const duplicateElement = useCallback((id) => {
|
||||||
|
const duplicatedElement = head(elements.filter(o => o.id === id));
|
||||||
|
|
||||||
|
if (duplicatedElement) {
|
||||||
|
const copyElement = klona(duplicatedElement);
|
||||||
|
copyElement.id = uniqid();
|
||||||
|
const originalIndex = elements.map(o => o.id).indexOf(id);
|
||||||
|
const newElements = [...elements].toSpliced(originalIndex, 0, copyElement);
|
||||||
|
storeSet.main.formElements(newElements);
|
||||||
|
}
|
||||||
|
}, [elements]);
|
||||||
|
|
||||||
const remove = (id) => {
|
const remove = (id) => {
|
||||||
storeSet.main.removeElement(id);
|
storeSet.main.removeElement(id);
|
||||||
}
|
}
|
||||||
@@ -112,10 +130,12 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
|
|||||||
|
|
||||||
if (variable && !isEmpty(variable.value)) {
|
if (variable && !isEmpty(variable.value)) {
|
||||||
setIsVariable('warning');
|
setIsVariable('warning');
|
||||||
|
setVariableName(variable.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formula && !isEmpty(formula.value)) {
|
if (formula && !isEmpty(formula.value)) {
|
||||||
setIsFormula('warning');
|
setIsFormula('warning');
|
||||||
|
setFormulaName(formula.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isRequestedAmount && !isEmpty(isRequestedAmount.value) && isRequestedAmount.value) {
|
if (isRequestedAmount && !isEmpty(isRequestedAmount.value) && isRequestedAmount.value) {
|
||||||
@@ -137,9 +157,9 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
|
|||||||
<div className="tagHeader">
|
<div className="tagHeader">
|
||||||
<Tag value={label} severity="info"/>
|
<Tag value={label} severity="info"/>
|
||||||
{['numberinput', 'criteria_table'].includes(name)
|
{['numberinput', 'criteria_table'].includes(name)
|
||||||
? <Tag value="var" severity={isVariable}/> : null}
|
? <Tag value="var" severity={isVariable} title={variableName}/> : null}
|
||||||
{name === 'numberinput'
|
{name === 'numberinput'
|
||||||
? <Tag value="f(x)" severity={isFormula}/> : null}
|
? <Tag value="f(x)" severity={isFormula} title={formulaName}/> : null}
|
||||||
{isRequestedAmount
|
{isRequestedAmount
|
||||||
? <Tag value="importo" severity={isRequestedAmount}/> : null}
|
? <Tag value="importo" severity={isRequestedAmount}/> : null}
|
||||||
{isDelegation
|
{isDelegation
|
||||||
@@ -148,6 +168,7 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
|
|||||||
<BuilderElementProperLabel id={id} defaultLabel={label}/>
|
<BuilderElementProperLabel id={id} defaultLabel={label}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="actions">
|
<div className="actions">
|
||||||
|
<Button icon="pi pi-clone" onClick={() => duplicateElement(id)} outlined severity="success"/>
|
||||||
<Button icon="pi pi-cog" onClick={() => openSettings(id)} outlined severity="info"/>
|
<Button icon="pi pi-cog" onClick={() => openSettings(id)} outlined severity="info"/>
|
||||||
<Button icon="pi pi-trash" disabled={bandoStatus === 'PUBLISH'} onClick={() => remove(id)} outlined severity="danger"/>
|
<Button icon="pi pi-trash" disabled={bandoStatus === 'PUBLISH'} onClick={() => remove(id)} outlined severity="danger"/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -35,12 +35,13 @@ const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => {
|
|||||||
text: __('Testo formattato', 'gepafin'),
|
text: __('Testo formattato', 'gepafin'),
|
||||||
table_columns: '',
|
table_columns: '',
|
||||||
criteria_table_columns: '',
|
criteria_table_columns: '',
|
||||||
variable: __('Variable (only letters and "_")', 'gepafin'),
|
variable: __('Variabile (lettere, cifre e "_"; il primo carattere deve essere una lettera!)', 'gepafin'),
|
||||||
formula: __('Auto calculation formula', 'gepafin')
|
formula: __('Formula di calcolo automatico', 'gepafin'),
|
||||||
|
isChecklistItem: __('Fa parte di "checklist"?', 'gepafin'),
|
||||||
}
|
}
|
||||||
|
|
||||||
const settingDescription = {
|
const settingDescription = {
|
||||||
formula: __('Create formula using previously declared variables. Use these math operators: <code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>. Example of formula: <code>{entrate}+{assicurazione}</code>.', 'gepafin')
|
formula: __('Crea una formula usando variabili dichiarate in precedenza. Utilizza questi operatori matematici: <code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>. Esempio: <code>{entrate}+{assicurazione}</code>.', 'gepafin')
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderHeader = () => {
|
const renderHeader = () => {
|
||||||
@@ -104,7 +105,7 @@ const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => {
|
|||||||
name={setting.name}
|
name={setting.name}
|
||||||
bandoStatus={bandoStatus}
|
bandoStatus={bandoStatus}
|
||||||
setDataFn={updateDataFn}/>
|
setDataFn={updateDataFn}/>
|
||||||
} else if (['isRequestedAmount', 'isDelegation'].includes(setting.name)) {
|
} else if (['isRequestedAmount', 'isDelegation', 'isChecklistItem'].includes(setting.name)) {
|
||||||
return <InputSwitch
|
return <InputSwitch
|
||||||
checked={setting.value}
|
checked={setting.value}
|
||||||
onChange={(e) => changeFn(e.value, setting.name)}/>
|
onChange={(e) => changeFn(e.value, setting.name)}/>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const ElementSettingChips = ({ restrictedValues = [], changeFn, value = [] }) =>
|
|||||||
const [lastTyped, setLastTyped] = useState([])
|
const [lastTyped, setLastTyped] = useState([])
|
||||||
|
|
||||||
const isValidValue = (newVal) => {
|
const isValidValue = (newVal) => {
|
||||||
const validationRegex = /^[a-zA-Z_]+$/;
|
const validationRegex = /^[a-zA-Z][a-zA-Z0-9_]*$/;
|
||||||
return validationRegex.test(newVal);
|
return validationRegex.test(newVal);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import { MultiSelect } from 'primereact/multiselect';
|
|||||||
|
|
||||||
import { dynamicDataOptions } from '../../../../configData';
|
import { dynamicDataOptions } from '../../../../configData';
|
||||||
|
|
||||||
const BuilderElementSettings = ({ closeSettingsFn, bandoStatus }) => {
|
const BuilderElementSettings = ({ closeSettingsFn, callStatus, context }) => {
|
||||||
const elements = useStore().main.formElements();
|
const elements = useStore().main.formElements();
|
||||||
const activeElement = useStore().main.activeElement();
|
const activeElement = useStore().main.activeElement();
|
||||||
const criteriaOptions = useStore().main.bandoCriteria();
|
const criteriaOptions = useStore().main.bandoCriteria();
|
||||||
@@ -123,6 +123,10 @@ const BuilderElementSettings = ({ closeSettingsFn, bandoStatus }) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settings = settings.filter(o => context === 'call'
|
||||||
|
? !['isRequestedAmount', 'isDelegation'].includes(o.name)
|
||||||
|
: !['isChecklistItem'].includes(o.name));
|
||||||
|
|
||||||
if (chosen) {
|
if (chosen) {
|
||||||
setActiveElementData(klona(chosen));
|
setActiveElementData(klona(chosen));
|
||||||
setSettings(settings);
|
setSettings(settings);
|
||||||
@@ -149,7 +153,7 @@ const BuilderElementSettings = ({ closeSettingsFn, bandoStatus }) => {
|
|||||||
.map((o) => <ElementSetting
|
.map((o) => <ElementSetting
|
||||||
key={o.name}
|
key={o.name}
|
||||||
setting={o}
|
setting={o}
|
||||||
bandoStatus={bandoStatus}
|
callStatus={callStatus}
|
||||||
changeFn={onChange}
|
changeFn={onChange}
|
||||||
updateDataFn={onUpdateOptions}/>)
|
updateDataFn={onUpdateOptions}/>)
|
||||||
: null}
|
: null}
|
||||||
@@ -220,7 +224,8 @@ const BuilderElementSettings = ({ closeSettingsFn, bandoStatus }) => {
|
|||||||
</div> : null}
|
</div> : null}
|
||||||
</div>) : null}
|
</div>) : null}
|
||||||
</TabPanel> : null}
|
</TabPanel> : null}
|
||||||
<TabPanel header={__('Criteri', 'gepafin')}>
|
{context === 'application'
|
||||||
|
? <TabPanel header={__('Criteri', 'gepafin')}>
|
||||||
<div className="formElementSettings__field">
|
<div className="formElementSettings__field">
|
||||||
<label htmlFor="criteria">{__('Criteri di valutazione', 'gepafin')}</label>
|
<label htmlFor="criteria">{__('Criteri di valutazione', 'gepafin')}</label>
|
||||||
<MultiSelect
|
<MultiSelect
|
||||||
@@ -233,25 +238,28 @@ const BuilderElementSettings = ({ closeSettingsFn, bandoStatus }) => {
|
|||||||
display="chip"
|
display="chip"
|
||||||
placeholder={__('Scegli', 'gepafin')}/>
|
placeholder={__('Scegli', 'gepafin')}/>
|
||||||
</div>
|
</div>
|
||||||
</TabPanel>
|
</TabPanel> : null}
|
||||||
{settings
|
{settings
|
||||||
&& settings
|
&& settings
|
||||||
.filter(o => ['variable', 'formula'].includes(o.name)).length > 0
|
.filter(o => ['variable', 'formula'].includes(o.name)).length > 0
|
||||||
? <TabPanel header={__('Calculation', 'gepafin')}>
|
? <TabPanel header={__('Calcolo', 'gepafin')}>
|
||||||
{settings
|
{settings
|
||||||
? settings
|
? settings
|
||||||
.filter(o => ['variable', 'formula'].includes(o.name))
|
.filter(o => ['variable', 'formula'].includes(o.name))
|
||||||
.map((o) => <ElementSetting
|
.map((o) => <ElementSetting
|
||||||
key={o.name}
|
key={o.name}
|
||||||
setting={o}
|
setting={o}
|
||||||
bandoStatus={bandoStatus}
|
callStatus={callStatus}
|
||||||
changeFn={onChange}
|
changeFn={onChange}
|
||||||
updateDataFn={onUpdateOptions}/>)
|
updateDataFn={onUpdateOptions}/>)
|
||||||
: null}
|
: null}
|
||||||
</TabPanel> : null}
|
</TabPanel> : null}
|
||||||
</TabView>
|
</TabView>
|
||||||
|
|
||||||
<Button label={__('Salva', 'gepafin')} onClick={saveSettings}/>
|
<div style={{display: 'flex', gap: '0.5rem'}}>
|
||||||
|
<Button label={__('Annulla', 'gepafin')} onClick={closeSettingsFn} severity="danger"/>
|
||||||
|
<Button label={__('Salva', 'gepafin')} onClick={saveSettings}/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
: null
|
: null
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import BuilderElementSettings from '../BuilderElementSettings';
|
|||||||
import BuilderDropzone from '../BuilderDropzone';
|
import BuilderDropzone from '../BuilderDropzone';
|
||||||
import BlockingOverlay from '../../../../components/BlockingOverlay';
|
import BlockingOverlay from '../../../../components/BlockingOverlay';
|
||||||
|
|
||||||
const FormBuilder = ({ bandoStatus }) => {
|
const FormBuilder = ({ callStatus, context }) => {
|
||||||
const elements = useStore().main.formElements();
|
const elements = useStore().main.formElements();
|
||||||
const elementItems = useStore().main.elementItems();
|
const elementItems = useStore().main.elementItems();
|
||||||
const activeElement = useStore().main.activeElement();
|
const activeElement = useStore().main.activeElement();
|
||||||
@@ -27,10 +27,10 @@ const FormBuilder = ({ bandoStatus }) => {
|
|||||||
id={field.id}
|
id={field.id}
|
||||||
label={field.label}
|
label={field.label}
|
||||||
name={field.name}
|
name={field.name}
|
||||||
bandoStatus={bandoStatus}
|
callStatus={callStatus}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}, [bandoStatus]);
|
}, [callStatus]);
|
||||||
|
|
||||||
const renderItem = useCallback((item) => {
|
const renderItem = useCallback((item) => {
|
||||||
return (
|
return (
|
||||||
@@ -56,9 +56,11 @@ const FormBuilder = ({ bandoStatus }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Sidebar visible={!isEmpty(activeElement)} onHide={closeSettings} className="formBuilder__elementSettings">
|
<Sidebar visible={!isEmpty(activeElement)} onHide={closeSettings} dismissable={false} className="formBuilder__elementSettings">
|
||||||
<h2>{__('Impostazioni del campo modulo', 'gepafin')}</h2>
|
<h2>{__('Impostazioni del campo modulo', 'gepafin')}</h2>
|
||||||
{!isEmpty(activeElement) ? <BuilderElementSettings closeSettingsFn={closeSettings} bandoStatus={bandoStatus}/> : null}
|
{!isEmpty(activeElement)
|
||||||
|
? <BuilderElementSettings closeSettingsFn={closeSettings} callStatus={callStatus} context={context}/>
|
||||||
|
: null}
|
||||||
</Sidebar>
|
</Sidebar>
|
||||||
<div className="formBuilder">
|
<div className="formBuilder">
|
||||||
<div className="formBuilder__main">
|
<div className="formBuilder__main">
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
|||||||
import BandoService from '../../service/bando-service';
|
import BandoService from '../../service/bando-service';
|
||||||
|
|
||||||
// TODO temp data
|
// TODO temp data
|
||||||
import { elementItems } from '../../tempData';
|
//import { elementItems } from '../../tempData';
|
||||||
|
|
||||||
const BandoFormsEdit = () => {
|
const BandoFormsEdit = () => {
|
||||||
const { id, formId } = useParams();
|
const { id, formId } = useParams();
|
||||||
@@ -215,8 +215,8 @@ const BandoFormsEdit = () => {
|
|||||||
|
|
||||||
const getElementItemsCallback = (data) => {
|
const getElementItemsCallback = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
storeSet.main.elementItems(elementItems.sort((a, b) => a.sortOrder - b.sortOrder));
|
//storeSet.main.elementItems(elementItems.sort((a, b) => a.sortOrder - b.sortOrder));
|
||||||
//storeSet.main.elementItems(data.data.sort((a, b) => a.sortOrder - b.sortOrder));
|
storeSet.main.elementItems(data.data.sort((a, b) => a.sortOrder - b.sortOrder));
|
||||||
}
|
}
|
||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
@@ -317,7 +317,7 @@ const BandoFormsEdit = () => {
|
|||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<DndProvider backend={HTML5Backend}>
|
<DndProvider backend={HTML5Backend}>
|
||||||
<FormBuilder bandoStatus={bandoStatus}/>
|
<FormBuilder callStatus={bandoStatus} context="application"/>
|
||||||
</DndProvider>
|
</DndProvider>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
import React, { useState, useEffect, useRef, useCallback, useMemo } from 'react';
|
||||||
import { __, sprintf } from '@wordpress/i18n';
|
import { __, sprintf } from '@wordpress/i18n';
|
||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
import { is, isEmpty, isNil, sum, pathOr, head } from 'ramda';
|
import { is, isEmpty, isNil, sum, pathOr, head, pluck } from 'ramda';
|
||||||
import { klona } from 'klona';
|
import { klona } from 'klona';
|
||||||
import { wrap } from 'object-path-immutable';
|
import { wrap } from 'object-path-immutable';
|
||||||
|
|
||||||
@@ -39,6 +39,25 @@ import RepeaterFields from '../DomandaEditPreInstructor/components/RepeaterField
|
|||||||
import getDateTimeFromISOstring from '../../helpers/getDateTimeFromISOstring';
|
import getDateTimeFromISOstring from '../../helpers/getDateTimeFromISOstring';
|
||||||
import ApplicationInfo from '../DomandaEditPreInstructor/components/ApplicationInfo';
|
import ApplicationInfo from '../DomandaEditPreInstructor/components/ApplicationInfo';
|
||||||
import ApplicationDownloadFiles from '../DomandaEditPreInstructor/components/ApplicationDownloadFiles';
|
import ApplicationDownloadFiles from '../DomandaEditPreInstructor/components/ApplicationDownloadFiles';
|
||||||
|
import { useForm } from 'react-hook-form';
|
||||||
|
import {
|
||||||
|
isCAP,
|
||||||
|
isCodiceFiscale,
|
||||||
|
isEmail,
|
||||||
|
isEmailPEC,
|
||||||
|
isIBAN,
|
||||||
|
isMarcaDaBollo,
|
||||||
|
isPIVA,
|
||||||
|
isUrl, maxChecks, minChecks, nonEmptyTables
|
||||||
|
} from '../../helpers/validators';
|
||||||
|
import formatDateString from '../../helpers/formatDateString';
|
||||||
|
import getTokens from '../../helpers/getTokens';
|
||||||
|
import parseCommaDecimal from '../../helpers/parseCommaDecimal';
|
||||||
|
import renderWithDataVars from '../../helpers/renderWithDataVars';
|
||||||
|
import { evaluate } from 'mathjs';
|
||||||
|
import equal from 'fast-deep-equal';
|
||||||
|
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||||
|
import FormField from '../../components/FormField';
|
||||||
|
|
||||||
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
||||||
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||||
@@ -68,6 +87,40 @@ const DomandaEditInstructorManager = () => {
|
|||||||
duration: 0,
|
duration: 0,
|
||||||
amount: 0
|
amount: 0
|
||||||
});
|
});
|
||||||
|
const [formData, setFormData] = useState([]);
|
||||||
|
const [formId, setFormId] = useState(0);
|
||||||
|
const [formInitialData, setFormInitialData] = useState(null);
|
||||||
|
const {
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { errors },
|
||||||
|
setValue,
|
||||||
|
trigger,
|
||||||
|
register,
|
||||||
|
getValues,
|
||||||
|
watch,
|
||||||
|
reset
|
||||||
|
} = useForm({
|
||||||
|
defaultValues: useMemo(() => {
|
||||||
|
return formInitialData ? formInitialData : {}
|
||||||
|
}, [formInitialData]),
|
||||||
|
mode: 'onChange'
|
||||||
|
});
|
||||||
|
const validationFns = {
|
||||||
|
isPIVA,
|
||||||
|
isCodiceFiscale,
|
||||||
|
isCAP,
|
||||||
|
isIBAN,
|
||||||
|
isEmail,
|
||||||
|
isEmailPEC,
|
||||||
|
isUrl,
|
||||||
|
isMarcaDaBollo,
|
||||||
|
minChecks,
|
||||||
|
maxChecks,
|
||||||
|
nonEmptyTables
|
||||||
|
}
|
||||||
|
const values = getValues();
|
||||||
|
const formValues = watch();
|
||||||
|
|
||||||
const goToEvaluationsPage = () => {
|
const goToEvaluationsPage = () => {
|
||||||
navigate('/mie-domande');
|
navigate('/mie-domande');
|
||||||
@@ -109,6 +162,35 @@ const DomandaEditInstructorManager = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getVersion = (resp) => {
|
||||||
|
if (resp.status === 'SUCCESS') {
|
||||||
|
if (resp.data.evaluationVersion === 'V1') {
|
||||||
|
storeSet.main.setAsyncRequest();
|
||||||
|
ApplicationEvaluationService.getEvaluationByApplId(getCallback, errGetCallback, [
|
||||||
|
['applicationId', resp.data.applicationId]
|
||||||
|
]);
|
||||||
|
} else if (resp.data.evaluationVersion === 'V2') {
|
||||||
|
storeSet.main.setAsyncRequest();
|
||||||
|
ApplicationEvaluationService.getEvaluationV2ByApplId(getCallback, errGetCallback, [
|
||||||
|
['applicationId', resp.data.applicationId]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetVersion = (resp) => {
|
||||||
|
if (toast.current && data.message) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: resp.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
set404FromErrorResponse(resp);
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
const getCallback = (data) => {
|
const getCallback = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
setData(getFormattedData(data.data));
|
setData(getFormattedData(data.data));
|
||||||
@@ -168,26 +250,74 @@ const DomandaEditInstructorManager = () => {
|
|||||||
updateFlagsForSoccorso(newData);
|
updateFlagsForSoccorso(newData);
|
||||||
}
|
}
|
||||||
|
|
||||||
const doSaveDraft = useCallback((doRedirect = '') => {
|
const getTransformedSubmitData = () => {
|
||||||
const formData = {
|
const formValues = getValues();
|
||||||
criteria: klona(data.criteria),
|
const usedFieldsIds = pluck('id', formData);
|
||||||
checklist: klona(data.checklist),
|
return Object.keys(formValues)
|
||||||
files: klona(data.files),
|
.filter(v => usedFieldsIds.includes(v))
|
||||||
evaluationDocument: klona(data.evaluationDocument.map(o => ({
|
.reduce((acc, cur) => {
|
||||||
...o,
|
const formField = head(formData.filter(o => o.id === cur));
|
||||||
fileValue: o.fileValue[0] ? o.fileValue[0].id : ''
|
let fieldVal = formValues[cur];
|
||||||
})
|
|
||||||
)),
|
|
||||||
amendmentDetails: klona(data.amendmentDetails),
|
|
||||||
note: data.note
|
|
||||||
}
|
|
||||||
|
|
||||||
ApplicationEvaluationService.updateEvaluation(
|
if (formValues[cur] && formValues[cur].toISOString) {
|
||||||
data.assignedApplicationId,
|
fieldVal = formatDateString(formValues[cur]);
|
||||||
formData,
|
}
|
||||||
(data) => updateCallback(data, doRedirect),
|
|
||||||
errUpdateCallback
|
fieldVal = isEmpty(fieldVal) ? null : fieldVal;
|
||||||
);
|
if (formField && formField.name === 'fileupload') {
|
||||||
|
fieldVal = is(Array, fieldVal) ? fieldVal.map(o => o.id).join(',') : null;
|
||||||
|
}
|
||||||
|
acc.push({
|
||||||
|
'fieldId': cur,
|
||||||
|
'fieldValue': fieldVal
|
||||||
|
});
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
const doSaveDraft = useCallback((doRedirect = '') => {
|
||||||
|
if (data.evaluationVersion === 'V1') {
|
||||||
|
const submitData = {
|
||||||
|
criteria: klona(data.criteria),
|
||||||
|
checklist: klona(data.checklist),
|
||||||
|
files: klona(data.files),
|
||||||
|
evaluationDocument: klona(data.evaluationDocument.map(o => ({
|
||||||
|
...o,
|
||||||
|
fileValue: o.fileValue[0] ? o.fileValue[0].id : ''
|
||||||
|
})
|
||||||
|
)),
|
||||||
|
amendmentDetails: klona(data.amendmentDetails),
|
||||||
|
note: data.note
|
||||||
|
};
|
||||||
|
|
||||||
|
ApplicationEvaluationService.updateEvaluation(
|
||||||
|
data.assignedApplicationId,
|
||||||
|
submitData,
|
||||||
|
(data) => updateCallback(data, doRedirect),
|
||||||
|
errUpdateCallback
|
||||||
|
);
|
||||||
|
} else if (data.evaluationVersion === 'V2') {
|
||||||
|
const newFormValues = getTransformedSubmitData();
|
||||||
|
const submitData = {
|
||||||
|
formFields: newFormValues,
|
||||||
|
files: klona(data.files),
|
||||||
|
evaluationDocument: klona(data.evaluationDocument.map(o => ({
|
||||||
|
...o,
|
||||||
|
fileValue: o.fileValue[0] ? o.fileValue[0].id : ''
|
||||||
|
})
|
||||||
|
)),
|
||||||
|
amendmentDetails: klona(data.amendmentDetails),
|
||||||
|
note: data.note
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplicationEvaluationService.updateEvaluationV2(
|
||||||
|
data.assignedApplicationId,
|
||||||
|
formId,
|
||||||
|
submitData,
|
||||||
|
(data) => updateCallback(data, doRedirect),
|
||||||
|
errUpdateCallback
|
||||||
|
);
|
||||||
|
}
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
const updateCallback = (data, doRedirect = '') => {
|
const updateCallback = (data, doRedirect = '') => {
|
||||||
@@ -220,33 +350,95 @@ const DomandaEditInstructorManager = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const doApprove = () => {
|
const doApprove = () => {
|
||||||
const formData = {
|
if (data.evaluationVersion === 'V1') {
|
||||||
applicationStatus: 'APPROVED',
|
const submitData = {
|
||||||
criteria: klona(data.criteria),
|
applicationStatus: 'APPROVED',
|
||||||
checklist: klona(data.checklist),
|
criteria: klona(data.criteria),
|
||||||
files: klona(data.files),
|
checklist: klona(data.checklist),
|
||||||
note: data.note,
|
files: klona(data.files),
|
||||||
motivation
|
note: data.note,
|
||||||
}
|
motivation
|
||||||
|
}
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setIsVisibleCompleteDialog(false);
|
setIsVisibleCompleteDialog(false);
|
||||||
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
|
ApplicationEvaluationService.updateEvaluation(
|
||||||
|
data.assignedApplicationId,
|
||||||
|
submitData,
|
||||||
|
updateStatusCallback,
|
||||||
|
errUpdateStatusCallback
|
||||||
|
);
|
||||||
|
} else if (data.evaluationVersion === 'V2') {
|
||||||
|
const newFormValues = getTransformedSubmitData();
|
||||||
|
const submitData = {
|
||||||
|
formFields: newFormValues,
|
||||||
|
files: klona(data.files),
|
||||||
|
evaluationDocument: klona(data.evaluationDocument.map(o => ({
|
||||||
|
...o,
|
||||||
|
fileValue: o.fileValue[0] ? o.fileValue[0].id : ''
|
||||||
|
})
|
||||||
|
)),
|
||||||
|
amendmentDetails: klona(data.amendmentDetails),
|
||||||
|
note: data.note,
|
||||||
|
motivation
|
||||||
|
}
|
||||||
|
|
||||||
|
setLoading(true);
|
||||||
|
setIsVisibleCompleteDialog(false);
|
||||||
|
ApplicationEvaluationService.updateEvaluationV2(
|
||||||
|
data.assignedApplicationId,
|
||||||
|
formId,
|
||||||
|
submitData,
|
||||||
|
updateStatusCallback,
|
||||||
|
errUpdateStatusCallback
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const doReject = () => {
|
const doReject = () => {
|
||||||
const formData = {
|
if (data.evaluationVersion === 'V1') {
|
||||||
applicationStatus: 'REJECTED',
|
const submitData = {
|
||||||
criteria: klona(data.criteria),
|
applicationStatus: 'REJECTED',
|
||||||
checklist: klona(data.checklist),
|
criteria: klona(data.criteria),
|
||||||
files: klona(data.files),
|
checklist: klona(data.checklist),
|
||||||
note: data.note,
|
files: klona(data.files),
|
||||||
motivation
|
note: data.note,
|
||||||
}
|
motivation
|
||||||
|
}
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setIsVisibleCompleteDialog(false);
|
setIsVisibleCompleteDialog(false);
|
||||||
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
|
ApplicationEvaluationService.updateEvaluation(
|
||||||
|
data.assignedApplicationId,
|
||||||
|
submitData,
|
||||||
|
updateStatusCallback,
|
||||||
|
errUpdateStatusCallback
|
||||||
|
);
|
||||||
|
} else if (data.evaluationVersion === 'V2') {
|
||||||
|
const newFormValues = getTransformedSubmitData();
|
||||||
|
const submitData = {
|
||||||
|
formFields: newFormValues,
|
||||||
|
files: klona(data.files),
|
||||||
|
evaluationDocument: klona(data.evaluationDocument.map(o => ({
|
||||||
|
...o,
|
||||||
|
fileValue: o.fileValue[0] ? o.fileValue[0].id : ''
|
||||||
|
})
|
||||||
|
)),
|
||||||
|
amendmentDetails: klona(data.amendmentDetails),
|
||||||
|
note: data.note,
|
||||||
|
motivation
|
||||||
|
}
|
||||||
|
|
||||||
|
setLoading(true);
|
||||||
|
setIsVisibleCompleteDialog(false);
|
||||||
|
ApplicationEvaluationService.updateEvaluationV2(
|
||||||
|
data.assignedApplicationId,
|
||||||
|
formId,
|
||||||
|
submitData,
|
||||||
|
updateStatusCallback,
|
||||||
|
errUpdateStatusCallback
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateStatusCallback = (data) => {
|
const updateStatusCallback = (data) => {
|
||||||
@@ -433,7 +625,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
setIsVisibleAppointmentDialog(true);
|
setIsVisibleAppointmentDialog(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const setValue = (name, value) => {
|
const setFieldValue = (name, value) => {
|
||||||
const newData = wrap(appointmentData).set(name, value).value();
|
const newData = wrap(appointmentData).set(name, value).value();
|
||||||
setAppointmentData(newData);
|
setAppointmentData(newData);
|
||||||
}
|
}
|
||||||
@@ -507,11 +699,151 @@ const DomandaEditInstructorManager = () => {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
const evaluationShouldBeBlocked = (data = {}) => {
|
const evaluationBlockedForUser = (data = {}) => {
|
||||||
const userData = storeGet.main.userData();
|
const userData = storeGet.main.userData();
|
||||||
return isAsyncRequest || userData.id !== data.assignedUserId;
|
return isAsyncRequest || userData.id !== data.assignedUserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const shouldDisableNewSoccorso = () => {
|
||||||
|
if (data.evaluationVersion === 'V1') {
|
||||||
|
return !allFilesRated || !atLeastOneChecked;
|
||||||
|
} else if (data.evaluationVersion === 'V2') {
|
||||||
|
return !allFilesRated || !atLeastOneChecked;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const actionBtns = () => {
|
||||||
|
return <div className="appPageSection__actions">
|
||||||
|
{['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
|
||||||
|
? <Button
|
||||||
|
type="button"
|
||||||
|
disabled={!data.id || data.status === 'CLOSE'
|
||||||
|
|| (data.applicationStatus === 'EVALUATION' && shouldDisableNewSoccorso())
|
||||||
|
|| evaluationBlockedForUser(data)}
|
||||||
|
onClick={doNewSoccorso}
|
||||||
|
outlined
|
||||||
|
label={<>
|
||||||
|
{data.applicationStatus === 'EVALUATION'
|
||||||
|
? __('Richiedi soccorso istruttorio', 'gepafin')
|
||||||
|
: __('Apri soccorso istruttorio', 'gepafin')}
|
||||||
|
<i style={{ marginLeft: 7 }}>
|
||||||
|
<HelpIcon/>
|
||||||
|
</i>
|
||||||
|
</>}
|
||||||
|
/> : null}
|
||||||
|
{data.id
|
||||||
|
? <Button
|
||||||
|
type="button"
|
||||||
|
disabled={data.status === 'CLOSE' || evaluationBlockedForUser(data)}
|
||||||
|
onClick={() => doSaveDraft()}
|
||||||
|
outlined
|
||||||
|
label={__('Salva bozza valutazione', 'gepafin')}
|
||||||
|
icon="pi pi-save" iconPos="right"/>
|
||||||
|
: <Button
|
||||||
|
type="button"
|
||||||
|
onClick={() => doSaveDraft()}
|
||||||
|
label={__('Crea valutazione', 'gepafin')}
|
||||||
|
icon="pi pi-save" iconPos="right"/>}
|
||||||
|
{APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus)
|
||||||
|
&& APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
||||||
|
? <Button
|
||||||
|
type="button"
|
||||||
|
disabled={!data.id || !allFilesRated || !allChecksChecked
|
||||||
|
|| !['EVALUATION'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
|
||||||
|
onClick={doCheckNDG}
|
||||||
|
label={__('Controlla NDG', 'gepafin')}
|
||||||
|
/> : null}
|
||||||
|
{APP_EVALUATION_FLOW_ID === '1' && APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
||||||
|
? <Button
|
||||||
|
type="button"
|
||||||
|
disabled={!data.id || !['NDG'].includes(data.applicationStatus) || !data.ndg || evaluationBlockedForUser(data)}
|
||||||
|
onClick={doCreateAppointment}
|
||||||
|
label={__('Crea l\'appuntamento', 'gepafin')}
|
||||||
|
/> : null}
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
disabled={!data.id || !['APPOINTMENT'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
|
||||||
|
onClick={doMakeAdmisible}
|
||||||
|
label={__('Ammissibile formalmente', 'gepafin')}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
disabled={true}
|
||||||
|
onClick={() => {
|
||||||
|
}}
|
||||||
|
label={__('Valutazione tecnico-finanziaria positiva', 'gepafin')}
|
||||||
|
/>
|
||||||
|
{data.id
|
||||||
|
? <Button
|
||||||
|
type="button"
|
||||||
|
disabled={!isAdmissible
|
||||||
|
|| ['APPROVED'].includes(data.applicationStatus)
|
||||||
|
|| evaluationBlockedForUser(data)
|
||||||
|
|| (APP_EVALUATION_FLOW_ID === '1' && !['ADMISSIBLE'].includes(data.applicationStatus))
|
||||||
|
}
|
||||||
|
onClick={initiateApproving}
|
||||||
|
label={__('Domanda deliberata', 'gepafin')}
|
||||||
|
icon="pi pi-check" iconPos="right"/> : null}
|
||||||
|
{data.id
|
||||||
|
? <Button
|
||||||
|
type="button"
|
||||||
|
disabled={APP_EVALUATION_FLOW_ID === '1'
|
||||||
|
&& (!['EVALUATION', 'ADMISSIBLE', 'APPOINTMENT'].includes(data.applicationStatus)
|
||||||
|
|| evaluationBlockedForUser(data))}
|
||||||
|
onClick={initiateRejecting}
|
||||||
|
label={__('Respingi domanda', 'gepafin')}
|
||||||
|
icon="pi pi-times" iconPos="right"/> : null}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let updatedFormValues = klona(formValues);
|
||||||
|
let context = {};
|
||||||
|
|
||||||
|
// eslint-disable-next-line array-callback-return
|
||||||
|
formData.map((o) => {
|
||||||
|
const variable = head(o.settings.filter(o => o.name === 'variable'));
|
||||||
|
const formula = head(o.settings.filter(o => o.name === 'formula'));
|
||||||
|
|
||||||
|
if (formula && !isEmpty(formula.value)) {
|
||||||
|
context = getTokens(formula.value)
|
||||||
|
.filter(v => !['false', 'null', 'true'].includes(v))
|
||||||
|
.reduce((acc, cur) => {
|
||||||
|
acc[cur] = isNil(context[cur]) ? 0 : parseCommaDecimal(context[cur]);
|
||||||
|
return acc;
|
||||||
|
}, context);
|
||||||
|
|
||||||
|
const mathFormula = renderWithDataVars(formula.value, context);
|
||||||
|
try {
|
||||||
|
updatedFormValues[o.id] = evaluate(mathFormula);
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Error in math formula: "', mathFormula, '"', e.message);
|
||||||
|
updatedFormValues[o.id] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (variable && !isEmpty(variable.value)) {
|
||||||
|
context[variable.value[0]] = 'criteria_table' === o.name
|
||||||
|
? pathOr(0, [o.id, 'total'], updatedFormValues)
|
||||||
|
: pathOr(0, [o.id], updatedFormValues);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isEmpty(updatedFormValues) && !equal(updatedFormValues, formValues)) {
|
||||||
|
reset(updatedFormValues);
|
||||||
|
}
|
||||||
|
}, [formValues]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (formInitialData) {
|
||||||
|
//reset();
|
||||||
|
Object.keys(formInitialData).map(k => setValue(k, formInitialData[k]));
|
||||||
|
trigger();
|
||||||
|
}
|
||||||
|
}, [formInitialData]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const maxScore = pathOr(0, ['minScore'], data);
|
const maxScore = pathOr(0, ['minScore'], data);
|
||||||
const criteria = pathOr([], ['criteria'], data);
|
const criteria = pathOr([], ['criteria'], data);
|
||||||
@@ -525,9 +857,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
const entityId = !isNaN(parsed) ? parsed : 0;
|
const entityId = !isNaN(parsed) ? parsed : 0;
|
||||||
|
|
||||||
storeSet.main.setAsyncRequest();
|
storeSet.main.setAsyncRequest();
|
||||||
ApplicationEvaluationService.getEvaluationByApplId(getCallback, errGetCallback, [
|
ApplicationEvaluationService.getEvaluationVersionByApplId(entityId, getVersion, errGetVersion);
|
||||||
['applicationId', entityId]
|
|
||||||
]);
|
|
||||||
AmendmentsService.getSoccorsoByApplId(entityId, getAmendmentsCallback, errGetAmendmentsCallback, [
|
AmendmentsService.getSoccorsoByApplId(entityId, getAmendmentsCallback, errGetAmendmentsCallback, [
|
||||||
['statuses', 'AWAITING']
|
['statuses', 'AWAITING']
|
||||||
]);
|
]);
|
||||||
@@ -557,6 +887,14 @@ const DomandaEditInstructorManager = () => {
|
|||||||
? <div className="appPage__content">
|
? <div className="appPage__content">
|
||||||
<ApplicationInfo data={data}/>
|
<ApplicationInfo data={data}/>
|
||||||
|
|
||||||
|
<div className="appPageSection__hr">
|
||||||
|
<span>{__('Azioni rapide', 'gepafin')}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
{actionBtns()}
|
||||||
|
</div>
|
||||||
|
|
||||||
<ApplicationDownloadFiles id={id}/>
|
<ApplicationDownloadFiles id={id}/>
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
@@ -567,7 +905,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
data,
|
data,
|
||||||
['evaluationDocument']
|
['evaluationDocument']
|
||||||
)}
|
)}
|
||||||
shouldDisable={['APPROVED', 'REJECTED'].includes(data.applicationStatus) || evaluationShouldBeBlocked(data)}
|
shouldDisable={['APPROVED', 'REJECTED'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
|
||||||
sourceId={data.assignedApplicationId}
|
sourceId={data.assignedApplicationId}
|
||||||
sourceName="evaluation"/>
|
sourceName="evaluation"/>
|
||||||
</div>
|
</div>
|
||||||
@@ -579,7 +917,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
? <ListOfFiles
|
? <ListOfFiles
|
||||||
files={data.files}
|
files={data.files}
|
||||||
updateFn={updateEvaluationValue}
|
updateFn={updateEvaluationValue}
|
||||||
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationShouldBeBlocked(data)}
|
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)}
|
||||||
name="files"
|
name="files"
|
||||||
ndg={data.ndg}
|
ndg={data.ndg}
|
||||||
applicationId={id}/>
|
applicationId={id}/>
|
||||||
@@ -587,6 +925,82 @@ const DomandaEditInstructorManager = () => {
|
|||||||
</div>
|
</div>
|
||||||
: null}
|
: null}
|
||||||
|
|
||||||
|
{data.evaluationVersion === 'V2'
|
||||||
|
? <form className="appForm" onSubmit={handleSubmit(() => {
|
||||||
|
})}>
|
||||||
|
{formData.map(o => {
|
||||||
|
const label = head(o.settings.filter(o => o.name === 'label'));
|
||||||
|
const text = head(o.settings.filter(o => o.name === 'text'));
|
||||||
|
const placeholder = head(o.settings.filter(o => o.name === 'placeholder'));
|
||||||
|
const options = head(o.settings.filter(o => o.name === 'options'));
|
||||||
|
let tableColumns = head(o.settings.filter(o => o.name === 'table_columns'));
|
||||||
|
if (!tableColumns) {
|
||||||
|
tableColumns = head(o.settings.filter(o => o.name === 'criteria_table_columns'));
|
||||||
|
}
|
||||||
|
const step = head(o.settings.filter(o => o.name === 'step'));
|
||||||
|
const mime = head(o.settings.filter(o => o.name === 'mime'));
|
||||||
|
const formula = head(o.settings.filter(o => o.name === 'formula'));
|
||||||
|
let mimeValue = '';
|
||||||
|
|
||||||
|
if (mime) {
|
||||||
|
mimeValue = mime.value.map(o => o.code ? o.code : o.ext);
|
||||||
|
}
|
||||||
|
|
||||||
|
const validations = Object.keys(o.validators).reduce((acc, cur) => {
|
||||||
|
if (o.validators[cur]) {
|
||||||
|
if (['min', 'max', 'minLength', 'maxLength', 'maxSize'].includes(cur)) {
|
||||||
|
acc[cur] = parseInt(o.validators[cur]);
|
||||||
|
} else if ('pattern' === cur) {
|
||||||
|
acc[cur] = new RegExp(o.validators[cur]);
|
||||||
|
} else if ('isRequired' === cur) {
|
||||||
|
//acc[cur] = o.validators[cur];
|
||||||
|
acc['required'] = true;
|
||||||
|
} else if ('custom' === cur && validationFns[o.validators[cur]]) {
|
||||||
|
if (!acc.validate) {
|
||||||
|
acc.validate = {};
|
||||||
|
}
|
||||||
|
acc.validate[o.validators[cur]] = validationFns[o.validators[cur]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
/*if (o.name === 'table') {
|
||||||
|
console.log('value:', values[o.id] ? values[o.id] : '')
|
||||||
|
}*/
|
||||||
|
|
||||||
|
return ['paragraph'].includes(o.name) && text
|
||||||
|
? <div key={o.id}>
|
||||||
|
<div className="ql-editor">
|
||||||
|
{renderHtmlContent(text.value)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
: <FormField
|
||||||
|
key={o.id}
|
||||||
|
readOnly={formula && !isEmpty(formula.value)}
|
||||||
|
type={o.name}
|
||||||
|
fieldName={o.id}
|
||||||
|
label={label ? label.value : ''}
|
||||||
|
placeholder={placeholder ? placeholder.value : ''}
|
||||||
|
control={control}
|
||||||
|
register={register}
|
||||||
|
errors={errors}
|
||||||
|
defaultValue={values[o.id] ? values[o.id] : ''}
|
||||||
|
maxFractionDigits={step ? step.value : 0}
|
||||||
|
accept={mimeValue}
|
||||||
|
config={validations}
|
||||||
|
options={options ? options.value : []}
|
||||||
|
setDataFn={setValue}
|
||||||
|
saveFormCallback={doSaveDraft}
|
||||||
|
sourceId={id}
|
||||||
|
useGrouping={false}
|
||||||
|
tableColumns={tableColumns ? tableColumns.value : {}}
|
||||||
|
/>
|
||||||
|
})}
|
||||||
|
</form>
|
||||||
|
: null}
|
||||||
|
|
||||||
{data.evaluationVersion === 'V1'
|
{data.evaluationVersion === 'V1'
|
||||||
? <div className="appPageSection">
|
? <div className="appPageSection">
|
||||||
<h2>{__('Checklist Valutazione', 'gepafin')}</h2>
|
<h2>{__('Checklist Valutazione', 'gepafin')}</h2>
|
||||||
@@ -597,7 +1011,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
<div className="appPageSection__checklist">
|
<div className="appPageSection__checklist">
|
||||||
{data.checklist.map((o, i) => <div key={o.id}>
|
{data.checklist.map((o, i) => <div key={o.id}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
disabled={shouldDisableField('checklist') || evaluationShouldBeBlocked(data)}
|
disabled={shouldDisableField('checklist') || evaluationBlockedForUser(data)}
|
||||||
inputId={`checklist_${o.id}`}
|
inputId={`checklist_${o.id}`}
|
||||||
onChange={(e) => updateEvaluationValue(
|
onChange={(e) => updateEvaluationValue(
|
||||||
e.checked,
|
e.checked,
|
||||||
@@ -613,7 +1027,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
<div>
|
<div>
|
||||||
<Editor
|
<Editor
|
||||||
value={data.note}
|
value={data.note}
|
||||||
readOnly={shouldDisableField('note') || evaluationShouldBeBlocked(data)}
|
readOnly={shouldDisableField('note') || evaluationBlockedForUser(data)}
|
||||||
placeholder={__('Digita qui il messagio', 'gepafin')}
|
placeholder={__('Digita qui il messagio', 'gepafin')}
|
||||||
headerTemplate={header}
|
headerTemplate={header}
|
||||||
onTextChange={(e) => updateEvaluationValue(
|
onTextChange={(e) => updateEvaluationValue(
|
||||||
@@ -630,7 +1044,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
? <ListOfFiles
|
? <ListOfFiles
|
||||||
files={data.files}
|
files={data.files}
|
||||||
updateFn={updateEvaluationValue}
|
updateFn={updateEvaluationValue}
|
||||||
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationShouldBeBlocked(data)}
|
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)}
|
||||||
name="files"
|
name="files"
|
||||||
ndg={data.ndg}
|
ndg={data.ndg}
|
||||||
applicationId={id}/>
|
applicationId={id}/>
|
||||||
@@ -646,7 +1060,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
<ListOfFiles
|
<ListOfFiles
|
||||||
files={data.amendmentDetails}
|
files={data.amendmentDetails}
|
||||||
updateFn={updateEvaluationValue}
|
updateFn={updateEvaluationValue}
|
||||||
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationShouldBeBlocked(data)}
|
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)}
|
||||||
name="amendmentDetails"
|
name="amendmentDetails"
|
||||||
ndg={data.ndg}
|
ndg={data.ndg}
|
||||||
applicationId={id}/>
|
applicationId={id}/>
|
||||||
@@ -670,7 +1084,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
<td>
|
<td>
|
||||||
<div className="p-inputgroup">
|
<div className="p-inputgroup">
|
||||||
<InputNumber
|
<InputNumber
|
||||||
disabled={shouldDisableField('criteria') || evaluationShouldBeBlocked(data)}
|
disabled={shouldDisableField('criteria') || evaluationBlockedForUser(data)}
|
||||||
placeholder={__('Punteggio', 'gepafin')}
|
placeholder={__('Punteggio', 'gepafin')}
|
||||||
keyfilter="int"
|
keyfilter="int"
|
||||||
value={o.score}
|
value={o.score}
|
||||||
@@ -693,7 +1107,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
onClick={() => displayCriterionData(o.id)}
|
onClick={() => displayCriterionData(o.id)}
|
||||||
aria-label={__('Mostra', 'gepafin')}/> : null}
|
aria-label={__('Mostra', 'gepafin')}/> : null}
|
||||||
<Button icon="pi pi-thumbs-up" rounded outlined
|
<Button icon="pi pi-thumbs-up" rounded outlined
|
||||||
disabled={shouldDisableField('criteria') || evaluationShouldBeBlocked(data)}
|
disabled={shouldDisableField('criteria') || evaluationBlockedForUser(data)}
|
||||||
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
||||||
onClick={() => updateEvaluationValue(
|
onClick={() => updateEvaluationValue(
|
||||||
true,
|
true,
|
||||||
@@ -701,7 +1115,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
)}
|
)}
|
||||||
aria-label={__('Su', 'gepafin')}/>
|
aria-label={__('Su', 'gepafin')}/>
|
||||||
<Button icon="pi pi-thumbs-down" rounded outlined
|
<Button icon="pi pi-thumbs-down" rounded outlined
|
||||||
disabled={shouldDisableField('criteria') || evaluationShouldBeBlocked(data)}
|
disabled={shouldDisableField('criteria') || evaluationBlockedForUser(data)}
|
||||||
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
|
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
|
||||||
onClick={() => updateEvaluationValue(
|
onClick={() => updateEvaluationValue(
|
||||||
false,
|
false,
|
||||||
@@ -740,86 +1154,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<div className="appPageSection__actions">
|
{actionBtns()}
|
||||||
{['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
|
|
||||||
? <Button
|
|
||||||
type="button"
|
|
||||||
disabled={!data.id || data.status === 'CLOSE' || (data.applicationStatus === 'EVALUATION'
|
|
||||||
&& (!allFilesRated || !atLeastOneChecked)) || evaluationShouldBeBlocked(data)}
|
|
||||||
onClick={doNewSoccorso}
|
|
||||||
outlined
|
|
||||||
label={<>
|
|
||||||
{data.applicationStatus === 'EVALUATION'
|
|
||||||
? __('Richiedi soccorso istruttorio', 'gepafin')
|
|
||||||
: __('Apri soccorso istruttorio', 'gepafin')}
|
|
||||||
<i style={{ marginLeft: 7 }}>
|
|
||||||
<HelpIcon/>
|
|
||||||
</i>
|
|
||||||
</>}
|
|
||||||
/> : null}
|
|
||||||
{data.id
|
|
||||||
? <Button
|
|
||||||
type="button"
|
|
||||||
disabled={data.status === 'CLOSE' || evaluationShouldBeBlocked(data)}
|
|
||||||
onClick={() => doSaveDraft()}
|
|
||||||
outlined
|
|
||||||
label={__('Salva bozza valutazione', 'gepafin')}
|
|
||||||
icon="pi pi-save" iconPos="right"/>
|
|
||||||
: <Button
|
|
||||||
type="button"
|
|
||||||
onClick={() => doSaveDraft()}
|
|
||||||
label={__('Crea valutazione', 'gepafin')}
|
|
||||||
icon="pi pi-save" iconPos="right"/>}
|
|
||||||
{APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus)
|
|
||||||
&& APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
|
||||||
? <Button
|
|
||||||
type="button"
|
|
||||||
disabled={!data.id || !allFilesRated || !allChecksChecked
|
|
||||||
|| !['EVALUATION'].includes(data.applicationStatus) || evaluationShouldBeBlocked(data)}
|
|
||||||
onClick={doCheckNDG}
|
|
||||||
label={__('Controlla NDG', 'gepafin')}
|
|
||||||
/> : null}
|
|
||||||
{APP_EVALUATION_FLOW_ID === '1' && APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
|
||||||
? <Button
|
|
||||||
type="button"
|
|
||||||
disabled={!data.id || !['NDG'].includes(data.applicationStatus) || !data.ndg || evaluationShouldBeBlocked(data)}
|
|
||||||
onClick={doCreateAppointment}
|
|
||||||
label={__('Crea l\'appuntamento', 'gepafin')}
|
|
||||||
/> : null}
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
disabled={!data.id || !['APPOINTMENT'].includes(data.applicationStatus) || evaluationShouldBeBlocked(data)}
|
|
||||||
onClick={doMakeAdmisible}
|
|
||||||
label={__('Ammissibile formalmente', 'gepafin')}
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
disabled={true}
|
|
||||||
onClick={() => {
|
|
||||||
}}
|
|
||||||
label={__('Valutazione tecnico-finanziaria positiva', 'gepafin')}
|
|
||||||
/>
|
|
||||||
{data.id
|
|
||||||
? <Button
|
|
||||||
type="button"
|
|
||||||
disabled={!isAdmissible
|
|
||||||
|| ['APPROVED'].includes(data.applicationStatus)
|
|
||||||
|| evaluationShouldBeBlocked(data)
|
|
||||||
|| (APP_EVALUATION_FLOW_ID === '1' && !['ADMISSIBLE'].includes(data.applicationStatus))
|
|
||||||
}
|
|
||||||
onClick={initiateApproving}
|
|
||||||
label={__('Domanda deliberata', 'gepafin')}
|
|
||||||
icon="pi pi-check" iconPos="right"/> : null}
|
|
||||||
{data.id
|
|
||||||
? <Button
|
|
||||||
type="button"
|
|
||||||
disabled={APP_EVALUATION_FLOW_ID === '1'
|
|
||||||
&& (!['EVALUATION', 'ADMISSIBLE', 'APPOINTMENT'].includes(data.applicationStatus)
|
|
||||||
|| evaluationShouldBeBlocked(data))}
|
|
||||||
onClick={initiateRejecting}
|
|
||||||
label={__('Respingi Domanda', 'gepafin')}
|
|
||||||
icon="pi pi-times" iconPos="right"/> : null}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Dialog
|
<Dialog
|
||||||
@@ -866,7 +1201,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
value={appointmentData.amount}
|
value={appointmentData.amount}
|
||||||
keyfilter="int"
|
keyfilter="int"
|
||||||
invalid={isEmpty(appointmentData.amount) || appointmentData.amount === 0}
|
invalid={isEmpty(appointmentData.amount) || appointmentData.amount === 0}
|
||||||
onChange={(e) => setValue('amount', e.value)}/>
|
onChange={(e) => setFieldValue('amount', e.value)}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
<label
|
<label
|
||||||
@@ -877,7 +1212,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
value={appointmentData.duration}
|
value={appointmentData.duration}
|
||||||
keyfilter="int"
|
keyfilter="int"
|
||||||
invalid={isEmpty(appointmentData.duration) || appointmentData.duration === 0}
|
invalid={isEmpty(appointmentData.duration) || appointmentData.duration === 0}
|
||||||
onChange={(e) => setValue('duration', e.value)}/>
|
onChange={(e) => setFieldValue('duration', e.value)}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
<label className={classNames({ 'p-error': isEmpty(appointmentData.title) })}>
|
<label className={classNames({ 'p-error': isEmpty(appointmentData.title) })}>
|
||||||
@@ -886,7 +1221,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
<InputText
|
<InputText
|
||||||
value={appointmentData.title}
|
value={appointmentData.title}
|
||||||
invalid={isEmpty(appointmentData.title)}
|
invalid={isEmpty(appointmentData.title)}
|
||||||
onChange={(e) => setValue('title', e.target.value)}/>
|
onChange={(e) => setFieldValue('title', e.target.value)}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
<label className={classNames({ 'p-error': isEmpty(appointmentData.text) })}>
|
<label className={classNames({ 'p-error': isEmpty(appointmentData.text) })}>
|
||||||
@@ -895,7 +1230,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
<InputTextarea
|
<InputTextarea
|
||||||
value={appointmentData.text}
|
value={appointmentData.text}
|
||||||
invalid={isEmpty(appointmentData.text)}
|
invalid={isEmpty(appointmentData.text)}
|
||||||
onChange={(e) => setValue('text', e.target.value)}
|
onChange={(e) => setFieldValue('text', e.target.value)}
|
||||||
rows={3}
|
rows={3}
|
||||||
cols={30}/>
|
cols={30}/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -264,6 +264,31 @@ const DomandaEditPreInstructor = () => {
|
|||||||
updateFlagsForSoccorso(newData);
|
updateFlagsForSoccorso(newData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getTransformedSubmitData = () => {
|
||||||
|
const formValues = getValues();
|
||||||
|
const usedFieldsIds = pluck('id', formData);
|
||||||
|
return Object.keys(formValues)
|
||||||
|
.filter(v => usedFieldsIds.includes(v))
|
||||||
|
.reduce((acc, cur) => {
|
||||||
|
const formField = head(formData.filter(o => o.id === cur));
|
||||||
|
let fieldVal = formValues[cur];
|
||||||
|
|
||||||
|
if (formValues[cur] && formValues[cur].toISOString) {
|
||||||
|
fieldVal = formatDateString(formValues[cur]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldVal = isEmpty(fieldVal) ? null : fieldVal;
|
||||||
|
if (formField && formField.name === 'fileupload') {
|
||||||
|
fieldVal = is(Array, fieldVal) ? fieldVal.map(o => o.id).join(',') : null;
|
||||||
|
}
|
||||||
|
acc.push({
|
||||||
|
'fieldId': cur,
|
||||||
|
'fieldValue': fieldVal
|
||||||
|
});
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
|
||||||
const doSaveDraft = useCallback((doRedirect = '') => {
|
const doSaveDraft = useCallback((doRedirect = '') => {
|
||||||
if (data.evaluationVersion === 'V1') {
|
if (data.evaluationVersion === 'V1') {
|
||||||
const submitData = {
|
const submitData = {
|
||||||
@@ -286,28 +311,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
errUpdateCallback
|
errUpdateCallback
|
||||||
);
|
);
|
||||||
} else if (data.evaluationVersion === 'V2') {
|
} else if (data.evaluationVersion === 'V2') {
|
||||||
const formValues = getValues();
|
const newFormValues = getTransformedSubmitData();
|
||||||
const usedFieldsIds = pluck('id', formData);
|
|
||||||
const newFormValues = Object.keys(formValues)
|
|
||||||
.filter(v => usedFieldsIds.includes(v))
|
|
||||||
.reduce((acc, cur) => {
|
|
||||||
const formField = head(formData.filter(o => o.id === cur));
|
|
||||||
let fieldVal = formValues[cur];
|
|
||||||
|
|
||||||
if (formValues[cur] && formValues[cur].toISOString) {
|
|
||||||
fieldVal = formatDateString(formValues[cur]);
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldVal = isEmpty(fieldVal) ? null : fieldVal;
|
|
||||||
if (formField && formField.name === 'fileupload') {
|
|
||||||
fieldVal = is(Array, fieldVal) ? fieldVal.map(o => o.id).join(',') : null;
|
|
||||||
}
|
|
||||||
acc.push({
|
|
||||||
'fieldId': cur,
|
|
||||||
'fieldValue': fieldVal
|
|
||||||
});
|
|
||||||
return acc;
|
|
||||||
}, []);
|
|
||||||
const submitData = {
|
const submitData = {
|
||||||
formFields: newFormValues,
|
formFields: newFormValues,
|
||||||
files: klona(data.files),
|
files: klona(data.files),
|
||||||
@@ -360,33 +364,95 @@ const DomandaEditPreInstructor = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const doApprove = () => {
|
const doApprove = () => {
|
||||||
const formData = {
|
if (data.evaluationVersion === 'V1') {
|
||||||
applicationStatus: 'APPROVED',
|
const submitData = {
|
||||||
criteria: klona(data.criteria),
|
applicationStatus: 'APPROVED',
|
||||||
checklist: klona(data.checklist),
|
criteria: klona(data.criteria),
|
||||||
files: klona(data.files),
|
checklist: klona(data.checklist),
|
||||||
note: data.note,
|
files: klona(data.files),
|
||||||
motivation
|
note: data.note,
|
||||||
}
|
motivation
|
||||||
|
}
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setIsVisibleCompleteDialog(false);
|
setIsVisibleCompleteDialog(false);
|
||||||
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
|
ApplicationEvaluationService.updateEvaluation(
|
||||||
|
data.assignedApplicationId,
|
||||||
|
submitData,
|
||||||
|
updateStatusCallback,
|
||||||
|
errUpdateStatusCallback
|
||||||
|
);
|
||||||
|
} else if (data.evaluationVersion === 'V2') {
|
||||||
|
const newFormValues = getTransformedSubmitData();
|
||||||
|
const submitData = {
|
||||||
|
formFields: newFormValues,
|
||||||
|
files: klona(data.files),
|
||||||
|
evaluationDocument: klona(data.evaluationDocument.map(o => ({
|
||||||
|
...o,
|
||||||
|
fileValue: o.fileValue[0] ? o.fileValue[0].id : ''
|
||||||
|
})
|
||||||
|
)),
|
||||||
|
amendmentDetails: klona(data.amendmentDetails),
|
||||||
|
note: data.note,
|
||||||
|
motivation
|
||||||
|
}
|
||||||
|
|
||||||
|
setLoading(true);
|
||||||
|
setIsVisibleCompleteDialog(false);
|
||||||
|
ApplicationEvaluationService.updateEvaluationV2(
|
||||||
|
data.assignedApplicationId,
|
||||||
|
formId,
|
||||||
|
submitData,
|
||||||
|
updateStatusCallback,
|
||||||
|
errUpdateStatusCallback
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const doReject = () => {
|
const doReject = () => {
|
||||||
const formData = {
|
if (data.evaluationVersion === 'V1') {
|
||||||
applicationStatus: 'REJECTED',
|
const submitData = {
|
||||||
criteria: klona(data.criteria),
|
applicationStatus: 'REJECTED',
|
||||||
checklist: klona(data.checklist),
|
criteria: klona(data.criteria),
|
||||||
files: klona(data.files),
|
checklist: klona(data.checklist),
|
||||||
note: data.note,
|
files: klona(data.files),
|
||||||
motivation
|
note: data.note,
|
||||||
}
|
motivation
|
||||||
|
}
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setIsVisibleCompleteDialog(false);
|
setIsVisibleCompleteDialog(false);
|
||||||
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
|
ApplicationEvaluationService.updateEvaluation(
|
||||||
|
data.assignedApplicationId,
|
||||||
|
submitData,
|
||||||
|
updateStatusCallback,
|
||||||
|
errUpdateStatusCallback
|
||||||
|
);
|
||||||
|
} else if (data.evaluationVersion === 'V2') {
|
||||||
|
const newFormValues = getTransformedSubmitData();
|
||||||
|
const submitData = {
|
||||||
|
formFields: newFormValues,
|
||||||
|
files: klona(data.files),
|
||||||
|
evaluationDocument: klona(data.evaluationDocument.map(o => ({
|
||||||
|
...o,
|
||||||
|
fileValue: o.fileValue[0] ? o.fileValue[0].id : ''
|
||||||
|
})
|
||||||
|
)),
|
||||||
|
amendmentDetails: klona(data.amendmentDetails),
|
||||||
|
note: data.note,
|
||||||
|
motivation
|
||||||
|
}
|
||||||
|
|
||||||
|
setLoading(true);
|
||||||
|
setIsVisibleCompleteDialog(false);
|
||||||
|
ApplicationEvaluationService.updateEvaluationV2(
|
||||||
|
data.assignedApplicationId,
|
||||||
|
formId,
|
||||||
|
submitData,
|
||||||
|
updateStatusCallback,
|
||||||
|
errUpdateStatusCallback
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateStatusCallback = (data) => {
|
const updateStatusCallback = (data) => {
|
||||||
@@ -647,10 +713,104 @@ const DomandaEditPreInstructor = () => {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
const evaluationShouldBeBlocked = (data = {}) => {
|
const evaluationBlockedForUser = (data = {}) => {
|
||||||
const userData = storeGet.main.userData()
|
const userData = storeGet.main.userData()
|
||||||
return isAsyncRequest || userData.id !== data.assignedUserId;
|
return isAsyncRequest || userData.id !== data.assignedUserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const shouldDisableNewSoccorso = () => {
|
||||||
|
if (data.evaluationVersion === 'V1') {
|
||||||
|
return !allFilesRated || !atLeastOneChecked;
|
||||||
|
} else if (data.evaluationVersion === 'V2') {
|
||||||
|
return !allFilesRated || !atLeastOneChecked;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const actionBtns = () => {
|
||||||
|
return <div className="appPageSection__actions">
|
||||||
|
{['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
|
||||||
|
? <Button
|
||||||
|
type="button"
|
||||||
|
disabled={!data.id || data.status === 'CLOSE'
|
||||||
|
|| (data.applicationStatus === 'EVALUATION' && shouldDisableNewSoccorso())
|
||||||
|
|| evaluationBlockedForUser(data)}
|
||||||
|
onClick={doNewSoccorso}
|
||||||
|
outlined
|
||||||
|
label={<>
|
||||||
|
{data.applicationStatus === 'EVALUATION'
|
||||||
|
? __('Richiedi soccorso istruttorio', 'gepafin')
|
||||||
|
: __('Apri soccorso istruttorio', 'gepafin')}
|
||||||
|
<i style={{ marginLeft: 7 }}>
|
||||||
|
<HelpIcon/>
|
||||||
|
</i>
|
||||||
|
</>}
|
||||||
|
/> : null}
|
||||||
|
{data.id
|
||||||
|
? <Button
|
||||||
|
type="button"
|
||||||
|
disabled={data.status === 'CLOSE' || evaluationBlockedForUser(data)}
|
||||||
|
onClick={() => doSaveDraft()}
|
||||||
|
outlined
|
||||||
|
label={__('Salva bozza valutazione', 'gepafin')}
|
||||||
|
icon="pi pi-save" iconPos="right"/>
|
||||||
|
: <Button
|
||||||
|
type="button"
|
||||||
|
onClick={() => doSaveDraft()}
|
||||||
|
label={__('Crea valutazione', 'gepafin')}
|
||||||
|
icon="pi pi-save" iconPos="right"/>}
|
||||||
|
{APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus)
|
||||||
|
&& APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
||||||
|
? <Button
|
||||||
|
type="button"
|
||||||
|
disabled={!data.id || !allFilesRated || !allChecksChecked
|
||||||
|
|| !['EVALUATION'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
|
||||||
|
onClick={doCheckNDG}
|
||||||
|
label={__('Controlla NDG', 'gepafin')}
|
||||||
|
/> : null}
|
||||||
|
{APP_EVALUATION_FLOW_ID === '1' && APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
||||||
|
? <Button
|
||||||
|
type="button"
|
||||||
|
disabled={!data.id || !['NDG'].includes(data.applicationStatus) || !data.ndg || evaluationBlockedForUser(data)}
|
||||||
|
onClick={doCreateAppointment}
|
||||||
|
label={__('Crea l\'appuntamento', 'gepafin')}
|
||||||
|
/> : null}
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
disabled={!data.id || !['APPOINTMENT'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
|
||||||
|
onClick={doMakeAdmisible}
|
||||||
|
label={__('Ammissibile formalmente', 'gepafin')}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
disabled={true}
|
||||||
|
onClick={() => {
|
||||||
|
}}
|
||||||
|
label={__('Valutazione tecnico-finanziaria positiva', 'gepafin')}
|
||||||
|
/>
|
||||||
|
{data.id
|
||||||
|
? <Button
|
||||||
|
type="button"
|
||||||
|
disabled={!isAdmissible
|
||||||
|
|| ['APPROVED'].includes(data.applicationStatus)
|
||||||
|
|| evaluationBlockedForUser(data)
|
||||||
|
|| (APP_EVALUATION_FLOW_ID === '1' && !['ADMISSIBLE'].includes(data.applicationStatus))
|
||||||
|
}
|
||||||
|
onClick={initiateApproving}
|
||||||
|
label={__('Domanda deliberata', 'gepafin')}
|
||||||
|
icon="pi pi-check" iconPos="right"/> : null}
|
||||||
|
{data.id
|
||||||
|
? <Button
|
||||||
|
type="button"
|
||||||
|
disabled={APP_EVALUATION_FLOW_ID === '1'
|
||||||
|
&& (!['EVALUATION', 'ADMISSIBLE', 'APPOINTMENT'].includes(data.applicationStatus)
|
||||||
|
|| evaluationBlockedForUser(data))}
|
||||||
|
onClick={initiateRejecting}
|
||||||
|
label={__('Respingi domanda', 'gepafin')}
|
||||||
|
icon="pi pi-times" iconPos="right"/> : null}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let updatedFormValues = klona(formValues);
|
let updatedFormValues = klona(formValues);
|
||||||
@@ -742,6 +902,14 @@ const DomandaEditPreInstructor = () => {
|
|||||||
? <div className="appPage__content">
|
? <div className="appPage__content">
|
||||||
<ApplicationInfo data={data}/>
|
<ApplicationInfo data={data}/>
|
||||||
|
|
||||||
|
<div className="appPageSection__hr">
|
||||||
|
<span>{__('Azioni rapide', 'gepafin')}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
{actionBtns()}
|
||||||
|
</div>
|
||||||
|
|
||||||
<ApplicationDownloadFiles id={id}/>
|
<ApplicationDownloadFiles id={id}/>
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
@@ -752,7 +920,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
data,
|
data,
|
||||||
['evaluationDocument']
|
['evaluationDocument']
|
||||||
)}
|
)}
|
||||||
shouldDisable={['APPROVED', 'REJECTED'].includes(data.applicationStatus) || evaluationShouldBeBlocked(data)}
|
shouldDisable={['APPROVED', 'REJECTED'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
|
||||||
sourceId={data.assignedApplicationId}
|
sourceId={data.assignedApplicationId}
|
||||||
sourceName="evaluation"/>
|
sourceName="evaluation"/>
|
||||||
</div>
|
</div>
|
||||||
@@ -764,7 +932,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
? <ListOfFiles
|
? <ListOfFiles
|
||||||
files={data.files}
|
files={data.files}
|
||||||
updateFn={updateEvaluationValue}
|
updateFn={updateEvaluationValue}
|
||||||
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationShouldBeBlocked(data)}
|
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)}
|
||||||
name="files"
|
name="files"
|
||||||
ndg={data.ndg}
|
ndg={data.ndg}
|
||||||
applicationId={id}/>
|
applicationId={id}/>
|
||||||
@@ -773,7 +941,8 @@ const DomandaEditPreInstructor = () => {
|
|||||||
: null}
|
: null}
|
||||||
|
|
||||||
{data.evaluationVersion === 'V2'
|
{data.evaluationVersion === 'V2'
|
||||||
? <form className="appForm" onSubmit={handleSubmit(() => {})}>
|
? <form className="appForm" onSubmit={handleSubmit(() => {
|
||||||
|
})}>
|
||||||
{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'));
|
||||||
@@ -857,7 +1026,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
<div className="appPageSection__checklist">
|
<div className="appPageSection__checklist">
|
||||||
{data.checklist.map((o, i) => <div key={o.id}>
|
{data.checklist.map((o, i) => <div key={o.id}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
disabled={shouldDisableField('checklist') || evaluationShouldBeBlocked(data)}
|
disabled={shouldDisableField('checklist') || evaluationBlockedForUser(data)}
|
||||||
inputId={`checklist_${o.id}`}
|
inputId={`checklist_${o.id}`}
|
||||||
onChange={(e) => updateEvaluationValue(
|
onChange={(e) => updateEvaluationValue(
|
||||||
e.checked,
|
e.checked,
|
||||||
@@ -873,7 +1042,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
<div>
|
<div>
|
||||||
<Editor
|
<Editor
|
||||||
value={data.note}
|
value={data.note}
|
||||||
readOnly={shouldDisableField('note') || evaluationShouldBeBlocked(data)}
|
readOnly={shouldDisableField('note') || evaluationBlockedForUser(data)}
|
||||||
placeholder={__('Digita qui il messagio', 'gepafin')}
|
placeholder={__('Digita qui il messagio', 'gepafin')}
|
||||||
headerTemplate={header}
|
headerTemplate={header}
|
||||||
onTextChange={(e) => updateEvaluationValue(
|
onTextChange={(e) => updateEvaluationValue(
|
||||||
@@ -890,7 +1059,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
? <ListOfFiles
|
? <ListOfFiles
|
||||||
files={data.files}
|
files={data.files}
|
||||||
updateFn={updateEvaluationValue}
|
updateFn={updateEvaluationValue}
|
||||||
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationShouldBeBlocked(data)}
|
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)}
|
||||||
name="files"
|
name="files"
|
||||||
ndg={data.ndg}
|
ndg={data.ndg}
|
||||||
applicationId={id}/>
|
applicationId={id}/>
|
||||||
@@ -906,7 +1075,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
<ListOfFiles
|
<ListOfFiles
|
||||||
files={data.amendmentDetails}
|
files={data.amendmentDetails}
|
||||||
updateFn={updateEvaluationValue}
|
updateFn={updateEvaluationValue}
|
||||||
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationShouldBeBlocked(data)}
|
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)}
|
||||||
name="amendmentDetails"
|
name="amendmentDetails"
|
||||||
ndg={data.ndg}
|
ndg={data.ndg}
|
||||||
applicationId={id}/>
|
applicationId={id}/>
|
||||||
@@ -930,7 +1099,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
<td>
|
<td>
|
||||||
<div className="p-inputgroup">
|
<div className="p-inputgroup">
|
||||||
<InputNumber
|
<InputNumber
|
||||||
disabled={shouldDisableField('criteria') || evaluationShouldBeBlocked(data)}
|
disabled={shouldDisableField('criteria') || evaluationBlockedForUser(data)}
|
||||||
placeholder={__('Punteggio', 'gepafin')}
|
placeholder={__('Punteggio', 'gepafin')}
|
||||||
keyfilter="int"
|
keyfilter="int"
|
||||||
value={o.score}
|
value={o.score}
|
||||||
@@ -953,7 +1122,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
onClick={() => displayCriterionData(o.id)}
|
onClick={() => displayCriterionData(o.id)}
|
||||||
aria-label={__('Mostra', 'gepafin')}/> : null}
|
aria-label={__('Mostra', 'gepafin')}/> : null}
|
||||||
<Button icon="pi pi-thumbs-up" rounded outlined
|
<Button icon="pi pi-thumbs-up" rounded outlined
|
||||||
disabled={shouldDisableField('criteria') || evaluationShouldBeBlocked(data)}
|
disabled={shouldDisableField('criteria') || evaluationBlockedForUser(data)}
|
||||||
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
||||||
onClick={() => updateEvaluationValue(
|
onClick={() => updateEvaluationValue(
|
||||||
true,
|
true,
|
||||||
@@ -961,7 +1130,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
)}
|
)}
|
||||||
aria-label={__('Su', 'gepafin')}/>
|
aria-label={__('Su', 'gepafin')}/>
|
||||||
<Button icon="pi pi-thumbs-down" rounded outlined
|
<Button icon="pi pi-thumbs-down" rounded outlined
|
||||||
disabled={shouldDisableField('criteria') || evaluationShouldBeBlocked(data)}
|
disabled={shouldDisableField('criteria') || evaluationBlockedForUser(data)}
|
||||||
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
|
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
|
||||||
onClick={() => updateEvaluationValue(
|
onClick={() => updateEvaluationValue(
|
||||||
false,
|
false,
|
||||||
@@ -1000,86 +1169,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<div className="appPageSection__actions">
|
{actionBtns()}
|
||||||
{['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
|
|
||||||
? <Button
|
|
||||||
type="button"
|
|
||||||
disabled={!data.id || data.status === 'CLOSE' || (data.applicationStatus === 'EVALUATION'
|
|
||||||
&& (!allFilesRated || !atLeastOneChecked)) || evaluationShouldBeBlocked(data)}
|
|
||||||
onClick={doNewSoccorso}
|
|
||||||
outlined
|
|
||||||
label={<>
|
|
||||||
{data.applicationStatus === 'EVALUATION'
|
|
||||||
? __('Richiedi soccorso istruttorio', 'gepafin')
|
|
||||||
: __('Apri soccorso istruttorio', 'gepafin')}
|
|
||||||
<i style={{ marginLeft: 7 }}>
|
|
||||||
<HelpIcon/>
|
|
||||||
</i>
|
|
||||||
</>}
|
|
||||||
/> : null}
|
|
||||||
{data.id
|
|
||||||
? <Button
|
|
||||||
type="button"
|
|
||||||
disabled={data.status === 'CLOSE' || evaluationShouldBeBlocked(data)}
|
|
||||||
onClick={() => doSaveDraft()}
|
|
||||||
outlined
|
|
||||||
label={__('Salva bozza valutazione', 'gepafin')}
|
|
||||||
icon="pi pi-save" iconPos="right"/>
|
|
||||||
: <Button
|
|
||||||
type="button"
|
|
||||||
onClick={() => doSaveDraft()}
|
|
||||||
label={__('Crea valutazione', 'gepafin')}
|
|
||||||
icon="pi pi-save" iconPos="right"/>}
|
|
||||||
{APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus)
|
|
||||||
&& APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
|
||||||
? <Button
|
|
||||||
type="button"
|
|
||||||
disabled={!data.id || !allFilesRated || !allChecksChecked
|
|
||||||
|| !['EVALUATION'].includes(data.applicationStatus) || evaluationShouldBeBlocked(data)}
|
|
||||||
onClick={doCheckNDG}
|
|
||||||
label={__('Controlla NDG', 'gepafin')}
|
|
||||||
/> : null}
|
|
||||||
{APP_EVALUATION_FLOW_ID === '1' && APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
|
||||||
? <Button
|
|
||||||
type="button"
|
|
||||||
disabled={!data.id || !['NDG'].includes(data.applicationStatus) || !data.ndg || evaluationShouldBeBlocked(data)}
|
|
||||||
onClick={doCreateAppointment}
|
|
||||||
label={__('Crea l\'appuntamento', 'gepafin')}
|
|
||||||
/> : null}
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
disabled={!data.id || !['APPOINTMENT'].includes(data.applicationStatus) || evaluationShouldBeBlocked(data)}
|
|
||||||
onClick={doMakeAdmisible}
|
|
||||||
label={__('Ammissibile formalmente', 'gepafin')}
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
disabled={true}
|
|
||||||
onClick={() => {
|
|
||||||
}}
|
|
||||||
label={__('Valutazione tecnico-finanziaria positiva', 'gepafin')}
|
|
||||||
/>
|
|
||||||
{data.id
|
|
||||||
? <Button
|
|
||||||
type="button"
|
|
||||||
disabled={!isAdmissible
|
|
||||||
|| ['APPROVED'].includes(data.applicationStatus)
|
|
||||||
|| evaluationShouldBeBlocked(data)
|
|
||||||
|| (APP_EVALUATION_FLOW_ID === '1' && !['ADMISSIBLE'].includes(data.applicationStatus))
|
|
||||||
}
|
|
||||||
onClick={initiateApproving}
|
|
||||||
label={__('Domanda deliberata', 'gepafin')}
|
|
||||||
icon="pi pi-check" iconPos="right"/> : null}
|
|
||||||
{data.id
|
|
||||||
? <Button
|
|
||||||
type="button"
|
|
||||||
disabled={APP_EVALUATION_FLOW_ID === '1'
|
|
||||||
&& (!['EVALUATION', 'ADMISSIBLE', 'APPOINTMENT'].includes(data.applicationStatus)
|
|
||||||
|| evaluationShouldBeBlocked(data))}
|
|
||||||
onClick={initiateRejecting}
|
|
||||||
label={__('Respingi domanda', 'gepafin')}
|
|
||||||
icon="pi pi-times" iconPos="right"/> : null}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Dialog
|
<Dialog
|
||||||
|
|||||||
@@ -185,6 +185,10 @@ export const elementItems = [
|
|||||||
{
|
{
|
||||||
name: "label",
|
name: "label",
|
||||||
value: "Casella di Spunta"
|
value: "Casella di Spunta"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "isChecklistItem",
|
||||||
|
value: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
validators: {
|
validators: {
|
||||||
@@ -459,5 +463,25 @@ export const elementItems = [
|
|||||||
validators: {
|
validators: {
|
||||||
custom: 'nonEmptyTables'
|
custom: 'nonEmptyTables'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 22,
|
||||||
|
sortOrder: 22,
|
||||||
|
name: 'switch',
|
||||||
|
label: 'Casella di spunta "Checklist"',
|
||||||
|
description: 'Per selezioni binarie, accettazioni, conferme',
|
||||||
|
settings: [
|
||||||
|
{
|
||||||
|
name: "label",
|
||||||
|
value: "Casella di Spunta"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "isChecklistItem",
|
||||||
|
value: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
validators: {
|
||||||
|
isRequired: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user