| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import {ItemMenu, ItemsMenu} from "~/types/types";
- import BaseMenu from "~/use/layout/Menus/baseMenu";
- class BillingMenu extends BaseMenu{
- private $ability:any;
- constructor($config:any, $ability:any) {
- super($config)
- this.$ability = $ability
- }
- /**
- * Construit le menu Facturation ou null si aucune page accessible
- * @return {ItemMenu | null}
- */
- getMenu():ItemMenu | null {
- const children:ItemsMenu = [];
- if (this.$ability().can('display', 'billing_product_page')) {
- children.push(this.constructMenu('billing_product', 'fa-cube', '/intangibles/list/', true))
- }
- if (this.$ability().can('display', 'billing_products_by_student_page')) {
- children.push(this.constructMenu('billing_products_by_student', 'fa-cubes', '/access_intangibles/list/', true))
- }
- if (this.$ability().can('display', 'billing_edition_page')) {
- children.push(this.constructMenu('billing_edition', 'fa-copy', '/billing_edition', true))
- }
- if (this.$ability().can('display', 'billing_accounting_page')) {
- children.push(this.constructMenu('billing_accounting', 'fa-file-alt', '/bill_accountings/list/', true))
- }
- if (this.$ability().can('display', 'billing_payment_list_page')) {
- children.push(this.constructMenu('billing_payment_list', 'fa-credit-card', '/bill_payments_list/list/', true))
- }
- if (this.$ability().can('display', 'pes_page')) {
- children.push(this.constructMenu('pes_export', 'fa-align-justify', '/pes/list/', true))
- }
- if (this.$ability().can('display', 'berger_levrault_page')) {
- children.push(this.constructMenu('berger_levrault_export', 'fa-align-justify', '/berger_levraults/list/', true))
- }
- if (this.$ability().can('display', 'jvs_page')) {
- children.push(this.constructMenu('jvs_export', 'fa-align-justify', '/jvs/list/', true))
- }
- if(children.length === 1){
- return children[0];
- }
- return children.length > 0 ? this.constructMenu('billing', 'fa-euro-sign', undefined, undefined, children) : null;
- }
- }
- export const getBillingMenu = ($config:any, $ability:any) => new BillingMenu($config, $ability).getMenu()
|