diff --git a/src/assets/scss/components/appForm.scss b/src/assets/scss/components/appForm.scss
index 843e5b9..7989898 100644
--- a/src/assets/scss/components/appForm.scss
+++ b/src/assets/scss/components/appForm.scss
@@ -88,7 +88,9 @@
display: flex;
flex-direction: column;
gap: 14px;
+ }
+ > div:not(.appForm__field) {
label {
font-weight: 400;
}
diff --git a/src/assets/scss/components/flowBuilder.scss b/src/assets/scss/components/flowBuilder.scss
new file mode 100644
index 0000000..d4401fe
--- /dev/null
+++ b/src/assets/scss/components/flowBuilder.scss
@@ -0,0 +1,19 @@
+.flowBuilder__wrapper {
+ width: 100%;
+ height: 500px;
+}
+
+.nodeInitialForm {
+ padding: 10px 20px;
+ background-color: white;
+ border: 1px solid black;
+ border-radius: 4px;
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+
+ label {
+ font-size: 13px;
+ text-align: center;
+ }
+}
\ No newline at end of file
diff --git a/src/assets/scss/components/layout.scss b/src/assets/scss/components/layout.scss
index 9b246f2..79a50c0 100644
--- a/src/assets/scss/components/layout.scss
+++ b/src/assets/scss/components/layout.scss
@@ -10,7 +10,7 @@ body {
flex-direction: column;
flex-grow: 1;
margin: 0;
- font-family: 'Montserrat';
+ font-family: "Montserrat", sans-serif;
p, span:not(.p-button-label, .p-button-icon, .p-badge), input, label:not(.p-error), textarea, a, li, h1, h2, h3, h4, h5, h6, div, th, td {
color: var(--global-textColor);
diff --git a/src/assets/scss/components/reactFlow.scss b/src/assets/scss/components/reactFlow.scss
deleted file mode 100644
index 91514cb..0000000
--- a/src/assets/scss/components/reactFlow.scss
+++ /dev/null
@@ -1,4 +0,0 @@
-.reactFlow__wrapper {
- width: 100%;
- height: 500px;
-}
\ No newline at end of file
diff --git a/src/assets/scss/components/statsBigBadges.scss b/src/assets/scss/components/statsBigBadges.scss
index 92a806f..a77f6cf 100644
--- a/src/assets/scss/components/statsBigBadges.scss
+++ b/src/assets/scss/components/statsBigBadges.scss
@@ -7,6 +7,10 @@
grid-template-columns: repeat(2, 1fr);
gap: 1rem;
width: 100%;
+
+ &.grid-3 {
+ grid-template-columns: repeat(3, 1fr);
+ }
}
.statsBigBadges__grid .statsBigBadges__gridItem span {
diff --git a/src/assets/scss/theme.scss b/src/assets/scss/theme.scss
index abac453..362d6c4 100644
--- a/src/assets/scss/theme.scss
+++ b/src/assets/scss/theme.scss
@@ -36,4 +36,4 @@
@import "./components/formBuilder.scss";
@import "./components/misc.scss";
@import "./components/login.scss";
-@import "./components/reactFlow.scss";
\ No newline at end of file
+@import "./components/flowBuilder.scss";
\ No newline at end of file
diff --git a/src/components/FlowBuilder/components/NodeInitialForm/index.js b/src/components/FlowBuilder/components/NodeInitialForm/index.js
new file mode 100644
index 0000000..ad01314
--- /dev/null
+++ b/src/components/FlowBuilder/components/NodeInitialForm/index.js
@@ -0,0 +1,55 @@
+import React, { useEffect, useState } from 'react';
+import { Handle, Position } from '@xyflow/react';
+import { isEmpty, head } from 'ramda';
+
+// store
+import { storeGet, storeSet } from '../../../../store';
+
+const NodeInitialForm = ({ data: { id, label = '' } }) => {
+ const [options, setOptions] = useState([]);
+ const [value, setValue] = useState('');
+
+ const onChangeFn = (e) => {
+ const { value } = e.target;
+ const data = {
+ formId: String(id),
+ chosenField: value,
+ chosenValue: ''
+ }
+ setValue(value);
+ storeSet.main.addFlowData(data);
+ }
+
+ useEffect(() => {
+ const forms = storeGet.main.flowForms();
+ const form = head(forms.filter(o => String(o.id) === String(id)))
+ const relevantFields = form
+ ? form.content
+ .filter(o => ['radio', 'select'].includes(o.name))
+ .map(o => ({ name: o.id, label: o.label }))
+ : [];
+ setOptions(relevantFields);
+ }, [id]);
+
+ return (
+
+
+ {options && !isEmpty(options)
+ ? : null}
+
+
+ );
+}
+
+export default NodeInitialForm;
\ No newline at end of file
diff --git a/src/components/FlowBuilder/components/NodeIntermediateForm/index.js b/src/components/FlowBuilder/components/NodeIntermediateForm/index.js
new file mode 100644
index 0000000..ea53143
--- /dev/null
+++ b/src/components/FlowBuilder/components/NodeIntermediateForm/index.js
@@ -0,0 +1,71 @@
+import React, { useEffect, useState } from 'react';
+import { Handle, Position } from '@xyflow/react';
+import { head, isEmpty } from 'ramda';
+
+import { useStore, storeSet, storeGet } from '../../../../store';
+
+const NodeIntermediateForm = ({ data: { id, label = '' } }) => {
+ const flowEdges = useStore().main.flowEdges();
+ const flowData = useStore().main.flowData();
+ const [options, setOptions] = useState([]);
+ const [value, setValue] = useState('');
+
+ const onChangeFn = (e) => {
+ const { value } = e.target;
+ const data = {
+ formId: String(id),
+ chosenField: '',
+ chosenValue: value
+ }
+ setValue(value);
+ storeSet.main.addFlowData(data);
+ }
+
+ useEffect(() => {
+ const edge = head(flowEdges.filter(o => o.target === String(id)));
+ if (edge) {
+ const sourceForm = edge.source;
+ const sourceFormData = head(flowData.filter(o => o.formId === sourceForm));
+ const flowForms = storeGet.main.flowForms();
+ const form = head(flowForms.filter(o => String(o.id) === String(sourceForm)));
+ if (form && sourceFormData) {
+ const { chosenField } = sourceFormData;
+ const field = head(form.content.filter(o => o.id === chosenField));
+ if (field) {
+ const options = head(field.settings.filter(o => o.name === 'options'));
+ if (options) {
+ setOptions(options.value);
+ }
+ }
+ }
+
+ }
+ }, [flowEdges, flowData]);
+
+ return (
+
+
+
+ {options && !isEmpty(options)
+ ? : null}
+
+
+ );
+}
+
+export default NodeIntermediateForm;
\ No newline at end of file
diff --git a/src/components/FlowBuilder/index.js b/src/components/FlowBuilder/index.js
index 62b6292..dbc5935 100644
--- a/src/components/FlowBuilder/index.js
+++ b/src/components/FlowBuilder/index.js
@@ -1,19 +1,26 @@
import React, { useEffect, useState } from 'react';
import {
ReactFlow,
- Background,
- useNodesState,
- useEdgesState,
- addEdge,
- getIncomers,
- getOutgoers,
- getConnectedEdges,
+ Background
} from '@xyflow/react';
import { isEmpty } from 'ramda';
import '@xyflow/react/dist/style.css';
-const FlowBuilder = ({ initialForm = 0, finalForm = 0, forms = [], updateFn }) => {
+// store
+import { useStore, storeSet } from '../../store';
+
+// nodes
+import NodeInitialForm from './components/NodeInitialForm';
+import NodeIntermediateForm from './components/NodeIntermediateForm';
+
+const nodeTypes = {
+ initialForm: NodeInitialForm,
+ intermediateForm: NodeIntermediateForm
+};
+
+const FlowBuilder = ({ initialForm = 0, finalForm = 0 }) => {
+ const forms = useStore().main.flowForms();
const [nodes, setNodes] = useState([]);
const [edges, setEdges] = useState([]);
@@ -35,22 +42,23 @@ const FlowBuilder = ({ initialForm = 0, finalForm = 0, forms = [], updateFn }) =
if (o.id === initialForm) {
obj = {
id: String(o.id),
- type: 'input',
- data: { label: o.label },
+ type: 'initialForm',
+ data: { label: o.label, id: o.id },
position: { x: 0, y: 0 },
}
} else if (o.id === finalForm) {
obj = {
id: String(o.id),
type: 'output',
- data: { label: o.label },
+ data: { label: o.label, id: o.id },
position: { x: 0, y: 300 },
}
} else {
const x = coordinates.splice(0, 1);
obj = {
id: String(o.id),
- data: { label: o.label },
+ type: 'intermediateForm',
+ data: { label: o.label, id: o.id },
position: { x, y: 150 },
}
}
@@ -60,14 +68,14 @@ const FlowBuilder = ({ initialForm = 0, finalForm = 0, forms = [], updateFn }) =
let edges = [];
forms.map(o => {
if (o.id !== initialForm && o.id !== finalForm) {
- edges.push({ id: `${initialForm}->${o.id}`, source: String(initialForm), target: String(o.id) });
- edges.push({ id: `${o.id}->${finalForm}`, source: String(o.id), target: String(finalForm) });
+ edges.push({ id: `${initialForm}->${o.id}`, source: String(initialForm), target: String(o.id), type: 'smoothstep' });
+ edges.push({ id: `${o.id}->${finalForm}`, source: String(o.id), target: String(finalForm), type: 'smoothstep' });
}
});
setNodes(initialNodes);
setEdges(edges);
- updateFn(edges);
+ storeSet.main.flowEdges(edges);
} else {
setNodes([]);
setEdges([]);
@@ -76,13 +84,14 @@ const FlowBuilder = ({ initialForm = 0, finalForm = 0, forms = [], updateFn }) =
return (
!isEmpty(nodes) && !isEmpty(edges)
- ?
+ ?
diff --git a/src/components/FormFieldRepeaterFaq/index.js b/src/components/FormFieldRepeaterFaq/index.js
index 506e763..2c7dc94 100644
--- a/src/components/FormFieldRepeaterFaq/index.js
+++ b/src/components/FormFieldRepeaterFaq/index.js
@@ -27,6 +27,7 @@ const FormFieldRepeaterFaq = ({
const [stateOptionsData, setStateOptionsData] = useState([]);
const [question, setQuestion] = useState('');
const [answer, setAnswer] = useState('');
+ const [title, setTitle] = useState('');
const [editDataIndex, setEditDataIndex] = useState(null);
const [isVisibleEditDialog, setIsVisibleEditDialog] = useState(false);
@@ -37,14 +38,13 @@ const FormFieldRepeaterFaq = ({
const selectItem = (e) => {
const targetedOption = head(stateOptionsData.filter(o => o.value === e.value));
- console.log('selected:', e, stateOptionsData, targetedOption)
if (targetedOption) {
- setStateFieldData([...stateFieldData, targetedOption]);
+ setStateFieldData([...stateFieldData, {...targetedOption, isVisible: true}]);
}
}
const addNewItem = () => {
- const newItem = { id: null, lookUpDataId: null, title: '', value: '', isVisible: true };
+ const newItem = { id: null, lookUpDataId: null, title: '', value: '', response: '', isVisible: true };
setStateFieldData([...stateFieldData, newItem]);
}
@@ -76,6 +76,8 @@ const FormFieldRepeaterFaq = ({
const onChangeEditItem = (value, key) => {
if (key === 'title') {
+ setTitle(value);
+ } else if (key === 'value') {
setQuestion(value);
} else {
setAnswer(value)
@@ -85,8 +87,9 @@ const FormFieldRepeaterFaq = ({
const saveEditDialog = () => {
const newData = stateFieldData.map((o, i) => {
if (i === editDataIndex) {
- o.title = question;
- o.value = answer;
+ o.title = title;
+ o.value = question;
+ o.response = answer;
return o
} else {
return o;
@@ -106,7 +109,10 @@ const FormFieldRepeaterFaq = ({
const footerEditDialog = () => {
return
-
}
@@ -151,6 +157,7 @@ const FormFieldRepeaterFaq = ({
selectItem(e)}
optionDisabled={(opt) => usedExistingValues().includes(opt.title)}
options={stateOptionsData}
+ placeholder={__('Scegli tra quelli pre-creati', 'gepafin')}
optionLabel="title"/>
@@ -164,8 +171,13 @@ const FormFieldRepeaterFaq = ({
onLabel=""
offLabel=""
checked={o.isVisible}
- onChange={(e) => setChecked(e, i)}/>
- {o.title}
+ onChange={(e) => {
+ console.log('e', e);
+ e.preventDefault();
+ e.stopPropagation();
+ setChecked(e, i);
+ }}/>
+ {o.value}
- {o.value}
+ {o.response}
)}
@@ -192,11 +204,15 @@ const FormFieldRepeaterFaq = ({
- onChangeEditItem(e.target.value, 'title')}/>
+ onChangeEditItem(e.target.value, 'title')}/>
+
+
+
+ onChangeEditItem(e.target.value, 'value')}/>
- onChangeEditItem(e.target.value, 'value')}
+ onChangeEditItem(e.target.value, 'response')}
rows={5}
cols={30}/>
diff --git a/src/components/UnsavedChangesDetector/index.js b/src/components/UnsavedChangesDetector/index.js
index 04af05a..5de82f0 100644
--- a/src/components/UnsavedChangesDetector/index.js
+++ b/src/components/UnsavedChangesDetector/index.js
@@ -1,36 +1,29 @@
-import { useEffect, useState, useCallback } from 'react';
+import { useEffect } from 'react';
import { __ } from '@wordpress/i18n';
import equal from 'fast-deep-equal';
-// tools
+// store
+import { storeGet } from '../../store';
-const UnsavedChangesDetector = ({ initialData, getValuesFn }) => {
- const [initial, setInitial] = useState(initialData);
-
- const warnIfUnsavedChanges = useCallback((event) => {
- const updatedData = getValuesFn();
- const isEqual = equal(initial, updatedData);
+const UnsavedChangesDetector = ({ getValuesFn }) => {
+ const warnIfUnsavedChanges = (event) => {
+ const formData = getValuesFn();
+ const initial = storeGet.main.formInitialData();
+ const isEqual = equal(initial, formData);
+ console.log(initial, formData);
if (!isEqual) {
event.returnValue = __('You have unsaved changes. If you proceed, they will be lost.', 'gepafin');
}
return event.returnValue;
- }, [initialData]);
+ };
useEffect(() => {
- setInitial(initialData);
- }, [initialData])
-
- useEffect(() => {
- window.addEventListener('beforeunload', (e) => {
- warnIfUnsavedChanges(e);
- });
+ window.addEventListener('beforeunload', warnIfUnsavedChanges);
return () => {
- window.removeEventListener('beforeunload', (e) => {
- warnIfUnsavedChanges(e);
- });
+ window.removeEventListener('beforeunload', warnIfUnsavedChanges);
}
}, []);
}
diff --git a/src/layouts/DefaultLayout/components/AppSidebar/index.js b/src/layouts/DefaultLayout/components/AppSidebar/index.js
index fb46539..e12f005 100644
--- a/src/layouts/DefaultLayout/components/AppSidebar/index.js
+++ b/src/layouts/DefaultLayout/components/AppSidebar/index.js
@@ -10,6 +10,7 @@ import { NavLink } from 'react-router-dom';
const AppSidebar = () => {
const permissions = useStore().main.getPermissions();
+ const role = useStore().main.getRole();
const items = [
{
@@ -22,16 +23,24 @@ const AppSidebar = () => {
{
label: __('Gestione Bandi', 'gepafin'),
icon: 'pi pi-file',
- href: '/bandi',
+ href: '/tenders',
id: 2,
- enable: intersection(permissions, ['VIEW_CALLS', 'MANAGE_TENDERS']).length
+ enable: intersection(permissions, ['MANAGE_TENDERS']).length
+ },
+ {
+ label: __('Domande in lavorazione', 'gepafin'),
+ icon: 'pi pi-file',
+ href: '/bids',
+ id: 11,
+ enable: intersection(permissions, ['APPLY_CALLS']).length
},
{
label: __('Gestione Utenti', 'gepafin'),
icon: 'pi pi-users',
//href: '/utenti',
id: 3,
- enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length
+ enable: false
+ //enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length
},
{
label: __('Configurazione', 'gepafin'),
diff --git a/src/pages/Bandi/components/AllBandiTable/index.js b/src/pages/Bandi/components/AllBandiTable/index.js
index b1768c5..47b86c5 100644
--- a/src/pages/Bandi/components/AllBandiTable/index.js
+++ b/src/pages/Bandi/components/AllBandiTable/index.js
@@ -123,7 +123,7 @@ const AllBandiTable = () => {
};
const actionsBodyTemplate = (rowData) => {
- return
+ return
}
diff --git a/src/pages/Bandi/index.js b/src/pages/Bandi/index.js
index dee6056..56ef2db 100644
--- a/src/pages/Bandi/index.js
+++ b/src/pages/Bandi/index.js
@@ -10,7 +10,7 @@ const Bandi = () => {
const navigate = useNavigate();
const onGoToCreateNewBando = () => {
- navigate('/bandi/new');
+ navigate('/tenders/new');
}
return(
diff --git a/src/pages/BandoEdit/components/BandoEditFormStep1/index.js b/src/pages/BandoEdit/components/BandoEditFormStep1/index.js
index dbf8516..bfbeda2 100644
--- a/src/pages/BandoEdit/components/BandoEditFormStep1/index.js
+++ b/src/pages/BandoEdit/components/BandoEditFormStep1/index.js
@@ -39,7 +39,6 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors },
}, [formInitialData]), mode: 'onChange'
});
const values = getValues();
- let minDateStart = new Date();
const onSubmit = (formData) => {
if (!isNil(formData.dates) && formData.dates.length) {
@@ -57,7 +56,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors },
if (data.status === 'SUCCESS') {
const values = getValues();
if (!values.id && data.data.id) {
- navigate(`/bandi/${data.data.id}`);
+ navigate(`/tenders/${data.data.id}`);
} else {
setFormInitialData(data.data);
reset();
@@ -70,11 +69,11 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors },
}
const openPreview = () => {
- navigate(`/bandi/${values.id}/preview`);
+ navigate(`/tenders/${values.id}/preview`);
}
const openPreviewEvaluation = () => {
- navigate(`/bandi/${values.id}/preview-evaluation`);
+ navigate(`/tenders/${values.id}/preview-evaluation`);
}
const lookupdataCallback = (data) => {
@@ -125,6 +124,7 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors },
}, [errors, isValid]);
useEffect(() => {
+ storeSet.main.formInitialData(initialData);
setFormInitialData(initialData);
}, [initialData]);
@@ -142,13 +142,16 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, getFormErrors },
}
trigger().then(() => clearErrors());
- //storeSet.main.setAsyncRequest();
- LookupdataService.getItems(lookupdataCallback, errLookupdataCallback, [['type', ['AIMED_TO', 'FAQ']]])
+ LookupdataService.getItems(lookupdataCallback, errLookupdataCallback, [['type', ['AIMED_TO', 'FAQ']]]);
+
+ return () => {
+ storeSet.main.formInitialData({});
+ }
}, []);
return (
*/}
+
+ {__('Azioni rapide', 'gepafin')}
+
+
-
{__('Collegamenti rapidi', 'gepafin')}
-
@@ -89,7 +92,7 @@ const Dashboard = () => {
+ label={__('Configurazione', 'gepafin')} icon="pi pi-cog" iconPos="right"/>*/}
diff --git a/src/pages/DashboardBenefeciario/components/LatestUsersActivityTable/index.js b/src/pages/DashboardBenefeciario/components/LatestUsersActivityTable/index.js
deleted file mode 100644
index 6f4fedf..0000000
--- a/src/pages/DashboardBenefeciario/components/LatestUsersActivityTable/index.js
+++ /dev/null
@@ -1,123 +0,0 @@
-import React, { useState, useEffect} from 'react';
-import { __ } from '@wordpress/i18n';
-
-// 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';
-
-const LatestUsersActivityTable = () => {
- const [items, setItems] = useState(null);
- const [filters, setFilters] = useState(null);
- const [loading, setLoading] = useState(false);
- const [globalFilterValue, setGlobalFilterValue] = useState('');
-
- useEffect(() => {
- // TODO
- const bandi = [
- {
- date: '2024-08-02T00:00:00+14:32',
- email: 'mario.rossi@gepafin.it',
- action: 'Valutazione Domanda',
- details: 'Bando Innovazione 2024 - Domanda #123',
- id: 11
- },
- {
- date: '2024-08-01T00:00:00+08:23',
- email: 'laura.bianchi@gepafin.it',
- action: 'Creazione Bando',
- details: 'Nuovo bando "Formazione 2025" in bozza',
- id: 9
- }
- ]
- setItems(getFormattedBandiData(bandi));
- setLoading(false);
- initFilters();
- }, []);
-
- const getFormattedBandiData = (data) => {
- return [...(data || [])].map((d) => {
- d.date = new Date(d.date);
-
- 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 },
- email: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }] },
- date: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] },
- });
- setGlobalFilterValue('');
- };
-
- const renderHeader = () => {
- return (
-
-
-
-
-
-
-
- );
- };
-
- const dateBodyTemplate = (rowData) => {
- return formatDate(rowData.date);
- };
-
- const dateFilterTemplate = (options) => {
- return options.filterCallback(e.value, options.index)} dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999" />;
- };
-
- const header = renderHeader();
-
- return(
-
- setFilters(e.filters)}>
-
-
-
-
-
-
- )
-}
-
-export default LatestUsersActivityTable;
\ No newline at end of file
diff --git a/src/pages/DashboardBenefeciario/components/LatestBandiTable/index.js b/src/pages/DashboardBenefeciario/components/MyLatestSubmissionsTable/index.js
similarity index 75%
rename from src/pages/DashboardBenefeciario/components/LatestBandiTable/index.js
rename to src/pages/DashboardBenefeciario/components/MyLatestSubmissionsTable/index.js
index 79f0028..965f79d 100644
--- a/src/pages/DashboardBenefeciario/components/LatestBandiTable/index.js
+++ b/src/pages/DashboardBenefeciario/components/MyLatestSubmissionsTable/index.js
@@ -19,9 +19,10 @@ import { Button } from 'primereact/button';
import { Calendar } from 'primereact/calendar';
import { Tag } from 'primereact/tag';
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
+import { Link } from 'react-router-dom';
-const LatestBandiTable = () => {
+const MyLatestSubmissionsTable = () => {
const [items, setItems] = useState(null);
const [filters, setFilters] = useState(null);
const [loading, setLoading] = useState(false);
@@ -33,27 +34,19 @@ const LatestBandiTable = () => {
const items = [
{
name: 'Bando Innovazione 2024',
- start_date: '2024-08-08T00:00:00+00:00',
- end_date: '2024-08-30T00:00:00+00:00',
- submissions: 24,
- status: 'publish',
+ end_date: '2024-08-08T00:00:00+00:00',
+ modify_date: '2024-08-30T00:00:00+00:00',
+ progress: 50,
+ status: 'DRAFT',
id: 11
},
{
name: 'Bando Sostenibilità 2024',
- start_date: '2024-07-28T00:00:00+00:00',
- end_date: '2024-08-15T00:00:00+00:00',
- submissions: 35,
- status: 'publish',
+ end_date: '2024-07-28T00:00:00+00:00',
+ modify_date: '2024-08-15T00:00:00+00:00',
+ progress: 25,
+ status: 'DRAFT',
id: 9
- },
- {
- name: 'Bando A',
- start_date: '2024-06-28T00:00:00+00:00',
- end_date: '2024-06-15T00:00:00+00:00',
- submissions: 2,
- status: 'closed',
- id: 2
}
]
setItems(getFormattedBandiData(items));
@@ -64,7 +57,7 @@ const LatestBandiTable = () => {
const getFormattedBandiData = (data) => {
return [...(data || [])].map((d) => {
- d.start_date = new Date(d.start_date);
+ d.modify_date = new Date(d.modify_date);
d.end_date = new Date(d.end_date);
return d;
@@ -97,9 +90,8 @@ const LatestBandiTable = () => {
setFilters({
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
name: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }] },
- start_date: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] },
+ modify_date: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] },
end_date: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] },
- submissions: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.EQUALS }] },
status: { operator: FilterOperator.OR, constraints: [{ value: null, matchMode: FilterMatchMode.EQUALS }] },
});
setGlobalFilterValue('');
@@ -117,8 +109,8 @@ const LatestBandiTable = () => {
);
};
- const dateStartBodyTemplate = (rowData) => {
- return formatDate(rowData.start_date);
+ const dateModifyBodyTemplate = (rowData) => {
+ return formatDate(rowData.modify_date);
};
const dateEndBodyTemplate = (rowData) => {
@@ -145,6 +137,12 @@ const LatestBandiTable = () => {
return ;
};
+ const actionsBodyTemplate = (rowData) => {
+ return
+
+
+ }
+
const header = renderHeader();
return(
@@ -154,23 +152,25 @@ const LatestBandiTable = () => {
globalFilterFields={['name', 'status']}
header={header}
emptyMessage="Nothing found." onFilter={(e) => setFilters(e.filters)}>
-
-
-
-
+
+
+
)
}
-export default LatestBandiTable;
\ No newline at end of file
+export default MyLatestSubmissionsTable;
\ No newline at end of file
diff --git a/src/pages/DashboardBenefeciario/index.js b/src/pages/DashboardBenefeciario/index.js
index 02ae6bf..cd9d14a 100644
--- a/src/pages/DashboardBenefeciario/index.js
+++ b/src/pages/DashboardBenefeciario/index.js
@@ -3,27 +3,15 @@ import { __ } from '@wordpress/i18n';
import { useNavigate } from 'react-router-dom';
// components
-import LatestBandiTable from './components/LatestBandiTable';
-import LatestUsersActivityTable from './components/LatestUsersActivityTable';
+import LatestBandiTable from '../Dashboard/components/LatestBandiTable';
+import MyLatestSubmissionsTable from './components/MyLatestSubmissionsTable';
import { Button } from 'primereact/button';
const DashboardBenefeciario = () => {
const navigate = useNavigate();
- const onGoToCreateNewBando = () => {
- navigate('/bandi/new');
- }
-
- const onGoToUsers = () => {
- console.log('onGoToUsers')
- }
-
- const onGoToStats = () => {
- console.log('onGoToStats')
- }
-
- const onGoToSettings = () => {
- console.log('onGoToSettings')
+ const goToAllSubmissions = () => {
+ navigate('/bids/new');
}
return(
@@ -36,7 +24,7 @@ const DashboardBenefeciario = () => {
{__('Panoramica di Sistema', 'gepafin')}
-
+
{__('Domande attivi', 'gepafin')}
3
@@ -51,6 +39,46 @@ const DashboardBenefeciario = () => {
+
+
+
+
+
{__('Domande in lavorazione', 'gepafin')}
+
+
+
+
+
+
+
{__('Bandi disponibili', 'gepafin')}
+
+
+
+
+
+
+ {__('Azioni rapide', 'gepafin')}
+
+
+
+
+
+ {
+ }}
+ label={__('Carica documento', 'gepafin')} icon="pi pi-upload" iconPos="right"/>
+ {
+ }}
+ label={__('Contatta assistenza', 'gepafin')} icon="pi pi-envelope" iconPos="right"/>
+
+
)
}
diff --git a/src/pages/Login/index.js b/src/pages/Login/index.js
index 260510e..cc6a419 100644
--- a/src/pages/Login/index.js
+++ b/src/pages/Login/index.js
@@ -45,7 +45,7 @@ const Login = () => {
});
} else {
errorMsgs.current.show([
- { sticky: true, severity: 'error', summary: 'Error',
+ { sticky: true, severity: 'error', summary: '',
detail: data.message,
closable: true }
]);
@@ -55,7 +55,7 @@ const Login = () => {
const loginError = (err) => {
errorMsgs.current.show([
- { sticky: true, severity: 'error', summary: 'Error',
+ { sticky: true, severity: 'error', summary: '',
detail: sprintf(__('%s', 'gepafin'), err),
closable: true }
]);
diff --git a/src/routes.js b/src/routes.js
index 60d9290..8996b93 100644
--- a/src/routes.js
+++ b/src/routes.js
@@ -14,6 +14,7 @@ import BandoFormsEdit from './pages/BandoFormsEdit';
import BandoForms from './pages/BandoForms';
import BandoFormsPreview from './pages/BandoFormsPreview';
import BandoFlowEdit from './pages/BandoFlowEdit';
+import Bids from './pages/Bids';
const routes = ({ role }) => {
return (
@@ -23,30 +24,33 @@ const routes = ({ role }) => {
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
}/>
-
+
{'ROLE_SUPER_ADMIN' === role ? : null}
}/>
-
+
{'ROLE_SUPER_ADMIN' === role ? : null}
}/>
-
+
{'ROLE_SUPER_ADMIN' === role ? : null}
}/>
-
+
{'ROLE_SUPER_ADMIN' === role ? : null}
}/>
-
+
{'ROLE_SUPER_ADMIN' === role ? : null}
}/>
-
+
{'ROLE_SUPER_ADMIN' === role ? : null}
}/>
-
+
{'ROLE_SUPER_ADMIN' === role ? : null}
}/>
-
+
{'ROLE_SUPER_ADMIN' === role ? : null}
}/>
+
+ {'ROLE_BENEFICIARY' === role ? : null}
+ }/>
}/>
{/*}/>*/}
diff --git a/src/store/actions.js b/src/store/actions.js
index 32f42f0..8c7e9f2 100644
--- a/src/store/actions.js
+++ b/src/store/actions.js
@@ -42,5 +42,15 @@ export const actionsBeta = (set, get, api) => ({
const newElements = newFields.toSpliced(hoverIndex, 0, prevFields[dragIndex]);
set.formElements(newElements);
}
+ },
+ addFlowData: (data) => {
+ const initial = get.flowData();
+ const exists = initial ? initial.filter(o => o.formId === data.formId) : [];
+ if (exists.length) {
+ const newData = initial.map(o => o.formId === data.formId ? data : o);
+ set.flowData(newData);
+ } else {
+ set.flowData([...initial, data]);
+ }
}
});
diff --git a/src/store/initial.js b/src/store/initial.js
index 77d89dc..7004e05 100644
--- a/src/store/initial.js
+++ b/src/store/initial.js
@@ -5,12 +5,18 @@ const initialStore = {
// user
userData: {},
token: '',
+ // bando form
+ formInitialData: {},
// form builder
formId: 0,
formLabel: '',
formElements: [],
elementItems: [],
- activeElement: ''
+ activeElement: '',
+ // flow
+ flowData: [],
+ flowForms: [],
+ flowEdges: []
}
export default initialStore;
\ No newline at end of file
diff --git a/src/tempData.js b/src/tempData.js
index b04b89a..0f7c9a0 100644
--- a/src/tempData.js
+++ b/src/tempData.js
@@ -364,4 +364,52 @@ export const elementItems = [
custom: null
}
}
-]
\ No newline at end of file
+]
+
+const flowData = {
+ "initialForm":9,
+ "finalForm":13,
+ "flowData":[
+ {
+ "formId":"9",
+ "chosenField":"a0acf568c8",
+ "chosenValue":""
+ },
+ {
+ "formId":"12",
+ "chosenField":"",
+ "chosenValue":"o8bf116e28"
+ },
+ {
+ "formId":"11",
+ "chosenField":"",
+ "chosenValue":"o1eb76229d"
+ }
+ ],
+ "flowEdges":[
+ {
+ "id":"9->12",
+ "source":"9",
+ "target":"12",
+ "type":"smoothstep"
+ },
+ {
+ "id":"12->13",
+ "source":"12",
+ "target":"13",
+ "type":"smoothstep"
+ },
+ {
+ "id":"9->11",
+ "source":"9",
+ "target":"11",
+ "type":"smoothstep"
+ },
+ {
+ "id":"11->13",
+ "source":"11",
+ "target":"13",
+ "type":"smoothstep"
+ }
+ ]
+}
\ No newline at end of file