- added Manage applications page and table of submitted appls;
This commit is contained in:
@@ -182,8 +182,11 @@
|
|||||||
|
|
||||||
.appPageSection__hero {
|
.appPageSection__hero {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 250px;
|
aspect-ratio: 16 / 9;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@supports not (aspect-ratio: 16 / 9) {
|
||||||
|
height: calc(100% * 9/16);
|
||||||
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -8,9 +8,6 @@ const getBandoLabel = (status) => {
|
|||||||
case 'SUBMIT':
|
case 'SUBMIT':
|
||||||
return __('Inviato', 'gepafin');
|
return __('Inviato', 'gepafin');
|
||||||
|
|
||||||
case 'ACTIVE':
|
|
||||||
return __('Attivo', 'gepafin');
|
|
||||||
|
|
||||||
case 'PUBLISH':
|
case 'PUBLISH':
|
||||||
return __('Pubblicato', 'gepafin');
|
return __('Pubblicato', 'gepafin');
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ const getBandoSeverity = (status) => {
|
|||||||
case 'SUBMIT':
|
case 'SUBMIT':
|
||||||
return 'success';
|
return 'success';
|
||||||
|
|
||||||
case 'ACTIVE':
|
|
||||||
return 'success';
|
|
||||||
|
|
||||||
case 'PUBLISH':
|
case 'PUBLISH':
|
||||||
return 'success';
|
return 'success';
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,13 @@ const AppSidebar = () => {
|
|||||||
id: 3,
|
id: 3,
|
||||||
enable: intersection(permissions, ['APPLY_CALLS']).length
|
enable: intersection(permissions, ['APPLY_CALLS']).length
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: __('Gestione Domande', 'gepafin'),
|
||||||
|
icon: 'pi pi-file',
|
||||||
|
href: '/domande',
|
||||||
|
id: 5,
|
||||||
|
enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: __('Bandi disponibili', 'gepafin'),
|
label: __('Bandi disponibili', 'gepafin'),
|
||||||
icon: 'pi pi-bookmark',
|
icon: 'pi pi-bookmark',
|
||||||
|
|||||||
@@ -91,12 +91,13 @@ const BandoApplication = () => {
|
|||||||
storeSet.main.setAsyncRequest();
|
storeSet.main.setAsyncRequest();
|
||||||
formMsgs.current.clear();
|
formMsgs.current.clear();
|
||||||
|
|
||||||
ApplicationService.updateStatusApplication(applId, {}, submitApplicationCallback, errSubmitApplicationCallback, [
|
/*ApplicationService.updateStatusApplication(applId, {}, submitApplicationCallback, errSubmitApplicationCallback, [
|
||||||
['status', 'SUBMIT']
|
['status', 'SUBMIT']
|
||||||
]);
|
]);*/
|
||||||
|
ApplicationService.validateApplication(applId, {}, validateApplicationCallback, errValidateApplicationCallback);
|
||||||
};
|
};
|
||||||
|
|
||||||
const submitApplicationCallback = (data) => {
|
/*const submitApplicationCallback = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
if (data.data.status) {
|
if (data.data.status) {
|
||||||
setApplicationStatus(data.data.status); // ask why not 'applicationStatus'?
|
setApplicationStatus(data.data.status); // ask why not 'applicationStatus'?
|
||||||
@@ -139,6 +140,8 @@ const BandoApplication = () => {
|
|||||||
closable: true
|
closable: true
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
|
if (toast.current) {
|
||||||
toast.current.show({
|
toast.current.show({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
summary: '',
|
summary: '',
|
||||||
@@ -148,6 +151,26 @@ const BandoApplication = () => {
|
|||||||
} else {
|
} else {
|
||||||
set404FromErrorResponse(data);
|
set404FromErrorResponse(data);
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
const validateApplicationCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
if (data.data.status) {
|
||||||
|
setApplicationStatus(data.data.status); // ask why not 'applicationStatus'?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const errValidateApplicationCallback = (data) => {
|
||||||
|
if (toast.current) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveDraft = (saveAndMove = '') => {
|
const saveDraft = (saveAndMove = '') => {
|
||||||
@@ -306,7 +329,6 @@ const BandoApplication = () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
console.log('formDataInitial1', klona(formDataInitial));
|
|
||||||
|
|
||||||
if (data.data.applicationFormResponse.formFields) {
|
if (data.data.applicationFormResponse.formFields) {
|
||||||
const submitData = data.data.applicationFormResponse.formFields.map((o) => ({
|
const submitData = data.data.applicationFormResponse.formFields.map((o) => ({
|
||||||
@@ -320,7 +342,6 @@ const BandoApplication = () => {
|
|||||||
return acc;
|
return acc;
|
||||||
}, formDataInitial);
|
}, formDataInitial);
|
||||||
}
|
}
|
||||||
console.log('formDataInitial2', klona(formDataInitial));
|
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
setFormInitialData(formDataInitial);
|
setFormInitialData(formDataInitial);
|
||||||
@@ -378,7 +399,7 @@ const BandoApplication = () => {
|
|||||||
iconPos="right"/> : null}
|
iconPos="right"/> : null}
|
||||||
<Button
|
<Button
|
||||||
disabled={'SUBMIT' === applicationStatus}
|
disabled={'SUBMIT' === applicationStatus}
|
||||||
label={__('Carica dati per stampa', 'gepafin')}
|
label={__('Convalidare', 'gepafin')}
|
||||||
icon="pi pi-check"
|
icon="pi pi-check"
|
||||||
iconPos="right"/>
|
iconPos="right"/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -169,7 +169,8 @@ const MyEvaluationsTable = () => {
|
|||||||
onFilter={(e) => setFilters(e.filters)}>
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
<Column field="id" header={__('ID domanda', 'gepafin')}
|
<Column field="id" header={__('ID domanda', 'gepafin')}
|
||||||
style={{ minWidth: '2rem' }}/>
|
style={{ minWidth: '2rem' }}/>
|
||||||
<Column field="callTitle" header={__('Bando', 'gepafin')} filter filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
<Column field="callTitle" header={__('Bando', 'gepafin')}
|
||||||
|
filter filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||||
style={{ minWidth: '12rem' }}/>
|
style={{ minWidth: '12rem' }}/>
|
||||||
<Column header={__('Data Ricezione', 'gepafin')} filterField="modifiedDate" dataType="date"
|
<Column header={__('Data Ricezione', 'gepafin')} filterField="modifiedDate" dataType="date"
|
||||||
style={{ minWidth: '10rem' }}
|
style={{ minWidth: '10rem' }}
|
||||||
|
|||||||
164
src/pages/Domande/components/AllDomandeTable/index.js
Normal file
164
src/pages/Domande/components/AllDomandeTable/index.js
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
import React, { useState, useEffect} from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { is, uniq } from 'ramda';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
// store
|
||||||
|
//import { storeSet, storeGet } from '../../../../store';
|
||||||
|
|
||||||
|
// api
|
||||||
|
import ApplicationService from '../../../../service/application-service';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
||||||
|
import { DataTable } from 'primereact/datatable';
|
||||||
|
import { Column } from 'primereact/column';
|
||||||
|
import { InputText } from 'primereact/inputtext';
|
||||||
|
import { IconField } from 'primereact/iconfield';
|
||||||
|
import { InputIcon } from 'primereact/inputicon';
|
||||||
|
import { Button } from 'primereact/button';
|
||||||
|
import { Calendar } from 'primereact/calendar';
|
||||||
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
|
|
||||||
|
|
||||||
|
const AllDomandeTable = () => {
|
||||||
|
const [items, setItems] = useState(null);
|
||||||
|
const [filters, setFilters] = useState(null);
|
||||||
|
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||||
|
const [globalFilterValue, setGlobalFilterValue] = useState('');
|
||||||
|
const [statuses, setStatuses] = useState([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setLocalAsyncRequest(true);
|
||||||
|
ApplicationService.getApplications(getCallback, errGetCallbacks, [['status', 'SUBMIT']]);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const getCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setItems(getFormattedData(data.data));
|
||||||
|
setStatuses(uniq(data.data.map(o => o.status)))
|
||||||
|
initFilters();
|
||||||
|
}
|
||||||
|
setLocalAsyncRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetCallbacks = (data) => {
|
||||||
|
setLocalAsyncRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 : '');
|
||||||
|
return d;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatDate = (value) => {
|
||||||
|
return value.toLocaleDateString('it-IT', {
|
||||||
|
day: '2-digit',
|
||||||
|
month: '2-digit',
|
||||||
|
year: 'numeric'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const clearFilter = () => {
|
||||||
|
initFilters();
|
||||||
|
};
|
||||||
|
|
||||||
|
const onGlobalFilterChange = (e) => {
|
||||||
|
const value = e.target.value;
|
||||||
|
let _filters = { ...filters };
|
||||||
|
|
||||||
|
_filters['global'].value = value;
|
||||||
|
|
||||||
|
setFilters(_filters);
|
||||||
|
setGlobalFilterValue(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const initFilters = () => {
|
||||||
|
setFilters({
|
||||||
|
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
|
||||||
|
callTitle: {
|
||||||
|
operator: FilterOperator.AND,
|
||||||
|
constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
|
||||||
|
},
|
||||||
|
appliedDate: {
|
||||||
|
operator: FilterOperator.AND,
|
||||||
|
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
|
||||||
|
},
|
||||||
|
callEndDate: {
|
||||||
|
operator: FilterOperator.AND,
|
||||||
|
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setGlobalFilterValue('');
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderHeader = () => {
|
||||||
|
return (
|
||||||
|
<div className="appTableHeader">
|
||||||
|
<Button type="button" icon="pi pi-filter-slash" label={__('Pulisci', 'gepafin')} outlined onClick={clearFilter} />
|
||||||
|
<IconField iconPosition="left">
|
||||||
|
<InputIcon className="pi pi-search" />
|
||||||
|
<InputText value={globalFilterValue} onChange={onGlobalFilterChange} placeholder={__('Cerca', 'gepafin')} />
|
||||||
|
</IconField>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const dateAppliedBodyTemplate = (rowData) => {
|
||||||
|
return formatDate(rowData.submissionDate);
|
||||||
|
};
|
||||||
|
|
||||||
|
const dateEndBodyTemplate = (rowData) => {
|
||||||
|
return formatDate(rowData.callEndDate);
|
||||||
|
};
|
||||||
|
|
||||||
|
const dateFilterTemplate = (options) => {
|
||||||
|
return <Calendar value={options.value} onChange={(e) => options.filterCallback(e.value, options.index)} dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999" />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const statusBodyTemplate = (rowData) => {
|
||||||
|
return <ProperBandoLabel status={rowData.status}/>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const actionsBodyTemplate = (rowData) => {
|
||||||
|
return <Link to={`/bandi/${rowData.id}`}>
|
||||||
|
<Button severity="info" label={__('Modifica', 'gepafin')} icon="pi pi-pencil" size="small" iconPos="right" />
|
||||||
|
</Link>
|
||||||
|
}
|
||||||
|
|
||||||
|
const header = renderHeader();
|
||||||
|
|
||||||
|
return(
|
||||||
|
<div className="appPageSection__table">
|
||||||
|
<DataTable value={items} paginator showGridlines rows={10} loading={localAsyncRequest} dataKey="id"
|
||||||
|
filters={filters}
|
||||||
|
globalFilterFields={['name', 'status']}
|
||||||
|
header={header}
|
||||||
|
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||||
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
|
<Column field="id" header={__('ID domanda', 'gepafin')}
|
||||||
|
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
|
style={{ minWidth: '12rem' }}/>
|
||||||
|
<Column field="callTitle" header={__('Bando', 'gepafin')}
|
||||||
|
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
|
style={{ minWidth: '12rem' }}/>
|
||||||
|
<Column header={__('Data Ricezione', 'gepafin')} filterField="modifiedDate" dataType="date"
|
||||||
|
style={{ minWidth: '10rem' }}
|
||||||
|
body={dateAppliedBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||||
|
<Column header={__('Scadenza', 'gepafin')} filterField="callEndDate" dataType="date"
|
||||||
|
style={{ minWidth: '10rem' }}
|
||||||
|
body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||||
|
<Column field="status" header={__('Stato', 'gepafin')}
|
||||||
|
style={{ width: '120px' }} body={statusBodyTemplate} />
|
||||||
|
<Column header={__('Azioni', 'gepafin')}
|
||||||
|
body={actionsBodyTemplate}/>
|
||||||
|
</DataTable>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AllDomandeTable;
|
||||||
23
src/pages/Domande/index.js
Normal file
23
src/pages/Domande/index.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import AllDomandeTable from './components/AllDomandeTable';
|
||||||
|
|
||||||
|
const Domande = () => {
|
||||||
|
return(
|
||||||
|
<div className="appPage">
|
||||||
|
<div className="appPage__pageHeader">
|
||||||
|
<h1>{__('Gestione domande', 'gepafin')}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<AllDomandeTable/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Domande;
|
||||||
@@ -29,6 +29,7 @@ import DashboardInstructor from './pages/DashboardInstructor';
|
|||||||
import ProfileBeneficiario from './pages/ProfileBeneficiario';
|
import ProfileBeneficiario from './pages/ProfileBeneficiario';
|
||||||
import Evaluations from './pages/Evaluations';
|
import Evaluations from './pages/Evaluations';
|
||||||
import EvaluationEdit from './pages/EvaluationEdit';
|
import EvaluationEdit from './pages/EvaluationEdit';
|
||||||
|
import Domande from './pages/Domande';
|
||||||
|
|
||||||
const routes = ({ role, chosenCompanyId }) => {
|
const routes = ({ role, chosenCompanyId }) => {
|
||||||
|
|
||||||
@@ -80,6 +81,11 @@ const routes = ({ role, chosenCompanyId }) => {
|
|||||||
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
||||||
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
||||||
</DefaultLayout>}/>
|
</DefaultLayout>}/>
|
||||||
|
<Route path="/domande" element={<DefaultLayout>
|
||||||
|
{'ROLE_SUPER_ADMIN' === role ? <Domande/> : null}
|
||||||
|
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
||||||
|
</DefaultLayout>}/>
|
||||||
<Route path="/imieibandi" element={<DefaultLayout>
|
<Route path="/imieibandi" element={<DefaultLayout>
|
||||||
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||||
{'ROLE_BENEFICIARY' === role ? <Applications/> : null}
|
{'ROLE_BENEFICIARY' === role ? <Applications/> : null}
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ export default class ApplicationService {
|
|||||||
NetworkService.put(`${API_BASE_URL}/application/${id}/status`, body, callback, errCallback, queryParams);
|
NetworkService.put(`${API_BASE_URL}/application/${id}/status`, body, callback, errCallback, queryParams);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static validateApplication = (id, body, callback, errCallback, queryParams) => {
|
||||||
|
NetworkService.post(`${API_BASE_URL}/application/${id}/validate`, body, callback, errCallback, queryParams);
|
||||||
|
};
|
||||||
|
|
||||||
static downloadApplicationPdf = (id, body, callback, errCallback, queryParams) => {
|
static downloadApplicationPdf = (id, body, callback, errCallback, queryParams) => {
|
||||||
NetworkService.postBlob(`${API_BASE_URL}/application/${id}/download-pdf`, body, callback, errCallback, queryParams);
|
NetworkService.postBlob(`${API_BASE_URL}/application/${id}/download-pdf`, body, callback, errCallback, queryParams);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user