| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import {ItemMenu, ItemsMenu} from "~/types/types";
- import BaseMenu from "~/use/layout/Menus/baseMenu";
- class ConfigurationMenu extends BaseMenu{
- private $ability:any;
- private $store:any;
- constructor($config:any, $ability:any, $store: any) {
- super($config)
- this.$ability = $ability
- this.$store = $store
- }
- /**
- * Construit le menu Header Configuration ou null si aucune page accessible
- * @return {ItemMenu | null}
- */
- getHeaderMenu():ItemMenu | null {
- const children:ItemsMenu = [];
- if (this.$ability().can('display', 'organization_page')) {
- children.push(this.constructMenu('organization_page', undefined,'/organization/edit'))
- }
- if (this.$ability().can('display', 'cmf_licence_page')) {
- children.push(this.constructMenu('cmf_licence_generate', undefined,'/attendances/list/', true))
- }
- if (this.$ability().can('display', 'parameters_page')) {
- children.push(this.constructMenu('parameters', undefined,'/configuration/parameters'))
- }
- if (this.$ability().can('display', 'place_page')) {
- children.push(this.constructMenu('place', undefined,'/places/list/', true))
- }
- if (this.$ability().can('display', 'education_page')) {
- children.push(this.constructMenu('education', undefined,'/educations/list/', true))
- }
- if (this.$ability().can('display', 'tag_page')) {
- children.push(this.constructMenu('tag', undefined,'/taggs/list/', true))
- }
- if (this.$ability().can('display', 'activities_page')) {
- children.push(this.constructMenu('activities', undefined,'/activities/list/', true))
- }
- if (this.$ability().can('display', 'billing_settings_page')) {
- children.push(this.constructMenu('billing_settings', undefined,'/billing_settings/' + this.$store.state.profile.organization.id, true))
- }
- if (this.$ability().can('display', 'online_registration_settings_page')) {
- children.push(this.constructMenu('online_registration_settings', undefined,'/online_registration_settings/' + this.$store.state.profile.organization.id, true))
- }
- if (this.$ability().can('display', 'transition_next_year_page')) {
- children.push(this.constructMenu('transition_next_year', undefined,'/attendances/list/', true))
- }
- if (this.$ability().can('display', 'course_duplication_page')) {
- children.push(this.constructMenu('course_duplication', undefined,'/duplicate_courses/', true))
- }
- if (this.$ability().can('display', 'import_page')) {
- children.push(this.constructMenu('import', undefined,'/import/all/', true))
- }
- return children.length > 0 ? this.constructMenu('configuration', 'fa-cogs', undefined, undefined, children) : null;
- }
- }
- export const getConfigurationMenu = ($config:any, $ability:any, $store:any) => new ConfigurationMenu($config, $ability, $store).getHeaderMenu()
|