|
|
@@ -1,140 +1,114 @@
|
|
|
<!--
|
|
|
-Header de l'application, contient entre autres le nom de l'organisation, l'accès à l'aide
|
|
|
-et aux préférences de l'utilisateur
|
|
|
+Header de l'application
|
|
|
+Contient entre autres le nom de l'organisation, l'accès à l'aide et aux préférences de l'utilisateur
|
|
|
-->
|
|
|
|
|
|
<template>
|
|
|
<v-app-bar
|
|
|
- clipped-left
|
|
|
- elevate-on-scroll
|
|
|
- dense
|
|
|
- fixed
|
|
|
- app
|
|
|
- class="ot-green ot-white--text"
|
|
|
+ order="0"
|
|
|
+ density="compact"
|
|
|
+ class="bg-ot-green text-ot-white"
|
|
|
>
|
|
|
- <v-btn
|
|
|
- v-if="displayedMiniVariant"
|
|
|
- class="menu-btn d-none d-sm-none d-sm-none d-md-none d-lg-flex" icon @click.stop="displayedMiniMenu()"
|
|
|
- >
|
|
|
- <v-icon class="ot-white--text">
|
|
|
- mdi-menu{{ `${properties.miniVariant ? '' : '-open'}` }}
|
|
|
- </v-icon>
|
|
|
- </v-btn>
|
|
|
-
|
|
|
- <v-btn class="menu-btn d-sm-flex d-md-flex d-lg-none" icon @click.stop="displayedMenu()">
|
|
|
- <v-icon class="ot-white--text">
|
|
|
- mdi-menu
|
|
|
- </v-icon>
|
|
|
- </v-btn>
|
|
|
+ <template #prepend>
|
|
|
+ <v-app-bar-nav-icon
|
|
|
+ v-if="hasMenu('Main')"
|
|
|
+ :icon="isMenuOpened('Main') ? 'mdi:mdi-menu-open' : 'mdi:mdi-menu'"
|
|
|
+ class="text-ot-white"
|
|
|
+ @click="toggleMenu('Main')"
|
|
|
+ >
|
|
|
+ </v-app-bar-nav-icon>
|
|
|
+
|
|
|
+ <!-- :icon="isMenuOpened('Main') ? 'fas fa-angle-left' : 'fas fa-bars'"-->
|
|
|
+ </template>
|
|
|
|
|
|
<v-toolbar-title v-text="title" />
|
|
|
|
|
|
<v-spacer />
|
|
|
|
|
|
- <LayoutHeaderUniversalCreationCreateButton v-if="showUniversalButton" />
|
|
|
-
|
|
|
- <v-tooltip bottom>
|
|
|
- <template #activator="{ on, attrs }">
|
|
|
- <v-btn
|
|
|
- icon
|
|
|
- class="ml-2"
|
|
|
- v-bind="attrs"
|
|
|
- v-on="on"
|
|
|
- >
|
|
|
- <a class="no-decoration" :href="properties.homeUrl + '/'"><v-icon class="ot-white--text" small>fa-home</v-icon></a>
|
|
|
- </v-btn>
|
|
|
- </template>
|
|
|
- <span>{{ $t('welcome') }}</span>
|
|
|
+<!-- <LayoutHeaderUniversalCreationCreateButton v-if="showUniversalButton" />-->
|
|
|
+
|
|
|
+ <v-tooltip text="$t('welcome')" bottom>
|
|
|
+ <v-btn
|
|
|
+ icon="far fa-home"
|
|
|
+ :href="homeUrl"
|
|
|
+ class="ml-2 text-ot-white"
|
|
|
+ ></v-btn>
|
|
|
</v-tooltip>
|
|
|
|
|
|
- <LayoutHeaderMenu :menu="webSiteMenu" />
|
|
|
+<!-- <LayoutHeaderMenu :menu="webSiteMenu" />-->
|
|
|
|
|
|
- <LayoutHeaderMenu v-if="hasAccessesMenu" :menu="myAccessesMenu" />
|
|
|
+<!-- <LayoutHeaderMenu v-if="hasAccessesMenu" :menu="myAccessesMenu" />-->
|
|
|
|
|
|
- <LayoutHeaderMenu v-if="hasFamilyMenu" :menu="myFamilyMenu" />
|
|
|
+<!-- <LayoutHeaderMenu v-if="hasFamilyMenu" :menu="myFamilyMenu" />-->
|
|
|
|
|
|
- <LayoutHeaderNotification />
|
|
|
+<!-- <LayoutHeaderNotification />-->
|
|
|
|
|
|
- <LayoutHeaderMenu v-if="hasConfigurationMenu" :menu="configurationMenu" />
|
|
|
+<!-- <LayoutHeaderMenu v-if="hasConfigurationMenu" :menu="configurationMenu" />-->
|
|
|
|
|
|
- <LayoutHeaderMenu :menu="accountMenu"/>
|
|
|
+<!-- <LayoutHeaderMenu :menu="accountMenu"/>-->
|
|
|
|
|
|
- <a class="text-body pa-3 ml-2 ot-dark_grey ot-white--text text-decoration-none" href="https://support.opentalent.fr/" target="_blank">
|
|
|
+ <a
|
|
|
+ href="https://support.opentalent.fr/"
|
|
|
+ class="text-body pa-3 ml-2 ot-dark-grey text-ot-white text-decoration-none"
|
|
|
+ target="_blank"
|
|
|
+ >
|
|
|
+ <!-- TODO: mettre le lien vers le support dans les .env ou dans la conf -->
|
|
|
<span class="d-none d-sm-none d-md-flex">{{ $t('help_access') }}</span>
|
|
|
- <v-icon class="d-sm-flex d-md-none" color="white">fas fa-question-circle</v-icon>
|
|
|
+ <v-icon icon="fas fa-question-circle" class="d-sm-flex d-md-none" color="white"></v-icon>
|
|
|
</a>
|
|
|
</v-app-bar>
|
|
|
</template>
|
|
|
|
|
|
-<script lang="ts">
|
|
|
-import {
|
|
|
- defineComponent, reactive, useContext, computed, ComputedRef, Ref, UnwrapRef
|
|
|
-} from '@nuxtjs/composition-api'
|
|
|
-import { $useMenu } from '~/composables/layout/menu'
|
|
|
-import { AnyJson } from '~/types/interfaces'
|
|
|
-
|
|
|
-export default defineComponent({
|
|
|
- setup (_props, { emit }) {
|
|
|
- const { store, $config,$ability } = useContext()
|
|
|
-
|
|
|
- const properties:UnwrapRef<AnyJson> = reactive({
|
|
|
- miniVariant: false,
|
|
|
- openMenu: false,
|
|
|
- homeUrl: $config.baseURL_adminLegacy
|
|
|
- })
|
|
|
-
|
|
|
- const displayedMiniVariant:ComputedRef<boolean> = computed(() => store.state.profile.access.hasLateralMenu)
|
|
|
- const hasConfigurationMenu:ComputedRef<boolean> = computed(() => store.state.profile.access.hasConfigurationMenu)
|
|
|
- const hasAccessesMenu:ComputedRef<boolean> = computed(() => store.state.profile.access.hasAccessesMenu)
|
|
|
- const hasFamilyMenu:ComputedRef<boolean> = computed(() => store.state.profile.access.hasFamilyMenu)
|
|
|
- const title:ComputedRef<string> = computed(() => store.state.profile.organization.name)
|
|
|
-
|
|
|
- const webSiteMenu:Ref<any> = $useMenu.setupContext().useWebSiteMenuConstruct()
|
|
|
- const myAccessesMenu:Ref<any> = $useMenu.setupContext().useMyAccessesMenuConstruct()
|
|
|
- const myFamilyMenu:Ref<any> = $useMenu.setupContext().useMyFamilyMenuConstruct()
|
|
|
- const configurationMenu:Ref<any> = $useMenu.setupContext().useConfigurationMenuConstruct()
|
|
|
- const accountMenu:Ref<any> = $useMenu.setupContext().useAccountMenuConstruct()
|
|
|
-
|
|
|
- const displayedMiniMenu = () => {
|
|
|
- properties.miniVariant = !properties.miniVariant
|
|
|
- emit('handle-open-mini-menu-click', properties.miniVariant)
|
|
|
- }
|
|
|
-
|
|
|
- const displayedMenu = () => {
|
|
|
- properties.openMenu = !properties.openMenu
|
|
|
- emit('handle-open-menu-click', properties.openMenu )
|
|
|
- }
|
|
|
-
|
|
|
- const showUniversalButton =
|
|
|
- $ability.can('manage', 'users')
|
|
|
- || $ability.can('manage', 'courses')
|
|
|
- || $ability.can('manage', 'examens')
|
|
|
- || $ability.can('manage', 'educationalprojects')
|
|
|
- || $ability.can('manage', 'events')
|
|
|
- || $ability.can('manage', 'emails')
|
|
|
- || $ability.can('manage', 'mails')
|
|
|
- || $ability.can('manage', 'texto')
|
|
|
- || $ability.can('display', 'message_send_page')
|
|
|
- || $ability.can('manage', 'equipments') ;
|
|
|
-
|
|
|
- return {
|
|
|
- properties,
|
|
|
- displayedMiniVariant,
|
|
|
- hasConfigurationMenu,
|
|
|
- hasAccessesMenu,
|
|
|
- hasFamilyMenu,
|
|
|
- title,
|
|
|
- displayedMiniMenu,
|
|
|
- displayedMenu,
|
|
|
- webSiteMenu,
|
|
|
- myAccessesMenu,
|
|
|
- myFamilyMenu,
|
|
|
- configurationMenu,
|
|
|
- accountMenu,
|
|
|
- showUniversalButton
|
|
|
- }
|
|
|
- }
|
|
|
-})
|
|
|
+<script setup lang="ts">
|
|
|
+
|
|
|
+import {computed, ComputedRef, Ref} from "@vue/reactivity";
|
|
|
+import {useMenuBuilder} from "~/composables/layout/useMenuBuilder";
|
|
|
+import {useAbility} from "@casl/vue";
|
|
|
+import {usePageStore} from "~/store/page";
|
|
|
+import {useOrganizationProfileStore} from "~/store/profile/organization";
|
|
|
+import {useRuntimeConfig} from "#app";
|
|
|
+
|
|
|
+const organizationProfile = useOrganizationProfileStore()
|
|
|
+
|
|
|
+const title: ComputedRef<string> = computed(() => organizationProfile.name ?? 'Opentalent')
|
|
|
+
|
|
|
+const { buildAccountMenu, buildWebsiteListMenu, buildMyFamilyMenu, buildConfigurationMenu, buildMyAccessesMenu, hasMenu } = useMenuBuilder()
|
|
|
+
|
|
|
+const webSiteMenu: Ref<any> = buildWebsiteListMenu()
|
|
|
+const myAccessesMenu: Ref<any> = buildMyAccessesMenu()
|
|
|
+const myFamilyMenu: Ref<any> = buildMyFamilyMenu()
|
|
|
+const configurationMenu: Ref<any> = buildConfigurationMenu()
|
|
|
+const accountMenu: Ref<any> = buildAccountMenu()
|
|
|
+
|
|
|
+const pageState = usePageStore()
|
|
|
+
|
|
|
+const isMenuOpened = (name: string): boolean => {
|
|
|
+ return pageState.menusOpened[name]
|
|
|
+}
|
|
|
+
|
|
|
+const toggleMenu = (name: string) => {
|
|
|
+ console.log('toggle menu ' + name)
|
|
|
+ pageState.menusOpened[name] = !pageState.menusOpened[name]
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+const runtimeConfig = useRuntimeConfig()
|
|
|
+const homeUrl = runtimeConfig.baseUrlAdminLegacy
|
|
|
+
|
|
|
+const { can } = useAbility()
|
|
|
+
|
|
|
+const showUniversalButton =
|
|
|
+ can('manage', 'users')
|
|
|
+ || can('manage', 'courses')
|
|
|
+ || can('manage', 'examens')
|
|
|
+ || can('manage', 'educationalprojects')
|
|
|
+ || can('manage', 'events')
|
|
|
+ || can('manage', 'emails')
|
|
|
+ || can('manage', 'mails')
|
|
|
+ || can('manage', 'texto')
|
|
|
+ || can('display', 'message_send_page')
|
|
|
+ || can('manage', 'equipments') ;
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|