| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import { ItemMenu, ItemsMenu, Menu } from '~/types/interfaces'
- import BaseMenu from '~/composables/layout/Menus/baseMenu'
- import {useAbility} from "@casl/vue";
- /**
- * @category composables/layout/Menus
- * @class Admin2iosMenu
- * Classe pour la construction du Menu Admin 2IOS
- */
- class Admin2iosMenu extends BaseMenu implements Menu {
- /**
- * @constructor
- * Initialisation des services issus du context
- */
- constructor () {
- const {$config} = useNuxtApp()
- super($config)
- }
- /**
- * Construit le menu Administration 2ios ou null si aucune page accessible
- * @return {ItemMenu | null}
- */
- getMenu (): ItemMenu | null {
- const {can} = useAbility()
- const children: ItemsMenu = []
- if (can('display', 'all_accesses_page')) {
- children.push(this.constructMenu('all_accesses', {name: 'fa-users'}, '/all_accesses/list/', true))
- }
- if (can('display', 'all_organizations_page')) {
- children.push(this.constructMenu('all_organizations', {name: 'fa-building'}, '/organization_params/list/', true))
- }
- if (can('display', 'tips_page')) {
- children.push(this.constructMenu('tips', {name: 'fa-info-circle'}, '/tips/list/', true))
- }
- if (can('display', 'dgv_page')) {
- children.push(this.constructMenu('dgv', {name: 'fa-house-damage'}, '/admin2ios/dgv', true))
- }
- if (can('display', 'cmf_cotisation_page')) {
- children.push(this.constructMenu('cmf_cotisation', {name: 'fa-info-circle'}, '/admin2ios/cotisationcmf', true))
- }
- if (can('display', 'right_page')) {
- children.push(this.constructMenu('right_menu', {name: 'fa-balance-scale-right'}, '/admin2ios/right', true))
- }
- if (can('display', 'tree_page')) {
- children.push(this.constructMenu('tree_menu', {name: 'fa-sitemap'}, '/admin2ios/tree', true))
- }
- if (children.length === 1) {
- return children[0]
- } else if (children.length > 0) {
- return this.constructMenu('admin2ios', {name: 'fa-sitemap'}, undefined, undefined, children)
- } else {
- return null
- }
- }
- }
- export const getAdmin2iosMenu = () => new Admin2iosMenu().getMenu()
|