import AbstractMenuBuilder from '~/services/layout/menuBuilder/abstractMenuBuilder' import type {MenuGroup, MenuItem, MenuItems} from "~/types/layout"; import {MENU_LINK_TYPE} from "~/types/enum/layout"; /** * Menu Facturation */ export default class BillingMenuBuilder extends AbstractMenuBuilder { static readonly menuName = "Billing" /** * Construit le menu Facturation ou null si aucune page accessible */ build (): MenuItem | MenuGroup | null { const children: MenuItems = [] if (this.ability.can('display', 'billing_product_page')) { children.push(this.createItem('billing_product', {name: 'fas fa-cube'}, '/intangibles/list/', MENU_LINK_TYPE.V1)) } if (this.ability.can('display', 'billing_products_by_student_page')) { children.push(this.createItem('billing_products_by_student', {name: 'fas fa-cubes'}, '/access_intangibles/list/', MENU_LINK_TYPE.V1)) } if (this.ability.can('display', 'billing_edition_page')) { children.push(this.createItem('billing_edition', {name: 'fas fa-copy'}, '/billing_edition', MENU_LINK_TYPE.V1)) } if (this.ability.can('display', 'billing_accounting_page')) { children.push(this.createItem('billing_accounting', {name: 'fas fa-file-alt'}, '/bill_accountings/list/', MENU_LINK_TYPE.V1)) } if (this.ability.can('display', 'billing_payment_list_page')) { children.push(this.createItem('billing_payment_list', {name: 'fas fa-credit-card'}, '/bill_payments_list/list/', MENU_LINK_TYPE.V1)) } if (this.ability.can('display', 'pes_page')) { children.push(this.createItem('pes_export', {name: 'fas fa-align-justify'}, '/pes/list/', MENU_LINK_TYPE.V1)) } if (this.ability.can('display', 'berger_levrault_page')) { children.push(this.createItem('berger_levrault_export', {name: 'fas fa-align-justify'}, '/berger_levraults/list/', MENU_LINK_TYPE.V1)) } if (this.ability.can('display', 'jvs_page')) { children.push(this.createItem('jvs_export', {name: 'fas fa-align-justify'}, '/jvs/list/', MENU_LINK_TYPE.V1)) } if (children.length > 1) { // Plusieurs éléments, on retourne un groupe return this.createGroup('billing', {name: 'fas fa-euro-sign'}, children) } else if (children.length === 1) { // Un seul élément, on retourne cet élément seul return children[0] } return null } }