1
|
import {Component, OnInit, ViewChild} from '@angular/core';
|
2
|
import {InboxSearchFormComponent} from './inbox-search-form/inbox-search-form.component';
|
3
|
import {InboxDocumentsTableComponent} from './inbox-documents-table/inbox-documents-table.component';
|
4
|
import {DialogService} from 'primeng/dynamicdialog';
|
5
|
import {InboxSearchCriteriaInterface} from '../../../shared/models/inbox-search-criteria.interface';
|
6
|
import { delay } from 'rxjs/operators';
|
7
|
import { AuthService } from 'src/app/shared/services/auth.service';
|
8
|
import { USER_RIGHTS } from 'src/app/shared/enums/USER_RIGHTS.enum';
|
9
|
import { environment } from 'src/environments/environment';
|
10
|
|
11
|
@Component({
|
12
|
selector: 'app-inbox-management',
|
13
|
templateUrl: './inbox-management.component.html',
|
14
|
styleUrls: ['./inbox-management.component.scss']
|
15
|
})
|
16
|
export class InboxManagementComponent implements OnInit {
|
17
|
|
18
|
// tslint:disable-next-line:variable-name
|
19
|
private _inboxDocumentsTableComponent: InboxDocumentsTableComponent;
|
20
|
documentRequest: InboxSearchCriteriaInterface;
|
21
|
|
22
|
constructor(public auth: AuthService) {
|
23
|
}
|
24
|
|
25
|
@ViewChild(InboxSearchFormComponent, {static: false})
|
26
|
inboxSearchFormComponent: InboxSearchFormComponent;
|
27
|
|
28
|
@ViewChild(InboxDocumentsTableComponent, {static: false})
|
29
|
set inboxDocumentsTableComponent(value: InboxDocumentsTableComponent) {
|
30
|
if (value) {
|
31
|
this._inboxDocumentsTableComponent = value;
|
32
|
// this._inboxDocumentsTableComponent.documentRequest = this.inboxSearchFormComponent.searchCriteriaForm.value;
|
33
|
}
|
34
|
}
|
35
|
|
36
|
|
37
|
get inboxDocumentsTableComponent(): InboxDocumentsTableComponent {
|
38
|
return this._inboxDocumentsTableComponent;
|
39
|
}
|
40
|
|
41
|
ngOnInit(): void {
|
42
|
}
|
43
|
|
44
|
searchByCriteria(): void {
|
45
|
|
46
|
this.documentRequest = this.inboxSearchFormComponent.searchCriteriaForm.value;
|
47
|
if (this.inboxDocumentsTableComponent) {
|
48
|
this._inboxDocumentsTableComponent.documentRequest = this.inboxSearchFormComponent.searchCriteriaForm.value;
|
49
|
}
|
50
|
}
|
51
|
|
52
|
clear() {
|
53
|
this.inboxSearchFormComponent.resetForm();
|
54
|
}
|
55
|
|
56
|
canPreviewByUA(): boolean {
|
57
|
return this.auth.userRights.find(rdc => USER_RIGHTS.C01.isGrantedToUser(rdc.rights)) != null;
|
58
|
}
|
59
|
|
60
|
canPreviewAll(): boolean {
|
61
|
return this.auth.userHasRightForClient(USER_RIGHTS.C03, environment.globalRightsClientID);
|
62
|
}
|
63
|
}
|