- merged with master;
- fixed registartion form - added hub id; - fixed bando view for beneficiario after switching company;
This commit is contained in:
@@ -18,7 +18,6 @@ const Datepicker = ({
|
|||||||
disabled = false,
|
disabled = false,
|
||||||
timeOnly = false
|
timeOnly = false
|
||||||
}) => {
|
}) => {
|
||||||
console.log('defaultValue', defaultValue)
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<label htmlFor={fieldName} className={classNames({ 'p-error': errors[fieldName] })}>
|
<label htmlFor={fieldName} className={classNames({ 'p-error': errors[fieldName] })}>
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { classNames } from 'primereact/utils';
|
import { classNames } from 'primereact/utils';
|
||||||
import { Controller } from 'react-hook-form';
|
import { Controller } from 'react-hook-form';
|
||||||
import { InputNumber } from 'primereact/inputnumber';
|
import { is } from 'ramda';
|
||||||
|
|
||||||
|
import { InputNumber } from 'primereact/inputnumber';
|
||||||
|
|
||||||
const NumberInput = ({
|
const NumberInput = ({
|
||||||
fieldName,
|
fieldName,
|
||||||
@@ -25,7 +26,7 @@ const NumberInput = ({
|
|||||||
const input = <Controller
|
const input = <Controller
|
||||||
name={fieldName}
|
name={fieldName}
|
||||||
control={control}
|
control={control}
|
||||||
defaultValue={defaultValue}
|
defaultValue={is(Number, defaultValue) ? defaultValue : 0}
|
||||||
rules={config}
|
rules={config}
|
||||||
render={({ field, fieldState }) => (
|
render={({ field, fieldState }) => (
|
||||||
<InputNumber inputId={field.name}
|
<InputNumber inputId={field.name}
|
||||||
@@ -36,8 +37,8 @@ const NumberInput = ({
|
|||||||
max={max}
|
max={max}
|
||||||
locale={locale}
|
locale={locale}
|
||||||
useGrouping={useGrouping}
|
useGrouping={useGrouping}
|
||||||
maxFractionDigits={maxFractionDigits}
|
maxFractionDigits={!isNaN(parseInt(maxFractionDigits)) ? parseInt(maxFractionDigits) : 0}
|
||||||
minFractionDigits={minFractionDigits}
|
minFractionDigits={!isNaN(parseInt(minFractionDigits)) ? parseInt(minFractionDigits) : 0}
|
||||||
className={classNames({ 'p-invalid': fieldState.invalid })}/>
|
className={classNames({ 'p-invalid': fieldState.invalid })}/>
|
||||||
)}/>
|
)}/>
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ const TopBarProfileMenu = ({ menuLeftRef }) => {
|
|||||||
const switchCompany = (id) => {
|
const switchCompany = (id) => {
|
||||||
if (chosenCompanyId !== id) {
|
if (chosenCompanyId !== id) {
|
||||||
storeSet.main.chosenCompanyId(id);
|
storeSet.main.chosenCompanyId(id);
|
||||||
console.log('set company 2', id)
|
|
||||||
if (toast.current) {
|
if (toast.current) {
|
||||||
toast.current.show({
|
toast.current.show({
|
||||||
severity: 'success',
|
severity: 'success',
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { __ } from '@wordpress/i18n';
|
|
||||||
|
|
||||||
const getBandoSeverity = (status) => {
|
const getBandoSeverity = (status) => {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 'ACTIVE':
|
case 'ACTIVE':
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText';
|
|||||||
import { defaultMaxFileSize } from '../../configData';
|
import { defaultMaxFileSize } from '../../configData';
|
||||||
|
|
||||||
const BandoApplication = () => {
|
const BandoApplication = () => {
|
||||||
|
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const [formData, setFormData] = useState([]);
|
const [formData, setFormData] = useState([]);
|
||||||
const [formInitialData, setFormInitialData] = useState(null);
|
const [formInitialData, setFormInitialData] = useState(null);
|
||||||
@@ -165,7 +166,7 @@ const BandoApplication = () => {
|
|||||||
fieldVal = tzAwareDate.toISOString().substring(0, 19);
|
fieldVal = tzAwareDate.toISOString().substring(0, 19);
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldVal = !fieldVal ? null : fieldVal;
|
fieldVal = isEmpty(fieldVal) ? null : fieldVal;
|
||||||
if (formField && formField.name === 'fileupload') {
|
if (formField && formField.name === 'fileupload') {
|
||||||
fieldVal = is(Array, fieldVal) ? fieldVal.map(o => o.id).join(',') : null;
|
fieldVal = is(Array, fieldVal) ? fieldVal.map(o => o.id).join(',') : null;
|
||||||
}
|
}
|
||||||
@@ -450,7 +451,7 @@ const BandoApplication = () => {
|
|||||||
storeSet.main.setAsyncRequest();
|
storeSet.main.setAsyncRequest();
|
||||||
ApplicationService.getApplicationForm(applId, getApplFormCallback, errGetApplFormCallbacks);
|
ApplicationService.getApplicationForm(applId, getApplFormCallback, errGetApplFormCallbacks);
|
||||||
}
|
}
|
||||||
}, [id]);
|
}, [id, chosenCompanyId]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="appPage">
|
<div className="appPage">
|
||||||
|
|||||||
@@ -64,6 +64,13 @@ const ElementSetting = ({ setting, changeFn, updateDataFn }) => {
|
|||||||
onTextChange={(e) => changeFn(e.htmlValue, setting.name)}
|
onTextChange={(e) => changeFn(e.htmlValue, setting.name)}
|
||||||
style={{ height: 80 * 4 }}
|
style={{ height: 80 * 4 }}
|
||||||
/>
|
/>
|
||||||
|
} else if (setting.name === 'step') {
|
||||||
|
return <InputText id={setting.name}
|
||||||
|
keyfilter="int"
|
||||||
|
aria-describedby={`${setting.name}-help`}
|
||||||
|
placeholder="0"
|
||||||
|
value={setting.value}
|
||||||
|
onChange={(e) => changeFn(e.target.value, setting.name)}/>
|
||||||
} else if (setting.name === 'table_columns') {
|
} else if (setting.name === 'table_columns') {
|
||||||
return <ElementSettingTableColumns
|
return <ElementSettingTableColumns
|
||||||
value={is(Object, setting.value) ? setting.value : {}}
|
value={is(Object, setting.value) ? setting.value : {}}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const BuilderElementSettings = ({ closeSettingsFn }) => {
|
|||||||
const [validators, setValidators] = useState({});
|
const [validators, setValidators] = useState({});
|
||||||
const [dynamicData, setDynamicData] = useState('');
|
const [dynamicData, setDynamicData] = useState('');
|
||||||
const [criteria, setCriteria] = useState([]);
|
const [criteria, setCriteria] = useState([]);
|
||||||
const textBasedValidatorFields = ['min', 'max', 'minLength', 'maxLength', 'pattern'];
|
const numberBasedValidatorFields = ['min', 'max', 'minLength', 'maxLength'];
|
||||||
const customValidationOptions = [
|
const customValidationOptions = [
|
||||||
{ value: 'isPIVA', label: 'isPIVA' },
|
{ value: 'isPIVA', label: 'isPIVA' },
|
||||||
{ value: 'isCodiceFiscale', label: 'isCodiceFiscale' },
|
{ value: 'isCodiceFiscale', label: 'isCodiceFiscale' },
|
||||||
@@ -99,7 +99,7 @@ const BuilderElementSettings = ({ closeSettingsFn }) => {
|
|||||||
newValidators[name] = value;
|
newValidators[name] = value;
|
||||||
setValidators(newValidators);
|
setValidators(newValidators);
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChangeCriteriaData = (value) => {
|
const onChangeCriteriaData = (value) => {
|
||||||
setCriteria(value);
|
setCriteria(value);
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ const BuilderElementSettings = ({ closeSettingsFn }) => {
|
|||||||
onChange={(e) => toggleRequired(e.value, k)}/>
|
onChange={(e) => toggleRequired(e.value, k)}/>
|
||||||
</div>
|
</div>
|
||||||
: null}
|
: null}
|
||||||
{textBasedValidatorFields.includes(k) || 'custom' === k
|
{numberBasedValidatorFields.includes(k) || 'pattern' === k || 'custom' === k
|
||||||
? <div className="formElementSettings__field">
|
? <div className="formElementSettings__field">
|
||||||
<label htmlFor={`enable_${k}`}>{sprintf(__('Set %s', 'gepafin'), k)}</label>
|
<label htmlFor={`enable_${k}`}>{sprintf(__('Set %s', 'gepafin'), k)}</label>
|
||||||
<InputSwitch
|
<InputSwitch
|
||||||
@@ -212,13 +212,23 @@ const BuilderElementSettings = ({ closeSettingsFn }) => {
|
|||||||
placeholder={__('Scegli', 'gepafin')}/>
|
placeholder={__('Scegli', 'gepafin')}/>
|
||||||
</div>
|
</div>
|
||||||
: null}
|
: null}
|
||||||
{textBasedValidatorFields.includes(k) && !isNil(validators[k])
|
{'pattern' === k && !isNil(validators[k])
|
||||||
? <div className="formElementSettings__field">
|
? <div className="formElementSettings__field">
|
||||||
<label htmlFor={k}>{k}</label>
|
<label htmlFor={k}>{k}</label>
|
||||||
<InputText id={k} aria-describedby={`${k}-help`}
|
<InputText id={k} aria-describedby={`${k}-help`}
|
||||||
value={validators[k]}
|
value={validators[k]}
|
||||||
onChange={(e) => onChangeValidator(e.target.value, k)}/>
|
onChange={(e) => onChangeValidator(e.target.value, k)}/>
|
||||||
</div> : null}
|
</div> : null}
|
||||||
|
{numberBasedValidatorFields.includes(k) && !isNil(validators[k])
|
||||||
|
? <div className="formElementSettings__field">
|
||||||
|
<label htmlFor={k}>{k}</label>
|
||||||
|
<InputText id={k}
|
||||||
|
aria-describedby={`${k}-help`}
|
||||||
|
value={validators[k]}
|
||||||
|
keyfilter="int"
|
||||||
|
placeholder="0"
|
||||||
|
onChange={(e) => onChangeValidator(e.target.value, k)}/>
|
||||||
|
</div> : null}
|
||||||
</div>) : null}
|
</div>) : null}
|
||||||
</TabPanel> : null}
|
</TabPanel> : null}
|
||||||
<TabPanel header={__('Criteri', 'gepafin')}>
|
<TabPanel header={__('Criteri', 'gepafin')}>
|
||||||
|
|||||||
@@ -130,11 +130,11 @@ const BandoViewBeneficiario = () => {
|
|||||||
'isVisible': false
|
'isVisible': false
|
||||||
}
|
}
|
||||||
storeSet.main.setAsyncRequest();
|
storeSet.main.setAsyncRequest();
|
||||||
FaqItemService.addQuestion(id, obj, createCallBack, errCreateCallback, [['companyId', chosenCompanyId]])
|
FaqItemService.addQuestion(id, obj, createQuestionBack, errCreateQuestionCallback, [['companyId', chosenCompanyId]])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const createCallBack = (data) => {
|
const createQuestionBack = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
setNewQuestion('');
|
setNewQuestion('');
|
||||||
if (toast.current) {
|
if (toast.current) {
|
||||||
@@ -148,7 +148,7 @@ const BandoViewBeneficiario = () => {
|
|||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
const errCreateCallback = (data) => {
|
const errCreateQuestionCallback = (data) => {
|
||||||
if (toast.current && data.message) {
|
if (toast.current && data.message) {
|
||||||
toast.current.show({
|
toast.current.show({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
@@ -219,8 +219,11 @@ const BandoViewBeneficiario = () => {
|
|||||||
const bandoId = getBandoId();
|
const bandoId = getBandoId();
|
||||||
storeSet.main.setAsyncRequest();
|
storeSet.main.setAsyncRequest();
|
||||||
BandoService.getBando(bandoId, getBandoCallback, errGetBandoCallback);
|
BandoService.getBando(bandoId, getBandoCallback, errGetBandoCallback);
|
||||||
ApplicationService.getApplications(getApplCallback, errGetApplCallback, [['callId', bandoId]])
|
ApplicationService.getApplications(getApplCallback, errGetApplCallback, [
|
||||||
}, [id]);
|
['callId', bandoId],
|
||||||
|
['companyId', chosenCompanyId]
|
||||||
|
])
|
||||||
|
}, [id, chosenCompanyId]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="appPage">
|
<div className="appPage">
|
||||||
|
|||||||
@@ -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 { uniq } from 'ramda';
|
import { uniq, is } from 'ramda';
|
||||||
|
|
||||||
// tools
|
// tools
|
||||||
import getBandoLabel from '../../../../helpers/getBandoLabel';
|
import getBandoLabel from '../../../../helpers/getBandoLabel';
|
||||||
@@ -26,6 +26,7 @@ import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse
|
|||||||
|
|
||||||
|
|
||||||
const MyLatestSubmissionsTable = () => {
|
const MyLatestSubmissionsTable = () => {
|
||||||
|
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||||
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||||
const [items, setItems] = useState(null);
|
const [items, setItems] = useState(null);
|
||||||
const [filters, setFilters] = useState(null);
|
const [filters, setFilters] = useState(null);
|
||||||
@@ -34,12 +35,14 @@ const MyLatestSubmissionsTable = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLocalAsyncRequest(true);
|
setLocalAsyncRequest(true);
|
||||||
ApplicationService.getApplications(getApplCallback, errGetApplCallback)
|
ApplicationService.getApplications(getApplCallback, errGetApplCallback, [
|
||||||
}, []);
|
['companyId', chosenCompanyId]
|
||||||
|
])
|
||||||
|
}, [chosenCompanyId]);
|
||||||
|
|
||||||
const getApplCallback = (data) => {
|
const getApplCallback = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
if (data.data.length) {
|
if (is(Array, data.data)) {
|
||||||
setItems(getFormattedBandiData(data.data));
|
setItems(getFormattedBandiData(data.data));
|
||||||
setStatuses(uniq(items.map(o => o.status)))
|
setStatuses(uniq(items.map(o => o.status)))
|
||||||
initFilters();
|
initFilters();
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import { Panel } from 'primereact/panel';
|
|||||||
import { Dialog } from 'primereact/dialog';
|
import { Dialog } from 'primereact/dialog';
|
||||||
import getDateFromISOstring from '../../helpers/getDateFromISOstring';
|
import getDateFromISOstring from '../../helpers/getDateFromISOstring';
|
||||||
|
|
||||||
|
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||||
|
|
||||||
const Registration = () => {
|
const Registration = () => {
|
||||||
const token = useStore().main.token();
|
const token = useStore().main.token();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
@@ -47,7 +49,8 @@ const Registration = () => {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
const newFormData = {
|
const newFormData = {
|
||||||
...formData,
|
...formData,
|
||||||
dateOfBirth: originalDateOfBirth
|
dateOfBirth: originalDateOfBirth,
|
||||||
|
hubUuid: APP_HUB_ID
|
||||||
}
|
}
|
||||||
|
|
||||||
AuthenticationService.registerUser(newFormData, regCallback, regError, [
|
AuthenticationService.registerUser(newFormData, regCallback, regError, [
|
||||||
|
|||||||
Reference in New Issue
Block a user