inet-layout
Version:
iNet Layout ===
642 lines (633 loc) • 438 kB
JavaScript
import * as i0 from '@angular/core';
import { Injectable, EventEmitter, ViewChild, Input, Output, Component, Pipe, HostListener, ContentChild, NgModule, Optional, SkipSelf, CUSTOM_ELEMENTS_SCHEMA, Directive } from '@angular/core';
import * as i1 from 'inet-core';
import { iNet as iNet$1, UserProfileService, ErrorMessage, NewPassword, CoreModule, WebSocketClientService, HttpClientService } from 'inet-core';
import * as i1$1 from '@angular/router';
import { NavigationEnd, RouterModule, RouteReuseStrategy, NavigationStart, NavigationError, NavigationCancel } from '@angular/router';
import { tap, shareReplay, delay, expand, skip, filter, debounceTime, distinctUntilChanged, withLatestFrom, map, first, catchError as catchError$1 } from 'rxjs/operators';
import * as i4 from 'inet-ui';
import { Organization, Address, Contact as Contact$1, CropperAvatarDialogComponent, ImageCropperModule, GridModule, LocationService, DictionaryService, InterceptorModule, CloudTranslateModule as CloudTranslateModule$1, NotifyModule, SafePipeModule, AuthenticateGuard, NotifyMessageService, CloudTransLoader } from 'inet-ui';
import * as i3 from '@ngx-translate/core';
import { TranslateModule, TranslateLoader, TranslateService } from '@ngx-translate/core';
import * as i3$1 from '@angular/common';
import { CommonModule } from '@angular/common';
import { register, format } from 'timeago.js';
import { of, timer, Subject, map as map$1, catchError, forkJoin, Observable } from 'rxjs';
import * as i2 from '@angular/forms';
import { Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
import * as i4$1 from 'ngx-bootstrap/datepicker';
import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
import { provideHttpClient, withInterceptorsFromDi, HttpHeaders } from '@angular/common/http';
import * as i2$1 from 'ngx-bootstrap/modal';
import { ModalModule, BsModalService } from 'ngx-bootstrap/modal';
import * as i1$2 from 'ngx-bootstrap/tabs';
import { TabsModule } from 'ngx-bootstrap/tabs';
import * as i3$2 from '@ngrx/store';
import { createAction, props, INIT, UPDATE, createSelector, select, StoreModule } from '@ngrx/store';
import * as i1$3 from '@ngrx/effects';
import { createEffect, ofType, EffectsModule } from '@ngrx/effects';
import * as i3$3 from '@ngrx/router-store';
import { routerReducer, StoreRouterConnectingModule } from '@ngrx/router-store';
import { Base64 } from 'js-base64';
import * as i1$4 from '@angular/platform-browser';
class OrganizationService {
constructor(http, coreService) {
this.http = http;
this.coreService = coreService;
this.url = {
firm_load: iNet$1.getPUrl('cloud/firmorganid/load'),
firm_update: iNet$1.getPUrl('cloud/firmprofile/update'),
update_logo: iNet$1.getPUrl('cloud/firmprofile/logoupdate'),
view_logo: iNet$1.getPUrl('plugin/firmlogo/view'),
// For Essentials
//load_info: iNet.getPUrl('gl/organ/profile/load'),
load_info: iNet$1.getPUrl('cloud/firmprofile/load'),
update_info: iNet$1.getPUrl('cloud/firmprofile/update'),
search_org: iNet$1.getPUrl('plugin/organization/search'),
view_org: iNet$1.getPUrl('plugin/firmprofile/view')
//update_logo: iNet.getPUrl('gl/organ/profile/logo')
};
}
firmLoad() {
this.http.showLoading();
return this.http.getJSON(this.url.firm_load, { organId: iNet$1.getOrganId() })
.pipe(tap((res) => res));
}
// saveLogoOrganization(params: any): Observable<any> {
// return this.http.postJSON(this.url.save_logo, params);
// }
firmUpdate(orgInfo) {
this.http.showLoading();
return this.http.postJSON(this.url.firm_update, orgInfo);
}
updateLogo(data) {
this.http.showLoading();
return this.http.post(this.url.update_logo, data);
}
removeLogo(params) {
this.http.showLoading();
return this.http.postJSON(this.url.update_logo, params);
}
load() {
if (!this.$orgCache) {
this.http.showLoading();
this.$orgCache = this.http.getJSON(this.url.view_org)
.pipe(shareReplay(1));
}
return this.$orgCache;
}
loadInfo() {
this.http.showLoading();
return this.http.postJSON(this.url.load_info);
}
update(data) {
this.http.showLoading();
// Clone data for update
const org = Object.assign(new Organization(), data);
org.officeAddressStr = JSON.stringify(org.officeAddress);
delete org.officeAddress;
delete org.createdDate;
delete org.createdBy;
delete org.banks;
delete org.busAces;
this.$orgCache = null;
return this.http.postJSON(this.url.update_info, org);
}
searchOrganization(params = {}) {
return this.http.postJSON(this.url.search_org, params);
}
getLogoUrlByOrganization(orgInfo) {
/*
if (!orgInfo.logo) {
return iNet.BLANK_IMAGE_URL;
}
*/
return `${this.url.view_logo}?version=${orgInfo.modifiedDate}`;
//return this.coreService.getFileUrl(orgInfo.logo + `?version=${orgInfo.modifiedDate}`);
}
getLogoUrl() {
return this.url.view_logo;
}
viewInfo() {
this.http.showLoading();
return this.http.postJSON(this.url.view_org);
}
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OrganizationService, deps: [{ token: i1.HttpClientService }, { token: i1.CoreService }], target: i0.ɵɵFactoryTarget.Injectable }); }
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OrganizationService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OrganizationService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root'
}]
}], ctorParameters: () => [{ type: i1.HttpClientService }, { type: i1.CoreService }] });
const BLANK_IMAGE_URL = 'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
class AdminNavbarComponent {
constructor(coreService, router, userProfileService, orgService, cloudTranslateService, messageService, translate, securityService) {
this.coreService = coreService;
this.router = router;
this.userProfileService = userProfileService;
this.orgService = orgService;
this.cloudTranslateService = cloudTranslateService;
this.messageService = messageService;
this.translate = translate;
this.securityService = securityService;
this.hideToggler = false;
this.hideTogglerButton = false;
this.hideCompanyMenu = false;
this.hideProfileMenu = false;
this.hideSearch = false;
this.messageCount = '';
this.hideBrandName = true;
this.hideLogo = false;
this.onToggleMenu = new EventEmitter();
this.onToggleMessageSideNav = new EventEmitter();
this.onToggleUserLogSideNav = new EventEmitter();
this.onToggleAppSideNav = new EventEmitter();
this.onToggleChatSideNav = new EventEmitter();
this.onToggleSocialSideNav = new EventEmitter();
this.onToggleNoteSideNav = new EventEmitter();
this.onClickLogo = new EventEmitter();
this.visibleChatIcon = !!iNet$1.getPrefix();
this.visibleMessageIcon = !!iNet$1.getPrefix();
this.visibleUserLogIcon = !!iNet$1.getPrefix();
this.visibleAppIcon = !!iNet$1.getPrefix();
this.visibleNoteIcon = false;
this.visibleSearch = false;
this.visibleLogo = true;
//externalUrl = 'javascript:;';
this.avatarUrl = BLANK_IMAGE_URL;
this.displayName = iNet$1.getDisplayName();
this.brandName = '';
this.langs = [];
this.currentLanguage = 'en';
}
ngOnInit() {
//this.brandName = !iNet.isEmpty(this.applicationName) ? `${this.applicationName} - ${this.orgName}` : this.orgName;
//this.externalUrl = window.location.protocol + '\/\/' + window.location.host + '\/' + iNet.firmPrefix;
this.langs = this.translate.getLangs(); // Languages
this.currentLanguage = this.cloudTranslateService.getCurrentLang();
if (this.isUser()) {
if (!!iNet$1.getPrefix()) {
this.userProfileService.getFullName().then(fullname => {
this.displayName = fullname || iNet$1.getDisplayName() || iNet$1.getUserName();
});
this.userProfileService.getAvatarUrl().then(url => {
this.avatarUrl = url;
});
if (this.visibleMessageIcon) {
this.countMessage();
}
//Load logo for header
this.logoUrl = this.orgService.getLogoUrl();
}
}
}
isUser() {
if (!iNet$1.getUserName()) {
return false;
}
return this.securityService.hasRole('firmuser,firm_user,community');
}
logout() {
if (this.coreService.getEnvironment()['production']) {
this.coreService.logout();
}
}
toggleMenu() {
this.onToggleMenu.emit();
}
toggleMessageSideNav($event) {
this.onToggleMessageSideNav.emit();
}
toggleUserLogSideNav($event) {
this.onToggleUserLogSideNav.emit();
}
toggleAppSideNav($event) {
this.onToggleAppSideNav.emit();
}
// toggleSocialSideNav($event) {
// this.onToggleSocialSideNav.emit();
// }
toggleChatSideNav($event) {
this.onToggleChatSideNav.emit();
}
toggleNoteNav($event) {
this.onToggleNoteSideNav.emit();
}
changeLanguage(lang) {
this.translate.use(lang).subscribe((v) => {
this.currentLanguage = lang;
this.cloudTranslateService.setCurrentLang(lang);
if (this.coreService.getEnvironment()['production']) {
this.coreService.updateLanguage(lang, function () {
window.location.reload();
});
}
else {
window.location.reload();
}
});
}
updateImageUrl($event) {
this.avatarUrl = UserProfileService.DEFAULT_AVATAR_URL;
}
updateBlankImage($event) {
if ($event) {
this.logoUrl = BLANK_IMAGE_URL;
}
}
countMessage() {
this.messageService.count().then((count) => {
//console.log('count')
this.messageCount = (count && count > 0) ? count.toString() : '';
});
}
setMessageCount(v) {
this.messageCount = v;
}
clickLogo($event) {
this.onClickLogo.emit(this.homeRouterLink);
}
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AdminNavbarComponent, deps: [{ token: i1.CoreService }, { token: i1$1.Router }, { token: i1.UserProfileService }, { token: OrganizationService }, { token: i4.CloudTranslateService }, { token: i4.NotifyMessageService }, { token: i3.TranslateService }, { token: i1.SecurityService }], target: i0.ɵɵFactoryTarget.Component }); }
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: AdminNavbarComponent, isStandalone: false, selector: "app-admin-navbar", inputs: { navbarItemTpl: "navbarItemTpl", profileItemTpl: "profileItemTpl", navbarMenuTpl: "navbarMenuTpl", titleMenuTpl: "titleMenuTpl", hideToggler: "hideToggler", hideTogglerButton: "hideTogglerButton", hideCompanyMenu: "hideCompanyMenu", hideProfileMenu: "hideProfileMenu", hideSearch: "hideSearch", applicationName: "applicationName", homeRouterLink: "homeRouterLink", noteRouterLink: "noteRouterLink", messageCount: "messageCount", hideBrandName: "hideBrandName", hideLogo: "hideLogo", visibleChatIcon: "visibleChatIcon", visibleMessageIcon: "visibleMessageIcon", visibleUserLogIcon: "visibleUserLogIcon", visibleAppIcon: "visibleAppIcon", visibleNoteIcon: "visibleNoteIcon", visibleSearch: "visibleSearch", visibleLogo: "visibleLogo", brandName: "brandName" }, outputs: { onToggleMenu: "onToggleMenu", onToggleMessageSideNav: "onToggleMessageSideNav", onToggleUserLogSideNav: "onToggleUserLogSideNav", onToggleAppSideNav: "onToggleAppSideNav", onToggleChatSideNav: "onToggleChatSideNav", onToggleSocialSideNav: "onToggleSocialSideNav", onToggleNoteSideNav: "onToggleNoteSideNav", onClickLogo: "onClickLogo" }, viewQueries: [{ propertyName: "brandLink", first: true, predicate: ["brandLink"], descendants: true }], ngImport: i0, template: "<nav class=\"navbar navbar-expand-md\">\n <div *ngIf=\"visibleLogo\" class=\"navbar-header logo-area p-1\" (click)=\"clickLogo($event)\" [routerLink]=\"homeRouterLink\">\n <ng-container>\n <img *ngIf=\"!hideLogo && logoUrl\" alt=\"Logo\" class=\"logo\" [title]=\"brandName\" [src]=\"logoUrl\"\n (error)=\"updateBlankImage($event)\">\n <a *ngIf=\"!hideBrandName\" #brandLink class=\"navbar-brand\">{{brandName}}</a>\n </ng-container>\n </div>\n <ng-template [ngTemplateOutlet]=\"navbarMenuTpl\"></ng-template>\n <ng-template [ngTemplateOutlet]=\"titleMenuTpl\"></ng-template>\n <div class=\"navbar-collapse collapse in\" id=\"navbar-collapse\" aria-expanded=\"true\">\n <ul class=\"navbar-nav navbar-right ml-auto d-flex align-items-center\">\n <ng-template [ngTemplateOutlet]=\"navbarItemTpl\"></ng-template>\n <li *ngIf=\"visibleNoteIcon\" class=\"nav-item\"><a href=\"javascript:;\" (click)=\"toggleNoteNav($event)\"><i\n class=\"fa fa-pencil-square-o\" aria-hidden=\"true\"></i></a>\n </li>\n\n <div *ngIf=\"visibleSearch\" class=\"search-input-group\">\n <div class=\"input-group input-group-sm\">\n <div class=\"input-group-prepend\">\n <span class=\"input-group-text border-radius-left\">\n <i class=\"fa fa-search\" aria-hidden=\"true\" ></i>\n </span>\n </div>\n <input type=\"text\"\n class=\"form-control text-white border-radius-right\">\n </div>\n </div>\n <li *ngIf=\"visibleMessageIcon\" class=\"nav-item\" [ngClass]=\"{'icon-animated-heartbeat': messageCount}\">\n <a href=\"javascript:;\" (click)=\"toggleMessageSideNav($event)\">\n <i class=\"fa fa-bell rotate-15\"></i><span class=\"number\">{{messageCount}}</span>\n </a>\n </li>\n <li *ngIf=\"visibleUserLogIcon\" class=\"nav-item\">\n <a href=\"javascript:;\" (click)=\"toggleUserLogSideNav($event)\">\n <i class=\"fa fa-history\"></i>\n </a>\n </li>\n <li *ngIf=\"visibleAppIcon\" class=\"nav-item\"><a href=\"javascript:;\" (click)=\"toggleAppSideNav($event)\"><i\n class=\"fa fa-th-large\"></i></a></li>\n <li id=\"user-profile\" class=\"light-blue user-profile\">\n <a *ngIf=\"displayName\" class=\"dropdown-toggle\" href=\"javascript:;\" data-toggle=\"dropdown\">\n <img [src]=\"avatarUrl\" [alt]=\"displayName\" class=\"nav-user-photo\" (error)=\"updateImageUrl($event)\">\n <!--span class=\"user-info\" [title]=\"displayName\"><small>{{'COMMON.WELCOME' | translate}},</small>{{displayName}}</span-->\n </a>\n <div class=\"dropdown-menu\">\n <a *ngIf=\"!hideProfileMenu\" class=\"dropdown-item\" href=\"javascript:;\" routerLink=\"user-profile\">\n <i class=\"fa fa-user\"></i> {{'COMMON.MENU.USER_PROFILE' | translate}}\n </a>\n <ng-template [ngTemplateOutlet]=\"profileItemTpl\"></ng-template>\n <a class=\"dropdown-submenu pull-left\">\n <a class=\"dropdown-item dropdown-toggle\" href=\"#\">\n <i class=\"fa fa-language\"></i> {{'COMMON.MENU.LANGUAGE' | translate}}\n <small class=\"text-lowercase\">({{ currentLanguage | translate }})</small>\n </a>\n <div class=\"dropdown-menu\">\n <a class=\"dropdown-item\" href=\"javascript:;\" *ngFor=\"let lang of langs\"\n (click)=\"changeLanguage(lang)\" [ngClass]=\"{'active': currentLanguage===lang}\">\n <i class=\"fa\"\n [ngClass]=\"{'fa-check': currentLanguage===lang}\"></i> {{ lang | translate }}\n </a>\n </div>\n <div class=\"dropdown-divider\"></div>\n </a>\n <a class=\"dropdown-item\" href=\"javascript:;\" (click)=\"logout()\">\n <i class=\"fa fa-sign-out\"></i> {{'COMMON.MENU.LOGOUT' | translate}}\n </a>\n </div>\n </li>\n </ul>\n </div>\n</nav>\n", styles: ["@-webkit-keyframes heartbeat{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:center center;transform-origin:center center;-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}10%{-webkit-transform:scale(.91);transform:scale(.91);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}17%{-webkit-transform:scale(.98);transform:scale(.98);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}33%{-webkit-transform:scale(.87);transform:scale(.87);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}45%{-webkit-transform:scale(1);transform:scale(1);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes heartbeat{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:center center;transform-origin:center center;-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}10%{-webkit-transform:scale(.91);transform:scale(.91);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}17%{-webkit-transform:scale(.98);transform:scale(.98);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}33%{-webkit-transform:scale(.87);transform:scale(.87);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}45%{-webkit-transform:scale(1);transform:scale(1);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.navbar .rotate-15{-webkit-transform:rotate(15deg);transform:rotate(15deg)}.navbar .icon-animated-heartbeat{-webkit-animation:heartbeat 1.5s ease-in-out infinite both;animation:heartbeat 1.5s ease-in-out infinite both}@media (max-width: 767px){.navbar .navbar-right{margin-top:-10px;margin-bottom:1px;margin-left:-7px}.navbar .navbar-header{display:inline-block;width:100%}}@media (min-width: 768px){.navbar .navbar-right{float:right!important}}.border-radius-left{border-bottom-left-radius:20px!important;border-top-left-radius:20px!important}.border-radius-right{border-bottom-right-radius:20px;border-top-right-radius:20px}\n"], dependencies: [{ kind: "directive", type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AdminNavbarComponent, decorators: [{
type: Component,
args: [{ selector: 'app-admin-navbar', standalone: false, template: "<nav class=\"navbar navbar-expand-md\">\n <div *ngIf=\"visibleLogo\" class=\"navbar-header logo-area p-1\" (click)=\"clickLogo($event)\" [routerLink]=\"homeRouterLink\">\n <ng-container>\n <img *ngIf=\"!hideLogo && logoUrl\" alt=\"Logo\" class=\"logo\" [title]=\"brandName\" [src]=\"logoUrl\"\n (error)=\"updateBlankImage($event)\">\n <a *ngIf=\"!hideBrandName\" #brandLink class=\"navbar-brand\">{{brandName}}</a>\n </ng-container>\n </div>\n <ng-template [ngTemplateOutlet]=\"navbarMenuTpl\"></ng-template>\n <ng-template [ngTemplateOutlet]=\"titleMenuTpl\"></ng-template>\n <div class=\"navbar-collapse collapse in\" id=\"navbar-collapse\" aria-expanded=\"true\">\n <ul class=\"navbar-nav navbar-right ml-auto d-flex align-items-center\">\n <ng-template [ngTemplateOutlet]=\"navbarItemTpl\"></ng-template>\n <li *ngIf=\"visibleNoteIcon\" class=\"nav-item\"><a href=\"javascript:;\" (click)=\"toggleNoteNav($event)\"><i\n class=\"fa fa-pencil-square-o\" aria-hidden=\"true\"></i></a>\n </li>\n\n <div *ngIf=\"visibleSearch\" class=\"search-input-group\">\n <div class=\"input-group input-group-sm\">\n <div class=\"input-group-prepend\">\n <span class=\"input-group-text border-radius-left\">\n <i class=\"fa fa-search\" aria-hidden=\"true\" ></i>\n </span>\n </div>\n <input type=\"text\"\n class=\"form-control text-white border-radius-right\">\n </div>\n </div>\n <li *ngIf=\"visibleMessageIcon\" class=\"nav-item\" [ngClass]=\"{'icon-animated-heartbeat': messageCount}\">\n <a href=\"javascript:;\" (click)=\"toggleMessageSideNav($event)\">\n <i class=\"fa fa-bell rotate-15\"></i><span class=\"number\">{{messageCount}}</span>\n </a>\n </li>\n <li *ngIf=\"visibleUserLogIcon\" class=\"nav-item\">\n <a href=\"javascript:;\" (click)=\"toggleUserLogSideNav($event)\">\n <i class=\"fa fa-history\"></i>\n </a>\n </li>\n <li *ngIf=\"visibleAppIcon\" class=\"nav-item\"><a href=\"javascript:;\" (click)=\"toggleAppSideNav($event)\"><i\n class=\"fa fa-th-large\"></i></a></li>\n <li id=\"user-profile\" class=\"light-blue user-profile\">\n <a *ngIf=\"displayName\" class=\"dropdown-toggle\" href=\"javascript:;\" data-toggle=\"dropdown\">\n <img [src]=\"avatarUrl\" [alt]=\"displayName\" class=\"nav-user-photo\" (error)=\"updateImageUrl($event)\">\n <!--span class=\"user-info\" [title]=\"displayName\"><small>{{'COMMON.WELCOME' | translate}},</small>{{displayName}}</span-->\n </a>\n <div class=\"dropdown-menu\">\n <a *ngIf=\"!hideProfileMenu\" class=\"dropdown-item\" href=\"javascript:;\" routerLink=\"user-profile\">\n <i class=\"fa fa-user\"></i> {{'COMMON.MENU.USER_PROFILE' | translate}}\n </a>\n <ng-template [ngTemplateOutlet]=\"profileItemTpl\"></ng-template>\n <a class=\"dropdown-submenu pull-left\">\n <a class=\"dropdown-item dropdown-toggle\" href=\"#\">\n <i class=\"fa fa-language\"></i> {{'COMMON.MENU.LANGUAGE' | translate}}\n <small class=\"text-lowercase\">({{ currentLanguage | translate }})</small>\n </a>\n <div class=\"dropdown-menu\">\n <a class=\"dropdown-item\" href=\"javascript:;\" *ngFor=\"let lang of langs\"\n (click)=\"changeLanguage(lang)\" [ngClass]=\"{'active': currentLanguage===lang}\">\n <i class=\"fa\"\n [ngClass]=\"{'fa-check': currentLanguage===lang}\"></i> {{ lang | translate }}\n </a>\n </div>\n <div class=\"dropdown-divider\"></div>\n </a>\n <a class=\"dropdown-item\" href=\"javascript:;\" (click)=\"logout()\">\n <i class=\"fa fa-sign-out\"></i> {{'COMMON.MENU.LOGOUT' | translate}}\n </a>\n </div>\n </li>\n </ul>\n </div>\n</nav>\n", styles: ["@-webkit-keyframes heartbeat{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:center center;transform-origin:center center;-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}10%{-webkit-transform:scale(.91);transform:scale(.91);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}17%{-webkit-transform:scale(.98);transform:scale(.98);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}33%{-webkit-transform:scale(.87);transform:scale(.87);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}45%{-webkit-transform:scale(1);transform:scale(1);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes heartbeat{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:center center;transform-origin:center center;-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}10%{-webkit-transform:scale(.91);transform:scale(.91);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}17%{-webkit-transform:scale(.98);transform:scale(.98);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}33%{-webkit-transform:scale(.87);transform:scale(.87);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}45%{-webkit-transform:scale(1);transform:scale(1);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.navbar .rotate-15{-webkit-transform:rotate(15deg);transform:rotate(15deg)}.navbar .icon-animated-heartbeat{-webkit-animation:heartbeat 1.5s ease-in-out infinite both;animation:heartbeat 1.5s ease-in-out infinite both}@media (max-width: 767px){.navbar .navbar-right{margin-top:-10px;margin-bottom:1px;margin-left:-7px}.navbar .navbar-header{display:inline-block;width:100%}}@media (min-width: 768px){.navbar .navbar-right{float:right!important}}.border-radius-left{border-bottom-left-radius:20px!important;border-top-left-radius:20px!important}.border-radius-right{border-bottom-right-radius:20px;border-top-right-radius:20px}\n"] }]
}], ctorParameters: () => [{ type: i1.CoreService }, { type: i1$1.Router }, { type: i1.UserProfileService }, { type: OrganizationService }, { type: i4.CloudTranslateService }, { type: i4.NotifyMessageService }, { type: i3.TranslateService }, { type: i1.SecurityService }], propDecorators: { navbarItemTpl: [{
type: Input
}], profileItemTpl: [{
type: Input
}], navbarMenuTpl: [{
type: Input
}], titleMenuTpl: [{
type: Input
}], hideToggler: [{
type: Input
}], hideTogglerButton: [{
type: Input
}], hideCompanyMenu: [{
type: Input
}], hideProfileMenu: [{
type: Input
}], hideSearch: [{
type: Input
}], applicationName: [{
type: Input
}], homeRouterLink: [{
type: Input
}], noteRouterLink: [{
type: Input
}], messageCount: [{
type: Input
}], hideBrandName: [{
type: Input
}], hideLogo: [{
type: Input
}], onToggleMenu: [{
type: Output
}], onToggleMessageSideNav: [{
type: Output
}], onToggleUserLogSideNav: [{
type: Output
}], onToggleAppSideNav: [{
type: Output
}], onToggleChatSideNav: [{
type: Output
}], onToggleSocialSideNav: [{
type: Output
}], onToggleNoteSideNav: [{
type: Output
}], onClickLogo: [{
type: Output
}], visibleChatIcon: [{
type: Input
}], visibleMessageIcon: [{
type: Input
}], visibleUserLogIcon: [{
type: Input
}], visibleAppIcon: [{
type: Input
}], visibleNoteIcon: [{
type: Input
}], visibleSearch: [{
type: Input
}], visibleLogo: [{
type: Input
}], brandName: [{
type: Input
}], brandLink: [{
type: ViewChild,
args: ['brandLink']
}] } });
class UserlogService {
constructor(http) {
this.http = http;
this.url = {
list_user_log: iNet.getPUrl('plugin/memberaccess'),
};
}
loadData(params = {}) {
this.http.showLoading();
return this.http.getJSON(this.url.list_user_log, params);
}
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UserlogService, deps: [{ token: i1.HttpClientService }], target: i0.ɵɵFactoryTarget.Injectable }); }
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UserlogService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UserlogService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root'
}]
}], ctorParameters: () => [{ type: i1.HttpClientService }] });
const MINUTE = 60;
const HOUR = MINUTE * 60;
const DAY = HOUR * 24;
/*
export const WEEK = DAY * 7;
export const MONTH = DAY * 30;
export const YEAR = DAY * 365;
*/
class TimeAgoService {
constructor() {
}
tick(then) {
return of(0)
.pipe(delay(60000), expand(() => {
const now = Date.now();
const seconds = Math.round(Math.abs(now - then) / 1000);
//console.log('[tick]', new Date(), seconds);
const period = seconds < MINUTE
? 1000
: seconds < HOUR
? 1000 * MINUTE
: seconds < DAY
? 1000 * HOUR
: 0;
//console.log('[period]',period);
return period ? timer(period) : of(0);
}), skip(1));
}
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TimeAgoService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TimeAgoService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TimeAgoService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root'
}]
}], ctorParameters: () => [] });
register('vi', (number, index, total_sec) => {
// number: the timeago / timein number;
// index: the index of array below;
// total_sec: total seconds between date to be formatted and today's date;
// @ts-ignore
return [
['vừa xong', 'một lúc'],
['%s giây trước', '%s giây nữa'],
['1 phút trước', '1 phút nữa'],
['%s phút trước', '%s phút nữa'],
['1 giờ trước', '1 giờ nữa'],
['%s giờ trước', '%s giờ nữa'],
['1 ngày trước', '1 ngày nữa'],
['%s ngày trước', '%s ngày nữa'],
['1 tuần trước', '1 tuần nữa'],
['%s tuần trước', '%s tuần nữa'],
['1 tháng trước', '1 tháng nữa'],
['%s tháng trước', '%s tháng nữa'],
['1 năm trước', '1 năm nữa'],
['%s năm trước', '%s năm nữa']
][index];
});
class TimeAgoPipe {
constructor(cd, timeService, cloudTranslateService) {
this.timeService = timeService;
this.cloudTranslateService = cloudTranslateService;
this.live = true;
this.stateChanges = new Subject();
this.stateChanges.subscribe(() => {
this.value = format(this.date, this.locale);
cd.markForCheck();
});
}
transform(date, live) {
this.date = date;
if (live) {
this.live = live;
}
this.locale = this.cloudTranslateService.getCurrentLang() || 'vi';
if (this.date) {
if (this.clockSubscription) {
this.clockSubscription.unsubscribe();
// this.clockSubscription = undefined;
}
this.clockSubscription = this.timeService.tick(this.date)
.pipe(filter(() => this.live, this))
.subscribe((v) => {
this.stateChanges.next();
});
this.stateChanges.next();
return format(this.date, this.locale);
}
else {
//throw new SyntaxError(`Expected a valid date, received: ${date}`);
return '';
}
}
ngOnDestroy() {
if (this.clockSubscription) {
this.clockSubscription.unsubscribe();
// this.clockSubscription = undefined;
}
this.stateChanges.complete();
}
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TimeAgoPipe, deps: [{ token: i0.ChangeDetectorRef }, { token: TimeAgoService }, { token: i4.CloudTranslateService }], target: i0.ɵɵFactoryTarget.Pipe }); }
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: TimeAgoPipe, isStandalone: false, name: "timeAgo", pure: false }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TimeAgoPipe, decorators: [{
type: Pipe,
args: [{
name: 'timeAgo',
pure: false,
standalone: false
}]
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: TimeAgoService }, { type: i4.CloudTranslateService }] });
class UserlogsComponent {
constructor(userlogService) {
this.userlogService = userlogService;
this.opened = false;
this.onClose = new EventEmitter();
this.memberAccess = [];
}
ngOnInit() {
this.init();
}
init() {
this.userlogService.loadData({ pageSize: 20, pageNumber: 0 }).subscribe((data) => {
if (data.type !== ErrorMessage.TYPE) {
this.memberAccess = data?.items || [];
}
});
}
closeUserlog() {
this.onClose.emit(true);
}
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UserlogsComponent, deps: [{ token: UserlogService }], target: i0.ɵɵFactoryTarget.Component }); }
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: UserlogsComponent, isStandalone: false, selector: "app-userlogs", inputs: { opened: "opened" }, outputs: { onClose: "onClose" }, ngImport: i0, template: "<div class=\"slide-nav \" [ngClass]=\"{'opened': opened}\">\n <div class=\" bg-white pt-2\">\n <div class=\"d-flex justify-content-between align-items-center w-100 mb-2 px-3\">\n <div style=\"font-size: 16px\" class=\"mb-0 header\">ACCESS HISTORY</div>\n <button class=\"btn btn-sm btn-light bg-white border-0\" (click)=\"closeUserlog()\">\n <i class=\"fa fa-times text-primary\" aria-hidden=\"true\"></i></button>\n </div>\n <div style=\"height: calc( 100vh - 95px );overflow: auto;\" class=\"mb-2\">\n <div class=\"mx-3\">\n <div *ngFor=\"let access of memberAccess\" class=\"rounded bg-user-log w-100 d-flex mb-3 row m-0 pt-2 f-12\">\n <div class=\" d-flex justify-content-between mb-2 row m-0 col-sm-12 px-2\">\n <div class=\"p-2 rounded bg-light-blue col-sm-4 d-flex align-items-center justify-content-center\">\n <p class=\"common-font text-primary text-center mb-0\"><i class=\"fa fa-history mr-1\" aria-hidden=\"true\"></i> {{access?.logtime | timeAgo}}\n </p>\n<!-- <p class=\"mb-0 common-font text-primary\">{{access?.logtime | date: 'dd/MM/yyy'}}</p>-->\n </div>\n <div class=\" common-font col-sm-8 \">\n <p class=\" mb-2\">Browser: <span class=\"text-primary ml-2\">{{access?.browser}}</span></p>\n <div class=\"mb-0 font-weight-bold d-flex align-items-center mb-0\"><i\n class=\"fa fa-adn fa-2x text-primary mr-2\"\n aria-hidden=\"true\"></i> {{access?.application }}</div>\n </div>\n\n </div>\n <div class=\" d-flex justify-content-between mb-2 row m-0 col-sm-12\">\n <div class=\" d-flex align-items-center common-font col-sm-4 p-0\">\n <div class=\"font-weight-bold d-flex align-items-center mb-0\"><i\n class=\"fa fa-laptop text-primary mr-2\" aria-hidden=\"true\"></i> <span\n class=\"font-weight-bold\">{{access?.deviceType }}</span></div>\n </div>\n <div class=\" common-font col-sm-8\">\n<!-- <p class=\"mb-2\">Url access: <span class=\"text-primary ml-2\">{{access?.serviceName}}</span>-->\n<!-- </p>-->\n <div class=\"font-weight-bold d-flex align-items-center mb-0\"><i\n class=\"fa fa-map-marker fa-2x text-primary mr-2\" aria-hidden=\"true\"></i> <span\n class=\"font-weight-bold\">{{access?.remoteAddress}}</span></div>\n </div>\n </div>\n </div>\n\n </div>\n </div>\n </div>\n</div>\n", styles: [".bg-light-blue{background:#c1dfee}.header{font-weight:700;font-size:1.5625rem;color:#2a7eda;font-family:Roboto,sans-serif}.bg-user-log{background:#f1fafe}.common-font{color:#464849}.text-blue{color:#629fd7}.f-12{font-size:12px!important}\n"], dependencies: [{ kind: "directive", type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "pipe", type: TimeAgoPipe, name: "timeAgo" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UserlogsComponent, decorators: [{
type: Component,
args: [{ selector: 'app-userlogs', standalone: false, template: "<div class=\"slide-nav \" [ngClass]=\"{'opened': opened}\">\n <div class=\" bg-white pt-2\">\n <div class=\"d-flex justify-content-between align-items-center w-100 mb-2 px-3\">\n <div style=\"font-size: 16px\" class=\"mb-0 header\">ACCESS HISTORY</div>\n <button class=\"btn btn-sm btn-light bg-white border-0\" (click)=\"closeUserlog()\">\n <i class=\"fa fa-times text-primary\" aria-hidden=\"true\"></i></button>\n </div>\n <div style=\"height: calc( 100vh - 95px );overflow: auto;\" class=\"mb-2\">\n <div class=\"mx-3\">\n <div *ngFor=\"let access of memberAccess\" class=\"rounded bg-user-log w-100 d-flex mb-3 row m-0 pt-2 f-12\">\n <div class=\" d-flex justify-content-between mb-2 row m-0 col-sm-12 px-2\">\n <div class=\"p-2 rounded bg-light-blue col-sm-4 d-flex align-items-center justify-content-center\">\n <p class=\"common-font text-primary text-center mb-0\"><i class=\"fa fa-history mr-1\" aria-hidden=\"true\"></i> {{access?.logtime | timeAgo}}\n </p>\n<!-- <p class=\"mb-0 common-font text-primary\">{{access?.logtime | date: 'dd/MM/yyy'}}</p>-->\n </div>\n <div class=\" common-font col-sm-8 \">\n <p class=\" mb-2\">Browser: <span class=\"text-primary ml-2\">{{access?.browser}}</span></p>\n <div class=\"mb-0 font-weight-bold d-flex align-items-center mb-0\"><i\n class=\"fa fa-adn fa-2x text-primary mr-2\"\n aria-hidden=\"true\"></i> {{access?.application }}</div>\n </div>\n\n </div>\n <div class=\" d-flex justify-content-between mb-2 row m-0 col-sm-12\">\n <div class=\" d-flex align-items-center common-font col-sm-4 p-0\">\n <div class=\"font-weight-bold d-flex align-items-center mb-0\"><i\n class=\"fa fa-laptop text-primary mr-2\" aria-hidden=\"true\"></i> <span\n class=\"font-weight-bold\">{{access?.deviceType }}</span></div>\n </div>\n <div class=\" common-font col-sm-8\">\n<!-- <p class=\"mb-2\">Url access: <span class=\"text-primary ml-2\">{{access?.serviceName}}</span>-->\n<!-- </p>-->\n <div class=\"font-weight-bold d-flex align-items-center mb-0\"><i\n class=\"fa fa-map-marker fa-2x text-primary mr-2\" aria-hidden=\"true\"></i> <span\n class=\"font-weight-bold\">{{access?.remoteAddress}}</span></div>\n </div>\n </div>\n </div>\n\n </div>\n </div>\n </div>\n</div>\n", styles: [".bg-light-blue{background:#c1dfee}.header{font-weight:700;font-size:1.5625rem;color:#2a7eda;font-family:Roboto,sans-serif}.bg-user-log{background:#f1fafe}.common-font{color:#464849}.text-blue{color:#629fd7}.f-12{font-size:12px!important}\n"] }]
}], ctorParameters: () => [{ type: UserlogService }], propDecorators: { opened: [{
type: Input
}], onClose: [{
type: Output
}] } });
class AbstractSideNavComponent {
constructor(elementRef) {
this.elementRef = elementRef;
this.opened = false;
this.onClose = new EventEmitter();
this.onClear = new EventEmitter();
this.onLoad = new EventEmitter();
this.overflowCls = 'overflow-hidden';
}
ngOnChanges(changes) {
const currentValue = changes['opened']["currentValue"];
setTimeout(() => {
if (currentValue) {
this.open();
}
else if (changes['opened']['previousValue'] != currentValue) {
this.close();
}
}, 1);
}
open() {
if (!document.body.classList.contains(this.overflowCls)) {
document.body.classList.add(this.overflowCls);
}
}
close() {
if (document.body.classList.contains(this.overflowCls)) {
document.body.classList.remove(this.overflowCls);
}
this.opened = false;
this.onClose.emit(this.opened);
}
// eslint-disable-next-line @angular-eslint/no-empty-lifecycle-method
ngOnDestroy() {
}
clickOut(event) {
if (!this.elementRef.nativeElement.contains(event.target)
&& this.opened && !event.target.closest('.nav-item') &&
!event.target.closest('.search-input__icon')) {
this.close();
}
}
clickInside(event) {
if (this.elementRef.nativeElement.contains(event.target)) {
}
}
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AbstractSideNavComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: AbstractSideNavComponent, isStandalone: false, selector: "app-admin-side-nav", inputs: { opened: "opened" }, outputs: { onClose: "onClose", onClear: "onClear", onLoad: "onLoad" }, host: { listeners: { "document:click": "clickOut($event)", "click": "clickInside($event)" } }, usesOnChanges: true, ngImport: i0, template: ``, isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AbstractSideNavComponent, decorators: [{
type: Component,
args: [{
selector: 'app-admin-side-nav',
template: ``,
standalone: false
}]
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { opened: [{
type: Input
}], onClose: [{
type: Output
}], onClear: [{
type: Output
}], onLoad: [{
type: Output
}], clickOut: [{
type: HostListener,
args: ['document:click', ['$event']]
}], clickInside: [{
type: HostListener,
args: ['click', ['$event']]
}] } });
class MessageSideNavComponent extends AbstractSideNavComponent {
constructor(service, elementRef, securityService) {
super(elementRef);
this.service = service;
this.elementRef = elementRef;
this.securityService = securityService;
// keyword: string;
this.loaded = false;
this.messages = [];
this.totalMessage = 0;
this.pageNumber = 0;
this.pageSize = 10;
}
ngOnChanges(changes) {
const currentValue = changes['opened']["currentValue"];
setTimeout(() => {
if (currentValue) {
this.open();
if (!this.loaded) {
this.pageNumber = 0;
this.listMessage({ pageSize: this.pageSize, pageNumber: this.pageNumber, notifylist: true });
}
}
else {
this.close();
}
}, 10);
}
isUser() {
if (!iNet.username) {
return false;
}
return this.securityService.hasRole('firmuser,firm_user');
}
listMessage(params) {
if (this.isUser()) {
this.service.getMessages(params).subscribe((response) => {
this.messages = response.items;
this.totalMessage = response.total;
this.loaded = true;
});
}
}
loadMessageMore() {
if (this.isUser()) {
this.pageNumber += 1;
this.service.getMessages({
pageSize: this.pageSize,
pageNumber: this.pageNumber,
notifylist: true
}).subscribe((response) => {
this.messages = [...this.messages, ...response.items];
});
}
}
clearMessage() {
if (this.isUser()) {
this.service.clearAll().subscribe(response => {
this.messages = [];
this.totalMessage = 0;
this.onClear.emit(true);
});
}
}
openMessage(msg) {
if (this.isUser()) {
if (!msg.read && msg.application && msg.activityID) {
this.service.loadNotify(msg.application, msg.activityID).subscribe((message) => {
msg.read = true;
this.onLoad.emit(true);
});
}
}
}
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MessageSideNavComponent, deps: [{ token: i4.NotifyMessageService }, { token: i0.ElementRef }, { token: i1.SecurityService }], target: i0.ɵɵFactoryTarget.Component }); }
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: MessageSideNavComponent, isStandalone: false, selector: "app-admin-message-side-nav", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"slide-nav\" [ngClass]=\"{'opened': opened}\">\n <div class=\"list-header\">\n