"use strict"; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } (function () { "use strict"; /** * DashboardButtonsCtrl Invoke a web service that retrieves a list of * configurations for each dashboard button */ var DashboardButtonsCtrl = /*#__PURE__*/function () { function DashboardButtonsCtrl(backofficeConfigService) { _classCallCheck(this, DashboardButtonsCtrl); this.backofficeConfigService = backofficeConfigService; this.linksList = []; } /** * $onChanges when the user is logged in retrieve the configurations from * a web service and initialize a list */ _createClass(DashboardButtonsCtrl, [{ key: "$onChanges", value: function $onChanges() { var _this = this; if (this.isLoggedIn) { var resp = []; this.backofficeConfigService.getAvailableDashboardButtonsConfig().then(function (response) { resp = response; /* let initialConfig = JSON.parse(sessionStorage.getItem("initialConfig" + "_" + PCK_GLOBAL_VARIABLES.JNDI)); angular.forEach(resp, (value, key) => { if (value.moduleName === "calendarModule") { value.isVisible = initialConfig.configsList.calendarModule === 1; } }); */ })["catch"](function (error) { console.error(error); })["finally"](function () { var userInfo = sessionHandler.sessionStorage.get("userInfo"); userInfo = typeof userInfo === "string" ? JSON.parse(userInfo) : userInfo; _this.linksList = []; for (var i = 0; i < resp.length; i++) { if (resp[i].id != 1) { _this.linksList.push(resp[i]); } else { if (userInfo.USER_TYPE_ID == 2) { _this.linksList.push(resp[i]); } } } //this.linksList = resp; _this.linksListLength = _this.linksList.length; }); } } }]); return DashboardButtonsCtrl; }(); // Set up component definition var dashboardButtons = { bindings: { isLoggedIn: "<" }, controller: DashboardButtonsCtrl, templateUrl: PCK_GLOBAL_VARIABLES.dashboard_buttons_view }; angular.module("agp.dashboard.buttons").component("dashboardButtons", dashboardButtons); }).call();