- 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:
Vitalii Kiiko
2024-12-05 17:16:27 +01:00
parent f072c3d6a6
commit 0f54ce6bd9
8 changed files with 152 additions and 18 deletions

View File

@@ -342,6 +342,10 @@
.appPageSection__row { .appPageSection__row {
display: flex; display: flex;
gap: 1rem; gap: 1rem;
&.autoFlow {
flex-wrap: wrap;
}
} }
.appPageSection__pMeta { .appPageSection__pMeta {

View File

@@ -141,7 +141,16 @@ const PreInstructorDomandeTable = () => {
header={header} header={header}
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}
onFilter={(e) => setFilters(e.filters)}> onFilter={(e) => setFilters(e.filters)}>
<Column field="applicationId" header={__('ID domanda', 'gepafin')} <Column field="id" header={__('ID domanda', 'gepafin')}
sortable filterPlaceholder={__('Cerca', 'gepafin')}
style={{ minWidth: '6rem' }}/>
<Column field="protocolNumber" header={__('Protocollo', 'gepafin')}
sortable filterPlaceholder={__('Cerca', 'gepafin')}
style={{ minWidth: '6rem' }}/>
<Column field="ndg" header={__('NDG', 'gepafin')}
sortable filterPlaceholder={__('Cerca', 'gepafin')}
style={{ minWidth: '6rem' }}/>
<Column field="appointmentId" header={__('ID appuntamento', 'gepafin')}
sortable filterPlaceholder={__('Cerca', 'gepafin')} sortable filterPlaceholder={__('Cerca', 'gepafin')}
style={{ minWidth: '6rem' }}/> style={{ minWidth: '6rem' }}/>
<Column field="callName" header={__('Bando', 'gepafin')} <Column field="callName" header={__('Bando', 'gepafin')}

View File

@@ -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;

View File

@@ -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;

View File

@@ -33,6 +33,8 @@ import { classNames } from 'primereact/utils';
import { InputTextarea } from 'primereact/inputtextarea'; import { InputTextarea } from 'primereact/inputtextarea';
import { InputText } from 'primereact/inputtext'; import { InputText } from 'primereact/inputtext';
import DownloadApplicationArchive from './components/DownloadApplicationArchive'; 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; const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
@@ -436,6 +438,18 @@ const DomandaEditPreInstructor = () => {
<span>{__('ID domanda', 'gepafin')}</span> <span>{__('ID domanda', 'gepafin')}</span>
<span>{data.applicationId}</span> <span>{data.applicationId}</span>
</p> </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"> <p className="appPageSection__pMeta">
<span>{__('Bando', 'gepafin')}</span> <span>{__('Bando', 'gepafin')}</span>
<span>{data.callName}</span> <span>{data.callName}</span>
@@ -446,7 +460,7 @@ const DomandaEditPreInstructor = () => {
</p> </p>
<p className="appPageSection__pMeta"> <p className="appPageSection__pMeta">
<span>{__('Azienda', 'gepafin')}</span> <span>{__('Azienda', 'gepafin')}</span>
<span></span> <span>{data.companyName}</span>
</p> </p>
<p className="appPageSection__pMeta"> <p className="appPageSection__pMeta">
<span>{__('Data ricezione', 'gepafin')}</span> <span>{__('Data ricezione', 'gepafin')}</span>
@@ -464,7 +478,11 @@ const DomandaEditPreInstructor = () => {
<div className="appPageSection"> <div className="appPageSection">
<h2>{__('Scarica documenti della domanda', 'gepafin')}</h2> <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>
<div className="appPageSection"> <div className="appPageSection">

View File

@@ -98,9 +98,9 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
return formatDate(rowData.submissionDate); return formatDate(rowData.submissionDate);
}; };
const dateEndBodyTemplate = (rowData) => { /*const dateEndBodyTemplate = (rowData) => {
return formatDate(rowData.callEndDate); return formatDate(rowData.callEndDate);
}; };*/
const dateFilterTemplate = (options) => { const dateFilterTemplate = (options) => {
return <Calendar value={options.value} onChange={(e) => options.filterCallback(e.value, options.index)} return <Calendar value={options.value} onChange={(e) => options.filterCallback(e.value, options.index)}
@@ -138,9 +138,11 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}
onFilter={(e) => setFilters(e.filters)}> onFilter={(e) => setFilters(e.filters)}>
<Column field="id" header={__('ID domanda', 'gepafin')} <Column field="id" header={__('ID domanda', 'gepafin')}
sortable sortable filterPlaceholder={__('Cerca', 'gepafin')}
filterPlaceholder={__('Cerca', 'gepafin')} style={{ minWidth: '6rem' }}/>
style={{ minWidth: '8rem' }}/> <Column field="protocolNumber" header={__('Protocollo', 'gepafin')}
sortable filterPlaceholder={__('Cerca', 'gepafin')}
style={{ minWidth: '6rem' }}/>
<Column field="callTitle" header={__('Bando', 'gepafin')} <Column field="callTitle" header={__('Bando', 'gepafin')}
filter sortable filter sortable
filterPlaceholder={__('Cerca', 'gepafin')} filterPlaceholder={__('Cerca', 'gepafin')}
@@ -153,10 +155,10 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
filterField="submissionDate" dataType="date" filterField="submissionDate" dataType="date"
style={{ minWidth: '8rem' }} style={{ minWidth: '8rem' }}
body={dateAppliedBodyTemplate} filter filterElement={dateFilterTemplate}/> body={dateAppliedBodyTemplate} filter filterElement={dateFilterTemplate}/>
<Column header={__('Scadenza', 'gepafin')} {/*<Column header={__('Scadenza', 'gepafin')}
filterField="callEndDate" dataType="date" filterField="callEndDate" dataType="date"
style={{ minWidth: '8rem' }} style={{ minWidth: '8rem' }}
body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/> body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>*/}
<Column field="status" header={__('Stato', 'gepafin')} <Column field="status" header={__('Stato', 'gepafin')}
style={{ minWidth: '8rem' }} body={statusBodyTemplate}/> style={{ minWidth: '8rem' }} body={statusBodyTemplate}/>
<Column header={__('Azioni', 'gepafin')} <Column header={__('Azioni', 'gepafin')}

View File

@@ -156,8 +156,10 @@ const BeneficiarioDomandeTable = () => {
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}
onFilter={(e) => setFilters(e.filters)}> onFilter={(e) => setFilters(e.filters)}>
<Column field="id" header={__('ID domanda', 'gepafin')} <Column field="id" header={__('ID domanda', 'gepafin')}
sortable sortable filterPlaceholder={__('Cerca', 'gepafin')}
filterPlaceholder={__('Cerca il nome', 'gepafin')} style={{ minWidth: '6rem' }}/>
<Column field="protocolNumber" header={__('Protocollo', 'gepafin')}
sortable filterPlaceholder={__('Cerca', 'gepafin')}
style={{ minWidth: '6rem' }}/> style={{ minWidth: '6rem' }}/>
<Column field="callTitle" header={__('Titolo bando', 'gepafin')} <Column field="callTitle" header={__('Titolo bando', 'gepafin')}
filter sortable filter sortable

View File

@@ -54,7 +54,7 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
const getFormattedData = (data) => { const getFormattedData = (data) => {
return data.map((d) => { return data.map((d) => {
d.startDate = is(String, d.startDate) ? new Date(d.startDate) : (d.startDate ? d.startDate : ''); d.startDate = is(String, d.startDate) ? new Date(d.startDate) : (d.startDate ? d.startDate : '');
d.expirationDate = is(String, d.expirationDate) ? new Date(d.expirationDate) : (d.expirationDate ? d.expirationDate : ''); d.evaluationEndDate = is(String, d.evaluationEndDate) ? new Date(d.evaluationEndDate) : (d.evaluationEndDate ? d.evaluationEndDate : '');
return d; return d;
}); });
}; };
@@ -86,7 +86,7 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
operator: FilterOperator.AND, operator: FilterOperator.AND,
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
}, },
expirationDate: { evaluationEndDate: {
operator: FilterOperator.AND, operator: FilterOperator.AND,
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
} }
@@ -106,7 +106,7 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
}; };
const dateExpirationBodyTemplate = (rowData) => { const dateExpirationBodyTemplate = (rowData) => {
return rowData.expirationDate ? formatDate(rowData.expirationDate) : ''; return rowData.evaluationEndDate ? formatDate(rowData.evaluationEndDate) : '';
}; };
const dateFilterTemplate = (options) => { const dateFilterTemplate = (options) => {
@@ -140,8 +140,11 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
header={header} header={header}
emptyMessage={translationStrings.emptyMessage} emptyMessage={translationStrings.emptyMessage}
onFilter={(e) => setFilters(e.filters)}> onFilter={(e) => setFilters(e.filters)}>
<Column field="applicationId" header={__('ID domanda', 'gepafin')} <Column field="id" header={__('ID domanda', 'gepafin')}
filter filterPlaceholder={__('Cerca', 'gepafin')} sortable filterPlaceholder={__('Cerca', 'gepafin')}
style={{ minWidth: '6rem' }}/>
<Column field="protocolNumber" header={__('Protocollo', 'gepafin')}
sortable filterPlaceholder={__('Cerca', 'gepafin')}
style={{ minWidth: '6rem' }}/> style={{ minWidth: '6rem' }}/>
<Column field="callName" header={__('Bando', 'gepafin')} <Column field="callName" header={__('Bando', 'gepafin')}
filter filterPlaceholder={__('Cerca', 'gepafin')} filter filterPlaceholder={__('Cerca', 'gepafin')}
@@ -154,7 +157,7 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
style={{ minWidth: '8rem' }} style={{ minWidth: '8rem' }}
body={dateStartBodyTemplate} filter filterElement={dateFilterTemplate}/> body={dateStartBodyTemplate} filter filterElement={dateFilterTemplate}/>
<Column header={__('Scadenza', 'gepafin')} <Column header={__('Scadenza', 'gepafin')}
filterField="expirationDate" dataType="date" filterField="evaluationEndDate" dataType="date"
style={{ minWidth: '8rem' }} style={{ minWidth: '8rem' }}
body={dateExpirationBodyTemplate} filter filterElement={dateFilterTemplate}/> body={dateExpirationBodyTemplate} filter filterElement={dateFilterTemplate}/>
<Column field="status" header={__('Stato', 'gepafin')} <Column field="status" header={__('Stato', 'gepafin')}