Profil information layout

This commit is contained in:
Simon Gschnell
2023-12-06 13:47:35 +01:00
parent 617c126aa8
commit 02e7ef12de
4 changed files with 73 additions and 43 deletions
+24 -4
View File
@@ -618,20 +618,31 @@ class Profil extends Auth_Controller
$uid = $uid != "Profil" ? $uid : null;
$isMitarbeiter = null;
if($uid)
if($uid){
if(isSuccess($this->PersonModel->addSelect(["person_id"]))){
$pid = $this->PersonModel->getByUid($uid);
$pid = hasData($pid) ? getData($pid)[0] : null;
}
if(!$pid){
return null;
}
$isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter($uid);
}
else
$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 == $this->uid || !$uid ){
@@ -639,10 +650,12 @@ class Profil extends Auth_Controller
if($isMitarbeiter ) {
$res->view= "MitarbeiterProfil";
$res->data = $this->mitarbeiterProfil();
$res->data->pid = $this->pid;
}
else {
$res->view= "StudentProfil";
$res->data = $this->studentProfil();
$res->data->pid = $this->pid;
}
}
elseif($uid){
@@ -650,10 +663,12 @@ class Profil extends Auth_Controller
if($isMitarbeiter ){
$res->view= "ViewMitarbeiterProfil";
$res->data= $this->viewMitarbeiterProfil($uid);
}
else {
$res->view= "ViewStudentProfil";
$res->data= $this->viewStudentProfil($uid);
}
}
@@ -661,9 +676,14 @@ class Profil extends Auth_Controller
echo json_encode($res);
}
public function foto_sperre_function($value, $uid=""){
public function foto_sperre_function($value){
//? Nur der Index User hat die Erlaubniss das Profilbild zu sperren
$res = $this->PersonModel->update($this->pid,array("foto_sperre"=>$value));
if(isError($res)){
echo json_encode("error encountered when updating foto_sperre");
return;
// error handling
}else{
//? select the value of the column foto_sperre to return
+12 -9
View File
@@ -21,6 +21,8 @@ const app = Vue.createApp({
return {
view:null,
data:null,
// notfound is null by default, but contains an UID if no user exists with that UID
notFoundUID:null,
}
},
@@ -32,21 +34,22 @@ const app = Vue.createApp({
let path = location.pathname;
let uid = path.substring(path.lastIndexOf('/')).replace("/","");
/* const payload = {
...(uid != "Profil" ? {uid} : {})
};
*/
Vue.$fhcapi.UserData.getView(uid).then((res)=>{
this.view = res.data.view;
this.data = res.data.data;
if(!res.data){
this.notFoundUID=uid;
}
this.view = res.data?.view;
this.data = res.data?.data;
});
},
template:`
<div>
<component :is="view" :data="data" ></component>
<div v-if="notFoundUID">
<h3>Es wurden keine oder mehrere Profile für {{this.notFoundUID}} gefunden</h3>
</div>
<component v-else :is="view" :data="data" ></component>
</div>`
@@ -40,7 +40,7 @@ export default {
betriebsmittel_table_options: {
height: 300,
layout: "fitColumns",
data: [{ betriebsmittel: "", Nummer: "", Ausgegeben_am: "" }],
data: [{ betriebsmittel: "<a href='#'>test</a>", Nummer: "", Ausgegeben_am: "" }],
columns: [
{
title: "Betriebsmittel",
@@ -93,8 +93,6 @@ export default {
Vorname: this.data.vorname,
Nachname: this.data.nachname,
Postnomen: this.data.postnomen,
},
GeburtsDaten: {
Geburtsdatum: this.data.gebdatum,
Geburtsort: this.data.gebort,
},
@@ -121,7 +119,7 @@ export default {
},
mounted() {
this.$refs.betriebsmittelTable.tabulator.on('tableBuilt', () => {
this.$refs.betriebsmittelTable.tabulator.on('tableBuilt', () => {
this.$refs.betriebsmittelTable.tabulator.setData(this.data.mittel);
@@ -132,12 +130,11 @@ export default {
this.$refs.funktionenTable.tabulator.setData(this.data.funktionen);
})
},
template: `
<div class="container-fluid">
<!-- here starts the row of the whole window -->
<div class="row">
@@ -147,9 +144,10 @@ export default {
<div class="col">
<div class="col-2">
<div class="row">
<div class="col">
<h3 >Mitarbeiter</h3>
<img class="img-thumbnail" :src="get_image_base64_src"></img>
</div>
</div>
@@ -168,52 +166,65 @@ export default {
<div class="col">
<div class="col m-4">
<h3 >Mitarbeiter</h3>
<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 v-else class="mb-3" ><span style="display:block;" v-for="(val,bez) in wert">{{bez}}: {{val}}</span></div>
<div class="row">
<div :class="{'col-lg-12':true, 'col-xl-6':true, 'order-1':bezeichnung=='Allgemein', 'order-3':bezeichnung=='SpecialInformation', 'order-4':bezeichnung=='Adressen'}" v-for="(wert,bezeichnung) in personData">
<dl class="m-0" v-if="bezeichnung=='Adressen'">
<dt>Adressen</dt>
<dd class="text-end m-0" v-for="element in wert">
{{element.strasse}} <b>({{element.adr_typ}})</b><br/>{{ element.plz}} {{element.ort}}
</dd>
</dl>
<dl class="m-0" v-else v-for="(wert,bez) in wert">
<dt >{{bez}}</dt>
<dd class="text-end m-0">{{wert?wert:"-"}}</dd>
</dl>
</div>
</div>
</div>
<div class="col">
<div style="list-style:none">
<p v-for="(wert,bezeichnung) in kontaktInfo">
<div class="col-lg-12 col-xl-6 order-2">
<dl v-for="(wert,bezeichnung) in kontaktInfo">
<!-- HIER IST DAS DATUM DES FH AUSWEIS -->
<div class="mb-3" v-if="bezeichnung=='FhAusweisStatus'">
<p class="mb-0"><b>FH-Ausweis Status</b></p>
<p class="mb-0">{{"Der FH Ausweis ist am "+ wert+ " ausgegeben worden."}}</p>
<dt class="mb-0">FH-Ausweis Status</dt>
<dd class="mb-0 text-end">{{"Der FH Ausweis ist am "+ wert+ " ausgegeben worden."}}</dd>
</div>
<!-- HIER SIND DIE EMAILS -->
<div class="mb-3" v-if="typeof wert === 'object' && bezeichnung == 'emails'">
<p class="mb-0"><b>eMail</b></p>
<p v-for="email in wert" class="mb-0">{{email.type}}: <a style="text-decoration:none" :href="'mailto:'+email.email">{{email.email}}</a></p>
<dt class="mb-0">eMail</dt>
<dd v-for="email in wert" class="mb-0 text-end">{{email.type}}: <a style="text-decoration:none" :href="'mailto:'+email.email">{{email.email}}</a></dd>
</div>
<!-- HIER SIND DIE PRIVATEN KONTAKTE -->
<div class="mb-3" v-if="typeof wert === 'object' && bezeichnung=='Kontakte'">
<p class="mb-0"><b>Private Kontakte</b></p>
<div class="row" v-for="element in wert" >
<dt class="mb-0">Private Kontakte</dt>
<dd class="row text-end" v-for="element in wert" >
<div class="col-8">{{element.kontakttyp + ": " + element.kontakt+" " }}</div>
<div class="col-2"> {{element?.anmerkung}}</div>
<div class="col-2">
<i v-if="element.zustellung" class="fa-solid fa-check"></i>
<i v-else="element.zustellung" class="fa-solid fa-xmark"></i>
</div>
</div>
</dd>
</div>
</p>
</dl>
</div>
</div>
@@ -123,11 +123,7 @@ export default {
<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>
<a href="#" @click.prevent="sperre_foto_function(true)" style="display:block; text-decoration:none" v-else>Profilfoto sperren</a>
</div>