1
|
import {Component, OnInit} from '@angular/core';
|
2
|
import {DialogService, DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
|
3
|
import {FileViewerPopupComponent} from '../file-viewer-popup/file-viewer-popup.component';
|
4
|
import {InboxManagementService} from '../../../../../shared/services/inbox-management.service';
|
5
|
import {InboxBatch} from '../../../../../shared/models/inbox-batch.interface';
|
6
|
import { NotificationsHandlingService } from 'src/app/shared/services/notifications-handling/notifications-handling.service';
|
7
|
import { ReceivedFiles } from 'src/app/shared/models/receivedFiles.interface';
|
8
|
|
9
|
@Component({
|
10
|
selector: 'app-ignore-file-dialog',
|
11
|
templateUrl: './ignore-file-dialog.component.html',
|
12
|
styleUrls: ['./ignore-file-dialog.component.scss']
|
13
|
})
|
14
|
export class IgnoreFileDialogComponent implements OnInit {
|
15
|
documents: ReceivedFiles[] = [];
|
16
|
private documentBatch: InboxBatch;
|
17
|
|
18
|
constructor(public ref: DynamicDialogRef,
|
19
|
public config: DynamicDialogConfig,
|
20
|
private dialogService: DialogService,
|
21
|
private inboxService: InboxManagementService,
|
22
|
private notificationService: NotificationsHandlingService) {
|
23
|
//TODO: find how to change the header from the HTML
|
24
|
this.config.header = 'Ignore Document';
|
25
|
|
26
|
}
|
27
|
|
28
|
ngOnInit(): void {
|
29
|
this.documentBatch = this.config.data;
|
30
|
this.documents = [this.documentBatch.receivedFile];
|
31
|
console.log(this.documents);
|
32
|
}
|
33
|
|
34
|
showOrDownloadFile(document: any): void {
|
35
|
this.dialogService.open(FileViewerPopupComponent, {data: document});
|
36
|
}
|
37
|
|
38
|
closeDialog(): void {
|
39
|
this.ref.close();
|
40
|
}
|
41
|
|
42
|
onIgnoreFile(): void {
|
43
|
this.inboxService.ignoreFile(String(this.documentBatch.statusPerDocRecId)).subscribe( result => {
|
44
|
this.notificationService.showOnIgnoreFileSuccess();
|
45
|
});
|
46
|
this.ref.close();
|
47
|
}
|
48
|
}
|