diff --git a/environments/dev/dev.env b/environments/dev/dev.env
index 9ef0c84..38e36ec 100644
--- a/environments/dev/dev.env
+++ b/environments/dev/dev.env
@@ -4,4 +4,5 @@ REACT_APP_API_ADDRESS=https://api-dev-gepafin.memento.credit
REACT_APP_LOGO_FILENAME=gepafin-logo.svg
REACT_APP_FAVICON_FILENAME=gepafin-favicon.ico
REACT_APP_HUB_ID=p4lk3bcx1RStqTaIVVbXs
-REACT_APP_EVALUATION_FLOW_ID=1
\ No newline at end of file
+REACT_APP_EVALUATION_FLOW_ID=1
+REACT_APP_LOCAL_DEVELOPMENT=0
\ No newline at end of file
diff --git a/environments/prod/prod.env b/environments/prod/prod.env
index 1755a33..ecbe860 100644
--- a/environments/prod/prod.env
+++ b/environments/prod/prod.env
@@ -4,4 +4,5 @@ REACT_APP_API_ADDRESS=https://bandi-api.gepafin.it
REACT_APP_LOGO_FILENAME=gepafin-logo.svg
REACT_APP_FAVICON_FILENAME=gepafin-favicon.ico
REACT_APP_HUB_ID=p4lk3bcx1RStqTaIVVbXs
-REACT_APP_EVALUATION_FLOW_ID=1
\ No newline at end of file
+REACT_APP_EVALUATION_FLOW_ID=1
+REACT_APP_LOCAL_DEVELOPMENT=0
\ No newline at end of file
diff --git a/src/assets/scss/components/appPage.scss b/src/assets/scss/components/appPage.scss
index da0721a..9d3de37 100644
--- a/src/assets/scss/components/appPage.scss
+++ b/src/assets/scss/components/appPage.scss
@@ -43,6 +43,10 @@
margin-left: 10px;
text-transform: uppercase;
}
+
+ span.companyName {
+ margin: 0;
+ }
}
.appPage__spacer {
@@ -258,7 +262,7 @@
.appPageSection__checklist {
display: flex;
flex-direction: column;
- gap: 1rem;
+ gap: 1.2rem;
div {
display: flex;
diff --git a/src/assets/scss/components/fieldsRepeater.scss b/src/assets/scss/components/fieldsRepeater.scss
new file mode 100644
index 0000000..dddc5ba
--- /dev/null
+++ b/src/assets/scss/components/fieldsRepeater.scss
@@ -0,0 +1,45 @@
+.fieldsRepeater {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 10px;
+ width: 100%;
+}
+
+.fieldsRepeater form {
+ display: contents;
+
+}
+
+.fieldsRepeater__panel {
+ width: 100%;
+}
+
+.fieldsRepeater__heading {
+ align-items: center;
+ display: flex;
+ justify-content: space-between;
+
+ > span {
+ width: 100%;
+ height: 100%;
+
+ &:hover {
+ cursor: pointer;
+ color: var(--menuitem-active-background);
+ }
+ }
+
+ &[data-hide="true"] {
+ display: none;
+ }
+}
+
+.fieldsRepeater__fields {
+ &[data-hide="true"] {
+ display: none;
+ }
+}
+
+.fieldsRepeater__addNew {
+}
\ No newline at end of file
diff --git a/src/assets/scss/theme.scss b/src/assets/scss/theme.scss
index 2bd1bad..4ad1ef5 100644
--- a/src/assets/scss/theme.scss
+++ b/src/assets/scss/theme.scss
@@ -43,4 +43,5 @@
@import "./components/flowBuilder.scss";
@import "./components/error404.scss";
@import "./components/myTable.scss";
-@import "./components/evaluation.scss";
\ No newline at end of file
+@import "./components/evaluation.scss";
+@import "./components/fieldsRepeater.scss";
\ No newline at end of file
diff --git a/src/components/ErrorBoundary/index.js b/src/components/ErrorBoundary/index.js
index 4ac790c..6521776 100644
--- a/src/components/ErrorBoundary/index.js
+++ b/src/components/ErrorBoundary/index.js
@@ -1,7 +1,5 @@
import React, { Component } from 'react';
-import * as Sentry from '@sentry/browser';
-
-const LOCAL_DEVELOPMENT = process.env.REACT_APP_LOCAL_DEVELOPMENT;
+import logMsgWithSentry from '../../helpers/logMsgWithSentry';
class ErrorBoundary extends Component {
constructor(props) {
@@ -14,16 +12,8 @@ class ErrorBoundary extends Component {
static getDerivedStateFromError(error) {
try {
- if (LOCAL_DEVELOPMENT !== '1') {
- Sentry.init({
- dsn: "https://e7b2134f7d816f663bb83e51b106a694@o4508381921738752.ingest.de.sentry.io/4508381935501392",
- environment: process.env.NODE_ENV || "development"
- });
-
- Sentry.captureException(error);
- }
+ logMsgWithSentry('', 0, {}, error);
} catch (err) {
- console.log('err')
console.log(err);
}
return { builderError: true };
diff --git a/src/components/FormField/components/Fileupload/index.js b/src/components/FormField/components/Fileupload/index.js
index 70d716d..0bdcfeb 100644
--- a/src/components/FormField/components/Fileupload/index.js
+++ b/src/components/FormField/components/Fileupload/index.js
@@ -38,7 +38,8 @@ const Fileupload = ({
source = 'application',
disabled = false,
saveFormCallback = () => {
- }
+ },
+ deleteOnBackend = true
}) => {
// eslint-disable-next-line no-unused-vars
const [stateFieldData, setStateFieldData] = useState([]);
@@ -97,7 +98,7 @@ const Fileupload = ({
};
const onTemplateRemove = (file) => {
- if (file.id) {
+ if (file.id && deleteOnBackend) {
FileUploadService.deleteFile(
{},
(data) => deleteCallback(data, file.id),
@@ -108,6 +109,11 @@ const Fileupload = ({
const files = inputRef.current.getFiles()
const newFiles = files.filter(o => o.lastModified !== file.lastModified && o.name !== file.name);
inputRef.current.setFiles(newFiles);
+ if (file.id) {
+ const uploadedFiles = inputRef.current.getUploadedFiles();
+ const newUploadedFiles = uploadedFiles.filter(o => o.id !== file.id);
+ inputRef.current.setUploadedFiles(newUploadedFiles);
+ }
}
}
diff --git a/src/configData.js b/src/configData.js
index c8827e7..ba5d649 100644
--- a/src/configData.js
+++ b/src/configData.js
@@ -67,87 +67,87 @@ export const protocolType = [
export const classificationType = [
{
- 'idClassificazione': 101,
+ 'idClassificazione': 1,
'name': 'BILANCIO',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 102,
+ 'idClassificazione': 2,
'name': 'DICHHIARAZIONE DEI REDDITI',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 103,
+ 'idClassificazione': 3,
'name': 'SITUAZIONE CONTABILE',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 104,
+ 'idClassificazione': 4,
'name': 'PROSPETTO CONTO ECONOMICO',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 105,
+ 'idClassificazione': 5,
'name': 'CENTRALE DEI RISCHI',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 106,
+ 'idClassificazione': 6,
'name': 'RELAZIONE AZIENDALE ILLUSTRATIVA (MOD R1C, R1I, R1R, R1R A SECONDO DEI ',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 107,
+ 'idClassificazione': 7,
'name': 'DOCUMENTO IDENTITA\'',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 108,
+ 'idClassificazione': 8,
'name': 'MODELLO SP1',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 109,
+ 'idClassificazione': 9,
'name': 'PRIVACY',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 110,
+ 'idClassificazione': 10,
'name': 'DOCUMENTAZIONE CHE ATTESTA POSSIBILITA\' DI RILASCIARE GAA FAVORE',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 111,
+ 'idClassificazione': 11,
'name': 'MODELLO AR1 D.LG 231/2007',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 112,
+ 'idClassificazione': 12,
'name': 'DOCUMENTO IDENTITA\' FIRMATORIO DICHHIARAZIONE SOSTITUTIVA',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 113,
+ 'idClassificazione': 13,
'name': 'PRIVACY FIRMATARIO DICHHIARAZIONE SOSTITUTIVA',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 114,
+ 'idClassificazione': 14,
'name': 'NULLAOSTA ANTIMAFIA',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 201,
+ 'idClassificazione': 1,
'name': 'LETTERA ESITO DELIBERA',
'idTipoprotocollo': 2
},
{
- 'idClassificazione': 202,
+ 'idClassificazione': 2,
'name': 'LETTERA DI GARANZIA',
'idTipoprotocollo': 1
},
{
- 'idClassificazione': 203,
+ 'idClassificazione': 3,
'name': 'GENERICO',
'idTipoprotocollo': 3
}
diff --git a/src/helpers/logMsgWithSentry.js b/src/helpers/logMsgWithSentry.js
new file mode 100644
index 0000000..5dee179
--- /dev/null
+++ b/src/helpers/logMsgWithSentry.js
@@ -0,0 +1,31 @@
+import * as Sentry from '@sentry/browser';
+
+const LOCAL_DEVELOPMENT = process.env.REACT_APP_LOCAL_DEVELOPMENT;
+
+const logMsgWithSentry = (endpoint = '', status = 0, resp = {}, error = null) => {
+ try {
+ if (LOCAL_DEVELOPMENT !== '1') {
+ Sentry.init({
+ dsn: 'https://e7b2134f7d816f663bb83e51b106a694@o4508381921738752.ingest.de.sentry.io/4508381935501392',
+ environment: process.env.NODE_ENV || 'development'
+ });
+
+ if (!error) {
+ const newError = new Error(`Status ${status}`);
+ Sentry.captureException(`Error in endpoint: ${endpoint}`, {
+ level: 'error',
+ extra: {
+ originalError: newError,
+ details: resp
+ }
+ });
+ } else {
+ Sentry.captureException(error);
+ }
+ }
+ } catch (err) {
+ console.log(err);
+ }
+}
+
+export default logMsgWithSentry;
\ No newline at end of file
diff --git a/src/pages/Applications/index.js b/src/pages/Applications/index.js
index ad3393f..21aaf42 100644
--- a/src/pages/Applications/index.js
+++ b/src/pages/Applications/index.js
@@ -1,6 +1,10 @@
import React from 'react';
import { __ } from '@wordpress/i18n';
import { useNavigate } from 'react-router-dom';
+import { head } from 'ramda';
+
+// store
+import { storeGet, useStore } from '../../store';
// components
import MyLatestSubmissionsTable from '../DashboardBeneficiario/components/MyLatestSubmissionsTable';
@@ -9,6 +13,9 @@ import ErrorBoundary from '../../components/ErrorBoundary';
const Applications = () => {
const navigate = useNavigate();
+ const chosenCompanyId = useStore().main.chosenCompanyId();
+ const companies = useStore().main.companies();
+ const company = head(companies.filter(o => o.id === chosenCompanyId));
const gotToBandiDisponibili = () => {
navigate('/bandi')
@@ -18,6 +25,7 @@ const Applications = () => {
{__('Domande in Lavorazione', 'gepafin')}
+ {company ? {company.companyName} : null}
diff --git a/src/pages/BandiBeneficiario/index.js b/src/pages/BandiBeneficiario/index.js
index 5a191be..ec107f7 100644
--- a/src/pages/BandiBeneficiario/index.js
+++ b/src/pages/BandiBeneficiario/index.js
@@ -1,7 +1,7 @@
import React from 'react';
import { __ } from '@wordpress/i18n';
import { Link } from 'react-router-dom';
-import { isEmpty } from 'ramda';
+import { head, isEmpty } from 'ramda';
// store
import { useStore } from '../../store';
@@ -12,11 +12,14 @@ import ErrorBoundary from '../../components/ErrorBoundary';
const BandiBeneficiario = () => {
const chosenCompanyId = useStore().main.chosenCompanyId();
+ const companies = useStore().main.companies();
+ const company = head(companies.filter(o => o.id === chosenCompanyId));
return (
{__('Bandi disponibili', 'gepafin')}
+ {company ? {company.companyName} : null}
diff --git a/src/pages/BandiPreferredBeneficiario/index.js b/src/pages/BandiPreferredBeneficiario/index.js
index e6e2063..df1f5a3 100644
--- a/src/pages/BandiPreferredBeneficiario/index.js
+++ b/src/pages/BandiPreferredBeneficiario/index.js
@@ -1,7 +1,7 @@
import React from 'react';
import { __ } from '@wordpress/i18n';
import { Link } from 'react-router-dom';
-import { isEmpty } from 'ramda';
+import { head, isEmpty } from 'ramda';
// store
import { useStore } from '../../store';
@@ -11,11 +11,14 @@ import AllBandiAccordion from '../BandiBeneficiario/components/AllBandiAccordion
const BandiPreferredBeneficiario = () => {
const chosenCompanyId = useStore().main.chosenCompanyId();
+ const companies = useStore().main.companies();
+ const company = head(companies.filter(o => o.id === chosenCompanyId));
return (
{__('Bandi osservati', 'gepafin')}
+ {company ? {company.companyName} : null}
diff --git a/src/pages/BandoApplicationPreview/index.js b/src/pages/BandoApplicationPreview/index.js
index 74b79d4..cb19582 100644
--- a/src/pages/BandoApplicationPreview/index.js
+++ b/src/pages/BandoApplicationPreview/index.js
@@ -266,7 +266,6 @@ const BandoApplicationPreview = () => {
{activeStep < totalSteps
?
{
const [stateFieldData, setStateFieldData] = useState([]);
const [rowsData, setRowsData] = useState([]);
@@ -28,18 +29,19 @@ const ElementSettingTableColumns = ({
setStateFieldData([...stateFieldData, { name: uniqid('o'), label: '', predefined: false }]);
}
- const addNewRow = (index) => {
- const newStateFieldData = wrap(stateFieldData)
- .insert([index, 'rows'], { label: '' }, stateFieldData[index].rows.length)
- .value();
- setStateFieldData(newStateFieldData);
+ const addNewRow = () => {
+ const obj = stateFieldData
+ .filter(o => o.predefined)
+ .reduce((acc, cur) => {
+ acc[cur.name] = ''
+ return acc;
+ }, {});
+ setRowsData([...rowsData, obj]);
}
- const removeRow = (index, indexK) => {
- const newStateFieldData = wrap(stateFieldData)
- .del([index, 'rows', indexK])
- .value();
- setStateFieldData(newStateFieldData);
+ const removeRow = (index) => {
+ const newRowsData = wrap(rowsData).del([index]).value();
+ setRowsData(newRowsData);
}
const onInputChange = (e, index) => {
@@ -53,24 +55,31 @@ const ElementSettingTableColumns = ({
setStateFieldData(newData);
}
- const onSubInputChange = (e, index, indexK) => {
+ const onSubInputChange = (e, name, index) => {
const { value } = e.target;
- const newStateFieldData = wrap(stateFieldData)
- .set([index, 'rows', indexK, 'label'], value)
- .value();
- setStateFieldData(newStateFieldData);
+ const newRowsData = wrap(rowsData).set([index, name], value).value();
+ setRowsData(newRowsData);
}
const setChecked = (value, index) => {
+ let name = '';
const newData = stateFieldData.map((o, i) => {
if (i === index) {
o.predefined = value;
- if (value === false) {
- o.rows = [];
- }
+ name = o.name;
}
return o;
- })
+ });
+
+ let newRowsData = [];
+
+ if (value === false) {
+ newRowsData = rowsData.map(o => wrap(o).set([name], '').value());
+ } else {
+ newRowsData = rowsData.map(o => wrap(o).set([name], '').value());
+ }
+
+ setRowsData(newRowsData);
setStateFieldData(newData);
}
@@ -79,23 +88,31 @@ const ElementSettingTableColumns = ({
onInputChange(e, i)}/>
{__('Predefinito?', 'gepafin')}
- setChecked(e.value, i)}/>
+ setChecked(e.value, i)}/>
>
}
- const properSubField = (item, i, k) => {
- return onSubInputChange(e, i, k)}/>
+ const properSubField = (item, i, name) => {
+ return onSubInputChange(e, name, i)}/>
}
useEffect(() => {
- const storeFieldData = value ?? [];
- setStateFieldData(storeFieldData);
+ const stateFieldData = pathOr([], ['stateFieldData'], value);
+ setStateFieldData(stateFieldData);
+ const rowsData = pathOr([], ['rowsData'], value);
+ setRowsData(rowsData);
}, []);
useEffect(() => {
- setDataFn(name, [...stateFieldData]);
- }, [stateFieldData]);
+ setDataFn(name, {
+ stateFieldData,
+ rowsData
+ });
+ }, [stateFieldData, rowsData]);
stateFieldData.filter(o => o.predefined)
@@ -105,10 +122,10 @@ const ElementSettingTableColumns = ({
{stateFieldData.map((o, i) =>
{properField(o, i)}
- removeItem(i)}/>
+ removeItem(i)}/>
)}
-
+
{stateFieldData
.filter(o => o.predefined)
@@ -116,19 +133,22 @@ const ElementSettingTableColumns = ({
{__('Righe per colonna:', 'gepafin')} {o.label}
- {o.rows.map((c, k) => {
- const properIndex = findIndex(propEq(o.name, 'name'))(stateFieldData);
+ {rowsData.map((c, k) => {
return
- {properSubField(c, properIndex, k)}
- removeRow(properIndex, k)}/>
+ {properSubField(c, k, o.name)}
+ removeRow(k)}/>
})}
-
addNewRow(findIndex(propEq(o.name, 'name'))(stateFieldData))}/>
+ onClick={addNewRow}/>
)}
diff --git a/src/pages/DashboardBeneficiario/index.js b/src/pages/DashboardBeneficiario/index.js
index cc12f6e..cec061b 100644
--- a/src/pages/DashboardBeneficiario/index.js
+++ b/src/pages/DashboardBeneficiario/index.js
@@ -21,6 +21,7 @@ const DashboardBeneficiario = () => {
const [mainStats, setMainStats] = useState({});
const companies = useStore().main.companies();
const chosenCompanyId = useStore().main.chosenCompanyId();
+ const company = head(companies.filter(o => o.id === chosenCompanyId));
const goToAllSubmissions = () => {
navigate('/bandi');
@@ -51,6 +52,7 @@ const DashboardBeneficiario = () => {
{__('Dashboard', 'gepafin')}
+ {company ? {company.companyName} : null}
diff --git a/src/pages/DomandaBeneficiario/index.js b/src/pages/DomandaBeneficiario/index.js
index 081b39c..e03c2d0 100644
--- a/src/pages/DomandaBeneficiario/index.js
+++ b/src/pages/DomandaBeneficiario/index.js
@@ -25,6 +25,9 @@ import { Toast } from 'primereact/toast';
import { Dialog } from 'primereact/dialog';
import FormField from '../../components/FormField';
import SoccorsoComunications from '../SoccorsoEditPreInstructor/components/SoccorsoComunications';
+import RepeaterFields from '../DomandaEditPreInstructor/components/RepeaterFields';
+import { wrap } from 'object-path-immutable';
+import { Editor } from 'primereact/editor';
const DomandaBeneficiario = () => {
const isAsyncRequest = useStore().main.isAsyncRequest();
@@ -67,12 +70,16 @@ const DomandaBeneficiario = () => {
if (data.data.length) {
const amendmentObj = data.data[0];
setData(getFormattedData(amendmentObj));
- const formDataInitial = amendmentObj.applicationFormFields.reduce((acc, cur) => {
+ let formDataInitial = amendmentObj.applicationFormFields.reduce((acc, cur) => {
if (cur.fieldValue) {
acc[cur.fieldId] = cur.fieldValue;
}
return acc;
}, {});
+ formDataInitial = {
+ ...formDataInitial,
+ amendmentDocuments: amendmentObj.amendmentDocuments
+ }
setFormInitialData(formDataInitial);
storeSet.main.unsetAsyncRequest();
} else {
@@ -101,7 +108,7 @@ const DomandaBeneficiario = () => {
}
const getFormattedData = (data) => {
- data.submissionDate = is(String, data.submissionDate) ? new Date(data.submissionDate) : (data.submissionDate ? data.submissionDate : '');
+ data.evaluationEndDate = is(String, data.evaluationEndDate) ? new Date(data.evaluationEndDate) : (data.evaluationEndDate ? data.evaluationEndDate : '');
data.startDate = is(String, data.startDate) ? new Date(data.startDate) : (data.startDate ? data.startDate : '');
data.expirationDate = is(String, data.expirationDate) ? new Date(data.expirationDate) : (data.expirationDate ? data.expirationDate : '');
return data;
@@ -114,6 +121,7 @@ const DomandaBeneficiario = () => {
trigger();
let formValues = klona(getValues());
const newFormValues = Object.keys(formValues)
+ .filter(v => v !== 'amendmentDocuments')
.reduce((acc, cur) => {
let fieldVal = formValues[cur];
@@ -126,9 +134,14 @@ const DomandaBeneficiario = () => {
});
return acc;
}, []);
+ const newAmendDocs = formValues.amendmentDocuments
+ ? formValues.amendmentDocuments.map(o => o.id).join(',')
+ : '';
const submitData = {
applicationFormFields: newFormValues,
+ amendmentDocuments: newAmendDocs,
+ amendmentNotes: data.amendmentNotes
}
const amendmentId = data.id;
@@ -145,13 +158,17 @@ const DomandaBeneficiario = () => {
detail: data.message
});
}
- const newFormDataInitial = data.data.applicationFormFields.reduce((acc, cur) => {
+ let formDataInitial = data.data.applicationFormFields.reduce((acc, cur) => {
if (cur.fieldValue) {
acc[cur.fieldId] = cur.fieldValue;
}
return acc;
- }, formInitialData);
- setFormInitialData(newFormDataInitial);
+ }, {});
+ formDataInitial = {
+ ...formDataInitial,
+ amendmentDocuments: data.data.amendmentDocuments
+ }
+ setFormInitialData(formDataInitial);
}
storeSet.main.unsetAsyncRequest();
}
@@ -168,6 +185,31 @@ const DomandaBeneficiario = () => {
storeSet.main.unsetAsyncRequest();
}
+ const updateNewAmendmentData = (value, path) => {
+ const newData = wrap(data).set(path, value).value();
+ setData(newData);
+ }
+
+ const renderHeader = () => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+ };
+
+ const header = renderHeader();
+
useEffect(() => {
if (formInitialData) {
//reset();
@@ -182,7 +224,7 @@ const DomandaBeneficiario = () => {
{data.id
?
{sprintf(__('Soccorso Istruttorio: richiesta integrazione documenti per domanda #%s', 'gepafin'), id)}
- : null}
+ : null}
{dataAppl.id
?
{sprintf(__('Dettagli: domanda #%s', 'gepafin'), dataAppl.id)}
@@ -239,7 +281,7 @@ const DomandaBeneficiario = () => {
{dataAppl.id
?
- {__('ID domanda', 'gepafin')}
+ {__('ID domanda', 'gepafin')}
{dataAppl.id}
@@ -274,6 +316,12 @@ const DomandaBeneficiario = () => {
: null}
+ {data.id
+ ?
+
{__('Comunicazioni', 'gepafin')}
+
+ : null}
+
{data.id
?
{__('Documenti Richiesti', 'gepafin')}
@@ -294,42 +342,80 @@ const DomandaBeneficiario = () => {
defaultValue={formInitialData[o.fieldId] ? formInitialData[o.fieldId] : []}
accept={[]}
source="AMENDMENT"
- sourceId={data.applicationId}
+ sourceId={data.id}
multiple={true}
/>
}) : null}
- {/*
- {data.formFields
- ? data.formFields.map((o, i) =>
- {o.label}
- ) : null}
- */}
+
+ {data.formFields
+ ? data.formFields.map((o, i) =>
+ {o.label}
+ ) : null}
+
: null}
{data.id
?
-
{__('Comunicazioni', 'gepafin')}
-
- : null}
+
{__('Documenti aggiuntivi', 'gepafin')}
+
+
{__('Notes', 'gepafin')}
+
+ updateNewAmendmentData(
+ e.htmlValue,
+ 'amendmentNotes'
+ )}
+ style={{ height: 80 * 3, width: '100%' }}
+ />
+
+
+
+
: null}
{data.id
?
-
- {__('Attenzione', 'gepafin')}
- {__('Inviare la documentazione richiesta completa delle integrazioni esclusivamente via PEC. In caso contarrio l’integrazione non può essere ritenuta valida.', 'gepafin')}
-
: null}
+
+ {__('Attenzione', 'gepafin')}
+ {__('Inviare la documentazione richiesta completa delle integrazioni esclusivamente via PEC. In caso contarrio l’integrazione non può essere ritenuta valida.', 'gepafin')}
+ : null}
{data.id
?
setIsVisibleEmailDialog(true)}
- label={__('Invia documenti via PEC', 'gepafin')}
- icon="pi pi-envelope" iconPos="right"/> : null}
+ type="button"
+ disabled={isAsyncRequest}
+ onClick={() => setIsVisibleEmailDialog(true)}
+ label={__('Invia documenti via PEC', 'gepafin')}
+ icon="pi pi-envelope" iconPos="right"/> : null}
+ {data.id
+ ? : null}
{
header={__('Invia documenti via PEC', 'gepafin')}
visible={isVisibleEmailDialog}
style={{ width: '50vw' }}
- onHide={() => {if (!isVisibleEmailDialog) return; setIsVisibleEmailDialog(false); }}>
+ onHide={() => {
+ if (!isVisibleEmailDialog) return;
+ setIsVisibleEmailDialog(false);
+ }}>
{data.callEmail}
diff --git a/src/pages/DomandaEditPreInstructor/components/ArchiveDocument/index.js b/src/pages/DomandaEditPreInstructor/components/ArchiveDocument/index.js
index b50c321..5a1bb66 100644
--- a/src/pages/DomandaEditPreInstructor/components/ArchiveDocument/index.js
+++ b/src/pages/DomandaEditPreInstructor/components/ArchiveDocument/index.js
@@ -1,8 +1,14 @@
import React, { useEffect, useRef, useState } from 'react';
import { __ } from '@wordpress/i18n';
-import { isEmpty } from 'ramda';
+import { isEmpty, pathOr, isNil } from 'ramda';
import { wrap } from 'object-path-immutable';
+// store
+import AppointmentService from '../../../../service/appointment-service';
+
+// tools
+import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse';
+
// components
import { Button } from 'primereact/button';
import { Dialog } from 'primereact/dialog';
@@ -11,14 +17,11 @@ import { Dropdown } from 'primereact/dropdown';
import { classNames } from 'primereact/utils';
import { InputSwitch } from 'primereact/inputswitch';
import { InputText } from 'primereact/inputtext';
-
-import { classificationType, protocolType } from '../../../../configData';
-import AppointmentService from '../../../../service/appointment-service';
-import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse';
-import { storeSet } from '../../../../store';
import { Toast } from 'primereact/toast';
-const ArchiveDocument = ({ applicationId, ndg = '', fileId = 0 }) => {
+import { classificationType, protocolType } from '../../../../configData';
+
+const ArchiveDocument = ({ applicationId, ndg = '', fileId = 0, docAttachmentId = null, updateFn = () => {} }) => {
const [loading, setLoading] = useState(false);
const [isVisibleDialog, setIsVisibleDialog] = useState(false);
const [modalData, setModalData] = useState({});
@@ -87,19 +90,29 @@ const ArchiveDocument = ({ applicationId, ndg = '', fileId = 0 }) => {
const submitCallback = (data) => {
if (data.status === 'SUCCESS') {
- console.log(data.data);
+ if (toast.current && data.message) {
+ toast.current.show({
+ severity: 'success',
+ summary: '',
+ detail: data.message
+ });
+ }
+ const documentAttachmentId = pathOr('fake_id', ['documentAttachmentId'], data.data);
+ updateFn(documentAttachmentId);
}
+ setIsVisibleDialog(false);
setLoading(false);
}
const errSubmitCallback = (data) => {
if (toast.current && data.message) {
toast.current.show({
- severity: 'error',
+ severity: data.status === 'SUCCESS' ? 'info' : 'error',
summary: '',
detail: data.message
});
}
+ setIsVisibleDialog(false);
set404FromErrorResponse(data);
setLoading(false);
}
@@ -119,7 +132,7 @@ const ArchiveDocument = ({ applicationId, ndg = '', fileId = 0 }) => {
setTypes(protocolType.map(o => ({ value: o.id, label: o.name })));
}, []);
- return (!isEmpty(ndg)
+ return (!isEmpty(ndg) && !isNil(ndg) && !docAttachmentId
? <>
{
return (
- {files.map((o, i) =>
+ {files.map((o, i) =>
-
{o.label}
+
{renderHtmlContent(o.label)}
{o.fileDetail && o.fileDetail.length === 1
- ?
+ {
window.open(o.fileDetail[0].filePath, '_blank').focus()
}}
outlined severity="info"
- aria-label={__('Mostra', 'gepafin')}/> : null}
+ aria-label={__('Mostra', 'gepafin')}/>
+ updateFn(
+ val,
+ [name, i, 'fileDetail', 0, 'documentAttachmentId']
+ )}
+ docAttachmentId={o.fileDetail[0].documentAttachmentId}/>
+ > : null}
- {o.fileDetail.map((k) =>
{k.name}
-
+ updateFn(
+ val,
+ [name, i, 'fileDetail', ind, 'documentAttachmentId']
+ )}
+ docAttachmentId={k.documentAttachmentId}/>
{
window.open(k.filePath, '_blank').focus()
diff --git a/src/pages/DomandaEditPreInstructor/components/RepeaterFields/index.js b/src/pages/DomandaEditPreInstructor/components/RepeaterFields/index.js
new file mode 100644
index 0000000..7a24f29
--- /dev/null
+++ b/src/pages/DomandaEditPreInstructor/components/RepeaterFields/index.js
@@ -0,0 +1,146 @@
+import React, { useMemo, useState, useCallback } from 'react';
+import { useForm, useFieldArray } from 'react-hook-form';
+import { isEmpty, head } from 'ramda';
+import { __ } from '@wordpress/i18n';
+import { klona } from 'klona';
+
+// tools
+import uniqid from '../../../../helpers/uniqid';
+
+// components
+import FormField from '../../../../components/FormField';
+import { Button } from 'primereact/button';
+
+const RepeaterFields = ({
+ sourceId,
+ sourceName,
+ updateFn = () => {
+ },
+ updateCallbackFn = () => {
+ },
+ defaultValue = [],
+ }) => {
+ const [chosen, setChosen] = useState('');
+ const {
+ control,
+ handleSubmit,
+ formState: { errors },
+ setValue,
+ register,
+ trigger,
+ getValues,
+ watch
+ } = useForm({
+ defaultValues: useMemo(() => {
+ return {
+ items: defaultValue || []
+ };
+ }, [defaultValue]), mode: 'onChange'
+ });
+ const { fields, append, remove } = useFieldArray({
+ control,
+ name: 'items'
+ });
+
+ const watchFields = watch('items');
+
+ const onSubmit = () => {
+ }
+
+ const doUpdateAfterFileUploaded = () => {
+ const formData = getValues();
+ updateFn(formData.items);
+ updateCallbackFn(formData.items);
+ }
+
+ const addNew = () => {
+ const uid = uniqid('f');
+ const newItem = {
+ fieldId: uid,
+ nameValue: '',
+ fileValue: []
+ }
+ append(newItem);
+ setChosen(newItem.fieldId);
+ trigger();
+ };
+
+ const setNewChosen = useCallback((id) => {
+ const chosenObj = head(fields.filter(o => id === o.fieldId));
+ if (chosenObj) {
+ setChosen(chosen === id ? '' : id);
+ }
+ }, [fields, chosen]);
+
+ const removeItem = useCallback((index) => {
+ const chosenObj = klona(fields[index]);
+ remove(index);
+ if (chosen === chosenObj.fieldId) {
+ setChosen('');
+ }
+ const formData = getValues();
+ updateFn(formData.items);
+ updateCallbackFn(formData.items);
+ }, [fields, chosen]);
+
+ return (
+
+
+
isEmpty(o.nameValue) || isEmpty(o.fileValue)).length > 0}
+ onClick={addNew}
+ label={__('Aggiungi nuovo file', 'gepafin')}
+ />
+
+ )
+}
+
+export default RepeaterFields;
\ No newline at end of file
diff --git a/src/pages/DomandaEditPreInstructor/index.js b/src/pages/DomandaEditPreInstructor/index.js
index f9b5d75..4a605d8 100644
--- a/src/pages/DomandaEditPreInstructor/index.js
+++ b/src/pages/DomandaEditPreInstructor/index.js
@@ -1,4 +1,4 @@
-import React, { useState, useEffect, useRef } from 'react';
+import React, { useState, useEffect, useRef, useCallback } from 'react';
import { __, sprintf } from '@wordpress/i18n';
import { useNavigate, useParams } from 'react-router-dom';
import { is, isEmpty, isNil, sum, pathOr, head } from 'ramda';
@@ -11,6 +11,7 @@ import { storeSet, useStore } from '../../store';
// api
import ApplicationEvaluationService from '../../service/application-evaluation-service';
import AmendmentsService from '../../service/amendments-service';
+import AppointmentService from '../../service/appointment-service';
// tools
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
@@ -24,19 +25,18 @@ import { Tag } from 'primereact/tag';
import { Checkbox } from 'primereact/checkbox';
import { Editor } from 'primereact/editor';
import { InputNumber } from 'primereact/inputnumber';
-import BlockingOverlay from '../../components/BlockingOverlay';
import { Toast } from 'primereact/toast';
-import HelpIcon from '../../icons/HelpIcon';
import { Dialog } from 'primereact/dialog';
-import ArchiveDocument from './components/ArchiveDocument';
+import HelpIcon from '../../icons/HelpIcon';
+import BlockingOverlay from '../../components/BlockingOverlay';
import { classNames } from 'primereact/utils';
import { InputTextarea } from 'primereact/inputtextarea';
import { InputText } from 'primereact/inputtext';
import DownloadApplicationArchive from './components/DownloadApplicationArchive';
import DownloadCompanyDelegation from './components/DownloadCompanyDelegation';
import DownloadSignedApplication from './components/DownloadSignedApplication';
-import AppointmentService from '../../service/appointment-service';
import ListOfFiles from './components/ListOfFiles';
+import RepeaterFields from './components/RepeaterFields';
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
@@ -71,12 +71,24 @@ const DomandaEditPreInstructor = () => {
}
const updateFlagsForSoccorso = (data) => {
+ let nonRatedFilesLength = 0;
+
if (data.files) {
const nonRatedFiles = data.files
.map(el => el.valid)
.filter(v => isNil(v));
- setAllFilesRated(nonRatedFiles.length === 0);
+ nonRatedFilesLength = nonRatedFiles.length;
}
+
+ if (data.amendmentDetails) {
+ const nonRatedFiles = data.amendmentDetails
+ .map(el => el.valid)
+ .filter(v => isNil(v));
+ nonRatedFilesLength = nonRatedFiles.length;
+ }
+
+ setAllFilesRated(nonRatedFilesLength === 0);
+
if (data.checklist) {
const checkedChecklistItems = data.checklist
.map(el => el.valid)
@@ -88,7 +100,7 @@ const DomandaEditPreInstructor = () => {
const doNewSoccorso = () => {
if (connectedSoccorsoId !== 0) {
- doSaveDraft(`/domande/${id}/soccorso/${connectedSoccorsoId}`)
+ navigate(`/domande/${id}/soccorso/${connectedSoccorsoId}`);
} else {
doSaveDraft(`/domande/${id}/aggiungi-soccorso/`)
}
@@ -153,11 +165,17 @@ const DomandaEditPreInstructor = () => {
updateFlagsForSoccorso(newData);
}
- const doSaveDraft = (doRedirect = '') => {
+ const doSaveDraft = useCallback((doRedirect = '') => {
const formData = {
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
}
@@ -167,7 +185,7 @@ const DomandaEditPreInstructor = () => {
(data) => updateCallback(data, doRedirect),
errUpdateCallback
);
- }
+ }, [data]);
const updateCallback = (data, doRedirect = '') => {
if (data.status === 'SUCCESS') {
@@ -266,9 +284,11 @@ const DomandaEditPreInstructor = () => {
switch (item.fieldName) {
case 'fileupload' :
content =
- {item.fieldValue.map(o =>
- {o.filePath ? {o.name} : null}
- )}
+ {item.fieldValue
+ ? item.fieldValue.map(o =>
+ {o.filePath ? {o.name} : null}
+ )
+ : null}
;
break;
case 'table' :
@@ -280,9 +300,11 @@ const DomandaEditPreInstructor = () => {
- {item.fieldValue.map((o, i) =>
- {Object.values(o).map(v => {v} )}
- )}
+ {item.fieldValue
+ ? item.fieldValue.map((o, i) =>
+ {Object.values(o).map(v => {v} )}
+ )
+ : null}
;
break;
@@ -370,7 +392,13 @@ const DomandaEditPreInstructor = () => {
const getNdgCallback = (data) => {
if (data.status === 'SUCCESS') {
- console.log('data', data.data);
+ if (toast.current && data.message) {
+ toast.current.show({
+ severity: 'success',
+ summary: '',
+ detail: data.message
+ });
+ }
}
storeSet.main.unsetAsyncRequest();
}
@@ -378,7 +406,7 @@ const DomandaEditPreInstructor = () => {
const errGetNdgCallback = (data) => {
if (toast.current && data.message) {
toast.current.show({
- severity: 'error',
+ severity: data.status === 'SUCCESS' ? 'info' : 'error',
summary: '',
detail: data.message
});
@@ -424,12 +452,49 @@ const DomandaEditPreInstructor = () => {
const doCreateAppointmentRequest = () => {
if (
!isEmpty(appointmentData.title) && !isEmpty(appointmentData.text) && !isEmpty(appointmentData.amount)
- && !isEmpty(appointmentData.duration) && appointmentData.duration !== 0 && appointmentData.amount !== 0
+ && !isEmpty(appointmentData.duration) && appointmentData.duration !== 0 && appointmentData.amount !== 0
) {
- console.log(appointmentData);
+ storeSet.main.setAsyncRequest();
+ const submitData = {
+ 'importoBreveTermine': appointmentData.amount,
+ 'durataMesiFinanziamento': appointmentData.duration,
+ 'nota': {
+ 'titolo': appointmentData.title,
+ 'testo': appointmentData.text
+ }
+ }
+
+ AppointmentService.createAppointment(id, submitData, getAppointemntCallback, errGetAppointemntCallback);
}
}
+ const getAppointemntCallback = (data) => {
+ if (data.status === 'SUCCESS') {
+ if (toast.current && data.message) {
+ toast.current.show({
+ severity: 'success',
+ summary: '',
+ detail: data.message
+ });
+ }
+ }
+ setIsVisibleAppointmentDialog(false);
+ storeSet.main.unsetAsyncRequest();
+ }
+
+ const errGetAppointemntCallback = (data) => {
+ if (toast.current && data.message) {
+ toast.current.show({
+ severity: data.status === 'SUCCESS' ? 'info' : 'error',
+ summary: '',
+ detail: data.message
+ });
+ }
+ setIsVisibleAppointmentDialog(false);
+ set404FromErrorResponse(data);
+ storeSet.main.unsetAsyncRequest();
+ }
+
const doMakeAdmisible = () => {
// TODO
}
@@ -528,17 +593,28 @@ const DomandaEditPreInstructor = () => {
{__('Scarica documenti della domanda', 'gepafin')}
-
+
+
+
{__('Documenti aggiuntivi', 'gepafin')}
+ updateEvaluationValue(
+ data,
+ ['evaluationDocument']
+ )}
+ sourceId={data.assignedApplicationId}
+ sourceName="evaluation"/>
+
+
{__('Checklist Valutazione', 'gepafin')}
-
{__('Lista', 'gepafin')}
@@ -584,6 +660,18 @@ const DomandaEditPreInstructor = () => {
+ {!isEmpty(data.amendmentDetails)
+ ?
+
{__('Documenti di soccorso', 'gepafin')}
+
+ : null}
+
{__('Punteggi di valutazione', 'gepafin')}
{data.criteria
@@ -699,14 +787,14 @@ const DomandaEditPreInstructor = () => {
onClick={() => doSaveDraft()}
label={__('Crea valutazione', 'gepafin')}
icon="pi pi-save" iconPos="right"/>}
- {APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus)
+ {/*{APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus)
? : null}
- {APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus) && data.ndg
+ /> : null}*/}
+ {APP_EVALUATION_FLOW_ID === '1' && ['NDG'].includes(data.applicationStatus) && data.ndg
? {
onClick={initiateApproving}
label={__('Approva Domanda', 'gepafin')}
icon="pi pi-check" iconPos="right"/> : null}
- {data.id
+ {/*{data.id
? : null}*/}
+ {data.id
+ ? : null}
diff --git a/src/pages/Domande/components/AllDomandeTable/index.js b/src/pages/Domande/components/AllDomandeTable/index.js
index f4696c1..7c751bf 100644
--- a/src/pages/Domande/components/AllDomandeTable/index.js
+++ b/src/pages/Domande/components/AllDomandeTable/index.js
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import { __ } from '@wordpress/i18n';
import { is, uniq } from 'ramda';
-import { Link } from 'react-router-dom';
+import { Link, useLocation } from 'react-router-dom';
// api
import ApplicationService from '../../../../service/application-service';
@@ -21,6 +21,7 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
const [filters, setFilters] = useState(null);
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
const [, setStatuses] = useState([]);
+ const location = useLocation();
useEffect(() => {
setLocalAsyncRequest(true);
@@ -113,14 +114,15 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
const actionsBodyTemplate = (rowData) => {
return
- {openDialogFn
+ {openDialogFn && rowData.status === 'SUBMIT'
?
openDialogFn(rowData.id)}
label={__('Assegnare', 'gepafin')}
icon="pi pi-pencil" size="small" iconPos="right"/>
- :
-
- }
+ : location.pathname !== '/domande'
+ ?
+
+ : null}
diff --git a/src/pages/Domande/index.js b/src/pages/Domande/index.js
index 6cd2bcc..c3ec3ab 100644
--- a/src/pages/Domande/index.js
+++ b/src/pages/Domande/index.js
@@ -65,7 +65,7 @@ const Domande = () => {
}
const headerEditDialog = () => {
- return {__('Assign application', 'gepafin')}
+ return {__('Assegni la domanda', 'gepafin')}
}
const hideEditDialog = () => {
diff --git a/src/pages/DomandeBeneficiario/components/BeneficiarioDomandeTable/index.js b/src/pages/DomandeBeneficiario/components/BeneficiarioDomandeTable/index.js
index 4b405db..48293ea 100644
--- a/src/pages/DomandeBeneficiario/components/BeneficiarioDomandeTable/index.js
+++ b/src/pages/DomandeBeneficiario/components/BeneficiarioDomandeTable/index.js
@@ -4,7 +4,7 @@ import { is, isEmpty, uniq } from 'ramda';
import { Link } from 'react-router-dom';
// store
-import { useStore } from '../../../../store';
+import { useStore, storeGet } from '../../../../store';
// api
import ApplicationService from '../../../../service/application-service';
@@ -33,7 +33,7 @@ const BeneficiarioDomandeTable = () => {
const [statuses, setStatuses] = useState([]);
useEffect(() => {
- if (!isEmpty(chosenCompanyId) && chosenCompanyId !== 0) {
+ if (!isEmpty(chosenCompanyId) && chosenCompanyId !== 0 && !localAsyncRequest) {
setLocalAsyncRequest(true);
ApplicationService.getApplications(getApplCallback, errGetApplCallback, [
['companyId', chosenCompanyId],
diff --git a/src/pages/DomandeBeneficiario/index.js b/src/pages/DomandeBeneficiario/index.js
index 06b202f..f820b21 100644
--- a/src/pages/DomandeBeneficiario/index.js
+++ b/src/pages/DomandeBeneficiario/index.js
@@ -1,14 +1,23 @@
import React from 'react';
import { __ } from '@wordpress/i18n';
+import { head } from 'ramda';
+
+// store
+import { useStore } from '../../store';
// components
import BeneficiarioDomandeTable from './components/BeneficiarioDomandeTable';
const DomandePreInstructor = () => {
+ const chosenCompanyId = useStore().main.chosenCompanyId();
+ const companies = useStore().main.companies();
+ const company = head(companies.filter(o => o.id === chosenCompanyId));
+
return(
{__('Archivio domande', 'gepafin')}
+ {company ? {company.companyName} : null}
diff --git a/src/pages/SoccorsoAddPreInstructor/index.js b/src/pages/SoccorsoAddPreInstructor/index.js
index a74bcbe..bfb4745 100644
--- a/src/pages/SoccorsoAddPreInstructor/index.js
+++ b/src/pages/SoccorsoAddPreInstructor/index.js
@@ -193,7 +193,7 @@ const SoccorsoAddPreInstructor = () => {
-
{__('Note', 'gepafin')}
+
{__('Pec/Email', 'gepafin')}
{
{
@@ -35,6 +36,7 @@ const SoccorsoEditPreInstructor = () => {
const { id, amendmentId } = useParams();
const navigate = useNavigate();
const [data, setData] = useState({});
+ const [isVisibleCloseAmendDialog, setIsVisibleCloseAmendDialog] = useState(false);
const [isVisibleExtendTimeDialog, setIsVisibleExtendTimeDialog] = useState(false);
const [extendedTime, setExtendedTime] = useState(3);
const [isLoadingExtendingTime, setIsLoadingExtendingTime] = useState(false);
@@ -62,12 +64,16 @@ const SoccorsoEditPreInstructor = () => {
const getCallback = (data) => {
if (data.status === 'SUCCESS') {
setData(getFormattedData(data.data));
- const formDataInitial = data.data.applicationFormFields.reduce((acc, cur) => {
+ let formDataInitial = data.data.applicationFormFields.reduce((acc, cur) => {
if (cur.fieldValue) {
acc[cur.fieldId] = cur.fieldValue;
}
return acc;
}, {});
+ formDataInitial = {
+ ...formDataInitial,
+ amendmentDocuments: data.data.amendmentDocuments
+ }
setFormInitialData(formDataInitial);
}
storeSet.main.unsetAsyncRequest();
@@ -112,7 +118,7 @@ const SoccorsoEditPreInstructor = () => {
const header = renderHeader();
const updateNewAmendmentData = (value, path) => {
- const newData = wrap(data).set(path.split('.'), value).value();
+ const newData = wrap(data).set(path, value).value();
setData(newData);
}
@@ -123,6 +129,7 @@ const SoccorsoEditPreInstructor = () => {
trigger();
let formValues = klona(getValues());
const newFormValues = Object.keys(formValues)
+ .filter(v => v !== 'amendmentDocuments')
.reduce((acc, cur) => {
let fieldVal = formValues[cur];
@@ -135,10 +142,15 @@ const SoccorsoEditPreInstructor = () => {
});
return acc;
}, []);
+ const newAmendDocs = formValues.amendmentDocuments
+ ? formValues.amendmentDocuments.map(o => o.id).join(',')
+ : '';
const submitData = {
- applicationFormFields: newFormValues
+ applicationFormFields: newFormValues,
+ amendmentDocuments: newAmendDocs
}
+
storeSet.main.setAsyncRequest();
AmendmentsService.updateSoccorso(amendmentId, submitData, updateAmendmentCallback, errUpdateAmendmentCallback);
}
@@ -152,13 +164,17 @@ const SoccorsoEditPreInstructor = () => {
detail: data.message
});
}
- const newFormDataInitial = data.data.applicationFormFields.reduce((acc, cur) => {
+ let formDataInitial = data.data.applicationFormFields.reduce((acc, cur) => {
if (cur.fieldValue) {
acc[cur.fieldId] = cur.fieldValue;
}
return acc;
}, formInitialData);
- setFormInitialData(newFormDataInitial);
+ formDataInitial = {
+ ...formDataInitial,
+ amendmentDocuments: data.data.amendmentDocuments
+ }
+ setFormInitialData(formDataInitial);
}
storeSet.main.unsetAsyncRequest();
}
@@ -175,6 +191,28 @@ const SoccorsoEditPreInstructor = () => {
storeSet.main.unsetAsyncRequest();
}
+ const openCloseAmendmentDialog = () => {
+ setIsVisibleCloseAmendDialog(true);
+ }
+
+ const headerCloseAmendDialog = () => {
+ return {__('Chiudi Soccorso Istruttorio', 'gepafin')}
+ }
+
+ const hideCloseAmendDialog = () => {
+ setIsVisibleCloseAmendDialog(false);
+ }
+
+ const footerCloseAmendDialog = () => {
+ return
+
+
+
+ }
+
const doCloseAmendment = () => {
const submitData = {
internalNote: data.internalNote
@@ -193,7 +231,8 @@ const SoccorsoEditPreInstructor = () => {
});
}
if (data.data.status) {
- updateNewAmendmentData(data.data.status, 'status')
+ updateNewAmendmentData(data.data.status, ['status']);
+ setIsVisibleCloseAmendDialog(false);
}
}
storeSet.main.unsetAsyncRequest();
@@ -297,7 +336,6 @@ const SoccorsoEditPreInstructor = () => {
useEffect(() => {
if (formInitialData) {
- //reset();
Object.keys(formInitialData).map(k => setValue(k, formInitialData[k]));
trigger();
}
@@ -388,12 +426,12 @@ const SoccorsoEditPreInstructor = () => {
-
-
{__('Documenti Ricevuti', 'gepafin')}
+ {data.formFields && !isEmpty(data.formFields)
+ ?
+
{__('Documenti Ricevuti', 'gepafin')}
-
-
+ })}
+
+
: null}
-
-
{__('Motivazioni / Note Interne', 'gepafin')}
-
-
-
updateNewAmendmentData(
- e.htmlValue,
- 'internalNote'
- )}
- style={{ height: 80 * 3, width: '100%' }}
+
+
{__('Documenti aggiuntivi', 'gepafin')}
+
+ {data.amendmentNotes
+ ? <>
+
{__('Notes', 'gepafin')}
+
+ {renderHtmlContent(data.amendmentNotes)}
+
+ > : null}
+
@@ -441,6 +490,12 @@ const SoccorsoEditPreInstructor = () => {
+ {/* */}
{
icon="pi pi-save" iconPos="right"/>*/}
@@ -494,6 +549,32 @@ const SoccorsoEditPreInstructor = () => {
onChange={(e) => setExtendedTime(e.value)}/>
+
+
+
+
{__('Motivazioni', 'gepafin')}
+
+
+ updateNewAmendmentData(
+ e.htmlValue,
+ ['internalNote']
+ )}
+ style={{ height: 80 * 3, width: '100%' }}
+ />
+
+
+
)
diff --git a/src/service/appointment-service.js b/src/service/appointment-service.js
index 0bf12bd..1d2741d 100644
--- a/src/service/appointment-service.js
+++ b/src/service/appointment-service.js
@@ -4,11 +4,15 @@ const API_BASE_URL = process.env.REACT_APP_API_EXECUTION_ADDRESS;
export default class AppointmentService {
- static getNdg = (id, callback, errCallback, queryParams) => {
- NetworkService.get(`${API_BASE_URL}/appointment/application/${id}/check-ndg`, callback, errCallback, queryParams);
+ static getNdg = (applicationId, callback, errCallback, queryParams) => {
+ NetworkService.get(`${API_BASE_URL}/appointment/application/${applicationId}/check-ndg`, callback, errCallback, queryParams);
};
static archiveDocument = (applicationId, documentId, body, callback, errCallback, queryParams) => {
- NetworkService.post(`${API_BASE_URL}/appointment/application/${applicationId}/document/${documentId}`, {}, callback, errCallback, queryParams);
+ NetworkService.post(`${API_BASE_URL}/appointment/document/${documentId}`, body, callback, errCallback, queryParams);
+ };
+
+ static createAppointment = (applicationId, body, callback, errCallback, queryParams) => {
+ NetworkService.post(`${API_BASE_URL}/appointment/application/${applicationId}`, body, callback, errCallback, queryParams);
};
}
diff --git a/src/service/network-service.js b/src/service/network-service.js
index 82bde68..5e7d5cc 100644
--- a/src/service/network-service.js
+++ b/src/service/network-service.js
@@ -1,33 +1,11 @@
import { storeGet, storeSet } from '../store';
-import * as Sentry from '@sentry/browser';
-
-const LOCAL_DEVELOPMENT = process.env.REACT_APP_LOCAL_DEVELOPMENT;
+import logMsgWithSentry from '../helpers/logMsgWithSentry';
export class NetworkService {
- static TOKEN_KEY
- static REFRESH_TOKEN_KEY
static logApiError = (endpoint, status = 0, resp = {}) => {
if (status === 500) {
- if (LOCAL_DEVELOPMENT !== '1') {
- try {
- Sentry.init({
- dsn: 'https://e7b2134f7d816f663bb83e51b106a694@o4508381921738752.ingest.de.sentry.io/4508381935501392',
- environment: process.env.NODE_ENV || 'development'
- });
-
- const error = new Error(`Status ${status}`);
- Sentry.captureException(`Error in endpoint: ${endpoint}`, {
- level: 'error',
- extra: {
- originalError: error,
- details: resp
- }
- });
- } catch (err) {
- console.log(err);
- }
- }
+ logMsgWithSentry(endpoint, status, resp);
} else if (status === 403) {
storeSet.main.token('');
const { pathname } = window.location;
@@ -52,8 +30,9 @@ export class NetworkService {
}
}
- if (url.charAt(url.length) === '&')
+ if (url.charAt(url.length) === '&') {
url = url.substring(0, url.length - 1);
+ }
}
fetch(url, {