| 1234567891011121314151617181920212223242526272829303132333435363738 |
- import {ItemMenu, ItemsMenu} from "~/types/types";
- import BaseMenu from "~/use/template/Menus/baseMenu";
- class StatsMenu extends BaseMenu{
- private $ability:any;
- constructor($config:any, $ability:any) {
- super($config)
- this.$ability = $ability
- }
- /**
- * Construit le menu Statistique et Dons ou null si aucune page accessible
- * @return {ItemMenu | null}
- */
- getMenu():ItemMenu | null {
- const children:ItemsMenu = [];
- if (this.$ability().can('display', 'report_activity_page')) {
- children.push(this.constructMenu('fa-chart-bar', 'report_activity', '/report_activity', true))
- }
- if (this.$ability().can('display', 'fede_stats_page')) {
- children.push(this.constructMenu('fa-chart-bar', 'fede_stats', '/statistic/membersfedeonly', true))
- }
- if (this.$ability().can('display', 'structure_stats_page')) {
- children.push(this.constructMenu('fa-chart-bar', 'structure_stats', '/statistic/membersfedeassos', true))
- }
- if(children.length === 1){
- return children[0];
- }
- return children.length > 0 ? this.constructMenu('fa-chart-bar', 'stats', undefined, undefined, children) : null;
- }
- }
- export const getStatsMenu = ($config:any, $ability:any) => new StatsMenu($config, $ability).getMenu()
|