diff --git a/application/controllers/Cis/Profil.php b/application/controllers/Cis/Profil.php
index 3782dfbe2..8a731e085 100644
--- a/application/controllers/Cis/Profil.php
+++ b/application/controllers/Cis/Profil.php
@@ -24,6 +24,9 @@ class Profil extends Auth_Controller
'indexProfilInformaion' => ['student/anrechnung_beantragen:r','user:r'],
'mitarbeiterProfil' => ['student/anrechnung_beantragen:r','user:r'],
'studentProfil' => ['student/anrechnung_beantragen:r','user:r'],
+ 'getView' => ['student/anrechnung_beantragen:r','user:r'],
+
+
@@ -52,29 +55,32 @@ class Profil extends Auth_Controller
*/
- public function index()
+ public function index($test=null)
{
//? we can pass data to the view by using the second parameter of the load->view() function
//* the first parameter is the route that Code Igniter will switch to
//* the second parameter can be used to pass data to the view
- $this->load->view('Cis/Profil', ["uid" => getAuthUID(),"pid" => getAuthPersonId(), "view"=> false]);
+ $this->load->view('Cis/Profil');
}
//? attempt at rerouting methods
/* public function _remap($method, $params = array())
+
{
- if($method ==='View' || $method === 'Mitarbeiter'){
+ echo json_encode($params);
+
- return call_user_func_array(array($this, "searchView"), $params);
+ echo json_encode($method);
+ return;
- }else{
+ }else{
if (method_exists($this, $method))
{
return call_user_func_array(array($this, $method), $params);
}
- }
+ }
} */
public function View($uid){
@@ -82,29 +88,153 @@ class Profil extends Auth_Controller
if($uid === getAuthUID()){
$this->index();
}else{
- $this->load->view('Cis/Profil', ["uid" => $uid,"view"=>true]);
+ $this->load->view('Cis/Profil');
}
}
-
- public function studentProfil($uid, $view=false){
+ private function viewMitarbeiterProfil($uid){
+
+
if(
- !$view &&
- isSuccess($this->BenutzergruppeModel->addSelect(['bezeichnung']))
- && isSuccess($this->BenutzergruppeModel->addJoin('tbl_gruppe', 'gruppe_kurzbz' ))
- ){
- $zutrittsgruppe_res = $this->BenutzergruppeModel->loadWhere(array("uid"=>$uid, "zutrittssystem"=>true));
- if(isError($zutrittsgruppe_res)){
+ 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'=>$uid));
+ if( isError($mailverteiler_res)){
// catch error
}
- $zutrittsgruppe_res = hasData($zutrittsgruppe_res) ? getData($zutrittsgruppe_res) : null;
+ $mailverteiler_res = hasData($mailverteiler_res)? getData($mailverteiler_res) : null;
+ $mailverteiler_res = array_map(function($element) { $element->mailto="mailto:".$element->gruppe_kurzbz."@".DOMAIN; return $element;},$mailverteiler_res);
}
+
+
+ if(
+ //! Summe der Wochenstunden wird jetzt in der hr/tbl_dienstverhaeltnis gespeichert
+ 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'=>$uid));
+ if(isError($benutzer_funktion_res)){
+ // error handling
+ }else{
+ $benutzer_funktion_res = hasData($benutzer_funktion_res)? getData($benutzer_funktion_res) : null;
+ }
+ }
+
+ if(isSuccess($this->BenutzerModel->addSelect(["alias"]))){
+ $benutzer_res = $this->BenutzerModel->load([$uid]);
+ if(isError($benutzer_res)){
+ // error handling
+ }else{
+ $benutzer_res = hasData($benutzer_res)? getData($benutzer_res)[0] : null;
+ }
+ }
+
+ if(isSuccess($this->BenutzerModel->addSelect(["foto","foto_sperre","anrede","titelpost","titelpre","vorname","nachname"]))
+ && isSuccess($this->BenutzerModel->addJoin("tbl_person", "person_id"))){
+
+ $person_res = $this->BenutzerModel->load([$uid]);
+ if(isError($person_res)){
+ // error handling
+ }else{
+ $person_res = hasData($person_res)? getData($person_res)[0] : null;
+ }
+ }
+ $mitarbeiter_res = $this->MitarbeiterModel->load($uid);
+ if(isError($mitarbeiter_res)){
+ // error handling
+ }else{
+ $mitarbeiter_res = hasData($mitarbeiter_res)? getData($mitarbeiter_res)[0] : null;
+ }
+
+
+ $res = new stdClass();
+ $res->username = $uid;
+
+
+ //? Person Info
+ $res->foto = $person_res->foto;
+ $res->foto_sperre = $person_res->foto_sperre;
+
+ $res->anrede = $person_res->anrede;
+ $res->titelpre = $person_res->titelpre;
+ $res->titelpost = $person_res->titelpost;
+ $res->vorname = $person_res->vorname;
+ $res->nachname = $person_res->nachname;
+
+
+ $res->gebdatum = $person_res->gebdatum;
+ $res->gebort = $person_res->gebort;
+ //? Mitarbeiter Info
+ $res->kurzbz = $mitarbeiter_res->kurzbz;
+ $res->telefonklappe = $mitarbeiter_res->telefonklappe;
+ //? Email Info
+ $intern_email = array();
+ $intern_email+=array("type" => "intern");
+ $intern_email+=array("email"=> $uid . "@" . DOMAIN);
+ $extern_email=array();
+ $extern_email+=array("type" => "alias");
+ $extern_email+=array("email" => $benutzer_res->alias . "@" . DOMAIN);
+ $res->emails = array($intern_email,$extern_email);
+ //? Adresse Info
+ $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;
+ //? Kontakt Info
+ $res->kontakte = $kontakte_res;
+ //? Mailverteiler Info
+ $res->mailverteiler = $mailverteiler_res;
+
+ echo json_encode($res);
+
+ }
+
+
+
+ private function viewStudentProfil($uid){
+
+
+
+ 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'=>$uid));
+ if( isError($mailverteiler_res)){
+ // catch error
+ }
+ $mailverteiler_res = hasData($mailverteiler_res)? getData($mailverteiler_res) : null;
+
+ $mailverteiler_res = array_map(function($element) { $element->mailto="mailto:".$element->gruppe_kurzbz."@".DOMAIN; return $element;},$mailverteiler_res);
+ }
+
+
+
+ if(isSuccess($this->BenutzerModel->addSelect(["foto","foto_sperre","anrede","titelpost","titelpre","vorname","nachname"]))
+ && isSuccess($this->BenutzerModel->addJoin("tbl_person", "person_id"))){
+
+ $person_res = $this->BenutzerModel->load([$uid]);
+ if(isError($person_res)){
+ // error handling
+ }else{
+ $person_res = hasData($person_res)? getData($person_res)[0] : null;
+ }
+ }
+
//? personenkennzeichen ist die Spalte Matrikelnr in der Tabelle Student
if(isSuccess($this->StudentModel->addSelect(['tbl_studiengang.bezeichnung as studiengang','tbl_student.semester', 'tbl_student.verband', 'tbl_student.gruppe' ,'tbl_student.matrikelnr as personenkennzeichen']))
@@ -123,78 +253,448 @@ 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"))){
- $person_res = $this->BenutzerModel->load([$uid]);
- if(isError($person_res)){
+ $matr_res = $this->BenutzerModel->load([$uid]);
+ if(isError($matr_res)){
// catch error
}else{
- $person_res = hasData($person_res)? getData($person_res)[0] : [];
+ $matr_res = hasData($matr_res)? getData($matr_res)[0] : [];
}
}
$res = new stdClass();
- $res->matrikelnummer = $person_res->matr_nr;
+
+
+ $res->foto = $person_res->foto;
+ $res->username = $uid;
+
+ $res->anrede = $person_res->anrede;
+ $res->titel = $person_res->titelpre;
+ $res->vorname = $person_res->vorname;
+ $res->nachname = $person_res->nachname;
+
+
+ $res->postnomen = $person_res->titelpost;
+
+ $res->internal_email= $uid . "@" . DOMAIN;
+
+
+
+
+ $res->matrikelnummer = $matr_res->matr_nr;
foreach($student_res as $key => $value){
$res->$key = $value;
}
- if(!$view){
- $res->zuttritsgruppen = $zutrittsgruppe_res;
+
+
+
+ $res->mailverteiler = $mailverteiler_res;
+
+ return $res;
+
+
+ }
+
+ private function mitarbeiterProfil(){
+ //? informationen die nur für den Mitarbeiter verfügbar sind
+ //? Data for the Mitarbeiter view
+
+ //? betriebsmittel soll nur der user selber sehen
+ if(
+
+ isSuccess($this->BetriebsmittelpersonModel->addSelect(["CONCAT(betriebsmitteltyp, ' ' ,beschreibung) as Betriebsmittel","nummer as Nummer","ausgegebenam as Ausgegeben_am"]))
+
+ ){
+ //? betriebsmittel are not needed in a view
+ $betriebsmittelperson_res = $this->BetriebsmittelpersonModel->getBetriebsmittel(getAuthPersonId());
+ if(isError($betriebsmittelperson_res)){
+ // error handling
+ }else{
+ $betriebsmittelperson_res = hasData($betriebsmittelperson_res)? getData($betriebsmittelperson_res) : null;
+ }
+ }
+
+ if(
+
+ //? kontaktdaten soll auch nur der user selbst sehen
+ 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;
+ }
+
+ }
+
+ //? FH Ausweis Austellungsdatum soll auch nur der user selbst sehen
+ $zutrittskarte_ausgegebenam = $this->BetriebsmittelpersonModel->getBetriebsmittelByUid(getAuthUID(),"Zutrittskarte");
+ if(isError($zutrittskarte_ausgegebenam)){
+ // error handling
+ }else{
+ $zutrittskarte_ausgegebenam = hasData($zutrittskarte_ausgegebenam)? getData($zutrittskarte_ausgegebenam)[0]->ausgegebenam : null;
+ //? formats the date from 01-01-2000 to 01.01.2000
+ $zutrittskarte_ausgegebenam = str_replace("-",".",$zutrittskarte_ausgegebenam);
+ }
+
+
+ //? Die Adressen soll auch nur der user selber sehen
+
+ 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;
+ }
+ }
+
+ //? die folgenden Informationen darf nur der eigene user sehen
+
+
+
+
+
+ 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;
+
+ $mailverteiler_res = array_map(function($element) { $element->mailto="mailto:".$element->gruppe_kurzbz."@".DOMAIN; return $element;},$mailverteiler_res);
+ }
+
+
+
+ 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()]);
+ if(isError($person_res)){
+ // error handling
+ }else{
+ $person_res = hasData($person_res)? getData($person_res)[0] : null;
+ }
+ }
+
+
+ if(
+ //! Summe der Wochenstunden wird jetzt in der hr/tbl_dienstverhaeltnis gespeichert
+ 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()));
+ if(isError($benutzer_funktion_res)){
+ // error handling
+ }else{
+ $benutzer_funktion_res = hasData($benutzer_funktion_res)? getData($benutzer_funktion_res) : null;
+ }
+ }
+
+
+
+
+ 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());
+ if(isError($mitarbeiter_res)){
+ // error handling
+ }else{
+ $mitarbeiter_res = hasData($mitarbeiter_res)? getData($mitarbeiter_res)[0] : null;
+ }
+ }
+
+ $res = new stdClass();
+ $res->foto = $person_res->foto;
+ $res->foto_sperre = $person_res->foto_sperre;
+ $res->username = getAuthUID();
+
+ $res->anrede = $person_res->anrede;
+ $res->titel = $person_res->titelpre;
+ $res->vorname = $person_res->vorname;
+ $res->nachname = $person_res->nachname;
+
+ $res->gebort = $person_res->gebort;
+ $res->gebdatum = $person_res->gebdatum;
+
+ $res->postnomen = $person_res->titelpost;
+
+
+ $res->adressen = $adresse_res;
+ $res->zutrittsdatum = $zutrittskarte_ausgegebenam;
+ $res->kontakte = $kontakte_res;
+ $res->mittel = $betriebsmittelperson_res;
+
+ $res->mailverteiler = $mailverteiler_res;
+
+ foreach($mitarbeiter_res as $key => $value){
+ $res->$key = $value;
+ }
+ $intern_email = array();
+ $intern_email+=array("type" => "intern");
+ $intern_email+=array("email"=> getAuthUID() . "@" . DOMAIN);
+ $extern_email=array();
+ $extern_email+=array("type" => "alias");
+ $extern_email+=array("email" => $mitarbeiter_res->alias . "@" . DOMAIN);
+ $res->emails = array($intern_email,$extern_email);
+
+ $res->funktionen = $benutzer_funktion_res;
+ return $res;
+ }
+
+
+
+
+
+ private function studentProfil(){
+
+
+
+ //? betriebsmittel soll nur der user selber sehen
+ if(
+
+ isSuccess($this->BetriebsmittelpersonModel->addSelect(["CONCAT(betriebsmitteltyp, ' ' ,beschreibung) as Betriebsmittel","nummer as Nummer","ausgegebenam as Ausgegeben_am"]))
+
+ ){
+ //? betriebsmittel are not needed in a view
+ $betriebsmittelperson_res = $this->BetriebsmittelpersonModel->getBetriebsmittel(getAuthPersonId());
+ if(isError($betriebsmittelperson_res)){
+ // error handling
+ }else{
+ $betriebsmittelperson_res = hasData($betriebsmittelperson_res)? getData($betriebsmittelperson_res) : null;
+ }
+ }
+
+ if(
+
+ //? kontaktdaten soll auch nur der user selbst sehen
+ 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;
+ }
+
+ }
+
+ //? FH Ausweis Austellungsdatum soll auch nur der user selbst sehen
+ $zutrittskarte_ausgegebenam = $this->BetriebsmittelpersonModel->getBetriebsmittelByUid(getAuthUID(),"Zutrittskarte");
+ if(isError($zutrittskarte_ausgegebenam)){
+ // error handling
+ }else{
+ $zutrittskarte_ausgegebenam = hasData($zutrittskarte_ausgegebenam)? getData($zutrittskarte_ausgegebenam)[0]->ausgegebenam : null;
+ //? formats the date from 01-01-2000 to 01.01.2000
+ $zutrittskarte_ausgegebenam = str_replace("-",".",$zutrittskarte_ausgegebenam);
+ }
+
+
+ //? Die Adressen soll auch nur der user selber sehen
+
+ 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;
+ }
+ }
+
+ //? die folgenden Informationen darf nur der eigene user sehen
+
+
+
+
+
+ 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;
+
+ $mailverteiler_res = array_map(function($element) { $element->mailto="mailto:".$element->gruppe_kurzbz."@".DOMAIN; return $element;},$mailverteiler_res);
+ }
+
+
+
+ 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()]);
+ if(isError($person_res)){
+ // error handling
+ }else{
+ $person_res = hasData($person_res)? getData($person_res)[0] : null;
+ }
}
- echo json_encode($res);
+ if(
+
+ isSuccess($this->BenutzergruppeModel->addSelect(['bezeichnung']))
+ && isSuccess($this->BenutzergruppeModel->addJoin('tbl_gruppe', 'gruppe_kurzbz' ))
+ ){
+ $zutrittsgruppe_res = $this->BenutzergruppeModel->loadWhere(array("uid"=>getAuthUID(), "zutrittssystem"=>true));
+ if(isError($zutrittsgruppe_res)){
+ // catch error
+ }
+ $zutrittsgruppe_res = hasData($zutrittsgruppe_res) ? getData($zutrittsgruppe_res) : null;
+
+ }
+
+
+
+ //? personenkennzeichen ist die Spalte Matrikelnr in der Tabelle Student
+ 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()]);
+ if(isError($student_res)){
+ // catch error
+ }
+ $student_res = hasData($student_res)?getData($student_res)[0]:null;
+
+ }
+
+
+
+ //? 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()]);
+ if(isError($matr_res)){
+ // catch error
+ }else{
+ $matr_res = hasData($matr_res)? getData($matr_res)[0] : [];
+
+ }
+ }
+
+ $res = new stdClass();
+
+
+ $res->foto = $person_res->foto;
+ $res->foto_sperre = $person_res->foto_sperre;
+ $res->username = getAuthUID();
+
+ $res->anrede = $person_res->anrede;
+ $res->titel = $person_res->titelpre;
+ $res->vorname = $person_res->vorname;
+ $res->nachname = $person_res->nachname;
+
+ $res->gebort = $person_res->gebort;
+ $res->gebdatum = $person_res->gebdatum;
+
+ $res->postnomen = $person_res->titelpost;
+
+ $res->internal_email= getAuthUID() . "@" . DOMAIN;
+ $res->adressen = $adresse_res;
+ $res->zutrittsdatum = $zutrittskarte_ausgegebenam;
+ $res->kontakte = $kontakte_res;
+ $res->mittel = $betriebsmittelperson_res;
+ $res->matrikelnummer = $matr_res->matr_nr;
+ foreach($student_res as $key => $value){
+ $res->$key = $value;
+ }
+ $res->zuttritsgruppen = $zutrittsgruppe_res;
+
+
+
+ $res->mailverteiler = $mailverteiler_res;
+
+ return $res;
}
- public function mitarbeiterProfil($uid){
- //? informationen die nur für den Mitarbeiter verfügbar sind
+ public function getView(){
+ // property_exists(object|string $object_or_class, string $property): bool
+
+ $payload = json_decode($this->input->raw_input_stream);
+ /* echo json_encode($payload);
+ return; */
+ $uid = property_exists($payload,"uid")? $payload->uid : null;
+
+
+ $isMitarbeiter = null;
+ if($uid)
+ $isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter($uid);
+ else
+ $isMitarbeiter = $this->MitarbeiterModel->isMitarbeiter(getAuthUID());
+
-
- if(
- //! Summe der Wochenstunden wird jetzt in der hr/tbl_dienstverhaeltnis gespeichert
- 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'=>$uid));
- if(isError($benutzer_funktion_res)){
- // error handling
- }else{
- $benutzer_funktion_res = hasData($benutzer_funktion_res)? getData($benutzer_funktion_res) : null;
+ if(isError($isMitarbeiter)){
+ //catch error
}
- }
-
-
+ $isMitarbeiter = hasData($isMitarbeiter) ? getData($isMitarbeiter) : null;
+
+ $res = new stdClass();
-
- 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($uid);
- if(isError($mitarbeiter_res)){
- // error handling
- }else{
- $mitarbeiter_res = hasData($mitarbeiter_res)? getData($mitarbeiter_res)[0] : null;
+ if($uid){
+ // if an $uid was passed as payload to the function then the user is trying to view another profile
+ if($isMitarbeiter ){
+ $res->view= "ViewMitarbeiterProfil";
+ $res->data= $this->viewMitarbeiterProfil($uid);
+ }
+ else {
+ $res->view= "ViewStudentProfil";
+ $res->data= $this->viewStudentProfil($uid);
+ }
+ }else{
+ // if the $uid is empty, then no payload was supplied and the own profile is being requested
+ if($isMitarbeiter ) {
+ $res->view= "MitarbeiterProfil";
+ $res->data = $this->mitarbeiterProfil();
+ }
+ else {
+ $res->view= "StudentProfil";
+ $res->data = $this->studentProfil();
}
}
-
- $res = new stdClass();
- foreach($mitarbeiter_res as $key => $value){
- $res->$key = $value;
- }
- $intern_email = array();
- $intern_email+=array("type" => "intern");
- $intern_email+=array("email"=> $uid . "@" . DOMAIN);
- $extern_email=array();
- $extern_email+=array("type" => "alias");
- $extern_email+=array("email" => $mitarbeiter_res->alias . "@" . DOMAIN);
- $res->emails = array($intern_email,$extern_email);
-
- $res->funktionen = $benutzer_funktion_res;
+
+
echo json_encode($res);
+ return;
+
+
+
+
}
-
+
//? the view parameter is a flag that describes if a Profile from a different person is being viewed
public function indexProfilInformaion($uid, $view=false){
//? funktion returns all data needed for the student and the mitarbeiter profil view
diff --git a/application/views/Cis/Profil.php b/application/views/Cis/Profil.php
index 866fbc959..a107f0775 100644
--- a/application/views/Cis/Profil.php
+++ b/application/views/Cis/Profil.php
@@ -1,22 +1,29 @@
'Stundenplan',
- 'customJSModules' => ['public/js/apps/Cis/ProfilApp.js'],
+ 'customJSModules' => ['public/js/apps/Cis/Profil.js'],
'tabulator5' => true,
'customCSSs' => ['public/css/components/calendar.css', 'public/css/components/FilterComponent.css'],
- 'childs' => ['test1','test2','test3','test4']
+
);
$this->load->view('templates/CISHTML-Header', $includesArray);
?>
+
-
test element
+ +MitarbeiterProfil
+ `, +}; \ No newline at end of file diff --git a/public/js/components/Cis/Profil/MitarbeiterViewProfil.js b/public/js/components/Cis/Profil/MitarbeiterViewProfil.js new file mode 100644 index 000000000..b259aa074 --- /dev/null +++ b/public/js/components/Cis/Profil/MitarbeiterViewProfil.js @@ -0,0 +1,218 @@ + +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 + props:['uid','view'], + 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.mitarbeiter_info && this.index_information && this.student_info) ){ + return; + } + fhcapifactory.UserData.sperre_foto_function(value).then(res => { + + this.index_information.foto_sperre = res.data.foto_sperre; + + }); + + }, + + + }, + computed:{ + + + get_image_base64_src(){ + if(!this.index_information){ + return ""; + } + return "data:image/jpeg;base64,"+this.index_information.foto; + }, + personData(){ + if(!this.index_information){ + return {}; + } + + return { + Allgemein: (this.role =='Mitarbeiter' || this.role =='View_Mitarbeiter')?{ + Username:this.index_information.username, + Anrede:this.index_information.anrede, + Titel:this.index_information.titel, + Vorname:this.index_information.vorname, + Nachname:this.index_information.nachname, + Postnomen:this.index_information.postnomen, + }:{ + Username:this.index_information.username, + Matrikelnummer: this.student_info?.matrikelnummer, + Anrede:this.index_information.anrede, + Titel:this.index_information.titel, + Vorname:this.index_information.vorname, + Nachname:this.index_information.nachname, + Postnomen:this.index_information.postnomen, + }, + GeburtsDaten:!this.role.includes("View")?{ + Geburtsdatum:this.index_information.gebdatum, + Geburtsort: this.index_information.gebort, + }: null, + Adressen: this.index_information.adressen, + SpecialInformation: this.role =='Mitarbeiter' || this.role === 'View_Mitarbeiter'? { + Kurzzeichen: this.mitarbeiter_info?.kurzbz, + Telefon: this.mitarbeiter_info?.telefonklappe, + //* Wird das Feld Ort_kurzbz noch gepflegt? + ...(this.role === 'View_Mitarbeiter'?{Büro:this.mitarbeiter_info?.ort_kurzbz}:{}) , + } : { + Studiengang:this.student_info?.studiengang, + Semester:this.student_info?.semester, + Verband:this.student_info?.verband, + Gruppe:this.student_info?.gruppe, + Personenkennzeichen:this.student_info?.personenkennzeichen + }, + }; + }, + //? this computed conains all the information that is used for the second column that displays the information of the person + kontaktInfo(){ + if(!this.index_information){ + return {}; + } + + return { + FhAusweisStatus: this.index_information.zutrittsdatum, + emails: this.role === 'Mitarbeiter' || this.role === 'View_Mitarbeiter'? this.mitarbeiter_info?.emails: this.index_information.emails, + Kontakte:this.index_information.kontakte, + }; + }, + + }, + + mounted(){ + + console.log(this.uid); + console.log(this.view); + console.log(typeof this.view); + if(this.view){console.log("view is true")}else{ console.log("view is false")} + + //? this function is to update the tabulator information only when the tabulator was build checking the tableBulit event + //! only the tableBuilt event of the second tabulator was used to update the table informations + + + fhcapifactory.UserData.isMitarbeiterOrStudent(this.uid).then((res) => { + + this.role = this.view? "View_"+res.data: res.data; + if(!this.role.includes('View')){ + this.$refs.betriebsmittelTable.tabulator.on('tableBuilt', () => { + }) + } + + + console.log("the role of the current view: ", this.role); + + + + //? Die anderen api calls werden erst gemacht wenn der call zu isMitarbeiterOrStudent gemacht worden ist + + + //! indexProfilInformationen werden immer gefetcht + fhcapifactory.UserData.indexProfilInformaion(this.uid,this.view).then((res) => { + console.log(res.data); + this.index_information = res.data; + if(!this.role.includes("View")){ + this.$refs.betriebsmittelTable.tabulator.setData(res.data.mittel); + } + }); + + + //? Danach werden die Informationen der Role gefetcht + if(this.role === "Student" || this.role === "View_Student"){ + fhcapifactory.UserData.studentProfil(this.uid,this.view).then((res)=> { + this.student_info = res.data; + if(this.role ==="Student"){ + this.$refs.zutrittsgruppenTable.tabulator.setData(res.data.zuttritsgruppen); + } + }) + } + + if(this.role === "Mitarbeiter" || this.role === "View_Mitarbeiter"){ + fhcapifactory.UserData.mitarbeiterProfil(this.uid).then((res)=> { + this.mitarbeiter_info = res.data; + this.$refs.funktionenTable.tabulator.setData(res.data.funktionen); + }) + } + }); + + + + }, + + template: ` + +MitarbeiterViewProfil
+ `, +}; \ No newline at end of file diff --git a/public/js/components/Cis/Profil/StudentProfil.js b/public/js/components/Cis/Profil/StudentProfil.js new file mode 100644 index 000000000..ffe63e952 --- /dev/null +++ b/public/js/components/Cis/Profil/StudentProfil.js @@ -0,0 +1,218 @@ + +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 + props:['uid','view'], + 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.mitarbeiter_info && this.index_information && this.student_info) ){ + return; + } + fhcapifactory.UserData.sperre_foto_function(value).then(res => { + + this.index_information.foto_sperre = res.data.foto_sperre; + + }); + + }, + + + }, + computed:{ + + + get_image_base64_src(){ + if(!this.index_information){ + return ""; + } + return "data:image/jpeg;base64,"+this.index_information.foto; + }, + personData(){ + if(!this.index_information){ + return {}; + } + + return { + Allgemein: (this.role =='Mitarbeiter' || this.role =='View_Mitarbeiter')?{ + Username:this.index_information.username, + Anrede:this.index_information.anrede, + Titel:this.index_information.titel, + Vorname:this.index_information.vorname, + Nachname:this.index_information.nachname, + Postnomen:this.index_information.postnomen, + }:{ + Username:this.index_information.username, + Matrikelnummer: this.student_info?.matrikelnummer, + Anrede:this.index_information.anrede, + Titel:this.index_information.titel, + Vorname:this.index_information.vorname, + Nachname:this.index_information.nachname, + Postnomen:this.index_information.postnomen, + }, + GeburtsDaten:!this.role.includes("View")?{ + Geburtsdatum:this.index_information.gebdatum, + Geburtsort: this.index_information.gebort, + }: null, + Adressen: this.index_information.adressen, + SpecialInformation: this.role =='Mitarbeiter' || this.role === 'View_Mitarbeiter'? { + Kurzzeichen: this.mitarbeiter_info?.kurzbz, + Telefon: this.mitarbeiter_info?.telefonklappe, + //* Wird das Feld Ort_kurzbz noch gepflegt? + ...(this.role === 'View_Mitarbeiter'?{Büro:this.mitarbeiter_info?.ort_kurzbz}:{}) , + } : { + Studiengang:this.student_info?.studiengang, + Semester:this.student_info?.semester, + Verband:this.student_info?.verband, + Gruppe:this.student_info?.gruppe, + Personenkennzeichen:this.student_info?.personenkennzeichen + }, + }; + }, + //? this computed conains all the information that is used for the second column that displays the information of the person + kontaktInfo(){ + if(!this.index_information){ + return {}; + } + + return { + FhAusweisStatus: this.index_information.zutrittsdatum, + emails: this.role === 'Mitarbeiter' || this.role === 'View_Mitarbeiter'? this.mitarbeiter_info?.emails: this.index_information.emails, + Kontakte:this.index_information.kontakte, + }; + }, + + }, + + mounted(){ + + console.log(this.uid); + console.log(this.view); + console.log(typeof this.view); + if(this.view){console.log("view is true")}else{ console.log("view is false")} + + //? this function is to update the tabulator information only when the tabulator was build checking the tableBulit event + //! only the tableBuilt event of the second tabulator was used to update the table informations + + + fhcapifactory.UserData.isMitarbeiterOrStudent(this.uid).then((res) => { + + this.role = this.view? "View_"+res.data: res.data; + if(!this.role.includes('View')){ + this.$refs.betriebsmittelTable.tabulator.on('tableBuilt', () => { + }) + } + + + console.log("the role of the current view: ", this.role); + + + + //? Die anderen api calls werden erst gemacht wenn der call zu isMitarbeiterOrStudent gemacht worden ist + + + //! indexProfilInformationen werden immer gefetcht + fhcapifactory.UserData.indexProfilInformaion(this.uid,this.view).then((res) => { + console.log(res.data); + this.index_information = res.data; + if(!this.role.includes("View")){ + this.$refs.betriebsmittelTable.tabulator.setData(res.data.mittel); + } + }); + + + //? Danach werden die Informationen der Role gefetcht + if(this.role === "Student" || this.role === "View_Student"){ + fhcapifactory.UserData.studentProfil(this.uid,this.view).then((res)=> { + this.student_info = res.data; + if(this.role ==="Student"){ + this.$refs.zutrittsgruppenTable.tabulator.setData(res.data.zuttritsgruppen); + } + }) + } + + if(this.role === "Mitarbeiter" || this.role === "View_Mitarbeiter"){ + fhcapifactory.UserData.mitarbeiterProfil(this.uid).then((res)=> { + this.mitarbeiter_info = res.data; + this.$refs.funktionenTable.tabulator.setData(res.data.funktionen); + }) + } + }); + + + + }, + + template: ` + +StudentProfil
+ `, +}; \ No newline at end of file diff --git a/public/js/components/Cis/Profil/StudentViewProfil.js b/public/js/components/Cis/Profil/StudentViewProfil.js new file mode 100644 index 000000000..65484fd2e --- /dev/null +++ b/public/js/components/Cis/Profil/StudentViewProfil.js @@ -0,0 +1,218 @@ + +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 + props:['uid','view'], + 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.mitarbeiter_info && this.index_information && this.student_info) ){ + return; + } + fhcapifactory.UserData.sperre_foto_function(value).then(res => { + + this.index_information.foto_sperre = res.data.foto_sperre; + + }); + + }, + + + }, + computed:{ + + + get_image_base64_src(){ + if(!this.index_information){ + return ""; + } + return "data:image/jpeg;base64,"+this.index_information.foto; + }, + personData(){ + if(!this.index_information){ + return {}; + } + + return { + Allgemein: (this.role =='Mitarbeiter' || this.role =='View_Mitarbeiter')?{ + Username:this.index_information.username, + Anrede:this.index_information.anrede, + Titel:this.index_information.titel, + Vorname:this.index_information.vorname, + Nachname:this.index_information.nachname, + Postnomen:this.index_information.postnomen, + }:{ + Username:this.index_information.username, + Matrikelnummer: this.student_info?.matrikelnummer, + Anrede:this.index_information.anrede, + Titel:this.index_information.titel, + Vorname:this.index_information.vorname, + Nachname:this.index_information.nachname, + Postnomen:this.index_information.postnomen, + }, + GeburtsDaten:!this.role.includes("View")?{ + Geburtsdatum:this.index_information.gebdatum, + Geburtsort: this.index_information.gebort, + }: null, + Adressen: this.index_information.adressen, + SpecialInformation: this.role =='Mitarbeiter' || this.role === 'View_Mitarbeiter'? { + Kurzzeichen: this.mitarbeiter_info?.kurzbz, + Telefon: this.mitarbeiter_info?.telefonklappe, + //* Wird das Feld Ort_kurzbz noch gepflegt? + ...(this.role === 'View_Mitarbeiter'?{Büro:this.mitarbeiter_info?.ort_kurzbz}:{}) , + } : { + Studiengang:this.student_info?.studiengang, + Semester:this.student_info?.semester, + Verband:this.student_info?.verband, + Gruppe:this.student_info?.gruppe, + Personenkennzeichen:this.student_info?.personenkennzeichen + }, + }; + }, + //? this computed conains all the information that is used for the second column that displays the information of the person + kontaktInfo(){ + if(!this.index_information){ + return {}; + } + + return { + FhAusweisStatus: this.index_information.zutrittsdatum, + emails: this.role === 'Mitarbeiter' || this.role === 'View_Mitarbeiter'? this.mitarbeiter_info?.emails: this.index_information.emails, + Kontakte:this.index_information.kontakte, + }; + }, + + }, + + mounted(){ + + console.log(this.uid); + console.log(this.view); + console.log(typeof this.view); + if(this.view){console.log("view is true")}else{ console.log("view is false")} + + //? this function is to update the tabulator information only when the tabulator was build checking the tableBulit event + //! only the tableBuilt event of the second tabulator was used to update the table informations + + + fhcapifactory.UserData.isMitarbeiterOrStudent(this.uid).then((res) => { + + this.role = this.view? "View_"+res.data: res.data; + if(!this.role.includes('View')){ + this.$refs.betriebsmittelTable.tabulator.on('tableBuilt', () => { + }) + } + + + console.log("the role of the current view: ", this.role); + + + + //? Die anderen api calls werden erst gemacht wenn der call zu isMitarbeiterOrStudent gemacht worden ist + + + //! indexProfilInformationen werden immer gefetcht + fhcapifactory.UserData.indexProfilInformaion(this.uid,this.view).then((res) => { + console.log(res.data); + this.index_information = res.data; + if(!this.role.includes("View")){ + this.$refs.betriebsmittelTable.tabulator.setData(res.data.mittel); + } + }); + + + //? Danach werden die Informationen der Role gefetcht + if(this.role === "Student" || this.role === "View_Student"){ + fhcapifactory.UserData.studentProfil(this.uid,this.view).then((res)=> { + this.student_info = res.data; + if(this.role ==="Student"){ + this.$refs.zutrittsgruppenTable.tabulator.setData(res.data.zuttritsgruppen); + } + }) + } + + if(this.role === "Mitarbeiter" || this.role === "View_Mitarbeiter"){ + fhcapifactory.UserData.mitarbeiterProfil(this.uid).then((res)=> { + this.mitarbeiter_info = res.data; + this.$refs.funktionenTable.tabulator.setData(res.data.funktionen); + }) + } + }); + + + + }, + + template: ` + +StudentViewProfil
+ `, +}; \ No newline at end of file