mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-14 07:49:35 +00:00
CisMenuApp fetch Authinfo, Cis search use isMitarbeiter flag to conditinally render Zeitsperren Button in search result
This commit is contained in:
@@ -2,6 +2,8 @@ import CisMenu from "../../components/Cis/Menu.js";
|
||||
import PluginsPhrasen from '../../plugins/Phrasen.js';
|
||||
import Theme from "../../plugins/Theme.js";
|
||||
|
||||
import ApiAuthinfo from "../../api/factory/authinfo.js";
|
||||
|
||||
const app = Vue.createApp({
|
||||
name: 'CisMenuApp',
|
||||
components: {
|
||||
@@ -9,11 +11,15 @@ const app = Vue.createApp({
|
||||
},
|
||||
data: () => ({
|
||||
windowWidth: 0,
|
||||
isStudent: null,
|
||||
isMitarbeiter: null,
|
||||
}),
|
||||
provide() {
|
||||
return {
|
||||
isNarrow: Vue.computed(() => this.windowWidth < 992),
|
||||
isMobile: Vue.computed(() => this.windowWidth < 767),
|
||||
isStudent: Vue.computed(() => this.isStudent),
|
||||
isMitarbeiter: Vue.computed(() => this.isMitarbeiter)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -21,8 +27,12 @@ const app = Vue.createApp({
|
||||
this.windowWidth = window.innerWidth;
|
||||
},
|
||||
},
|
||||
created() {
|
||||
async created() {
|
||||
this.windowWidth = window.innerWidth;
|
||||
await this.$api.call(ApiAuthinfo.getAuthInfo()).then((res) => {
|
||||
this.isMitarbeiter = res.data.isMitarbeiter;
|
||||
this.isStudent = res.data.isStudent;
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener("resize", this.handleWindowResize);
|
||||
|
||||
@@ -65,6 +65,10 @@ export default {
|
||||
label: Vue.computed(() => this.$p.t("profil/zeitsperren")),
|
||||
icon: "fas fa-calendar-days",
|
||||
type: "link",
|
||||
isMitarbeiter: Vue.computed(() => this.isMitarbeiter),
|
||||
renderif: function() {
|
||||
return this.isMitarbeiter;
|
||||
},
|
||||
action: function (data) {
|
||||
const uid = JSON.parse(data.data).uid;
|
||||
const link =
|
||||
@@ -163,7 +167,7 @@ export default {
|
||||
openMenuHierarchy: [],
|
||||
};
|
||||
},
|
||||
inject: ["isNarrow", "isMobile"],
|
||||
inject: ["isNarrow", "isMobile", "isMitarbeiter", "isStudent"],
|
||||
provide(){
|
||||
return{
|
||||
setActiveEntry: this.setActiveEntry,
|
||||
|
||||
Reference in New Issue
Block a user