"use strict"; var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AppMainComponent = exports.routes = void 0; var core_1 = require("@angular/core"); var app_api_service_1 = require("./app.api.service"); var angular_jwt_1 = require("@auth0/angular-jwt"); exports.routes = []; var AppMainComponent = function () { var _classDecorators = [(0, core_1.Component)({ selector: 'app-main', templateUrl: './app.main.component.html', styleUrls: ['./app.component.css'], standalone: false, })]; var _classDescriptor; var _classExtraInitializers = []; var _classThis; var AppMainComponent = _classThis = /** @class */ (function () { function AppMainComponent_1(menuService, // private primengConfig: PrimeNGConfig, apiService, app, authService, _auth) { this.menuService = menuService; this.apiService = apiService; this.app = app; this.authService = authService; this._auth = _auth; this.isAuthenticated = false; this.payrollTypesImg = [ { id: 1, imagePath: 'assets/payrolltype-img/payrolltype1.png' }, { id: 2, imagePath: 'assets/payrolltype-img/payrolltype2.png' }, { id: 3, imagePath: 'assets/payrolltype-img/payrolltype3.png' }, { id: 4, imagePath: 'assets/payrolltype-img/payrolltype4.png' }, { id: 5, imagePath: 'assets/payrolltype-img/payrolltype5.png' } ]; if (performance.navigation.type == performance.navigation.TYPE_RELOAD) { } else { this.authService.logout(); } this.IsSelfService(); } AppMainComponent_1.prototype.IsSelfService = function () { var jwtHelper = new angular_jwt_1.JwtHelperService(); var user = jwtHelper.decodeToken(localStorage.getItem('token')); this.apiService.menuItems = []; if (user !== null) { if (user.UserType === "1" || user.UserType === "0") { this.apiService.isSelService = false; } if (user.UserType === "2") { this.apiService.isSelService = true; this.apiService.menuItems = this._auth.getUserMenu(); } if (this.apiService.isSelService === true) { this.staticMenuDesktopInactive = true; if (this.apiService.menuItems && this.apiService.menuItems.length > 0) { this.ProcessSelfServiceMenu(this.apiService.menuItems); } } else { this.staticMenuDesktopInactive = false; } } }; AppMainComponent_1.prototype.ProcessSelfServiceMenu = function (menuItems) { var _this = this; if (menuItems && menuItems.length > 0) { menuItems.forEach(function (item) { if (item.routerLink && item.routerLink !== "" && item.routerLink !== "/") { item.command = function (event) { return _this.menuService.onMenuClickForSelfService(event.item); }; } if (item.items && item.items.length > 0) { _this.ProcessSelfServiceMenu(item.items); } }); } }; AppMainComponent_1.prototype.getImagePath = function () { var a = app_api_service_1.ApiService.USERTYPE; var typeImage = this.payrollTypesImg.find(function (img) { return img.id === app_api_service_1.ApiService.PAYROLLTYPEID; }); return typeImage ? typeImage.imagePath : 'assets/layout/images/Logo.png'; }; AppMainComponent_1.prototype.onLayoutClick = function () { if (!this.topbarItemClick) { this.activeTopbarItem = null; this.topbarMenuActive = false; } if (!this.menuClick || (this.inlineMenuClick && this.isSlim())) { if (this.isHorizontal() || this.isSlim()) { this.menuService.reset(); } if (this.overlayMenuActive || this.staticMenuMobileActive) { this.hideOverlayMenu(); } this.menuHoverActive = false; } if (this.configActive && !this.configClick) { this.configActive = false; } if (this.inlineMenuActive && !this.inlineMenuClick && !this.isStatic()) { this.inlineMenuActive = false; } this.inlineMenuClick = false; this.configClick = false; this.topbarItemClick = false; this.menuClick = false; }; AppMainComponent_1.prototype.onMenuButtonClick = function (event) { debugger; this.menuClick = true; this.rotateMenuButton = !this.rotateMenuButton; this.topbarMenuActive = false; if (this.app.layoutMode === 'overlay' && (!this.isMobile() && !this.isTablet())) { this.overlayMenuActive = !this.overlayMenuActive; } else { if (this.isDesktop()) { this.staticMenuDesktopInactive = !this.staticMenuDesktopInactive; } else { this.staticMenuMobileActive = !this.staticMenuMobileActive; } } event.preventDefault(); }; AppMainComponent_1.prototype.onMenuClick = function ($event) { this.menuClick = true; if (this.inlineMenuActive && !this.inlineMenuClick && !this.isStatic()) { this.inlineMenuActive = false; } }; AppMainComponent_1.prototype.onInlineMenuClick = function (event) { this.inlineMenuActive = !this.inlineMenuActive; this.inlineMenuClick = true; }; AppMainComponent_1.prototype.onTopbarMenuButtonClick = function (event) { debugger; this.topbarItemClick = true; this.topbarMenuActive = !this.topbarMenuActive; this.hideOverlayMenu(); event.preventDefault(); }; AppMainComponent_1.prototype.onTopbarItemClick = function (event, item) { this.topbarItemClick = true; if (this.activeTopbarItem === item) { this.activeTopbarItem = null; } else { this.activeTopbarItem = item; localStorage.setItem('selectedMenu', JSON.stringify(this.menuService.clickedMenuItem)); } event.preventDefault(); }; AppMainComponent_1.prototype.onTopbarSubItemClick = function (event) { event.preventDefault(); }; AppMainComponent_1.prototype.onConfigClick = function (event) { this.configClick = true; }; AppMainComponent_1.prototype.onRippleChange = function (event) { this.app.ripple = event.checked; // this.primengConfig = event.checked; }; AppMainComponent_1.prototype.hideOverlayMenu = function () { this.rotateMenuButton = false; this.overlayMenuActive = false; this.staticMenuMobileActive = false; }; AppMainComponent_1.prototype.isTablet = function () { var width = window.innerWidth; return width <= 1024 && width > 640; }; AppMainComponent_1.prototype.isDesktop = function () { return window.innerWidth > 1024; }; AppMainComponent_1.prototype.isMobile = function () { return window.innerWidth <= 640; }; AppMainComponent_1.prototype.isOverlay = function () { return this.app.layoutMode === 'overlay'; }; AppMainComponent_1.prototype.isHorizontal = function () { return this.app.layoutMode === 'horizontal'; }; AppMainComponent_1.prototype.isSlim = function () { return this.app.layoutMode === 'slim'; }; AppMainComponent_1.prototype.isStatic = function () { return this.app.layoutMode === 'static'; }; AppMainComponent_1.prototype.isLoginForm = function () { var token = localStorage.getItem('token'); if (token != null) { return false; } else { var forgot = localStorage.getItem('forgotpass'); if (forgot != null) { return false; } else return true; } }; AppMainComponent_1.prototype.forgotpassword = function () { var token = localStorage.getItem('token'); if (token != null) { return false; } else { var forgot = localStorage.getItem('forgotpass'); if (forgot != null) { return true; } else return false; } }; return AppMainComponent_1; }()); __setFunctionName(_classThis, "AppMainComponent"); (function () { var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); AppMainComponent = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); __runInitializers(_classThis, _classExtraInitializers); })(); return AppMainComponent = _classThis; }(); exports.AppMainComponent = AppMainComponent; //# sourceMappingURL=app.main.component.js.map