diff --git a/src/App.js b/src/App.js
index 7d3a901..ad0f6ef 100644
--- a/src/App.js
+++ b/src/App.js
@@ -4,7 +4,8 @@ import Routes from './routes';
import { createI18n, setLocaleData } from '@wordpress/i18n';
import { I18nProvider } from '@wordpress/react-i18n';
import './assets/scss/theme.scss';
-import { isEmpty, head } from 'ramda'
+import { isEmpty, head } from 'ramda';
+import { addLocale, PrimeReactProvider } from 'primereact/api';
// store
import { useStore, storeSet, storeGet } from './store';
@@ -18,6 +19,9 @@ function App() {
const role = useStore().main.getRole();
const chosenCompanyId = useStore().main.chosenCompanyId();
const isRedirectedOnceNoCompany = useStore().main.isRedirectedOnceNoCompany();
+ const value = {
+ locale: 'it',
+ };
const callback = (data) => {
if (data.status === 'SUCCESS') {
@@ -33,7 +37,7 @@ function App() {
}
useEffect(() => {
- if (role === 'ROLE_BENEFICIARY') {
+ if (['ROLE_BENEFICIARY', 'ROLE_CONFIDI'].includes(role)) {
const userData = storeGet.main.userData();
if (userData.companies && !isEmpty(userData.companies)) {
storeSet.main.companies(userData.companies);
@@ -59,6 +63,51 @@ function App() {
storeSet.main.setAsyncRequest();
AuthenticationService.me(callback, errCallback);
+ addLocale('it', {
+ startsWith: 'Inizia con',
+ contains: 'Contiene',
+ notContains: 'Non contiene',
+ endsWith: 'Finisce con',
+ equals: 'Uguale a',
+ notEquals: 'Diverso da',
+ noFilter: 'Nessun filtro',
+ lt: 'Minore di',
+ lte: 'Minore o uguale a',
+ gt: 'Maggiore di',
+ gte: 'Maggiore o uguale a',
+ dateIs: 'Data uguale a',
+ dateIsNot: 'Data diversa da',
+ dateBefore: 'Data prima di',
+ dateAfter: 'Data dopo',
+ custom: 'Personalizzato',
+ clear: 'Cancella',
+ apply: 'Applica',
+ matchAll: 'Tutte le condizioni',
+ matchAny: 'Qualsiasi condizione',
+ addRule: 'Aggiungi regola',
+ removeRule: 'Rimuovi regola',
+ accept: 'Sì',
+ reject: 'No',
+ choose: 'Scegli',
+ upload: 'Carica',
+ cancel: 'Annulla',
+ dayNames: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
+ dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'],
+ dayNamesMin: ['D', 'L', 'M', 'M', 'G', 'V', 'S'],
+ monthNames: ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'],
+ monthNamesShort: ['Gen', 'Feb', 'Mar', 'Apr', 'Mag', 'Giu', 'Lug', 'Ago', 'Set', 'Ott', 'Nov', 'Dic'],
+ today: 'Oggi',
+ weekHeader: 'Sm',
+ firstDayOfWeek: 1,
+ dateFormat: 'dd/mm/yy',
+ weak: 'Debole',
+ medium: 'Medio',
+ strong: 'Forte',
+ passwordPrompt: 'Inserisci una password',
+ emptyMessage: 'Nessun risultato trovato',
+ emptyFilterMessage: 'Nessun risultato trovato'
+ });
+
fetch('/languages/en_US.json')
.then((res) => res.json())
.then(res => {
@@ -69,7 +118,9 @@ function App() {
return (
-
+
+
+
);
diff --git a/src/assets/scss/components/appForm.scss b/src/assets/scss/components/appForm.scss
index dad056e..c6bef3f 100644
--- a/src/assets/scss/components/appForm.scss
+++ b/src/assets/scss/components/appForm.scss
@@ -109,6 +109,51 @@
background-color: var(--table-border-color)
}
}
+
+ &.fileselect {
+ .fileselectInner {
+ flex-direction: row;
+ display: flex;
+ gap: 1rem;
+
+ > div {
+ flex: 1 1 50%;
+ }
+ }
+
+ .fileselectInner__selectionBox {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ }
+
+ .fileselectInner__selectedFiles {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+
+ p {
+ margin: 0;
+ font-weight: bold;
+ font-size: 14px;
+ }
+
+ ul {
+ margin: 0;
+ padding: 0;
+ display: flex;
+ flex-direction: column;
+ gap: 7px;
+
+ li {
+ display: flex;
+ gap: 1rem;
+ justify-content: space-between;
+ align-items: center;
+ }
+ }
+ }
+ }
}
.appForm__field--required.appForm__field--required {
diff --git a/src/assets/scss/components/appPage.scss b/src/assets/scss/components/appPage.scss
index a07df79..a608ea4 100644
--- a/src/assets/scss/components/appPage.scss
+++ b/src/assets/scss/components/appPage.scss
@@ -113,6 +113,10 @@
font-weight: 600;
line-height: normal;
margin: 0 0 24px;
+ display: flex;
+ gap: 1rem;
+ flex-wrap: wrap;
+ align-items: center;
}
h3 {
diff --git a/src/assets/scss/components/misc.scss b/src/assets/scss/components/misc.scss
index 030a350..03bd8f8 100644
--- a/src/assets/scss/components/misc.scss
+++ b/src/assets/scss/components/misc.scss
@@ -167,6 +167,13 @@
}
}
+.p-column-filter-overlay .p-column-filter-row-items .p-column-filter-row-item.p-highlight {
+ color: white;
+}
+.p-listbox .p-listbox-list .p-listbox-item.p-highlight {
+ color: white;
+}
+
.p-inputnumber-input[readonly] {
background-color: #e1e1e1;
}
diff --git a/src/components/DataTableAsync/DataTableAsync.js b/src/components/DataTableAsync/DataTableAsync.js
new file mode 100644
index 0000000..8e6bb34
--- /dev/null
+++ b/src/components/DataTableAsync/DataTableAsync.js
@@ -0,0 +1,105 @@
+import React, { useEffect, useState } from 'react';
+import { __ } from '@wordpress/i18n';
+
+import translationStrings from '../../translationStringsForComponents';
+
+// components
+import { DataTable } from 'primereact/datatable';
+import { Column } from 'primereact/column';
+import { Button } from 'primereact/button';
+import BandoService from '../../service/bando-service';
+
+const DataTableAsync = () => {
+ const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
+ const [items, setItems] = useState(null);
+ const [totalRecordsNum, setTotalRecordsNum] = useState(0);
+ const [lazyState, setLazyState] = useState({
+ first: 0,
+ rows: 5,
+ page: 1,
+ sortField: null,
+ sortOrder: null,
+ filters: {
+ name: { value: '', matchMode: 'contains' }
+ }
+ });
+
+ const getPaginationQuery = () => {
+ return {
+ "globalFilters": {
+ "page": 0,
+ "limit": lazyState.rows,
+ "sortBy": {
+ "columnName": "ID",
+ "sortDesc": true
+ }
+ }
+ }
+ }
+
+ const onPage = (event) => {
+ setLazyState(event);
+ };
+
+ const onSort = (event) => {
+ setLazyState(event);
+ };
+
+ const onFilter = (event) => {
+ event['first'] = 0;
+ setLazyState(event);
+ };
+
+ const getCallback = (data) => {
+ if (data.status === 'SUCCESS') {
+ const { body, totalRecords, currentPage, totalPages, pageSize } = data.data;
+ setTotalRecordsNum(totalRecords);
+ const newItems = body.filter(o => o.status === 'PUBLISH');
+ setItems(getFormattedBandiData(newItems));
+ }
+ setLocalAsyncRequest(false);
+ }
+
+ const errGetCallbacks = (data) => {
+ setLocalAsyncRequest(false);
+ }
+
+ const getFormattedBandiData = (data) => {
+ return [...(data || [])].map((d) => {
+ d.start_date = new Date(d.dates[0]);
+ d.end_date = new Date(d.dates[1]);
+
+ return d;
+ });
+ };
+
+ useEffect(() => {
+ console.log(lazyState)
+ }, [lazyState]);
+
+ useEffect(() => {
+ if (!localAsyncRequest) {
+ setLocalAsyncRequest(true);
+ const paginationQuery = getPaginationQuery();
+ BandoService.getBandiPaginated(paginationQuery, getCallback, errGetCallbacks);
+ }
+ }, []);
+
+ return (
+
+
+
+
+
+ )
+}
+
+export default DataTableAsync;
\ No newline at end of file
diff --git a/src/components/FormField/components/FileSelect/index.js b/src/components/FormField/components/FileSelect/index.js
new file mode 100644
index 0000000..089b625
--- /dev/null
+++ b/src/components/FormField/components/FileSelect/index.js
@@ -0,0 +1,212 @@
+import React, { useCallback, useEffect, useRef, useState } from 'react';
+import { classNames } from 'primereact/utils';
+import { __ } from '@wordpress/i18n';
+import { isEmpty, pathOr, pluck } from 'ramda';
+
+// service
+import FileUploadService from '../../../../service/file-upload-service';
+import CompanyDocumentsService from '../../../../service/company-documents-service';
+
+// components
+import { ListBox } from 'primereact/listbox';
+import { Button } from 'primereact/button';
+import { Link } from 'react-router-dom';
+import { ConfirmPopup, confirmPopup } from 'primereact/confirmpopup';
+
+const FileSelect = ({
+ fieldName,
+ label,
+ setDataFn,
+ register,
+ errors,
+ defaultValue,
+ config = {},
+ infoText = null,
+ disabled = false,
+ options = [],
+ sourceId = 0,
+ source = 'DOCUMENT',
+ documentCategories = [],
+ saveFormCallback
+ }) => {
+ //const [stateFieldData, setStateFieldData] = useState([]);
+ const stateFieldData = useRef([]);
+ const [selectedUnconfirmed, setSelectedUnconfirmed] = useState([]);
+ const [optionsTransformed, setOptionsTransformed] = useState([]);
+ const [loading, setLoading] = useState(false);
+ const [addNewMode, setAddNewMode] = useState(false);
+
+ const attachSelectedFiles = useCallback(() => {
+ const existingIds = pluck('id', stateFieldData.current);
+ const selectedToBeAdded = selectedUnconfirmed.filter(o => !existingIds.includes(o.id));
+ setSelectedUnconfirmed([]);
+
+ setLoading(true);
+ // eslint-disable-next-line array-callback-return
+ selectedToBeAdded.map(o => {
+ CompanyDocumentsService.attachCompanyDocumentToAppl(o.id, callback, errCallback, [
+ ['applicationId', sourceId],
+ ['documentType', source]
+ ])
+ });
+ setAddNewMode(false);
+ }, [selectedUnconfirmed]);
+
+ const doGoBackToListOfFiles = () => {
+ setSelectedUnconfirmed([]);
+ setAddNewMode(false);
+ }
+
+ const callback = (resp) => {
+ if (resp.status === 'SUCCESS') {
+ stateFieldData.current = [...stateFieldData.current, resp.data];
+ setDataFn(fieldName, stateFieldData.current, { shouldValidate: true });
+ saveFormCallback();
+ }
+ setLoading(false);
+ }
+
+ const errCallback = () => {
+ setLoading(false);
+ }
+
+ const removeAttached = (id) => {
+ FileUploadService.deleteFile(
+ {},
+ (data) => deleteCallback(data, id),
+ deleteErrorCallback,
+ [['id', id]]
+ );
+ }
+
+ const deleteCallback = (data, id) => {
+ if (data.status === 'SUCCESS') {
+ stateFieldData.current = stateFieldData.current.filter(o => id !== o.id);
+ setDataFn(fieldName, stateFieldData.current, { shouldValidate: true });
+ saveFormCallback();
+ }
+ }
+
+ const deleteErrorCallback = (err) => {
+ console.log('err', err);
+ }
+
+ const confirmDelete = (event, id) => {
+ confirmPopup({
+ target: event.currentTarget,
+ message: __('Sei sicuro di cancellare il file?', 'gepafin'),
+ acceptLabel: __('Si', 'gepafin'),
+ icon: 'pi pi-info-circle',
+ defaultFocus: 'reject',
+ acceptClassName: 'p-button-danger',
+ accept: () => removeAttached(id),
+ reject: () => {}
+ });
+ };
+
+ useEffect(() => {
+ stateFieldData.current = defaultValue;
+ register(fieldName, config)
+ }, []);
+
+ useEffect(() => {
+ if (!isEmpty(options)) {
+ const optionsDefault = options
+ .filter(o => isEmpty(documentCategories)
+ ? o
+ : documentCategories.includes(o.category.id))
+ .reduce((acc, cur) => {
+ const catName = pathOr('', ['category', 'categoryName'], cur);
+ const catLabel = pathOr('', ['category', 'description'], cur);
+
+ if (!acc[catName]) {
+ acc[catName] = {
+ code: catName,
+ label: catLabel,
+ items: []
+ };
+ }
+ acc[catName].items.push(cur)
+ return acc;
+ }, {});
+
+ setOptionsTransformed(Object.values(optionsDefault));
+ }
+ }, [options]);
+
+ useEffect(() => {
+ stateFieldData.current = defaultValue;
+ }, [defaultValue]);
+ //console.log([...stateFieldData.current])
+ return (
+ <>
+
+
+ {addNewMode
+ ?
+ setSelectedUnconfirmed(e.value)}
+ options={optionsTransformed}
+ optionLabel="name"
+ optionGroupLabel="label"
+ optionGroupChildren="items"
+ className="w-full md:w-14rem"
+ listStyle={{ maxHeight: '130px' }}/>
+ {!isEmpty(selectedUnconfirmed)
+ ?
+ : }
+
: null}
+ {!isEmpty(optionsTransformed) && !addNewMode
+ ?
+
{__('I file selezionati')}
+
+
: null}
+
+ {isEmpty(optionsTransformed)
+ ?
+
+ {__('I file caricati sulla pagina Documenti saranno disponibili qui. ', 'gepafin')}
+
+ {__('Vai alla pagina Documenti', 'gepafin')}
+
+
+
+ : null}
+ {infoText ? {infoText} : null}
+
+ >)
+}
+
+export default FileSelect;
\ No newline at end of file
diff --git a/src/components/FormField/components/Fileupload/index.js b/src/components/FormField/components/Fileupload/index.js
index 0bdcfeb..49cf709 100644
--- a/src/components/FormField/components/Fileupload/index.js
+++ b/src/components/FormField/components/Fileupload/index.js
@@ -16,6 +16,7 @@ import { Button } from 'primereact/button';
import { defaultMaxFileSize, mimeTypes } from '../../../../configData';
import getFormatedFileSizeText from '../../../../helpers/getFormatedFileSizeText';
+import { ConfirmPopup, confirmPopup } from 'primereact/confirmpopup';
const Fileupload = ({
fieldName,
@@ -72,6 +73,20 @@ const Fileupload = ({
console.log('err', err);
}
+ const confirmDelete = (event, file) => {
+ console.log('confirmDelete', file)
+ confirmPopup({
+ target: event.currentTarget,
+ message: __('Sei sicuro di cancellare il file?', 'gepafin'),
+ acceptLabel: __('Si', 'gepafin'),
+ icon: 'pi pi-info-circle',
+ defaultFocus: 'reject',
+ acceptClassName: 'p-button-danger',
+ accept: () => onTemplateRemove(file),
+ reject: () => {}
+ });
+ };
+
const itemTemplate = (file) => {
let fileName = file.fileName ? file.fileName : file.name;
return (
@@ -91,7 +106,7 @@ const Fileupload = ({
type="button"
disabled={disabled}
aria-label={__('Anulla', 'gepafin')}
- onClick={() => onTemplateRemove(file)}/>
+ onClick={(e) => confirmDelete(e, file)}/>
);
@@ -213,6 +228,7 @@ const Fileupload = ({
onBeforeSelect={onBeforeSelect}
uploadHandler={customBase64Uploader}/>
{infoText ? {infoText} : null}
+
>
: null
)
diff --git a/src/components/FormField/components/Wysiwyg/index.js b/src/components/FormField/components/Wysiwyg/index.js
index 8c33a69..35252b0 100644
--- a/src/components/FormField/components/Wysiwyg/index.js
+++ b/src/components/FormField/components/Wysiwyg/index.js
@@ -8,6 +8,7 @@ import { __ } from '@wordpress/i18n';
import { Editor } from 'primereact/editor';
import BlockingOverlay from '../../../BlockingOverlay';
import { Button } from 'primereact/button';
+import { isNil } from 'ramda';
const Delta = Quill.import('delta');
@@ -53,15 +54,17 @@ const Wysiwyg = ({
<>
-
+ {!isNil(setDataFn)
+ ? : null}
({insert: op.insert}));
+ [Node.ELEMENT_NODE, function (node, delta) {
+ const ops = delta.ops.map((op) => ({ insert: op.insert }));
return new Delta(ops)
}]
]
diff --git a/src/components/FormField/index.js b/src/components/FormField/index.js
index 6a60658..e9d7fbd 100644
--- a/src/components/FormField/index.js
+++ b/src/components/FormField/index.js
@@ -18,6 +18,7 @@ import Fileupload from './components/Fileupload';
import Table from './components/Table';
import PasswordField from './components/PasswordField';
import CriteriaTable from './components/CriteriaTable';
+import FileSelect from './components/FileSelect';
const FormField = (props) => {
const fields = {
@@ -35,7 +36,8 @@ const FormField = (props) => {
checkboxes: Checkboxes,
table: Table,
criteria_table: CriteriaTable,
- password: PasswordField
+ password: PasswordField,
+ fileselect: FileSelect,
}
const Comp = !isNil(fields[props.type]) ? fields[props.type] : null;
diff --git a/src/components/TopBarProfileMenu/index.js b/src/components/TopBarProfileMenu/index.js
index 296527a..3aee326 100644
--- a/src/components/TopBarProfileMenu/index.js
+++ b/src/components/TopBarProfileMenu/index.js
@@ -55,7 +55,7 @@ const TopBarProfileMenu = ({ menuLeftRef }) => {
command: () => {
navigate('/profilo-aziendale')
},
- enable: intersection(permissions, ['APPLY_CALLS']).length && companies.length > 0
+ enable: intersection(permissions, ['APPLY_CALLS', 'APPLY_CONFIDI_CALLS']).length && companies.length > 0
},
{
label: __('Seleziona azienda', 'gepafin'),
@@ -67,7 +67,7 @@ const TopBarProfileMenu = ({ menuLeftRef }) => {
command: () => {
navigate('/agguingi-azienda')
},
- enable: intersection(permissions, ['APPLY_CALLS']).length
+ enable: intersection(permissions, ['APPLY_CALLS', 'APPLY_CONFIDI_CALLS']).length
},
{
separator: true,
diff --git a/src/configData.js b/src/configData.js
index dbed67c..6e5efda 100644
--- a/src/configData.js
+++ b/src/configData.js
@@ -207,6 +207,21 @@ export const classificationType = [
'name': 'ALTRO',
'idTipoprotocollo': 1
},
+ {
+ 'idClassificazione': 135,
+ 'name': 'DOMANDA PDF FIRMATO',
+ 'idTipoprotocollo': 1
+ },
+ {
+ 'idClassificazione': 136,
+ 'name': 'DELEGA-PROCURA BANDI',
+ 'idTipoprotocollo': 1
+ },
+ {
+ 'idClassificazione': 137,
+ 'name': 'DIGITAL ASSESMENT',
+ 'idTipoprotocollo': 1
+ },
{
'idClassificazione': 202,
'name': 'LETTERA DI GARANZIA',
diff --git a/src/helpers/getBandoLabel.js b/src/helpers/getBandoLabel.js
index 7cbf3bf..e379402 100644
--- a/src/helpers/getBandoLabel.js
+++ b/src/helpers/getBandoLabel.js
@@ -14,6 +14,9 @@ const getBandoLabel = (status) => {
case 'APPROVED':
return __('Approvato', 'gepafin');
+ case 'VALID':
+ return __('Valido', 'gepafin');
+
case 'READY_TO_PUBLISH':
return __('Pronto', 'gepafin');
@@ -29,6 +32,12 @@ const getBandoLabel = (status) => {
case 'ADMISSIBLE':
return __('Ammisibile', 'gepafin');
+ case 'TECHNICAL_EVALUATION':
+ return __('Valutazione technico-finanziaria', 'gepafin');
+
+ case 'DUE':
+ return __('In scadenza', 'gepafin');
+
case 'RESPONSE_RECEIVED':
return __('Riposta ricevuta', 'gepafin');
diff --git a/src/helpers/getBandoSeverity.js b/src/helpers/getBandoSeverity.js
index 03b8704..115ab3b 100644
--- a/src/helpers/getBandoSeverity.js
+++ b/src/helpers/getBandoSeverity.js
@@ -12,6 +12,9 @@ const getBandoSeverity = (status) => {
case 'APPROVED':
return 'success';
+ case 'VALID':
+ return 'success';
+
case 'READY_TO_PUBLISH':
return 'info';
@@ -27,6 +30,12 @@ const getBandoSeverity = (status) => {
case 'ADMISSIBLE':
return 'info';
+ case 'TECHNICAL_EVALUATION':
+ return 'info';
+
+ case 'DUE':
+ return 'warning';
+
case 'RESPONSE_RECEIVED':
return 'warning';
diff --git a/src/helpers/getFormattedDateString.js b/src/helpers/getFormattedDateString.js
new file mode 100644
index 0000000..97c03f9
--- /dev/null
+++ b/src/helpers/getFormattedDateString.js
@@ -0,0 +1,9 @@
+const getFormattedDateString = (value) => {
+ return value.toLocaleDateString('it-IT', {
+ day: '2-digit',
+ month: '2-digit',
+ year: 'numeric'
+ });
+};
+
+export default getFormattedDateString;
\ No newline at end of file
diff --git a/src/layouts/DefaultLayout/components/AppSidebar/index.js b/src/layouts/DefaultLayout/components/AppSidebar/index.js
index c449022..840e734 100644
--- a/src/layouts/DefaultLayout/components/AppSidebar/index.js
+++ b/src/layouts/DefaultLayout/components/AppSidebar/index.js
@@ -32,21 +32,21 @@ const AppSidebar = () => {
icon: 'pi pi-file',
href: '/imieibandi',
id: 3,
- enable: intersection(permissions, ['APPLY_CALLS']).length
+ enable: intersection(permissions, ['APPLY_CALLS', 'APPLY_CONFIDI_CALLS']).length
},
{
label: __('Bandi disponibili', 'gepafin'),
icon: 'pi pi-bookmark',
href: '/bandi',
id: 4,
- enable: intersection(permissions, ['VIEW_CALLS']).length
+ enable: intersection(permissions, ['VIEW_CALLS', 'VIEW_CONFIDI_CALLS']).length
},
{
label: __('Bandi osservati', 'gepafin'),
icon: 'pi pi-star',
href: '/bandi-osservati',
id: 5,
- enable: intersection(permissions, ['VIEW_CALLS']).length
+ enable: intersection(permissions, ['VIEW_CALLS', 'VIEW_CONFIDI_CALLS']).length
},
{
label: __('Gestione domande', 'gepafin'),
@@ -81,7 +81,7 @@ const AppSidebar = () => {
icon: 'pi pi-briefcase',
href: '/domande',
id: 10,
- enable: intersection(permissions, ['APPLY_CALLS']).length
+ enable: intersection(permissions, ['APPLY_CALLS', 'APPLY_CONFIDI_CALLS']).length
},
{
label: __('Archivio domande', 'gepafin'),
@@ -136,7 +136,14 @@ const AppSidebar = () => {
icon: 'pi pi-chart-bar',
href: '/stats',
id: 15,
- enable: intersection(permissions, ['APPLY_CALLS']).length
+ enable: intersection(permissions, ['APPLY_CALLS', 'APPLY_CONFIDI_CALLS']).length
+ },
+ {
+ label: __('Documenti', 'gepafin'),
+ icon: 'pi pi-folder-open',
+ href: '/documenti',
+ id: 16,
+ enable: intersection(permissions, ['APPLY_CALLS', 'APPLY_CONFIDI_CALLS']).length
},
{
label: __('Log di Sistema', 'gepafin'),
diff --git a/src/layouts/DefaultLayout/index.js b/src/layouts/DefaultLayout/index.js
index f144a45..fa38644 100644
--- a/src/layouts/DefaultLayout/index.js
+++ b/src/layouts/DefaultLayout/index.js
@@ -3,7 +3,7 @@ import { __ } from '@wordpress/i18n';
import { useLocation } from 'react-router-dom';
// store
-import { useStore, storeSet } from '../../store';
+import { useStore, storeSet, storeGet } from '../../store';
// components
import AppSidebar from './components/AppSidebar';
diff --git a/src/pages/BandiBeneficiario/components/AllBandiAccordion/index.js b/src/pages/BandiBeneficiario/components/AllBandiAccordion/index.js
index 8218845..60edd5c 100644
--- a/src/pages/BandiBeneficiario/components/AllBandiAccordion/index.js
+++ b/src/pages/BandiBeneficiario/components/AllBandiAccordion/index.js
@@ -1,6 +1,6 @@
import React, { useState, useEffect} from 'react';
import { __, sprintf } from '@wordpress/i18n';
-import { is, uniq, isNil, isEmpty } from 'ramda';
+import { is, uniq, isNil, isEmpty, head } from 'ramda';
import { wrap } from 'object-path-immutable';
import { useNavigate } from 'react-router-dom';
@@ -37,6 +37,7 @@ const REACT_APP_HUB_ID = process.env.REACT_APP_HUB_ID;
const AllBandiAccordion = ({ showOnlyPreferred = false }) => {
const chosenCompanyId = useStore().main.chosenCompanyId();
+ const companies = useStore().main.companies();
const isAsyncRequest = useStore().main.isAsyncRequest();
const [items, setItems] = useState(null);
const [filters, setFilters] = useState(null);
@@ -45,11 +46,15 @@ const AllBandiAccordion = ({ showOnlyPreferred = false }) => {
const navigate = useNavigate();
useEffect(() => {
- storeSet.main.setAsyncRequest();
- BandoService.getBandi(getCallback, errGetCallbacks, [
- ['companyId', chosenCompanyId],
- ['onlyPreferredCall', showOnlyPreferred]
- ]);
+ const existingCompany = head(companies.filter(o => o.id === chosenCompanyId));
+
+ if (existingCompany && !isAsyncRequest) {
+ storeSet.main.setAsyncRequest();
+ BandoService.getBandi(getCallback, errGetCallbacks, [
+ ['companyId', chosenCompanyId],
+ ['onlyPreferredCall', showOnlyPreferred]
+ ]);
+ }
}, [chosenCompanyId]);
const getCallback = (data) => {
diff --git a/src/pages/BandiPreferredBeneficiario/components/AllBandiPreferredAccordion/index.js b/src/pages/BandiPreferredBeneficiario/components/AllBandiPreferredAccordion/index.js
index 874f9e0..c576d1b 100644
--- a/src/pages/BandiPreferredBeneficiario/components/AllBandiPreferredAccordion/index.js
+++ b/src/pages/BandiPreferredBeneficiario/components/AllBandiPreferredAccordion/index.js
@@ -1,6 +1,6 @@
import React, { useState, useEffect} from 'react';
import { __ } from '@wordpress/i18n';
-import { is, uniq, isNil, isEmpty } from 'ramda';
+import { is, uniq, isNil, isEmpty, head } from 'ramda';
import { wrap } from 'object-path-immutable';
import { useNavigate } from 'react-router-dom';
@@ -30,6 +30,7 @@ import translationStrings from '../../../../translationStringsForComponents';
const AllBandiPreferredAccordion = () => {
const chosenCompanyId = useStore().main.chosenCompanyId();
+ const companies = useStore().main.companies();
const isAsyncRequest = useStore().main.isAsyncRequest();
const [items, setItems] = useState(null);
const [filters, setFilters] = useState(null);
@@ -38,12 +39,16 @@ const AllBandiPreferredAccordion = () => {
const navigate = useNavigate();
useEffect(() => {
- storeSet.main.setAsyncRequest();
- const userData = storeGet.main.userData();
- PreferredBandoService.getPreferredCalls(getCallback, errGetCallbacks, [
- ['companyId', chosenCompanyId],
- ['userId', userData.id]
- ]);
+ const existingCompany = head(companies.filter(o => o.id === chosenCompanyId));
+
+ if (existingCompany) {
+ storeSet.main.setAsyncRequest();
+ const userData = storeGet.main.userData();
+ PreferredBandoService.getPreferredCalls(getCallback, errGetCallbacks, [
+ ['companyId', chosenCompanyId],
+ ['userId', userData.id]
+ ]);
+ }
}, [chosenCompanyId]);
const getCallback = (data) => {
diff --git a/src/pages/BandoApplication/index.js b/src/pages/BandoApplication/index.js
index 1b815f8..4b526eb 100644
--- a/src/pages/BandoApplication/index.js
+++ b/src/pages/BandoApplication/index.js
@@ -1,7 +1,7 @@
import React, { useState, useEffect, useRef, useMemo } from 'react';
import { __, sprintf } from '@wordpress/i18n';
import { useParams } from 'react-router-dom';
-import { head, is, pluck, isEmpty, pathOr, isNil } from 'ramda';
+import { head, is, pluck, isEmpty, pathOr, isNil, uniqBy } from 'ramda';
import { useForm } from 'react-hook-form';
import 'quill/dist/quill.core.css';
import { wrap } from 'object-path-immutable';
@@ -14,6 +14,7 @@ import { storeSet, storeGet, useStore } from '../../store';
// api
import ApplicationService from '../../service/application-service';
+import CompanyDocumentsService from '../../service/company-documents-service';
// tools
import {
@@ -64,6 +65,8 @@ const BandoApplication = () => {
const [applicationStatus, setApplicationStatus] = useState('');
const [activeStep, setActiveStep] = useState(1);
const [signedPdfFile, setSignedPdfFile] = useState([]);
+ const [companyDocs, setCompanyDocs] = useState([]);
+ const [personalDocs, setPersonalDocs] = useState([]);
const [isRequestForApplData, setIsRequestForApplData] = useState(false);
const isAsyncRequest = useStore().main.isAsyncRequest();
const previousStatus = useRef('');
@@ -219,7 +222,7 @@ const BandoApplication = () => {
}
fieldVal = isEmpty(fieldVal) ? null : fieldVal;
- if (formField && formField.name === 'fileupload') {
+ if (formField && ['fileupload', 'fileselect'].includes(formField.name)) {
fieldVal = is(Array, fieldVal) ? fieldVal.map(o => o.id).join(',') : null;
}
acc.push({
@@ -262,7 +265,7 @@ const BandoApplication = () => {
});
}
if (!isEmpty(saveAndMove) && is(String, saveAndMove)) {
- if (['NEXT','PREVIOUS'].includes(saveAndMove)) {
+ if (['NEXT', 'PREVIOUS'].includes(saveAndMove)) {
storeSet.main.setAsyncRequest();
ApplicationService.getApplicationForm(data.data.id, getApplFormCallback, errGetApplFormCallbacks, [
['formId', formId],
@@ -542,6 +545,26 @@ const BandoApplication = () => {
? ['.p7m', '.pdf']
: ['.p7m'];
+ const getDocsCallback = (resp, type) => {
+ if (resp.status === 'SUCCESS') {
+ const filteredPersonal = getFormattedDocsData(resp.data.filter(o => o.type === 'PERSONAL_DOCUMENT'));
+ setPersonalDocs(uniqBy((o) => o.id, filteredPersonal));
+ const filteredCompany = getFormattedDocsData(resp.data.filter(o => o.type === 'COMPANY_DOCUMENT'));
+ setCompanyDocs(uniqBy((o) => o.id, filteredCompany));
+ }
+ }
+
+
+ const errDocsGetCallbacks = () => {
+ }
+
+ const getFormattedDocsData = (data) => {
+ return data.map((d) => {
+ d.callEndDate = is(String, d.callEndDate) ? new Date(d.callEndDate) : (d.callEndDate ? d.callEndDate : '');
+ return d;
+ });
+ };
+
useEffect(() => {
let updatedFormValues = klona(formValues);
let context = {};
@@ -630,6 +653,7 @@ const BandoApplication = () => {
ApplicationService.getApplicationForm(applId, getApplFormCallback, errGetApplFormCallbacks, [
['companyId', chosenCompanyId]
]);
+ CompanyDocumentsService.getCompanyDocuments(chosenCompanyId, getDocsCallback, errDocsGetCallbacks);
}
}, [id, chosenCompanyId]);
@@ -689,13 +713,16 @@ const BandoApplication = () => {
const label = head(o.settings.filter(o => o.name === 'label'));
const text = head(o.settings.filter(o => o.name === 'text'));
const placeholder = head(o.settings.filter(o => o.name === 'placeholder'));
- const options = head(o.settings.filter(o => o.name === 'options'));
+ const options = ['fileselect'].includes(o.name)
+ ? { value: [...companyDocs, ...personalDocs] }
+ : head(o.settings.filter(o => o.name === 'options'));
let tableColumns = head(o.settings.filter(o => o.name === 'table_columns'));
if (!tableColumns) {
tableColumns = head(o.settings.filter(o => o.name === 'criteria_table_columns'));
}
const step = head(o.settings.filter(o => o.name === 'step'));
const mime = head(o.settings.filter(o => o.name === 'mime'));
+ const documentCategories = head(o.settings.filter(o => o.name === 'documentCategories'));
const formula = head(o.settings.filter(o => o.name === 'formula'));
let mimeValue = '';
@@ -723,8 +750,8 @@ const BandoApplication = () => {
return acc;
}, {});
- /*if (o.name === 'table') {
- console.log('value:', values[o.id] ? values[o.id] : '')
+ /*if (o.name === 'fileselect') {
+ console.log('options::', options)
}*/
return ['paragraph'].includes(o.name) && text
@@ -747,6 +774,7 @@ const BandoApplication = () => {
defaultValue={values[o.id] ? values[o.id] : ''}
maxFractionDigits={step ? step.value : 0}
accept={mimeValue}
+ documentCategories={documentCategories ? documentCategories.value : []}
config={validations}
options={options ? options.value : []}
setDataFn={setValue}
diff --git a/src/pages/BandoApplicationPreview/index.js b/src/pages/BandoApplicationPreview/index.js
index 84c64e8..52aa372 100644
--- a/src/pages/BandoApplicationPreview/index.js
+++ b/src/pages/BandoApplicationPreview/index.js
@@ -328,7 +328,7 @@ const BandoApplicationPreview = () => {
if (applId) {
storeSet.main.setAsyncRequest();
- const queryParams = 'ROLE_BENEFICIARY' === role
+ const queryParams = ['ROLE_BENEFICIARY', 'ROLE_CONFIDI'].includes(role)
? [
['companyId', chosenCompanyId]
]
diff --git a/src/pages/BandoEdit/components/BandoEditFormStep1/index.js b/src/pages/BandoEdit/components/BandoEditFormStep1/index.js
index 6d615ed..64bb587 100644
--- a/src/pages/BandoEdit/components/BandoEditFormStep1/index.js
+++ b/src/pages/BandoEdit/components/BandoEditFormStep1/index.js
@@ -201,7 +201,8 @@ const BandoEditFormStep1 = forwardRef(function ({ initialData, setInitialData, g
![
'descriptionShort', 'descriptionLong', 'documentationRequested', 'threshold',
'aimedTo', 'criteria', 'docs', 'checklist', 'faq', 'amount', 'amountMin', 'amountMax',
- 'email', 'phoneNumber', 'checkList', 'images', 'numberOfCheck', 'appointmentTemplateId'
+ 'email', 'phoneNumber', 'checkList', 'images', 'numberOfCheck', 'appointmentTemplateId',
+ 'endDate', 'endTime'
].includes(fieldName)
}
diff --git a/src/pages/BandoEdit/components/BandoEditFormStep2/index.js b/src/pages/BandoEdit/components/BandoEditFormStep2/index.js
index c649a6c..b9cffd6 100644
--- a/src/pages/BandoEdit/components/BandoEditFormStep2/index.js
+++ b/src/pages/BandoEdit/components/BandoEditFormStep2/index.js
@@ -214,7 +214,7 @@ const BandoEditFormStep2 = forwardRef(function ({ initialData, setInitialData, g
![
'descriptionShort', 'descriptionLong', 'documentationRequested', 'threshold',
'aimedTo', 'criteria', 'docs', 'checklist', 'faq', 'amount', 'amountMin', 'amountMax',
- 'email', 'phoneNumber', 'checkList', 'images'
+ 'email', 'phoneNumber', 'checkList', 'images', 'endDate', 'endTime'
].includes(fieldName)
}
diff --git a/src/pages/BandoEdit/components/BandoEditFormStep3/index.js b/src/pages/BandoEdit/components/BandoEditFormStep3/index.js
index b67b93f..e9db65c 100644
--- a/src/pages/BandoEdit/components/BandoEditFormStep3/index.js
+++ b/src/pages/BandoEdit/components/BandoEditFormStep3/index.js
@@ -78,7 +78,11 @@ const BandoEditFormStep3 = forwardRef(function () {
const getElementItemsCallback = (data) => {
if (data.status === 'SUCCESS') {
//storeSet.main.elementItems(elementItems.sort((a, b) => a.sortOrder - b.sortOrder));
- storeSet.main.elementItems(data.data.sort((a, b) => a.sortOrder - b.sortOrder));
+ storeSet.main.elementItems(
+ data.data
+ .filter(o => !['fileselect'].includes(o.name))
+ .sort((a, b) => a.sortOrder - b.sortOrder)
+ );
}
storeSet.main.unsetAsyncRequest();
}
diff --git a/src/pages/BandoFormsEdit/components/BuilderElement/index.js b/src/pages/BandoFormsEdit/components/BuilderElement/index.js
index d0acc67..6fda4b4 100644
--- a/src/pages/BandoFormsEdit/components/BuilderElement/index.js
+++ b/src/pages/BandoFormsEdit/components/BuilderElement/index.js
@@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'
import { useDrag, useDrop } from 'react-dnd'
import { ItemTypes } from '../ItemTypes';
import { __ } from '@wordpress/i18n';
-import { head, isEmpty } from 'ramda';
+import { head, isEmpty, pathOr } from 'ramda';
import { klona } from 'klona';
// store
@@ -22,6 +22,7 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
const ref = useRef(null);
const elements = useStore().main.formElements();
const element = head(elements.filter(o => o.id === id));
+ const elementSettings = pathOr([], ['settings'], element);
const [isVariable, setIsVariable] = useState('secondary');
const [isFormula, setIsFormula] = useState('secondary');
const [variableName, setVariableName] = useState('secondary');
@@ -134,10 +135,10 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
drag(drop(ref));
useEffect(() => {
- const variable = head(element.settings.filter(o => o.name === 'variable'));
- const formula = head(element.settings.filter(o => o.name === 'formula'));
- const isRequestedAmount = head(element.settings.filter(o => o.name === 'isRequestedAmount'));
- const isDelegation = head(element.settings.filter(o => o.name === 'isDelegation'));
+ const variable = head(elementSettings.filter(o => o.name === 'variable'));
+ const formula = head(elementSettings.filter(o => o.name === 'formula'));
+ const isRequestedAmount = head(elementSettings.filter(o => o.name === 'isRequestedAmount'));
+ const isDelegation = head(elementSettings.filter(o => o.name === 'isDelegation'));
if (variable && !isEmpty(variable.value)) {
setIsVariable('warning');
@@ -151,12 +152,16 @@ const BuilderElement = ({ id, name, label, index, bandoStatus }) => {
if (isRequestedAmount && !isEmpty(isRequestedAmount.value) && isRequestedAmount.value) {
setIsRequestedAmount('tertiary');
+ } else {
+ setIsRequestedAmount(false);
}
if (isDelegation && !isEmpty(isDelegation.value) && isDelegation.value) {
setIsDelegation('tertiary');
+ } else {
+ setIsDelegation(false);
}
- }, [elements]);
+ }, [elementSettings]);
return (
draggingElementId === id
diff --git a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js
index 0795c5a..051e7c4 100644
--- a/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js
+++ b/src/pages/BandoFormsEdit/components/BuilderElementSettings/components/ElementSetting/index.js
@@ -3,7 +3,7 @@ import { __ } from '@wordpress/i18n';
import { head, is, isEmpty, isNil, uniq } from 'ramda';
// store
-import { storeGet } from '../../../../../../store';
+import { storeGet, useStore } from '../../../../../../store';
// tools
import renderHtmlContent from '../../../../../../helpers/renderHtmlContent';
@@ -23,6 +23,7 @@ import { mimeTypes } from '../../../../../../configData';
const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => {
const [existingVars, setExistingVars] = useState([]);
+ const documentCategories = useStore().main.documentCategories();
const settingLabels = {
label: __('Label', 'gepafin'),
@@ -32,6 +33,7 @@ const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => {
isDelegation: __('Delega', 'gepafin'),
options: __('Opzioni', 'gepafin'),
mime: __('Tipo di file', 'gepafin'),
+ documentCategories: __('Categorie dei documenti', 'gepafin'),
text: __('Testo formattato', 'gepafin'),
table_columns: '',
criteria_table_columns: '',
@@ -79,6 +81,13 @@ const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => {
optionLabel="name"
display="chip"
placeholder={__('Scegli', 'gepafin')}/>
+ } else if (setting.name === 'documentCategories') {
+ return updateDataFn(setting.name, e.value)}
+ options={documentCategories}
+ display="chip"
+ placeholder={__('Scegli', 'gepafin')}/>
} else if (setting.name === 'text') {
return {
const { id, formId } = useParams();
@@ -215,10 +216,10 @@ const BandoFormsEdit = () => {
const getElementItemsCallback = (data) => {
if (data.status === 'SUCCESS') {
- //storeSet.main.elementItems(elementItems.sort((a, b) => a.sortOrder - b.sortOrder));
- storeSet.main.elementItems(data.data
+ storeSet.main.elementItems(elementItems.sort((a, b) => a.sortOrder - b.sortOrder));
+ /*storeSet.main.elementItems(data.data
.filter(o => o.id !== 22)
- .sort((a, b) => a.sortOrder - b.sortOrder));
+ .sort((a, b) => a.sortOrder - b.sortOrder));*/
}
storeSet.main.unsetAsyncRequest();
}
@@ -257,6 +258,15 @@ const BandoFormsEdit = () => {
set404FromErrorResponse(data);
}
+ const getCategories = (resp) => {
+ if (resp.status === 'SUCCESS') {
+ storeSet.main.documentCategories(resp.data.map(o => ({value: o.id, label: o.description})));
+ }
+ }
+
+ const errGetCategories = () => {
+ }
+
useEffect(() => {
const bandoId = getBandoId();
const parsedFormId = parseInt(formId)
@@ -283,6 +293,10 @@ const BandoFormsEdit = () => {
}
}, [id, formId]);
+ useEffect(() => {
+ DocumentCategoryService.getCategories(getCategories, errGetCategories)
+ }, []);
+
return (
diff --git a/src/pages/Dashboard/components/DraftApplicationsTableAsync/index.js b/src/pages/Dashboard/components/DraftApplicationsTableAsync/index.js
new file mode 100644
index 0000000..8eb9c99
--- /dev/null
+++ b/src/pages/Dashboard/components/DraftApplicationsTableAsync/index.js
@@ -0,0 +1,169 @@
+import React, { useState, useEffect, useCallback } from 'react';
+import { __ } from '@wordpress/i18n';
+import { is, pathOr, isEmpty } from 'ramda';
+
+// store
+import { useStore } from '../../../../store';
+
+// api
+import ApplicationService from '../../../../service/application-service';
+
+// components
+import { DataTable } from 'primereact/datatable';
+import { Column } from 'primereact/column';
+import { ProgressBar } from 'primereact/progressbar';
+import { Button } from 'primereact/button';
+import ProperBandoLabel from '../../../../components/ProperBandoLabel';
+import { Link } from 'react-router-dom';
+import translationStrings from '../../../../translationStringsForComponents';
+
+const DraftApplicationsTableAsync = () => {
+ const chosenCompanyId = useStore().main.chosenCompanyId();
+ const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
+ const [items, setItems] = useState(null);
+ const [totalRecordsNum, setTotalRecordsNum] = useState(0);
+ const [lazyState, setLazyState] = useState({
+ first: 0,
+ rows: 5,
+ page: 0,
+ sortField: null,
+ sortOrder: null,
+ filters: {
+ id: { value: null, matchMode: 'contains' },
+ callTitle: { value: null, matchMode: 'contains' },
+ companyName: { value: null, matchMode: 'contains' }
+ }
+ });
+ const statuses = ['DRAFT'];
+
+ const getPaginationQuery = useCallback(() => {
+ let sortBy = {
+ columnName: "ID",
+ sortDesc: true
+ };
+
+ if (lazyState.sortField) {
+ sortBy = {
+ columnName: lazyState.sortField,
+ sortDesc: lazyState.sortOrder === -1
+ }
+ }
+ return {
+ globalFilters: {
+ page: lazyState.page ? lazyState.page + 1 : 1,
+ limit: lazyState.rows,
+ sortBy
+ },
+ status: statuses,
+ filters: Object.keys(lazyState.filters).reduce((acc, cur) => {
+ const value = pathOr('', ['filters', cur, 'value'], lazyState);
+ if (!isEmpty(value)) {
+ acc[cur] = lazyState.filters[cur];
+ }
+ return acc;
+ }, {}),
+ }
+ }, [lazyState]);
+
+ const onPage = (event) => {
+ setLazyState(event);
+ };
+
+ const onSort = (event) => {
+ event['first'] = 0;
+ event['page'] = 0;
+ setLazyState(event);
+ };
+
+ const onFilter = useCallback((event) => {
+ event['first'] = 0;
+ event['page'] = 0;
+ setLazyState(event);
+ }, [lazyState]);
+
+ const getApplCallback = (resp) => {
+ if (resp.status === 'SUCCESS') {
+ const { body, totalRecords,
+ //currentPage, totalPages, pageSize
+ } = resp.data;
+ setTotalRecordsNum(totalRecords);
+ setItems(getFormattedData(body));
+ }
+ setLocalAsyncRequest(false);
+ }
+
+ const errGetApplCallback = () => {
+ 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;
+ });
+ };
+
+ useEffect(() => {
+ setLocalAsyncRequest(true);
+ const paginationQuery = getPaginationQuery();
+
+ ApplicationService.getApplicationsPaginated(paginationQuery, getApplCallback, errGetApplCallback);
+ }, [lazyState, chosenCompanyId]);
+
+ const statusBodyTemplate = (rowData) => {
+ return
;
+ };
+
+ const progressBodyTemplate = (options) => {
+ return ;
+ };
+
+ const actionsBodyTemplate = (rowData) => {
+ return
+
+
+ }
+
+ return (
+
+
+
+
+
+
+
+
+
+
+ )
+}
+
+export default DraftApplicationsTableAsync;
\ No newline at end of file
diff --git a/src/pages/Dashboard/components/LatestBandiTableAsync/index.js b/src/pages/Dashboard/components/LatestBandiTableAsync/index.js
new file mode 100644
index 0000000..6959e8d
--- /dev/null
+++ b/src/pages/Dashboard/components/LatestBandiTableAsync/index.js
@@ -0,0 +1,208 @@
+import React, { useEffect, useState, useCallback } from 'react';
+import { __ } from '@wordpress/i18n';
+import { isEmpty, pathOr } from 'ramda';
+import { Link } from 'react-router-dom';
+
+import translationStrings from '../../../../translationStringsForComponents';
+
+// api
+import BandoService from '../../../../service/bando-service';
+
+// tools
+import getTimeParsedFromString from '../../../../helpers/getTimeParsedFromString';
+import getTimeFromISOstring from '../../../../helpers/getTimeFromISOstring';
+import getFormattedDateString from '../../../../helpers/getFormattedDateString';
+import getBandoLabel from '../../../../helpers/getBandoLabel';
+import getBandoSeverity from '../../../../helpers/getBandoSeverity';
+
+// components
+import { DataTable } from 'primereact/datatable';
+import { Column } from 'primereact/column';
+import { Button } from 'primereact/button';
+import ProperBandoLabel from '../../../../components/ProperBandoLabel';
+import { Dropdown } from 'primereact/dropdown';
+import { Tag } from 'primereact/tag';
+import { Calendar } from 'primereact/calendar';
+
+const LatestBandiTableAsync = () => {
+ const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
+ const [items, setItems] = useState(null);
+ const [totalRecordsNum, setTotalRecordsNum] = useState(0);
+ const [lazyState, setLazyState] = useState({
+ first: 0,
+ rows: 5,
+ page: 0,
+ sortField: null,
+ sortOrder: null,
+ filters: {
+ name: { value: null, matchMode: 'contains' },
+ startDate: { value: null, matchMode: 'date_is' },
+ endDate: { value: null, matchMode: 'date_is' },
+ status: { value: null, matchMode: 'equals' }
+ }
+ });
+ const statuses = ['PUBLISH'];
+
+ const getPaginationQuery = useCallback(() => {
+ let sortBy = {
+ columnName: "ID",
+ sortDesc: true
+ };
+
+ if (lazyState.sortField) {
+ sortBy = {
+ columnName: lazyState.sortField,
+ sortDesc: lazyState.sortOrder === -1
+ }
+ }
+ return {
+ globalFilters: {
+ page: lazyState.page ? lazyState.page + 1 : 1,
+ limit: lazyState.rows,
+ sortBy
+ },
+ status: statuses,
+ filters: Object.keys(lazyState.filters).reduce((acc, cur) => {
+ const value = pathOr('', ['filters', cur, 'value'], lazyState);
+ if (!isEmpty(value)) {
+ acc[cur] = lazyState.filters[cur];
+ }
+ return acc;
+ }, {}),
+ }
+ }, [lazyState]);
+
+ const onPage = (event) => {
+ setLazyState(event);
+ };
+
+ const onSort = (event) => {
+ event['first'] = 0;
+ event['page'] = 0;
+ setLazyState(event);
+ };
+
+ const onFilter = useCallback((event) => {
+ event['first'] = 0;
+ event['page'] = 0;
+ setLazyState(event);
+ }, [lazyState]);
+
+ const getCallback = (resp) => {
+ if (resp.status === 'SUCCESS') {
+ const { body, totalRecords,
+ //currentPage, totalPages, pageSize
+ } = resp.data;
+ setTotalRecordsNum(totalRecords);
+ setItems(getFormattedData(body));
+ }
+ setLocalAsyncRequest(false);
+ }
+
+ const errGetCallbacks = () => {
+ setLocalAsyncRequest(false);
+ }
+
+ const getFormattedData = (data) => {
+ return [...(data || [])].map((d) => {
+ d.startDate = new Date(d.dates[0]);
+ d.endDate = new Date(d.dates[1]);
+
+ return d;
+ });
+ };
+
+ const actionsBodyTemplate = (rowData) => {
+ return
+
+
+ }
+
+ const statusBodyTemplate = (rowData) => {
+ return ;
+ };
+
+ const statusItemTemplate = (option) => {
+ return ;
+ };
+
+ const statusFilterTemplate = (options) => {
+ return {
+ options.filterCallback(e.value, options.index)
+ const filters = { ...lazyState.filters };
+ if (e.value) {
+ filters['status'] = { value: e.value, matchMode: 'equals' };
+ } else {
+ delete filters['status'];
+ }
+ setLazyState({ ...lazyState, filters, first: 0 });
+ }}
+ itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter"
+ showClear/>;
+ };
+
+ const dateFilterTemplate = (options) => {
+ return options.filterCallback(e.value, options.index)}
+ dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999"/>;
+ };
+
+ const dateStartBodyTemplate = (rowData) => {
+ const startTimeObj = getTimeParsedFromString(rowData.startTime);
+ return getFormattedDateString(rowData.startDate) + ' ' + getTimeFromISOstring(startTimeObj);
+ };
+
+ const dateEndBodyTemplate = (rowData) => {
+ const endTimeObg = getTimeParsedFromString(rowData.endTime);
+ return getFormattedDateString(rowData.endDate) + ' ' + getTimeFromISOstring(endTimeObg);
+ };
+
+ useEffect(() => {
+ setLocalAsyncRequest(true);
+ const paginationQuery = getPaginationQuery();
+
+ BandoService.getBandiPaginated(paginationQuery, getCallback, errGetCallbacks);
+ }, [lazyState]);
+
+ return (
+
+
+
+
+
+
+
+
+
+ )
+}
+
+export default LatestBandiTableAsync;
\ No newline at end of file
diff --git a/src/pages/Dashboard/index.js b/src/pages/Dashboard/index.js
index e7e7585..fd46b4d 100644
--- a/src/pages/Dashboard/index.js
+++ b/src/pages/Dashboard/index.js
@@ -8,12 +8,12 @@ import NumberFlow from '@number-flow/react';
import DashboardService from '../../service/dashboard-service';
// components
-import LatestBandiTable from './components/LatestBandiTable';
import { Button } from 'primereact/button';
-import AllDomandeTable from '../Domande/components/AllDomandeTable';
-import DraftApplicationsTable from './components/DraftApplicationsTable';
import ChartDomandePerBando from '../../components/ChartDomandePerBando';
import ChartStatoDomande from '../../components/ChartStatoDomande';
+import LatestBandiTableAsync from './components/LatestBandiTableAsync';
+import AllDomandeTableAsync from '../Domande/components/AllDomandeTableAsync';
+import DraftApplicationsTableAsync from './components/DraftApplicationsTableAsync';
const Dashboard = () => {
const navigate = useNavigate();
@@ -136,30 +136,23 @@ const Dashboard = () => {
{__('Ultimi bandi pubblicati', 'gepafin')}
-
+
{__('Ultime domande pubblicate', 'gepafin')}
-
+
{__('Domande in bozza', 'gepafin')}
-
+
- {/*
-
-
-
{__('Attività Recenti Utenti', 'gepafin')}
-
- */}
-
{chartStats.applicationPerCall
diff --git a/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js b/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js
index 3cf30e7..e3e043a 100644
--- a/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js
+++ b/src/pages/DashboardBeneficiario/components/MyLatestSubmissionsTable/index.js
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { __ } from '@wordpress/i18n';
-import { uniq, is, isEmpty } from 'ramda';
+import { uniq, is, head } from 'ramda';
// tools
import getBandoLabel from '../../../../helpers/getBandoLabel';
@@ -25,16 +25,20 @@ import ProperBandoLabel from '../../../../components/ProperBandoLabel';
import { Link } from 'react-router-dom';
import translationStrings from '../../../../translationStringsForComponents';
import { ConfirmPopup, confirmPopup } from 'primereact/confirmpopup';
+import isDateTimeInPast from '../../../../helpers/isDateTimeInPast';
const MyLatestSubmissionsTable = () => {
const chosenCompanyId = useStore().main.chosenCompanyId();
+ const companies = useStore().main.companies();
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
const [items, setItems] = useState(null);
const [filters, setFilters] = useState(null);
const [statuses, setStatuses] = useState([]);
useEffect(() => {
- if (!isEmpty(chosenCompanyId) && chosenCompanyId !== 0) {
+ const existingCompany = head(companies.filter(o => o.id === chosenCompanyId));
+
+ if (existingCompany) {
setLocalAsyncRequest(true);
ApplicationService.getApplications(getApplCallback, errGetApplCallback, [
['companyId', chosenCompanyId],
@@ -162,25 +166,28 @@ const MyLatestSubmissionsTable = () => {
};
const actionsBodyTemplate = (rowData) => {
- return 'DRAFT' === rowData.status
- ?
-
-
-
+ const isCallExpired = isDateTimeInPast(rowData.callEndDate, rowData.callEndTime);
+ return
+ {'DRAFT' === rowData.status && !isCallExpired
+ ?
+
+
+ : null}
+ {'DRAFT' !== rowData.status || isCallExpired
+ ?
+
+
+ : null}
- :
-
-
}
diff --git a/src/pages/DashboardBeneficiario/index.js b/src/pages/DashboardBeneficiario/index.js
index cec061b..7d1f625 100644
--- a/src/pages/DashboardBeneficiario/index.js
+++ b/src/pages/DashboardBeneficiario/index.js
@@ -5,16 +5,16 @@ import { head, isEmpty, pathOr } from 'ramda';
import NumberFlow from '@number-flow/react';
// store
-import { useStore } from '../../store';
+import { storeSet, useStore } from '../../store';
// api
import DashboardService from '../../service/dashboard-service';
// components
-import LatestBandiTable from './components/LatestBandiTable';
import MyLatestSubmissionsTable from './components/MyLatestSubmissionsTable';
import { Button } from 'primereact/button';
import ErrorBoundary from '../../components/ErrorBoundary';
+import LatestBandiTableAsync from '../Dashboard/components/LatestBandiTableAsync';
const DashboardBeneficiario = () => {
const navigate = useNavigate();
@@ -108,7 +108,7 @@ const DashboardBeneficiario = () => {
{__('Bandi disponibili', 'gepafin')}
-
+
diff --git a/src/pages/DashboardInstructorManager/components/LatestBandiTableInstructorManagerAsync/index.js b/src/pages/DashboardInstructorManager/components/LatestBandiTableInstructorManagerAsync/index.js
new file mode 100644
index 0000000..46acaf1
--- /dev/null
+++ b/src/pages/DashboardInstructorManager/components/LatestBandiTableInstructorManagerAsync/index.js
@@ -0,0 +1,198 @@
+import React, { useEffect, useState, useCallback } from 'react';
+import { __ } from '@wordpress/i18n';
+import { isEmpty, pathOr } from 'ramda';
+
+import translationStrings from '../../../../translationStringsForComponents';
+
+// api
+import BandoService from '../../../../service/bando-service';
+
+// tools
+import getTimeParsedFromString from '../../../../helpers/getTimeParsedFromString';
+import getTimeFromISOstring from '../../../../helpers/getTimeFromISOstring';
+import getFormattedDateString from '../../../../helpers/getFormattedDateString';
+import getBandoLabel from '../../../../helpers/getBandoLabel';
+import getBandoSeverity from '../../../../helpers/getBandoSeverity';
+
+// components
+import { DataTable } from 'primereact/datatable';
+import { Column } from 'primereact/column';
+import ProperBandoLabel from '../../../../components/ProperBandoLabel';
+import { Dropdown } from 'primereact/dropdown';
+import { Tag } from 'primereact/tag';
+import { Calendar } from 'primereact/calendar';
+
+const LatestBandiTableInstructorManagerAsync = () => {
+ const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
+ const [items, setItems] = useState(null);
+ const [totalRecordsNum, setTotalRecordsNum] = useState(0);
+ const [lazyState, setLazyState] = useState({
+ first: 0,
+ rows: 5,
+ page: 0,
+ sortField: null,
+ sortOrder: null,
+ filters: {
+ name: { value: null, matchMode: 'contains' },
+ startDate: { value: null, matchMode: 'date_is' },
+ endDate: { value: null, matchMode: 'date_is' },
+ status: { value: null, matchMode: 'equals' }
+ }
+ });
+ const statuses = ['PUBLISH'];
+
+ const getPaginationQuery = useCallback(() => {
+ let sortBy = {
+ columnName: "ID",
+ sortDesc: true
+ };
+
+ if (lazyState.sortField) {
+ sortBy = {
+ columnName: lazyState.sortField,
+ sortDesc: lazyState.sortOrder === -1
+ }
+ }
+ return {
+ globalFilters: {
+ page: lazyState.page ? lazyState.page + 1 : 1,
+ limit: lazyState.rows,
+ sortBy
+ },
+ status: statuses,
+ filters: Object.keys(lazyState.filters).reduce((acc, cur) => {
+ const value = pathOr('', ['filters', cur, 'value'], lazyState);
+ if (!isEmpty(value)) {
+ acc[cur] = lazyState.filters[cur];
+ }
+ return acc;
+ }, {}),
+ }
+ }, [lazyState]);
+
+ const onPage = (event) => {
+ setLazyState(event);
+ };
+
+ const onSort = (event) => {
+ event['first'] = 0;
+ event['page'] = 0;
+ setLazyState(event);
+ };
+
+ const onFilter = useCallback((event) => {
+ event['first'] = 0;
+ event['page'] = 0;
+ setLazyState(event);
+ }, [lazyState]);
+
+ const getCallback = (resp) => {
+ if (resp.status === 'SUCCESS') {
+ const { body, totalRecords,
+ //currentPage, totalPages, pageSize
+ } = resp.data;
+ setTotalRecordsNum(totalRecords);
+ setItems(getFormattedData(body));
+ }
+ setLocalAsyncRequest(false);
+ }
+
+ const errGetCallbacks = () => {
+ setLocalAsyncRequest(false);
+ }
+
+ const getFormattedData = (data) => {
+ return [...(data || [])].map((d) => {
+ d.startDate = new Date(d.dates[0]);
+ d.endDate = new Date(d.dates[1]);
+
+ return d;
+ });
+ };
+
+ const statusBodyTemplate = (rowData) => {
+ return
;
+ };
+
+ const statusItemTemplate = (option) => {
+ return ;
+ };
+
+ const statusFilterTemplate = (options) => {
+ return {
+ options.filterCallback(e.value, options.index)
+ const filters = { ...lazyState.filters };
+ if (e.value) {
+ filters['status'] = { value: e.value, matchMode: 'equals' };
+ } else {
+ delete filters['status'];
+ }
+ setLazyState({ ...lazyState, filters, first: 0 });
+ }}
+ itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter"
+ showClear/>;
+ };
+
+ const dateFilterTemplate = (options) => {
+ return options.filterCallback(e.value, options.index)}
+ dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999"/>;
+ };
+
+ const dateStartBodyTemplate = (rowData) => {
+ const startTimeObj = getTimeParsedFromString(rowData.startTime);
+ return getFormattedDateString(rowData.startDate) + ' ' + getTimeFromISOstring(startTimeObj);
+ };
+
+ const dateEndBodyTemplate = (rowData) => {
+ const endTimeObg = getTimeParsedFromString(rowData.endTime);
+ return getFormattedDateString(rowData.endDate) + ' ' + getTimeFromISOstring(endTimeObg);
+ };
+
+ useEffect(() => {
+ setLocalAsyncRequest(true);
+ const paginationQuery = getPaginationQuery();
+
+ BandoService.getBandiPaginated(paginationQuery, getCallback, errGetCallbacks);
+ }, [lazyState]);
+
+ return (
+
+
+
+
+
+
+
+
+ )
+}
+
+export default LatestBandiTableInstructorManagerAsync;
\ No newline at end of file
diff --git a/src/pages/DashboardInstructorManager/components/MieDomandeTableInstructorManagerAsync/index.js b/src/pages/DashboardInstructorManager/components/MieDomandeTableInstructorManagerAsync/index.js
new file mode 100644
index 0000000..2a9cb73
--- /dev/null
+++ b/src/pages/DashboardInstructorManager/components/MieDomandeTableInstructorManagerAsync/index.js
@@ -0,0 +1,276 @@
+import React, { useEffect, useState, useCallback } from 'react';
+import { __ } from '@wordpress/i18n';
+import { head, is, isEmpty, pathOr } from 'ramda';
+import { klona } from 'klona';
+
+import translationStrings from '../../../../translationStringsForComponents';
+
+// api
+import AssignedApplicationService from '../../../../service/assigned-application-service';
+
+// store
+import { useStore } from '../../../../store';
+
+// tools
+import getFormattedDateString from '../../../../helpers/getFormattedDateString';
+import getBandoLabel from '../../../../helpers/getBandoLabel';
+import getBandoSeverity from '../../../../helpers/getBandoSeverity';
+
+// components
+import { DataTable } from 'primereact/datatable';
+import { Column } from 'primereact/column';
+import ProperBandoLabel from '../../../../components/ProperBandoLabel';
+import { Dropdown } from 'primereact/dropdown';
+import { Tag } from 'primereact/tag';
+import { Calendar } from 'primereact/calendar';
+import { Button } from 'primereact/button';
+import { Link, useNavigate } from 'react-router-dom';
+
+
+const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
+
+const MieDomandeTableInstructorManagerAsync = ({ userId = null, statuses = [] }) => {
+ const navigate = useNavigate();
+ const userData = useStore().main.userData();
+ const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
+ const [items, setItems] = useState(null);
+ const [totalRecordsNum, setTotalRecordsNum] = useState(0);
+ const [lazyState, setLazyState] = useState({
+ first: 0,
+ rows: 5,
+ page: 0,
+ sortField: null,
+ sortOrder: null,
+ filters: {
+ applicationId: { value: null, matchMode: 'contains' },
+ protocolNumber: { value: null, matchMode: 'contains' },
+ callName: { value: null, matchMode: 'contains' },
+ companyName: { value: null, matchMode: 'contains' },
+ submissionDate: { value: null, matchMode: 'date_is' },
+ evaluationEndDate: { value: null, matchMode: 'date_is' },
+ status: { value: null, matchMode: 'equals' }
+ }
+ });
+
+ const getPaginationQuery = useCallback(() => {
+ let sortBy = {
+ columnName: "ID",
+ sortDesc: true
+ };
+
+ if (lazyState.sortField) {
+ sortBy = {
+ columnName: lazyState.sortField,
+ sortDesc: lazyState.sortOrder === -1
+ }
+ }
+ return {
+ globalFilters: {
+ page: lazyState.page ? lazyState.page + 1 : 1,
+ limit: lazyState.rows,
+ sortBy
+ },
+ status: statuses,
+ filters: Object.keys(lazyState.filters).reduce((acc, cur) => {
+ const value = pathOr('', ['filters', cur, 'value'], lazyState);
+ if (!isEmpty(value)) {
+ acc[cur] = lazyState.filters[cur];
+ }
+ return acc;
+ }, {}),
+ }
+ }, [lazyState]);
+
+ const onPage = (event) => {
+ setLazyState(event);
+ };
+
+ const onSort = (event) => {
+ event['first'] = 0;
+ event['page'] = 0;
+ setLazyState(event);
+ };
+
+ const onFilter = useCallback((event) => {
+ event['first'] = 0;
+ event['page'] = 0;
+ setLazyState(event);
+ }, [lazyState]);
+
+ const getCallback = (resp) => {
+ if (resp.status === 'SUCCESS') {
+ const { body, totalRecords,
+ //currentPage, totalPages, pageSize
+ } = resp.data;
+ setTotalRecordsNum(totalRecords);
+ setItems(getFormattedData(body));
+ }
+ setLocalAsyncRequest(false);
+ }
+
+ const errGetCallbacks = () => {
+ setLocalAsyncRequest(false);
+ }
+
+ const getFormattedData = (data) => {
+ return data.map((d) => {
+ d.evaluationEndDate = is(String, d.evaluationEndDate) ? new Date(d.evaluationEndDate) : (d.evaluationEndDate ? d.evaluationEndDate : '');
+ d.submissionDate = is(String, d.submissionDate) ? new Date(d.submissionDate) : (d.submissionDate ? d.submissionDate : '');
+ return d;
+ });
+ };
+
+ const statusBodyTemplate = (rowData) => {
+ return ;
+ };
+
+ const statusItemTemplate = (option) => {
+ return ;
+ };
+
+ const statusFilterTemplate = (options) => {
+ return {
+ options.filterCallback(e.value, options.index)
+ const filters = { ...lazyState.filters };
+ if (e.value) {
+ filters['status'] = { value: e.value, matchMode: 'equals' };
+ } else {
+ delete filters['status'];
+ }
+ setLazyState({ ...lazyState, filters, first: 0 });
+ }}
+ itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter"
+ showClear/>;
+ };
+
+ const dateFilterTemplate = (options) => {
+ return options.filterCallback(e.value, options.index)}
+ dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999"/>;
+ };
+
+ const dateAppliedBodyTemplate = (rowData) => {
+ return getFormattedDateString(rowData.submissionDate);
+ };
+
+ const dateEndBodyTemplate = (rowData) => {
+ return getFormattedDateString(rowData.evaluationEndDate);
+ };
+
+ const actionsBodyTemplate = (rowData) => {
+ if (rowData.status === 'AWAITING') {
+ return
-
+
@@ -160,7 +190,7 @@ const Users = () => {
label={__('Crea nuovo')} icon="pi pi-plus" iconPos="right"/>
-
+
-
@@ -244,6 +272,16 @@ const Users = () => {
optionLabel="name"
optionValue="value"/>
+ {isConfidiRoleChosen()
+ ?
+
+ {__('Codice Fiscale', 'gepafin')}*
+
+ onChangeEditItem(e.target.value, 'codiceFiscale')}/>
+
: null}
diff --git a/src/routes.js b/src/routes.js
index f5555e3..62867b6 100644
--- a/src/routes.js
+++ b/src/routes.js
@@ -51,6 +51,9 @@ import SoccorsoEditInstructorManager from './pages/SoccorsoEditInstructorManager
import SoccorsoIstruttorioInstructorManager from './pages/SoccorsoIstruttorioInstructorManager';
import SoccorsoIstruttorioMioInstructorManager from './pages/SoccorsoIstruttorioMioInstructorManager';
import StatsBeneficiary from './pages/StatsBeneficiary';
+import DocumentsBeneficiary from './pages/DocumentsBeneficiary';
+import LoginConfidi from './pages/LoginConfidi';
+import ResetPasswordAdmin from './pages/ResetPasswordAdmin';
const routes = ({ role, chosenCompanyId }) => {
@@ -60,193 +63,233 @@ const routes = ({ role, chosenCompanyId }) => {
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role && chosenCompanyId > 0 ? : }
+ {'ROLE_CONFIDI' === role && chosenCompanyId > 0 ? : }
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
{'ROLE_SUPER_ADMIN' === role ? : null}
{'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
+ {'ROLE_PRE_INSTRUCTOR' === role ? : null}
+ {'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
+ }/>
+
+ {'ROLE_SUPER_ADMIN' === role ? : null}
+ {'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_CONFIDI' === role ? : null}
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
}/>
+ }/>
}/>
- }/>
+ }/>
+ }/>
}/>
}/>
)
diff --git a/src/service/assigned-application-service.js b/src/service/assigned-application-service.js
index 8d9f049..ae547c4 100644
--- a/src/service/assigned-application-service.js
+++ b/src/service/assigned-application-service.js
@@ -15,4 +15,8 @@ export default class AssignedApplicationService {
static updateStatusAssignedApplication = (id, callback, errCallback, queryParams) => {
NetworkService.put(`${API_BASE_URL}/assignedApplication/${id}/status`, {}, callback, errCallback, queryParams);
};
+
+ static assignApplicationPaginated = (body, callback, errCallback, queryParams) => {
+ NetworkService.post(`${API_BASE_URL}/assignedApplication/pagination`, body, callback, errCallback, queryParams);
+ };
}
diff --git a/src/service/company-documents-service.js b/src/service/company-documents-service.js
new file mode 100644
index 0000000..3d38b71
--- /dev/null
+++ b/src/service/company-documents-service.js
@@ -0,0 +1,24 @@
+import { NetworkService } from './network-service';
+
+const API_BASE_URL = process.env.REACT_APP_API_EXECUTION_ADDRESS;
+
+export default class CompanyDocumentsService {
+
+ static getCompanyDocuments = (companyId, callback, errCallback, queryParams) => {
+ NetworkService.get(`${API_BASE_URL}/companyDocument/company/${companyId}`, callback, errCallback, queryParams);
+ };
+
+ static uploadCompanyDocument = (id, body, callback, errCallback, queryParams) => {
+ NetworkService.postMultiPart(`${API_BASE_URL}/companyDocument/company/${id}/upload`, body, callback, errCallback, queryParams);
+ };
+
+ static attachCompanyDocumentToAppl = (id, callback, errCallback, queryParams) => {
+ NetworkService.put(`${API_BASE_URL}/companyDocument/${id}/document/upload`, {}, callback, errCallback, queryParams);
+ };
+
+ static deleteCompanyDocument = (id, callback, errCallback) => {
+ NetworkService.delete(`${API_BASE_URL}/companyDocument`, {}, callback, errCallback, [
+ ['id', id]
+ ]);
+ };
+}
diff --git a/src/service/document-category-service.js b/src/service/document-category-service.js
new file mode 100644
index 0000000..1cdb30b
--- /dev/null
+++ b/src/service/document-category-service.js
@@ -0,0 +1,10 @@
+import { NetworkService } from './network-service';
+
+const API_BASE_URL = process.env.REACT_APP_API_EXECUTION_ADDRESS;
+
+export default class DocumentCategoryService {
+
+ static getCategories = (callback, errCallback) => {
+ NetworkService.get(`${API_BASE_URL}/documentCategory`, callback, errCallback);
+ };
+}
diff --git a/src/service/network-service.js b/src/service/network-service.js
index 5e7d5cc..acacaa4 100644
--- a/src/service/network-service.js
+++ b/src/service/network-service.js
@@ -9,7 +9,7 @@ export class NetworkService {
} else if (status === 403) {
storeSet.main.token('');
const { pathname } = window.location;
- if (!['/login', '/loginadmin', '/reset-password', '/registration'].includes(pathname)) {
+ if (!['/login', '/registration', '/loginadmin', '/reset-password-admin', '/confidi', '/reset-password'].includes(pathname)) {
window.location.replace('/login');
}
}
diff --git a/src/store/initial.js b/src/store/initial.js
index ea1fda5..3421093 100644
--- a/src/store/initial.js
+++ b/src/store/initial.js
@@ -11,6 +11,7 @@ const initialStore = {
users: [],
// bando form
formInitialData: {},
+ documentCategories: [],
// form builder
formId: 0,
formLabel: '',
diff --git a/src/tempData.js b/src/tempData.js
index 431f555..58eb99e 100644
--- a/src/tempData.js
+++ b/src/tempData.js
@@ -483,5 +483,29 @@ export const elementItems = [
validators: {
isRequired: false
}
+ },
+ {
+ id: 23,
+ sortOrder: 23,
+ name: 'fileselect',
+ label: 'Seleziona File',
+ description: "Per selezionare di documenti o immagini",
+ settings: [
+ {
+ name: "label",
+ value: "Seleziona File"
+ },
+ {
+ name: "documentCategories",
+ value: []
+ },
+ {
+ name: "isDelegation",
+ value: false
+ }
+ ],
+ validators: {
+ isRequired: false
+ }
}
]
diff --git a/src/translationStringsForComponents.js b/src/translationStringsForComponents.js
index e33247e..3423e68 100644
--- a/src/translationStringsForComponents.js
+++ b/src/translationStringsForComponents.js
@@ -1,5 +1,6 @@
/* data table related */
import { __ } from '@wordpress/i18n';
+import { FilterMatchMode } from 'primereact/api';
const currentPageReportTemplate = '';
@@ -7,10 +8,43 @@ const emptyMessage = __('Nessun dato disponibile', 'gepafin');
const selectOneLabel = __('Seleziona', 'gepafin');
+const textFilterOptions = [
+ //{ label: 'Inizia con', value: FilterMatchMode.STARTS_WITH },
+ { label: 'Contiene', value: FilterMatchMode.CONTAINS },
+ //{ label: 'Non contiene', value: FilterMatchMode.NOT_CONTAINS },
+ //{ label: 'Finisce con', value: FilterMatchMode.ENDS_WITH },
+ { label: 'Uguale a', value: FilterMatchMode.EQUALS },
+ //{ label: 'Diverso da', value: FilterMatchMode.NOT_EQUALS }
+];
+
+const statusFilterOptions = [
+ { label: 'Uguale a', value: FilterMatchMode.EQUALS }
+];
+
+const numericFilterOptions = [
+ { label: 'Uguale a', value: FilterMatchMode.EQUALS },
+ { label: 'Diverso da', value: FilterMatchMode.NOT_EQUALS },
+ { label: 'Maggiore di', value: FilterMatchMode.GREATER_THAN },
+ { label: 'Maggiore o uguale a', value: FilterMatchMode.GREATER_THAN_OR_EQUAL_TO },
+ { label: 'Minore di', value: FilterMatchMode.LESS_THAN },
+ { label: 'Minore o uguale a', value: FilterMatchMode.LESS_THAN_OR_EQUAL_TO }
+];
+
+const dateFilterOptions = [
+ { label: 'Data uguale a', value: FilterMatchMode.DATE_IS },
+ { label: 'Data diversa da', value: FilterMatchMode.DATE_IS_NOT },
+ { label: 'Data prima di', value: FilterMatchMode.DATE_BEFORE },
+ { label: 'Data dopo', value: FilterMatchMode.DATE_AFTER }
+];
+
const translationStrings = {
currentPageReportTemplate,
emptyMessage,
- selectOneLabel
+ selectOneLabel,
+ textFilterOptions,
+ statusFilterOptions,
+ numericFilterOptions,
+ dateFilterOptions
}
export default translationStrings;
\ No newline at end of file