From 0f54ce6bd967f91093ea1fcbe231881b2e71d5a0 Mon Sep 17 00:00:00 2001
From: Vitalii Kiiko
Date: Thu, 5 Dec 2024 17:16:27 +0100
Subject: [PATCH] - updated tables - displaying protocol id, columns for ndg
and appointment; - added 2 buttons for download delega and download signed
pdf for application;
---
src/assets/scss/components/appPage.scss | 4 ++
.../PreInstructorDomandeTable/index.js | 11 +++-
.../DownloadCompanyDelegation/index.js | 51 +++++++++++++++++++
.../DownloadSignedApplication/index.js | 45 ++++++++++++++++
src/pages/DomandaEditPreInstructor/index.js | 22 +++++++-
.../components/AllDomandeTable/index.js | 16 +++---
.../BeneficiarioDomandeTable/index.js | 6 ++-
.../PreInstructorSoccorsiTable/index.js | 15 +++---
8 files changed, 152 insertions(+), 18 deletions(-)
create mode 100644 src/pages/DomandaEditPreInstructor/components/DownloadCompanyDelegation/index.js
create mode 100644 src/pages/DomandaEditPreInstructor/components/DownloadSignedApplication/index.js
diff --git a/src/assets/scss/components/appPage.scss b/src/assets/scss/components/appPage.scss
index 8f40ad9..da0721a 100644
--- a/src/assets/scss/components/appPage.scss
+++ b/src/assets/scss/components/appPage.scss
@@ -342,6 +342,10 @@
.appPageSection__row {
display: flex;
gap: 1rem;
+
+ &.autoFlow {
+ flex-wrap: wrap;
+ }
}
.appPageSection__pMeta {
diff --git a/src/pages/DashboardPreInstructor/components/PreInstructorDomandeTable/index.js b/src/pages/DashboardPreInstructor/components/PreInstructorDomandeTable/index.js
index 537fa3c..4cac1b4 100644
--- a/src/pages/DashboardPreInstructor/components/PreInstructorDomandeTable/index.js
+++ b/src/pages/DashboardPreInstructor/components/PreInstructorDomandeTable/index.js
@@ -141,7 +141,16 @@ const PreInstructorDomandeTable = () => {
header={header}
emptyMessage={translationStrings.emptyMessage}
onFilter={(e) => setFilters(e.filters)}>
-
+
+
+
{
+ 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
+ ? : null
+ )
+}
+
+export default DownloadCompanyDelegation;
\ No newline at end of file
diff --git a/src/pages/DomandaEditPreInstructor/components/DownloadSignedApplication/index.js b/src/pages/DomandaEditPreInstructor/components/DownloadSignedApplication/index.js
new file mode 100644
index 0000000..0e6a529
--- /dev/null
+++ b/src/pages/DomandaEditPreInstructor/components/DownloadSignedApplication/index.js
@@ -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
+ ? : null
+ )
+}
+
+export default DownloadSignedApplication;
\ No newline at end of file
diff --git a/src/pages/DomandaEditPreInstructor/index.js b/src/pages/DomandaEditPreInstructor/index.js
index 3e1c3be..8492567 100644
--- a/src/pages/DomandaEditPreInstructor/index.js
+++ b/src/pages/DomandaEditPreInstructor/index.js
@@ -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 = () => {
{__('ID domanda', 'gepafin')}
{data.applicationId}
+
+ {__('Protocollo', 'gepafin')}
+ {data.protocolNumber}
+
+
+ {__('NDG', 'gepafin')}
+ {data.ndg}
+
+
+ {__('Appuntamento', 'gepafin')}
+ {data.appointmentId}
+
{__('Bando', 'gepafin')}
{data.callName}
@@ -446,7 +460,7 @@ const DomandaEditPreInstructor = () => {
{__('Azienda', 'gepafin')}
-
+ {data.companyName}
{__('Data ricezione', 'gepafin')}
@@ -464,7 +478,11 @@ const DomandaEditPreInstructor = () => {
{__('Scarica documenti della domanda', 'gepafin')}
-
+
+
+
+
+
diff --git a/src/pages/Domande/components/AllDomandeTable/index.js b/src/pages/Domande/components/AllDomandeTable/index.js
index 2f0ee3e..f4696c1 100644
--- a/src/pages/Domande/components/AllDomandeTable/index.js
+++ b/src/pages/Domande/components/AllDomandeTable/index.js
@@ -98,9 +98,9 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
return formatDate(rowData.submissionDate);
};
- const dateEndBodyTemplate = (rowData) => {
+ /*const dateEndBodyTemplate = (rowData) => {
return formatDate(rowData.callEndDate);
- };
+ };*/
const dateFilterTemplate = (options) => {
return options.filterCallback(e.value, options.index)}
@@ -138,9 +138,11 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
emptyMessage={translationStrings.emptyMessage}
onFilter={(e) => setFilters(e.filters)}>
+ sortable filterPlaceholder={__('Cerca', 'gepafin')}
+ style={{ minWidth: '6rem' }}/>
+
{
filterField="submissionDate" dataType="date"
style={{ minWidth: '8rem' }}
body={dateAppliedBodyTemplate} filter filterElement={dateFilterTemplate}/>
-
+ body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>*/}
{
emptyMessage={translationStrings.emptyMessage}
onFilter={(e) => setFilters(e.filters)}>
+
{
const getFormattedData = (data) => {
return data.map((d) => {
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;
});
};
@@ -86,7 +86,7 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
operator: FilterOperator.AND,
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
},
- expirationDate: {
+ evaluationEndDate: {
operator: FilterOperator.AND,
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
}
@@ -106,7 +106,7 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
};
const dateExpirationBodyTemplate = (rowData) => {
- return rowData.expirationDate ? formatDate(rowData.expirationDate) : '';
+ return rowData.evaluationEndDate ? formatDate(rowData.evaluationEndDate) : '';
};
const dateFilterTemplate = (options) => {
@@ -140,8 +140,11 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
header={header}
emptyMessage={translationStrings.emptyMessage}
onFilter={(e) => setFilters(e.filters)}>
-
+
{
style={{ minWidth: '8rem' }}
body={dateStartBodyTemplate} filter filterElement={dateFilterTemplate}/>