import { ItemMenu, ItemsMenu, Menu } from '~/types/interfaces' import BaseMenu from '~/composables/layout/Menus/baseMenu' import {useAbility} from "@casl/vue"; /** * @category composables/layout/Menus * @class EducationalMenu * Classe pour la construction du Menu Suivi pédagogique */ class EducationalMenu extends BaseMenu implements Menu { /** * @constructor * Initialisation des services issues du context */ constructor () { const {$config} = useNuxtApp() super($config) } /** * Construit le menu Suivi pédagogique ou null si aucune page accessible * @return {ItemMenu | null} */ getMenu (): ItemMenu | null { const {can} = useAbility() const children: ItemsMenu = [] if (can('display', 'criteria_notations_page')) { children.push(this.constructMenu('criteria_notations', {name: 'fa-bars'}, '/criteria_notations/list/', true)) } if (can('display', 'education_notation_config_page')) { children.push(this.constructMenu('education_notation_configs', {name: 'fa-bars'}, '/education_notation_configs/list/', true)) } if (can('display', 'seizure_period_page')) { children.push(this.constructMenu('seizure_period', {name: 'fa-calendar-alt'}, '/education_teachers/list/', true)) } if (can('display', 'test_seizure_page')) { children.push(this.constructMenu('test_seizure', {name: 'fa-pencil-alt'}, '/education_input/list/', true)) } if (can('display', 'test_validation_page')) { children.push(this.constructMenu('test_validation', {name: 'fa-check'}, '/education_notations/list/', true)) } if (can('display', 'examen_results_page')) { children.push(this.constructMenu('examen_results', {name: 'fa-graduation-cap'}, '/examen_convocations/list/', true)) } if (can('display', 'education_by_student_validation_page')) { children.push(this.constructMenu('education_by_student_validation', {name: 'fa-check-square'}, '/education_by_student/list/', true)) } if (children.length === 1) { return children[0] } else if (children.length > 0) { return this.constructMenu('education_state', {name: 'fa-graduation-cap'}, undefined, undefined, children) } else { return null } } } export const getEducationalMenu = () => new EducationalMenu().getMenu()