diff --git a/application/controllers/Cis/Profil.php b/application/controllers/Cis/Profil.php index a45edcab2..ef15d830c 100644 --- a/application/controllers/Cis/Profil.php +++ b/application/controllers/Cis/Profil.php @@ -18,6 +18,9 @@ class Profil extends Auth_Controller 'index' => ['student/anrechnung_beantragen:r','user:r'], // TODO(chris): permissions? 'isMitarbeiterOrStudent' => ['student/anrechnung_beantragen:r','user:r'], 'getMitarbeiterAnsicht' => ['student/anrechnung_beantragen:r','user:r'], + 'foto_sperre_function' => ['student/anrechnung_beantragen:r','user:r'], + + ]); $this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel'); @@ -52,8 +55,32 @@ class Profil extends Auth_Controller public function getMitarbeiterAnsicht(){ + if( + isSuccess($this->PersonModel->addSelect('gruppe_kurzbz, beschreibung'))&& + isSuccess($this->PersonModel->addJoin('tbl_benutzer', 'person_id')) && + 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())); + if( isError($mailverteiler_res)){ + // catch error + } + $mailverteiler_res = hasData($mailverteiler_res)? getData($mailverteiler_res) : null; + } + + if(isSuccess($this->KontaktModel->addSelect('DISTINCT ON (kontakttyp) kontakttyp, kontakt, tbl_kontakt.anmerkung, tbl_kontakt.zustellung')) && + isSuccess($this->KontaktModel->addJoin('public.tbl_standort', 'standort_id', 'LEFT')) && + 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())); + if(isError($kontakte_res)){ + // handle error + }else{ + $kontakte_res = hasData($kontakte_res)? getData($kontakte_res) : null; + } + + } $zutrittskarte_ausgegebenam = $this->BetriebsmittelpersonModel->getBetriebsmittel(getAuthPersonId()); if(isError($zutrittskarte_ausgegebenam)){ @@ -64,6 +91,7 @@ class Profil extends Auth_Controller if( isSuccess($this->BetriebsmittelpersonModel->addSelect(["betriebsmitteltyp", "beschreibung","nummer","ausgegebenam"])) + ){ $betriebsmittelperson_res = $this->BetriebsmittelpersonModel->getBetriebsmittel(getAuthPersonId()); if(isError($betriebsmittelperson_res)){ @@ -74,10 +102,11 @@ class Profil extends Auth_Controller } if( - isSuccess($this->BenutzerfunktionModel->addSelect(["tbl_benutzerfunktion.bezeichnung as bf_bezeichnung","tbl_organisationseinheit.bezeichnung as oe_bezeichnung","datum_von","datum_bis","wochenstunden"])) - && isSuccess($this->BenutzerfunktionModel->addJoin("tbl_organisationseinheit","oe_kurzbz")) + //! Summe der Wochenstunden wird jetzt in der hr/tbl_dienstverhaeltnis gespeichert + isSuccess($this->BenutzerfunktionModel->addSelect(["tbl_benutzerfunktion.bezeichnung as bf_bezeichnung","tbl_organisationseinheit.bezeichnung as oe_bezeichnung","datum_von","datum_bis","wochenstunden"]))&& + isSuccess($this->BenutzerfunktionModel->addJoin("tbl_organisationseinheit","oe_kurzbz")) ){ - $benutzer_funktion_res = $this->BenutzerfunktionModel->loadWhere("uid='" . getAuthUID() . "'"); + $benutzer_funktion_res = $this->BenutzerfunktionModel->loadWhere(array('uid'=>getAuthUID())); if(isError($benutzer_funktion_res)){ // error handling }else{ @@ -85,12 +114,19 @@ class Profil extends Auth_Controller } } - //! THERE COULD BE MULTIPLE ADRESSES - $adresse_res = $this->AdresseModel->load(getAuthPersonId()); - if(isError($adresse_res)){ - // error handling - }else{ //! not only one - $adresse_res = hasData($adresse_res)? getData($adresse_res)[0] : null; + + if( + isSuccess($adresse_res = $this->AdresseModel->addSelect(array("strasse","tbl_adressentyp.bezeichnung as adr_typ","plz","ort")))&& + isSuccess($adresse_res = $this->AdresseModel->addOrder("zustelladresse","DESC"))&& + 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())); + if(isError($adresse_res)){ + // error handling + }else{ + $adresse_res = hasData($adresse_res)? getData($adresse_res) : null; + } } $benutzer_res = $this->BenutzerModel->load([getAuthUID()]); @@ -134,26 +170,20 @@ class Profil extends Auth_Controller $res->email_intern = getAuthUID() . DOMAIN; $res->email_extern = $benutzer_res->alias . DOMAIN; //? Adresse Info - $res->strasse = $adresse_res->strasse; - $res->heimatadresse = $adresse_res->heimatadresse; - $res->zustelladresse = $adresse_res->zustelladresse; - $res->plz = $adresse_res->plz; - $res->ort = $adresse_res->ort; + $res->adressen = $adresse_res; //? Benutzerfunktion Info $res->funktionen = $benutzer_funktion_res; //? Betriebsmittel Info $res->mittel = $betriebsmittelperson_res; + //? Austellungsdatum von der Zutrittskarte $res->zutrittskarte_ausgegebenam = $zutrittskarte_ausgegebenam->ausgegebenam; - $res->kontakt = $kontakte; - - + //? Kontakt Info + $res->kontakte = $kontakte_res; + //? Mailverteiler Info + $res->mailverteiler = $mailverteiler_res; echo json_encode($res); - return; - - - } //? check wheter the parameter uid is a Mitarbeiter or a Student @@ -170,6 +200,27 @@ class Profil extends Auth_Controller } + public function foto_sperre_function($value){ + $res = $this->PersonModel->update(getAuthPersonID(),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()); + if(isError($res)){ + // error handling + } + $res = hasData($res) ? getData($res)[0] : null; + } + + } + echo json_encode($res); + } + + + + diff --git a/application/views/Cis/Profil.php b/application/views/Cis/Profil.php index 7be2cc0cc..4feb98ec4 100644 --- a/application/views/Cis/Profil.php +++ b/application/views/Cis/Profil.php @@ -9,7 +9,8 @@ $this->load->view('templates/CISHTML-Header', $includesArray); ?>
-

