Merge branch 'master' into develop
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
"@babel/plugin-proposal-private-property-in-object": "7.21.11",
|
"@babel/plugin-proposal-private-property-in-object": "7.21.11",
|
||||||
"@babel/preset-react": "7.24.7",
|
"@babel/preset-react": "7.24.7",
|
||||||
"@date-fns/tz": "1.1.2",
|
"@date-fns/tz": "1.1.2",
|
||||||
|
"@emailjs/browser": "^4.4.1",
|
||||||
"@emotion/styled": "11.13.0",
|
"@emotion/styled": "11.13.0",
|
||||||
"@number-flow/react": "0.2.0",
|
"@number-flow/react": "0.2.0",
|
||||||
"@tanstack/react-table": "^8.20.5",
|
"@tanstack/react-table": "^8.20.5",
|
||||||
|
|||||||
@@ -453,6 +453,34 @@ const BandoApplication = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const doChangeToDraft = () => {
|
||||||
|
const applId = getApplicationId();
|
||||||
|
storeSet.main.setAsyncRequest();
|
||||||
|
formMsgs.current.clear();
|
||||||
|
|
||||||
|
ApplicationService.updateStatusApplication(applId, {}, changeToDraftCallback, errChangeToDraftCallback, [
|
||||||
|
['status', 'DRAFT']
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const changeToDraftCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
if (data.data.status) {
|
||||||
|
setApplicationStatus(data.data.status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const errChangeToDraftCallback = (data) => {
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if ('SUBMIT' === applicationStatus) {
|
if ('SUBMIT' === applicationStatus) {
|
||||||
setVisibleConfirmation(true);
|
setVisibleConfirmation(true);
|
||||||
@@ -592,6 +620,16 @@ const BandoApplication = () => {
|
|||||||
})
|
})
|
||||||
: null}
|
: null}
|
||||||
|
|
||||||
|
{['AWAITING'].includes(applicationStatus)
|
||||||
|
? <div className="appPageSection">
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
outlined
|
||||||
|
onClick={doChangeToDraft}
|
||||||
|
label={__('Ripristina draft', 'gepafin')}
|
||||||
|
icon="pi pi-arrow-left" iconPos="left"/>
|
||||||
|
</div> : null}
|
||||||
|
|
||||||
{['AWAITING', 'READY', 'SUBMIT', 'EVALUATION'].includes(applicationStatus)
|
{['AWAITING', 'READY', 'SUBMIT', 'EVALUATION'].includes(applicationStatus)
|
||||||
? <div className="appPageSection">
|
? <div className="appPageSection">
|
||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
|
|||||||
@@ -4,6 +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';
|
||||||
|
|
||||||
// store
|
// store
|
||||||
import { storeSet, useStore, storeGet } from '../../store';
|
import { storeSet, useStore, storeGet } from '../../store';
|
||||||
@@ -25,6 +26,10 @@ 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 { classNames } from 'primereact/utils';
|
||||||
|
import { Dropdown } from 'primereact/dropdown';
|
||||||
|
import { Dialog } from 'primereact/dialog';
|
||||||
|
import { confirmPopup, ConfirmPopup } from 'primereact/confirmpopup';
|
||||||
|
|
||||||
const ProfileCompany = () => {
|
const ProfileCompany = () => {
|
||||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||||
@@ -34,6 +39,7 @@ const ProfileCompany = () => {
|
|||||||
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 { delegaFirstName = '', delegaLastName = '', delegaCodiceFiscale = '' } = delegaData;
|
const { delegaFirstName = '', delegaLastName = '', delegaCodiceFiscale = '' } = delegaData;
|
||||||
const toast = useRef(null);
|
const toast = useRef(null);
|
||||||
|
|
||||||
@@ -197,6 +203,85 @@ const ProfileCompany = () => {
|
|||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const confirmDelete = (event) => {
|
||||||
|
confirmPopup({
|
||||||
|
target: event.currentTarget,
|
||||||
|
message: __('Sei sicuro di rimuovere la azienda?', 'gepafin'),
|
||||||
|
acceptLabel: __('Si', 'gepafin'),
|
||||||
|
icon: 'pi pi-info-circle',
|
||||||
|
defaultFocus: 'reject',
|
||||||
|
acceptClassName: 'p-button-danger',
|
||||||
|
accept: () => {
|
||||||
|
doRemoveCompany();
|
||||||
|
},
|
||||||
|
reject: () => {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const footerRemoveDialog = () => {
|
||||||
|
return <div>
|
||||||
|
<Button type="button" label={__('No', 'gepafin')} onClick={hideRemoveDialog} outlined/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
label={__('Si', 'gepafin')} onClick={doRemoveCompany}/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
const headerRemoveDialog = () => {
|
||||||
|
return <span>{__('Rimuovi azienda', 'gepafin')}</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
const hideRemoveDialog = () => {
|
||||||
|
setIsVisibleRemoveDialog(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const doRemoveCompany = () => {
|
||||||
|
const userData = storeGet.main.userData();
|
||||||
|
let chosenCompany = {};
|
||||||
|
|
||||||
|
if (chosenCompanyId) {
|
||||||
|
chosenCompany = head(companies.filter(o => o.id === chosenCompanyId));
|
||||||
|
}
|
||||||
|
|
||||||
|
const templateParams = {
|
||||||
|
firstName: userData.firstName,
|
||||||
|
lastName: userData.lastName,
|
||||||
|
userId: userData.id,
|
||||||
|
companyName: chosenCompany.companyName,
|
||||||
|
companyId: chosenCompany.id
|
||||||
|
};
|
||||||
|
|
||||||
|
emailjs.send(
|
||||||
|
'service_qu9yy6o',
|
||||||
|
'template_oie3kcp',
|
||||||
|
templateParams,
|
||||||
|
{
|
||||||
|
publicKey: 'TPWwaPLM2dDuEIa10'
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
/*if (toast.current) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'success',
|
||||||
|
summary: '',
|
||||||
|
detail: __('La richiesta è stata inviata!', 'gepafin')
|
||||||
|
});
|
||||||
|
}*/
|
||||||
|
setIsVisibleRemoveDialog(true);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
if (toast.current) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: __('Error', 'gepafin')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const newFormData = klona(formInitialData);
|
const newFormData = klona(formInitialData);
|
||||||
Object.keys(newFormData).map(v => setValue(v, newFormData[v]));
|
Object.keys(newFormData).map(v => setValue(v, newFormData[v]));
|
||||||
@@ -498,19 +583,36 @@ const ProfileCompany = () => {
|
|||||||
</div> : <div className="appPage__spacer"></div>}
|
</div> : <div className="appPage__spacer"></div>}
|
||||||
|
|
||||||
<div className="appPageSection__hr">
|
<div className="appPageSection__hr">
|
||||||
<span>{__('Azioni rapide', 'gepafin')}</span>
|
<span>{__('Azioni', 'gepafin')}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<div className="appPageSection__actions">
|
<div className="appPageSection__actions">
|
||||||
<Button
|
<Button
|
||||||
form="companyForm"
|
form="companyForm"
|
||||||
/*disabled={isAsyncRequest || emptyValues || values.id}*/
|
|
||||||
label={__('Salva modifiche', 'gepafin')}
|
label={__('Salva modifiche', 'gepafin')}
|
||||||
icon="pi pi-check" iconPos="right"/>
|
icon="pi pi-check" iconPos="right"/>
|
||||||
|
|
||||||
|
<ConfirmPopup/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
onClick={confirmDelete}
|
||||||
|
severity="danger"
|
||||||
|
label={__('Rimuovi azienda', 'gepafin')}
|
||||||
|
icon="pi pi-trash" iconPos="right"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
visible={isVisibleRemoveDialog}
|
||||||
|
modal
|
||||||
|
header={headerRemoveDialog}
|
||||||
|
/*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>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user