@tuki-io/tuki-widgets 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/.editorconfig +16 -0
  2. package/.vscode/extensions.json +4 -0
  3. package/.vscode/launch.json +20 -0
  4. package/.vscode/tasks.json +42 -0
  5. package/README.md +27 -0
  6. package/angular.json +41 -0
  7. package/package.json +42 -0
  8. package/projects/tuki/widgets/README.md +24 -0
  9. package/projects/tuki/widgets/karma.conf.js +44 -0
  10. package/projects/tuki/widgets/ng-package.json +7 -0
  11. package/projects/tuki/widgets/package.json +13 -0
  12. package/projects/tuki/widgets/src/lib/widgets.component.spec.ts +23 -0
  13. package/projects/tuki/widgets/src/lib/widgets.component.ts +20 -0
  14. package/projects/tuki/widgets/src/lib/widgets.module.ts +16 -0
  15. package/projects/tuki/widgets/src/lib/widgets.service.spec.ts +16 -0
  16. package/projects/tuki/widgets/src/lib/widgets.service.ts +9 -0
  17. package/projects/tuki/widgets/src/public-api.ts +7 -0
  18. package/projects/tuki/widgets/src/test.ts +27 -0
  19. package/projects/tuki/widgets/styles/_variables.scss +90 -0
  20. package/projects/tuki/widgets/styles/form.scss +231 -0
  21. package/projects/tuki/widgets/styles/icons.scss +32 -0
  22. package/projects/tuki/widgets/styles/styles.scss +110 -0
  23. package/projects/tuki/widgets/styles/tables.scss +30 -0
  24. package/projects/tuki/widgets/tsconfig.lib.json +36 -0
  25. package/projects/tuki/widgets/tsconfig.lib.prod.json +10 -0
  26. package/projects/tuki/widgets/tsconfig.spec.json +17 -0
  27. package/projects/tuki/widgets/user-manage/ng-package.json +7 -0
  28. package/projects/tuki/widgets/user-manage/public-api.ts +6 -0
  29. package/projects/tuki/widgets/user-manage/src/app.constants.ts +38 -0
  30. package/projects/tuki/widgets/user-manage/src/classes/device.ts +225 -0
  31. package/projects/tuki/widgets/user-manage/src/classes/line.ts +117 -0
  32. package/projects/tuki/widgets/user-manage/src/classes/notification.ts +39 -0
  33. package/projects/tuki/widgets/user-manage/src/classes/pagination.ts +18 -0
  34. package/projects/tuki/widgets/user-manage/src/classes/simplified-user.ts +128 -0
  35. package/projects/tuki/widgets/user-manage/src/classes/table-data.ts +6 -0
  36. package/projects/tuki/widgets/user-manage/src/classes/user-interface.ts +225 -0
  37. package/projects/tuki/widgets/user-manage/src/classes/user-list.ts +40 -0
  38. package/projects/tuki/widgets/user-manage/src/classes/user.ts +8 -0
  39. package/projects/tuki/widgets/user-manage/src/common-functions.ts +16 -0
  40. package/projects/tuki/widgets/user-manage/src/environments/environment.prod.ts +9 -0
  41. package/projects/tuki/widgets/user-manage/src/environments/environment.ts +10 -0
  42. package/projects/tuki/widgets/user-manage/src/interseptors/auth.interceptor.ts +36 -0
  43. package/projects/tuki/widgets/user-manage/src/lazy-loading-select/lazy-loading-select.component.html +50 -0
  44. package/projects/tuki/widgets/user-manage/src/lazy-loading-select/lazy-loading-select.component.scss +3 -0
  45. package/projects/tuki/widgets/user-manage/src/lazy-loading-select/lazy-loading-select.component.ts +81 -0
  46. package/projects/tuki/widgets/user-manage/src/material.module.ts +85 -0
  47. package/projects/tuki/widgets/user-manage/src/notifications/notification.component.html +33 -0
  48. package/projects/tuki/widgets/user-manage/src/notifications/notification.component.scss +84 -0
  49. package/projects/tuki/widgets/user-manage/src/notifications/notification.component.ts +46 -0
  50. package/projects/tuki/widgets/user-manage/src/removeKynFromIBM.service.ts +25 -0
  51. package/projects/tuki/widgets/user-manage/src/services/api.service.ts +89 -0
  52. package/projects/tuki/widgets/user-manage/src/services/notification.service.ts +68 -0
  53. package/projects/tuki/widgets/user-manage/src/services/removeKynFromIBM.service.ts +25 -0
  54. package/projects/tuki/widgets/user-manage/src/services/site-settings.service.ts +35 -0
  55. package/projects/tuki/widgets/user-manage/src/services/user.service.ts +120 -0
  56. package/projects/tuki/widgets/user-manage/src/services/users-search.service.ts +58 -0
  57. package/projects/tuki/widgets/user-manage/src/services/utils.service.ts +71 -0
  58. package/projects/tuki/widgets/user-manage/src/styles/_variables.scss +90 -0
  59. package/projects/tuki/widgets/user-manage/src/styles/form.scss +231 -0
  60. package/projects/tuki/widgets/user-manage/src/styles/icons.scss +32 -0
  61. package/projects/tuki/widgets/user-manage/src/styles/styles.scss +110 -0
  62. package/projects/tuki/widgets/user-manage/src/styles/tables.scss +30 -0
  63. package/projects/tuki/widgets/user-manage/src/user-details/notification.service.ts +68 -0
  64. package/projects/tuki/widgets/user-manage/src/user-info/user-info.component.html +32 -0
  65. package/projects/tuki/widgets/user-manage/src/user-info/user-info.component.scss +53 -0
  66. package/projects/tuki/widgets/user-manage/src/user-info/user-info.component.ts +19 -0
  67. package/projects/tuki/widgets/user-manage/src/user-manage-widget.component.html +291 -0
  68. package/projects/tuki/widgets/user-manage/src/user-manage-widget.component.scss +461 -0
  69. package/projects/tuki/widgets/user-manage/src/user-manage-widget.component.ts +163 -0
  70. package/projects/tuki/widgets/user-manage/src/user-manage.module.ts +53 -0
  71. package/projects/tuki/widgets/user-manage/src/utils/app-loader/app-loader.component.html +6 -0
  72. package/projects/tuki/widgets/user-manage/src/utils/app-loader/app-loader.component.scss +11 -0
  73. package/projects/tuki/widgets/user-manage/src/utils/app-loader/app-loader.ts +13 -0
  74. package/projects/tuki/widgets/user-manage/src/utils/pagination/pagination.component.html +26 -0
  75. package/projects/tuki/widgets/user-manage/src/utils/pagination/pagination.component.scss +41 -0
  76. package/projects/tuki/widgets/user-manage/src/utils/pagination/pagination.component.ts +41 -0
  77. package/projects/tuki/widgets/users-list/ng-package.json +6 -0
  78. package/projects/tuki/widgets/users-list/public-api.ts +8 -0
  79. package/projects/tuki/widgets/users-list/src/app.constants.ts +35 -0
  80. package/projects/tuki/widgets/users-list/src/classes/device.ts +225 -0
  81. package/projects/tuki/widgets/users-list/src/classes/line.ts +117 -0
  82. package/projects/tuki/widgets/users-list/src/classes/notification.ts +38 -0
  83. package/projects/tuki/widgets/users-list/src/classes/pagination.ts +18 -0
  84. package/projects/tuki/widgets/users-list/src/classes/simlified-user.ts +74 -0
  85. package/projects/tuki/widgets/users-list/src/classes/table-data.ts +6 -0
  86. package/projects/tuki/widgets/users-list/src/classes/user-interface.ts +225 -0
  87. package/projects/tuki/widgets/users-list/src/classes/user-list.ts +40 -0
  88. package/projects/tuki/widgets/users-list/src/classes/user.ts +8 -0
  89. package/projects/tuki/widgets/users-list/src/material.module.ts +84 -0
  90. package/projects/tuki/widgets/users-list/src/services/api.service.ts +87 -0
  91. package/projects/tuki/widgets/users-list/src/services/events-communication.service.ts +11 -0
  92. package/projects/tuki/widgets/users-list/src/services/notification.service.ts +68 -0
  93. package/projects/tuki/widgets/users-list/src/services/removeKynFromIBM.service.ts +25 -0
  94. package/projects/tuki/widgets/users-list/src/services/user.service.ts +117 -0
  95. package/projects/tuki/widgets/users-list/src/services/users-search.service.ts +58 -0
  96. package/projects/tuki/widgets/users-list/src/users-list.component.css +4 -0
  97. package/projects/tuki/widgets/users-list/src/users-list.component.css.map +1 -0
  98. package/projects/tuki/widgets/users-list/src/users-list.component.html +39 -0
  99. package/projects/tuki/widgets/users-list/src/users-list.component.scss +9 -0
  100. package/projects/tuki/widgets/users-list/src/users-list.component.ts +85 -0
  101. package/projects/tuki/widgets/users-list/src/users-list.module.ts +36 -0
  102. package/projects/tuki/widgets/users-list/src/utils/app-loader/app-loader.component.css +11 -0
  103. package/projects/tuki/widgets/users-list/src/utils/app-loader/app-loader.component.css.map +1 -0
  104. package/projects/tuki/widgets/users-list/src/utils/app-loader/app-loader.component.html +6 -0
  105. package/projects/tuki/widgets/users-list/src/utils/app-loader/app-loader.component.scss +11 -0
  106. package/projects/tuki/widgets/users-list/src/utils/app-loader/app-loader.ts +13 -0
  107. package/projects/tuki/widgets/users-list/src/utils/common-functions.ts +16 -0
  108. package/projects/tuki/widgets/users-list/src/utils/notifications/notification.component.html +33 -0
  109. package/projects/tuki/widgets/users-list/src/utils/notifications/notification.component.scss +84 -0
  110. package/projects/tuki/widgets/users-list/src/utils/notifications/notification.component.ts +46 -0
  111. package/projects/tuki/widgets/users-list/src/utils/pagination/pagination.component.css +45 -0
  112. package/projects/tuki/widgets/users-list/src/utils/pagination/pagination.component.css.map +1 -0
  113. package/projects/tuki/widgets/users-list/src/utils/pagination/pagination.component.html +26 -0
  114. package/projects/tuki/widgets/users-list/src/utils/pagination/pagination.component.scss +41 -0
  115. package/projects/tuki/widgets/users-list/src/utils/pagination/pagination.component.ts +41 -0
  116. package/projects/tuki/widgets/users-list/src/utils/utils.service.ts +71 -0
  117. package/tsconfig.json +46 -0
