myFamilyMenu.ts 940 B

1234567891011121314151617181920212223242526272829
  1. import {ItemMenu, ItemsMenu} from "~/types/types";
  2. import BaseMenu from "~/use/layout/Menus/baseMenu";
  3. class MyFamilyMenu extends BaseMenu{
  4. private $ability:any;
  5. private $store:any;
  6. constructor($config:any, $ability:any, $store: any) {
  7. super($config)
  8. this.$ability = $ability
  9. this.$store = $store
  10. }
  11. /**
  12. * Construit le menu Header Configuration ou null si aucune page accessible
  13. * @return {ItemMenu | null}
  14. */
  15. getHeaderMenu():ItemMenu | null {
  16. const children:ItemsMenu = [];
  17. if (this.$ability().can('display', 'organization_page')) {
  18. children.push(this.constructMenu('organization_page', undefined,'/organization/edit'))
  19. }
  20. return children.length > 0 ? this.constructMenu('configuration', 'fa-users', undefined, undefined, children) : null;
  21. }
  22. }
  23. export const getMyFamilyMenu = ($config:any, $ability:any, $store:any) => new MyFamilyMenu($config, $ability, $store).getHeaderMenu()