import {ItemMenu, ItemsMenu} from "~/types/types"; import BaseMenu from "~/use/layout/Menus/baseMenu"; class CotisationsMenu extends BaseMenu{ private $ability:any; constructor($config:any, $ability:any) { super($config) this.$ability = $ability } /** * Construit le menu Cotisations ou null si aucune page accessible * @return {ItemMenu | null} */ getMenu():ItemMenu | null { const children:ItemsMenu = []; if (this.$ability().can('display', 'rate_cotisation_page')) { children.push(this.constructMenu('rate_cotisation', 'fa-euro-sign', '/cotisation/rate', true)) } if (this.$ability().can('display', 'parameters_cotisation_page')) { children.push(this.constructMenu('parameters_cotisation', 'fa-euro-sign', '/cotisation/parameter', true)) } if (this.$ability().can('display', 'send_cotisation_page')) { children.push(this.constructMenu('send_cotisation', 'fa-euro-sign', '/cotisation/send', true)) } if (this.$ability().can('display', 'state_cotisation_page')) { children.push(this.constructMenu('state_cotisation', 'fa-euro-sign', '/cotisation/state', true)) } if (this.$ability().can('display', 'pay_cotisation_page')) { children.push(this.constructMenu('pay_cotisation', 'fa-euro-sign', '/cotisation/pay', true)) } if (this.$ability().can('display', 'check_cotisation_page')) { children.push(this.constructMenu('check_cotisation', 'fa-euro-sign', '/cotisation/check', true)) } if (this.$ability().can('display', 'ledger_cotisation_page')) { children.push(this.constructMenu('ledger_cotisation', 'fa-euro-sign', '/cotisation/ledger', true)) } if (this.$ability().can('display', 'magazine_cotisation_page')) { children.push(this.constructMenu('magazine_cotisation', 'fa-euro-sign', '/cotisation/magazine', true)) } if (this.$ability().can('display', 'ventilated_cotisation_page')) { children.push(this.constructMenu('ventilated_cotisation', 'fa-euro-sign', '/cotisation/ventilated', true)) } if (this.$ability().can('display', 'pay_erase_cotisation_page')) { children.push(this.constructMenu('pay_erase_cotisation', 'fa-euro-sign', '/cotisation/payerase', true)) } if (this.$ability().can('display', 'resume_cotisation_page')) { children.push(this.constructMenu('resume_cotisation', 'fa-euro-sign', '/cotisation/resume', true)) } if (this.$ability().can('display', 'history_cotisation_page')) { children.push(this.constructMenu('history_cotisation', 'fa-euro-sign', '/cotisation/history', true)) } if (this.$ability().can('display', 'call_cotisation_page')) { children.push(this.constructMenu('call_cotisation', 'fa-euro-sign', '/cotisation/call', true)) } if (this.$ability().can('display', 'history_struture_cotisation_page')) { children.push(this.constructMenu('history_struture_cotisation', 'fa-euro-sign', '/cotisation/historystructure', true)) } if (this.$ability().can('display', 'insurance_cotisation_page')) { children.push(this.constructMenu('insurance_cotisation', 'fa-euro-sign', '/cotisation/insurance', true)) } if (this.$ability().can('display', 'resume_all_cotisation_page')) { children.push(this.constructMenu('resume_all_cotisation', 'fa-euro-sign', '/cotisation/resumeall', true)) } if (this.$ability().can('display', 'resume_pay_cotisation_page')) { children.push(this.constructMenu('resume_pay_cotisation', 'fa-euro-sign', '/cotisation/resumepay', true)) } if(children.length === 1){ return children[0]; } return children.length > 0 ? this.constructMenu('cotisations', 'fa-money-bill', undefined, undefined, children) : null; } } export const getCotisationsMenu = ($config:any, $ability:any) => new CotisationsMenu($config, $ability).getMenu()