Fixed: Recommendation button was not enabled correctly after withdrawing approvement

Now, if approvment is withdrawn, the recommendation button is enabled again
ONLY if no recommendation was submitted until yet.

Signed-off-by: cris-technikum <hainberg@technikum-wien.at>
This commit is contained in:
cris-technikum
2021-03-29 13:05:27 +02:00
parent 279157b920
commit 2c091cd405
2 changed files with 9 additions and 2 deletions
@@ -403,6 +403,8 @@ var approveAnrechnungDetail = {
$('#approveAnrechnungDetail-withdraw-anrechnung-approvement').removeClass('hidden');
},
formatGenehmigungIsWithdrawed: function (statusBezeichnung){
let empfehlung = $('#approveAnrechnungDetail-empfehlung').data('empfehlung'); // null / false / true
$('#approveAnrechnungDetail-status_kurzbz').text(statusBezeichnung);
$('#approveAnrechnungDetail-status_kurzbz').closest('div').removeClass('alert-danger').removeClass('alert-success');
$('#approveAnrechnungDetail-status_kurzbz').closest('div').addClass('alert-warning');
@@ -414,7 +416,11 @@ var approveAnrechnungDetail = {
$('#approveAnrechnungDetail-abgeschlossenAm').text('-');
$('#approveAnrechnungDetail-abgeschlossenVon').text('-');
$('#approveAnrechnungDetail-request-recommendation').prop('disabled', false);
// Only enable recommendation button again if no recommendation was submitted until now
if (empfehlung === null)
{
$('#approveAnrechnungDetail-request-recommendation').prop('disabled', false);
}
$('#approveAnrechnungDetail-approve-anrechnung-ask').prop('disabled', false);
$('#approveAnrechnungDetail-reject-anrechnung-ask').prop('disabled', false);
// Hide button to withdraw approval