diff --git a/resources/js/event_billing.js b/resources/js/event_billing.js index da5cb9a..d71df32 100644 --- a/resources/js/event_billing.js +++ b/resources/js/event_billing.js @@ -105,6 +105,9 @@ EventBilling = (function () { alert("Es ist ein Fehler aufgetreten!"); } }); + if(typeof res !== 'object'){ + return res; + } if('error' in res){ return null; }else{ @@ -196,16 +199,14 @@ EventBilling = (function () { } else if (event.state === 6) { $(".goto_personnel_billing").show(); } else if (event.state >= 7) { - let min_billing_state; - if (!event_min_billing_state.error) { - min_billing_state = event_min_billing_state; - } else { - min_billing_state = billing_states[0].entity_id; + if (!event_min_billing_state) { + $(".goto_approve_" + billing_states[0].entity_id).show(); } + //Show next approval step (billing_state) button for (let i = 0; i < billing_states.length - 1; i++) { - if (billing_states[i].entity_id === min_billing_state) { - $(".goto_approve_" + billing_states[i + 1].entity_id).show(); + if (billing_states[i].entity_id === event_min_billing_state) { + $(".goto_approve_" + billing_states[i+1].entity_id).show(); } } }