- added page with evalutions;

- added page with amendements;
- implemented communication for amendment;
- implemented amendment creation;
This commit is contained in:
Vitalii Kiiko
2024-10-31 10:06:32 +01:00
parent d8ea017023
commit 5ecf4b5181
5 changed files with 56 additions and 36 deletions

View File

@@ -4,7 +4,7 @@ import { is, uniq } from 'ramda';
import { Link } from 'react-router-dom';
// store
//import { storeSet, storeGet } from '../../../../store';
import { storeSet, storeGet } from '../../../../store';
// api
import ApplicationService from '../../../../service/application-service';
@@ -19,6 +19,7 @@ import { InputIcon } from 'primereact/inputicon';
import { Button } from 'primereact/button';
import { Calendar } from 'primereact/calendar';
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
import AmendmentsService from '../../../../service/amendments-service';
const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
@@ -29,8 +30,9 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
const [statuses, setStatuses] = useState([]);
useEffect(() => {
const userData = storeGet.main.userData()
setLocalAsyncRequest(true);
ApplicationService.getApplications(getCallback, errGetCallbacks, [['status', 'SUBMIT']]);
AmendmentsService.getSoccorsoByPreInstructorId(userData.id, getCallback, errGetCallbacks);
}, []);
const getCallback = (data) => {
@@ -48,9 +50,8 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
const getFormattedData = (data) => {
return data.map((d) => {
d.callEndDate = is(String, d.callEndDate) ? new Date(d.callEndDate) : (d.callEndDate ? d.callEndDate : '');
d.modifiedDate = is(String, d.modifiedDate) ? new Date(d.modifiedDate) : (d.modifiedDate ? d.modifiedDate : '');
d.submissionDate = is(String, d.submissionDate) ? new Date(d.submissionDate) : (d.submissionDate ? d.submissionDate : '');
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 : '');
return d;
});
};
@@ -80,15 +81,19 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
const initFilters = () => {
setFilters({
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
callTitle: {
callName: {
operator: FilterOperator.AND,
constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
},
submissionDate: {
beneficiaryName: {
operator: FilterOperator.AND,
constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
},
startDate: {
operator: FilterOperator.AND,
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
},
callEndDate: {
expirationDate: {
operator: FilterOperator.AND,
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
}
@@ -108,12 +113,12 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
);
};
const dateAppliedBodyTemplate = (rowData) => {
return formatDate(rowData.submissionDate);
const dateStartBodyTemplate = (rowData) => {
return formatDate(rowData.startDate);
};
const dateEndBodyTemplate = (rowData) => {
return formatDate(rowData.callEndDate);
const dateExpirationBodyTemplate = (rowData) => {
return formatDate(rowData.expirationDate);
};
const dateFilterTemplate = (options) => {
@@ -125,13 +130,8 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
};
const actionsBodyTemplate = (rowData) => {
return openDialogFn
? <Button severity="info"
onClick={() => openDialogFn(rowData.id)}
label={__('Assegnare', 'gepafin')}
icon="pi pi-pencil" size="small" iconPos="right" />
: <Link to={'/domande'}>
<Button severity="info" label={__('Gestire', 'gepafin')} size="small" />
return <Link to={`/domande/${rowData.applicationId}/soccorso/${rowData.id}`}>
<Button severity="info" label={__('Dettagli', 'gepafin')} size="small" />
</Link>
}
@@ -145,20 +145,23 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
header={header}
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
onFilter={(e) => setFilters(e.filters)}>
<Column field="id" header={__('ID domanda', 'gepafin')}
<Column field="applicationId" header={__('ID domanda', 'gepafin')}
filter filterPlaceholder={__('Cerca', 'gepafin')}
style={{ minWidth: '12rem' }}/>
<Column field="callTitle" header={__('Bando', 'gepafin')}
<Column field="callName" header={__('Bando', 'gepafin')}
filter filterPlaceholder={__('Cerca', 'gepafin')}
style={{ minWidth: '12rem' }}/>
<Column header={__('Data Ricezione', 'gepafin')}
filterField="submissionDate" dataType="date"
<Column field="beneficiaryName" header={__('Beneficiario', 'gepafin')}
filter filterPlaceholder={__('Cerca', 'gepafin')}
style={{ minWidth: '12rem' }}/>
<Column header={__('Data Richiesta', 'gepafin')}
filterField="startDate" dataType="date"
style={{ minWidth: '10rem' }}
body={dateAppliedBodyTemplate} filter filterElement={dateFilterTemplate}/>
body={dateStartBodyTemplate} filter filterElement={dateFilterTemplate}/>
<Column header={__('Scadenza', 'gepafin')}
filterField="callEndDate" dataType="date"
filterField="expirationDate" dataType="date"
style={{ minWidth: '10rem' }}
body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>
body={dateExpirationBodyTemplate} filter filterElement={dateFilterTemplate}/>
<Column field="status" header={__('Stato', 'gepafin')}
style={{ width: '120px' }} body={statusBodyTemplate} />
<Column header={__('Azioni', 'gepafin')}