hides the profil updates list if no profil update is present

This commit is contained in:
SimonGschnell
2024-02-13 14:20:01 +01:00
parent 1be8c27cb5
commit 66b843be1b
5 changed files with 48 additions and 10 deletions
+22 -2
View File
@@ -20,9 +20,9 @@ class Profil extends Auth_Controller
'foto_sperre_function' => ['student/anrechnung_beantragen:r', 'user:r'],
'getView' => ['student/anrechnung_beantragen:r', 'user:r'],
'View' => ['student/anrechnung_beantragen:r', 'user:r'],
'isMitarbeiter' => ['student/anrechnung_beantragen:r', 'user:r'],
'isStudent' => ['student/anrechnung_beantragen:r', 'user:r'],
]);
@@ -613,4 +613,24 @@ class Profil extends Auth_Controller
return $zutrittskarte_ausgegebenam;
}
//? foreward declaration of the function isStudent in Student_model.php
public function isStudent($uid){
$result = $this->StudentModel->isStudent($uid);
if(!isSuccess($result)){
show_error("error when calling Student_model function isStudent with uid ".$uid);
}
$result = getData($result);
echo json_encode($result);
}
//? foreward declaration of the function isMitarbeiter in Mitarbeiter_model.php
public function isMitarbeiter($uid){
$result = $this->MitarbeiterModel->isMitarbeiter($uid);
if(!isSuccess($result)){
show_error("error when calling Mitarbeiter_model function isMitarbeiter with uid ".$uid);
}
$result = getData($result);
echo json_encode($result);
}
}
+14
View File
@@ -22,4 +22,18 @@ export default {
`cis.php/Cis/Profil/foto_sperre_function/${value}`;
return axios.get(url);
},
isStudent: function (uid) {
const url =
FHC_JS_DATA_STORAGE_OBJECT.app_root +
`cis.php/Cis/Profil/isStudent/${uid}`;
return axios.get(url);
},
isMitarbeiter: function (uid) {
const url =
FHC_JS_DATA_STORAGE_OBJECT.app_root +
`cis.php/Cis/Profil/isMitarbeiter/${uid}`;
return axios.get(url);
},
};
@@ -273,7 +273,7 @@ export default {
<div v-if="data.profilUpdates" class="row mb-3">
<div class="col">
<!-- MOBILE PROFIL UPDATES -->
<fetch-profil-updates @fetchUpdates="fetchProfilUpdates" :data="data.profilUpdates"></fetch-profil-updates>
<fetch-profil-updates v-if="data.profilUpdates && data.profilUpdates.length" @fetchUpdates="fetchProfilUpdates" :data="data.profilUpdates"></fetch-profil-updates>
</div>
</div>
@@ -438,7 +438,7 @@ export default {
<!-- PROFIL UPDATES -->
<fetch-profil-updates @fetchUpdates="fetchProfilUpdates" :data="data.profilUpdates"></fetch-profil-updates>
<fetch-profil-updates v-if="data.profilUpdates && data.profilUpdates.length" @fetchUpdates="fetchProfilUpdates" :data="data.profilUpdates"></fetch-profil-updates>
</div>
</div>
@@ -91,10 +91,14 @@ export default {
};
//?TODO: check if updateRequest.uid is a mitarbeiter, if so add the flag isMitarbeiter:true
/* if(view === "EditAdresse"){
const getMitarbeiter = await Vue.$fhcapi.UserData.getMitarbeiter(updateRequest.uid);
console.log(getMitarbeiter);
} */
if(view === "EditAdresse"){
console.log("uid",updateRequest.uid);
const isMitarbeiter = await Vue.$fhcapi.UserData.isMitarbeiter(updateRequest.uid).then(res => res.data);
console.log(typeof(isMitarbeiter));
if(isMitarbeiter){
content['isMitarbeiter']=isMitarbeiter;
}
}
//? adds the status information if the profil update request was rejected or accepted
if (updateRequest.status !== "pending") {
@@ -212,7 +212,7 @@ export default {
<div v-if="data.profilUpdates" class="row mb-3">
<div class="col">
<!-- MOBILE PROFIL UPDATES -->
<fetch-profil-updates @fetchUpdates="fetchProfilUpdates" :data="data.profilUpdates"></fetch-profil-updates>
<fetch-profil-updates v-if="data.profilUpdates && data.profilUpdates.length" @fetchUpdates="fetchProfilUpdates" :data="data.profilUpdates"></fetch-profil-updates>
</div>
</div>
@@ -398,7 +398,7 @@ export default {
<div v-if="data.profilUpdates" class="row d-none d-md-block mb-3">
<div class="col mb-3">
<!-- PROFIL UPDATES -->
<fetch-profil-updates @fetchUpdates="fetchProfilUpdates" :data="data.profilUpdates"></fetch-profil-updates>
<fetch-profil-updates v-if="data.profilUpdates && data.profilUpdates.length" @fetchUpdates="fetchProfilUpdates" :data="data.profilUpdates"></fetch-profil-updates>
</div>
</div>