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