- added confirmation for amendment;
- fixed amendment creation; - added configrmation for appl deletion; - re added delega related fieldss on company profile page for non gepafin hubs;
This commit is contained in:
@@ -23,12 +23,15 @@ import FormField from '../../components/FormField';
|
||||
import { Button } from 'primereact/button';
|
||||
import BlockingOverlay from '../../components/BlockingOverlay';
|
||||
import { InputText } from 'primereact/inputtext';
|
||||
//import FileuploadDelega from '../../components/FileuploadDelega';
|
||||
import FileuploadDelega from '../../components/FileuploadDelega';
|
||||
import { Toast } from 'primereact/toast';
|
||||
//import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText';
|
||||
//import { defaultMaxFileSize } from '../../configData';
|
||||
import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText';
|
||||
import { defaultMaxFileSize } from '../../configData';
|
||||
//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,7 +40,8 @@ const ProfileCompany = () => {
|
||||
const infoMsgs = useRef(null);
|
||||
const [formInitialData, setFormInitialData] = useState({});
|
||||
const [delegaData, setDelegaData] = useState({});
|
||||
//const [delega, setDelega] = useState([]);
|
||||
const navigate = useNavigate();
|
||||
const [delega, setDelega] = useState([]);
|
||||
//const [isVisibleRemoveDialog, setIsVisibleRemoveDialog] = useState(false);
|
||||
const { delegaFirstName = '', delegaLastName = '', delegaCodiceFiscale = '' } = delegaData;
|
||||
const toast = useRef(null);
|
||||
@@ -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);
|
||||
@@ -161,11 +164,11 @@ const ProfileCompany = () => {
|
||||
setDelegaData(newDelegaData)
|
||||
}
|
||||
|
||||
/*const setDelegaFile = (name, value) => {
|
||||
const setDelegaFile = (name, value) => {
|
||||
setDelega(value);
|
||||
}*/
|
||||
}
|
||||
|
||||
/*const getDellegaCallback = (data) => {
|
||||
const getDellegaCallback = (data) => {
|
||||
if (data.data) {
|
||||
setDelega([data.data]);
|
||||
}
|
||||
@@ -175,7 +178,7 @@ const ProfileCompany = () => {
|
||||
const errDellegaCallback = () => {
|
||||
setDelega([]);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}*/
|
||||
}
|
||||
|
||||
const downloadDelega = () => {
|
||||
storeSet.main.setAsyncRequest();
|
||||
@@ -206,7 +209,7 @@ 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',
|
||||
@@ -281,8 +284,8 @@ 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)) {
|
||||
@@ -290,6 +293,7 @@ const ProfileCompany = () => {
|
||||
storeSet.main.chosenCompanyId(newChosenCompanyId);
|
||||
} else {
|
||||
storeSet.main.chosenCompanyId(0);
|
||||
navigate(`/`);
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
@@ -339,14 +343,14 @@ const ProfileCompany = () => {
|
||||
setFormInitialData(companyData);
|
||||
}, [chosenCompanyId, companies]);
|
||||
|
||||
/*useEffect(() => {
|
||||
useEffect(() => {
|
||||
if (formInitialData.id) {
|
||||
storeSet.main.setAsyncRequest();
|
||||
CompanyService.getCompanyDelega(getDellegaCallback, errDellegaCallback, [
|
||||
['companyId', formInitialData.id]
|
||||
]);
|
||||
}
|
||||
}, [formInitialData])*/
|
||||
}, [formInitialData])
|
||||
|
||||
return (
|
||||
<div className="appPage">
|
||||
@@ -555,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 !== 'p4lk3bcx1RStqTaIVVbXs'
|
||||
? <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 !== 'p4lk3bcx1RStqTaIVVbXs'
|
||||
? <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>}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user