From 9912af7690bf0ad5c15b5a8ca878bc3b7b8d3b9f Mon Sep 17 00:00:00 2001 From: Keanu D?lle Date: Tue, 8 Mar 2022 16:06:34 +0100 Subject: [PATCH] FIX: show correct action buttons in event billing overview --- resources/js/event_billing.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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(); } } }