diff --git a/resources/js/event_billing.js b/resources/js/event_billing.js index 6c6790c..da5cb9a 100644 --- a/resources/js/event_billing.js +++ b/resources/js/event_billing.js @@ -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; } };