diff --git a/application/libraries/AntragLib.php b/application/libraries/AntragLib.php index a04a03d84..0b5ec1957 100644 --- a/application/libraries/AntragLib.php +++ b/application/libraries/AntragLib.php @@ -1627,8 +1627,7 @@ class AntragLib if ($antrag->typ != Studierendenantrag_model::TYP_ABMELDUNG_STGL) return $this->isOwnAntrag($antrag_id); - // TODO(chris): assistenz can not cancel - should they be able to? - return false; + return $this->hasAccessToAntrag($antrag_id, 'student/studierendenantrag'); } /** diff --git a/public/js/components/Studierendenantrag/Leitung.js b/public/js/components/Studierendenantrag/Leitung.js index 2b2a53d61..747ad7123 100644 --- a/public/js/components/Studierendenantrag/Leitung.js +++ b/public/js/components/Studierendenantrag/Leitung.js @@ -267,6 +267,25 @@ export default { .then(this.showValidation) .catch(this.showError); }, + actionCancel(evt) { + var antraege = evt || this.selectedData; + this.$refs.loader.show(); + axios + .all( + antraege.map( + antrag => axios.post( + FHC_JS_DATA_STORAGE_OBJECT.app_root + + FHC_JS_DATA_STORAGE_OBJECT.ci_router + + '/components/Antrag/Abmeldung/cancelAntrag/', + { + antrag_id: antrag.studierendenantrag_id + } + ) + ) + ) + .then(this.showValidation) + .catch(this.showError); + }, showValidation(results) { var errors = results.filter(res => res.data.error); this.$refs.loader.hide(); @@ -327,6 +346,7 @@ export default { @action:object="actionObject" @action:objectionDeny="actionoObjectionDeny" @action:objectionApprove="actionObjectionApprove" + @action:cancel="actionCancel" > diff --git a/public/js/components/Studierendenantrag/Leitung/Table.js b/public/js/components/Studierendenantrag/Leitung/Table.js index cb469ee57..ba665c6f9 100644 --- a/public/js/components/Studierendenantrag/Leitung/Table.js +++ b/public/js/components/Studierendenantrag/Leitung/Table.js @@ -25,7 +25,8 @@ export default { 'action:reopen', 'action:object', 'action:objectionDeny', - 'action:objectionApprove' + 'action:objectionApprove', + 'action:cancel' ], data() { return { @@ -272,6 +273,14 @@ export default { }; container.append(button); } + // NOTE(chris): Cancel + if (data.typ == 'AbmeldungStgl' && data.status == 'Erstellt') { + let button = document.createElement('button'); + button.innerHTML = this.p.t('studierendenantrag', 'btn_cancel'); + button.className = "btn btn-outline-secondary"; + button.addEventListener('click',() => this.$emit('action:cancel', [cell.getData()])); + container.append(button); + } } if (this.stgL.includes(data.studiengang_kz)) {