| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- import AbstractMenuBuilder from '~/services/menuBuilder/abstractMenuBuilder'
- import {MenuGroup, MenuItem, MenuItems} from "~/types/layout";
- import {MENU_LINK_TYPE} from "~/types/enum/layout";
- /**
- * Classe pour la construction du Menu Paramètres
- */
- export default class ConfigurationMenuBuilder extends AbstractMenuBuilder {
- name() {
- return 'Configuration'
- }
- /**
- * Construit le menu Header Configuration ou null si aucune page accessible
- */
- build (): MenuItem | MenuGroup | null {
- const children: MenuItems = []
- if (this.ability.can('display', 'organization_page')) {
- children.push(this.createItem('organization_page', undefined, `/organization`, MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'cmf_licence_page')) {
- children.push(this.createItem('cmf_licence_generate', undefined, '/cmf_licence/organization', MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'parameters_page')) {
- children.push(this.createItem('parameters', undefined,`/parameters`, MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'place_page')) {
- children.push(this.createItem('place', undefined, '/places/list/', MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'education_page')) {
- children.push(this.createItem('education', undefined, '/educations/list/', MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'tag_page')) {
- children.push(this.createItem('tag', undefined, '/taggs/list/', MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'activities_page')) {
- children.push(this.createItem('activities', undefined, '/activities/list/', MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'template_systems_page')) {
- children.push(this.createItem('template_systems', undefined,'/template_systems/list/', MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'billing_settings_page')) {
- children.push(this.createItem('billing_settings', undefined, '/main/edit/billing_settings/' + this.organizationProfile.id, MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'online_registration_settings_page')) {
- children.push(this.createItem('online_registration_settings', undefined, '/main/edit/online_registration_settings/' + this.organizationProfile.id, MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'transition_next_year_page')) {
- children.push(this.createItem('transition_next_year', undefined, '/transition_next_year', MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'course_duplication_page')) {
- children.push(this.createItem('course_duplication', undefined, '/duplicate_courses', MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'import_page')) {
- children.push(this.createItem('import', undefined, '/import/all', MENU_LINK_TYPE.V1))
- }
- if (children.length > 1) {
- // Plusieurs éléments, on retourne un groupe
- return this.createGroup('configuration', {name: 'fas fa-cogs'}, children)
- }
- else if (children.length === 1) {
- // Un seul élément, on retourne cet élément seul
- return children[0]
- }
- return null
- }
- }
|