UNPKG

armisa-models

Version:
34 lines (33 loc) 1.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MenuFactory = void 0; const _2_MenuItemFactory_1 = require("./2-MenuItemFactory"); class MenuFactory { constructor(mainStateManager, authFactory) { this.mainStateManager = mainStateManager; this.authFactory = authFactory; this.forceUpdate = () => { }; this.forceUpdateAfterSystemsChange = () => { }; this.visible = true; this.menuItems = []; this.routes = []; } get visibleMenuItems() { return this.menuItems.filter(i => i.isSystemSelected && i.isInRole); } addNewItem(caption, path, Page, exact, onClick, accounting, purchase, sale, treasury, warehouse, produce, pms, costOfGoods, payment, asset, warranty, automation, dailyDistribution, preventindMaintainance, workflow, users) { let captionFinal = ''; if (caption) { if (typeof caption === 'string') { captionFinal = caption; } else if (caption) { captionFinal = this.mainStateManager.getCaptionNaming(caption); } } const item = new _2_MenuItemFactory_1.MenuItemFactory(this, captionFinal, accounting || false, purchase || false, sale || false, treasury || false, warehouse || false, produce || false, pms || false, costOfGoods || false, payment || false, asset || false, warranty || false, automation || false, dailyDistribution || false, preventindMaintainance || false, workflow || false, users, path, Page, exact, onClick); this.menuItems.push(item); return item; } } exports.MenuFactory = MenuFactory;