mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-18 15:32:17 +00:00
fetches profil update request if an entry with uid in table public.tbl_cis_profil_update exists
This commit is contained in:
@@ -21,6 +21,7 @@ class Profil extends Auth_Controller
|
||||
'foto_sperre_function' => ['student/anrechnung_beantragen:r', 'user:r'],
|
||||
'getView' => ['student/anrechnung_beantragen:r', 'user:r'],
|
||||
'editProfil' => ['student/anrechnung_beantragen:r', 'user:r'],
|
||||
|
||||
|
||||
]);
|
||||
$this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel');
|
||||
@@ -90,6 +91,7 @@ class Profil extends Auth_Controller
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function viewMitarbeiterProfil($uid)
|
||||
{
|
||||
|
||||
@@ -179,6 +181,7 @@ class Profil extends Auth_Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$res = new stdClass();
|
||||
$res->username = $uid;
|
||||
@@ -482,6 +485,15 @@ class Profil extends Auth_Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//? querying if the user already has a pending profil information update request
|
||||
$editData_res = $this->ProfilChangeModel->load([$this->uid]);
|
||||
if(isError($editData_res)){
|
||||
//error handling
|
||||
}else{
|
||||
$editData_res = hasData($editData_res) ? getData($editData_res)[0] : null;
|
||||
}
|
||||
|
||||
$res = new stdClass();
|
||||
$res->foto = $person_res->foto;
|
||||
$res->foto_sperre = $person_res->foto_sperre;
|
||||
@@ -520,6 +532,10 @@ class Profil extends Auth_Controller
|
||||
|
||||
//telefon nummer von dem Standort
|
||||
$res->standort_telefon = $telefon_res;
|
||||
|
||||
$res->editData = json_decode($editData_res->profil_changes);
|
||||
$res->editDataTimestamp = $editData_res->change_timestamp;
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -672,6 +688,15 @@ class Profil extends Auth_Controller
|
||||
}
|
||||
}
|
||||
|
||||
//? querying if the user already has a pending profil information update request
|
||||
$editData_res = $this->ProfilChangeModel->load([$this->uid]);
|
||||
if(isError($editData_res)){
|
||||
//error handling
|
||||
}else{
|
||||
$editData_res = hasData($editData_res) ? getData($editData_res)[0] : null;
|
||||
}
|
||||
|
||||
|
||||
$res = new stdClass();
|
||||
|
||||
|
||||
@@ -708,7 +733,8 @@ class Profil extends Auth_Controller
|
||||
|
||||
|
||||
$res->mailverteiler = $mailverteiler_res;
|
||||
|
||||
$res->editData = json_decode($editData_res->profil_changes);
|
||||
$res->editDataTimestamp = $editData_res->change_timestamp;
|
||||
return $res;
|
||||
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@ const app = Vue.createApp({
|
||||
this.view = res.data?.view;
|
||||
this.data = res.data?.data;
|
||||
|
||||
|
||||
});
|
||||
},
|
||||
template:`
|
||||
|
||||
@@ -5,6 +5,12 @@ export default {
|
||||
`/Cis/Profil/editProfil`;
|
||||
return axios.post(url,payload);
|
||||
},
|
||||
|
||||
getEditProfil: function() {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router+
|
||||
`/Cis/Profil/getEditProfil`;
|
||||
return axios.get(url);
|
||||
},
|
||||
|
||||
isMitarbeiterOrStudent: function(uid) {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
@@ -25,24 +31,7 @@ export default {
|
||||
},
|
||||
|
||||
|
||||
indexProfilInformaion: function(uid, view=false) {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router+
|
||||
`/Cis/Profil/indexProfilInformaion/${uid}/${view}`;
|
||||
|
||||
return axios.get(url);
|
||||
},
|
||||
mitarbeiterProfil: function() {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router+
|
||||
`/Cis/Profil/mitarbeiterProfil/`;
|
||||
|
||||
return axios.get(url);
|
||||
},
|
||||
studentProfil: function(uid, view=false) {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router+
|
||||
`/Cis/Profil/studentProfil/${uid}/${view}`;
|
||||
|
||||
return axios.get(url);
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,8 +11,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: {
|
||||
height: 300,
|
||||
layout: "fitColumns",
|
||||
@@ -150,7 +149,7 @@ export default {
|
||||
submitProfilChange(){
|
||||
if(this.isEditDataChanged){
|
||||
//? inserts new row in public.tbl_cis_profil_update
|
||||
Vue.$fhcapi.UserData.editProfil(this.editData);
|
||||
Vue.$fhcapi.UserData.editProfil(this.data.editData);
|
||||
|
||||
}
|
||||
},
|
||||
@@ -182,7 +181,7 @@ export default {
|
||||
|
||||
|
||||
isEditDataChanged: function(){
|
||||
return JSON.stringify(this.editData) != this.originalEditData;
|
||||
return JSON.stringify(this.data.editData) != this.originalEditData;
|
||||
},
|
||||
|
||||
get_mitarbeiter_standort_telefon(){
|
||||
@@ -266,23 +265,22 @@ export default {
|
||||
|
||||
created() {
|
||||
|
||||
if(this.data.editData){
|
||||
this.originalEditData = JSON.stringify(this.data.editData);
|
||||
}else{
|
||||
//? 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,
|
||||
});
|
||||
|
||||
|
||||
|
||||
//? 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.data.editData = JSON.parse(this.originalEditData);
|
||||
|
||||
this.editData = JSON.parse(this.originalEditData);
|
||||
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
@@ -295,14 +293,11 @@ export default {
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
template: `
|
||||
|
||||
<div class="row"><div class="col"><pre>{{JSON.stringify(editData,null,2)}}</pre></div><div class="col"><pre>{{JSON.stringify(data.emails,null,2)}}</pre></div></div>
|
||||
<div class="row"><div class="col"><pre>{{JSON.stringify(data.editData,null,2)}}</pre></div><div class="col"><pre>{{JSON.stringify(data.emails,null,2)}}</pre></div></div>
|
||||
|
||||
<div class="container-fluid text-break fhc-form" >
|
||||
<!-- ROW -->
|
||||
@@ -522,7 +517,7 @@ export default {
|
||||
|
||||
|
||||
<div class="accordion accordion-flush" id="accordionFlushExample" >
|
||||
<div class="accordion-item" v-for="(value,key) in editData ">
|
||||
<div class="accordion-item" v-for="(value,key) in data.editData ">
|
||||
<h2 class="accordion-header" :id="'flush-headingOne'+key">
|
||||
<button style="font-weight:500" class="accordion-button collapsed" type="button" data-bs-toggle="collapse" :data-bs-target="'#flush-collapseOne'+key" aria-expanded="false" :aria-controls="'flush-collapseOne'+key">
|
||||
{{key.replace("_"," ")}}
|
||||
@@ -534,18 +529,18 @@ export default {
|
||||
|
||||
<div v-if="Array.isArray(value)" class="row gy-5">
|
||||
|
||||
<template v-for="(objects,objectkey) in value" >
|
||||
<template v-for="(object,objectkey) in value" >
|
||||
<div class="col-12 ">
|
||||
<div class="row gy-3">
|
||||
<div v-for="(data,title) in objects" class="col-12" >
|
||||
<div v-for="(propertyValue,propertyKey) in object" class="col-12" >
|
||||
|
||||
<div class="form-underline ">
|
||||
<div class="form-underline-titel">
|
||||
<label :for="title+'input'" >{{title}}</label>
|
||||
<label :for="propertyKey+'input'" >{{propertyKey}}</label>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<input class="form-control" :id="title+'input'" v-model="editData[key][objectkey][title]" :placeholder="data">
|
||||
<input class="form-control" :id="propertyKey+'input'" v-model="data.editData[key][objectkey][propertyKey]" :placeholder="propertyValue">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -553,22 +548,22 @@ export default {
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<hr class="mb-0" v-if="value[value.length-1] != objects">
|
||||
<hr class="mb-0" v-if="value[value.length-1] != object">
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div v-else class="row gy-3">
|
||||
<div v-for="(data,title) in value" class="col-12">
|
||||
<div v-for="(propertyValue,propertyKey) in value" class="col-12">
|
||||
|
||||
<div class="form-underline ">
|
||||
<div class="form-underline-titel">
|
||||
<label :for="title+'input'" >{{title}}</label>
|
||||
<label :for="propertyKey+'input'" >{{propertyKey}}</label>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<input type="email" class="form-control" :id="title+'input'" v-model="editData[key][title]" :placeholder="data">
|
||||
<input type="email" class="form-control" :id="propertyKey+'input'" v-model="data.editData[key][propertyKey]" :placeholder="propertyValue">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import fhcapifactory from "../../../apps/api/fhcapifactory.js";
|
||||
|
||||
import { CoreFilterCmpt } from "../../../components/filter/Filter.js";
|
||||
|
||||
export default {
|
||||
|
||||
Reference in New Issue
Block a user