| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import AbstractMenuBuilder from '~/services/layout/menuBuilder/abstractMenuBuilder'
- import type {MenuGroup, MenuItem, MenuItems} from "~/types/layout";
- import {MENU_LINK_TYPE} from "~/types/enum/layout";
- /**
- * Menu Admin 2IOS
- */
- export default class Admin2iosMenuBuilder extends AbstractMenuBuilder {
- static readonly menuName = "Admin2ios"
- /**
- * Construit le menu Administration 2ios ou null si aucune page accessible
- */
- build (): MenuItem | MenuGroup | null {
- const children: MenuItems = []
- if (this.ability.can('display', 'all_accesses_page')) {
- children.push(this.createItem('all_accesses', {name: 'fas fa-users'}, '/all_accesses/list/', MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'all_organizations_page')) {
- children.push(this.createItem('all_organizations', {name: 'fas fa-building'}, '/organization_params/list/', MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'tips_page')) {
- children.push(this.createItem('tips', {name: 'fas fa-info-circle'}, '/tips/list/', MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'dgv_page')) {
- children.push(this.createItem('dgv', {name: 'fas fa-house-damage'}, '/admin2ios/dgv', MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'cmf_cotisation_page')) {
- children.push(this.createItem('cmf_cotisation', {name: 'fas fa-info-circle'}, '/admin2ios/cotisationcmf', MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'right_page')) {
- children.push(this.createItem('right_menu', {name: 'fas fa-balance-scale-right'}, '/admin2ios/right', MENU_LINK_TYPE.V1))
- }
- if (this.ability.can('display', 'tree_page')) {
- children.push(this.createItem('tree_menu', {name: 'fas fa-sitemap'}, '/admin2ios/tree', MENU_LINK_TYPE.V1))
- }
- if (children.length > 1) {
- // Plusieurs éléments, on retourne un groupe
- return this.createGroup('admin2ios', {name: 'fas fa-sitemap'}, children)
- }
- else if (children.length === 1) {
- // Un seul élément, on retourne cet élément seul
- return children[0]
- }
- return null
- }
- }
|