| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- 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 override 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 (this.ability.can('display', 'afi_page')) {
- children.push(
- this.createItem(
- 'afi_export',
- { name: 'fas fa-align-justify' },
- '/afis/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
- }
- }
|