diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index ca7d3ef3d..3c63c0c17 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -93,7 +93,8 @@ class Config extends FHCAPI_Controller ]; $result['grades'] = [ 'title' => $this->p->t('stv', 'tab_grades'), - 'component' => './Stv/Studentenverwaltung/Details/Noten.js' + 'component' => './Stv/Studentenverwaltung/Details/Noten.js', + 'showOnlyWithUid' => true ]; diff --git a/public/js/components/Stv/Studentenverwaltung/Details.js b/public/js/components/Stv/Studentenverwaltung/Details.js index 4df148063..b42611095 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details.js +++ b/public/js/components/Stv/Studentenverwaltung/Details.js @@ -9,8 +9,8 @@ export default { }, data() { return { - configStudent: null, - configStudents: null + configStudent: {}, + configStudents: {} }; }, props: { @@ -19,6 +19,17 @@ export default { computed: { appRoot() { return FHC_JS_DATA_STORAGE_OBJECT.app_root; + }, + config() { + if (!this.students.length) + return {}; + if (this.students.length == 1) { + const student = this.students[0]; + if (student.uid) + return Object.fromEntries(Object.entries(this.configStudent).filter(([key, value]) => !value.showOnlyWithoutUid)); + return Object.fromEntries(Object.entries(this.configStudent).filter(([key, value]) => !value.showOnlyWithUid)); + } + return this.configStudents; } }, methods: { @@ -53,8 +64,11 @@ export default {