- update to contract functionality;
This commit is contained in:
@@ -15,7 +15,6 @@ import { storeGet, storeSet, useStoreValue } from '../../store';
|
|||||||
import ApplicationEvaluationService from '../../service/application-evaluation-service';
|
import ApplicationEvaluationService from '../../service/application-evaluation-service';
|
||||||
import AmendmentsService from '../../service/amendments-service';
|
import AmendmentsService from '../../service/amendments-service';
|
||||||
import AppointmentService from '../../service/appointment-service';
|
import AppointmentService from '../../service/appointment-service';
|
||||||
import ApplicationContractService from '../../service/application-contract-service';
|
|
||||||
|
|
||||||
// tools
|
// tools
|
||||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||||
@@ -34,6 +33,7 @@ import getTokens from '../../helpers/getTokens';
|
|||||||
import parseCommaDecimal from '../../helpers/parseCommaDecimal';
|
import parseCommaDecimal from '../../helpers/parseCommaDecimal';
|
||||||
import renderWithDataVars from '../../helpers/renderWithDataVars';
|
import renderWithDataVars from '../../helpers/renderWithDataVars';
|
||||||
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||||
|
import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { Skeleton } from 'primereact/skeleton';
|
import { Skeleton } from 'primereact/skeleton';
|
||||||
@@ -60,8 +60,7 @@ import EvaluationReAdmit from '../DomandaEditPreInstructor/components/Evaluation
|
|||||||
import { SplitButton } from 'primereact/splitbutton';
|
import { SplitButton } from 'primereact/splitbutton';
|
||||||
import { FileUpload } from 'primereact/fileupload';
|
import { FileUpload } from 'primereact/fileupload';
|
||||||
import { defaultMaxFileSize, mimeTypes, rejectionReasons } from '../../configData';
|
import { defaultMaxFileSize, mimeTypes, rejectionReasons } from '../../configData';
|
||||||
import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText';
|
import ArchiveDocument from './components/ArchiveDocument';
|
||||||
import ArchiveDocument from '../DomandaEditPreInstructor/components/ArchiveDocument';
|
|
||||||
|
|
||||||
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
||||||
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||||
@@ -100,12 +99,12 @@ const DomandaEditInstructorManager = () => {
|
|||||||
duration: 0,
|
duration: 0,
|
||||||
amount: 0
|
amount: 0
|
||||||
});
|
});
|
||||||
const [isVisibleContractForm, setIsVisibleContractForm] = useState(false);
|
/*const [isVisibleContractForm, setIsVisibleContractForm] = useState(false);
|
||||||
const [contractFormData, setContractFormData] = useState({
|
const [contractFormData, setContractFormData] = useState({
|
||||||
subject: '',
|
subject: '',
|
||||||
text: ''
|
text: ''
|
||||||
});
|
});
|
||||||
const contractFormFilesRef = useRef(null);
|
const contractFormFilesRef = useRef(null);*/
|
||||||
const [formData, setFormData] = useState([]);
|
const [formData, setFormData] = useState([]);
|
||||||
const [formId, setFormId] = useState(0);
|
const [formId, setFormId] = useState(0);
|
||||||
const [formInitialData, setFormInitialData] = useState(null);
|
const [formInitialData, setFormInitialData] = useState(null);
|
||||||
@@ -1008,14 +1007,12 @@ const DomandaEditInstructorManager = () => {
|
|||||||
setData(newData);
|
setData(newData);
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
const openSendContractForm = () => {
|
/*const openSendContractForm = () => {
|
||||||
setIsVisibleContractForm(true);
|
setIsVisibleContractForm(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const headerContractDialog = () => {
|
const headerContractDialog = () => {
|
||||||
return <span>{__('Invia il contratto', 'gepafin')}</span>;
|
return <span>{__('Invia il contratto', 'gepafin')}</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hideContractDialog = () => {
|
const hideContractDialog = () => {
|
||||||
setIsVisibleContractForm(false);
|
setIsVisibleContractForm(false);
|
||||||
setContractFormData({
|
setContractFormData({
|
||||||
@@ -1023,7 +1020,6 @@ const DomandaEditInstructorManager = () => {
|
|||||||
text: ''
|
text: ''
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const footerContractDialog = useCallback(() => {
|
const footerContractDialog = useCallback(() => {
|
||||||
let isDisabled = !contractFormData.subject || isEmpty(contractFormData.subject)
|
let isDisabled = !contractFormData.subject || isEmpty(contractFormData.subject)
|
||||||
|| !contractFormData.text || isEmpty(contractFormData.text)
|
|| !contractFormData.text || isEmpty(contractFormData.text)
|
||||||
@@ -1037,12 +1033,10 @@ const DomandaEditInstructorManager = () => {
|
|||||||
label={__('Invia', 'gepafin')} onClick={doSendContract}/>
|
label={__('Invia', 'gepafin')} onClick={doSendContract}/>
|
||||||
</div>
|
</div>
|
||||||
}, [contractFormData]);
|
}, [contractFormData]);
|
||||||
|
|
||||||
const updateContractFormData = (value, path) => {
|
const updateContractFormData = (value, path) => {
|
||||||
const newData = wrap(contractFormData).set(path.split('.'), value).value();
|
const newData = wrap(contractFormData).set(path.split('.'), value).value();
|
||||||
setContractFormData(newData);
|
setContractFormData(newData);
|
||||||
};
|
};
|
||||||
|
|
||||||
const doSendContract = useCallback(() => {
|
const doSendContract = useCallback(() => {
|
||||||
if (
|
if (
|
||||||
contractFormData.subject && !isEmpty(contractFormData.subject)
|
contractFormData.subject && !isEmpty(contractFormData.subject)
|
||||||
@@ -1075,7 +1069,6 @@ const DomandaEditInstructorManager = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [contractFormData]);
|
}, [contractFormData]);
|
||||||
|
|
||||||
const getUploadApplicationContractCallback = (data) => {
|
const getUploadApplicationContractCallback = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
setData((prev) => ({
|
setData((prev) => ({
|
||||||
@@ -1094,7 +1087,6 @@ const DomandaEditInstructorManager = () => {
|
|||||||
hideContractDialog();
|
hideContractDialog();
|
||||||
storeSet('unsetAsyncRequest');
|
storeSet('unsetAsyncRequest');
|
||||||
}
|
}
|
||||||
|
|
||||||
const errGetUploadApplicationContractCallback = (data) => {
|
const errGetUploadApplicationContractCallback = (data) => {
|
||||||
if (toast.current && data.message) {
|
if (toast.current && data.message) {
|
||||||
toast.current.show({
|
toast.current.show({
|
||||||
@@ -1106,7 +1098,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
hideContractDialog();
|
hideContractDialog();
|
||||||
set404FromErrorResponse(data);
|
set404FromErrorResponse(data);
|
||||||
storeSet('unsetAsyncRequest');
|
storeSet('unsetAsyncRequest');
|
||||||
}
|
}*/
|
||||||
|
|
||||||
const actionBtns = () => {
|
const actionBtns = () => {
|
||||||
return <div className="appPageSection__actions">
|
return <div className="appPageSection__actions">
|
||||||
@@ -1243,13 +1235,16 @@ const DomandaEditInstructorManager = () => {
|
|||||||
onClick={initiateRejecting}
|
onClick={initiateRejecting}
|
||||||
label={__('Respingi domanda', 'gepafin')}
|
label={__('Respingi domanda', 'gepafin')}
|
||||||
icon="pi pi-times" iconPos="right"/> : null}
|
icon="pi pi-times" iconPos="right"/> : null}
|
||||||
{APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE' && data.applicationStatus === 'APPROVED'
|
{/*
|
||||||
|
This functionality has been moved
|
||||||
|
*/}
|
||||||
|
{/*{APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE' && data.applicationStatus === 'APPROVED'
|
||||||
? <Button
|
? <Button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={!data.id}
|
disabled={!data.id}
|
||||||
onClick={openSendContractForm}
|
onClick={openSendContractForm}
|
||||||
label={__('Invia il contratto', 'gepafin')}
|
label={__('Invia il contratto', 'gepafin')}
|
||||||
/> : null}
|
/> : null}*/}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2035,7 +2030,10 @@ const DomandaEditInstructorManager = () => {
|
|||||||
</div>
|
</div>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
<Dialog
|
{/*
|
||||||
|
This functionality has been moved
|
||||||
|
*/}
|
||||||
|
{/*<Dialog
|
||||||
visible={isVisibleContractForm}
|
visible={isVisibleContractForm}
|
||||||
modal
|
modal
|
||||||
header={headerContractDialog}
|
header={headerContractDialog}
|
||||||
@@ -2130,7 +2128,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
emptyTemplate={<p className="m-0">{__('Trascina i file qua')}</p>}
|
emptyTemplate={<p className="m-0">{__('Trascina i file qua')}</p>}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Dialog>
|
</Dialog>*/}
|
||||||
</div>
|
</div>
|
||||||
: <>
|
: <>
|
||||||
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||||
|
|||||||
Reference in New Issue
Block a user