import AbstractMenuBuilder from '~/services/menuBuilder/abstractMenuBuilder' import {MenuGroup, MenuItems} from "~/types/layout"; import {MENU_LINK_TYPE} from "~/types/enum/layout"; import {useEach} from "#imports"; /** * Menu : Liste des sites internet de la structure et de ses structures parentes */ export default class WebsiteListMenuBuilder extends AbstractMenuBuilder { static readonly menuName = "WebsiteList" /** * Construit le menu Site internet, ou null si aucune page accessible */ build(): MenuGroup | null { const children: MenuItems = [] const url = this.organizationProfile.website + '/typo3' children.push(this.createItem(this.organizationProfile.name as string, undefined, url, MENU_LINK_TYPE.V1)) useEach(this.organizationProfile.parents, (parent:any) => { if(parent.id != process.env.OPENTALENT_MANAGER_ID){ children.push(this.createItem(parent.name, undefined, parent.website, MENU_LINK_TYPE.EXTERNAL)) } }) if (children.length > 0) { return this.createGroup('websiteList', {name: 'fas fa-globe-americas'}, children) } return null } }