Merge branch 'develop' into feature/30-better-tables
This commit is contained in:
@@ -4,7 +4,7 @@ import { isEmpty, pathOr, head } from 'ramda';
|
|||||||
import { klona } from 'klona';
|
import { klona } from 'klona';
|
||||||
import { wrap } from 'object-path-immutable';
|
import { wrap } from 'object-path-immutable';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
import emailjs from '@emailjs/browser';
|
//import emailjs from '@emailjs/browser';
|
||||||
//import { useNavigate } from 'react-router-dom';
|
//import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
// store
|
// store
|
||||||
@@ -23,11 +23,11 @@ import FormField from '../../components/FormField';
|
|||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import BlockingOverlay from '../../components/BlockingOverlay';
|
import BlockingOverlay from '../../components/BlockingOverlay';
|
||||||
import { InputText } from 'primereact/inputtext';
|
import { InputText } from 'primereact/inputtext';
|
||||||
import FileuploadDelega from '../../components/FileuploadDelega';
|
//import FileuploadDelega from '../../components/FileuploadDelega';
|
||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText';
|
//import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText';
|
||||||
import { defaultMaxFileSize } from '../../configData';
|
//import { defaultMaxFileSize } from '../../configData';
|
||||||
import { Dialog } from 'primereact/dialog';
|
//import { Dialog } from 'primereact/dialog';
|
||||||
import { confirmPopup, ConfirmPopup } from 'primereact/confirmpopup';
|
import { confirmPopup, ConfirmPopup } from 'primereact/confirmpopup';
|
||||||
|
|
||||||
const ProfileCompany = () => {
|
const ProfileCompany = () => {
|
||||||
@@ -37,8 +37,8 @@ const ProfileCompany = () => {
|
|||||||
const infoMsgs = useRef(null);
|
const infoMsgs = useRef(null);
|
||||||
const [formInitialData, setFormInitialData] = useState({});
|
const [formInitialData, setFormInitialData] = useState({});
|
||||||
const [delegaData, setDelegaData] = useState({});
|
const [delegaData, setDelegaData] = useState({});
|
||||||
const [delega, setDelega] = useState([]);
|
//const [delega, setDelega] = useState([]);
|
||||||
const [isVisibleRemoveDialog, setIsVisibleRemoveDialog] = useState(false);
|
//const [isVisibleRemoveDialog, setIsVisibleRemoveDialog] = useState(false);
|
||||||
const { delegaFirstName = '', delegaLastName = '', delegaCodiceFiscale = '' } = delegaData;
|
const { delegaFirstName = '', delegaLastName = '', delegaCodiceFiscale = '' } = delegaData;
|
||||||
const toast = useRef(null);
|
const toast = useRef(null);
|
||||||
//const navigate = useNavigate();
|
//const navigate = useNavigate();
|
||||||
@@ -161,11 +161,11 @@ const ProfileCompany = () => {
|
|||||||
setDelegaData(newDelegaData)
|
setDelegaData(newDelegaData)
|
||||||
}
|
}
|
||||||
|
|
||||||
const setDelegaFile = (name, value) => {
|
/*const setDelegaFile = (name, value) => {
|
||||||
setDelega(value);
|
setDelega(value);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
const getDellegaCallback = (data) => {
|
/*const getDellegaCallback = (data) => {
|
||||||
if (data.data) {
|
if (data.data) {
|
||||||
setDelega([data.data]);
|
setDelega([data.data]);
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ const ProfileCompany = () => {
|
|||||||
const errDellegaCallback = () => {
|
const errDellegaCallback = () => {
|
||||||
setDelega([]);
|
setDelega([]);
|
||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
const downloadDelega = () => {
|
const downloadDelega = () => {
|
||||||
storeSet.main.setAsyncRequest();
|
storeSet.main.setAsyncRequest();
|
||||||
@@ -212,22 +212,22 @@ const ProfileCompany = () => {
|
|||||||
defaultFocus: 'reject',
|
defaultFocus: 'reject',
|
||||||
acceptClassName: 'p-button-danger',
|
acceptClassName: 'p-button-danger',
|
||||||
accept: () => {
|
accept: () => {
|
||||||
doRemoveCompany();
|
doRemoveCompanyAPI();
|
||||||
},
|
},
|
||||||
reject: () => {
|
reject: () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const headerRemoveDialog = () => {
|
/*const headerRemoveDialog = () => {
|
||||||
return <span>{__('Rimuovi azienda', 'gepafin')}</span>
|
return <span>{__('Rimuovi azienda', 'gepafin')}</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
const hideRemoveDialog = () => {
|
const hideRemoveDialog = () => {
|
||||||
setIsVisibleRemoveDialog(false);
|
setIsVisibleRemoveDialog(false);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
const doRemoveCompany = () => {
|
/*const doRemoveCompany = () => {
|
||||||
const userData = storeGet.main.userData();
|
const userData = storeGet.main.userData();
|
||||||
let chosenCompany = {};
|
let chosenCompany = {};
|
||||||
|
|
||||||
@@ -251,13 +251,13 @@ const ProfileCompany = () => {
|
|||||||
publicKey: 'TPWwaPLM2dDuEIa10'
|
publicKey: 'TPWwaPLM2dDuEIa10'
|
||||||
}
|
}
|
||||||
).then(() => {
|
).then(() => {
|
||||||
/*if (toast.current) {
|
/!*if (toast.current) {
|
||||||
toast.current.show({
|
toast.current.show({
|
||||||
severity: 'success',
|
severity: 'success',
|
||||||
summary: '',
|
summary: '',
|
||||||
detail: __('La richiesta è stata inviata!', 'gepafin')
|
detail: __('La richiesta è stata inviata!', 'gepafin')
|
||||||
});
|
});
|
||||||
}*/
|
}*!/
|
||||||
setIsVisibleRemoveDialog(true);
|
setIsVisibleRemoveDialog(true);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
@@ -270,10 +270,9 @@ const ProfileCompany = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// TODO delete company functionality by API, ready to be shipped
|
const doRemoveCompanyAPI = () => {
|
||||||
/*const doRemoveCompanyAPI = () => {
|
|
||||||
storeSet.main.setAsyncRequest();
|
storeSet.main.setAsyncRequest();
|
||||||
CompanyService.deleteCompany(formInitialData.id, deleteCompanyCallback, errDeleteCompanyCallback)
|
CompanyService.deleteCompany(formInitialData.id, deleteCompanyCallback, errDeleteCompanyCallback)
|
||||||
}
|
}
|
||||||
@@ -289,6 +288,8 @@ const ProfileCompany = () => {
|
|||||||
if (!isEmpty(newCompanies)) {
|
if (!isEmpty(newCompanies)) {
|
||||||
const newChosenCompanyId = newCompanies[0].id;
|
const newChosenCompanyId = newCompanies[0].id;
|
||||||
storeSet.main.chosenCompanyId(newChosenCompanyId);
|
storeSet.main.chosenCompanyId(newChosenCompanyId);
|
||||||
|
} else {
|
||||||
|
storeSet.main.chosenCompanyId(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
@@ -297,7 +298,7 @@ const ProfileCompany = () => {
|
|||||||
const errDeleteCompanyCallback = (data) => {
|
const errDeleteCompanyCallback = (data) => {
|
||||||
set404FromErrorResponse(data);
|
set404FromErrorResponse(data);
|
||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}*/
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const newFormData = klona(formInitialData);
|
const newFormData = klona(formInitialData);
|
||||||
@@ -338,14 +339,14 @@ const ProfileCompany = () => {
|
|||||||
setFormInitialData(companyData);
|
setFormInitialData(companyData);
|
||||||
}, [chosenCompanyId, companies]);
|
}, [chosenCompanyId, companies]);
|
||||||
|
|
||||||
useEffect(() => {
|
/*useEffect(() => {
|
||||||
if (formInitialData.id) {
|
if (formInitialData.id) {
|
||||||
storeSet.main.setAsyncRequest();
|
storeSet.main.setAsyncRequest();
|
||||||
CompanyService.getCompanyDelega(getDellegaCallback, errDellegaCallback, [
|
CompanyService.getCompanyDelega(getDellegaCallback, errDellegaCallback, [
|
||||||
['companyId', formInitialData.id]
|
['companyId', formInitialData.id]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}, [formInitialData])
|
}, [formInitialData])*/
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="appPage">
|
<div className="appPage">
|
||||||
@@ -516,7 +517,7 @@ const ProfileCompany = () => {
|
|||||||
? <div className="appForm__delegaForm">
|
? <div className="appForm__delegaForm">
|
||||||
<div className="appForm__delegaFormHeader">
|
<div className="appForm__delegaFormHeader">
|
||||||
<legend>{__('Compilazione Delega', 'gepafin')}</legend>
|
<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.', 'gepafin')}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appForm__cols">
|
<div className="appForm__cols">
|
||||||
@@ -563,7 +564,7 @@ const ProfileCompany = () => {
|
|||||||
icon="pi pi-check" iconPos="right"/>
|
icon="pi pi-check" iconPos="right"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appForm__field">
|
{/*<div className="appForm__field">
|
||||||
<label htmlFor="delega">
|
<label htmlFor="delega">
|
||||||
{__('Carica documento Delega Firmato', 'gepafin')}
|
{__('Carica documento Delega Firmato', 'gepafin')}
|
||||||
<span className="appForm__field--required">*</span>
|
<span className="appForm__field--required">*</span>
|
||||||
@@ -580,7 +581,7 @@ const ProfileCompany = () => {
|
|||||||
doctype="document"
|
doctype="document"
|
||||||
companyId={formInitialData.id}
|
companyId={formInitialData.id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>*/}
|
||||||
|
|
||||||
{/*<div className="appForm__delegaFormActions">
|
{/*<div className="appForm__delegaFormActions">
|
||||||
<Button
|
<Button
|
||||||
@@ -622,15 +623,15 @@ const ProfileCompany = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Dialog
|
{/*<Dialog
|
||||||
visible={isVisibleRemoveDialog}
|
visible={isVisibleRemoveDialog}
|
||||||
modal
|
modal
|
||||||
header={headerRemoveDialog}
|
header={headerRemoveDialog}
|
||||||
/*footer={footerRemoveDialog}*/
|
footer={footerRemoveDialog}
|
||||||
style={{ maxWidth: '600px', width: '100%' }}
|
style={{ maxWidth: '600px', width: '100%' }}
|
||||||
onHide={hideRemoveDialog}>
|
onHide={hideRemoveDialog}>
|
||||||
<p>Abbiamo preso in carica la tua richiesta a breve l'azienda sarà rimossa dal tuo profilo</p>
|
<p>Abbiamo preso in carica la tua richiesta a breve l'azienda sarà rimossa dal tuo profilo</p>
|
||||||
</Dialog>
|
</Dialog>*/}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -37,6 +37,6 @@ export default class CompanyService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static deleteCompany = (id, callback, errCallback) => {
|
static deleteCompany = (id, callback, errCallback) => {
|
||||||
NetworkService.delete(`${API_BASE_URL}/company/${id}`, {}, callback, errCallback);
|
NetworkService.delete(`${API_BASE_URL}/company/user/${id}`, {}, callback, errCallback);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user