mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
71 lines
1.6 KiB
TypeScript
71 lines
1.6 KiB
TypeScript
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
import { PaperlessDocument } from 'src/app/data/paperless-document';
|
|
import { DocumentService } from 'src/app/services/rest/document.service';
|
|
|
|
@Component({
|
|
selector: 'app-document-card-large',
|
|
templateUrl: './document-card-large.component.html',
|
|
styleUrls: ['./document-card-large.component.scss']
|
|
})
|
|
export class DocumentCardLargeComponent implements OnInit {
|
|
|
|
constructor(private documentService: DocumentService, private sanitizer: DomSanitizer) { }
|
|
|
|
@Input()
|
|
moreLikeThis: boolean = false
|
|
|
|
@Input()
|
|
document: PaperlessDocument
|
|
|
|
@Input()
|
|
details: any
|
|
|
|
@Output()
|
|
clickTag = new EventEmitter<number>()
|
|
|
|
@Output()
|
|
clickCorrespondent = new EventEmitter<number>()
|
|
|
|
@Input()
|
|
searchScore: number
|
|
|
|
get searchScoreClass() {
|
|
if (this.searchScore > 0.7) {
|
|
return "success"
|
|
} else if (this.searchScore > 0.3) {
|
|
return "warning"
|
|
} else {
|
|
return "danger"
|
|
}
|
|
}
|
|
|
|
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)
|
|
}
|
|
|
|
getPreviewUrl() {
|
|
return this.documentService.getPreviewUrl(this.document.id)
|
|
}
|
|
}
|