mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 16:02:15 +00:00
conditional rendering for different Profile Views
This commit is contained in:
@@ -16,6 +16,8 @@ class Profil extends Auth_Controller
|
||||
{
|
||||
parent::__construct([
|
||||
'index' => ['student/anrechnung_beantragen:r','user:r'], // TODO(chris): permissions?
|
||||
'View' => ['student/anrechnung_beantragen:r','user:r'],
|
||||
|
||||
'isMitarbeiterOrStudent' => ['student/anrechnung_beantragen:r','user:r'],
|
||||
'getMitarbeiterAnsicht' => ['student/anrechnung_beantragen:r','user:r'],
|
||||
'foto_sperre_function' => ['student/anrechnung_beantragen:r','user:r'],
|
||||
@@ -48,23 +50,54 @@ class Profil extends Auth_Controller
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
//? 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()]);
|
||||
$this->load->view('Cis/Profil', ["uid" => getAuthUID(),"pid" => getAuthPersonId(), "view"=> false]);
|
||||
}
|
||||
|
||||
//? attempt at rerouting methods
|
||||
/* public function _remap($method, $params = array())
|
||||
{
|
||||
if($method ==='View' || $method === 'Mitarbeiter'){
|
||||
|
||||
|
||||
return call_user_func_array(array($this, "searchView"), $params);
|
||||
|
||||
}else{
|
||||
if (method_exists($this, $method))
|
||||
{
|
||||
return call_user_func_array(array($this, $method), $params);
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
public function View($uid){
|
||||
|
||||
//? get the personID of the uid
|
||||
isSuccess($this->BenutzerModel->addSelect(["person_id"]));
|
||||
$personID_res = $this->BenutzerModel->load([$uid]);
|
||||
$personID_res = hasData($personID_res) ? getData($personID_res)[0] : null;
|
||||
|
||||
$this->load->view('Cis/Profil', ["uid" => $uid,"pid" => $personID_res->person_id,"view"=>true]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function studentProfil(){
|
||||
|
||||
public function studentProfil($uid, $view=false){
|
||||
|
||||
if(
|
||||
!$view &&
|
||||
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"=>$uid, "zutrittssystem"=>true));
|
||||
if(isError($zutrittsgruppe_res)){
|
||||
// catch error
|
||||
}
|
||||
@@ -78,7 +111,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([$uid]);
|
||||
if(isError($student_res)){
|
||||
// catch error
|
||||
}
|
||||
@@ -89,8 +122,9 @@ class Profil extends Auth_Controller
|
||||
|
||||
|
||||
//? Matrikelnummer ist die Spalte matr_nr in Person
|
||||
if(isSuccess($this->StudentModel->addSelect(["matr_nr"]))){
|
||||
$person_res = $this->PersonModel->load(getAuthPersonID());
|
||||
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)){
|
||||
// catch error
|
||||
}else{
|
||||
@@ -104,7 +138,9 @@ class Profil extends Auth_Controller
|
||||
foreach($student_res as $key => $value){
|
||||
$res->$key = $value;
|
||||
}
|
||||
if(!$view){
|
||||
$res->zuttritsgruppen = $zutrittsgruppe_res;
|
||||
}
|
||||
|
||||
echo json_encode($res);
|
||||
|
||||
@@ -112,7 +148,7 @@ class Profil extends Auth_Controller
|
||||
|
||||
}
|
||||
|
||||
public function mitarbeiterProfil(){
|
||||
public function mitarbeiterProfil($uid){
|
||||
//? informationen die nur für den Mitarbeiter verfügbar sind
|
||||
|
||||
|
||||
@@ -121,7 +157,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'=>$uid));
|
||||
if(isError($benutzer_funktion_res)){
|
||||
// error handling
|
||||
}else{
|
||||
@@ -134,7 +170,7 @@ class Profil extends Auth_Controller
|
||||
if(isSuccess($this->MitarbeiterModel->addSelect(["kurzbz","telefonklappe", "alias"]))
|
||||
&& isSuccess($this->MitarbeiterModel->addJoin("tbl_benutzer", "tbl_benutzer.uid = tbl_mitarbeiter.mitarbeiter_uid"))
|
||||
){
|
||||
$mitarbeiter_res = $this->MitarbeiterModel->load(getAuthUID());
|
||||
$mitarbeiter_res = $this->MitarbeiterModel->load($uid);
|
||||
if(isError($mitarbeiter_res)){
|
||||
// error handling
|
||||
}else{
|
||||
@@ -148,7 +184,7 @@ class Profil extends Auth_Controller
|
||||
}
|
||||
$intern_email = array();
|
||||
$intern_email+=array("type" => "intern");
|
||||
$intern_email+=array("email"=> getAuthUID() . "@" . DOMAIN);
|
||||
$intern_email+=array("email"=> $uid . "@" . DOMAIN);
|
||||
$extern_email=array();
|
||||
$extern_email+=array("type" => "alias");
|
||||
$extern_email+=array("email" => $mitarbeiter_res->alias . "@" . DOMAIN);
|
||||
@@ -158,10 +194,84 @@ class Profil extends Auth_Controller
|
||||
echo json_encode($res);
|
||||
}
|
||||
|
||||
public function indexProfilInformaion(){
|
||||
|
||||
//? 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
|
||||
|
||||
|
||||
$res = new stdClass();
|
||||
|
||||
//! falls der view flag auf flase gesetzt ist werden extra informationen des Users abgefragt
|
||||
if(!$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($uid,"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(
|
||||
!$view &&
|
||||
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
|
||||
$res->adressen = $adresse_res;
|
||||
$res->zutrittsdatum = $zutrittskarte_ausgegebenam;
|
||||
$res->kontakte = $kontakte_res;
|
||||
$res->mittel = $betriebsmittelperson_res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(
|
||||
isSuccess($this->PersonModel->addSelect('gruppe_kurzbz, beschreibung'))&&
|
||||
@@ -169,7 +279,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'=>$uid));
|
||||
if( isError($mailverteiler_res)){
|
||||
// catch error
|
||||
}
|
||||
@@ -179,60 +289,15 @@ class Profil extends Auth_Controller
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(
|
||||
isSuccess($this->BetriebsmittelpersonModel->addSelect(["CONCAT(betriebsmitteltyp, ' ' ,beschreibung) as Betriebsmittel","nummer as Nummer","ausgegebenam as Ausgegeben_am"]))
|
||||
|
||||
){
|
||||
$betriebsmittelperson_res = $this->BetriebsmittelpersonModel->getBetriebsmittel(getAuthPersonId());
|
||||
if(isError($betriebsmittelperson_res)){
|
||||
// error handling
|
||||
}else{
|
||||
$betriebsmittelperson_res = hasData($betriebsmittelperson_res)? getData($betriebsmittelperson_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->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);
|
||||
$benutzer_info_sql_columns = ["foto","foto_sperre","anrede","titelpost","titelpre","vorname","nachname"];
|
||||
//? der Geburtsort und das Geburtsdatum darf auch nur der eigene User sehen
|
||||
if (!$view){
|
||||
array_push($benutzer_info_sql_columns, "gebort", "gebdatum");
|
||||
}
|
||||
if(isSuccess($this->BenutzerModel->addSelect($benutzer_info_sql_columns))
|
||||
&& isSuccess($this->BenutzerModel->addJoin("tbl_person", "person_id"))){
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if(isSuccess($this->PersonModel->addSelect(["foto","foto_sperre","anrede","titelpost","titelpre","vorname","nachname", "gebort", "gebdatum"]))){
|
||||
|
||||
$person_res = $this->PersonModel->load(getAuthPersonId());
|
||||
$person_res = $this->BenutzerModel->load([$uid]);
|
||||
if(isError($person_res)){
|
||||
// error handling
|
||||
}else{
|
||||
@@ -242,27 +307,27 @@ 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 = $uid;
|
||||
|
||||
$res->anrede = $person_res->anrede;
|
||||
$res->titel = $person_res->titelpre ." " . $person_res->titelpost;
|
||||
$res->vorname = $person_res->vorname;
|
||||
$res->nachname = $person_res->nachname;
|
||||
if(!$view){
|
||||
$res->gebort = $person_res->gebort;
|
||||
$res->gebdatum = $person_res->gebdatum;
|
||||
$res->adressen = $adresse_res;
|
||||
$res->zutrittsdatum = $zutrittskarte_ausgegebenam;
|
||||
}
|
||||
//$res->postnomen = $person_res->postnomen; //! still not found
|
||||
$intern_email = array();
|
||||
$intern_email+=array("type" => "intern");
|
||||
$intern_email+=array("email"=> getAuthUID() . "@" . DOMAIN);
|
||||
$intern_email+=array("email"=> $uid . "@" . DOMAIN);
|
||||
$res->emails = array($intern_email);
|
||||
|
||||
$res->kontakte = $kontakte_res;
|
||||
$res->mittel = $betriebsmittelperson_res;
|
||||
|
||||
|
||||
$res->mailverteiler = $mailverteiler_res;
|
||||
|
||||
|
||||
@@ -271,6 +336,10 @@ class Profil extends Auth_Controller
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! old function that was used to fetch all the data
|
||||
// todo delete the function at the end
|
||||
public function getMitarbeiterAnsicht(){
|
||||
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ $this->load->view('templates/CISHTML-Header', $includesArray);
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- we can pass information from the php view file to the public js file through interpolating data from php into vue props -->
|
||||
<Profil uid="<?php echo $uid ?>" pid="<?php echo $pid ?>"></Profil>
|
||||
<!-- we can pass information from the php view file to the public js file throughz interpolating data from php into vue props -->
|
||||
<Profil <?php echo "uid=$uid" ?> <?php echo "pid=$pid" ?> view=<?php echo $view? boolval(1): boolval(0); ?>></Profil>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('templates/CISHTML-Footer', $includesArray); ?>
|
||||
|
||||
@@ -23,6 +23,10 @@ Vue.createApp({
|
||||
type: "function",
|
||||
action: function(data) {
|
||||
alert('employee defaultaction ' + JSON.stringify(data));
|
||||
//return FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router+
|
||||
//"/Cis/Profil/"+data.person_id;
|
||||
//? Person id is data.person_id
|
||||
//? Benutzer UID is data.uid
|
||||
}
|
||||
},
|
||||
childactions: []
|
||||
|
||||
@@ -2,7 +2,7 @@ export default {
|
||||
search: function(searchsettings) {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
+ FHC_JS_DATA_STORAGE_OBJECT.ci_router
|
||||
+ 'components/SearchBar/search';
|
||||
+ '/components/SearchBar/search';
|
||||
return axios.post(url, searchsettings);
|
||||
},
|
||||
searchdummy: function(searchsettings) {
|
||||
|
||||
@@ -1,47 +1,35 @@
|
||||
export default {
|
||||
|
||||
getUser: function() {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
+ 'cis.php/Cis/Profil/getUser';
|
||||
return axios.get(url);
|
||||
},
|
||||
|
||||
|
||||
isMitarbeiterOrStudent: function(uid) {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
+ `cis.php/Cis/Profil/isMitarbeiterOrStudent/${uid}`;
|
||||
return axios.get(url);
|
||||
},
|
||||
getMitarbeiterAnsicht: function() {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
+ `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);
|
||||
},
|
||||
getBenutzerFunktionen: function() {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router+
|
||||
"/Cis/Profil/getBenutzerFunktionen";
|
||||
|
||||
return axios.get(url);
|
||||
},
|
||||
|
||||
|
||||
indexProfilInformaion: function() {
|
||||
indexProfilInformaion: function(uid, view=false) {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router+
|
||||
"/Cis/Profil/indexProfilInformaion";
|
||||
`/Cis/Profil/indexProfilInformaion/${uid}/${view}`;
|
||||
|
||||
return axios.get(url);
|
||||
},
|
||||
mitarbeiterProfil: function() {
|
||||
mitarbeiterProfil: function(uid) {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router+
|
||||
"/Cis/Profil/mitarbeiterProfil";
|
||||
`/Cis/Profil/mitarbeiterProfil/${uid}`;
|
||||
|
||||
return axios.get(url);
|
||||
},
|
||||
studentProfil: function() {
|
||||
studentProfil: function(uid, view=false) {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router+
|
||||
"/Cis/Profil/studentProfil";
|
||||
`/Cis/Profil/studentProfil/${uid}/${view}`;
|
||||
|
||||
return axios.get(url);
|
||||
},
|
||||
|
||||
@@ -2,20 +2,12 @@
|
||||
import fhcapifactory from "../../../apps/api/fhcapifactory.js";
|
||||
import {CoreFilterCmpt} from "../../../components/filter/Filter.js"
|
||||
|
||||
|
||||
/* [
|
||||
{title: 'Log ID', field: 'LogId', headerFilter: true},
|
||||
{title: 'Request ID', field: 'RequestId', headerFilter: true},
|
||||
{title: 'Execution time', field: 'ExecutionTime', headerFilter: true},
|
||||
{title: 'Executed by', field: 'ExecutedBy', headerFilter: true},
|
||||
{title: 'Description', field: 'Description', headerFilter: true},
|
||||
{title: 'Data', field: 'Data', headerFilter: true},
|
||||
{title: 'Web service type', field: 'WebserviceType', headerFilter: true}
|
||||
] */
|
||||
|
||||
//? old data
|
||||
/* ajaxUrl: FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router+
|
||||
"/Cis/Profil/getBenutzerFunktionen", */
|
||||
//? 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:{
|
||||
@@ -28,7 +20,6 @@ export default {
|
||||
student_info:null,
|
||||
//? beinhaltet die Information ob der angefragte user ein Student oder Mitarbeiter ist
|
||||
role: null,
|
||||
//"bf_bezeichnung", "oe_bezeichnung", "datum_von", "datum_bis", "wochenstunden" ]
|
||||
|
||||
funktionen_table_options: {
|
||||
height: 300,
|
||||
@@ -60,7 +51,7 @@ export default {
|
||||
},
|
||||
|
||||
//? this props were passed in the Profil.php view file
|
||||
props:['uid','pid'],
|
||||
props:['uid','pid','view'],
|
||||
methods: {
|
||||
|
||||
concatenate_addresses(address_array){
|
||||
@@ -111,7 +102,7 @@ export default {
|
||||
}
|
||||
|
||||
return {
|
||||
Allgemein: this.role =='Mitarbeiter'?{
|
||||
Allgemein: (this.role =='Mitarbeiter' || this.role =='View_Mitarbeiter')?{
|
||||
Username:this.index_information.username,
|
||||
Anrede:this.index_information.anrede,
|
||||
Titel:this.index_information.titel,
|
||||
@@ -127,12 +118,12 @@ export default {
|
||||
Nachname:this.index_information.nachname,
|
||||
Postnomen:null,
|
||||
},
|
||||
GeburtsDaten:{
|
||||
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'? {
|
||||
SpecialInformation: this.role =='Mitarbeiter' || this.role === 'View_Mitarbeiter'? {
|
||||
Kurzzeichen: this.mitarbeiter_info?.kurzbz,
|
||||
Telefon: this.mitarbeiter_info?.telefonklappe,
|
||||
} : {
|
||||
@@ -152,7 +143,7 @@ export default {
|
||||
|
||||
return {
|
||||
FhAusweisStatus: this.index_information.zutrittsdatum,
|
||||
emails: this.role === 'Mitarbeiter'? this.mitarbeiter_info?.emails: this.index_information.emails,
|
||||
emails: this.role === 'Mitarbeiter' || this.role === 'View_Mitarbeiter'? this.mitarbeiter_info?.emails: this.index_information.emails,
|
||||
Kontakte:this.index_information.kontakte,
|
||||
};
|
||||
},
|
||||
@@ -171,43 +162,57 @@ export default {
|
||||
|
||||
console.log(this.uid);
|
||||
console.log(this.pid);
|
||||
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
|
||||
this.$refs.betriebsmittelTable.tabulator.on('tableBuilt', () => {
|
||||
|
||||
fhcapifactory.UserData.isMitarbeiterOrStudent(this.uid).then((res) => {
|
||||
this.role = res.data;
|
||||
|
||||
|
||||
|
||||
//? Die anderen api calls werden erst gemacht wenn der call zu isMitarbeiterOrStudent gemacht worden ist
|
||||
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', () => {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//! indexProfilInformationen werden immer gefetcht
|
||||
fhcapifactory.UserData.indexProfilInformaion().then((res) => {
|
||||
this.index_information = res.data;
|
||||
this.$refs.betriebsmittelTable.tabulator.setData(res.data.mittel);
|
||||
});
|
||||
|
||||
console.log("the role of the current view: ", this.role);
|
||||
|
||||
|
||||
|
||||
//? Danach werden die Informationen der Role gefetcht
|
||||
if(this.role === 'Student'){
|
||||
fhcapifactory.UserData.studentProfil().then((res)=> {
|
||||
this.student_info = res.data;
|
||||
this.$refs.zutrittsgruppenTable.tabulator.setData(res.data.zuttritsgruppen);
|
||||
})
|
||||
//? 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'){
|
||||
fhcapifactory.UserData.mitarbeiterProfil().then((res)=> {
|
||||
this.mitarbeiter_info = res.data;
|
||||
this.$refs.funktionenTable.tabulator.setData(res.data.funktionen);
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
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);
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -218,7 +223,6 @@ export default {
|
||||
<div :class="{'container':true}">
|
||||
<div :class="{'row':true}">
|
||||
<div :class="{'col':true}">
|
||||
|
||||
</div>
|
||||
<div :class="{'col':true}">
|
||||
|
||||
@@ -244,7 +248,7 @@ export default {
|
||||
</div>
|
||||
<div :class="{'col':true}">
|
||||
|
||||
<h3 v-if="role=='Mitarbeiter'">Mitarbeiter</h3>
|
||||
<h3 v-if="role=='Mitarbeiter' || role == 'View_Mitarbeiter'">Mitarbeiter</h3>
|
||||
<h3 v-else >Student</h3>
|
||||
|
||||
<div v-for="(wert,bezeichnung) in personData">
|
||||
@@ -261,7 +265,7 @@ export default {
|
||||
<li v-for="(wert,bezeichnung) in kontaktInfo">
|
||||
|
||||
<!-- HIER IST DAS DATUM DES FH AUSWEIS -->
|
||||
<div class="mb-3" v-if="bezeichnung=='FhAusweisStatus'">
|
||||
<div class="mb-3" v-if="bezeichnung=='FhAusweisStatus' && (role=='Sudent' || role =='Mitarbeiter')">
|
||||
<p class="mb-0"><b>FH-Ausweis Status</b></p>
|
||||
<p class="mb-0">{{"Der FH Ausweis ist am "+ wert+ " ausgegeben worden."}}</p>
|
||||
</div>
|
||||
@@ -299,15 +303,15 @@ export default {
|
||||
<div :class="{'row':true}">
|
||||
|
||||
<!-- order-1 classe wird nur bei der Studentenansicht hinzugefügt um die Zutrittsgruppen Tabelle hinter der Betriebsmittel aufzureihen -->
|
||||
<div :class="{'col-12':true, 'order-2':role==='Student'}">
|
||||
<div :class="{'col-12':true, 'order-2':role=='Student'}">
|
||||
|
||||
<core-filter-cmpt v-if="role === 'Mitarbeiter'" title="Funktionen" ref="funktionenTable" :tabulator-options="funktionen_table_options" :tableOnly />
|
||||
<core-filter-cmpt v-else title="Zutrittsgruppen" ref="zutrittsgruppenTable" :tabulator-options="zutrittsgruppen_table_options" :tableOnly :noColFilter />
|
||||
<core-filter-cmpt v-if="role == 'Mitarbeiter' || role =='View_Mitarbeiter'" title="Funktionen" ref="funktionenTable" :tabulator-options="funktionen_table_options" :tableOnly />
|
||||
<core-filter-cmpt v-if="role == 'Student'" title="Zutrittsgruppen" ref="zutrittsgruppenTable" :tabulator-options="zutrittsgruppen_table_options" :tableOnly :noColFilter />
|
||||
|
||||
</div>
|
||||
<div :class="{'col-12':true}">
|
||||
|
||||
<core-filter-cmpt title="Entlehnte Betriebsmittel" ref="betriebsmittelTable" :tabulator-options="betriebsmittel_table_options" :tableOnly />
|
||||
<core-filter-cmpt title="Entlehnte Betriebsmittel" v-if="!role?.includes('View')" ref="betriebsmittelTable" :tabulator-options="betriebsmittel_table_options" :tableOnly />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user