2020-11-28 21:28:07 +01:00
|
|
|
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
2020-10-27 01:10:18 +01:00
|
|
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
|
|
|
import { PaperlessDocument } from 'src/app/data/paperless-document';
|
2020-11-28 21:28:07 +01:00
|
|
|
import { PaperlessTag } from 'src/app/data/paperless-tag';
|
2020-10-27 01:10:18 +01:00
|
|
|
import { DocumentService } from 'src/app/services/rest/document.service';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-document-card-large',
|
|
|
|
|
templateUrl: './document-card-large.component.html',
|
2020-11-22 14:43:59 +01:00
|
|
|
styleUrls: ['./document-card-large.component.scss']
|
2020-10-27 01:10:18 +01:00
|
|
|
})
|
|
|
|
|
export class DocumentCardLargeComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
constructor(private documentService: DocumentService, private sanitizer: DomSanitizer) { }
|
|
|
|
|
|
|
|
|
|
@Input()
|
|
|
|
|
document: PaperlessDocument
|
|
|
|
|
|
|
|
|
|
@Input()
|
|
|
|
|
details: any
|
|
|
|
|
|
2020-11-28 21:28:07 +01:00
|
|
|
@Output()
|
|
|
|
|
clickTag = new EventEmitter<PaperlessTag>()
|
|
|
|
|
|
|
|
|
|
@Output()
|
|
|
|
|
clickCorrespondent = new EventEmitter<PaperlessDocument>()
|
|
|
|
|
|
2020-10-27 01:10:18 +01:00
|
|
|
ngOnInit(): void {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getDetailsAsString() {
|
|
|
|
|
if (typeof this.details === 'string') {
|
|
|
|
|
return this.details.substring(0, 500)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getDetailsAsHighlight() {
|
|
|
|
|
//TODO: this is not an exact typecheck, can we do better
|
|
|
|
|
if (this.details instanceof Array) {
|
|
|
|
|
return this.details
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getThumbUrl() {
|
|
|
|
|
return this.documentService.getThumbUrl(this.document.id)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getDownloadUrl() {
|
|
|
|
|
return this.documentService.getDownloadUrl(this.document.id)
|
|
|
|
|
}
|
2020-11-28 14:50:14 +01:00
|
|
|
|
|
|
|
|
getPreviewUrl() {
|
|
|
|
|
return this.documentService.getPreviewUrl(this.document.id)
|
|
|
|
|
}
|
2020-10-27 01:10:18 +01:00
|
|
|
}
|