From 02e7ef12dec6b7845fe7ebbf8c9d73ba6e00b580 Mon Sep 17 00:00:00 2001 From: Simon Gschnell Date: Wed, 6 Dec 2023 13:47:35 +0100 Subject: [PATCH] Profil information layout --- application/controllers/Cis/Profil.php | 28 +++++++-- public/js/apps/Cis/Profil.js | 21 ++++--- .../Cis/Profil/MitarbeiterProfil.js | 61 +++++++++++-------- .../Cis/Profil/MitarbeiterViewProfil.js | 6 +- 4 files changed, 73 insertions(+), 43 deletions(-) diff --git a/application/controllers/Cis/Profil.php b/application/controllers/Cis/Profil.php index de6f115da..9dfbc741d 100644 --- a/application/controllers/Cis/Profil.php +++ b/application/controllers/Cis/Profil.php @@ -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 diff --git a/public/js/apps/Cis/Profil.js b/public/js/apps/Cis/Profil.js index c48d7ef23..a6f811478 100644 --- a/public/js/apps/Cis/Profil.js +++ b/public/js/apps/Cis/Profil.js @@ -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:`
- - +
+

Es wurden keine oder mehrere Profile für {{this.notFoundUID}} gefunden

+
+
` diff --git a/public/js/components/Cis/Profil/MitarbeiterProfil.js b/public/js/components/Cis/Profil/MitarbeiterProfil.js index 765893f8f..12f7cb88e 100644 --- a/public/js/components/Cis/Profil/MitarbeiterProfil.js +++ b/public/js/components/Cis/Profil/MitarbeiterProfil.js @@ -40,7 +40,7 @@ export default { betriebsmittel_table_options: { height: 300, layout: "fitColumns", - data: [{ betriebsmittel: "", Nummer: "", Ausgegeben_am: "" }], + data: [{ betriebsmittel: "test", 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: ` -
@@ -147,9 +144,10 @@ export default { -
+
+

Mitarbeiter

@@ -168,52 +166,65 @@ export default { -
+
-

Mitarbeiter

-
+ -
{{element.strasse}} ({{element.adr_typ}})
{{ element.plz}} {{element.ort}}
-
{{bez}}: {{val}}
+
+
+ +
+
Adressen
+
+ {{element.strasse}} ({{element.adr_typ}})
{{ element.plz}} {{element.ort}} +
+
+ +
+
{{bez}}
+
{{wert?wert:"-"}}
+
-
+
-
-
-
-

+ + +

+ +
-

FH-Ausweis Status

-

{{"Der FH Ausweis ist am "+ wert+ " ausgegeben worden."}}

+
FH-Ausweis Status
+
{{"Der FH Ausweis ist am "+ wert+ " ausgegeben worden."}}
-

eMail

-

{{email.type}}: {{email.email}}

+
eMail
+
{{email.type}}: {{email.email}}
-

Private Kontakte

-
+
Private Kontakte
+
{{element.kontakttyp + ": " + element.kontakt+" " }}
{{element?.anmerkung}}
-
+
-

+
+
diff --git a/public/js/components/Cis/Profil/MitarbeiterViewProfil.js b/public/js/components/Cis/Profil/MitarbeiterViewProfil.js index d7da24779..b35942fea 100644 --- a/public/js/components/Cis/Profil/MitarbeiterViewProfil.js +++ b/public/js/components/Cis/Profil/MitarbeiterViewProfil.js @@ -123,11 +123,7 @@ export default {
-
-

Profilfoto gesperrt

- Sperre des Profilfotos aufheben -
- Profilfoto sperren +