import {ItemMenu, ItemsMenu} from "~/types/types"; import BaseMenu from "~/use/template/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('fa-bars', 'criteria_notations', '/criteria_notations/list/', true)) } if (this.$ability().can('display', 'seizure_period_page')) { children.push(this.constructMenu('fa-calendar-alt', 'seizure_period', '/education_teachers/list/', true)) } if (this.$ability().can('display', 'test_seizure_page')) { children.push(this.constructMenu('fa-pencil-alt', 'test_seizure', '/education_input/list/', true)) } if (this.$ability().can('display', 'test_validation_page')) { children.push(this.constructMenu('fa-check', 'test_validation', '/education_notations/list/', true)) } if (this.$ability().can('display', 'examen_results_page')) { children.push(this.constructMenu('fa-graduation-cap', 'examen_results', '/examen_convocations/list/', true)) } if (this.$ability().can('display', 'education_by_student_validation_page')) { children.push(this.constructMenu('fa-check-square', 'education_by_student_validation', '/education_by_student/list/', true)) } if(children.length === 1){ return children[0]; } return children.length > 0 ? this.constructMenu('fa-graduation-cap', 'education_state', undefined, undefined, children) : null; } } export const getEducationalMenu = ($config:any, $ability:any) => new EducationalMenu($config, $ability).getMenu()