@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.
- package/.editorconfig +16 -0
- package/.vscode/extensions.json +4 -0
- package/.vscode/launch.json +20 -0
- package/.vscode/tasks.json +42 -0
- package/README.md +27 -0
- package/angular.json +41 -0
- package/package.json +42 -0
- package/projects/tuki/widgets/README.md +24 -0
- package/projects/tuki/widgets/karma.conf.js +44 -0
- package/projects/tuki/widgets/ng-package.json +7 -0
- package/projects/tuki/widgets/package.json +13 -0
- package/projects/tuki/widgets/src/lib/widgets.component.spec.ts +23 -0
- package/projects/tuki/widgets/src/lib/widgets.component.ts +20 -0
- package/projects/tuki/widgets/src/lib/widgets.module.ts +16 -0
- package/projects/tuki/widgets/src/lib/widgets.service.spec.ts +16 -0
- package/projects/tuki/widgets/src/lib/widgets.service.ts +9 -0
- package/projects/tuki/widgets/src/public-api.ts +7 -0
- package/projects/tuki/widgets/src/test.ts +27 -0
- package/projects/tuki/widgets/styles/_variables.scss +90 -0
- package/projects/tuki/widgets/styles/form.scss +231 -0
- package/projects/tuki/widgets/styles/icons.scss +32 -0
- package/projects/tuki/widgets/styles/styles.scss +110 -0
- package/projects/tuki/widgets/styles/tables.scss +30 -0
- package/projects/tuki/widgets/tsconfig.lib.json +36 -0
- package/projects/tuki/widgets/tsconfig.lib.prod.json +10 -0
- package/projects/tuki/widgets/tsconfig.spec.json +17 -0
- package/projects/tuki/widgets/user-manage/ng-package.json +7 -0
- package/projects/tuki/widgets/user-manage/public-api.ts +6 -0
- package/projects/tuki/widgets/user-manage/src/app.constants.ts +38 -0
- package/projects/tuki/widgets/user-manage/src/classes/device.ts +225 -0
- package/projects/tuki/widgets/user-manage/src/classes/line.ts +117 -0
- package/projects/tuki/widgets/user-manage/src/classes/notification.ts +39 -0
- package/projects/tuki/widgets/user-manage/src/classes/pagination.ts +18 -0
- package/projects/tuki/widgets/user-manage/src/classes/simplified-user.ts +128 -0
- package/projects/tuki/widgets/user-manage/src/classes/table-data.ts +6 -0
- package/projects/tuki/widgets/user-manage/src/classes/user-interface.ts +225 -0
- package/projects/tuki/widgets/user-manage/src/classes/user-list.ts +40 -0
- package/projects/tuki/widgets/user-manage/src/classes/user.ts +8 -0
- package/projects/tuki/widgets/user-manage/src/common-functions.ts +16 -0
- package/projects/tuki/widgets/user-manage/src/environments/environment.prod.ts +9 -0
- package/projects/tuki/widgets/user-manage/src/environments/environment.ts +10 -0
- package/projects/tuki/widgets/user-manage/src/interseptors/auth.interceptor.ts +36 -0
- package/projects/tuki/widgets/user-manage/src/lazy-loading-select/lazy-loading-select.component.html +50 -0
- package/projects/tuki/widgets/user-manage/src/lazy-loading-select/lazy-loading-select.component.scss +3 -0
- package/projects/tuki/widgets/user-manage/src/lazy-loading-select/lazy-loading-select.component.ts +81 -0
- package/projects/tuki/widgets/user-manage/src/material.module.ts +85 -0
- package/projects/tuki/widgets/user-manage/src/notifications/notification.component.html +33 -0
- package/projects/tuki/widgets/user-manage/src/notifications/notification.component.scss +84 -0
- package/projects/tuki/widgets/user-manage/src/notifications/notification.component.ts +46 -0
- package/projects/tuki/widgets/user-manage/src/removeKynFromIBM.service.ts +25 -0
- package/projects/tuki/widgets/user-manage/src/services/api.service.ts +89 -0
- package/projects/tuki/widgets/user-manage/src/services/notification.service.ts +68 -0
- package/projects/tuki/widgets/user-manage/src/services/removeKynFromIBM.service.ts +25 -0
- package/projects/tuki/widgets/user-manage/src/services/site-settings.service.ts +35 -0
- package/projects/tuki/widgets/user-manage/src/services/user.service.ts +120 -0
- package/projects/tuki/widgets/user-manage/src/services/users-search.service.ts +58 -0
- package/projects/tuki/widgets/user-manage/src/services/utils.service.ts +71 -0
- package/projects/tuki/widgets/user-manage/src/styles/_variables.scss +90 -0
- package/projects/tuki/widgets/user-manage/src/styles/form.scss +231 -0
- package/projects/tuki/widgets/user-manage/src/styles/icons.scss +32 -0
- package/projects/tuki/widgets/user-manage/src/styles/styles.scss +110 -0
- package/projects/tuki/widgets/user-manage/src/styles/tables.scss +30 -0
- package/projects/tuki/widgets/user-manage/src/user-details/notification.service.ts +68 -0
- package/projects/tuki/widgets/user-manage/src/user-info/user-info.component.html +32 -0
- package/projects/tuki/widgets/user-manage/src/user-info/user-info.component.scss +53 -0
- package/projects/tuki/widgets/user-manage/src/user-info/user-info.component.ts +19 -0
- package/projects/tuki/widgets/user-manage/src/user-manage-widget.component.html +291 -0
- package/projects/tuki/widgets/user-manage/src/user-manage-widget.component.scss +461 -0
- package/projects/tuki/widgets/user-manage/src/user-manage-widget.component.ts +163 -0
- package/projects/tuki/widgets/user-manage/src/user-manage.module.ts +53 -0
- package/projects/tuki/widgets/user-manage/src/utils/app-loader/app-loader.component.html +6 -0
- package/projects/tuki/widgets/user-manage/src/utils/app-loader/app-loader.component.scss +11 -0
- package/projects/tuki/widgets/user-manage/src/utils/app-loader/app-loader.ts +13 -0
- package/projects/tuki/widgets/user-manage/src/utils/pagination/pagination.component.html +26 -0
- package/projects/tuki/widgets/user-manage/src/utils/pagination/pagination.component.scss +41 -0
- package/projects/tuki/widgets/user-manage/src/utils/pagination/pagination.component.ts +41 -0
- package/projects/tuki/widgets/users-list/ng-package.json +6 -0
- package/projects/tuki/widgets/users-list/public-api.ts +8 -0
- package/projects/tuki/widgets/users-list/src/app.constants.ts +35 -0
- package/projects/tuki/widgets/users-list/src/classes/device.ts +225 -0
- package/projects/tuki/widgets/users-list/src/classes/line.ts +117 -0
- package/projects/tuki/widgets/users-list/src/classes/notification.ts +38 -0
- package/projects/tuki/widgets/users-list/src/classes/pagination.ts +18 -0
- package/projects/tuki/widgets/users-list/src/classes/simlified-user.ts +74 -0
- package/projects/tuki/widgets/users-list/src/classes/table-data.ts +6 -0
- package/projects/tuki/widgets/users-list/src/classes/user-interface.ts +225 -0
- package/projects/tuki/widgets/users-list/src/classes/user-list.ts +40 -0
- package/projects/tuki/widgets/users-list/src/classes/user.ts +8 -0
- package/projects/tuki/widgets/users-list/src/material.module.ts +84 -0
- package/projects/tuki/widgets/users-list/src/services/api.service.ts +87 -0
- package/projects/tuki/widgets/users-list/src/services/events-communication.service.ts +11 -0
- package/projects/tuki/widgets/users-list/src/services/notification.service.ts +68 -0
- package/projects/tuki/widgets/users-list/src/services/removeKynFromIBM.service.ts +25 -0
- package/projects/tuki/widgets/users-list/src/services/user.service.ts +117 -0
- package/projects/tuki/widgets/users-list/src/services/users-search.service.ts +58 -0
- package/projects/tuki/widgets/users-list/src/users-list.component.css +4 -0
- package/projects/tuki/widgets/users-list/src/users-list.component.css.map +1 -0
- package/projects/tuki/widgets/users-list/src/users-list.component.html +39 -0
- package/projects/tuki/widgets/users-list/src/users-list.component.scss +9 -0
- package/projects/tuki/widgets/users-list/src/users-list.component.ts +85 -0
- package/projects/tuki/widgets/users-list/src/users-list.module.ts +36 -0
- package/projects/tuki/widgets/users-list/src/utils/app-loader/app-loader.component.css +11 -0
- package/projects/tuki/widgets/users-list/src/utils/app-loader/app-loader.component.css.map +1 -0
- package/projects/tuki/widgets/users-list/src/utils/app-loader/app-loader.component.html +6 -0
- package/projects/tuki/widgets/users-list/src/utils/app-loader/app-loader.component.scss +11 -0
- package/projects/tuki/widgets/users-list/src/utils/app-loader/app-loader.ts +13 -0
- package/projects/tuki/widgets/users-list/src/utils/common-functions.ts +16 -0
- package/projects/tuki/widgets/users-list/src/utils/notifications/notification.component.html +33 -0
- package/projects/tuki/widgets/users-list/src/utils/notifications/notification.component.scss +84 -0
- package/projects/tuki/widgets/users-list/src/utils/notifications/notification.component.ts +46 -0
- package/projects/tuki/widgets/users-list/src/utils/pagination/pagination.component.css +45 -0
- package/projects/tuki/widgets/users-list/src/utils/pagination/pagination.component.css.map +1 -0
- package/projects/tuki/widgets/users-list/src/utils/pagination/pagination.component.html +26 -0
- package/projects/tuki/widgets/users-list/src/utils/pagination/pagination.component.scss +41 -0
- package/projects/tuki/widgets/users-list/src/utils/pagination/pagination.component.ts +41 -0
- package/projects/tuki/widgets/users-list/src/utils/utils.service.ts +71 -0
- package/tsconfig.json +46 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Injectable, OnInit } from '@angular/core';
|
|
2
|
+
import { SimplifiedUser } from '../classes/simlified-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 @@
|
|
|
1
|
+
{"version":3,"sources":["users-list.component.scss","users-list.component.css"],"names":[],"mappings":"AAAA;EACE,yBAAA;EACA,iBAAA;ACCF","file":"users-list.component.css"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<app-pagination
|
|
2
|
+
[pagination]="usersSearchService.getPagination()"
|
|
3
|
+
[showPageSizeOptions]="true"
|
|
4
|
+
(pageNumberChangeEmitter)="pageNumberChangeEvent($event)"
|
|
5
|
+
(pageEmitter)="pageEvent($event)">
|
|
6
|
+
</app-pagination>
|
|
7
|
+
|
|
8
|
+
<table class="webex-table" mat-table *ngIf="users?.length" #table [dataSource]="dataSource">
|
|
9
|
+
|
|
10
|
+
<ng-container matColumnDef="user-icon">
|
|
11
|
+
<th mat-header-cell *matHeaderCellDef class="webex-table-th"></th>
|
|
12
|
+
<td class="user-site" mat-cell *matCellDef="let user" (click)="onUserClick(user)">
|
|
13
|
+
<span class="icon-webex-box"><span class="icon-webex icon-webex-user"></span></span>
|
|
14
|
+
</td>
|
|
15
|
+
</ng-container>
|
|
16
|
+
|
|
17
|
+
<ng-container matColumnDef="name">
|
|
18
|
+
<th mat-header-cell *matHeaderCellDef class="webex-table-th">First Name/Last Name</th>
|
|
19
|
+
<td class="user-site" mat-cell *matCellDef="let user" (click)="onUserClick(user)"> {{ user.firstName }} {{ user.lastName }}</td>
|
|
20
|
+
</ng-container>
|
|
21
|
+
|
|
22
|
+
<ng-container matColumnDef="email">
|
|
23
|
+
<th mat-header-cell *matHeaderCellDef class="webex-table-th">Email</th>
|
|
24
|
+
<td class="user-site" mat-cell *matCellDef="let user" (click)="onUserClick(user)"> {{ user.email }}</td>
|
|
25
|
+
</ng-container>
|
|
26
|
+
|
|
27
|
+
<ng-container matColumnDef="status">
|
|
28
|
+
<th mat-header-cell *matHeaderCellDef class="webex-table-th">Status</th>
|
|
29
|
+
<td class="user-site" mat-cell *matCellDef="let user" (click)="onUserClick(user)"></td>
|
|
30
|
+
</ng-container>
|
|
31
|
+
|
|
32
|
+
<ng-container matColumnDef="role">
|
|
33
|
+
<th mat-header-cell *matHeaderCellDef class="webex-table-th">Administrator Role</th>
|
|
34
|
+
<td class="user-site" mat-cell *matCellDef="let user" (click)="onUserClick(user)"></td>
|
|
35
|
+
</ng-container>
|
|
36
|
+
|
|
37
|
+
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
|
|
38
|
+
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
39
|
+
</table>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
2
|
+
import { FormGroup } from '@angular/forms';
|
|
3
|
+
import { UserService } from './services/user.service';
|
|
4
|
+
import { APIService } from "./services/api.service";
|
|
5
|
+
import { NotificationService } from './services/notification.service';
|
|
6
|
+
import { Subscription } from 'rxjs';
|
|
7
|
+
import { UsersSearchService } from './services/users-search.service';
|
|
8
|
+
import { ListUser } from './classes/user-list';
|
|
9
|
+
import { MatTableDataSource } from '@angular/material/table';
|
|
10
|
+
import { PageEvent } from '@angular/material/paginator';
|
|
11
|
+
|
|
12
|
+
const DISPLAYED_COLS = ['user-icon', 'name', 'email', 'status', 'role'];
|
|
13
|
+
|
|
14
|
+
@Component({
|
|
15
|
+
selector: 'app-users-list',
|
|
16
|
+
templateUrl: './users-list.component.html',
|
|
17
|
+
styleUrls: ['./users-list.component.scss']
|
|
18
|
+
})
|
|
19
|
+
export class UsersListComponent implements OnInit {
|
|
20
|
+
@Input() token!: string;
|
|
21
|
+
@Input() customerId!: number;
|
|
22
|
+
@Output() openUser = new EventEmitter();
|
|
23
|
+
dataPending!: boolean;
|
|
24
|
+
users!: ListUser[];
|
|
25
|
+
dataSource!: MatTableDataSource<ListUser>;
|
|
26
|
+
displayedColumns = DISPLAYED_COLS;
|
|
27
|
+
private searchSubscription!: Subscription;
|
|
28
|
+
|
|
29
|
+
get form(): FormGroup {
|
|
30
|
+
return this.userService?.user?.form;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
constructor(
|
|
34
|
+
public userService: UserService,
|
|
35
|
+
private apiService: APIService,
|
|
36
|
+
private notifications: NotificationService,
|
|
37
|
+
public usersSearchService: UsersSearchService
|
|
38
|
+
) {
|
|
39
|
+
console.log('users list 1');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
ngOnInit(): void {
|
|
43
|
+
console.log('users list 2');
|
|
44
|
+
this.usersSearchService.customerId = this.customerId;
|
|
45
|
+
this.apiService.token = this.token;
|
|
46
|
+
this.runSearch();
|
|
47
|
+
|
|
48
|
+
this.searchSubscription = this.usersSearchService.foundUsers$
|
|
49
|
+
.subscribe((users: ListUser[]) => {
|
|
50
|
+
this.initializeDataSource(users);
|
|
51
|
+
this.users = users;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public pageNumberChangeEvent(perPageNumber: number): void {
|
|
56
|
+
this.usersSearchService.pageSize = perPageNumber;
|
|
57
|
+
this.usersSearchService.pageIndex = 0;
|
|
58
|
+
this.runSearch();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public pageEvent(event: PageEvent): void {
|
|
62
|
+
this.usersSearchService.pageSize = event.pageSize;
|
|
63
|
+
this.usersSearchService.pageIndex = event.pageIndex;
|
|
64
|
+
this.runSearch();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public onUserClick(user: ListUser): void {
|
|
68
|
+
this.openUser.emit(user);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private initializeDataSource(users: ListUser[]): void {
|
|
72
|
+
this.dataSource = new MatTableDataSource(users);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private runSearch(): void {
|
|
76
|
+
this.dataPending = true;
|
|
77
|
+
this.usersSearchService.quickRegularUsersSearch()
|
|
78
|
+
.subscribe(() => {
|
|
79
|
+
this.dataPending = false;
|
|
80
|
+
}, () => {
|
|
81
|
+
this.dataPending = false;
|
|
82
|
+
this.notifications.error('The data can not be received');
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { UsersListComponent } from './users-list.component';
|
|
3
|
+
import { FormsModule } from '@angular/forms';
|
|
4
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
6
|
+
import { MaterialModule } from './material.module';
|
|
7
|
+
import { PaginationComponent } from './utils/pagination/pagination.component';
|
|
8
|
+
import { UserService } from './services/user.service';
|
|
9
|
+
import { APIService } from './services/api.service';
|
|
10
|
+
import { EventsCommunicationService } from './services/events-communication.service';
|
|
11
|
+
import { UsersSearchService } from './services/users-search.service';
|
|
12
|
+
import { NotificationService } from './services/notification.service';
|
|
13
|
+
import { RemoveKynFromIBMService } from './services/removeKynFromIBM.service';
|
|
14
|
+
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@NgModule({
|
|
18
|
+
declarations: [UsersListComponent, PaginationComponent],
|
|
19
|
+
imports: [
|
|
20
|
+
BrowserModule,
|
|
21
|
+
FormsModule,
|
|
22
|
+
ReactiveFormsModule,
|
|
23
|
+
HttpClientModule,
|
|
24
|
+
MaterialModule
|
|
25
|
+
],
|
|
26
|
+
providers: [
|
|
27
|
+
UserService,
|
|
28
|
+
APIService,
|
|
29
|
+
EventsCommunicationService,
|
|
30
|
+
UsersSearchService,
|
|
31
|
+
NotificationService,
|
|
32
|
+
RemoveKynFromIBMService
|
|
33
|
+
],
|
|
34
|
+
exports: [UsersListComponent]
|
|
35
|
+
})
|
|
36
|
+
export class UsersListModule { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["app-loader.component.scss","app-loader.component.css"],"names":[],"mappings":"AAAA;EACI,eAAA;EACA,WAAA;EACA,YAAA;EACA,MAAA;EACA,OAAA;EACA,QAAA;EACA,SAAA;EACA,0CAAA;EACA,YAAA;ACCJ","file":"app-loader.component.css"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'app-loader',
|
|
5
|
+
templateUrl: './app-loader.component.html',
|
|
6
|
+
styleUrls: ['./app-loader.component.scss'],
|
|
7
|
+
encapsulation: ViewEncapsulation.None,
|
|
8
|
+
})
|
|
9
|
+
export class AppLoaderComponent {
|
|
10
|
+
constructor() {
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const getSavableData = (model: any, exclude?: Array<string>) => {
|
|
2
|
+
let result = Object.keys(model);
|
|
3
|
+
if (exclude && exclude.length) {
|
|
4
|
+
result = result.filter(key => !exclude.some(item => item === key));
|
|
5
|
+
}
|
|
6
|
+
return result.reduce((result, key) => {
|
|
7
|
+
if (model[key] instanceof Array && model[key].length && model[key][0].getSavableData) {
|
|
8
|
+
(result as any)[key] = model[key].map((item: any) => item.getSavableData());
|
|
9
|
+
} else if (model[key] instanceof Object && model[key].getSavableData) {
|
|
10
|
+
(result as any)[key] = model[key].getSavableData();
|
|
11
|
+
} else {
|
|
12
|
+
(result as any)[key] = model[key];
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}, {});
|
|
16
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
<div class="notification-block" role="alert" aria-live="assertive">
|
|
4
|
+
<div class="notification"
|
|
5
|
+
*ngFor="let notification of list"
|
|
6
|
+
[ngClass]="{'error': notification.isError(), 'success': notification.isSuccess()}">
|
|
7
|
+
|
|
8
|
+
<div class="flex-box">
|
|
9
|
+
<div class="notification-icons-block">
|
|
10
|
+
<i *ngIf="notification.isError()" class="fa fa-exclamation-triangle"></i>
|
|
11
|
+
<i *ngIf="notification.isWarning()" class="fa fa-hand-paper-o"></i>
|
|
12
|
+
<i *ngIf="notification.isSuccess()" class="fa fa-check"></i>
|
|
13
|
+
<i *ngIf="notification.isInfo()" class="fa fa-info-circle"></i>
|
|
14
|
+
</div>
|
|
15
|
+
<div *ngIf="!isReadMore" class="message-block">
|
|
16
|
+
{{notification.message | truncate:[93]}}
|
|
17
|
+
</div>
|
|
18
|
+
<div *ngIf="isReadMore" class="message-block">
|
|
19
|
+
{{notification.message}}
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="read-more-error link clickable" *ngIf="notification.message && notification.message.length > 93"
|
|
23
|
+
(click)="readMore()">{{(isReadMore ? 'BUTTON.COLLAPSE' : 'BUTTON.READ_MORE') | translate}}</div>
|
|
24
|
+
<button
|
|
25
|
+
class="close"
|
|
26
|
+
mat-icon-button
|
|
27
|
+
matTooltip="{{'BUTTON.CLOSE' | translate}} {{'NOTIFICATION_MSG.' + notification.type | translate}} {{'NOTIFICATION_MSG.NOTI' | translate}}"
|
|
28
|
+
(click)="removeNotification(notification)">
|
|
29
|
+
<img class="notification-icon-close" src="assets/icons/close_icon_modal.svg" alt="">
|
|
30
|
+
</button>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
-->
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
@import '../../../styles/_variables';
|
|
2
|
+
|
|
3
|
+
.notification-block {
|
|
4
|
+
right: 0;
|
|
5
|
+
top: 110px;
|
|
6
|
+
position: absolute;
|
|
7
|
+
width: 20%;
|
|
8
|
+
z-index: 100;
|
|
9
|
+
|
|
10
|
+
.read-more-error {
|
|
11
|
+
margin: 10px 13px 3px 0;
|
|
12
|
+
text-align: right;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.notification {
|
|
16
|
+
padding: 15px 0 10px 0;
|
|
17
|
+
margin-bottom: 18px;
|
|
18
|
+
color: $main-txt-color;
|
|
19
|
+
position: relative;
|
|
20
|
+
border-radius: 3px;
|
|
21
|
+
border-top: 1.5px solid $warning-border-color;
|
|
22
|
+
background: $warning-bg-color;
|
|
23
|
+
box-shadow: 0px 8px 12px 0px rgba(9, 30, 66, 0.15), 0px 0px 1px 0px rgba(9, 30, 66, 0.31);
|
|
24
|
+
width: 368px;
|
|
25
|
+
position: relative;
|
|
26
|
+
|
|
27
|
+
.notification-icons-block {
|
|
28
|
+
text-align: center;
|
|
29
|
+
width: 56px;
|
|
30
|
+
}
|
|
31
|
+
.message-block {
|
|
32
|
+
font-size: 14px;
|
|
33
|
+
font-family: $poppins-font !important;
|
|
34
|
+
word-break: break-word;
|
|
35
|
+
width: 270px;
|
|
36
|
+
}
|
|
37
|
+
.notification-icon-close {
|
|
38
|
+
height: 24px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.error {
|
|
42
|
+
background: #FFE9E9;
|
|
43
|
+
border-top: 1.5px solid #E16D6D;
|
|
44
|
+
}
|
|
45
|
+
&.success {
|
|
46
|
+
background: $success-bg-color;
|
|
47
|
+
border-top: 1.5px solid $success-border-color;
|
|
48
|
+
}
|
|
49
|
+
.fa-exclamation-triangle {
|
|
50
|
+
color: #E16D6D !important;
|
|
51
|
+
}
|
|
52
|
+
.fa-check {
|
|
53
|
+
color: #a0c37f !important;
|
|
54
|
+
}
|
|
55
|
+
.fa-info-circle, .fa-hand-paper-o {
|
|
56
|
+
color: #bdb89e !important;
|
|
57
|
+
}
|
|
58
|
+
.fa {
|
|
59
|
+
font-size: 20px;
|
|
60
|
+
}
|
|
61
|
+
.close {
|
|
62
|
+
position: absolute;
|
|
63
|
+
top: 2px;
|
|
64
|
+
right: -5px;
|
|
65
|
+
.fa {
|
|
66
|
+
font-size: 14px;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
.fa {
|
|
70
|
+
margin: 0;
|
|
71
|
+
color: inherit;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@media screen and (max-width: 600px) {
|
|
77
|
+
.notification-block {
|
|
78
|
+
width: 50%;
|
|
79
|
+
min-width: 150px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
@@ -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,45 @@
|
|
|
1
|
+
.search-header-refresh-icon {
|
|
2
|
+
align-items: center;
|
|
3
|
+
line-height: 54px;
|
|
4
|
+
margin-left: 10px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
button[mat-icon-button] i {
|
|
8
|
+
font-size: 18px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
mat-spinner.length-spinner {
|
|
12
|
+
position: absolute;
|
|
13
|
+
right: 120px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
h3, .search-header-refresh-icon {
|
|
17
|
+
float: left;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.page-options, .mat-paginator {
|
|
21
|
+
float: right;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.per-page-block mat-form-field {
|
|
25
|
+
width: 70px !important;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.per-page-block span {
|
|
29
|
+
margin-right: 20px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.pagination {
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: flex-end;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.select-page-size {
|
|
38
|
+
width: 60px;
|
|
39
|
+
margin: 0 0 0 15px;
|
|
40
|
+
padding: 0 10px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.item_per_page {
|
|
44
|
+
line-height: 35px;
|
|
45
|
+
}/*# sourceMappingURL=pagination.component.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["pagination.component.scss","pagination.component.css"],"names":[],"mappings":"AAAA;EACE,mBAAA;EACA,iBAAA;EACA,iBAAA;ACCF;;ADGE;EACE,eAAA;ACAJ;;ADIA;EACE,kBAAA;EACA,YAAA;ACDF;;ADGA;EACE,WAAA;ACAF;;ADEA;EACE,YAAA;ACCF;;ADCA;EACE,sBAAA;ACEF;;ADAA;EACE,kBAAA;ACGF;;ADDA;EACE,aAAA;EACA,yBAAA;ACIF;;ADFA;EACE,WAAA;EACA,kBAAA;EACA,eAAA;ACKF;;ADHA;EACE,iBAAA;ACMF","file":"pagination.component.css"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<div class="flex-box pagination">
|
|
2
|
+
<div class="page-indexes-box">
|
|
3
|
+
<mat-paginator
|
|
4
|
+
[id]="'commonPagination'"
|
|
5
|
+
[hidePageSize]="true"
|
|
6
|
+
[length]="pagination.total"
|
|
7
|
+
[pageIndex]="pagination.pageIndex"
|
|
8
|
+
[pageSize]="pagination.pageSize"
|
|
9
|
+
[pageSizeOptions]="pagination.pageSizeOptions"
|
|
10
|
+
(page)="pageEvent($event)">
|
|
11
|
+
</mat-paginator>
|
|
12
|
+
<mat-spinner class="length-spinner" [diameter]="20" mode="indeterminate" *ngIf="lengthPending">
|
|
13
|
+
</mat-spinner>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="flex-box per-page-block" *ngIf="showPageSizeOptions">
|
|
17
|
+
<div class="item_per_page">Items per page:</div>
|
|
18
|
+
<div class="select-box select-page-size">
|
|
19
|
+
<mat-select [(ngModel)]="pagination.pageSize" (selectionChange)="changePerPageNumber($event)" #page
|
|
20
|
+
[id]="'commonPaginationSelect'">
|
|
21
|
+
<mat-option *ngFor="let option of pageSizeOptions; let i = index;" [id]="'paginationSelectOpt_' + i" [value]="option">{{option}}</mat-option>
|
|
22
|
+
</mat-select>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.search-header-refresh-icon {
|
|
2
|
+
align-items: center;
|
|
3
|
+
line-height: 54px;
|
|
4
|
+
margin-left: 10px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
button[mat-icon-button] {
|
|
8
|
+
i {
|
|
9
|
+
font-size: 18px;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
mat-spinner.length-spinner {
|
|
14
|
+
position: absolute;
|
|
15
|
+
right: 120px;
|
|
16
|
+
}
|
|
17
|
+
h3, .search-header-refresh-icon {
|
|
18
|
+
float: left;
|
|
19
|
+
}
|
|
20
|
+
.page-options, .mat-paginator {
|
|
21
|
+
float: right;
|
|
22
|
+
}
|
|
23
|
+
.per-page-block mat-form-field {
|
|
24
|
+
width: 70px !important;
|
|
25
|
+
}
|
|
26
|
+
.per-page-block span {
|
|
27
|
+
margin-right: 20px;
|
|
28
|
+
}
|
|
29
|
+
.pagination {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: flex-end;
|
|
32
|
+
}
|
|
33
|
+
.select-page-size {
|
|
34
|
+
width: 60px;
|
|
35
|
+
margin: 0 0 0 15px;
|
|
36
|
+
padding: 0 10px;
|
|
37
|
+
}
|
|
38
|
+
.item_per_page {
|
|
39
|
+
line-height: 35px;
|
|
40
|
+
}
|
|
41
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
2
|
+
import { PaginationDataDto } from '../../classes/pagination';
|
|
3
|
+
import { PAGINATION_SIZE_OPTIONS } from '../../app.constants';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'app-pagination',
|
|
8
|
+
templateUrl: './pagination.component.html',
|
|
9
|
+
styleUrls: ['./pagination.component.scss'],
|
|
10
|
+
})
|
|
11
|
+
export class PaginationComponent implements OnInit{
|
|
12
|
+
@Input()
|
|
13
|
+
public pagination!: PaginationDataDto;
|
|
14
|
+
@Input()
|
|
15
|
+
public showPageSizeOptions!: boolean;
|
|
16
|
+
@Input()
|
|
17
|
+
public showRefreshButton!: boolean;
|
|
18
|
+
@Input()
|
|
19
|
+
public lengthPending!: boolean;
|
|
20
|
+
@Output()
|
|
21
|
+
public pageEmitter = new EventEmitter();
|
|
22
|
+
@Output()
|
|
23
|
+
public pageNumberChangeEmitter = new EventEmitter<any>();
|
|
24
|
+
public pageSizeOptions: number[] = PAGINATION_SIZE_OPTIONS;
|
|
25
|
+
|
|
26
|
+
constructor(
|
|
27
|
+
) {
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ngOnInit(): void {
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public pageEvent(event: any) {
|
|
34
|
+
this.pageEmitter.emit(event);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public changePerPageNumber(event: any) {
|
|
38
|
+
this.pageNumberChangeEmitter.emit(event.value);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|