- updated zustand and react libraries;
- added 'put in draft' btn;
This commit is contained in:
@@ -9,7 +9,7 @@ import equal from 'fast-deep-equal';
|
||||
import { useForm } from 'react-hook-form';
|
||||
|
||||
// store
|
||||
import { storeGet, storeSet, useStore } from '../../store';
|
||||
import { storeGet, storeSet, useStoreValue } from '../../store';
|
||||
|
||||
// api
|
||||
import ApplicationEvaluationService from '../../service/application-evaluation-service';
|
||||
@@ -57,7 +57,7 @@ const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
||||
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||
|
||||
const DomandaEditInstructorManager = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const isAsyncRequest = useStoreValue('isAsyncRequest');
|
||||
const { id } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const [data, setData] = useState({});
|
||||
@@ -179,18 +179,18 @@ const DomandaEditInstructorManager = () => {
|
||||
const getVersion = (resp) => {
|
||||
if (resp.status === 'SUCCESS') {
|
||||
if (resp.data.evaluationVersion === 'V1') {
|
||||
storeSet.main.setAsyncRequest();
|
||||
storeSet('setAsyncRequest');
|
||||
ApplicationEvaluationService.getEvaluationByApplId(getCallback, errGetCallback, [
|
||||
['applicationId', resp.data.applicationId]
|
||||
]);
|
||||
} else if (resp.data.evaluationVersion === 'V2') {
|
||||
storeSet.main.setAsyncRequest();
|
||||
storeSet('setAsyncRequest');
|
||||
ApplicationEvaluationService.getEvaluationV2ByApplId(getCallback, errGetCallback, [
|
||||
['applicationId', resp.data.applicationId]
|
||||
]);
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const errGetVersion = (resp) => {
|
||||
@@ -202,7 +202,7 @@ const DomandaEditInstructorManager = () => {
|
||||
});
|
||||
}
|
||||
set404FromErrorResponse(resp);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const getCallback = (resp) => {
|
||||
@@ -233,7 +233,7 @@ const DomandaEditInstructorManager = () => {
|
||||
setFormInitialData(formDataInitial);
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const errGetCallback = (resp) => {
|
||||
@@ -245,7 +245,7 @@ const DomandaEditInstructorManager = () => {
|
||||
});
|
||||
}
|
||||
set404FromErrorResponse(resp);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const getFormattedData = (data) => {
|
||||
@@ -377,7 +377,7 @@ const DomandaEditInstructorManager = () => {
|
||||
afterUpdateCallback();
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const errUpdateCallback = (data) => {
|
||||
@@ -389,7 +389,7 @@ const DomandaEditInstructorManager = () => {
|
||||
});
|
||||
}
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const doApprove = useCallback(() => {
|
||||
@@ -635,7 +635,7 @@ const DomandaEditInstructorManager = () => {
|
||||
}
|
||||
|
||||
const doGetNDGRequest = () => {
|
||||
storeSet.main.setAsyncRequest();
|
||||
storeSet('setAsyncRequest');
|
||||
AppointmentService.getNdg(id, getNdgCallback, errGetNdgCallback);
|
||||
}
|
||||
|
||||
@@ -655,7 +655,7 @@ const DomandaEditInstructorManager = () => {
|
||||
}));
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const errGetNdgCallback = (data) => {
|
||||
@@ -667,7 +667,7 @@ const DomandaEditInstructorManager = () => {
|
||||
});
|
||||
}
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const doCreateAppointment = () => {
|
||||
@@ -709,7 +709,7 @@ const DomandaEditInstructorManager = () => {
|
||||
!isEmpty(appointmentData.title) && !isEmpty(appointmentData.text) && !isEmpty(appointmentData.amount)
|
||||
&& !isEmpty(appointmentData.duration) && appointmentData.duration !== 0 && appointmentData.amount !== 0
|
||||
) {
|
||||
storeSet.main.setAsyncRequest();
|
||||
storeSet('setAsyncRequest');
|
||||
const submitData = {
|
||||
'importoBreveTermine': appointmentData.amount,
|
||||
'durataMesiFinanziamento': appointmentData.duration,
|
||||
@@ -740,7 +740,7 @@ const DomandaEditInstructorManager = () => {
|
||||
}
|
||||
}
|
||||
setIsVisibleAppointmentDialog(false);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const errGetAppointemntCallback = (data) => {
|
||||
@@ -753,7 +753,7 @@ const DomandaEditInstructorManager = () => {
|
||||
}
|
||||
setIsVisibleAppointmentDialog(false);
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const doMakeAdmisible = () => {
|
||||
@@ -771,7 +771,7 @@ const DomandaEditInstructorManager = () => {
|
||||
}, [isAdmissible]);
|
||||
|
||||
const evaluationBlockedForUser = (data = {}) => {
|
||||
const userData = storeGet.main.userData();
|
||||
const userData = storeGet('userData');
|
||||
return isAsyncRequest || userData.id !== data.assignedUserId;
|
||||
}
|
||||
|
||||
@@ -933,7 +933,7 @@ const DomandaEditInstructorManager = () => {
|
||||
const parsed = parseInt(id)
|
||||
const entityId = !isNaN(parsed) ? parsed : 0;
|
||||
|
||||
storeSet.main.setAsyncRequest();
|
||||
storeSet('setAsyncRequest');
|
||||
ApplicationEvaluationService.getEvaluationVersionByApplId(entityId, getVersion, errGetVersion);
|
||||
AmendmentsService.getSoccorsoByApplId(entityId, getAmendmentsCallback, errGetAmendmentsCallback, [
|
||||
['statuses', ['AWAITING', 'RESPONSE_RECEIVED']]
|
||||
|
||||
Reference in New Issue
Block a user