import {ItemMenu, ItemsMenu} from "~/types/types"; import BaseMenu from "~/use/template/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('fa-users', 'all_accesses', '/all_accesses/list/', true)) } if (this.$ability().can('display', 'all_organizations_page')) { children.push(this.constructMenu('fa-building', 'all_organizations', '/organization_params/list/', true)) } if (this.$ability().can('display', 'tips_page')) { children.push(this.constructMenu('fa-info-circle', 'tips', '/tips/list/', true)) } if (this.$ability().can('display', 'actions_lead_page')) { children.push(this.constructMenu('fa-comments-dollar', 'actions_lead', '/admin2ios/actions_lead', true)) } if (this.$ability().can('display', 'renewall_list_page')) { children.push(this.constructMenu('fa-sync', 'renewall_list', '/admin2ios/renewalllist', true)) } if (this.$ability().can('display', 'settlements_page')) { children.push(this.constructMenu('fa-euro-sign', 'settlements', '/admin2ios/settlements', true)) } if (this.$ability().can('display', 'pendings_settlements_page')) { children.push(this.constructMenu('fa-euro-sign', 'pendings_settlements', '/admin2ios/pendings_settlements', true)) } if (this.$ability().can('display', 'outages_notice_page')) { children.push(this.constructMenu('fa-cut', 'outages_notice', '/admin2ios/outagesnotice', true)) } if (this.$ability().can('display', 'degraded_page')) { children.push(this.constructMenu('fa-users', 'degraded', '/admin2ios/degraded', true)) } if (this.$ability().can('display', 'dgv_page')) { children.push(this.constructMenu('fa-house-damage', 'dgv', '/admin2ios/dgv', true)) } if (this.$ability().can('display', 'cmf_cotisation_page')) { children.push(this.constructMenu('fa-info-circle', 'cmf_cotisation', '/admin2ios/cotisationcmf', true)) } if (this.$ability().can('display', 'right_page')) { children.push(this.constructMenu('fa-balance-scale-right', 'right_menu', '/admin2ios/right', true)) } if (this.$ability().can('display', 'tree_page')) { children.push(this.constructMenu('fa-sitemap', 'tree_menu', '/admin2ios/tree', true)) } if(children.length === 1){ return children[0]; } return children.length > 0 ? this.constructMenu('fa-sitemap', 'admin2ios', undefined, undefined, children) : null; } } export const getAdmin2iosMenu = ($config:any, $ability:any) => new Admin2iosMenu($config, $ability).getMenu()