- updated tables - displaying protocol id, columns for ndg and appointment;
- added 2 buttons for download delega and download signed pdf for application;
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { isEmpty } from 'ramda';
|
||||
|
||||
// api
|
||||
import CompanyService from '../../../../service/company-service';
|
||||
|
||||
// components
|
||||
import { Button } from 'primereact/button';
|
||||
|
||||
const DownloadCompanyDelegation = ({ applicationId = 0 }) => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [delega, setDelega] = useState({});
|
||||
|
||||
const onClickDownload = () => {
|
||||
if (delega.filePath) {
|
||||
window.open(encodeURI(delega.filePath), '_blank').focus()
|
||||
}
|
||||
}
|
||||
|
||||
const getDellegaCallback = (data) => {
|
||||
if (data.data) {
|
||||
setDelega([data.data]);
|
||||
}
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
const errDellegaCallback = () => {
|
||||
setDelega([]);
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
setLoading(true);
|
||||
CompanyService.getCompanyDelega(0, getDellegaCallback, errDellegaCallback, [
|
||||
['applicationId', applicationId]
|
||||
]);
|
||||
}, [])
|
||||
|
||||
return (applicationId && applicationId !== 0
|
||||
? <Button
|
||||
type="button"
|
||||
disabled={loading || isEmpty(delega)}
|
||||
onClick={onClickDownload}
|
||||
label={__('Scarica la delega', 'gepafin')}
|
||||
icon="pi pi-download"
|
||||
iconPos="right"/> : null
|
||||
)
|
||||
}
|
||||
|
||||
export default DownloadCompanyDelegation;
|
||||
@@ -0,0 +1,45 @@
|
||||
import React, { useState } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
// api
|
||||
import ApplicationService from '../../../../service/application-service';
|
||||
|
||||
// components
|
||||
import { Button } from 'primereact/button';
|
||||
|
||||
const DownloadSignedApplication = ({ applicationId = 0 }) => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [, setDocument] = useState({});
|
||||
|
||||
const onClickDownload = () => {
|
||||
setLoading(true);
|
||||
ApplicationService.getApplicationSignedPdf(applicationId, getSignedPdfCallback, errSignedPdfCallbacks);
|
||||
}
|
||||
|
||||
const getSignedPdfCallback = (data) => {
|
||||
if (data.data) {
|
||||
setDocument([data.data]);
|
||||
if (data.data.filePath) {
|
||||
window.open(encodeURI(data.data.filePath), '_blank').focus()
|
||||
}
|
||||
}
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
const errSignedPdfCallbacks = () => {
|
||||
setDocument([]);
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
return (applicationId && applicationId !== 0
|
||||
? <Button
|
||||
type="button"
|
||||
disabled={loading}
|
||||
onClick={onClickDownload}
|
||||
label={__('Scarica PDF firmato', 'gepafin')}
|
||||
icon="pi pi-download"
|
||||
iconPos="right"/> : null
|
||||
)
|
||||
}
|
||||
|
||||
export default DownloadSignedApplication;
|
||||
@@ -33,6 +33,8 @@ 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';
|
||||
|
||||
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
||||
|
||||
@@ -436,6 +438,18 @@ const DomandaEditPreInstructor = () => {
|
||||
<span>{__('ID domanda', 'gepafin')}</span>
|
||||
<span>{data.applicationId}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Protocollo', 'gepafin')}</span>
|
||||
<span>{data.protocolNumber}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('NDG', 'gepafin')}</span>
|
||||
<span>{data.ndg}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Appuntamento', 'gepafin')}</span>
|
||||
<span>{data.appointmentId}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Bando', 'gepafin')}</span>
|
||||
<span>{data.callName}</span>
|
||||
@@ -446,7 +460,7 @@ const DomandaEditPreInstructor = () => {
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Azienda', 'gepafin')}</span>
|
||||
<span></span>
|
||||
<span>{data.companyName}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Data ricezione', 'gepafin')}</span>
|
||||
@@ -464,7 +478,11 @@ const DomandaEditPreInstructor = () => {
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Scarica documenti della domanda', 'gepafin')}</h2>
|
||||
<DownloadApplicationArchive applicationId={id}/>
|
||||
<div className="appPageSection__row autoFlow">
|
||||
<DownloadApplicationArchive applicationId={id}/>
|
||||
<DownloadSignedApplication applicationId={id}/>
|
||||
<DownloadCompanyDelegation applicationId={id}/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
|
||||
Reference in New Issue
Block a user