- added page with evalutions;
- added page with amendements; - implemented communication for amendment; - implemented amendment creation;
This commit is contained in:
@@ -125,11 +125,7 @@ const PreInstructorDomandeTable = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const actionsBodyTemplate = (rowData) => {
|
const actionsBodyTemplate = (rowData) => {
|
||||||
/*return <Button severity="info"
|
return <Link to={`/domande/${rowData.applicationId}`}>
|
||||||
onClick={() => createEvaluation(rowData.id)}
|
|
||||||
label={__('Valuta', 'gepafin')}
|
|
||||||
icon="pi pi-pencil" size="small" iconPos="right" />*/
|
|
||||||
return <Link to={`/domande/${rowData.id}`}>
|
|
||||||
<Button severity="info" label={__('Valuta', 'gepafin')} icon="pi pi-eye" size="small" iconPos="right"/>
|
<Button severity="info" label={__('Valuta', 'gepafin')} icon="pi pi-eye" size="small" iconPos="right"/>
|
||||||
</Link>
|
</Link>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import { Calendar } from 'primereact/calendar';
|
|||||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
|
|
||||||
|
|
||||||
const AllDomandeTable = ({ openDialogFn }) => {
|
const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
|
||||||
const [items, setItems] = useState(null);
|
const [items, setItems] = useState(null);
|
||||||
const [filters, setFilters] = useState(null);
|
const [filters, setFilters] = useState(null);
|
||||||
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||||
@@ -31,7 +31,7 @@ const AllDomandeTable = ({ openDialogFn }) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLocalAsyncRequest(true);
|
setLocalAsyncRequest(true);
|
||||||
ApplicationService.getApplications(getCallback, errGetCallbacks, [['status', 'SUBMIT']]);
|
ApplicationService.getApplications(getCallback, errGetCallbacks, [['status', 'SUBMIT']]);
|
||||||
}, []);
|
}, [updaterString]);
|
||||||
|
|
||||||
const getCallback = (data) => {
|
const getCallback = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
|
|
||||||
// api
|
// api
|
||||||
@@ -18,6 +18,7 @@ import { classNames } from 'primereact/utils';
|
|||||||
import { isEmpty, isNil } from 'ramda';
|
import { isEmpty, isNil } from 'ramda';
|
||||||
import { Dropdown } from 'primereact/dropdown';
|
import { Dropdown } from 'primereact/dropdown';
|
||||||
import AssignedApplicationService from '../../service/assigned-application-service';
|
import AssignedApplicationService from '../../service/assigned-application-service';
|
||||||
|
import uniqid from '../../helpers/uniqid';
|
||||||
|
|
||||||
const Domande = () => {
|
const Domande = () => {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
@@ -26,6 +27,8 @@ const Domande = () => {
|
|||||||
const [users, setUsers] = useState([]);
|
const [users, setUsers] = useState([]);
|
||||||
const [chosenUser, setChosenUser] = useState(0);
|
const [chosenUser, setChosenUser] = useState(0);
|
||||||
const [chosenApplication, setChosenApplication] = useState(0);
|
const [chosenApplication, setChosenApplication] = useState(0);
|
||||||
|
const [updaterString, setUpdaterString] = useState('');
|
||||||
|
const toast = useRef(null);
|
||||||
|
|
||||||
const getRolesCallback = (data) => {
|
const getRolesCallback = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
@@ -97,12 +100,26 @@ const Domande = () => {
|
|||||||
|
|
||||||
const assignApplCallback = (data) => {
|
const assignApplCallback = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
|
if (toast.current) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'success',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setUpdaterString(uniqid());
|
||||||
}
|
}
|
||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
const errAssignApplCallback = (data) => {
|
const errAssignApplCallback = (data) => {
|
||||||
|
if (toast.current && data.message) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
set404FromErrorResponse(data);
|
set404FromErrorResponse(data);
|
||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
@@ -130,7 +147,7 @@ const Domande = () => {
|
|||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<AllDomandeTable openDialogFn={openAssignDialog}/>
|
<AllDomandeTable openDialogFn={openAssignDialog} updaterString={updaterString}/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Dialog
|
<Dialog
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { is, uniq } from 'ramda';
|
|||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
// store
|
// store
|
||||||
//import { storeSet, storeGet } from '../../../../store';
|
import { storeSet, storeGet } from '../../../../store';
|
||||||
|
|
||||||
// api
|
// api
|
||||||
import ApplicationService from '../../../../service/application-service';
|
import ApplicationService from '../../../../service/application-service';
|
||||||
@@ -19,6 +19,7 @@ import { InputIcon } from 'primereact/inputicon';
|
|||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import { Calendar } from 'primereact/calendar';
|
import { Calendar } from 'primereact/calendar';
|
||||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
|
import AmendmentsService from '../../../../service/amendments-service';
|
||||||
|
|
||||||
|
|
||||||
const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
||||||
@@ -29,8 +30,9 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
|||||||
const [statuses, setStatuses] = useState([]);
|
const [statuses, setStatuses] = useState([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const userData = storeGet.main.userData()
|
||||||
setLocalAsyncRequest(true);
|
setLocalAsyncRequest(true);
|
||||||
ApplicationService.getApplications(getCallback, errGetCallbacks, [['status', 'SUBMIT']]);
|
AmendmentsService.getSoccorsoByPreInstructorId(userData.id, getCallback, errGetCallbacks);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const getCallback = (data) => {
|
const getCallback = (data) => {
|
||||||
@@ -48,9 +50,8 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
|||||||
|
|
||||||
const getFormattedData = (data) => {
|
const getFormattedData = (data) => {
|
||||||
return data.map((d) => {
|
return data.map((d) => {
|
||||||
d.callEndDate = is(String, d.callEndDate) ? new Date(d.callEndDate) : (d.callEndDate ? d.callEndDate : '');
|
d.startDate = is(String, d.startDate) ? new Date(d.startDate) : (d.startDate ? d.startDate : '');
|
||||||
d.modifiedDate = is(String, d.modifiedDate) ? new Date(d.modifiedDate) : (d.modifiedDate ? d.modifiedDate : '');
|
d.expirationDate = is(String, d.expirationDate) ? new Date(d.expirationDate) : (d.expirationDate ? d.expirationDate : '');
|
||||||
d.submissionDate = is(String, d.submissionDate) ? new Date(d.submissionDate) : (d.submissionDate ? d.submissionDate : '');
|
|
||||||
return d;
|
return d;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -80,15 +81,19 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
|||||||
const initFilters = () => {
|
const initFilters = () => {
|
||||||
setFilters({
|
setFilters({
|
||||||
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
|
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
|
||||||
callTitle: {
|
callName: {
|
||||||
operator: FilterOperator.AND,
|
operator: FilterOperator.AND,
|
||||||
constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
|
constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
|
||||||
},
|
},
|
||||||
submissionDate: {
|
beneficiaryName: {
|
||||||
|
operator: FilterOperator.AND,
|
||||||
|
constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
|
||||||
|
},
|
||||||
|
startDate: {
|
||||||
operator: FilterOperator.AND,
|
operator: FilterOperator.AND,
|
||||||
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
|
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
|
||||||
},
|
},
|
||||||
callEndDate: {
|
expirationDate: {
|
||||||
operator: FilterOperator.AND,
|
operator: FilterOperator.AND,
|
||||||
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
|
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
|
||||||
}
|
}
|
||||||
@@ -108,12 +113,12 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const dateAppliedBodyTemplate = (rowData) => {
|
const dateStartBodyTemplate = (rowData) => {
|
||||||
return formatDate(rowData.submissionDate);
|
return formatDate(rowData.startDate);
|
||||||
};
|
};
|
||||||
|
|
||||||
const dateEndBodyTemplate = (rowData) => {
|
const dateExpirationBodyTemplate = (rowData) => {
|
||||||
return formatDate(rowData.callEndDate);
|
return formatDate(rowData.expirationDate);
|
||||||
};
|
};
|
||||||
|
|
||||||
const dateFilterTemplate = (options) => {
|
const dateFilterTemplate = (options) => {
|
||||||
@@ -125,13 +130,8 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const actionsBodyTemplate = (rowData) => {
|
const actionsBodyTemplate = (rowData) => {
|
||||||
return openDialogFn
|
return <Link to={`/domande/${rowData.applicationId}/soccorso/${rowData.id}`}>
|
||||||
? <Button severity="info"
|
<Button severity="info" label={__('Dettagli', 'gepafin')} size="small" />
|
||||||
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" />
|
|
||||||
</Link>
|
</Link>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,20 +145,23 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
|||||||
header={header}
|
header={header}
|
||||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||||
onFilter={(e) => setFilters(e.filters)}>
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
<Column field="id" header={__('ID domanda', 'gepafin')}
|
<Column field="applicationId" header={__('ID domanda', 'gepafin')}
|
||||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
style={{ minWidth: '12rem' }}/>
|
style={{ minWidth: '12rem' }}/>
|
||||||
<Column field="callTitle" header={__('Bando', 'gepafin')}
|
<Column field="callName" header={__('Bando', 'gepafin')}
|
||||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
style={{ minWidth: '12rem' }}/>
|
style={{ minWidth: '12rem' }}/>
|
||||||
<Column header={__('Data Ricezione', 'gepafin')}
|
<Column field="beneficiaryName" header={__('Beneficiario', 'gepafin')}
|
||||||
filterField="submissionDate" dataType="date"
|
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
|
style={{ minWidth: '12rem' }}/>
|
||||||
|
<Column header={__('Data Richiesta', 'gepafin')}
|
||||||
|
filterField="startDate" dataType="date"
|
||||||
style={{ minWidth: '10rem' }}
|
style={{ minWidth: '10rem' }}
|
||||||
body={dateAppliedBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
body={dateStartBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||||
<Column header={__('Scadenza', 'gepafin')}
|
<Column header={__('Scadenza', 'gepafin')}
|
||||||
filterField="callEndDate" dataType="date"
|
filterField="expirationDate" dataType="date"
|
||||||
style={{ minWidth: '10rem' }}
|
style={{ minWidth: '10rem' }}
|
||||||
body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
body={dateExpirationBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||||
<Column field="status" header={__('Stato', 'gepafin')}
|
<Column field="status" header={__('Stato', 'gepafin')}
|
||||||
style={{ width: '120px' }} body={statusBodyTemplate} />
|
style={{ width: '120px' }} body={statusBodyTemplate} />
|
||||||
<Column header={__('Azioni', 'gepafin')}
|
<Column header={__('Azioni', 'gepafin')}
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ export default class AmendmentsService {
|
|||||||
NetworkService.get(`${API_BASE_URL}/amendments`, callback, errCallback, queryParams);
|
NetworkService.get(`${API_BASE_URL}/amendments`, callback, errCallback, queryParams);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static getSoccorsoByPreInstructorId = (id, callback, errCallback, queryParams) => {
|
||||||
|
NetworkService.get(`${API_BASE_URL}/amendments/user/${id}`, callback, errCallback, queryParams);
|
||||||
|
};
|
||||||
|
|
||||||
static createSoccorso = (body, callback, errCallback, queryParams) => {
|
static createSoccorso = (body, callback, errCallback, queryParams) => {
|
||||||
NetworkService.post(`${API_BASE_URL}/amendments`, body, callback, errCallback, queryParams);
|
NetworkService.post(`${API_BASE_URL}/amendments`, body, callback, errCallback, queryParams);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user