queryies the telefon number of the mitarbeiter with standort and adds tel links to all phone numbers

This commit is contained in:
Simon Gschnell
2023-12-19 11:02:44 +01:00
parent a3e70afdc1
commit 030be5b83f
2 changed files with 77 additions and 17 deletions
+42 -1
View File
@@ -128,6 +128,21 @@ class Profil extends Auth_Controller
}
}
//? querying the telefon number of the office
if(isSuccess($this->MitarbeiterModel->addSelect(["mitarbeiter_uid"])) &&
isSuccess($this->MitarbeiterModel->addJoin("tbl_kontakt", "tbl_mitarbeiter.standort_id = tbl_kontakt.standort_id"))
){
$this->MitarbeiterModel->addLimit(1);
$telefon_res = $this->MitarbeiterModel->loadWhere(["mitarbeiter_uid"=>$this->uid, "kontakttyp"=>"telefon"]);
if(isError($telefon_res)){
// error handling
}else{
$telefon_res = hasData($telefon_res)? getData($telefon_res)[0] : null;
}
}
$res = new stdClass();
$res->username = $uid;
@@ -163,6 +178,8 @@ class Profil extends Auth_Controller
//? Mailverteiler Info
$res->mailverteiler = $mailverteiler_res;
$res->standort_telefon = $telefon_res;
return $res;
@@ -301,6 +318,9 @@ class Profil extends Auth_Controller
}
//$this->MitarbeiterModel->load($this->uid);
//? FH Ausweis Austellungsdatum soll auch nur der user selbst sehen
$zutrittskarte_ausgegebenam = $this->BetriebsmittelpersonModel->getBetriebsmittelByUid($this->uid,"Zutrittskarte");
if(isError($zutrittskarte_ausgegebenam)){
@@ -378,10 +398,28 @@ class Profil extends Auth_Controller
}
//? querying the telefon number of the office
if(isSuccess($this->MitarbeiterModel->addSelect(["mitarbeiter_uid"])) &&
isSuccess($this->MitarbeiterModel->addJoin("tbl_kontakt", "tbl_mitarbeiter.standort_id = tbl_kontakt.standort_id"))
){
$this->MitarbeiterModel->addLimit(1);
$telefon_res = $this->MitarbeiterModel->loadWhere(["mitarbeiter_uid"=>$this->uid, "kontakttyp"=>"telefon"]);
if(isError($telefon_res)){
// error handling
}else{
$telefon_res = hasData($telefon_res)? getData($telefon_res)[0] : null;
}
}
if(isSuccess($this->MitarbeiterModel->addSelect(["kurzbz","telefonklappe", "alias","ort_kurzbz"]))
if(isSuccess($this->MitarbeiterModel->addSelect(["kurzbz","tbl_mitarbeiter.telefonklappe", "alias","ort_kurzbz"]))
&& isSuccess($this->MitarbeiterModel->addJoin("tbl_benutzer", "tbl_benutzer.uid = tbl_mitarbeiter.mitarbeiter_uid"))
){
$mitarbeiter_res = $this->MitarbeiterModel->load($this->uid);
if(isError($mitarbeiter_res)){
@@ -426,6 +464,9 @@ class Profil extends Auth_Controller
$res->emails = array($intern_email,$extern_email);
$res->funktionen = $benutzer_funktion_res;
//telefon nummer von dem Standort
$res->standort_telefon = $telefon_res;
return $res;
}
@@ -173,6 +173,14 @@ export default {
}
return "data:image/jpeg;base64," + this.data.foto;
},
get_mitarbeiter_standort_telefon(){
if(this.data.standort_telefon){
return "tel:"+ this.data.telefonklappe + this.data.standort_telefon;
}else{
return null;
}
},
//? this computed function returns all the informations for the first column in the profil
personData() {
if (!this.data) {
@@ -207,7 +215,7 @@ export default {
Geburtsdatum: this.data.gebdatum,
Geburtsort: this.data.gebort,
Kurzzeichen: this.data.kurzbz,
Telefon: this.data.telefonklappe,
Telefon: this.data.telefonklappe + (this.data.standort_telefon?this.data.standort_telefon:""),
Büro: this.data.ort_kurzbz,
};
},
@@ -253,6 +261,8 @@ export default {
this.$refs.funktionenTable.tabulator.on("tableBuilt", () => {
this.$refs.funktionenTable.tabulator.setData(this.data.funktionen);
});
},
template: `
@@ -423,8 +433,14 @@ export default {
<div class="card-body">
<div class="row">
<div v-for="(wert,bez) in specialData" class="col-md-6 col-sm-12 ">
<div class=" form-floating mb-2">
<input readonly class="form-control form-control-plaintext border-bottom" :id="'floating'+bez" :value="wert?wert:'-'">
<div class=" form-floating mb-2">
<!-- print Telefon link -->
<a v-if="bez=='Telefon'" :href="get_mitarbeiter_standort_telefon" readonly class="form-control form-control-plaintext border-bottom" :id="'floating'+bez" >{{wert?wert:''}}</a>
<!-- otherwise print input field -->
<input v-else readonly class="form-control form-control-plaintext border-bottom" :id="'floating'+bez" :value="wert?wert:'-'">
<label :for="'floating'+bez">{{bez}}</label>
</div>
</div>
@@ -480,7 +496,7 @@ export default {
<div class="col-12 ">
<div class="row align-items-center">
<div class="col-1">
<div class="col-1 text-center">
<i class="fa-solid fa-envelope" style="color:rgb(0, 100, 156)"></i>
@@ -517,17 +533,26 @@ export default {
<div class="card-header">
Private Kontakte
</div>
<div class="card-body text-center">
<div class="card-body ">
<div v-for="element in privateKontakte" class="align-items-center row justify-content-center">
<div class="col-1">
<i class="fa-solid fa-envelope" style="color:rgb(0, 100, 156)"></i>
<div class="col-1 text-center" >
<i class="fa-solid " :class="{...(element.kontakt.includes('@')?{'fa-envelope':true}:{'fa-phone':true})}" style="color:rgb(0, 100, 156)"></i>
</div>
<div :class="{...(element.anmerkung? {'col-11':true, 'col-md-5':true, 'col-xl-11':true, 'col-xxl-5':true} : {'col-9':true, 'col-xl-9':true})}">
<div class=" form-floating mb-2">
<input readonly class="form-control form-control-plaintext border-bottom" id="floatingKontakt" :value="element.kontakt">
<!-- rendering KONTAKT emails -->
<div v-if="element.kontakt.includes('@')" class=" form-floating mb-2">
<a :href="'mailto:'+element.kontakt" readonly class="form-control form-control-plaintext border-bottom" id="floatingKontakt" >{{element.kontakt}}</a>
<label for="floatingKontakt">{{element.kontakttyp}}</label>
</div>
<!-- rendering KONTAKT phones -->
<div v-else class=" form-floating mb-2">
<a :href="'tel:'+element.kontakt" readonly class="form-control form-control-plaintext border-bottom" id="floatingKontakt" >{{element.kontakt}}</a>
<label for="floatingKontakt">{{element.kontakttyp}}</label>
</div>
</div>
<div v-if="element?.anmerkung" class="offset-1 offset-md-0 col-9 col-md-4 offset-xl-1 offset-xxl-0 col-xl-9 col-xxl-4 order-2 order-md-1 order-xl-1 order-sm-1 order-xxl-1 ">
<div class=" form-floating mb-2">
@@ -610,13 +635,7 @@ export default {
<!-- LITTLE EXTRA ROW WITH INFORMATION REFRESHING LINK -->
<div class="row">
<div class="col ">
<p>Sollten Ihre Daten nicht mehr aktuell sein, klicken Sie bitte <a :href="refreshMailTo">hier</a></p>
</div>
</div>
<!-- END OF REFRESHING LINK ROW -->