| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- import AbstractMenuBuilder from '~/services/layout/menuBuilder/abstractMenuBuilder'
- import type { MenuItems, MenuGroup, MenuItem } from '~/types/layout'
- import { MENU_LINK_TYPE } from '~/types/enum/layout'
- /**
- * Menu Cotisation (CMF)
- */
- export default class CotisationsMenuBuilder extends AbstractMenuBuilder {
- static override readonly menuName = 'Cotisation'
- /**
- * Construit le menu Cotisations ou null si aucune page accessible
- */
- build(): MenuItem | MenuGroup | null {
- const children: MenuItems = []
- if (this.ability.can('display', 'rate_cotisation_page')) {
- children.push(
- this.createItem(
- 'rate_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/rate',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'parameters_cotisation_page')) {
- children.push(
- this.createItem(
- 'parameters_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/parameter',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'send_cotisation_page')) {
- children.push(
- this.createItem(
- 'send_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/send',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'state_cotisation_page')) {
- children.push(
- this.createItem(
- 'state_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/state',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'pay_cotisation_page')) {
- children.push(
- this.createItem(
- 'pay_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/pay',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'check_cotisation_page')) {
- children.push(
- this.createItem(
- 'check_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/check',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'ledger_cotisation_page')) {
- children.push(
- this.createItem(
- 'ledger_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/ledger',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'magazine_cotisation_page')) {
- children.push(
- this.createItem(
- 'magazine_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/magazine',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'ventilated_cotisation_page')) {
- children.push(
- this.createItem(
- 'ventilated_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/ventilated',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'pay_erase_cotisation_page')) {
- children.push(
- this.createItem(
- 'pay_erase_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/payerase',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'resume_cotisation_page')) {
- children.push(
- this.createItem(
- 'resume_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/resume',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'history_cotisation_page')) {
- children.push(
- this.createItem(
- 'history_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/history',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'call_cotisation_page')) {
- children.push(
- this.createItem(
- 'call_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/call',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'history_structure_cotisation_page')) {
- children.push(
- this.createItem(
- 'history_structure_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/historystructure',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'insurance_cotisation_page')) {
- children.push(
- this.createItem(
- 'insurance_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/insurance',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'resume_all_cotisation_page')) {
- children.push(
- this.createItem(
- 'resume_all_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/resumeall',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (this.ability.can('display', 'resume_pay_cotisation_page')) {
- children.push(
- this.createItem(
- 'resume_pay_cotisation',
- { name: 'fas fa-euro-sign' },
- '/cotisation/resumepay',
- MENU_LINK_TYPE.V1,
- ),
- )
- }
- if (children.length > 1) {
- // Plusieurs éléments, on retourne un groupe
- return this.createGroup(
- 'cotisations',
- { name: 'fas fa-money-bill' },
- children,
- )
- } else if (children.length === 1) {
- // Un seul élément, on retourne cet élément seul
- return children[0]
- }
- return null
- }
- }
|