@@ -0,0 +1,46 @@
1
+ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
2
+ import { Subscription } from 'rxjs';
3
+ import { NotificationService } from '../services/notification.service';
4
+ import { Notification } from '../classes/notification';
5
+
6
+ @Component({
7
+ selector: 'app-notification',
8
+ templateUrl: './notification.component.html',
9
+ styleUrls: ['./notification.component.scss'],
10
+ changeDetection: ChangeDetectionStrategy.OnPush
11
+ })
12
+ export class NotificationsComponent implements OnInit, OnDestroy {
13
+ public list!: Notification[];
14
+ public isReadMore!: boolean;
15
+ private listSubscription!: Subscription;
16
+
17
+ constructor(
18
+ public notificationService: NotificationService,
19
+ private ref: ChangeDetectorRef
20
+ ) {
21
+ }
22
+
23
+ ngOnInit() {
24
+ this.listChangeSubscribe();
25
+ }
26
+
27
+ ngOnDestroy() {
28
+ this.listSubscription.unsubscribe();
29
+ }
30
+
31
+ public readMore(): void {
32
+ this.isReadMore = !this.isReadMore;
33
+ }
34
+
35
+ public removeNotification(notification: Notification): void {
36
+ this.notificationService.remove(notification);
37
+ }
38
+
39
+ private listChangeSubscribe(): void {
40
+ this.listSubscription = this.notificationService.listChange
41
+ .subscribe((list: any) => {
42
+ this.list = list;
43
+ this.ref.detectChanges();
44
+ });
45
+ }
46
+ }
@@ -0,0 +1,25 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { CUCMS_TO_IGNORE, CUCS_TO_IGNORE } from './app.constants';
3
+
4
+ @Injectable()
5
+ export class RemoveKynFromIBMService {
6
+ constructor() {
7
+ }
8
+
9
+
10
+ removeCUCMS(date: any, customerId: number) {
11
+ if (customerId === 8) {
12
+ return date.filter((val: any) => !CUCMS_TO_IGNORE.includes(Math.round(val.cucmId)));
13
+ }
14
+ return date;
15
+ }
16
+
17
+ removeCUCS(date: any, customerId: number) {
18
+ if (customerId === 8) {
19
+ return date.filter((val: any) => !CUCS_TO_IGNORE.includes(Math.round(val.cucId)));
20
+ }
21
+ return date;
22
+ }
23
+
24
+
25
+ }
@@ -0,0 +1,89 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { HttpClient, HttpHeaders } from '@angular/common/http';
3
+ import { TableDataInterface } from '../classes/table-data';
4
+ import { Observable } from 'rxjs';
5
+
6
+ const apiUrl = 'http://192.168.0.191:8080';
7
+
8
+
9
+ @Injectable()
10
+ export class APIService {
11
+ public token: any;
12
+ constructor(
13
+ private httpClient: HttpClient
14
+ ) {
15
+ }
16
+
17
+ fetch(url: string, params?: any, cache?: boolean) {
18
+ const headers = this.getHeaders(cache);
19
+ params = params || {};
20
+ return this.httpClient.get(apiUrl + url, {params: this.prepareEncodedParams(params), headers});
21
+ }
22
+
23
+ post(url: string, body: any, params = {}): any {
24
+ body = body || null;
25
+ const headers = this.getHeaders();
26
+ return this.httpClient.post(apiUrl + url, body, {params: this.prepareEncodedParams(params), headers});
27
+ }
28
+
29
+ // use when response extended data is necessary:
30
+ postExtended(url: string, body = null, params = {}, headers = {}) {
31
+ headers = headers || this.getHeaders();
32
+ return this.httpClient.post(apiUrl + url, body, {
33
+ headers,
34
+ observe: 'response',
35
+ params: this.prepareEncodedParams(params)
36
+ });
37
+ }
38
+
39
+ put(url: string, body = null, params = {}) {
40
+ const headers = this.getHeaders();
41
+ return this.httpClient.put(apiUrl + url, body, {headers, params: this.prepareEncodedParams(params)});
42
+ }
43
+
44
+ delete(url: string, params = {}) {
45
+ const headers = this.getHeaders();
46
+ return this.httpClient.delete(apiUrl + url, {headers, params: this.prepareEncodedParams(params)});
47
+ }
48
+
49
+ fetchPagination(url: string, pageSize: number, pageNumber: number, additionalParams = {}, cache?: boolean): Observable<TableDataInterface> {
50
+ const copyAdditionalParams = JSON.parse(JSON.stringify(additionalParams));
51
+ const params = Object.assign(copyAdditionalParams, {size: pageSize.toString(), page: pageNumber.toString()});
52
+ return this.fetch(url, params, cache) as Observable<TableDataInterface>;
53
+ }
54
+
55
+ private prepareEncodedParams(params: any) {
56
+ const result: any = {};
57
+
58
+ if (!params) {
59
+ return {};
60
+ }
61
+ for (const key of Object.keys(params)) {
62
+ if (params[key]) {
63
+ const stringParam = params[key].toString();
64
+ result[key] = stringParam.includes('+') ? encodeURIComponent(stringParam) : stringParam;
65
+ }
66
+ }
67
+ return result;
68
+ }
69
+
70
+ private getHeaders(cache?: boolean): HttpHeaders {
71
+ let headers = new HttpHeaders();
72
+ if (cache) {
73
+ headers = headers.append('_Cache', 'true ');
74
+ }
75
+ const token = this.token || this.getParameterByName('token');
76
+ headers = headers.append('Authorization', 'Bearer '+ token);
77
+ return headers;
78
+ }
79
+
80
+ private getParameterByName(name: any, url = window.location.href) {
81
+ name = name.replace(/[\[\]]/g, '\\$&');
82
+ var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
83
+ results = regex.exec(url);
84
+ if (!results) return null;
85
+ if (!results[2]) return '';
86
+ return decodeURIComponent(results[2].replace(/\+/g, ' '));
87
+ }
88
+
89
+ }
@@ -0,0 +1,68 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { Notification } from '../classes/notification';
3
+ import { Subject } from 'rxjs';
4
+ const SUCCESS_TIME = 5000;
5
+ const INACTIVE_SESSION_MESSAGE = 'Your session was lost due to inactivity. Please login again';
6
+ const INACTIVE_SESSION = 'SESSION_INACTIVE';
7
+
8
+ @Injectable()
9
+ export class NotificationService {
10
+
11
+ public listChange = new Subject();
12
+
13
+ private max = 0;
14
+ private list: Notification[] = [];
15
+
16
+ constructor(
17
+ ) {
18
+ }
19
+
20
+ error(message: string, ttl?: number): void {
21
+ this.notify('error', message, ttl);
22
+ }
23
+
24
+ success(message: string, ttl?: number): void {
25
+ this.notify('success', message, (!ttl) ? SUCCESS_TIME : ttl);
26
+ }
27
+
28
+ warning(message: string, ttl?: number): void {
29
+ this.notify('warning', message, ttl);
30
+ }
31
+
32
+ info(message: string, ttl?: number): void {
33
+ this.notify('info', message, ttl);
34
+ }
35
+ private notify(type: string, message: string, ttl?: number): void {
36
+ const found = this.list.find((n: Notification) => n.message === message);
37
+ if (found) {
38
+ this.remove(found);
39
+ }
40
+ const notification = new Notification({
41
+ id: ++this.max,
42
+ type, message, ttl
43
+ });
44
+ if (notification.ttl > 0) {
45
+ notification.timerId = setTimeout(() => this.remove(notification, true), notification.ttl);
46
+ }
47
+ this.list.push(notification);
48
+ this.listChange.next(this.list);
49
+ }
50
+
51
+ remove(notification: Notification, auto?: boolean): void {
52
+ if (!auto && notification.timerId) {
53
+ // clear timeout in case of manual remove
54
+ clearInterval(notification.timerId);
55
+ }
56
+ this.list = this.list.filter(n => n.id !== notification.id);
57
+ this.listChange.next(this.list);
58
+ }
59
+
60
+ private removeInactiveSessionError(): void {
61
+ if (!this.list || !this.list.length) {
62
+ return;
63
+ }
64
+ this.list = this.list.filter(n => n.message !== INACTIVE_SESSION_MESSAGE && n.message !== INACTIVE_SESSION);
65
+ this.listChange.next(this.list);
66
+ }
67
+
68
+ }
@@ -0,0 +1,25 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { CUCMS_TO_IGNORE, CUCS_TO_IGNORE } from '../app.constants';
3
+
4
+ @Injectable()
5
+ export class RemoveKynFromIBMService {
6
+ constructor() {
7
+ }
8
+
9
+
10
+ removeCUCMS(date: any, customerId: number) {
11
+ if (customerId === 8) {
12
+ return date.filter((val: any) => !CUCMS_TO_IGNORE.includes(Math.round(val.cucmId)));
13
+ }
14
+ return date;
15
+ }
16
+
17
+ removeCUCS(date: any, customerId: number) {
18
+ if (customerId === 8) {
19
+ return date.filter((val: any) => !CUCS_TO_IGNORE.includes(Math.round(val.cucId)));
20
+ }
21
+ return date;
22
+ }
23
+
24
+
25
+ }
@@ -0,0 +1,35 @@
1
+ import { Injectable, OnInit } from '@angular/core';
2
+ import { APIService } from './api.service';
3
+ import { API } from '../app.constants';
4
+ import { Observable } from 'rxjs';
5
+ import { map } from 'rxjs/operators';
6
+ const urlMap = {
7
+ locations: API.LOCATION,
8
+ userLocales: API.USER_LOCALES,
9
+ userProfiles: API.USER_PROFILES
10
+ }
11
+
12
+ @Injectable()
13
+ export class SiteSettingsService {
14
+
15
+ constructor(
16
+ private apiService: APIService
17
+ ) {
18
+
19
+ }
20
+ public getSelectionOptions(siteId: number, token: string): any {
21
+ if(!siteId) {
22
+ return;
23
+ }
24
+ // @ts-ignore
25
+ const URL = urlMap[token];
26
+ return this.apiService.fetch(URL.replace(':siteId', String(siteId)), null, true)
27
+ // @ts-ignore
28
+ .pipe(map((options: string[]) => {
29
+ // @ts-ignore
30
+ this[token] = options ? options.sort() : [];
31
+ // @ts-ignore
32
+ return this[token];
33
+ }))
34
+ }
35
+ }
@@ -0,0 +1,120 @@
1
+ import {Injectable, OnInit} from '@angular/core';
2
+ import { Observable, of, forkJoin } from 'rxjs';
3
+ import { SimplifiedUser } from '../classes/simplified-user';
4
+ import { API } from '../app.constants';
5
+ import { APIService } from './api.service';
6
+ import { map } from 'rxjs/operators';
7
+ import { UtilsService } from './utils.service';
8
+
9
+ @Injectable()
10
+ export class UserService implements OnInit{
11
+ siteId: number = -1;
12
+ userId: string = '';
13
+ userIdExistPending = false;
14
+ hasExistedUserId = false;
15
+ user!: SimplifiedUser;
16
+ originUser!: SimplifiedUser;
17
+
18
+ constructor(
19
+ private apiService: APIService
20
+ ) {
21
+
22
+ }
23
+
24
+ ngOnInit(): void {
25
+ console.log(this.siteId)
26
+ }
27
+
28
+ public fetchUserToken(siteId: number, userId: string): any {
29
+ if (this.siteId === siteId && this.userId === userId && this.user) {
30
+ return of(this.user);
31
+ }
32
+ this.siteId = siteId;
33
+ this.userId = userId;
34
+ return this.apiService.fetch(API.USER_TOKEN.replace(':siteId', String(this.siteId)).replace(':userId', encodeURIComponent(encodeURIComponent(userId))))
35
+ .pipe(map((result: any) => {
36
+ this.setSimplifiedUser(Object.values(result)[0]);
37
+ }))
38
+ // .pipe(this.handleError(false, true));
39
+ }
40
+
41
+ public updateUserFields(body: any): any {
42
+ if (!this.userId || !this.siteId || !this.user?.token) {
43
+ return;
44
+ }
45
+ return this.apiService.post(API.UPDATE_USER_FIELDS.replace(':siteId', String(this.siteId)).replace(':token', this.user.token), body)
46
+ // .pipe(this.handleError(false, true));
47
+ }
48
+
49
+ public fetchUserById(id: string) {
50
+ this.userIdExistPending = true;
51
+ return this.apiService.fetch(API.USER_BY_ID.replace(':siteId', String(this.siteId)).replace(':userId', encodeURIComponent(encodeURIComponent(id))))
52
+ .pipe(map(result => {
53
+ this.userIdExistPending = false;
54
+ return result;
55
+ }));
56
+ }
57
+
58
+ public persistCacheChanges() {
59
+ const params = {
60
+ excludeDeviceExtraOptions: true
61
+ };
62
+ return this.processUserChangesToCache()
63
+ .pipe(map((result: any) => {
64
+ return this.apiService.post(API.PERSIST_USER_CACHE.replace(':siteId', String(this.siteId)).replace(':token', this.user.token), {}, params)
65
+ .subscribe(() => {
66
+
67
+ })
68
+ // .pipe(map((user) => {
69
+ // // this.setUser(user, false, this.user.token);
70
+ // this.user.hasModifiedCache = false;
71
+ // }))
72
+ // .pipe(this.handleError(true, true));
73
+ }));
74
+ }
75
+
76
+ public processUserChangesToCache(): any {
77
+ const calls = [];
78
+ const body = UtilsService.diff(this.originUser.getSavableData(), this.user.getSavableData(), 'user');
79
+ if (body) {
80
+ calls.push(this.updateUserFields(body));
81
+ }
82
+ if (!calls?.length) {
83
+ return of(this.user);
84
+ }
85
+
86
+ return forkJoin(calls)
87
+ .pipe(map((responses: any) => {
88
+ // ApiUserResponse
89
+ this.handleSaveUserResponse(responses);
90
+ }))
91
+ // .pipe(this.handleError(false, true));
92
+
93
+ }
94
+
95
+ public hasUnsavedChanges() {
96
+ if (this.user && this.originUser) {
97
+ return !this.user.equal(this.originUser);
98
+ }
99
+ return false;
100
+ }
101
+
102
+ public setSimplifiedUser(user: any): void {
103
+ this.user = new SimplifiedUser(user);
104
+ const copiedUser = JSON.parse(JSON.stringify(user));
105
+ this.originUser = new SimplifiedUser(copiedUser);
106
+ }
107
+
108
+ private handleSaveUserResponse(responses: any) {
109
+ if (!responses?.length) {
110
+ return;
111
+ }
112
+ for (let len = responses.length, i = len - 1; i >= 0; i--) {
113
+ if (responses[i] && responses[i].currentUpdatedUser) {
114
+ // this.setUser(responses[i].currentUpdatedUser, false, this.user.token);
115
+ this.user.hasModifiedCache = true;
116
+ return;
117
+ }
118
+ }
119
+ }
120
+ }
@@ -0,0 +1,58 @@
1
+ import { Injectable, OnInit } from '@angular/core';
2
+ import { SimplifiedUser } from '../classes/simplified-user';
3
+ import { APIService } from './api.service';
4
+ import { ListUser, ListUserInterface } from '../classes/user-list';
5
+ import { BehaviorSubject, Observable } from 'rxjs';
6
+ import { API, PAGINATION_DEFAULTS, PAGINATION_SIZE_OPTIONS } from '../app.constants';
7
+ import { TableDataInterface } from '../classes/table-data';
8
+ import { map } from 'rxjs/operators';
9
+ import { RemoveKynFromIBMService } from '../removeKynFromIBM.service';
10
+ import { PaginationDataDto } from '../classes/pagination';
11
+
12
+
13
+
14
+ @Injectable()
15
+ export class UsersSearchService {
16
+ siteId: number = -1;
17
+ userId: string = '';
18
+ customerId!: number;
19
+ userIdExistPending = false;
20
+ hasExistedUserId = false;
21
+ pageSize = PAGINATION_DEFAULTS.SIZE;
22
+ pageIndex = PAGINATION_DEFAULTS.SIZE;
23
+ pageSizeOptions = PAGINATION_SIZE_OPTIONS;
24
+ total!: number;
25
+ searchParams!: any;
26
+ foundUsers$!: any;
27
+
28
+ constructor(
29
+ private apiService: APIService,
30
+ private removeKynFromIBMService: RemoveKynFromIBMService
31
+ ) {
32
+ this.foundUsers$ = new BehaviorSubject(null);
33
+
34
+ }
35
+
36
+ public getPagination(): PaginationDataDto {
37
+ return {
38
+ total: this.total,
39
+ pageSizeOptions: this.pageSizeOptions,
40
+ pageSize: this.pageSize,
41
+ pageIndex: this.pageIndex
42
+ };
43
+ }
44
+
45
+ public quickRegularUsersSearch() {
46
+ this.searchParams = this.searchParams || {customerid: this.customerId};
47
+ return this.apiService.fetchPagination(API.QUICK_USERS_SEARCH, this.pageSize, this.pageIndex, this.searchParams)
48
+ .pipe(map((res: TableDataInterface) => {
49
+ this.total = res.total;
50
+ // this.totals = this.totals || {};
51
+ // this.totals['users'] = res.total;
52
+ const users = res.pageData && res.pageData.length ? res.pageData.map(user => new ListUser(user)) : [];
53
+ // this.foundUsers$.next(this.removeKynFromIBMService.removeCUCMS(users, this.customerId));
54
+ this.foundUsers$.next(users);
55
+ }));
56
+ // .pipe(this.handleError(true));
57
+ }
58
+ }
@@ -0,0 +1,71 @@
1
+ import { Injectable } from '@angular/core';
2
+
3
+ @Injectable()
4
+ export class UtilsService {
5
+
6
+ static sortSortArrayByProperty(array: [], sortBy: string) {
7
+ if (!array) {
8
+ return null;
9
+ }
10
+ return array.sort((a, b) => {
11
+ if (!a[sortBy] && !b[sortBy]) {
12
+ return 0;
13
+ }
14
+ if (a[sortBy] && !b[sortBy]) {
15
+ return 1;
16
+ }
17
+ if (!a[sortBy] && b[sortBy]) {
18
+ return -1;
19
+ }
20
+ const positionA = a[sortBy];
21
+ const positionB = b[sortBy];
22
+ return (positionA < positionB) ? -1 : (positionA > positionB) ? 1 : 0;
23
+ });
24
+ }
25
+
26
+ static diff(origObject: any, updatedObj: any, path: string, keysToIgnore?: string[]) {
27
+ let result: any = [];
28
+ if (Object.is(origObject, updatedObj)) {
29
+ return undefined;
30
+ }
31
+ if (!updatedObj || typeof updatedObj !== 'object') {
32
+ return updatedObj;
33
+ }
34
+ const concat = Array.from(new Set([...Object.keys(origObject || {}), ...Object.keys(updatedObj || {})]));
35
+ const filter = keysToIgnore ? concat.filter(key => !keysToIgnore.includes(key)) : concat;
36
+ filter
37
+ .forEach(key => {
38
+ if (typeof updatedObj[key] === 'object' && typeof origObject[key] === 'object') {
39
+ if (UtilsService.differs(updatedObj[key], origObject[key])) {
40
+ const newPath = `${path}${path ? '.' : ''}${key}`;
41
+ const values = UtilsService.diff(origObject[key], updatedObj[key], newPath, keysToIgnore);
42
+ if (values !== undefined) {
43
+ result = [...result, ...values];
44
+ }
45
+ }
46
+ } else if (updatedObj && !origObject || updatedObj[key] !== origObject[key] && !Object.is(origObject[key], updatedObj[key])) {
47
+ const value = updatedObj ? UtilsService.formatIfEmpty(updatedObj[key]) : null;
48
+ result.push(`${path}${path ? '.' : ''}${key}=${value}`);
49
+ }
50
+ });
51
+ return result;
52
+ }
53
+
54
+ static formatIfEmpty(value: any) {
55
+ if (value) {
56
+ return value;
57
+ }
58
+ switch (typeof value) {
59
+ case 'boolean':
60
+ return value;
61
+ case 'string':
62
+ return '';
63
+ default:
64
+ return null;
65
+ }
66
+ }
67
+
68
+ static differs(obj1: any, obj2: any): boolean {
69
+ return JSON.stringify(obj1) !== JSON.stringify(obj2);
70
+ }
71
+ }
@@ -0,0 +1,90 @@
1
+ //@import url( 'https://fonts.googleapis.com/css?family=Roboto:400,700|Material+Icons');
2
+ //@import url('https://fonts.googleapis.com/css?family=Raleway:400,100,200,300,500,600,800,700,900');
3
+ @import url('https://fonts.googleapis.com/css?family=Poppins:400,100,200,300,500,600,800,700,900');
4
+ //@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400&display=swap');
5
+
6
+ $fa-font-path : '../../node_modules/font-awesome/fonts';
7
+
8
+ //$common-font: Raleway, 'Raleway', sans-serif;
9
+ //$special-font: Raleway, 'Roboto', sans-serif;
10
+ //$content-font: 'Roboto', sans-serif;
11
+ //$buttons-font: Raleway, 'Raleway', sans-serif;
12
+ //$input-font: 'Roboto', sans-serif;
13
+ $menu-font: Poppins, 'Poppins', sans-serif;
14
+ $main-font: Poppins, 'Poppins', sans-serif;
15
+ //$sub-menu-font: Inter, 'Inter', sans-serif;
16
+ $font-size: 14px;
17
+ $txt-color: rgba(0, 0, 0, 0.87);
18
+ $table-title-color: rgba(0,0,0,.54);;
19
+ $txt-grey-color: #454e5e;
20
+ $header-gradient: linear-gradient(90deg,#0d56aa,#0d56ab);
21
+ $poppins-font: Poppins, 'Poppins', sans-serif;
22
+
23
+ $icon-color: #8E9FB7;
24
+ $active-color: #0D56AA;
25
+ $icon-box-color: #0773BC;
26
+ $mark-color: #009FDB;
27
+ $hover-color: #0985A0;
28
+ $error-color: #C73636;
29
+ $main-txt-color: #333;
30
+
31
+ $table-border-color: rgba(0, 0, 0, 0.12);
32
+ $input-border-color: rgba(0, 0, 0, 0.30);
33
+ $bg-color: #F7F9FB;
34
+
35
+ $error-bg-color: #f2dede;
36
+ $error-border-color: #ebccd1;
37
+ $error-txt-color: #bc1e1b;
38
+ $qob-error-color: #E70707;
39
+
40
+ $warning-bg-color: #fcf8e3;
41
+ $warning-border-color: #e5e1cd;
42
+ $warning-txt-color: #8a6d3b;
43
+
44
+ $success-bg-color: #e3f4dc;
45
+ $success-border-color: #b3d692;
46
+ $success-txt-color: #3c763d;
47
+
48
+ $read-only-txt-color: rgba(0, 0, 0, 0.38);
49
+ $my-menu-txt-color: #555555;
50
+
51
+ $page-background-color: #F3F6F6;
52
+ $disabled-button-text-color: #BABCC5;
53
+ $dark-elements-color: #2C355D;
54
+ $dark-disabled-btn-color: #DFE3E7;
55
+ $disabled-color: #DFE3E7;
56
+ $link-color: #0985A0;
57
+ $title-color: #0985A0;
58
+ $active-link-color: #0985A0;
59
+ $text-color: #646464;
60
+ $light-border-color: #DEE5EA;
61
+ $icon-background: #D2E5E5;
62
+
63
+ // QOB style
64
+ $navy: #2399DA;
65
+ $dark-blue: #2C355D;
66
+ $qob-danger-color: #E70707;
67
+ $qob-disabled-color: #D4D4D4;
68
+
69
+ // WEBEX STYLE
70
+
71
+ $webex-body-bg: #f7f7f7;
72
+
73
+
74
+ $webex-icon-bg: #d0d0d0;
75
+ $webex-icon-color: #2a2a2a;
76
+ $webex-text-color: #252525;
77
+
78
+ $webex-tr-hover-bg: #ededed;
79
+ $webex-tr-border: #dedede;
80
+
81
+ $webex-table-th-bg: #f7f7f7;
82
+ $webex-table-th-txt: #636363;
83
+ $webex-table-th-size: 12px;
84
+
85
+ $webex-table-td-bg: #fff;
86
+ $webex-table-td-txt: #636363;
87
+ $webex-table-td-size: 14px;
88
+
89
+ $webex-pagination-txt: #636363;
90
+ $webex-pagination-hover-bg: #ededed;