import {ItemMenu, ItemsMenu} from "~/types/types"; import BaseMenu from "~/use/layout/Menus/baseMenu"; class EducationalMenu extends BaseMenu{ private $ability:any; constructor($config:any, $ability:any) { super($config) this.$ability = $ability } /** * Construit le menu Suivi pédagogique ou null si aucune page accessible * @return {ItemMenu | null} */ getMenu():ItemMenu | null { const children:ItemsMenu = []; if (this.$ability().can('display', 'criteria_notations_page')) { children.push(this.constructMenu('criteria_notations', 'fa-bars', '/criteria_notations/list/', true)) } if (this.$ability().can('display', 'seizure_period_page')) { children.push(this.constructMenu('seizure_period', 'fa-calendar-alt', '/education_teachers/list/', true)) } if (this.$ability().can('display', 'test_seizure_page')) { children.push(this.constructMenu('test_seizure', 'fa-pencil-alt', '/education_input/list/', true)) } if (this.$ability().can('display', 'test_validation_page')) { children.push(this.constructMenu('test_validation', 'fa-check', '/education_notations/list/', true)) } if (this.$ability().can('display', 'examen_results_page')) { children.push(this.constructMenu('examen_results', 'fa-graduation-cap', '/examen_convocations/list/', true)) } if (this.$ability().can('display', 'education_by_student_validation_page')) { children.push(this.constructMenu('education_by_student_validation', 'fa-check-square', '/education_by_student/list/', true)) } if(children.length === 1){ return children[0]; } return children.length > 0 ? this.constructMenu('education_state', 'fa-graduation-cap', undefined, undefined, children) : null; } } export const getEducationalMenu = ($config:any, $ability:any) => new EducationalMenu($config, $ability).getMenu()