- 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:
@@ -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"
|
||||
|
||||
@@ -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>}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user