store getAuthUID and getAuthPersonID inside Profil controller to avoid extra calls

This commit is contained in:
Simon Gschnell
2023-12-06 09:52:46 +01:00
parent 28b7a41b80
commit 617c126aa8
8 changed files with 119 additions and 361 deletions
+37 -34
View File
@@ -31,6 +31,10 @@ class Profil extends Auth_Controller
$this->load->model('ressource/Betriebsmittelperson_model', 'BetriebsmittelpersonModel');
$this->load->model('person/Kontakt_model', 'KontaktModel');
//? put the uid and pid inside the controller for further usage in views
$this->uid = getAuthUID();
$this->pid = getAuthPersonID();
}
@@ -48,7 +52,7 @@ class Profil extends Auth_Controller
}
public function View($uid){
if($uid === getAuthUID()){
if($uid === $this->uid){
$this->index();
}else{
$this->load->view('Cis/Profil');
@@ -241,7 +245,7 @@ class Profil extends Auth_Controller
$intern_email = array();
$intern_email+=array("type" => "intern");
$intern_email+=array("email"=> getAuthUID() . "@" . DOMAIN);
$intern_email+=array("email"=> $this->uid . "@" . DOMAIN);
$res->emails = array($intern_email);
@@ -272,7 +276,7 @@ class Profil extends Auth_Controller
){
//? betriebsmittel are not needed in a view
$betriebsmittelperson_res = $this->BetriebsmittelpersonModel->getBetriebsmittel(getAuthPersonId());
$betriebsmittelperson_res = $this->BetriebsmittelpersonModel->getBetriebsmittel($this->pid);
if(isError($betriebsmittelperson_res)){
// error handling
}else{
@@ -288,7 +292,7 @@ class Profil extends Auth_Controller
isSuccess($this->KontaktModel->addJoin('public.tbl_firma', 'firma_id', 'LEFT'))&&
isSuccess($this->KontaktModel->addOrder('kontakttyp, kontakt, tbl_kontakt.updateamum, tbl_kontakt.insertamum'))
){
$kontakte_res = $this->KontaktModel->loadWhere(array('person_id' => getAuthPersonID()));
$kontakte_res = $this->KontaktModel->loadWhere(array('person_id' => $this->pid));
if(isError($kontakte_res)){
// handle error
}else{
@@ -298,7 +302,7 @@ class Profil extends Auth_Controller
}
//? FH Ausweis Austellungsdatum soll auch nur der user selbst sehen
$zutrittskarte_ausgegebenam = $this->BetriebsmittelpersonModel->getBetriebsmittelByUid(getAuthUID(),"Zutrittskarte");
$zutrittskarte_ausgegebenam = $this->BetriebsmittelpersonModel->getBetriebsmittelByUid($this->uid,"Zutrittskarte");
if(isError($zutrittskarte_ausgegebenam)){
// error handling
}else{
@@ -317,7 +321,7 @@ class Profil extends Auth_Controller
isSuccess($adresse_res = $this->AdresseModel->addOrder("sort"))&&
isSuccess($adresse_res = $this->AdresseModel->addJoin("tbl_adressentyp","typ=adressentyp_kurzbz"))
){
$adresse_res = $this->AdresseModel->loadWhere(array("person_id"=>getAuthPersonID()));
$adresse_res = $this->AdresseModel->loadWhere(array("person_id"=>$this->pid));
if(isError($adresse_res)){
// error handling
}else{
@@ -337,7 +341,7 @@ class Profil extends Auth_Controller
isSuccess($this->PersonModel->addJoin('tbl_benutzergruppe', 'uid')) &&
isSuccess($this->PersonModel->addJoin('tbl_gruppe', 'gruppe_kurzbz'))){
$mailverteiler_res = $this->PersonModel->loadWhere(array('mailgrp' => true, 'uid'=>getAuthUID()));
$mailverteiler_res = $this->PersonModel->loadWhere(array('mailgrp' => true, 'uid'=>$this->uid));
if( isError($mailverteiler_res)){
// catch error
}
@@ -351,7 +355,7 @@ class Profil extends Auth_Controller
if(isSuccess($this->BenutzerModel->addSelect(["foto","foto_sperre","anrede","titelpost","titelpre","vorname","nachname", "gebort", "gebdatum"]))
&& isSuccess($this->BenutzerModel->addJoin("tbl_person", "person_id"))){
$person_res = $this->BenutzerModel->load([getAuthUID()]);
$person_res = $this->BenutzerModel->load([$this->uid]);
if(isError($person_res)){
// error handling
}else{
@@ -365,7 +369,7 @@ class Profil extends Auth_Controller
isSuccess($this->BenutzerfunktionModel->addSelect(["tbl_benutzerfunktion.bezeichnung as Bezeichnung","tbl_organisationseinheit.bezeichnung as Organisationseinheit","datum_von as Gültig_von","datum_bis as Gültig_bis","wochenstunden as Wochenstunden"]))&&
isSuccess($this->BenutzerfunktionModel->addJoin("tbl_organisationseinheit","oe_kurzbz"))
){
$benutzer_funktion_res = $this->BenutzerfunktionModel->loadWhere(array('uid'=>getAuthUID()));
$benutzer_funktion_res = $this->BenutzerfunktionModel->loadWhere(array('uid'=>$this->uid));
if(isError($benutzer_funktion_res)){
// error handling
}else{
@@ -379,7 +383,7 @@ class Profil extends Auth_Controller
if(isSuccess($this->MitarbeiterModel->addSelect(["kurzbz","telefonklappe", "alias","ort_kurzbz"]))
&& isSuccess($this->MitarbeiterModel->addJoin("tbl_benutzer", "tbl_benutzer.uid = tbl_mitarbeiter.mitarbeiter_uid"))
){
$mitarbeiter_res = $this->MitarbeiterModel->load(getAuthUID());
$mitarbeiter_res = $this->MitarbeiterModel->load($this->uid);
if(isError($mitarbeiter_res)){
// error handling
}else{
@@ -390,7 +394,7 @@ class Profil extends Auth_Controller
$res = new stdClass();
$res->foto = $person_res->foto;
$res->foto_sperre = $person_res->foto_sperre;
$res->username = getAuthUID();
$res->username = $this->uid;
$res->anrede = $person_res->anrede;
$res->titel = $person_res->titelpre;
@@ -415,7 +419,7 @@ class Profil extends Auth_Controller
}
$intern_email = array();
$intern_email+=array("type" => "intern");
$intern_email+=array("email"=> getAuthUID() . "@" . DOMAIN);
$intern_email+=array("email"=> $this->uid . "@" . DOMAIN);
$extern_email=array();
$extern_email+=array("type" => "alias");
$extern_email+=array("email" => $mitarbeiter_res->alias . "@" . DOMAIN);
@@ -437,7 +441,7 @@ class Profil extends Auth_Controller
){
//? betriebsmittel are not needed in a view
$betriebsmittelperson_res = $this->BetriebsmittelpersonModel->getBetriebsmittel(getAuthPersonId());
$betriebsmittelperson_res = $this->BetriebsmittelpersonModel->getBetriebsmittel($this->pid);
if(isError($betriebsmittelperson_res)){
// error handling
}else{
@@ -453,7 +457,7 @@ class Profil extends Auth_Controller
isSuccess($this->KontaktModel->addJoin('public.tbl_firma', 'firma_id', 'LEFT'))&&
isSuccess($this->KontaktModel->addOrder('kontakttyp, kontakt, tbl_kontakt.updateamum, tbl_kontakt.insertamum'))
){
$kontakte_res = $this->KontaktModel->loadWhere(array('person_id' => getAuthPersonID()));
$kontakte_res = $this->KontaktModel->loadWhere(array('person_id' => $this->pid));
if(isError($kontakte_res)){
// handle error
}else{
@@ -463,7 +467,7 @@ class Profil extends Auth_Controller
}
//? FH Ausweis Austellungsdatum soll auch nur der user selbst sehen
$zutrittskarte_ausgegebenam = $this->BetriebsmittelpersonModel->getBetriebsmittelByUid(getAuthUID(),"Zutrittskarte");
$zutrittskarte_ausgegebenam = $this->BetriebsmittelpersonModel->getBetriebsmittelByUid($this->uid,"Zutrittskarte");
if(isError($zutrittskarte_ausgegebenam)){
// error handling
}else{
@@ -482,7 +486,7 @@ class Profil extends Auth_Controller
isSuccess($adresse_res = $this->AdresseModel->addOrder("sort"))&&
isSuccess($adresse_res = $this->AdresseModel->addJoin("tbl_adressentyp","typ=adressentyp_kurzbz"))
){
$adresse_res = $this->AdresseModel->loadWhere(array("person_id"=>getAuthPersonID()));
$adresse_res = $this->AdresseModel->loadWhere(array("person_id"=>$this->pid));
if(isError($adresse_res)){
// error handling
}else{
@@ -502,7 +506,7 @@ class Profil extends Auth_Controller
isSuccess($this->PersonModel->addJoin('tbl_benutzergruppe', 'uid')) &&
isSuccess($this->PersonModel->addJoin('tbl_gruppe', 'gruppe_kurzbz'))){
$mailverteiler_res = $this->PersonModel->loadWhere(array('mailgrp' => true, 'uid'=>getAuthUID()));
$mailverteiler_res = $this->PersonModel->loadWhere(array('mailgrp' => true, 'uid'=>$this->uid));
if( isError($mailverteiler_res)){
// catch error
}
@@ -516,7 +520,7 @@ class Profil extends Auth_Controller
if(isSuccess($this->BenutzerModel->addSelect(["foto","foto_sperre","anrede","titelpost","titelpre","vorname","nachname", "gebort", "gebdatum"]))
&& isSuccess($this->BenutzerModel->addJoin("tbl_person", "person_id"))){
$person_res = $this->BenutzerModel->load([getAuthUID()]);
$person_res = $this->BenutzerModel->load([$this->uid]);
if(isError($person_res)){
// error handling
}else{
@@ -529,7 +533,7 @@ class Profil extends Auth_Controller
isSuccess($this->BenutzergruppeModel->addSelect(['bezeichnung']))
&& isSuccess($this->BenutzergruppeModel->addJoin('tbl_gruppe', 'gruppe_kurzbz' ))
){
$zutrittsgruppe_res = $this->BenutzergruppeModel->loadWhere(array("uid"=>getAuthUID(), "zutrittssystem"=>true));
$zutrittsgruppe_res = $this->BenutzergruppeModel->loadWhere(array("uid"=>$this->uid, "zutrittssystem"=>true));
if(isError($zutrittsgruppe_res)){
// catch error
}
@@ -543,7 +547,7 @@ class Profil extends Auth_Controller
if(isSuccess($this->StudentModel->addSelect(['tbl_studiengang.bezeichnung as studiengang','tbl_student.semester', 'tbl_student.verband', 'tbl_student.gruppe' ,'tbl_student.matrikelnr as personenkennzeichen']))
&& isSuccess($this->StudentModel->addJoin('tbl_studiengang', "tbl_studiengang.studiengang_kz=tbl_student.studiengang_kz")))
{
$student_res = $this->StudentModel->load([getAuthUID()]);
$student_res = $this->StudentModel->load([$this->uid]);
if(isError($student_res)){
// catch error
}
@@ -556,7 +560,7 @@ class Profil extends Auth_Controller
//? Matrikelnummer ist die Spalte matr_nr in Person
if(isSuccess($this->BenutzerModel->addSelect(["matr_nr"]))
&& isSuccess($this->BenutzerModel->addJoin("tbl_person","person_id"))){
$matr_res = $this->BenutzerModel->load([getAuthUID()]);
$matr_res = $this->BenutzerModel->load([$this->uid]);
if(isError($matr_res)){
// catch error
}else{
@@ -570,7 +574,7 @@ class Profil extends Auth_Controller
$res->foto = $person_res->foto;
$res->foto_sperre = $person_res->foto_sperre;
$res->username = getAuthUID();
$res->username = $this->uid;
$res->anrede = $person_res->anrede;
$res->titel = $person_res->titelpre;
@@ -585,7 +589,7 @@ class Profil extends Auth_Controller
$intern_email = array();
$intern_email+=array("type" => "intern");
$intern_email+=array("email"=> getAuthUID() . "@" . DOMAIN);
$intern_email+=array("email"=> $this->uid . "@" . DOMAIN);
$res->emails = array($intern_email);
$res->adressen = $adresse_res;
@@ -608,30 +612,29 @@ class Profil extends Auth_Controller
}
public function getView(){
// property_exists(object|string $object_or_class, string $property): bool
public function getView($uid){
$payload = json_decode($this->input->raw_input_stream);
/* echo json_encode($payload);
return; */
$uid = property_exists($payload,"uid")? $payload->uid : null;
$uid = $uid != "Profil" ? $uid : null;
$isMitarbeiter = null;
if($uid)
$isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter($uid);
else
$isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter(getAuthUID());
$isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter($this->uid);
if(isError($isMitarbeiter)){
//catch error
echo "error";
return;
}
$isMitarbeiter = hasData($isMitarbeiter) ? getData($isMitarbeiter) : null;
$res = new stdClass();
if($uid == getAuthUID() || !$uid ){
if($uid == $this->uid || !$uid ){
// if the $uid is empty, then no payload was supplied and the own profile is being requested
if($isMitarbeiter ) {
$res->view= "MitarbeiterProfil";
@@ -658,14 +661,14 @@ class Profil extends Auth_Controller
echo json_encode($res);
}
public function foto_sperre_function($value){
$res = $this->PersonModel->update(getAuthPersonID(),array("foto_sperre"=>$value));
public function foto_sperre_function($value, $uid=""){
$res = $this->PersonModel->update($this->pid,array("foto_sperre"=>$value));
if(isError($res)){
// error handling
}else{
//? select the value of the column foto_sperre to return
if(isSuccess($this->PersonModel->addSelect("foto_sperre"))){
$res = $this->PersonModel->load(getAuthPersonID());
$res = $this->PersonModel->load($this->pid);
if(isError($res)){
// error handling
}
+5 -7
View File
@@ -30,18 +30,16 @@ const app = Vue.createApp({
created(){
let path = location.pathname;
console.log(path);
console.log(path.lastIndexOf('/'));
let uid = path.substring(path.lastIndexOf('/')).replace("/","");
console.log("i am passing this uid: ", uid);
const payload = {
/* const payload = {
...(uid != "Profil" ? {uid} : {})
};
Vue.$fhcapi.UserData.getView(payload).then((res)=>{
*/
Vue.$fhcapi.UserData.getView(uid).then((res)=>{
this.view = res.data.view;
this.data = res.data.data;
console.log(res.data);
});
},
template:`
+3 -3
View File
@@ -8,10 +8,10 @@ export default {
return axios.get(url);
},
getView: function(payload) {
getView: function(uid) {
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root
+ `cis.php/Cis/Profil/getView`;
return axios.post(url,payload);
+ `cis.php/Cis/Profil/getView/${uid}`;
return axios.get(url);
},
sperre_foto_function: function(value) {
@@ -1,24 +1,13 @@
import fhcapifactory from "../../../apps/api/fhcapifactory.js";
import { CoreFilterCmpt } from "../../../components/filter/Filter.js";
//? possible types of roles:
//! depending on the role of the current view, different content is being displayed and fetched
//* Student
//* Mitarbeiter
//* View_Student
//* View_Mitarbeiter
export default {
components: {
CoreFilterCmpt,
},
data() {
return {
index_information: null,
mitarbeiter_info: null,
student_info: null,
//? beinhaltet die Information ob der angefragte user ein Student oder Mitarbeiter ist
role: null,
funktionen_table_options: {
height: 300,
@@ -66,48 +55,14 @@ export default {
},
],
},
zutrittsgruppen_table_options: {
height: 300,
layout: "fitColumns",
data: [{ bezeichnung: "test1" }],
columns: [{ title: "Zutritt", field: "bezeichnung" }],
},
};
},
//? this props were passed in the Profil.php view file
//? this is the prop passed to the dynamic component with the custom data of the view
props: ["data"],
methods: {
concatenate_addresses(address_array) {
let result = "";
for (let i = 0; i < address_array.length; i++) {
result +=
address_array[i].strasse +
" " +
address_array[i].plz +
" " +
address_array[i].ort +
"\n";
}
return result;
},
render_unterelement(wert, bezeichnung) {
if (isArray(bezeichnung)) {
}
},
concatenate_kontakte(kontakt_array) {
let result = "";
for (let i = 0; i < kontakt_array.length; i++) {
result +=
kontakt_array[i].kontakttyp +
" " +
kontakt_array[i].kontakt +
" " +
kontakt_array[i].zustellung +
"\n";
}
return result;
},
sperre_foto_function(value) {
if (!this.data) {
return;
@@ -124,6 +79,7 @@ export default {
}
return "data:image/jpeg;base64," + this.data.foto;
},
//? this computed function returns all the informations for the first column in the profil
personData() {
if (!this.data) {
return {};
@@ -150,7 +106,7 @@ export default {
},
};
},
//? this computed conains all the information that is used for the second column that displays the information of the person
//? this computed function returns the data for the second column in the profil
kontaktInfo() {
if (!this.data) {
return {};
@@ -188,15 +144,28 @@ export default {
<!-- this is the left column of the window -->
<div class="col-9">
<div class="row">
<div class="col">
<img class="img-thumbnail" :src="get_image_base64_src"></img>
<div v-if="data.foto_sperre ">
<p style="margin:0">Profilfoto gesperrt</p>
<a href="#" @click.prevent="sperre_foto_function(false)" style="text-decoration:none">Sperre des Profilfotos aufheben</a>
<div class="row">
<div class="col">
<img class="img-thumbnail" :src="get_image_base64_src"></img>
</div>
<a href="#" @click.prevent="sperre_foto_function(true)" style="display:block; text-decoration:none" v-else>Profilfoto sperren</a>
</div>
<div class="row">
<div class="col">
<div v-if="data.foto_sperre ">
<p class="m-0">Profilfoto gesperrt</p>
<a href="#" @click.prevent="sperre_foto_function(false)" class="text-decoration-none">Sperre des Profilfotos aufheben</a>
</div>
<a href="#" @click.prevent="sperre_foto_function(true)" class="text-decoration-none" v-else>Profilfoto sperren</a>
</div>
</div>
</div>
<div class="col">
@@ -213,9 +182,9 @@ export default {
</div>
<div class="col">
<ol style="list-style:none">
<div style="list-style:none">
<li v-for="(wert,bezeichnung) in kontaktInfo">
<p v-for="(wert,bezeichnung) in kontaktInfo">
<!-- HIER IST DAS DATUM DES FH AUSWEIS -->
<div class="mb-3" v-if="bezeichnung=='FhAusweisStatus'">
@@ -244,8 +213,8 @@ export default {
</div>
</div>
</li>
</ol>
</p>
</div>
</div>
@@ -1,12 +1,6 @@
import fhcapifactory from "../../../apps/api/fhcapifactory.js";
import { CoreFilterCmpt } from "../../../components/filter/Filter.js";
//? possible types of roles:
//! depending on the role of the current view, different content is being displayed and fetched
//* Student
//* Mitarbeiter
//* View_Student
//* View_Mitarbeiter
export default {
components: {
@@ -14,11 +8,7 @@ export default {
},
data() {
return {
index_information: null,
mitarbeiter_info: null,
student_info: null,
//? beinhaltet die Information ob der angefragte user ein Student oder Mitarbeiter ist
role: null,
funktionen_table_options: {
height: 300,
@@ -48,66 +38,14 @@ export default {
},
],
},
betriebsmittel_table_options: {
height: 300,
layout: "fitColumns",
data: [{ betriebsmittel: "", Nummer: "", Ausgegeben_am: "" }],
columns: [
{
title: "Betriebsmittel",
field: "betriebsmittel",
headerFilter: true,
},
{ title: "Nummer", field: "Nummer", headerFilter: true },
{
title: "Ausgegeben_am",
field: "Ausgegeben_am",
headerFilter: true,
},
],
},
zutrittsgruppen_table_options: {
height: 300,
layout: "fitColumns",
data: [{ bezeichnung: "test1" }],
columns: [{ title: "Zutritt", field: "bezeichnung" }],
},
};
},
//? this props were passed in the Profil.php view file
//? this is the prop passed to the dynamic component with the custom data of the view
props: ["data"],
methods: {
concatenate_addresses(address_array) {
let result = "";
for (let i = 0; i < address_array.length; i++) {
result +=
address_array[i].strasse +
" " +
address_array[i].plz +
" " +
address_array[i].ort +
"\n";
}
return result;
},
render_unterelement(wert, bezeichnung) {
if (isArray(bezeichnung)) {
}
},
concatenate_kontakte(kontakt_array) {
let result = "";
for (let i = 0; i < kontakt_array.length; i++) {
result +=
kontakt_array[i].kontakttyp +
" " +
kontakt_array[i].kontakt +
" " +
kontakt_array[i].zustellung +
"\n";
}
return result;
},
sperre_foto_function(value) {
if (!this.data) {
return;
@@ -124,6 +62,7 @@ export default {
}
return "data:image/jpeg;base64," + this.data.foto;
},
//? this computed function returns all the informations for the first column in the profil
personData() {
if (!this.data) {
return {};
@@ -147,7 +86,7 @@ export default {
},
};
},
//? this computed conains all the information that is used for the second column that displays the information of the person
//? this computed function returns the data for the second column in the profil
kontaktInfo() {
if (!this.data) {
return {};
@@ -206,9 +145,9 @@ export default {
</div>
<div class="col">
<ol style="list-style:none">
<div style="list-style:none">
<li v-for="(wert,bezeichnung) in kontaktInfo">
<p v-for="(wert,bezeichnung) in kontaktInfo">
<!-- HIER IST DAS DATUM DES FH AUSWEIS -->
<div class="mb-3" v-if="bezeichnung=='FhAusweisStatus'">
@@ -237,8 +176,8 @@ export default {
</div>
</div>
</li>
</ol>
</p>
</div>
</div>
@@ -1,12 +1,6 @@
import fhcapifactory from "../../../apps/api/fhcapifactory.js";
import { CoreFilterCmpt } from "../../../components/filter/Filter.js";
//? possible types of roles:
//! depending on the role of the current view, different content is being displayed and fetched
//* Student
//* Mitarbeiter
//* View_Student
//* View_Mitarbeiter
export default {
components: {
@@ -14,40 +8,9 @@ export default {
},
data() {
return {
index_information: null,
mitarbeiter_info: null,
student_info: null,
//? beinhaltet die Information ob der angefragte user ein Student oder Mitarbeiter ist
role: null,
funktionen_table_options: {
height: 300,
layout: "fitColumns",
data: [
{
Bezeichnung: "",
Organisationseinheit: "",
Gültig_von: "",
Gültig_bis: "",
Wochenstunden: "",
},
],
columns: [
{ title: "Bezeichnung", field: "Bezeichnung", headerFilter: true },
{
title: "Organisationseinheit",
field: "Organisationseinheit",
headerFilter: true,
},
{ title: "Gültig_von", field: "Gültig_von", headerFilter: true },
{ title: "Gültig_bis", field: "Gültig_bis", headerFilter: true },
{
title: "Wochenstunden",
field: "Wochenstunden",
headerFilter: true,
},
],
},
betriebsmittel_table_options: {
height: 300,
layout: "fitColumns",
@@ -75,39 +38,9 @@ export default {
};
},
//? this props were passed in the Profil.php view file
//? this is the prop passed to the dynamic component with the custom data of the view
props: ["data"],
methods: {
concatenate_addresses(address_array) {
let result = "";
for (let i = 0; i < address_array.length; i++) {
result +=
address_array[i].strasse +
" " +
address_array[i].plz +
" " +
address_array[i].ort +
"\n";
}
return result;
},
render_unterelement(wert, bezeichnung) {
if (isArray(bezeichnung)) {
}
},
concatenate_kontakte(kontakt_array) {
let result = "";
for (let i = 0; i < kontakt_array.length; i++) {
result +=
kontakt_array[i].kontakttyp +
" " +
kontakt_array[i].kontakt +
" " +
kontakt_array[i].zustellung +
"\n";
}
return result;
},
sperre_foto_function(value) {
if (!this.data) {
return;
@@ -124,6 +57,7 @@ export default {
}
return "data:image/jpeg;base64," + this.data.foto;
},
//? this computed function returns all the informations for the first column in the profil
personData() {
if (!this.data) {
return {};
@@ -153,7 +87,7 @@ export default {
},
};
},
//? this computed conains all the information that is used for the second column that displays the information of the person
//? this computed function returns the data for the second column in the profil
kontaktInfo() {
if (!this.data) {
return {};
@@ -192,13 +126,20 @@ export default {
<div class="col-9">
<div class="row">
<div class="col">
<img class="img-thumbnail" :src="get_image_base64_src"></img>
<div v-if="data.foto_sperre ">
<p style="margin:0">Profilfoto gesperrt</p>
<a href="#" @click.prevent="sperre_foto_function(false)" style="text-decoration:none">Sperre des Profilfotos aufheben</a>
<div class="row">
<div class="col">
<img class="img-thumbnail" :src="get_image_base64_src"></img>
</div>
</div>
<div class="row">
<div class="col">
<div v-if="data.foto_sperre ">
<p class="m-0">Profilfoto gesperrt</p>
<a href="#" @click.prevent="sperre_foto_function(false)" class="text-decoration-none">Sperre des Profilfotos aufheben</a>
</div>
<a href="#" @click.prevent="sperre_foto_function(true)" class="text-decoration-none" v-else>Profilfoto sperren</a>
</div>
</div>
<a href="#" @click.prevent="sperre_foto_function(true)" style="display:block; text-decoration:none" v-else>Profilfoto sperren</a>
</div>
@@ -209,16 +150,16 @@ export default {
<div v-for="(wert,bezeichnung) in personData">
<div class="mb-3" v-if="typeof wert == 'object' && bezeichnung=='Adressen'"><span style="display:block" v-for="element in wert">{{element.strasse}} <b>({{element.adr_typ}})</b><br/>{{ element.plz}} {{element.ort}}</span></div>
<div class="mb-3" v-if="typeof wert == 'object' && bezeichnung=='Adressen'"><p style="display:block" v-for="element in wert">{{element.strasse}} <b>({{element.adr_typ}})</b><br/>{{ element.plz}} {{element.ort}}</p></div>
<div v-else class="mb-3" ><span style="display:block;" v-for="(val,bez) in wert">{{bez}}: {{val}}</span></div>
</div>
</div>
<div class="col">
<ol style="list-style:none">
<div >
<li v-for="(wert,bezeichnung) in kontaktInfo">
<p v-for="(wert,bezeichnung) in kontaktInfo">
<!-- HIER IST DAS DATUM DES FH AUSWEIS -->
<div class="mb-3" v-if="bezeichnung=='FhAusweisStatus'">
@@ -247,8 +188,8 @@ export default {
</div>
</div>
</li>
</ol>
</p>
</div>
</div>
@@ -1,113 +1,20 @@
import fhcapifactory from "../../../apps/api/fhcapifactory.js";
import { CoreFilterCmpt } from "../../../components/filter/Filter.js";
//? possible types of roles:
//! depending on the role of the current view, different content is being displayed and fetched
//* Student
//* Mitarbeiter
//* View_Student
//* View_Mitarbeiter
export default {
components: {
CoreFilterCmpt,
},
data() {
return {
index_information: null,
mitarbeiter_info: null,
student_info: null,
//? beinhaltet die Information ob der angefragte user ein Student oder Mitarbeiter ist
role: null,
funktionen_table_options: {
height: 300,
layout: "fitColumns",
data: [
{
Bezeichnung: "",
Organisationseinheit: "",
Gültig_von: "",
Gültig_bis: "",
Wochenstunden: "",
},
],
columns: [
{ title: "Bezeichnung", field: "Bezeichnung", headerFilter: true },
{
title: "Organisationseinheit",
field: "Organisationseinheit",
headerFilter: true,
},
{ title: "Gültig_von", field: "Gültig_von", headerFilter: true },
{ title: "Gültig_bis", field: "Gültig_bis", headerFilter: true },
{
title: "Wochenstunden",
field: "Wochenstunden",
headerFilter: true,
},
],
},
betriebsmittel_table_options: {
height: 300,
layout: "fitColumns",
data: [{ betriebsmittel: "", Nummer: "", Ausgegeben_am: "" }],
columns: [
{
title: "Betriebsmittel",
field: "betriebsmittel",
headerFilter: true,
},
{ title: "Nummer", field: "Nummer", headerFilter: true },
{
title: "Ausgegeben_am",
field: "Ausgegeben_am",
headerFilter: true,
},
],
},
zutrittsgruppen_table_options: {
height: 300,
layout: "fitColumns",
data: [{ bezeichnung: "test1" }],
columns: [{ title: "Zutritt", field: "bezeichnung" }],
},
};
},
//? this props were passed in the Profil.php view file
//? this is the prop passed to the dynamic component with the custom data of the view
props: ["data"],
methods: {
concatenate_addresses(address_array) {
let result = "";
for (let i = 0; i < address_array.length; i++) {
result +=
address_array[i].strasse +
" " +
address_array[i].plz +
" " +
address_array[i].ort +
"\n";
}
return result;
},
render_unterelement(wert, bezeichnung) {
if (isArray(bezeichnung)) {
}
},
concatenate_kontakte(kontakt_array) {
let result = "";
for (let i = 0; i < kontakt_array.length; i++) {
result +=
kontakt_array[i].kontakttyp +
" " +
kontakt_array[i].kontakt +
" " +
kontakt_array[i].zustellung +
"\n";
}
return result;
},
sperre_foto_function(value) {
if (!this.data) {
return;
@@ -124,6 +31,7 @@ export default {
}
return "data:image/jpeg;base64," + this.data.foto;
},
//? this computed function returns all the informations for the first column in the profil
personData() {
if (!this.data) {
return {};
@@ -150,7 +58,7 @@ export default {
},
};
},
//? this computed conains all the information that is used for the second column that displays the information of the person
//? this computed function returns the data for the second column in the profil
kontaktInfo() {
if (!this.data) {
return {};
@@ -199,9 +107,9 @@ export default {
</div>
<div class="col">
<ol style="list-style:none">
<div style="list-style:none">
<li v-for="(wert,bezeichnung) in kontaktInfo">
<p v-for="(wert,bezeichnung) in kontaktInfo">
<!-- HIER SIND DIE EMAILS -->
<div class="mb-3" v-if="typeof wert === 'object' && bezeichnung == 'emails'">
<p class="mb-0"><b>eMail</b></p>
@@ -210,8 +118,8 @@ export default {
</li>
</ol>
</p>
</div>
</div>