| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import BaseMenu from '~/composables/layout/Menus/baseMenu'
- import { ItemMenu, ItemsMenu, Menu, organizationState } from '~/types/interfaces'
- import {useProfileOrganizationStore} from "~/store/profile/organization";
- import {useProfileAccessStore} from "~/store/profile/access";
- /**
- * @category composables/layout/Menus
- * @class WebsiteMenu
- * Classe pour la construction du Menu Sites internet
- */
- class WebsiteMenu extends BaseMenu implements Menu {
- /**
- * @constructor
- * Initialisation des services issues du context
- */
- constructor () {
- const {$config} = useNuxtApp()
- super($config)
- }
- /**
- * Construit le menu Site internet ou null si aucune page accessible
- * @return {ItemMenu | null}
- */
- getMenu (): ItemMenu | null {
- const profileOrganizationStore = useProfileOrganizationStore()
- const profileAccessStore = useProfileAccessStore()
- if (!profileOrganizationStore.website && profileAccessStore.isAdminAccess) {
- return this.constructMenu('advanced_modification', {name: 'fa-globe-americas'}, this.getWebsite(profileOrganizationStore) + '/typo3', false, undefined, true)
- }
- return null
- }
- /**
- * Construit le menu Header des Sites internet ou null si aucune page accessible
- * @return {ItemMenu | null}
- */
- getHeaderMenu (): ItemMenu | null {
- const profileOrganizationStore = useProfileOrganizationStore()
- const children: ItemsMenu = []
- children.push(this.constructMenu(profileOrganizationStore.name as string, undefined, this.getWebsite(profileOrganizationStore), false, undefined, true))
- useEach(profileOrganizationStore.parents, (parent:any) => {
- if(parent.id != process.env.OPENTALENT_MANAGER_ID){
- children.push(this.constructMenu(parent.name, undefined, this.getWebsite(parent), false, undefined, true))
- }
- })
- return children.length > 0 ? this.constructMenu('website', {name: 'fa-globe-americas'}, undefined, undefined, children) : null
- }
- getWebsite (organization: organizationState): string {
- return organization.website ?? '';
- }
- }
- export const getWebsiteMenu = () => new WebsiteMenu()
|