diff --git a/application/controllers/Cis/Profil.php b/application/controllers/Cis/Profil.php index d125fcc0e..747a667db 100644 --- a/application/controllers/Cis/Profil.php +++ b/application/controllers/Cis/Profil.php @@ -31,7 +31,7 @@ class Profil extends Auth_Controller $this->load->model('person/Benutzergruppe_model', 'BenutzergruppeModel'); $this->load->model('ressource/Betriebsmittelperson_model', 'BetriebsmittelpersonModel'); $this->load->model('person/Kontakt_model', 'KontaktModel'); - $this->load->model('crm/Profil_change_model', 'ChangeModel'); + $this->load->model('person/Profil_change_model', 'ProfilChangeModel'); //? put the uid and pid inside the controller for further usage in views $this->uid = getAuthUID(); @@ -73,7 +73,7 @@ class Profil extends Auth_Controller //$res = json_encode($this->ChangeModel->load([$this->uid])); //? inserts new row inside the public.tbl_cis_profil_update table - $insert_res = json_encode($this->ChangeModel->insert($data)); + $insert_res = json_encode($this->ProfilChangeModel->insert($data)); echo $insert_res; diff --git a/application/models/crm/Profil_change_model.php b/application/models/person/Profil_change_model.php similarity index 100% rename from application/models/crm/Profil_change_model.php rename to application/models/person/Profil_change_model.php diff --git a/public/js/components/Cis/Profil/MitarbeiterProfil.js b/public/js/components/Cis/Profil/MitarbeiterProfil.js index fe4622656..a23b8c452 100644 --- a/public/js/components/Cis/Profil/MitarbeiterProfil.js +++ b/public/js/components/Cis/Profil/MitarbeiterProfil.js @@ -10,7 +10,7 @@ export default { }, data() { return { - + //? this reactive object contains all the field the user is able to edit and keep track of which fields he has edited editData:null, funktionen_table_options: { @@ -139,9 +139,7 @@ export default { BsModal, ], */ - popup(options) { - return BsModal.popup.bind(this)(null, options); - }, + methods: { showModal() { this.$refs.bsmodal.show() @@ -153,15 +151,10 @@ export default { }, - insertEditData(){ + submitProfilChange(){ - let editDataKeys = Object.keys(this.editData); - let this_data = Object.entries(this.data).filter(([key,value])=>{ - return editDataKeys.includes(key); - }) - - if(JSON.stringify(this_data) == JSON.stringify(Object.entries(this.editData))){ + if(this.isEditDataChanged){ console.log("the editData contains the same information",JSON.stringify(this_data),"editData values:", JSON.stringify(Object.entries(this.editData))); }else{ @@ -193,6 +186,8 @@ export default { return `mailto:info.mio@technikum-wien.at?subject=Datenkorrektur&body=Die%20Profildaten%20für%20User%20'${this.data.username}'%20sind%20nicht%20korrekt.%0DHier, die richtigen Daten:%0A%0ANachname:%20${this.data.nachname}%0AVorname:%20${this.data.vorname}%0AGeburtsdatum:${this.data.gebdatum}%0AGeburtsort:%20${this.data.gebort}%0ATitelPre:${this.data.titel}%20%0ATitelPost:${this.data.postnomen}%20%0A%0A***%0DPlatz für weitere (nicht angeführte Daten)%0D***%0A%0A[Bitte%20übermitteln%20Sie%20uns%20etwaige%20Dokumente%20zum%20Beleg%20der%20Änderung]`; }, + + get_image_base64_src() { if (!this.data) { return ""; @@ -200,6 +195,11 @@ export default { return "data:image/jpeg;base64," + this.data.foto; }, + + isEditDataChanged: function(){ + return JSON.stringify(this.editData) != this.originalEditData; + }, + get_mitarbeiter_standort_telefon(){ if(this.data.standort_telefon){ return "tel:"+ this.data.telefonklappe + this.data.standort_telefon; @@ -278,21 +278,25 @@ export default { }; }, }, + created() { + - this.editData = JSON.parse( - JSON.stringify( + + //? storing an original version of the editData to check if the editData was changed by the user and is not in the original state + this.originalEditData = JSON.stringify( { Personen_Informationen : {...this.personData, vorname: this.data.vorname, nachname: this.data.nachname}, Mitarbeiter_Informatinen: this.specialData, Emails:this.data.emails, Private_Kontakte: this.data.kontakte, Private_Adressen:this.privateAdressen, - })); + }); + + this.editData = JSON.parse(this.originalEditData); + - console.log(this.data.titelpre); - }, mounted() { @@ -306,7 +310,6 @@ export default { }); - @@ -314,8 +317,8 @@ export default { template: ` - +
{{JSON.stringify(editData,null,2)}}
{{JSON.stringify(data.emails,null,2)}}
+
@@ -530,7 +533,7 @@ export default { - +
@@ -597,20 +600,17 @@ export default { - - - + - + - --> - + @@ -845,8 +845,13 @@ export default {
- -
+
+
Funktionen
+
+ +
+
+