diff --git a/src/assets/scss/components/formBuilder.scss b/src/assets/scss/components/formBuilder.scss index 2b82558..3ed9564 100644 --- a/src/assets/scss/components/formBuilder.scss +++ b/src/assets/scss/components/formBuilder.scss @@ -53,6 +53,10 @@ font-weight: 400; line-height: 21px; + &:hover { + cursor: pointer; + } + .meta { display: flex; flex-direction: column; @@ -116,7 +120,7 @@ border: 1px solid var(--button-secondary-borderColor); background-color: var(--button-secondary-borderColor); width: 100%; - padding: 10px; + padding: 20px 10px; opacity: 0.6; color: white; font-size: 11px; diff --git a/src/components/FormField/components/CriteriaTable/RenderTable/components/LastRowCell/index.js b/src/components/FormField/components/CriteriaTable/RenderTable/components/LastRowCell/index.js index c9e12a0..cd0d954 100644 --- a/src/components/FormField/components/CriteriaTable/RenderTable/components/LastRowCell/index.js +++ b/src/components/FormField/components/CriteriaTable/RenderTable/components/LastRowCell/index.js @@ -1,4 +1,5 @@ import { head, isNil, pathOr } from 'ramda'; +import getNumberFormatted from '../../../../../../../helpers/getNumberFormatted'; const LastRowCell = ({columnId, lastRowCfg, columnMeta = {}, tableValue = []}) => { const cellData = head(lastRowCfg.filter(o => !isNil(o[columnId]))); @@ -8,7 +9,7 @@ const LastRowCell = ({columnId, lastRowCfg, columnMeta = {}, tableValue = []}) = cellValue = pathOr(0, ['total'], tableValue); } - return {cellValue}; + return {getNumberFormatted(cellValue)}; }; export default LastRowCell; \ No newline at end of file diff --git a/src/components/FormField/components/CriteriaTable/RenderTable/index.js b/src/components/FormField/components/CriteriaTable/RenderTable/index.js index 822df3a..e888433 100644 --- a/src/components/FormField/components/CriteriaTable/RenderTable/index.js +++ b/src/components/FormField/components/CriteriaTable/RenderTable/index.js @@ -6,7 +6,6 @@ import { head, isEmpty, isNil, pathOr, sum } from 'ramda'; // components import DefaultCell from './components/DefaultCell'; import LastRowCell from './components/LastRowCell'; -import getNumberFormatted from '../../../../../helpers/getNumberFormatted'; const RenderTable = ({ tableValue = {}, columnsCfg, lastRowCfg, setTableValueFn, disabled }) => { const rows = pathOr([], ['rows'], tableValue) @@ -32,7 +31,7 @@ const RenderTable = ({ tableValue = {}, columnsCfg, lastRowCfg, setTableValueFn, .map(v => isEmpty(v) || isNil(v) ? 0 : v); if (cellValue === 'sum') { - total = getNumberFormatted(sum(getAllRowsValues)); + total = sum(getAllRowsValues); } else { total = 0; } diff --git a/src/configData.js b/src/configData.js index c37fc50..dbed67c 100644 --- a/src/configData.js +++ b/src/configData.js @@ -50,105 +50,195 @@ export const dynamicDataOptions = { export const protocolType = [ { 'id': 1, - 'name': 'PROTOCOLLO IN ENTRATA' + 'name': 'PROTOCOLLO ENTRATA' }, { 'id': 2, - 'name': 'PROTOCOLLO IN USCITA' + 'name': 'PROTOCOLLO USCITA' }, { 'id': 3, 'name': 'DOCUMENTO INTERNO' }, - { + /*{ 'id': 1003, 'name': 'PROTOCOLLO INTERNO ' - } + }*/ ]; export const classificationType = [ { - 'idClassificazione': 1, + 'idClassificazione': 101, 'name': 'BILANCIO', 'idTipoprotocollo': 1 }, { - 'idClassificazione': 2, + 'idClassificazione': 102, 'name': 'DICHHIARAZIONE DEI REDDITI', 'idTipoprotocollo': 1 }, { - 'idClassificazione': 3, + 'idClassificazione': 103, 'name': 'SITUAZIONE CONTABILE', 'idTipoprotocollo': 1 }, { - 'idClassificazione': 4, + 'idClassificazione': 104, 'name': 'PROSPETTO CONTO ECONOMICO', 'idTipoprotocollo': 1 }, { - 'idClassificazione': 5, + 'idClassificazione': 105, 'name': 'CENTRALE DEI RISCHI', 'idTipoprotocollo': 1 }, { - 'idClassificazione': 6, - 'name': 'RELAZIONE AZIENDALE ILLUSTRATIVA (MOD R1C, R1I, R1R, R1R A SECONDO DEI ', + 'idClassificazione': 106, + 'name': 'RELAZIONE AZIENDALE ILLUSTRATIVA (MOD R1C, R1I, R1R, R1S A SECONDA DEI SETTORI)', 'idTipoprotocollo': 1 }, { - 'idClassificazione': 7, + 'idClassificazione': 107, 'name': 'DOCUMENTO IDENTITA\'', 'idTipoprotocollo': 1 }, { - 'idClassificazione': 8, + 'idClassificazione': 108, 'name': 'MODELLO SP1', 'idTipoprotocollo': 1 }, { - 'idClassificazione': 9, + 'idClassificazione': 109, 'name': 'PRIVACY', 'idTipoprotocollo': 1 }, { - 'idClassificazione': 10, - 'name': 'DOCUMENTAZIONE CHE ATTESTA POSSIBILITA\' DI RILASCIARE GAA FAVORE', + 'idClassificazione': 110, + 'name': 'DOCUMENTAZIONE CHE ATTESTA POSSIBILITA\' DI RILASCIARE GARANZIE A FAVORE DI TERZI (ES. STATUTO, VISURA…)', 'idTipoprotocollo': 1 }, { - 'idClassificazione': 11, + 'idClassificazione': 111, 'name': 'MODELLO AR1 D.LG 231/2007', 'idTipoprotocollo': 1 }, { - 'idClassificazione': 12, - 'name': 'DOCUMENTO IDENTITA\' FIRMATORIO DICHHIARAZIONE SOSTITUTIVA', + 'idClassificazione': 112, + 'name': 'DOCUMENTO IDENTITA\' FIRMATARIO DICHIARAZIONE SOSTITUTIVA', 'idTipoprotocollo': 1 }, { - 'idClassificazione': 13, - 'name': 'PRIVACY FIRMATARIO DICHHIARAZIONE SOSTITUTIVA', + 'idClassificazione': 113, + 'name': 'PRIVACY FIRMATARIO DICHIARAZIONE SOSTITUTIVA', 'idTipoprotocollo': 1 }, { - 'idClassificazione': 14, + 'idClassificazione': 114, 'name': 'NULLAOSTA ANTIMAFIA', 'idTipoprotocollo': 1 }, { - 'idClassificazione': 1, - 'name': 'LETTERA ESITO DELIBERA', - 'idTipoprotocollo': 2 + 'idClassificazione': 115, + 'name': 'VISURA CRIF', + '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', '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', 'idTipoprotocollo': 3 } diff --git a/src/pages/BandoEdit/components/BandoEditFormStep1/index.js b/src/pages/BandoEdit/components/BandoEditFormStep1/index.js index 5c106ae..f15f353 100644 --- a/src/pages/BandoEdit/components/BandoEditFormStep1/index.js +++ b/src/pages/BandoEdit/components/BandoEditFormStep1/index.js @@ -29,6 +29,8 @@ import getTimeParsedFromString from '../../../../helpers/getTimeParsedFromString import formatDateString from '../../../../helpers/formatDateString'; 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 navigate = useNavigate(); const [aimedToOptions, setAimedToOptions] = useState([]); @@ -51,7 +53,8 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, setInitialData, g const values = getValues(); const toast = useRef(null); - const onSubmit = () => {}; + const onSubmit = () => { + }; const onSaveDraft = () => { trigger(); @@ -198,7 +201,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, setInitialData, g ![ 'descriptionShort', 'descriptionLong', 'documentationRequested', 'threshold', 'aimedTo', 'criteria', 'docs', 'checklist', 'faq', 'amount', 'amountMin', 'amountMax', - 'email', 'phoneNumber', 'checkList', 'images' + 'email', 'phoneNumber', 'checkList', 'images', 'numberOfCheck', 'productId' ].includes(fieldName) } @@ -477,6 +480,35 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, setInitialData, g /> +
+ + + {APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE' + ? : null} +
+ { if (data.status === 'SUCCESS') { - 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(elementItems.sort((a, b) => a.sortOrder - b.sortOrder)); + storeSet.main.elementItems(data.data.sort((a, b) => a.sortOrder - b.sortOrder)); } storeSet.main.unsetAsyncRequest(); } @@ -123,7 +123,7 @@ const BandoEditFormStep3 = forwardRef(function () {
- +
diff --git a/src/pages/BandoFormsEdit/components/BuilderElement/index.js b/src/pages/BandoFormsEdit/components/BuilderElement/index.js index 83d22af..2cfffa6 100644 --- a/src/pages/BandoFormsEdit/components/BuilderElement/index.js +++ b/src/pages/BandoFormsEdit/components/BuilderElement/index.js @@ -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 { ItemTypes } from '../ItemTypes'; import { __ } from '@wordpress/i18n'; import { head, isEmpty } from 'ramda'; +import { klona } from 'klona'; // store import { storeSet, useStore } from '../../../../store'; +// tools +import uniqid from '../../../../helpers/uniqid'; + // components import { Button } from 'primereact/button'; 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 [isVariable, setIsVariable] = useState('secondary'); const [isFormula, setIsFormula] = useState('secondary'); + const [variableName, setVariableName] = useState('secondary'); + const [formulaName, setFormulaName] = useState('secondary'); const [isRequestedAmount, setIsRequestedAmount] = useState(false); const [isDelegation, setIsDelegation] = useState(false); @@ -97,6 +103,18 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => { 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) => { storeSet.main.removeElement(id); } @@ -112,10 +130,12 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => { if (variable && !isEmpty(variable.value)) { setIsVariable('warning'); + setVariableName(variable.value) } if (formula && !isEmpty(formula.value)) { setIsFormula('warning'); + setFormulaName(formula.value) } if (isRequestedAmount && !isEmpty(isRequestedAmount.value) && isRequestedAmount.value) { @@ -137,9 +157,9 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
{['numberinput', 'criteria_table'].includes(name) - ? : null} + ? : null} {name === 'numberinput' - ? : null} + ? : null} {isRequestedAmount ? : null} {isDelegation @@ -148,6 +168,7 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
+
diff --git a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js index ed7fa42..0795c5a 100644 --- a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js +++ b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js @@ -35,12 +35,13 @@ const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => { text: __('Testo formattato', 'gepafin'), table_columns: '', criteria_table_columns: '', - variable: __('Variable (only letters and "_")', 'gepafin'), - formula: __('Auto calculation formula', 'gepafin') + variable: __('Variabile (lettere, cifre e "_"; il primo carattere deve essere una lettera!)', 'gepafin'), + formula: __('Formula di calcolo automatico', 'gepafin'), + isChecklistItem: __('Fa parte di "checklist"?', 'gepafin'), } const settingDescription = { - formula: __('Create formula using previously declared variables. Use these math operators: +, -, *, /. Example of formula: {entrate}+{assicurazione}.', 'gepafin') + formula: __('Crea una formula usando variabili dichiarate in precedenza. Utilizza questi operatori matematici: +, -, *, /. Esempio: {entrate}+{assicurazione}.', 'gepafin') } const renderHeader = () => { @@ -104,7 +105,7 @@ const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => { name={setting.name} bandoStatus={bandoStatus} setDataFn={updateDataFn}/> - } else if (['isRequestedAmount', 'isDelegation'].includes(setting.name)) { + } else if (['isRequestedAmount', 'isDelegation', 'isChecklistItem'].includes(setting.name)) { return changeFn(e.value, setting.name)}/> diff --git a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingChips/index.js b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingChips/index.js index 846dcc5..4ea1149 100644 --- a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingChips/index.js +++ b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSettingChips/index.js @@ -8,7 +8,7 @@ const ElementSettingChips = ({ restrictedValues = [], changeFn, value = [] }) => const [lastTyped, setLastTyped] = useState([]) const isValidValue = (newVal) => { - const validationRegex = /^[a-zA-Z_]+$/; + const validationRegex = /^[a-zA-Z][a-zA-Z0-9_]*$/; return validationRegex.test(newVal); }; diff --git a/src/pages/BandoFormsEdit/components/BuilderElementSettings/index.js b/src/pages/BandoFormsEdit/components/BuilderElementSettings/index.js index e95efd6..92fec6f 100644 --- a/src/pages/BandoFormsEdit/components/BuilderElementSettings/index.js +++ b/src/pages/BandoFormsEdit/components/BuilderElementSettings/index.js @@ -19,7 +19,7 @@ import { MultiSelect } from 'primereact/multiselect'; import { dynamicDataOptions } from '../../../../configData'; -const BuilderElementSettings = ({ closeSettingsFn, bandoStatus }) => { +const BuilderElementSettings = ({ closeSettingsFn, callStatus, context }) => { const elements = useStore().main.formElements(); const activeElement = useStore().main.activeElement(); 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) { setActiveElementData(klona(chosen)); setSettings(settings); @@ -149,7 +153,7 @@ const BuilderElementSettings = ({ closeSettingsFn, bandoStatus }) => { .map((o) => ) : null} @@ -220,7 +224,8 @@ const BuilderElementSettings = ({ closeSettingsFn, bandoStatus }) => {
: null} ) : null} : null} - + {context === 'application' + ?
{ display="chip" placeholder={__('Scegli', 'gepafin')}/>
-
+
: null} {settings && settings .filter(o => ['variable', 'formula'].includes(o.name)).length > 0 - ? + ? {settings ? settings .filter(o => ['variable', 'formula'].includes(o.name)) .map((o) => ) : null} : null} -