| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- import AbstractMenuBuilder from '~/services/layout/menuBuilder/abstractMenuBuilder'
- import type { MenuGroup, MenuItem, MenuItems } from '~/types/layout'
- import { MENU_LINK_TYPE } from '~/types/enum/layout'
- /**
- * Menu Suivi pédagogique
- */
- export default class EducationalMenuBuilder extends AbstractMenuBuilder {
- static override readonly menuName = 'Educational'
- /**
- * Construit le menu Suivi pédagogique ou null si aucune page accessible
- */
- build(): MenuItem | MenuGroup | null {
- const children: MenuItems = []
- if (this.ability.can('display', 'criteria_notations_page')) {
- children.push(
- this.createItem(
- 'criteria_notations',
- { name: 'fas fa-bars' },
- '/criteria_notations/list/',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'education_notation_config_page')) {
- children.push(
- this.createItem(
- 'education_notation_configs',
- { name: 'fas fa-bars' },
- '/education_notation_configs/list/',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'seizure_period_page')) {
- children.push(
- this.createItem(
- 'seizure_period',
- { name: 'fas fa-calendar-alt' },
- '/education_teachers/list/',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'test_seizure_page')) {
- children.push(
- this.createItem(
- 'test_seizure',
- { name: 'fas fa-pencil-alt' },
- '/education_input/list/',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'test_validation_page')) {
- children.push(
- this.createItem(
- 'test_validation',
- { name: 'fas fa-check' },
- '/education_notations/list/',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'examen_results_page')) {
- children.push(
- this.createItem(
- 'examen_results',
- { name: 'fas fa-graduation-cap' },
- '/examen_convocations/list/',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'education_by_student_validation_page')) {
- children.push(
- this.createItem(
- 'education_by_student_validation',
- { name: 'fas fa-check-square' },
- '/education_by_student/list/',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (children.length > 1) {
- // Plusieurs éléments, on retourne un groupe
- return this.createGroup(
- 'education_state',
- { name: 'fas fa-graduation-cap' },
- children,
- )
- } else if (children.length === 1) {
- // Un seul élément, on retourne cet élément seul
- return children[0]
- }
- return null
- }
- }
|