diff --git a/src/pages/DomandaBeneficiario/index.js b/src/pages/DomandaBeneficiario/index.js index 2aee3a5..081b39c 100644 --- a/src/pages/DomandaBeneficiario/index.js +++ b/src/pages/DomandaBeneficiario/index.js @@ -207,35 +207,39 @@ const DomandaBeneficiario = () => {
- {__('ID domanda', 'gepafin')} - {data.applicationId} -
-- {__('Bando', 'gepafin')} - {data.callName} -
-- {__('Beneficiario', 'gepafin')} - {data.beneficiaryName} -
-- {__('Inizio', 'gepafin')} - {getDateFromISOstring(data.startDate)} -
-- {__('Scadenza', 'gepafin')} - {getDateFromISOstring(data.expirationDate)} -
-- {__('Stato', 'gepafin')} - {getBandoLabel(data.status)} -
-+ {__('ID domanda', 'gepafin')} + {data.applicationId} +
++ {__('Bando', 'gepafin')} + {data.callName} +
++ {__('Beneficiario', 'gepafin')} + {data.beneficiaryName} +
++ {__('Azienda', 'gepafin')} + +
++ {__('Inizio', 'gepafin')} + {getDateFromISOstring(data.startDate)} +
++ {__('Scadenza', 'gepafin')} + {getDateFromISOstring(data.expirationDate)} +
++ {__('Stato', 'gepafin')} + {getBandoLabel(data.status)} +
+- {__('ID domanda', 'gepafin')} + {__('ID domanda', 'gepafin')} {dataAppl.id}
diff --git a/src/pages/DomandaEditPreInstructor/components/DownloadApplicationArchive/index.js b/src/pages/DomandaEditPreInstructor/components/DownloadApplicationArchive/index.js new file mode 100644 index 0000000..dd19bed --- /dev/null +++ b/src/pages/DomandaEditPreInstructor/components/DownloadApplicationArchive/index.js @@ -0,0 +1,49 @@ +import React, { useState } from 'react'; +import { __ } from '@wordpress/i18n'; + +// tools +import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse'; + +// api +import ApplicationService from '../../../../service/application-service'; + +// components +import { Button } from 'primereact/button'; + +const DownloadApplicationArchive = ({ applicationId = 0 }) => { + const [loading, setLoading] = useState(false); + + const onClickDownload = () => { + setLoading(true); + ApplicationService.downloadCompleteZip(applicationId, getCompleteZipCallback, errCompleteZipCallback); + } + + const getCompleteZipCallback = (data) => { + const file = new Blob([data], { type: 'application/zip' }); + const url = window.URL.createObjectURL(file); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', `application-${applicationId}.zip`); + document.body.appendChild(link); + link.click(); + link.remove(); + setLoading(false); + } + + const errCompleteZipCallback = (data) => { + set404FromErrorResponse(data); + setLoading(false); + } + + return (applicationId && applicationId !== 0 + ? : null + ) +} + +export default DownloadApplicationArchive; \ No newline at end of file diff --git a/src/pages/DomandaEditPreInstructor/index.js b/src/pages/DomandaEditPreInstructor/index.js index 95c0c9b..1fe5727 100644 --- a/src/pages/DomandaEditPreInstructor/index.js +++ b/src/pages/DomandaEditPreInstructor/index.js @@ -32,6 +32,7 @@ import ArchiveDocument from './components/ArchiveDocument'; import { classNames } from 'primereact/utils'; import { InputTextarea } from 'primereact/inputtextarea'; import { InputText } from 'primereact/inputtext'; +import DownloadApplicationArchive from './components/DownloadApplicationArchive'; const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID; @@ -442,6 +443,10 @@ const DomandaEditPreInstructor = () => { {__('Beneficiario', 'gepafin')} {data.beneficiary}
++ {__('Azienda', 'gepafin')} + +
{__('Data ricezione', 'gepafin')} {getDateFromISOstring(data.submissionDate)} @@ -456,85 +461,9 @@ const DomandaEditPreInstructor = () => {
| {__('Parametro', 'gepafin')} | -{__('Punteggio', 'gepafin')} | -{__('Stato', 'gepafin')} | -
|---|---|---|
| {o.label} | -
-
-
- |
-
-
- {!isEmpty(o.criteriaMappedFields)
- ?
- |
-
| {__('Punteggio:', 'gepafin')} | -{sum(data.criteria.map(o => o.score))} | -
- {isAdmissible
- ? |
-
| {sprintf(__('Punteggio minimo per l\'ammissione: %d'), data.minScore)} | -||
| {__('Parametro', 'gepafin')} | +{__('Punteggio', 'gepafin')} | +{__('Stato', 'gepafin')} | +
|---|---|---|
| {o.label} | +
+
+
+ |
+
+
+ {!isEmpty(o.criteriaMappedFields)
+ ?
+ |
+
| {__('Punteggio:', 'gepafin')} | +{sum(data.criteria.map(o => o.score))} | +
+ {isAdmissible
+ ? |
+
| {sprintf(__('Punteggio minimo per l\'ammissione: %d'), data.minScore)} | +||