diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php
index 42de1b02f..138bdec67 100644
--- a/application/controllers/api/frontend/v1/stv/Config.php
+++ b/application/controllers/api/frontend/v1/stv/Config.php
@@ -29,6 +29,8 @@ class Config extends FHCAPI_Controller
{
+ private $arr;
+
public function __construct()
{
// TODO(chris): permissions
@@ -162,11 +164,12 @@ class Config extends FHCAPI_Controller
'changeStatusToAbsolvent' => $this->permissionlib->isBerechtigt('admin')
]
];
- $result['finalexam'] = [
- 'title' => $this->p->t('stv', 'tab_finalexam'),
+ $this->arr = [
+ 'title' => $this->p->t('stv', 'tab_finalexam'),
'component' => './Stv/Studentenverwaltung/Details/Abschlusspruefung.js',
'config' => $config['finalexam']
];
+ $result['finalexam'] = $this->arr;
Events::trigger('stv_conf_students', function & () use (&$result) {
return $result;
diff --git a/public/js/api/factory/detailHeader.js b/public/js/api/factory/detailHeader.js
new file mode 100644
index 000000000..f9f368bc7
--- /dev/null
+++ b/public/js/api/factory/detailHeader.js
@@ -0,0 +1,37 @@
+/**
+ * Copyright (C) 2025 fhcomplete.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+export default {
+ getHeader(person_id){
+ return {
+ method: 'get',
+ url: 'api/frontend/v1/vertraege/vertraege/getHeader/' + person_id,
+ };
+ },
+ getPersonAbteilung(person_id){
+ return {
+ method: 'get',
+ url: 'api/frontend/v1/vertraege/vertraege/getPersonAbteilung/' + person_id,
+ };
+ },
+ getLeitungOrg(oekurzbz){
+ return {
+ method: 'get',
+ url: 'api/frontend/v1/vertraege/vertraege/getLeitungOrg/' + oekurzbz,
+ };
+ },
+}
\ No newline at end of file
diff --git a/public/js/components/DetailHeader/DetailHeader.js b/public/js/components/DetailHeader/DetailHeader.js
index a50b39e8c..0b50c5153 100644
--- a/public/js/components/DetailHeader/DetailHeader.js
+++ b/public/js/components/DetailHeader/DetailHeader.js
@@ -1,9 +1,21 @@
+import ApiDetailHeader from "../../api/factory/detailHeader.js";
+
export default {
name: 'DetailHeader',
+ inject: {
+ domain: {
+ from: 'configDomain',
+ default: 'technikum-wien.at'
+ },
+ },
props: {
headerData: {
type: Object,
- required: true
+ required: false
+ },
+ person_id: {
+ type: Number,
+ required: false
},
typeHeader: {
type: String,
@@ -20,87 +32,179 @@ export default {
appRoot() {
return FHC_JS_DATA_STORAGE_OBJECT.app_root;
},
+ validatedHeaderData() {
+ if (this.typeHeader === 'student') return this.headerData;
+ if (this.typeHeader === 'mitarbeiter') return this.person_id;
+ return null;
+ }
+ },
+ created(){
+ if(this.person_id) {
+ this.getHeader(this.person_id);
+
+ this.loadDepartmentData(this.person_id)
+ .then(() => {
+ // Call getLeitungOrg only after departmentData is loaded
+ this.getLeitungOrg(this.departmentData.oe_kurzbz);
+ })
+ .catch((error) => {
+ console.error("Error loading department data:", error);
+ });
+ }
+ },
+ watch: {
+ person_id: {
+ handler(newVal) {
+ if (newVal) {
+ this.getHeader(this.person_id);
+ this.loadDepartmentData(this.person_id).
+ then(() => {
+ this.getLeitungOrg(this.departmentData.oe_kurzbz);
+ });
+ }
+ },
+ deep: true,
+ },
},
data(){
- return{};
+ return{
+ headerDataMa: {},
+ departmentData: {},
+ leitungData: {},
+ };
},
methods: {
- //TODO(Manu) finish for Vertragsverwaltung
- getVorgesetzer(){},
+ getHeader(person_id) {
+ return this.$api
+ .call(ApiDetailHeader.getHeader(person_id))
+ .then(result => {
+ this.headerDataMa = result.data;
+
+ })
+ .catch(this.$fhcAlert.handleSystemError);
+ },
+ loadDepartmentData(person_id) {
+ return this.$api
+ .call(ApiDetailHeader.getPersonAbteilung(person_id))
+ .then(result => {
+ this.departmentData = result.data;
+ })
+ .catch(this.$fhcAlert.handleSystemError);
+ },
+ getLeitungOrg(oekurzbz){
+ return this.$api
+ .call(ApiDetailHeader.getLeitungOrg(oekurzbz))
+ .then(result => {
+ this.leitungData = result.data;
+ })
+ .catch(this.$fhcAlert.handleSystemError);
+ },
+ redirectToLeitung(){
+ this.$emit('redirectToLeitung', {
+ person_id: this.leitungData.person_id});
+ }
},
template: `
-
+
+
`
-}
\ No newline at end of file
+}