diff --git a/src/pages/ProfileCompany/index.js b/src/pages/ProfileCompany/index.js index f7ee19d..79824fb 100644 --- a/src/pages/ProfileCompany/index.js +++ b/src/pages/ProfileCompany/index.js @@ -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 @@ -23,11 +23,11 @@ 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 { Dialog } from 'primereact/dialog'; +//import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText'; +//import { defaultMaxFileSize } from '../../configData'; +//import { Dialog } from 'primereact/dialog'; import { confirmPopup, ConfirmPopup } from 'primereact/confirmpopup'; const ProfileCompany = () => { @@ -37,8 +37,8 @@ const ProfileCompany = () => { const infoMsgs = useRef(null); const [formInitialData, setFormInitialData] = useState({}); const [delegaData, setDelegaData] = useState({}); - const [delega, setDelega] = useState([]); - const [isVisibleRemoveDialog, setIsVisibleRemoveDialog] = useState(false); + //const [delega, setDelega] = useState([]); + //const [isVisibleRemoveDialog, setIsVisibleRemoveDialog] = useState(false); const { delegaFirstName = '', delegaLastName = '', delegaCodiceFiscale = '' } = delegaData; const toast = useRef(null); //const navigate = useNavigate(); @@ -161,11 +161,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 +175,7 @@ const ProfileCompany = () => { const errDellegaCallback = () => { setDelega([]); storeSet.main.unsetAsyncRequest(); - } + }*/ const downloadDelega = () => { storeSet.main.setAsyncRequest(); @@ -212,22 +212,22 @@ const ProfileCompany = () => { defaultFocus: 'reject', acceptClassName: 'p-button-danger', accept: () => { - doRemoveCompany(); + doRemoveCompanyAPI(); }, reject: () => { } }); }; - const headerRemoveDialog = () => { + /*const headerRemoveDialog = () => { return {__('Rimuovi azienda', 'gepafin')} } const hideRemoveDialog = () => { setIsVisibleRemoveDialog(false); - } + }*/ - const doRemoveCompany = () => { + /*const doRemoveCompany = () => { const userData = storeGet.main.userData(); let chosenCompany = {}; @@ -251,13 +251,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 +270,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) } @@ -289,6 +288,8 @@ const ProfileCompany = () => { if (!isEmpty(newCompanies)) { const newChosenCompanyId = newCompanies[0].id; storeSet.main.chosenCompanyId(newChosenCompanyId); + } else { + storeSet.main.chosenCompanyId(0); } } storeSet.main.unsetAsyncRequest(); @@ -297,7 +298,7 @@ const ProfileCompany = () => { const errDeleteCompanyCallback = (data) => { set404FromErrorResponse(data); storeSet.main.unsetAsyncRequest(); - }*/ + } useEffect(() => { const newFormData = klona(formInitialData); @@ -338,14 +339,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 (
{__('Per procedere come delegato, compila il form seguente, scarica il documento della delega, fallo firmare dal rappresentante legale e ricaricalo.', 'gepafin')}
+{__('Per procedere come delegato, compila il form seguente, scarica il documento della delega, fallo firmare dal rappresentante legale.', 'gepafin')}