diff --git a/public/js/components/Cis/Profil/ProfilComponents/ProfilInformation.js b/public/js/components/Cis/Profil/ProfilComponents/ProfilInformation.js
index 83b746c69..040eed441 100755
--- a/public/js/components/Cis/Profil/ProfilComponents/ProfilInformation.js
+++ b/public/js/components/Cis/Profil/ProfilComponents/ProfilInformation.js
@@ -1,59 +1,70 @@
export default {
+ props: {
+ title: {
+ type: String,
+ },
+ data: {
+ type: Object,
+ },
+ },
+ data() {
+ return {
+ FotoSperre: this.data.foto_sperre,
+ };
+ },
+ emits: ["showEditProfilModal"],
- props:{
- title:{
- type:String,
-
- },
- data:{
- type:Object,
+ methods: {
+ sperre_foto_function() {
+ //TODO: refactor
+ if (!this.data) {
+ return;
+ }
+ Vue.$fhcapi.UserData.sperre_foto_function(!this.FotoSperre).then(
+ (res) => {
+ this.FotoSperre = res.data.foto_sperre;
}
+ );
},
- data(){
- return {
- FotoSperre:this.data.foto_sperre,
+ },
+ computed: {
+ get_image_base64_src: function () {
+ if (!this.data.foto) {
+ return "";
+ }
+ return "data:image/jpeg;base64," + this.data.foto;
+ },
+ name: function () {
+ return { vorname: this.data.Vorname, nachname: this.data.Nachname };
+ },
+ profilInfo: function () {
+ let res = {};
+ let notIncludedProperties = [
+ "Vorname",
+ "Nachname",
+ "foto_sperre",
+ "foto",
+ ];
+ Object.keys(this.data).forEach((key) => {
+ if (!notIncludedProperties.includes(key)) {
+ res[key] = this.data[key];
}
+ });
+ return res;
},
-
- methods:{
-
- sperre_foto_function() {
- //TODO: make this better
- if (!this.data) {
- return;
- }
- Vue.$fhcapi.UserData.sperre_foto_function(!this.FotoSperre).then((res) => {
- this.FotoSperre = res.data.foto_sperre;
-
- });
- },
- },
- computed:{
- get_image_base64_src: function() {
- if (!this.data.foto) {
- return "";
- }
- return "data:image/jpeg;base64," + this.data.foto;
- },
- name: function(){
- return {vorname:this.data.Vorname, nachname: this.data.Nachname};
- },
- profilInfo: function(){
- let res = {};
- let notIncludedProperties=["Vorname", "Nachname", "foto_sperre","foto"];
- Object.keys(this.data).forEach((key)=>{
- if(!notIncludedProperties.includes(key)){
- res[key] = this.data[key];
- }
- })
- return res;
- }
- },
- template: `
+ },
+ template: /*html*/ `
@@ -134,5 +145,4 @@ export default {
`,
-
-};
\ No newline at end of file
+};
diff --git a/public/js/components/Cis/Profil/ProfilModal/EditProfilSelect.js b/public/js/components/Cis/Profil/ProfilModal/EditProfilSelect.js
index 74aa15968..983e0a20c 100755
--- a/public/js/components/Cis/Profil/ProfilModal/EditProfilSelect.js
+++ b/public/js/components/Cis/Profil/ProfilModal/EditProfilSelect.js
@@ -133,8 +133,12 @@ export default {
created() {
//? JSON parse and stringify are used to deep clone the objects
this.properties = { ...this.list };
- this.data = JSON.parse(JSON.stringify(this.list.data));
- this.view = JSON.parse(JSON.stringify(this.list.view));
+ this.data = this.list.data
+ ? JSON.parse(JSON.stringify(this.list.data))
+ : null;
+ this.view = this.list.view
+ ? JSON.parse(JSON.stringify(this.list.view))
+ : null;
},
mounted() {},
diff --git a/public/js/components/Cis/Profil/StudentProfil.js b/public/js/components/Cis/Profil/StudentProfil.js
index 0eb7e8770..2f6b988e0 100755
--- a/public/js/components/Cis/Profil/StudentProfil.js
+++ b/public/js/components/Cis/Profil/StudentProfil.js
@@ -22,14 +22,16 @@ export default {
RoleInformation,
ProfilInformation,
FetchProfilUpdates,
- EditProfil
-
+ EditProfil,
},
- inject:['sortProfilUpdates','collapseFunction'],
+ inject: ["sortProfilUpdates", "collapseFunction"],
data() {
return {
showModal: false,
collapseIconBetriebsmittel: true,
+ editDataFilter: null,
+
+ // tabulator options
zutrittsgruppen_table_options: {
height: 200,
layout: "fitColumns",
@@ -79,58 +81,62 @@ export default {
},
props: {
- data:Object,
- editData:Object,
+ data: Object,
+ editData: Object,
},
methods: {
-
- fetchProfilUpdates: function(){
- Vue.$fhcapi.ProfilUpdate.selectProfilRequest().then((res)=>{
-
- if(!res.error){
- this.data.profilUpdates = res.data?.length ? res.data.sort(this.sortProfilUpdates) : null ;
+ fetchProfilUpdates: function () {
+ Vue.$fhcapi.ProfilUpdate.selectProfilRequest().then((res) => {
+ if (!res.error) {
+ this.data.profilUpdates = res.data?.length
+ ? res.data.sort(this.sortProfilUpdates)
+ : null;
}
});
},
-
- hideEditProfilModal: function(){
-
+
+ hideEditProfilModal: function () {
//? checks the editModal component property result, if the user made a successful request or not
- if(this.$refs.editModal.result){
+ if (this.$refs.editModal.result) {
Vue.$fhcapi.ProfilUpdate.selectProfilRequest()
- .then((request) =>{
- if(!request.error){
- this.data.profilUpdates = request.data;
- this.data.profilUpdates.sort(this.sortProfilUpdates);
-
- }else{
- console.log("Error when fetching profile updates: " +res.data);
- }
- })
- .catch(err=>{
- console.log(err);
- });
- }else{
+ .then((request) => {
+ if (!request.error) {
+ this.data.profilUpdates = request.data;
+ this.data.profilUpdates.sort(this.sortProfilUpdates);
+ } else {
+ console.log("Error when fetching profile updates: " + res.data);
+ }
+ })
+ .catch((err) => {
+ console.log(err);
+ });
+ } else {
// when modal was closed without submitting request
}
- this.showModal=false;
-
+ this.showModal = false;
+ this.editDataFilter = null;
},
- showEditProfilModal() {
+ showEditProfilModal(view) {
+ if (view) {
+ this.editDataFilter = view;
+ }
this.showModal = true;
// after a state change, wait for the DOM updates to complete
- Vue.nextTick(()=>{
+ Vue.nextTick(() => {
this.$refs.editModal.show();
});
-
},
-
},
computed: {
-
- profilInformation() {
+ filteredEditData() {
+ return this.editDataFilter
+ ? this.editData.data[this.editDataFilter]
+ : this.editData;
+ },
+
+ profilInformation() {
if (!this.data) {
return {};
}
@@ -142,13 +148,11 @@ export default {
Anrede: this.data.anrede,
Titel: this.data.titel,
Postnomen: this.data.postnomen,
- foto_sperre:this.data.foto_sperre,
- foto:this.data.foto,
-
+ foto_sperre: this.data.foto_sperre,
+ foto: this.data.foto,
};
},
-
roleInformation() {
if (!this.data) {
return {};
@@ -164,36 +168,29 @@ export default {
Gruppe: this.data.gruppe.trim(),
};
},
-
-
},
- created(){
-
+ created() {
//? sorts the profil Updates: pending -> accepted -> rejected
this.data.profilUpdates?.sort(this.sortProfilUpdates);
},
mounted() {
- this.$refs.betriebsmittelTable.tabulator.on('tableBuilt', () => {
-
+ this.$refs.betriebsmittelTable.tabulator.on("tableBuilt", () => {
this.$refs.betriebsmittelTable.tabulator.setData(this.data.mittel);
-
- })
+ });
- this.$refs.zutrittsgruppenTable.tabulator.on('tableBuilt', () => {
-
- this.$refs.zutrittsgruppenTable.tabulator.setData(this.data.zuttritsgruppen);
-
- })
-
-
+ this.$refs.zutrittsgruppenTable.tabulator.on("tableBuilt", () => {
+ this.$refs.zutrittsgruppenTable.tabulator.setData(
+ this.data.zuttritsgruppen
+ );
+ });
},
- template:/*html*/ `
+ template: /*html*/ `
-
+
@@ -250,7 +247,7 @@ export default {
@@ -290,7 +287,15 @@ export default {
@@ -312,7 +317,16 @@ export default {
-
+
@@ -367,7 +381,7 @@ export default {
-