@@ -174,9 +183,9 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
-
)
diff --git a/src/pages/BandoFormsEdit/index.js b/src/pages/BandoFormsEdit/index.js
index 9fdfbe9..e739c89 100644
--- a/src/pages/BandoFormsEdit/index.js
+++ b/src/pages/BandoFormsEdit/index.js
@@ -223,7 +223,7 @@ const BandoFormsEdit = () => {
storeSet.main.unsetAsyncRequest();
}
- const errGetElementItemsCallback = (data) => {
+ const errGetElementItemsCallback = () => {
storeSet.main.unsetAsyncRequest();
}
@@ -278,6 +278,8 @@ const BandoFormsEdit = () => {
storeSet.main.formLabel('');
storeSet.main.formElements([]);
storeSet.main.bandoCriteria([]);
+ storeSet.main.activeElement('');
+ storeSet.main.selectedElement('');
}
}, [id, formId]);
diff --git a/src/pages/StatsBeneficiary/components/PreInstructorSoccorsiTable/index.js b/src/pages/StatsBeneficiary/components/PreInstructorSoccorsiTable/index.js
new file mode 100644
index 0000000..b74acd6
--- /dev/null
+++ b/src/pages/StatsBeneficiary/components/PreInstructorSoccorsiTable/index.js
@@ -0,0 +1,178 @@
+import React, { useState, useEffect} from 'react';
+import { __ } from '@wordpress/i18n';
+import { is, isNil, uniq } from 'ramda';
+import { Link } from 'react-router-dom';
+
+// api
+import AmendmentsService from '../../../../service/amendments-service';
+
+// tools
+import getBandoLabel from '../../../../helpers/getBandoLabel';
+import getBandoSeverity from '../../../../helpers/getBandoSeverity';
+
+// components
+import { FilterMatchMode, FilterOperator } from 'primereact/api';
+import { DataTable } from 'primereact/datatable';
+import { Column } from 'primereact/column';
+import { Button } from 'primereact/button';
+import { Calendar } from 'primereact/calendar';
+import ProperBandoLabel from '../../../../components/ProperBandoLabel';
+import { Dropdown } from 'primereact/dropdown';
+import { Tag } from 'primereact/tag';
+
+import translationStrings from '../../../../translationStringsForComponents';
+
+
+const PreInstructorSoccorsiTable = ({ userId = null }) => {
+ const [items, setItems] = useState(null);
+ const [filters, setFilters] = useState(null);
+ const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
+ const [statuses, setStatuses] = useState([]);
+
+ useEffect(() => {
+ if (!isNil(userId)) {
+ setLocalAsyncRequest(true);
+
+ if (userId === 0) {
+ AmendmentsService.getSoccorsi(getCallback, errGetCallbacks);
+ } else {
+ AmendmentsService.getSoccorsi(getCallback, errGetCallbacks, [
+ ['userId', userId]
+ ]);
+ }
+ }
+ }, [userId]);
+
+ 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.startDate = is(String, d.startDate) ? new Date(d.startDate) : (d.startDate ? d.startDate : '');
+ d.evaluationEndDate = is(String, d.evaluationEndDate) ? new Date(d.evaluationEndDate) : (d.evaluationEndDate ? d.evaluationEndDate : '');
+ return d;
+ });
+ };
+
+ const formatDate = (value) => {
+ return value.toLocaleDateString('it-IT', {
+ day: '2-digit',
+ month: '2-digit',
+ year: 'numeric'
+ });
+ };
+
+ const clearFilter = () => {
+ initFilters();
+ };
+
+ const initFilters = () => {
+ setFilters({
+ global: { value: null, matchMode: FilterMatchMode.CONTAINS },
+ callName: {
+ operator: FilterOperator.AND,
+ constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
+ },
+ companyName: {
+ operator: FilterOperator.AND,
+ constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
+ },
+ startDate: {
+ operator: FilterOperator.AND,
+ constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
+ },
+ evaluationEndDate: {
+ operator: FilterOperator.AND,
+ constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
+ }
+ });
+ };
+
+ const renderHeader = () => {
+ return (
+
+
+
+ );
+ };
+
+ const dateStartBodyTemplate = (rowData) => {
+ return formatDate(rowData.startDate);
+ };
+
+ const dateExpirationBodyTemplate = (rowData) => {
+ return rowData.evaluationEndDate ? formatDate(rowData.evaluationEndDate) : '';
+ };
+
+ const dateFilterTemplate = (options) => {
+ return
options.filterCallback(e.value, options.index)} dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999" />;
+ };
+
+ const statusBodyTemplate = (rowData) => {
+ return ;
+ };
+
+ const statusFilterTemplate = (options) => {
+ return options.filterCallback(e.value, options.index)} itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter" showClear />;
+ };
+
+ const statusItemTemplate = (option) => {
+ return ;
+ };
+
+ const actionsBodyTemplate = (rowData) => {
+ return
+
+
+ }
+
+ const header = renderHeader();
+
+ return(
+
+ setFilters(e.filters)}>
+
+
+
+
+
+
+
+
+
+
+ )
+}
+
+export default PreInstructorSoccorsiTable;
diff --git a/src/pages/StatsBeneficiary/index.js b/src/pages/StatsBeneficiary/index.js
new file mode 100644
index 0000000..aab0e18
--- /dev/null
+++ b/src/pages/StatsBeneficiary/index.js
@@ -0,0 +1,107 @@
+import React, { useEffect, useState, useCallback } from 'react';
+import { __ } from '@wordpress/i18n';
+import { isEmpty, pathOr } from 'ramda';
+import NumberFlow from '@number-flow/react';
+
+// store
+import { useStore } from '../../store';
+
+// components
+//import PreInstructorSoccorsiTable from './components/PreInstructorSoccorsiTable';
+import DashboardService from '../../service/dashboard-service';
+import ChartDomandePerBando from '../../components/ChartDomandePerBando';
+import ChartStatoDomande from '../../components/ChartStatoDomande';
+import ChartDomandePerStato from '../../components/ChartDomandePerStato';
+
+const StatsBeneficiary = () => {
+ const [mainStats, setMainStats] = useState({});
+ const [chartStats, setChartStats] = useState({});
+ //const userData = useStore().main.userData();
+ const chosenCompanyId = useStore().main.chosenCompanyId();
+
+ const getStats = (resp) => {
+ if (resp.status === 'SUCCESS') {
+ setMainStats(resp.data.applicationWidget);
+ setChartStats(resp.data.applicationWidgetBars);
+ }
+ }
+
+ const errGetStats = () => {}
+
+ const getStatValue = useCallback((key, fallback = '') => {
+ return pathOr(fallback, [key], mainStats);
+ }, [mainStats]);
+
+ useEffect(() => {
+ DashboardService.getBeneficiaryStatsPage(chosenCompanyId, getStats, errGetStats);
+ }, []);
+console.log(chartStats)
+ return(
+
+
+
{__('Statistiche', 'gepafin')}
+
+
+
+
+
+
{__('Riepilogo', 'gepafin')}
+
+
+ {__('Domande presentate', 'gepafin')}
+
+
+
+ {__('Tasso di successo', 'gepafin')}
+
+
+
+ {__('Domande approvate', 'gepafin')}
+
+
+
+ {__('Importo totale finanziato', 'gepafin')}
+
+
+
+
+
+
+
+ {chartStats && !isEmpty(chartStats)
+ ?
+
{__('Statistiche di sistema', 'gepafin')}
+
+ {/**/}
+
+
+
: null}
+
+ )
+}
+
+export default StatsBeneficiary;
\ No newline at end of file
diff --git a/src/routes.js b/src/routes.js
index df80af3..f5555e3 100644
--- a/src/routes.js
+++ b/src/routes.js
@@ -50,6 +50,7 @@ import SoccorsoAddInstructorManager from './pages/SoccorsoAddInstructorManager';
import SoccorsoEditInstructorManager from './pages/SoccorsoEditInstructorManager';
import SoccorsoIstruttorioInstructorManager from './pages/SoccorsoIstruttorioInstructorManager';
import SoccorsoIstruttorioMioInstructorManager from './pages/SoccorsoIstruttorioMioInstructorManager';
+import StatsBeneficiary from './pages/StatsBeneficiary';
const routes = ({ role, chosenCompanyId }) => {
@@ -236,6 +237,12 @@ const routes = ({ role, chosenCompanyId }) => {
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
+
+ {'ROLE_SUPER_ADMIN' === role ? : null}
+ {'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_PRE_INSTRUCTOR' === role ? : null}
+ {'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
+ }/>
}/>
}/>
diff --git a/src/service/dashboard-service.js b/src/service/dashboard-service.js
index 5ad2f03..6453d4f 100644
--- a/src/service/dashboard-service.js
+++ b/src/service/dashboard-service.js
@@ -23,6 +23,9 @@ export default class DashboardService {
static getBeneficiaryStatsForCompany = (id, callback, errCallback) => {
NetworkService.get(`${API_BASE_URL}/dashboard/beneficiary/company/${id}`, callback, errCallback);
};
+ static getBeneficiaryStatsPage = (id, callback, errCallback) => {
+ NetworkService.get(`${API_BASE_URL}/dashboard/beneficiary/statistic/company/${id}`, callback, errCallback);
+ };
static getInstructorAmendmentsStats = (callback, errCallback, queryParams) => {
NetworkService.get(`${API_BASE_URL}/dashboard/instructor/amendment`, callback, errCallback, queryParams);
diff --git a/src/store/initial.js b/src/store/initial.js
index 14223f5..ea1fda5 100644
--- a/src/store/initial.js
+++ b/src/store/initial.js
@@ -17,6 +17,7 @@ const initialStore = {
formElements: [],
elementItems: [],
activeElement: '',
+ selectedElement: '',
draggingElementId: 0,
bandoCriteria: [],
// flow