add change status function
This commit is contained in:
@@ -71,6 +71,9 @@ const getBandoLabel = (status) => {
|
||||
case 'REJECTED':
|
||||
return __('Respinto', 'gepafin');
|
||||
|
||||
case 'TECHNICAL_EVALUATION_REJECTED':
|
||||
return __('Respinto', 'gepafin');
|
||||
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -793,6 +793,40 @@ const DomandaEditInstructorManager = () => {
|
||||
setData(newData);
|
||||
}, [data]);
|
||||
|
||||
const handleRejectingSuccess = useCallback((response) => {
|
||||
if (response.status === 'SUCCESS') {
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
summary: 'Successo',
|
||||
detail: 'Stato aggiornato a Rifiutato (Valutazione Tecnica)'
|
||||
});
|
||||
}
|
||||
}
|
||||
storeSet('unsetAsyncRequest');
|
||||
}, []);
|
||||
|
||||
const handleRejectingError = useCallback((errorResponse) => {
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
summary: 'Errore',
|
||||
detail: 'Si è verificato un errore durante l\'aggiornamento dello stato.'
|
||||
});
|
||||
}
|
||||
set404FromErrorResponse(errorResponse);
|
||||
storeSet('unsetAsyncRequest');
|
||||
}, []);
|
||||
|
||||
const doRejectingStatus = (assignedApplicationId) => {
|
||||
storeSet('setAsyncRequest')
|
||||
const body = {
|
||||
applicationStatus: 'TECHNICAL_EVALUATION_REJECTED'
|
||||
};
|
||||
|
||||
ApplicationEvaluationService.updateStatus(assignedApplicationId, body, handleRejectingSuccess, handleRejectingError);
|
||||
}
|
||||
|
||||
const actionBtns = () => {
|
||||
return <div className="appPageSection__actions">
|
||||
{['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
|
||||
@@ -858,6 +892,14 @@ const DomandaEditInstructorManager = () => {
|
||||
severity={isAdmissible ? 'success' : 'warning'}
|
||||
label={__('Valutazione tecnico-finanziaria positiva', 'gepafin')}
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
disabled={!data.id || !['TECHNICAL_EVALUATION'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
|
||||
onClick={()=>doRejectingStatus(data.assignedApplicationId)}
|
||||
icon="pi pi-info-circle" iconPos="right"
|
||||
severity={isAdmissible ? 'success' : 'warning'}
|
||||
label={__('Respingi domanda per valutazione TF negativa', 'gepafin')}
|
||||
/>
|
||||
{data.id
|
||||
? <Button
|
||||
type="button"
|
||||
@@ -873,7 +915,7 @@ const DomandaEditInstructorManager = () => {
|
||||
? <Button
|
||||
type="button"
|
||||
disabled={APP_EVALUATION_FLOW_ID === '1'
|
||||
&& (!['EVALUATION', 'ADMISSIBLE', 'NDG', 'APPOINTMENT', 'TECHNICAL_EVALUATION'].includes(data.applicationStatus)
|
||||
&& (!['EVALUATION', 'ADMISSIBLE', 'NDG', 'APPOINTMENT'].includes(data.applicationStatus)
|
||||
|| evaluationBlockedForUser(data))}
|
||||
onClick={initiateRejecting}
|
||||
label={__('Respingi domanda', 'gepafin')}
|
||||
|
||||
@@ -792,6 +792,39 @@ const DomandaEditPreInstructor = () => {
|
||||
setData(newData);
|
||||
}, [data]);
|
||||
|
||||
const handleRejectingSuccess = useCallback((response) => {
|
||||
if (response.status === 'SUCCESS') {
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
summary: 'Successo',
|
||||
detail: 'Stato aggiornato a Rifiutato (Valutazione Tecnica)'
|
||||
});
|
||||
}
|
||||
}
|
||||
storeSet('unsetAsyncRequest');
|
||||
}, []);
|
||||
|
||||
const handleRejectingError = useCallback((errorResponse) => {
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
summary: 'Errore',
|
||||
detail: 'Si è verificato un errore durante l\'aggiornamento dello stato.'
|
||||
});
|
||||
}
|
||||
set404FromErrorResponse(errorResponse);
|
||||
storeSet('unsetAsyncRequest');
|
||||
}, []);
|
||||
|
||||
const doRejectingStatus = (assignedApplicationId) => {
|
||||
storeSet('setAsyncRequest')
|
||||
const body = {
|
||||
applicationStatus: 'TECHNICAL_EVALUATION_REJECTED'
|
||||
};
|
||||
|
||||
ApplicationEvaluationService.updateStatus(assignedApplicationId, body, handleRejectingSuccess, handleRejectingError);
|
||||
}
|
||||
const actionBtns = () => {
|
||||
return <div className="appPageSection__actions">
|
||||
{['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
|
||||
@@ -859,8 +892,8 @@ const DomandaEditPreInstructor = () => {
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
disabled={!data.id || (!['ADMISSIBLE'].includes(data.applicationStatus) && !['TECHNICAL_EVALUATION'].includes(data.applicationStatus)) || evaluationBlockedForUser(data)}
|
||||
// onClick={doPassTechnicalEvaluation}
|
||||
disabled={!data.id || !['TECHNICAL_EVALUATION'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
|
||||
onClick={()=>doRejectingStatus(data.assignedApplicationId)}
|
||||
icon="pi pi-info-circle" iconPos="right"
|
||||
severity={isAdmissible ? 'success' : 'warning'}
|
||||
label={__('Respingi domanda per valutazione TF negativa', 'gepafin')}
|
||||
@@ -881,7 +914,7 @@ const DomandaEditPreInstructor = () => {
|
||||
type="button"
|
||||
disabled={['APPROVED', 'REJECTED'].includes(data.applicationStatus)
|
||||
|| (APP_EVALUATION_FLOW_ID === '1'
|
||||
&& (!['EVALUATION', 'ADMISSIBLE', 'APPOINTMENT', 'TECHNICAL_EVALUATION'].includes(data.applicationStatus)
|
||||
&& (!['EVALUATION', 'ADMISSIBLE', 'APPOINTMENT'].includes(data.applicationStatus)
|
||||
|| evaluationBlockedForUser(data)))
|
||||
}
|
||||
onClick={initiateRejecting}
|
||||
|
||||
@@ -25,4 +25,8 @@ export default class ApplicationEvaluationService {
|
||||
['evaluationFormId', formId]
|
||||
]);
|
||||
};
|
||||
|
||||
static updateStatus = (assignedApplicationId, body, callback, errCallback)=>{
|
||||
NetworkService.put(`${API_BASE_URL}/applicationEvaluation/${assignedApplicationId}`, body, callback, errCallback,);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user