import { ItemMenu, ItemsMenu, Menu } from '~/types/interfaces' import BaseMenu from '~/composables/layout/Menus/baseMenu' import {useProfileOrganizationStore} from "~/store/profile/organization"; import {useAbility} from "@casl/vue"; /** * @category composables/layout/Menus * @class ConfigurationMenu * Classe pour la construction du Menu Paramètres */ class ConfigurationMenu extends BaseMenu implements Menu { /** * Construit le menu Header Configuration ou null si aucune page accessible * @return {ItemMenu | null} */ getHeaderMenu (): ItemMenu | null { const {can} = useAbility() const profileOrganizationStore = useProfileOrganizationStore() const children: ItemsMenu = [] if (can('display', 'organization_page')) { // children.push(this.constructMenu('organization_page', undefined, `/main/organizations/${profileOrganizationStore.id}/dashboard`, true)) children.push(this.constructMenuItem('organization_page', undefined, `/organization`, false)) } if (can('display', 'cmf_licence_page')) { children.push(this.constructMenuItem('cmf_licence_generate', undefined, '/cmf_licence/organization')) } if (can('display', 'parameters_page')) { // children.push(this.constructMenu('parameters', undefined,`/main/edit/parameters/${profileOrganizationStore.id}`, true)) children.push(this.constructMenuItem('parameters', undefined,`/parameters`, false)) } if (can('display', 'place_page')) { children.push(this.constructMenuItem('place', undefined, '/places/list/', true)) } if (can('display', 'education_page')) { children.push(this.constructMenuItem('education', undefined, '/educations/list/', true)) } if (can('display', 'tag_page')) { children.push(this.constructMenuItem('tag', undefined, '/taggs/list/', true)) } if (can('display', 'activities_page')) { children.push(this.constructMenuItem('activities', undefined, '/activities/list/', true)) } if (can('display', 'template_systems_page')) { children.push(this.constructMenuItem('template_systems', undefined,'/template_systems/list/', true)) } if (can('display', 'billing_settings_page')) { children.push(this.constructMenuItem('billing_settings', undefined, '/main/edit/billing_settings/' + profileOrganizationStore.id, true)) } if (can('display', 'online_registration_settings_page')) { children.push(this.constructMenuItem('online_registration_settings', undefined, '/main/edit/online_registration_settings/' + profileOrganizationStore.id, true)) } if (can('display', 'transition_next_year_page')) { children.push(this.constructMenuItem('transition_next_year', undefined, '/transition_next_year', true)) } if (can('display', 'course_duplication_page')) { children.push(this.constructMenuItem('course_duplication', undefined, '/duplicate_courses', true)) } if (can('display', 'import_page')) { children.push(this.constructMenuItem('import', undefined, '/import/all', true)) } if (children.length === 1) { return children[0] } else if (children.length > 0) { return this.constructMenuItem('configuration', {name: 'fa-cogs'}, undefined, undefined, children) } else { return null } } } export const getConfigurationMenu = () => new ConfigurationMenu().getHeaderMenu()