Profil22

+

Profil

+

diff --git a/public/js/apps/api/userdata.js b/public/js/apps/api/userdata.js index 2c72e9618..cd701a2d1 100644 --- a/public/js/apps/api/userdata.js +++ b/public/js/apps/api/userdata.js @@ -15,6 +15,11 @@ export default { + `cis.php/Cis/Profil/getMitarbeiterAnsicht`; return axios.get(url); }, + sperre_foto_function: function(value) { + const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + + `cis.php/Cis/Profil/foto_sperre_function/${value}`; + return axios.get(url); + }, }; \ No newline at end of file diff --git a/public/js/components/Cis/Profil/Profil.js b/public/js/components/Cis/Profil/Profil.js index a4c7a91dd..3b1ca8e03 100644 --- a/public/js/components/Cis/Profil/Profil.js +++ b/public/js/components/Cis/Profil/Profil.js @@ -1,6 +1,6 @@ import fhcapifactory from "../../../apps/api/fhcapifactory.js"; - +//"" export default { @@ -15,14 +15,69 @@ export default { //? this props were passed in the Profil.php view file props:['uid','pid'], 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){ + fhcapifactory.UserData.sperre_foto_function(value).then(res => { + console.log(res.data); + if(res.data){ + + this.person_info.foto_sperre = res.data.foto_sperre; + } + }); + + }, }, computed:{ - computed_placeholder(){ - return { - // + + get_image_base64_src(){ + return "data:image/jpeg;base64,"+this.person_info.foto; + }, + first_col(){ + //! postnomen is still missing + return { + Username:this.uid, + Anrede:this.person_info.anrede, + Titel:(this.person_info.titelpre&&this.person_info.titelpost)?this.person_info.titelpre.concat(this.person_info.titelpost):"null", + Vorname:this.person_info.vorname, + Nachname:this.person_info.nachname, + Postnomen:null, + Geburtsdatum:this.person_info.gebdatum, + Geburtsort: this.person_info.gebort, + Adresse: this.person_info.adressen, + Kurzzeichen: this.person_info.kurzbz, + Telefon: this.person_info.telefonklappe, }; }, + second_col(){ + //! postnomen is still missing + return { + Intern:this.person_info.email_intern, + Alias:this.person_info.email_extern, + Kontakte:this.person_info.kontakte, + }; + }, + + + }, created(){ @@ -33,24 +88,55 @@ export default { }, template: ` -
-

test

-

{{"here is the uid "+uid}}

-

{{"here is the pid "+pid}}

- + +

{{wert + ": " + bezeichnung}}

+

{{JSON.stringify(first_col)}}

+

{{"here is the uid "+uid}}

+

{{"here is the pid "+pid}}

+
+
+
+ +
+

Profilfoto gesperrt

+ Sperre des Profilfotos aufheben +
+ Profilfoto sperren -

test

+
+
+ + +
    +
  1. + +

    {{element.strasse +" "+element.adr_typ+" " + element.plz+" "+element.ort}}

    + +

    {{bezeichnung +": " +wert}}

    +
  2. +
+
+
+
    + +
  1. + +

    + {{element.kontakttyp + " " + element.kontakt+" " }} + + + +

    + +

    {{bezeichnung +": "+wert}}

    + +
  2. +
+ + +
+
`, }; \ No newline at end of file