change fh logo visibility breakpoint class md -> sm; editable flag in profile based on looking at own profile or being an admin; scrollbar calc in profil app;

This commit is contained in:
Johann Hoffmann
2024-11-13 17:27:50 +01:00
parent 2fd39a9d18
commit 9042f9b83b
8 changed files with 34 additions and 11 deletions
@@ -34,7 +34,8 @@ class Profil extends FHCAPI_Controller
'isMitarbeiter' => self::PERM_LOGGED,
]);
$this->load->library('PermissionLib');
$this->load->model('ressource/mitarbeiter_model', 'MitarbeiterModel');
$this->load->model('crm/Student_model', 'StudentModel');
@@ -69,6 +70,7 @@ class Profil extends FHCAPI_Controller
public function getView($uid)
{
$res = new stdClass();
$editAllowed = getAuthUID() == $uid || $this->permissionlib->isBerechtigt('admin');
// if parsing the URL did not found a UID then the UID of the logged in user is used
if ($uid == "Profil" || $uid == $this->uid) {
@@ -86,6 +88,8 @@ class Profil extends FHCAPI_Controller
$res->data = $this->studentProfil();
$res->data->pid = $this->pid;
}
$editAllowed = true;
}
// UID is availabe when accessing Profil/View/:uid
else {
@@ -112,6 +116,7 @@ class Profil extends FHCAPI_Controller
$res->data = $this->viewStudentProfil($uid);
}
}
$res->data->editAllowed = $editAllowed;
$this->terminateWithSuccess($res);
}
+2 -1
View File
@@ -4,6 +4,7 @@ import ViewStudentProfil from "../../components/Cis/Profil/StudentViewProfil.js"
import ViewMitarbeiterProfil from "../../components/Cis/Profil/MitarbeiterViewProfil.js";
import Loading from "../../components/Loader.js";
import Phrasen from "../../plugin/Phrasen.js";
import { setScrollbarWidth } from "../../helpers/CssVarCalcHelpers";
Vue.$collapseFormatter = function (data) {
@@ -400,7 +401,7 @@ const profilApp = Vue.createApp({
</div>`,
});
setScrollbarWidth()
profilApp
.use(primevue.config.default, { zIndex: { overlay: 9999 } })
.use(Phrasen)
+1 -1
View File
@@ -124,7 +124,7 @@ export default {
<span class="navbar-toggler-icon"></span>
</button>
<fhc-searchbar @showSettings="toggleCollapsibles" ref="searchbar" id="nav-search" class="fhc-searchbar w-100" :searchoptions="searchbaroptions" :searchfunction="searchfunction" :selectedtypes="selectedtypes"></fhc-searchbar>
<a id="nav-logo" class="d-none d-md-block" :href="rootUrl">
<a id="nav-logo" class="d-none d-sm-block" :href="rootUrl">
<img :src="logoUrl" alt="Logo">
</a>
<div id="nav-user">
@@ -195,6 +195,9 @@ export default {
},
computed: {
editable() {
return this.data?.editAllowed ?? false;
},
filteredEditData() {
return this.editDataFilter
? this.editData.data[this.editDataFilter]
@@ -299,7 +302,7 @@ export default {
<div class="col">
<!-- PROFIL INFORMATION -->
<profil-information @showEditProfilModal="showEditProfilModal" :title="$p.t('profil','mitarbeiterIn')" :data="profilInformation"></profil-information>
<profil-information @showEditProfilModal="showEditProfilModal" :title="$p.t('profil','mitarbeiterIn')" :data="profilInformation" :editable="editable"></profil-information>
</div>
@@ -93,6 +93,10 @@ export default {
},
computed: {
editable() {
return this.data?.editAllowed ?? false;
},
personEmails() {
return this.data?.emails ? this.data.emails : [];
},
@@ -161,7 +165,7 @@ export default {
<div class="col">
<!-- Profil Informationen -->
<profil-information :title="$p.t('profil','mitarbeiterIn')" :data="profilInformation"></profil-information>
<profil-information :title="$p.t('profil','mitarbeiterIn')" :data="profilInformation" :editable="editable"></profil-information>
</div>
</div>
@@ -6,6 +6,10 @@ export default {
data: {
type: Object,
},
editable: {
type: Boolean,
default: false
}
},
data() {
return {
@@ -56,7 +60,7 @@ export default {
<div class="card h-100">
<div class="card-header">
<div class="row">
<div @click="$emit('showEditProfilModal','Personen_Informationen')" class="col-auto" type="button">
<div v-if="editable" @click="$emit('showEditProfilModal','Personen_Informationen')" class="col-auto" type="button">
<i class="fa fa-edit"></i>
</div>
<div class="col">
@@ -77,7 +81,7 @@ export default {
<!-- LOCKING IMAGE FUNCTIONALITY -->
<div role="button" @click.prevent="sperre_foto_function" class="image-lock" >
<div v-if="editable" role="button" @click.prevent="sperre_foto_function" class="image-lock" >
<i :class="{'fa':true, ...(FotoSperre?{'fa-lock':true}:{'fa-lock-open':true})} " ></i>
</div>
@@ -139,6 +139,10 @@ export default {
},
computed: {
editable() {
return this.data?.editAllowed ?? false;
},
filteredEditData() {
return this.editDataFilter
? this.editData.data[this.editDataFilter]
@@ -204,8 +208,7 @@ export default {
</div>
<!-- Bearbeiten Button -->
<div class="row ">
<div v-if="editable" class="row ">
<div class="col mb-3">
<button @click="showEditProfilModal" type="button" class="text-start w-100 btn btn-outline-secondary" >
@@ -248,7 +251,7 @@ export default {
<div class="col">
<!-- PROFIL INFORMATION -->
<profil-information @showEditProfilModal="showEditProfilModal" :title="$p.t('profil','studentIn')" :data="profilInformation"></profil-information>
<profil-information @showEditProfilModal="showEditProfilModal" :title="$p.t('profil','studentIn')" :data="profilInformation" :editable="editable"></profil-information>
</div>
@@ -20,6 +20,9 @@ export default {
methods: {},
computed: {
editable() {
return this.data?.editAllowed ?? false;
},
profilInformation() {
if (!this.data) {
return {};
@@ -89,7 +92,7 @@ export default {
<div class="row mb-4">
<div class="col">
<profil-information :data="profilInformation" :title="$p.t('profil','studentIn')"></profil-information>
<profil-information :data="profilInformation" :title="$p.t('profil','studentIn')" :editable="editable"></profil-information>
</div>
</div>