FIX: do not show all steps as active if min_billing_states returns 404 error

This commit is contained in:
Keanu D?lle 2022-03-08 15:56:49 +01:00
parent f20e8c7030
commit d9bb76e087

View File

@ -71,10 +71,12 @@ EventBilling = (function () {
if (event.state >= 7) {
$(".progress_personnel_billing").addClass("active");
for (let state of billing_states) {
$(".progress_approve_" + state.entity_id).addClass("active");
if (state.entity_id === event_min_billing_state) {
break;
if(event_min_billing_state) {
for (let state of billing_states) {
$(".progress_approve_" + state.entity_id).addClass("active");
if (state.entity_id === event_min_billing_state) {
break;
}
}
}
}
@ -94,7 +96,7 @@ EventBilling = (function () {
}
};
let load_min_billing_states_for_event = async function (event_id) {
const res = $.ajax({
const res = await $.ajax({
url: '/api/events/' + event_id + '/billing_states/min',
type: 'GET',
contentType: 'application/json',
@ -103,7 +105,9 @@ EventBilling = (function () {
alert("Es ist ein Fehler aufgetreten!");
}
});
if (is_ok(res)) {
if('error' in res){
return null;
}else{
return res;
}
};