| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import {ItemMenu, ItemsMenu} from "~/types/interfaces";
- import BaseMenu from "~/use/layout/Menus/baseMenu";
- class Admin2iosMenu extends BaseMenu{
- private $ability:any;
- constructor($config:any, $ability:any) {
- super($config)
- this.$ability = $ability
- }
- /**
- * Construit le menu Administration 2ios ou null si aucune page accessible
- * @return {ItemMenu | null}
- */
- getMenu():ItemMenu | null {
- const children:ItemsMenu = [];
- if (this.$ability().can('display', 'all_accesses_page')) {
- children.push(this.constructMenu('all_accesses', 'fa-users', '/all_accesses/list/', true))
- }
- if (this.$ability().can('display', 'all_organizations_page')) {
- children.push(this.constructMenu('all_organizations', 'fa-building', '/organization_params/list/', true))
- }
- if (this.$ability().can('display', 'tips_page')) {
- children.push(this.constructMenu('tips', 'fa-info-circle', '/tips/list/', true))
- }
- if (this.$ability().can('display', 'dgv_page')) {
- children.push(this.constructMenu('dgv', 'fa-house-damage', '/admin2ios/dgv', true))
- }
- if (this.$ability().can('display', 'cmf_cotisation_page')) {
- children.push(this.constructMenu('cmf_cotisation', 'fa-info-circle', '/admin2ios/cotisationcmf', true))
- }
- if (this.$ability().can('display', 'right_page')) {
- children.push(this.constructMenu('right_menu', 'fa-balance-scale-right', '/admin2ios/right', true))
- }
- if (this.$ability().can('display', 'tree_page')) {
- children.push(this.constructMenu('tree_menu', 'fa-sitemap', '/admin2ios/tree', true))
- }
- if(children.length === 1){
- return children[0];
- }
- return children.length > 0 ? this.constructMenu('admin2ios', 'fa-sitemap', undefined, undefined, children) : null;
- }
- }
- export const getAdmin2iosMenu = ($config:any, $ability:any) => new Admin2iosMenu($config, $ability).getMenu()
|