Merge branch 'develop' into feature/46-forms-flow-preview
This commit is contained in:
@@ -290,21 +290,23 @@ const BandoForms = () => {
|
||||
<h2>{__('Modifica form esistente', 'gepafin')}</h2>
|
||||
<div className="row">
|
||||
<p>{__('Continua a lavorare su un form precedentemente salvato', 'gepafin')}</p>
|
||||
<Dropdown
|
||||
id="form"
|
||||
disabled={isEmpty(forms)}
|
||||
value={selectedForm}
|
||||
onChange={(e) => setSelectedForm(e.value)}
|
||||
options={forms}
|
||||
optionLabel="label"
|
||||
placeholder={__('Seleziona form', 'gepafin')}/>
|
||||
<Button
|
||||
type="button"
|
||||
outlined
|
||||
disabled={!selectedForm}
|
||||
onClick={goToEditForm}
|
||||
label={__('Modifica', 'gepafin')}
|
||||
icon="pi pi-cog" iconPos="right"/>
|
||||
<div className="row">
|
||||
<Dropdown
|
||||
id="form"
|
||||
disabled={isEmpty(forms)}
|
||||
value={selectedForm}
|
||||
onChange={(e) => setSelectedForm(e.value)}
|
||||
options={forms}
|
||||
optionLabel="label"
|
||||
placeholder={__('Seleziona form', 'gepafin')}/>
|
||||
<Button
|
||||
type="button"
|
||||
outlined
|
||||
disabled={!selectedForm}
|
||||
onClick={goToEditForm}
|
||||
label={__('Modifica', 'gepafin')}
|
||||
icon="pi pi-cog" iconPos="right"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -19,10 +19,11 @@ const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => {
|
||||
placeholder: __('Segnaposto', 'gepafin'),
|
||||
step: __('Numero Decimali', 'gepafin'),
|
||||
isRequestedAmount: __('Importo richiesto', 'gepafin'),
|
||||
isDelegation: __('Delega', 'gepafin'),
|
||||
options: __('Opzioni', 'gepafin'),
|
||||
mime: __('Tipo di file', 'gepafin'),
|
||||
text: __('Testo formattato', 'gepafin'),
|
||||
table_columns: __('Colonne', 'gepafin'),
|
||||
table_columns: '',
|
||||
}
|
||||
|
||||
const renderHeader = () => {
|
||||
@@ -80,7 +81,7 @@ const ElementSetting = ({ setting, changeFn, updateDataFn, bandoStatus }) => {
|
||||
name={setting.name}
|
||||
bandoStatus={bandoStatus}
|
||||
setDataFn={updateDataFn}/>
|
||||
} else if (setting.name === 'isRequestedAmount') {
|
||||
} else if (['isRequestedAmount', 'isDelegation'].includes(setting.name)) {
|
||||
return <InputSwitch
|
||||
checked={setting.value}
|
||||
onChange={(e) => changeFn(e.value, setting.name)}/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { __, sprintf } from '@wordpress/i18n';
|
||||
import { wrap } from 'object-path-immutable';
|
||||
import { pathOr } from 'ramda';
|
||||
import { isEmpty, pathOr } from 'ramda';
|
||||
|
||||
// components
|
||||
import { InputText } from 'primereact/inputtext';
|
||||
@@ -10,6 +10,8 @@ import { InputSwitch } from 'primereact/inputswitch';
|
||||
|
||||
// tools
|
||||
import uniqid from '../../../../../../helpers/uniqid';
|
||||
import { Dropdown } from 'primereact/dropdown';
|
||||
import { Accordion, AccordionTab } from 'primereact/accordion';
|
||||
|
||||
const ElementSettingTableColumns = ({
|
||||
value,
|
||||
@@ -55,6 +57,37 @@ const ElementSettingTableColumns = ({
|
||||
setStateFieldData(newData);
|
||||
}
|
||||
|
||||
const onLastRowInputChange = (e, index) => {
|
||||
const { value } = e.target;
|
||||
const newData = stateFieldData.map((o, i) => {
|
||||
if (i === index) {
|
||||
o.lastRowText = value;
|
||||
}
|
||||
return o;
|
||||
})
|
||||
setStateFieldData(newData);
|
||||
}
|
||||
|
||||
const onTypeChange = (value, index) => {
|
||||
const newData = stateFieldData.map((o, i) => {
|
||||
if (i === index) {
|
||||
o.fieldtype = value;
|
||||
}
|
||||
return o;
|
||||
})
|
||||
setStateFieldData(newData);
|
||||
}
|
||||
|
||||
const onLastRowFormulaChange = (value, index) => {
|
||||
const newData = stateFieldData.map((o, i) => {
|
||||
if (i === index) {
|
||||
o.lastRowFormula = value;
|
||||
}
|
||||
return o;
|
||||
})
|
||||
setStateFieldData(newData);
|
||||
}
|
||||
|
||||
const onSubInputChange = (e, name, index) => {
|
||||
const { value } = e.target;
|
||||
const newRowsData = wrap(rowsData).set([index, name], value).value();
|
||||
@@ -83,23 +116,133 @@ const ElementSettingTableColumns = ({
|
||||
setStateFieldData(newData);
|
||||
}
|
||||
|
||||
const properField = (item, i) => {
|
||||
const setColFormulaChecked = (index) => {
|
||||
const newData = stateFieldData.map((o, i) => {
|
||||
if (i === index) {
|
||||
const newVal = o.enableFormula !== true;
|
||||
o.enableFormula = newVal;
|
||||
if (newVal) {
|
||||
o.lastRowFormula = 'sum';
|
||||
o.fieldtype = 'numeric';
|
||||
delete o.lastRowText;
|
||||
} else {
|
||||
delete o.lastRowFormula;
|
||||
delete o.fieldtype;
|
||||
o.lastRowText = '';
|
||||
}
|
||||
}
|
||||
return o;
|
||||
});
|
||||
setStateFieldData(newData);
|
||||
}
|
||||
|
||||
const handleClearLastRowData = useCallback(() => {
|
||||
const newData = stateFieldData.map((o) => {
|
||||
delete o.lastRowFormula;
|
||||
o.lastRowText = '';
|
||||
delete o.enableFormula;
|
||||
|
||||
return o;
|
||||
});
|
||||
|
||||
setStateFieldData(newData);
|
||||
}, [stateFieldData]);
|
||||
|
||||
const properFields = (item, i) => {
|
||||
return <>
|
||||
<InputText value={item.label} onInput={(e) => onInputChange(e, i)}/>
|
||||
<div className="flex-1">
|
||||
<span>{__('Predefinito?', 'gepafin')}</span>
|
||||
<div>
|
||||
<InputText
|
||||
value={item.label}
|
||||
placeholder={sprintf(__('Colonna %d', 'gepafin'), i + 1)}
|
||||
onInput={(e) => onInputChange(e, i)}/>
|
||||
</div>
|
||||
<div>
|
||||
<Dropdown
|
||||
disabled={item.enableFormula}
|
||||
value={item.fieldtype ? item.fieldtype : 'text'}
|
||||
onChange={(e) => onTypeChange(e.value, i)}
|
||||
options={[
|
||||
{ value: 'text', label: __('Testo', 'gepafin') },
|
||||
{ value: 'numeric', label: __('Numerico', 'gepafin') }
|
||||
]}/>
|
||||
</div>
|
||||
<div>
|
||||
<button
|
||||
className="formElementSettings__repeaterItemIconBtn"
|
||||
onClick={() => setColFormulaChecked(i)}
|
||||
data-active={item.enableFormula ? item.enableFormula : false}
|
||||
type="button">
|
||||
<i className="pi pi-calculator"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<InputSwitch
|
||||
checked={item.predefined}
|
||||
disabled={bandoStatus === 'PUBLISH'}
|
||||
onChange={(e) => setChecked(e.value, i)}/>
|
||||
</div>
|
||||
<div>
|
||||
<Button icon="pi pi-times"
|
||||
disabled={bandoStatus === 'PUBLISH'}
|
||||
className="p-button-danger"
|
||||
onClick={() => removeItem(i)}/>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
|
||||
const properSubField = (item, i, name) => {
|
||||
return <InputText value={item[name]} onInput={(e) => onSubInputChange(e, name, i)}/>
|
||||
return <>
|
||||
<div>
|
||||
<InputText value={item[name]} onInput={(e) => onSubInputChange(e, name, i)}/>
|
||||
</div>
|
||||
<div>
|
||||
<Button icon="pi pi-times"
|
||||
disabled={bandoStatus === 'PUBLISH'}
|
||||
className="p-button-danger"
|
||||
onClick={() => removeRow(i)}/>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
|
||||
const properFieldsLastRow = useCallback((item, i) => {
|
||||
return <>
|
||||
<div>
|
||||
<span>{sprintf(__('Colonna %d'), i + 1)}</span>
|
||||
</div>
|
||||
{item.enableFormula
|
||||
? <div>
|
||||
<Dropdown
|
||||
value={item.lastRowFormula}
|
||||
onChange={(e) => onLastRowFormulaChange(e.value, i)}
|
||||
options={[
|
||||
{ value: 'sum', label: __('Somma automatica', 'gepafin') }
|
||||
]}/>
|
||||
</div>
|
||||
: <div>
|
||||
<InputText
|
||||
value={item.lastRowText ? item.lastRowText : ''}
|
||||
onInput={(e) => onLastRowInputChange(e, i)}/>
|
||||
</div>}
|
||||
</>
|
||||
}, [stateFieldData]);
|
||||
|
||||
const lastRow = <div className="formElementSettings__repeater">
|
||||
<div className="formElementSettings__lastRowHeader">
|
||||
<div className="formElementSettings__lastRowHeaderTitle">
|
||||
{__('Definisci ultima righa', 'gepafin')}
|
||||
</div>
|
||||
<Button type="button"
|
||||
outlined
|
||||
label={__('Pulisci', 'gepafin')}
|
||||
iconPos="right"
|
||||
icon="pi pi-refresh"
|
||||
onClick={handleClearLastRowData}/>
|
||||
</div>
|
||||
{stateFieldData.map((o, i) => <div key={i} className="formElementSettings__lastRowItem">
|
||||
{properFieldsLastRow(o, i)}
|
||||
</div>)}
|
||||
</div>;
|
||||
|
||||
useEffect(() => {
|
||||
const stateFieldData = pathOr([], ['stateFieldData'], value);
|
||||
setStateFieldData(stateFieldData);
|
||||
@@ -114,44 +257,51 @@ const ElementSettingTableColumns = ({
|
||||
});
|
||||
}, [stateFieldData, rowsData]);
|
||||
|
||||
stateFieldData.filter(o => o.predefined)
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="formElementSettings__repeater">
|
||||
{stateFieldData.length > 0
|
||||
? <div className="formElementSettings__repeaterItem">
|
||||
<div>{__('Colonne', 'gepafin')}</div>
|
||||
<div>{__('Tipo', 'gepafin')}</div>
|
||||
<div>{__('Calcola', 'gepafin')}</div>
|
||||
<div>{__('Predefinito?', 'gepafin')}</div>
|
||||
<div></div>
|
||||
</div> : null}
|
||||
{stateFieldData.map((o, i) => <div key={i} className="formElementSettings__repeaterItem">
|
||||
<div className="p-inputgroup flex-1">
|
||||
{properField(o, i)}
|
||||
<Button icon="pi pi-times" disabled={bandoStatus === 'PUBLISH'} className="p-button-danger" onClick={() => removeItem(i)}/>
|
||||
</div>
|
||||
{properFields(o, i)}
|
||||
</div>)}
|
||||
<Button type="button" disabled={bandoStatus === 'PUBLISH'} outlined label={__('Aggiungi', 'gepafin')} onClick={addNewItem}/>
|
||||
<Button type="button" disabled={bandoStatus === 'PUBLISH'} outlined
|
||||
label={__('Aggiungi colonna', 'gepafin')} onClick={addNewItem}/>
|
||||
</div>
|
||||
{stateFieldData
|
||||
.filter(o => o.predefined)
|
||||
.map((o, i) => <div key={i} className="formElementSettings__repeaterItem">
|
||||
<div className="formElementSettings__repeater formElementSettings__subRepeater">
|
||||
<label>{__('Righe per colonna:', 'gepafin')} <strong>{o.label}</strong></label>
|
||||
<div className="formElementSettings__repeater">
|
||||
{rowsData.map((c, k) => {
|
||||
return <div key={k} className="formElementSettings__repeaterItem">
|
||||
<div className="p-inputgroup flex-1">
|
||||
{properSubField(c, k, o.name)}
|
||||
<Button icon="pi pi-times"
|
||||
disabled={bandoStatus === 'PUBLISH'}
|
||||
className="p-button-danger"
|
||||
onClick={() => removeRow(k)}/>
|
||||
</div>
|
||||
</div>
|
||||
})}
|
||||
<Button type="button"
|
||||
outlined
|
||||
disabled={bandoStatus === 'PUBLISH'}
|
||||
label={__('Aggiungi una riga', 'gepafin')}
|
||||
onClick={addNewRow}/>
|
||||
</div>
|
||||
</div>
|
||||
</div>)}
|
||||
.filter(o => o.predefined).length > 0
|
||||
? <div className="formElementSettings__subRepeaterWrapper">
|
||||
<Accordion activeIndex={0}>
|
||||
{stateFieldData
|
||||
//.filter(o => o.predefined)
|
||||
.map((o, i) =>
|
||||
o.predefined
|
||||
? <AccordionTab
|
||||
key={i}
|
||||
header={sprintf(__('Righe per colonna: %s'), !isEmpty(o.label) ? o.label : i + 1)}>
|
||||
<div className="formElementSettings__subRepeaterWrapper">
|
||||
{rowsData.map((c, k) => {
|
||||
return <div key={k} className="formElementSettings__subRepeaterItem">
|
||||
{properSubField(c, k, o.name)}
|
||||
</div>
|
||||
})}
|
||||
<Button type="button"
|
||||
outlined
|
||||
disabled={bandoStatus === 'PUBLISH'}
|
||||
label={__('Aggiungi una riga', 'gepafin')}
|
||||
onClick={addNewRow}/>
|
||||
</div>
|
||||
</AccordionTab> : null)}
|
||||
</Accordion>
|
||||
</div>
|
||||
: null}
|
||||
{lastRow}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -155,8 +155,8 @@ const BandoFormsPreview = () => {
|
||||
}, {});
|
||||
|
||||
return ['paragraph'].includes(o.name) && text
|
||||
? <div>
|
||||
<div className="ql-editor" key={o.id}>
|
||||
? <div key={o.id}>
|
||||
<div className="ql-editor">
|
||||
{renderHtmlContent(text.value)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -24,6 +24,7 @@ import { Tag } from 'primereact/tag';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
import { Link } from 'react-router-dom';
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
import { ConfirmPopup, confirmPopup } from 'primereact/confirmpopup';
|
||||
|
||||
const MyLatestSubmissionsTable = () => {
|
||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||
@@ -167,8 +168,10 @@ const MyLatestSubmissionsTable = () => {
|
||||
<Button severity="info" label={__('Modifica', 'gepafin')} icon="pi pi-pencil" size="small"
|
||||
iconPos="right"/>
|
||||
</Link>
|
||||
<ConfirmPopup/>
|
||||
<Button severity="danger"
|
||||
onClick={() => handleDeleteApplication(rowData.id)}
|
||||
/*onClick={() => handleDeleteApplication(rowData.id)}*/
|
||||
onClick={(event) => confirmDelete(event, rowData.id)}
|
||||
label={__('Cancella', 'gepafin')}
|
||||
icon="pi pi-trash"
|
||||
size="small"
|
||||
@@ -183,6 +186,22 @@ const MyLatestSubmissionsTable = () => {
|
||||
|
||||
const header = renderHeader();
|
||||
|
||||
const confirmDelete = (event, id) => {
|
||||
confirmPopup({
|
||||
target: event.currentTarget,
|
||||
message: __('Sei sicuro di voler rimuovere la domanda?', 'gepafin'),
|
||||
acceptLabel: __('Si', 'gepafin'),
|
||||
icon: 'pi pi-info-circle',
|
||||
defaultFocus: 'reject',
|
||||
acceptClassName: 'p-button-danger',
|
||||
accept: () => {
|
||||
handleDeleteApplication(id);
|
||||
},
|
||||
reject: () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="appPageSection__table">
|
||||
<DataTable value={items} paginator showGridlines rows={10} loading={localAsyncRequest} dataKey="id"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { isEmpty } from 'ramda';
|
||||
import { isEmpty, pathOr } from 'ramda';
|
||||
|
||||
// api
|
||||
import UserService from '../../service/user-service';
|
||||
@@ -20,6 +20,8 @@ import { Button } from 'primereact/button';
|
||||
import { classNames } from 'primereact/utils';
|
||||
import { Dropdown } from 'primereact/dropdown';
|
||||
import DraftApplicationsTable from '../Dashboard/components/DraftApplicationsTable';
|
||||
import NumberFlow from '@number-flow/react';
|
||||
import DashboardService from '../../service/dashboard-service';
|
||||
|
||||
const Domande = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -29,6 +31,7 @@ const Domande = () => {
|
||||
const [chosenUser, setChosenUser] = useState(0);
|
||||
const [chosenApplication, setChosenApplication] = useState(0);
|
||||
const [updaterString, setUpdaterString] = useState('');
|
||||
const [mainStats, setMainStats] = useState({});
|
||||
const toast = useRef(null);
|
||||
|
||||
const getRolesCallback = (data) => {
|
||||
@@ -123,6 +126,18 @@ const Domande = () => {
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const getStatValue = (key, fallback = '') => {
|
||||
return pathOr(fallback, [key], mainStats);
|
||||
}
|
||||
|
||||
const getStats = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setMainStats(data.data);
|
||||
}
|
||||
}
|
||||
|
||||
const errGetStats = () => {}
|
||||
|
||||
useEffect(() => {
|
||||
if (roleIds.length > 0) {
|
||||
setLoading(true);
|
||||
@@ -137,6 +152,10 @@ const Domande = () => {
|
||||
}
|
||||
}, [isVisibleEditDialog]);
|
||||
|
||||
useEffect(() => {
|
||||
DashboardService.getApplicationsStats(getStats, errGetStats);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
@@ -152,6 +171,57 @@ const Domande = () => {
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPageSection statsBigBadges">
|
||||
<h2>{__('Riepilogo', 'gepafin')}</h2>
|
||||
<div className="statsBigBadges__grid applStats">
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('Totale domande', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('numberOfApplication', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
locales="it-IT"/></span>
|
||||
</div>
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('Assegnate', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('numberOfAssignedApplication', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
locales="it-IT"/></span>
|
||||
</div>
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('Completate', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('numberOfAcceptedApplication', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
locales="it-IT"/></span>
|
||||
</div>
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('Tempo medio di valutazione', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('evaluationAverageTime', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
suffix={` ${__('minuti', 'gepafin')}`}
|
||||
locales="it-IT"/></span>
|
||||
</div>
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('In soccorso istruttorio', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('numberOfApplicationInAmendmentState', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
locales="it-IT"/></span>
|
||||
</div>
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('Domande in scadenza (48h)', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('numberOfDueApplication', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
locales="en-US"/></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Domande in bozza', 'gepafin')}</h2>
|
||||
<DraftApplicationsTable/>
|
||||
|
||||
@@ -140,7 +140,7 @@ const BeneficiarioDomandeTable = () => {
|
||||
};
|
||||
|
||||
const actionsBodyTemplate = (rowData) => {
|
||||
return <>
|
||||
return <div className="appPageSection__tableActions">
|
||||
{rowData.status === 'SOCCORSO'
|
||||
? <Link to={`/domande/${rowData.id}`}>
|
||||
<Button severity="info" label={__('Dettagli', 'gepafin')} icon="pi pi-eye" size="small"
|
||||
@@ -150,7 +150,7 @@ const BeneficiarioDomandeTable = () => {
|
||||
<Button severity="info" label={__('Anteprima', 'gepafin')} icon="pi pi-eye" size="small"
|
||||
iconPos="right"/>
|
||||
</Link>
|
||||
</>
|
||||
</div>
|
||||
}
|
||||
|
||||
const header = renderHeader();
|
||||
|
||||
@@ -4,7 +4,7 @@ import { isEmpty, pathOr, head } from 'ramda';
|
||||
import { klona } from 'klona';
|
||||
import { wrap } from 'object-path-immutable';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import emailjs from '@emailjs/browser';
|
||||
//import emailjs from '@emailjs/browser';
|
||||
//import { useNavigate } from 'react-router-dom';
|
||||
|
||||
// store
|
||||
@@ -27,8 +27,11 @@ import FileuploadDelega from '../../components/FileuploadDelega';
|
||||
import { Toast } from 'primereact/toast';
|
||||
import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText';
|
||||
import { defaultMaxFileSize } from '../../configData';
|
||||
import { Dialog } from 'primereact/dialog';
|
||||
//import { Dialog } from 'primereact/dialog';
|
||||
import { confirmPopup, ConfirmPopup } from 'primereact/confirmpopup';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||
|
||||
const ProfileCompany = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
@@ -37,8 +40,9 @@ const ProfileCompany = () => {
|
||||
const infoMsgs = useRef(null);
|
||||
const [formInitialData, setFormInitialData] = useState({});
|
||||
const [delegaData, setDelegaData] = useState({});
|
||||
const navigate = useNavigate();
|
||||
const [delega, setDelega] = useState([]);
|
||||
const [isVisibleRemoveDialog, setIsVisibleRemoveDialog] = useState(false);
|
||||
//const [isVisibleRemoveDialog, setIsVisibleRemoveDialog] = useState(false);
|
||||
const { delegaFirstName = '', delegaLastName = '', delegaCodiceFiscale = '' } = delegaData;
|
||||
const toast = useRef(null);
|
||||
//const navigate = useNavigate();
|
||||
@@ -90,7 +94,6 @@ const ProfileCompany = () => {
|
||||
} else {
|
||||
newCompanies = [...companies, company];
|
||||
storeSet.main.chosenCompanyId(company.id);
|
||||
console.log('set company 3', company.id)
|
||||
}
|
||||
|
||||
storeSet.main.companies(newCompanies);
|
||||
@@ -206,28 +209,28 @@ const ProfileCompany = () => {
|
||||
const confirmDelete = (event) => {
|
||||
confirmPopup({
|
||||
target: event.currentTarget,
|
||||
message: __('Sei sicuro di rimuovere la azienda?', 'gepafin'),
|
||||
message: __('Sei sicuro di voler rimuovere l\'azienda?', 'gepafin'),
|
||||
acceptLabel: __('Si', 'gepafin'),
|
||||
icon: 'pi pi-info-circle',
|
||||
defaultFocus: 'reject',
|
||||
acceptClassName: 'p-button-danger',
|
||||
accept: () => {
|
||||
doRemoveCompany();
|
||||
doRemoveCompanyAPI();
|
||||
},
|
||||
reject: () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const headerRemoveDialog = () => {
|
||||
/*const headerRemoveDialog = () => {
|
||||
return <span>{__('Rimuovi azienda', 'gepafin')}</span>
|
||||
}
|
||||
|
||||
const hideRemoveDialog = () => {
|
||||
setIsVisibleRemoveDialog(false);
|
||||
}
|
||||
}*/
|
||||
|
||||
const doRemoveCompany = () => {
|
||||
/*const doRemoveCompany = () => {
|
||||
const userData = storeGet.main.userData();
|
||||
let chosenCompany = {};
|
||||
|
||||
@@ -251,13 +254,13 @@ const ProfileCompany = () => {
|
||||
publicKey: 'TPWwaPLM2dDuEIa10'
|
||||
}
|
||||
).then(() => {
|
||||
/*if (toast.current) {
|
||||
/!*if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
summary: '',
|
||||
detail: __('La richiesta è stata inviata!', 'gepafin')
|
||||
});
|
||||
}*/
|
||||
}*!/
|
||||
setIsVisibleRemoveDialog(true);
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -270,10 +273,9 @@ const ProfileCompany = () => {
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}*/
|
||||
|
||||
// TODO delete company functionality by API, ready to be shipped
|
||||
/*const doRemoveCompanyAPI = () => {
|
||||
const doRemoveCompanyAPI = () => {
|
||||
storeSet.main.setAsyncRequest();
|
||||
CompanyService.deleteCompany(formInitialData.id, deleteCompanyCallback, errDeleteCompanyCallback)
|
||||
}
|
||||
@@ -282,13 +284,16 @@ const ProfileCompany = () => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
const userData = storeGet.main.userData();
|
||||
const newCompanies = companies.filter(o => o.id !== chosenCompanyId);
|
||||
const newUserData = wrap(userData).set('company', newCompanies).value();
|
||||
storeSet.main.companies(newUserData.companies);
|
||||
storeSet.main.companies(newCompanies);
|
||||
const newUserData = wrap(userData).set('companies', newCompanies).value();
|
||||
storeSet.main.userData(newUserData);
|
||||
|
||||
if (!isEmpty(newCompanies)) {
|
||||
const newChosenCompanyId = newCompanies[0].id;
|
||||
storeSet.main.chosenCompanyId(newChosenCompanyId);
|
||||
} else {
|
||||
storeSet.main.chosenCompanyId(0);
|
||||
navigate(`/`);
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
@@ -297,7 +302,7 @@ const ProfileCompany = () => {
|
||||
const errDeleteCompanyCallback = (data) => {
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}*/
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const newFormData = klona(formInitialData);
|
||||
@@ -516,7 +521,7 @@ const ProfileCompany = () => {
|
||||
? <div className="appForm__delegaForm">
|
||||
<div className="appForm__delegaFormHeader">
|
||||
<legend>{__('Compilazione Delega', 'gepafin')}</legend>
|
||||
<p className="appForm__delegaFormText">{__('Per procedere come delegato, compila il form seguente, scarica il documento della delega, fallo firmare dal rappresentante legale e ricaricalo.', 'gepafin')}</p>
|
||||
<p className="appForm__delegaFormText">{__('Per procedere come delegato, compila il form seguente, scarica il documento della delega, fallo firmare dal rappresentante legale e ricaricalo nel form di domanda.', 'gepafin')}</p>
|
||||
</div>
|
||||
|
||||
<div className="appForm__cols">
|
||||
@@ -554,50 +559,35 @@ const ProfileCompany = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Button
|
||||
disabled={isEmpty(delegaCodiceFiscale) || isEmpty(delegaFirstName) || isEmpty(delegaLastName)}
|
||||
onClick={downloadDelega}
|
||||
type="button"
|
||||
label={__('Genera documento Delega', 'gepafin')}
|
||||
icon="pi pi-check" iconPos="right"/>
|
||||
</div>
|
||||
{APP_HUB_ID === 'nonexisting' // hide it from all hub
|
||||
? <div>
|
||||
<Button
|
||||
disabled={isEmpty(delegaCodiceFiscale) || isEmpty(delegaFirstName) || isEmpty(delegaLastName)}
|
||||
onClick={downloadDelega}
|
||||
type="button"
|
||||
label={__('Genera documento Delega', 'gepafin')}
|
||||
icon="pi pi-check" iconPos="right"/>
|
||||
</div> : null}
|
||||
|
||||
<div className="appForm__field">
|
||||
<label htmlFor="delega">
|
||||
{__('Carica documento Delega Firmato', 'gepafin')}
|
||||
<span className="appForm__field--required">*</span>
|
||||
{' (.p7m) '}
|
||||
{`(max ${getFormatedFileSizeText(defaultMaxFileSize)})`}
|
||||
</label>
|
||||
<FileuploadDelega
|
||||
setDataFn={setDelegaFile}
|
||||
fieldName="delega"
|
||||
defaultValue={delega}
|
||||
accept={['.p7m,application/pkcs7-mime,application/x-pkcs7-mime']}
|
||||
chooseLabel={__('Aggiungi documento', 'gepafin')}
|
||||
multiple={false}
|
||||
doctype="document"
|
||||
companyId={formInitialData.id}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/*<div className="appForm__delegaFormActions">
|
||||
<Button
|
||||
type="button"
|
||||
disabled={true}
|
||||
outlined
|
||||
onClick={() => {
|
||||
}}
|
||||
label={__('Visualizza delega', 'gepafin')} icon="pi pi-eye" iconPos="right"/>
|
||||
<Button
|
||||
type="button"
|
||||
disabled={true}
|
||||
outlined
|
||||
onClick={() => {
|
||||
}}
|
||||
label={__('Sostituisci delega', 'gepafin')} icon="pi pi-sync" iconPos="right"/>
|
||||
</div>*/}
|
||||
{APP_HUB_ID === 'nonexisting' // hide it from all hub
|
||||
? <div className="appForm__field">
|
||||
<label htmlFor="delega">
|
||||
{__('Carica documento Delega Firmato', 'gepafin')}
|
||||
<span className="appForm__field--required">*</span>
|
||||
{' (.p7m) '}
|
||||
{`(max ${getFormatedFileSizeText(defaultMaxFileSize)})`}
|
||||
</label>
|
||||
<FileuploadDelega
|
||||
setDataFn={setDelegaFile}
|
||||
fieldName="delega"
|
||||
defaultValue={delega}
|
||||
accept={['.p7m,application/pkcs7-mime,application/x-pkcs7-mime']}
|
||||
chooseLabel={__('Aggiungi documento', 'gepafin')}
|
||||
multiple={false}
|
||||
doctype="document"
|
||||
companyId={formInitialData.id}
|
||||
/>
|
||||
</div> : null}
|
||||
|
||||
</div> : <div className="appPage__spacer"></div>}
|
||||
|
||||
@@ -622,15 +612,15 @@ const ProfileCompany = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Dialog
|
||||
{/*<Dialog
|
||||
visible={isVisibleRemoveDialog}
|
||||
modal
|
||||
header={headerRemoveDialog}
|
||||
/*footer={footerRemoveDialog}*/
|
||||
footer={footerRemoveDialog}
|
||||
style={{ maxWidth: '600px', width: '100%' }}
|
||||
onHide={hideRemoveDialog}>
|
||||
<p>Abbiamo preso in carica la tua richiesta a breve l'azienda sarà rimossa dal tuo profilo</p>
|
||||
</Dialog>
|
||||
</Dialog>*/}
|
||||
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -50,7 +50,8 @@ const Registration = () => {
|
||||
const newFormData = {
|
||||
...formData,
|
||||
dateOfBirth: originalDateOfBirth,
|
||||
hubUuid: APP_HUB_ID
|
||||
hubUuid: APP_HUB_ID,
|
||||
roleId: 1
|
||||
}
|
||||
|
||||
AuthenticationService.registerUser(newFormData, regCallback, regError, [
|
||||
|
||||
@@ -23,6 +23,7 @@ import BlockingOverlay from '../../components/BlockingOverlay';
|
||||
import { Toast } from 'primereact/toast';
|
||||
import { InputSwitch } from 'primereact/inputswitch';
|
||||
import ApplicationEvaluationService from '../../service/application-evaluation-service';
|
||||
import { Dialog } from 'primereact/dialog';
|
||||
|
||||
const SoccorsoAddPreInstructor = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
@@ -31,6 +32,7 @@ const SoccorsoAddPreInstructor = () => {
|
||||
const [data, setData] = useState({});
|
||||
const [evaluationId, setEvaluationId] = useState(0);
|
||||
const [formData, setFormData] = useState({});
|
||||
const [isVisibleConfirmDialog, setIsVisibleConfirmDialog] = useState(false)
|
||||
const toast = useRef(null);
|
||||
|
||||
const goToEvaluationPage = () => {
|
||||
@@ -49,8 +51,8 @@ const SoccorsoAddPreInstructor = () => {
|
||||
|
||||
const getCallbackEvaluation = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setEvaluationId(data.data.assignedApplicationId);
|
||||
AmendmentsService.getSoccorsoByApplEvalId(data.data.assignedApplicationId, getCallback, errGetCallback)
|
||||
setEvaluationId(data.data.id);
|
||||
AmendmentsService.getSoccorsoByApplEvalId(data.data.id, getCallback, errGetCallback)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +154,32 @@ const SoccorsoAddPreInstructor = () => {
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const initCreationProcess = () => {
|
||||
setIsVisibleConfirmDialog(true);
|
||||
}
|
||||
|
||||
const headerConfirmDialog = () => {
|
||||
return <span>{__('Richiesta di conferma', 'gepafin')}</span>;
|
||||
}
|
||||
|
||||
const hideConfirmDialog = () => {
|
||||
setIsVisibleConfirmDialog(false);
|
||||
}
|
||||
|
||||
const footerConfirmDialog = () => {
|
||||
return <div>
|
||||
<Button type="button" label={__('No', 'gepafin')} onClick={goToEvaluationPage} outlined/>
|
||||
<Button
|
||||
type="button"
|
||||
label={__('Si', 'gepafin')} onClick={doConfirm}/>
|
||||
</div>
|
||||
}
|
||||
|
||||
const doConfirm = () => {
|
||||
setIsVisibleConfirmDialog(false);
|
||||
doCreate();
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
@@ -286,12 +314,24 @@ const SoccorsoAddPreInstructor = () => {
|
||||
icon="pi pi-times" iconPos="right"/>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={doCreate}
|
||||
onClick={initCreationProcess}
|
||||
label={__('Invia richiesta', 'gepafin')}
|
||||
icon="pi pi-check" iconPos="right"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Dialog
|
||||
visible={isVisibleConfirmDialog}
|
||||
modal
|
||||
header={headerConfirmDialog}
|
||||
footer={footerConfirmDialog}
|
||||
style={{ maxWidth: '600px', width: '100%' }}
|
||||
onHide={hideConfirmDialog}>
|
||||
<div className="appForm__field">
|
||||
<p>{__('Soccorso istruttorio autorizzato dal direttore e autorizzazione caricata su portale a seguito del quale parte l\'email?', 'gepafin')}</p>
|
||||
</div>
|
||||
</Dialog>
|
||||
|
||||
</div>
|
||||
: <>
|
||||
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||
|
||||
@@ -528,7 +528,7 @@ const SoccorsoEditPreInstructor = () => {
|
||||
<Button
|
||||
type="button"
|
||||
onClick={openCloseAmendmentDialog}
|
||||
disabled={isAsyncRequest || ['CLOSE', 'EXPIRED'].includes(data.status)}
|
||||
disabled={isAsyncRequest || ['CLOSE', 'AWAITING'].includes(data.status)}
|
||||
label={__('Chiudi Soccorso Istruttorio', 'gepafin')}
|
||||
icon="pi pi-times" iconPos="right"/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user