diff --git a/application/config/Events.php b/application/config/Events.php
new file mode 100644
index 000000000..191a1eb98
--- /dev/null
+++ b/application/config/Events.php
@@ -0,0 +1,14 @@
+ 'TEST',
+ 'component' => './Stv/Studentenverwaltung/Details/Notizen.js'
+ ];
+ });
+ */
diff --git a/application/controllers/components/stv/Config.php b/application/controllers/components/stv/Config.php
new file mode 100644
index 000000000..a9503f4e6
--- /dev/null
+++ b/application/controllers/components/stv/Config.php
@@ -0,0 +1,40 @@
+ 'Details',
+ 'component' => './Stv/Studentenverwaltung/Details/Details.js'
+ ];
+ $result['kontakt'] = [
+ 'title' => 'Kontakt',
+ 'component' => './Stv/Studentenverwaltung/Details/Kontakt.js'
+ ];
+ $result['notizen'] = [
+ 'title' => 'Notizen',
+ 'component' => './Stv/Studentenverwaltung/Details/Notizen.js'
+ ];
+
+ Events::trigger('stv_conf_student', $result);
+
+ $this->outputJsonSuccess($result);
+ }
+
+ public function students()
+ {
+ $this->outputJsonSuccess([]);
+ }
+}
diff --git a/application/core/CI3_Events.php b/application/core/CI3_Events.php
new file mode 100644
index 000000000..d2c687a75
--- /dev/null
+++ b/application/core/CI3_Events.php
@@ -0,0 +1,51 @@
+
-
+
diff --git a/public/js/components/Stv/Studentenverwaltung/Details.js b/public/js/components/Stv/Studentenverwaltung/Details.js
index f444c0eec..78e57ae88 100644
--- a/public/js/components/Stv/Studentenverwaltung/Details.js
+++ b/public/js/components/Stv/Studentenverwaltung/Details.js
@@ -1,66 +1,20 @@
-import accessibility from "../../../directives/accessibility.js";
+import FhcTabs from "../../Tabs.js";
export default {
- directives: {
- accessibility
+ components: {
+ FhcTabs
},
props: {
- student: Object
- },
- data() {
- return {
- current: this.$route.params.tab || 'details',
- tabTemplates: {
- details: 'Details',
- notizen: 'Notizen',
- kontakt: 'Kontakt'
- },
- tabs: {}
- }
- },
- computed: {
- hasNoStudent() {
- return !this.student || (Object.keys(this.student).length === 0 && this.student.constructor === Object);
- },
- currentComponent() {
- return this.tabs[this.current].component;
- }
- },
- created() {
- this.tabs = Object.fromEntries(Object.entries(this.tabTemplates).map(([key, title]) => {
- return [key, {
- title,
- component: Vue.defineAsyncComponent(() => import("./Details/" + key.charAt(0).toUpperCase() + key.slice(1) + '.js'))
- }];
- }));
+ students: Array
},
template: `
-
Bitte StudentIn auswählen!
-
-
-
-
-
-
-
- Loading...
-
-
-
-
+
+ Bitte StudentIn auswählen!
+
+
+
+
`
};
\ No newline at end of file
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Details.js b/public/js/components/Stv/Studentenverwaltung/Details/Details.js
index c60a32b1e..9d824e142 100644
--- a/public/js/components/Stv/Studentenverwaltung/Details/Details.js
+++ b/public/js/components/Stv/Studentenverwaltung/Details/Details.js
@@ -37,7 +37,7 @@ export default {
}
},
props: {
- student: Object
+ modelValue: Object
},
data() {
return {
@@ -65,7 +65,7 @@ export default {
}
},
watch: {
- student(n) {
+ modelValue(n) {
this.updateStudent(n);
},
data: {
@@ -104,7 +104,7 @@ export default {
},
save() {
CoreRESTClient
- .post('components/stv/Student/save/' + this.student.prestudent_id, this.changed)
+ .post('components/stv/Student/save/' + this.modelValue.prestudent_id, this.changed)
.then(result => result.data)
.then(result => {
this.resetErrors();
@@ -169,7 +169,7 @@ export default {
}
},
created() {
- this.updateStudent(this.student);
+ this.updateStudent(this.modelValue);
},
//TODO(chris): Geburtszeit? Anzahl der Kinder?
template: `
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt.js
index f8d30a5a6..64d62642d 100644
--- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt.js
+++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt.js
@@ -14,7 +14,7 @@ export default {
PvAutoComplete
},
props: {
- student: Object
+ modelValue: Object
},
data() {
return {
@@ -25,7 +25,7 @@ export default {
},
created(){
CoreRESTClient
- .get('components/stv/Kontakt/getAdressen/' + this.student.person_id)
+ .get('components/stv/Kontakt/getAdressen/' + this.modelValue.person_id)
.then(result => {
this.adressen = result.data;
})
@@ -33,7 +33,7 @@ export default {
console.error(err.response.data || err.message);
});
/* CoreRESTClient
- .get('components/stv/Kontakt/getKontakte/' + this.student.person_id)
+ .get('components/stv/Kontakt/getKontakte/' + this.modelValue.person_id)
.then(result => {
this.kontakte = result.data;
})
@@ -41,7 +41,7 @@ export default {
console.error(err.response.data || err.message);
});
CoreRESTClient
- .get('components/stv/Kontakt/getBankverbindung/' + this.student.person_id)
+ .get('components/stv/Kontakt/getBankverbindung/' + this.modelValue.person_id)
.then(result => {
this.bankverbindungen = result.data;
})
@@ -62,19 +62,19 @@ export default {
-
+
`
};
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js
index f94468b4c..4b7f5901e 100644
--- a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js
+++ b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js
@@ -1,6 +1,6 @@
export default {
props: {
- student: Object
+ modelValue: Object
},
template: `
diff --git a/public/js/components/Tabs.js b/public/js/components/Tabs.js
new file mode 100644
index 000000000..809a258ce
--- /dev/null
+++ b/public/js/components/Tabs.js
@@ -0,0 +1,85 @@
+import {CoreRESTClient} from '../RESTClient.js';
+import accessibility from "../directives/accessibility.js";
+
+export default {
+ directives: {
+ accessibility
+ },
+ emits: [
+ 'update:modelValue'
+ ],
+ props: {
+ configUrl: String,
+ default: String,
+ modelValue: [String, Number, Boolean, Array, Object, Date, Function, Symbol]
+ },
+ data() {
+ return {
+ current: null,
+ tabs: {}
+ }
+ },
+ computed: {
+ currentTab() {
+ if (this.tabs[this.current])
+ return this.tabs[this.current];
+
+ return { component: 'div' };
+ },
+ value: {
+ get() {
+ return this.modelValue;
+ },
+ set(v) {
+ this.$emit('update:modelValue', v);
+ }
+ }
+ },
+ created() {
+ CoreRESTClient
+ .get(this.configUrl)
+ .then(result => CoreRESTClient.getData(result.data))
+ .then(result => {
+ const tabs = {};
+ // TODO(chris): check if result is array
+ Object.entries(result).forEach(([key, config]) => {
+ if (!config.component)
+ return console.error('Component missing for ' + key);
+
+ tabs[key] = {
+ component: Vue.defineAsyncComponent(() => import(config.component)),
+ title: config.title || key,
+ config: config.config,
+ key
+ }
+ });
+ if (tabs[this.default])
+ this.current = this.default;
+ else
+ this.current = Object.keys(tabs)[0];
+ this.tabs = tabs;
+ })
+ .catch(this.$fhcAlert.handleSystemError);
+ },
+ template: `
+
`
+};
\ No newline at end of file