- fixed login with spid fe issue;
- improved 'add user' form; - added new field 'paragraph';
This commit is contained in:
@@ -11,6 +11,7 @@ import BandoService from '../../service/bando-service';
|
|||||||
|
|
||||||
// tools
|
// tools
|
||||||
import getBandoLabel from '../../helpers/getBandoLabel';
|
import getBandoLabel from '../../helpers/getBandoLabel';
|
||||||
|
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
@@ -20,7 +21,6 @@ import BandoEditFormStep1 from './components/BandoEditFormStep1';
|
|||||||
import BandoEditFormStep2 from './components/BandoEditFormStep2';
|
import BandoEditFormStep2 from './components/BandoEditFormStep2';
|
||||||
import { Messages } from 'primereact/messages';
|
import { Messages } from 'primereact/messages';
|
||||||
import FormsService from '../../service/forms-service';
|
import FormsService from '../../service/forms-service';
|
||||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
|
||||||
import BlockingOverlay from '../../components/BlockingOverlay';
|
import BlockingOverlay from '../../components/BlockingOverlay';
|
||||||
|
|
||||||
const BandoEdit = () => {
|
const BandoEdit = () => {
|
||||||
@@ -30,8 +30,6 @@ const BandoEdit = () => {
|
|||||||
const [activeStep, setActiveStep] = useState(null)
|
const [activeStep, setActiveStep] = useState(null)
|
||||||
const [data, setData] = useState({});
|
const [data, setData] = useState({});
|
||||||
const [forms, setForms] = useState([]);
|
const [forms, setForms] = useState([]);
|
||||||
//const [selectedTemplate, setSelectedTemplate] = useState(null);
|
|
||||||
//const [templates, setTemplate] = useState(null);
|
|
||||||
const formRef = useRef(null);
|
const formRef = useRef(null);
|
||||||
const bandoMsgs = useRef(null);
|
const bandoMsgs = useRef(null);
|
||||||
|
|
||||||
@@ -43,23 +41,7 @@ const BandoEdit = () => {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
bandoMsgs.current.clear();
|
bandoMsgs.current.clear();
|
||||||
const isFormValid = formRef.current.isFormValid();
|
|
||||||
//const values = formRef.current.getValues();
|
|
||||||
//const diffData = equal(values, data);
|
|
||||||
// TODO warn about unsaved data
|
|
||||||
goToStep(0);
|
goToStep(0);
|
||||||
/*if (isFormValid) {
|
|
||||||
goToStep(0)
|
|
||||||
} else {
|
|
||||||
bandoMsgs.current.show([
|
|
||||||
{
|
|
||||||
id: '98',
|
|
||||||
sticky: true, severity: 'error', summary: '',
|
|
||||||
detail: __('Potrai andare su altro step dopo risolvere errori della forma', 'gepafin'),
|
|
||||||
closable: true
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -68,25 +50,8 @@ const BandoEdit = () => {
|
|||||||
if (activeStep === 1) {
|
if (activeStep === 1) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
console.log('11');
|
|
||||||
bandoMsgs.current.clear();
|
bandoMsgs.current.clear();
|
||||||
const isFormValid = formRef.current.isFormValid();
|
|
||||||
//const values = formRef.current.getValues();
|
|
||||||
//const diffData = equal(values, data);
|
|
||||||
// TODO warn about unsaved data
|
|
||||||
goToStep(1);
|
goToStep(1);
|
||||||
/*if (isFormValid) {
|
|
||||||
goToStep(1);
|
|
||||||
} else {
|
|
||||||
bandoMsgs.current.show([
|
|
||||||
{
|
|
||||||
id: '98',
|
|
||||||
sticky: true, severity: 'error', summary: '',
|
|
||||||
detail: __('Potrai andare su altro step dopo risolvere errori della forma', 'gepafin'),
|
|
||||||
closable: true
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@@ -271,26 +236,6 @@ const BandoEdit = () => {
|
|||||||
|
|
||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
{/*!isLoading
|
|
||||||
? <div className="pageBando__templateSelection">
|
|
||||||
<div className="appForm__field">
|
|
||||||
<label htmlFor="template">
|
|
||||||
{__('Usa Template Salvato', 'gepafin')}
|
|
||||||
</label>
|
|
||||||
<Dropdown
|
|
||||||
id="template"
|
|
||||||
value={selectedTemplate}
|
|
||||||
onChange={(e) => setSelectedTemplate(e.value)}
|
|
||||||
options={templates}
|
|
||||||
optionLabel="name"
|
|
||||||
placeholder={__('Seleziona template', 'gepafin')}/>
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
onClick={() => console.log('use template')}
|
|
||||||
label={__('Applica', 'gepafin')}
|
|
||||||
icon="pi pi-check"
|
|
||||||
iconPos="right"/>
|
|
||||||
</div> : null*/}
|
|
||||||
{!isEmpty(data)
|
{!isEmpty(data)
|
||||||
? <Steps
|
? <Steps
|
||||||
model={stepItems}
|
model={stepItems}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const BuilderElementProperLabel = ({ id, defaultLabel }) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const element = head(elements.filter(o => o.id === id));
|
const element = head(elements.filter(o => o.id === id));
|
||||||
const setting = head(element.settings.filter(o => o.name === 'label'));
|
const setting = head(element.settings.filter(o => o.name === 'label'));
|
||||||
if (setting.value) {
|
if (setting) {
|
||||||
setLabel(setting.value);
|
setLabel(setting.value);
|
||||||
} else {
|
} else {
|
||||||
setLabel(defaultLabel);
|
setLabel(defaultLabel);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ const ElementSetting = ({ setting, changeFn, updateDataFn }) => {
|
|||||||
step: __('Precisione decimale', 'gepafin'),
|
step: __('Precisione decimale', 'gepafin'),
|
||||||
options: __('Opzioni', 'gepafin'),
|
options: __('Opzioni', 'gepafin'),
|
||||||
mime: __('Tipo di file', 'gepafin'),
|
mime: __('Tipo di file', 'gepafin'),
|
||||||
|
text: __('Testo formattato', 'gepafin')
|
||||||
}
|
}
|
||||||
|
|
||||||
return <div className="formElementSettings__field" key={setting.name}>
|
return <div className="formElementSettings__field" key={setting.name}>
|
||||||
|
|||||||
@@ -23,14 +23,14 @@ const BuilderElementSettings = ({ closeSettings }) => {
|
|||||||
const [validators, setValidators] = useState({});
|
const [validators, setValidators] = useState({});
|
||||||
const textBasedValidatorFields = ['min', 'max', 'minLength', 'maxLength', 'pattern'];
|
const textBasedValidatorFields = ['min', 'max', 'minLength', 'maxLength', 'pattern'];
|
||||||
const customValidationOptions = [
|
const customValidationOptions = [
|
||||||
{value: 'isPIVA', label: 'isPIVA'},
|
{ value: 'isPIVA', label: 'isPIVA' },
|
||||||
{value: 'isCodiceFiscale', label: 'isCodiceFiscale'},
|
{ value: 'isCodiceFiscale', label: 'isCodiceFiscale' },
|
||||||
{value: 'isCAP', label: 'isCAP'},
|
{ value: 'isCAP', label: 'isCAP' },
|
||||||
{value: 'isIBAN', label: 'isIBAN'},
|
{ value: 'isIBAN', label: 'isIBAN' },
|
||||||
{value: 'isEmail', label: 'isEmail'},
|
{ value: 'isEmail', label: 'isEmail' },
|
||||||
{value: 'isEmailPEC', label: 'isEmailPEC'},
|
{ value: 'isEmailPEC', label: 'isEmailPEC' },
|
||||||
{value: 'isUrl', label: 'isUrl'},
|
{ value: 'isUrl', label: 'isUrl' },
|
||||||
{value: 'isMarcaDaBollo', label: 'isMarcaDaBollo'}
|
{ value: 'isMarcaDaBollo', label: 'isMarcaDaBollo' }
|
||||||
]
|
]
|
||||||
|
|
||||||
const onChange = (value, name) => {
|
const onChange = (value, name) => {
|
||||||
@@ -116,48 +116,49 @@ const BuilderElementSettings = ({ closeSettings }) => {
|
|||||||
updateDataFn={onUpdateOptions}/>)
|
updateDataFn={onUpdateOptions}/>)
|
||||||
: null}
|
: null}
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel header={__('Validation', 'gepafin')}>
|
{!isEmpty(validators)
|
||||||
{validators
|
? <TabPanel header={__('Validation', 'gepafin')}>
|
||||||
? Object.keys(validators).map((k) => <div
|
{validators
|
||||||
className="formElementSettings__field" key={k}>
|
? Object.keys(validators).map((k) => <div
|
||||||
{k === 'isRequired'
|
className="formElementSettings__field" key={k}>
|
||||||
? <div className="formElementSettings__field">
|
{k === 'isRequired'
|
||||||
<label htmlFor={k}>{__('Obligatorio?', 'gepafin')}</label>
|
? <div className="formElementSettings__field">
|
||||||
<InputSwitch
|
<label htmlFor={k}>{__('Obligatorio?', 'gepafin')}</label>
|
||||||
checked={validators[k]}
|
<InputSwitch
|
||||||
onChange={(e) => toggleRequired(e.value, k)}/>
|
checked={validators[k]}
|
||||||
</div>
|
onChange={(e) => toggleRequired(e.value, k)}/>
|
||||||
: null}
|
</div>
|
||||||
{textBasedValidatorFields.includes(k) || 'custom' === k
|
: null}
|
||||||
? <div className="formElementSettings__field">
|
{textBasedValidatorFields.includes(k) || 'custom' === k
|
||||||
<label htmlFor={`enable_${k}`}>{sprintf(__('Set %s', 'gepafin'), k)}</label>
|
? <div className="formElementSettings__field">
|
||||||
<InputSwitch
|
<label htmlFor={`enable_${k}`}>{sprintf(__('Set %s', 'gepafin'), k)}</label>
|
||||||
checked={!isNil(validators[k])}
|
<InputSwitch
|
||||||
onChange={(e) => showField(e.value, k)}/>
|
checked={!isNil(validators[k])}
|
||||||
</div>
|
onChange={(e) => showField(e.value, k)}/>
|
||||||
: null}
|
</div>
|
||||||
{k === 'custom' && !isNil(validators[k])
|
: null}
|
||||||
? <div className="formElementSettings__field">
|
{k === 'custom' && !isNil(validators[k])
|
||||||
<label htmlFor={k}>{__('Personalizzato', 'gepafin')}</label>
|
? <div className="formElementSettings__field">
|
||||||
<Dropdown
|
<label htmlFor={k}>{__('Personalizzato', 'gepafin')}</label>
|
||||||
id={`enable_${k}`}
|
<Dropdown
|
||||||
value={validators[k]}
|
id={`enable_${k}`}
|
||||||
onChange={(e) => onChangeValidator(e.value, k)}
|
value={validators[k]}
|
||||||
options={customValidationOptions}
|
onChange={(e) => onChangeValidator(e.value, k)}
|
||||||
optionLabel="label"
|
options={customValidationOptions}
|
||||||
optionValue="value"
|
optionLabel="label"
|
||||||
placeholder={__('Scegli', 'gepafin')}/>
|
optionValue="value"
|
||||||
</div>
|
placeholder={__('Scegli', 'gepafin')}/>
|
||||||
: null}
|
</div>
|
||||||
{textBasedValidatorFields.includes(k) && !isNil(validators[k])
|
: null}
|
||||||
? <div className="formElementSettings__field">
|
{textBasedValidatorFields.includes(k) && !isNil(validators[k])
|
||||||
<label htmlFor={k}>{k}</label>
|
? <div className="formElementSettings__field">
|
||||||
<InputText id={k} aria-describedby={`${k}-help`}
|
<label htmlFor={k}>{k}</label>
|
||||||
value={validators[k]}
|
<InputText id={k} aria-describedby={`${k}-help`}
|
||||||
onChange={(e) => onChangeValidator(e.target.value, k)}/>
|
value={validators[k]}
|
||||||
</div> : null}
|
onChange={(e) => onChangeValidator(e.target.value, k)}/>
|
||||||
</div>) : null}
|
</div> : null}
|
||||||
</TabPanel>
|
</div>) : null}
|
||||||
|
</TabPanel> : null}
|
||||||
</TabView>
|
</TabView>
|
||||||
|
|
||||||
<Button label={__('Salva', 'gepafin')} onClick={saveSettings}/>
|
<Button label={__('Salva', 'gepafin')} onClick={saveSettings}/>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const Login = () => {
|
|||||||
|
|
||||||
const loginWithSpid = () => {
|
const loginWithSpid = () => {
|
||||||
if (!loading) {
|
if (!loading) {
|
||||||
//window.location.replace(`${API_BASE_URL}/saml2/authenticate/loginumbria`);
|
window.location.replace(`${API_BASE_URL}/saml2/authenticate/loginumbria`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { isEmpty } from 'ramda';
|
import { isEmpty, isNil } from 'ramda';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import AllUsersTable from './components/AllUsersTable';
|
import AllUsersTable from './components/AllUsersTable';
|
||||||
@@ -12,6 +12,7 @@ import UserService from '../../service/user-service';
|
|||||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||||
import { storeSet } from '../../store';
|
import { storeSet } from '../../store';
|
||||||
import { klona } from 'klona';
|
import { klona } from 'klona';
|
||||||
|
import { classNames } from 'primereact/utils';
|
||||||
|
|
||||||
const Users = () => {
|
const Users = () => {
|
||||||
const [isVisibleEditDialog, setIsVisibleEditDialog] = useState(false);
|
const [isVisibleEditDialog, setIsVisibleEditDialog] = useState(false);
|
||||||
@@ -112,32 +113,37 @@ const Users = () => {
|
|||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
<div className="appForm__cols">
|
<div className="appForm__cols">
|
||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
<label>{__('Nome', 'gepafin')}*</label>
|
<label className={classNames({ 'p-error': isEmpty(newUserData.firstName) || isNil(newUserData.firstName) })}>{__('Nome', 'gepafin')}*</label>
|
||||||
<InputText value={newUserData.firstName}
|
<InputText value={newUserData.firstName}
|
||||||
|
invalid={isEmpty(newUserData.firstName) || isNil(newUserData.firstName)}
|
||||||
onChange={(e) => onChangeEditItem(e.target.value, 'firstName')}/>
|
onChange={(e) => onChangeEditItem(e.target.value, 'firstName')}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
<label>{__('Cognome', 'gepafin')}*</label>
|
<label className={classNames({ 'p-error': isEmpty(newUserData.lastName) || isNil(newUserData.lastName) })}>{__('Cognome', 'gepafin')}*</label>
|
||||||
<InputText value={newUserData.lastName}
|
<InputText value={newUserData.lastName}
|
||||||
|
invalid={isEmpty(newUserData.lastName) || isNil(newUserData.lastName)}
|
||||||
onChange={(e) => onChangeEditItem(e.target.value, 'lastName')}/>
|
onChange={(e) => onChangeEditItem(e.target.value, 'lastName')}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="appForm__cols">
|
<div className="appForm__cols">
|
||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
<label>{__('Email', 'gepafin')}*</label>
|
<label className={classNames({ 'p-error': isEmpty(newUserData.email) || isNil(newUserData.email) })}>{__('Email', 'gepafin')}*</label>
|
||||||
<InputText value={newUserData.email}
|
<InputText value={newUserData.email}
|
||||||
|
invalid={isEmpty(newUserData.email) || isNil(newUserData.email)}
|
||||||
onChange={(e) => onChangeEditItem(e.target.value, 'email')}/>
|
onChange={(e) => onChangeEditItem(e.target.value, 'email')}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
<label>{__('Telefono', 'gepafin')}</label>
|
<label className={classNames({ 'p-error': isEmpty(newUserData.phoneNumber) || isNil(newUserData.phoneNumber) })}>{__('Telefono', 'gepafin')}</label>
|
||||||
<InputText value={newUserData.phoneNumber}
|
<InputText value={newUserData.phoneNumber}
|
||||||
|
invalid={isEmpty(newUserData.phoneNumber) || isNil(newUserData.phoneNumber)}
|
||||||
onChange={(e) => onChangeEditItem(e.target.value, 'phoneNumber')}/>
|
onChange={(e) => onChangeEditItem(e.target.value, 'phoneNumber')}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
<label>{__('Ruolo', 'gepafin')}</label>
|
<label className={classNames({ 'p-error': isEmpty(newUserData.role) || isNil(newUserData.role) })}>{__('Ruolo', 'gepafin')}</label>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
value={newUserData.role}
|
value={newUserData.role}
|
||||||
|
invalid={isEmpty(newUserData.role) || isNil(newUserData.role)}
|
||||||
onChange={(e) => onChangeEditItem(e.value, 'role')}
|
onChange={(e) => onChangeEditItem(e.value, 'role')}
|
||||||
options={roles}
|
options={roles}
|
||||||
optionLabel="name"
|
optionLabel="name"
|
||||||
|
|||||||
@@ -719,5 +719,19 @@ export const elementItems = [
|
|||||||
isRequired: false,
|
isRequired: false,
|
||||||
custom: 'isMarcaDaBollo'
|
custom: 'isMarcaDaBollo'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 19,
|
||||||
|
sortOrder: 19,
|
||||||
|
name: 'paragraph',
|
||||||
|
label: 'Paragrafo',
|
||||||
|
description: 'Semplice testo formattato',
|
||||||
|
settings: [
|
||||||
|
{
|
||||||
|
name: "text",
|
||||||
|
value: "Testo formattato"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
validators: {}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user