diff --git a/src-ui/messages.xlf b/src-ui/messages.xlf index 1f46b1d6c..eee391f14 100644 --- a/src-ui/messages.xlf +++ b/src-ui/messages.xlf @@ -1922,7 +1922,7 @@ src/app/components/document-list/document-card-small/document-card-small.component.html - 70 + 78 src/app/components/manage/management-list/management-list.component.html @@ -2349,18 +2349,29 @@ 11 + + Delete comment + + src/app/components/document-comments/document-comments.component.html + 21 + + + src/app/components/document-comments/document-comments.component.html + 25 + + Error saving comment: src/app/components/document-comments/document-comments.component.ts - 71 + 75 Error deleting comment: src/app/components/document-comments/document-comments.component.ts - 86 + 91 @@ -2397,7 +2408,7 @@ src/app/components/document-list/document-card-small/document-card-small.component.html - 86 + 94 @@ -2653,15 +2664,11 @@ 215 - - Comments + + Comments src/app/components/document-detail/document-detail.component.html - 175 - - - src/app/components/manage/settings/settings.component.html - 159 + 175,176 @@ -2682,32 +2689,32 @@ Error retrieving metadata src/app/components/document-detail/document-detail.component.ts - 305 + 340 Error retrieving suggestions src/app/components/document-detail/document-detail.component.ts - 325 + 360 Error saving document src/app/components/document-detail/document-detail.component.ts - 439 + 474 src/app/components/document-detail/document-detail.component.ts - 483 + 518 Confirm delete src/app/components/document-detail/document-detail.component.ts - 512 + 547 src/app/components/manage/management-list/management-list.component.ts @@ -2718,35 +2725,35 @@ Do you really want to delete document ""? src/app/components/document-detail/document-detail.component.ts - 513 + 548 The files for this document will be deleted permanently. This operation cannot be undone. src/app/components/document-detail/document-detail.component.ts - 514 + 549 Delete document src/app/components/document-detail/document-detail.component.ts - 516 + 551 Error deleting document: src/app/components/document-detail/document-detail.component.ts - 532 + 567 Redo OCR confirm src/app/components/document-detail/document-detail.component.ts - 552 + 587 src/app/components/document-list/bulk-editor/bulk-editor.component.ts @@ -2757,14 +2764,14 @@ This operation will permanently redo OCR for this document. src/app/components/document-detail/document-detail.component.ts - 553 + 588 This operation cannot be undone. src/app/components/document-detail/document-detail.component.ts - 554 + 589 src/app/components/document-list/bulk-editor/bulk-editor.component.ts @@ -2795,7 +2802,7 @@ Proceed src/app/components/document-detail/document-detail.component.ts - 556 + 591 src/app/components/document-list/bulk-editor/bulk-editor.component.ts @@ -2822,7 +2829,7 @@ Redo OCR operation will begin in the background. Close and re-open or reload this document after the operation has completed to see new content. src/app/components/document-detail/document-detail.component.ts - 564 + 599 @@ -2831,7 +2838,7 @@ )"/> src/app/components/document-detail/document-detail.component.ts - 575,577 + 610,612 @@ -3166,11 +3173,25 @@ 185 + + View comments + + src/app/components/document-list/document-card-large/document-card-large.component.html + 70 + + + + Comments + + src/app/components/document-list/document-card-large/document-card-large.component.html + 74 + + Filter by document type src/app/components/document-list/document-card-large/document-card-large.component.html - 69 + 76 src/app/components/document-list/document-list.component.html @@ -3181,7 +3202,7 @@ Filter by storage path src/app/components/document-list/document-card-large/document-card-large.component.html - 76 + 83 src/app/components/document-list/document-list.component.html @@ -3192,40 +3213,40 @@ Created: src/app/components/document-list/document-card-large/document-card-large.component.html - 91,92 + 98,99 src/app/components/document-list/document-card-small/document-card-small.component.html - 48,49 + 56,57 Added: src/app/components/document-list/document-card-large/document-card-large.component.html - 92,93 + 99,100 src/app/components/document-list/document-card-small/document-card-small.component.html - 49,50 + 57,58 Modified: src/app/components/document-list/document-card-large/document-card-large.component.html - 93,94 + 100,101 src/app/components/document-list/document-card-small/document-card-small.component.html - 50,51 + 58,59 Score: src/app/components/document-list/document-card-large/document-card-large.component.html - 104 + 110 @@ -3239,21 +3260,21 @@ Toggle correspondent filter src/app/components/document-list/document-card-small/document-card-small.component.html - 24 + 32 Toggle document type filter src/app/components/document-list/document-card-small/document-card-small.component.html - 31 + 39 Toggle storage path filter src/app/components/document-list/document-card-small/document-card-small.component.html - 38 + 46 @@ -4018,6 +4039,13 @@ 155 + + Comments + + src/app/components/manage/settings/settings.component.html + 159 + + Enable comments @@ -4670,11 +4698,11 @@ src/app/services/open-documents.service.ts - 103 + 104 src/app/services/open-documents.service.ts - 130 + 131 @@ -4685,7 +4713,7 @@ src/app/services/open-documents.service.ts - 131 + 132 @@ -4857,35 +4885,35 @@ You have unsaved changes to the document src/app/services/open-documents.service.ts - 105 + 106 Are you sure you want to close this document? src/app/services/open-documents.service.ts - 109 + 110 Close document src/app/services/open-documents.service.ts - 111 + 112 Are you sure you want to close all documents? src/app/services/open-documents.service.ts - 132 + 133 Close documents src/app/services/open-documents.service.ts - 134 + 135 diff --git a/src-ui/src/app/components/document-comments/document-comments.component.html b/src-ui/src/app/components/document-comments/document-comments.component.html index 576f46d79..ffc8bfb9f 100644 --- a/src-ui/src/app/components/document-comments/document-comments.component.html +++ b/src-ui/src/app/components/document-comments/document-comments.component.html @@ -18,10 +18,11 @@ diff --git a/src-ui/src/app/components/document-comments/document-comments.component.ts b/src-ui/src/app/components/document-comments/document-comments.component.ts index f5c63ab07..602d6bdb1 100644 --- a/src-ui/src/app/components/document-comments/document-comments.component.ts +++ b/src-ui/src/app/components/document-comments/document-comments.component.ts @@ -1,4 +1,4 @@ -import { Component, Input } from '@angular/core' +import { Component, Input, Output, EventEmitter } from '@angular/core' import { DocumentCommentsService } from 'src/app/services/rest/document-comments.service' import { PaperlessDocumentComment } from 'src/app/data/paperless-document-comment' import { FormControl, FormGroup } from '@angular/forms' @@ -30,6 +30,9 @@ export class DocumentCommentsComponent extends ComponentWithPermissions { } } + @Output() + updated: EventEmitter = new EventEmitter() + constructor( private commentsService: DocumentCommentsService, private toastService: ToastService @@ -64,6 +67,7 @@ export class DocumentCommentsComponent extends ComponentWithPermissions { this.comments = result this.commentForm.get('newComment').reset() this.networkActive = false + this.updated.emit(this.comments.length) }, error: (e) => { this.networkActive = false @@ -79,6 +83,7 @@ export class DocumentCommentsComponent extends ComponentWithPermissions { next: (result) => { this.comments = result this.networkActive = false + this.updated.emit(this.comments.length) }, error: (e) => { this.networkActive = false diff --git a/src-ui/src/app/components/document-detail/document-detail.component.html b/src-ui/src/app/components/document-detail/document-detail.component.html index 3459ce2ae..43eeed0ef 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.html +++ b/src-ui/src/app/components/document-detail/document-detail.component.html @@ -172,9 +172,9 @@
  • - Comments + Comments {{document.n_comments}} - +
  • diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts index 8103cc374..401b82944 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.ts @@ -632,6 +632,11 @@ export class DocumentDetailComponent ) } + commentsUpdated(n_comments: number) { + this.document.n_comments = n_comments + this.openDocumentService.refreshDocument(this.documentId) + } + get userIsOwner(): boolean { let doc: PaperlessDocument = Object.assign({}, this.document) // dont disable while editing diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html index b90651955..102fe9844 100644 --- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html +++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html @@ -65,24 +65,31 @@ +
    +
    - #{{document.archive_serial_number}}
    @@ -94,9 +101,8 @@
    - {{document.created_date | customDate:'mediumDate'}}
    diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html index e476b40d9..00e233425 100644 --- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html +++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html @@ -18,6 +18,14 @@ +
    + + + {{document.n_comments}} +
    +

    diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.scss b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.scss index f64c3f112..4825be9b2 100644 --- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.scss +++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.scss @@ -34,6 +34,12 @@ display: block; } +.document-card-comments { + position: absolute; + right: 0; + bottom: 170px; +} + .card-selected { border-color:var(--bs-primary); @@ -58,12 +64,12 @@ color: var(--bs-primary); } } +} - .metadata-icon { - width: 0.9rem; - height: 0.9rem; - padding: 0.05rem; - } +.metadata-icon { + width: 0.9rem; + height: 0.9rem; + padding: 0.05rem; } .card-footer .btn { diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts index 0aa7bd758..99d64e711 100644 --- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts +++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts @@ -74,11 +74,12 @@ export class DocumentCardSmallComponent extends ComponentWithPermissions { } getTagsLimited$() { + const limit = this.document.n_comments > 0 ? 6 : 7 return this.document.tags$.pipe( map((tags) => { - if (tags.length > 7) { - this.moreTags = tags.length - 6 - return tags.slice(0, 6) + if (tags.length > limit) { + this.moreTags = tags.length - (limit - 1) + return tags.slice(0, limit - 1) } else { return tags } diff --git a/src-ui/src/app/data/paperless-document.ts b/src-ui/src/app/data/paperless-document.ts index 8936e2b43..009b33a03 100644 --- a/src-ui/src/app/data/paperless-document.ts +++ b/src-ui/src/app/data/paperless-document.ts @@ -54,5 +54,7 @@ export interface PaperlessDocument extends ObjectWithPermissions { archive_serial_number?: number + n_comments?: number + __search_hit__?: SearchHit } diff --git a/src-ui/src/app/services/open-documents.service.ts b/src-ui/src/app/services/open-documents.service.ts index a21523458..17be66428 100644 --- a/src-ui/src/app/services/open-documents.service.ts +++ b/src-ui/src/app/services/open-documents.service.ts @@ -35,15 +35,16 @@ export class OpenDocumentsService { refreshDocument(id: number) { let index = this.openDocuments.findIndex((doc) => doc.id == id) if (index > -1) { - this.documentService.get(id).subscribe( - (doc) => { + this.documentService.get(id).subscribe({ + next: (doc) => { this.openDocuments[index] = doc + this.save() }, - (error) => { + error: () => { this.openDocuments.splice(index, 1) this.save() - } - ) + }, + }) } } diff --git a/src-ui/src/app/services/rest/abstract-paperless-service.ts b/src-ui/src/app/services/rest/abstract-paperless-service.ts index f7833c812..9a5664c9d 100644 --- a/src-ui/src/app/services/rest/abstract-paperless-service.ts +++ b/src-ui/src/app/services/rest/abstract-paperless-service.ts @@ -2,10 +2,8 @@ import { HttpClient, HttpParams } from '@angular/common/http' import { Observable } from 'rxjs' import { map, publishReplay, refCount } from 'rxjs/operators' import { ObjectWithId } from 'src/app/data/object-with-id' -import { PaperlessUser } from 'src/app/data/paperless-user' import { Results } from 'src/app/data/results' import { environment } from 'src/environments/environment' -import { PermissionAction, PermissionType } from '../permissions.service' export abstract class AbstractPaperlessService { protected baseUrl: string = environment.apiBaseUrl diff --git a/src-ui/src/theme.scss b/src-ui/src/theme.scss index 69fbc68cc..7090d8d40 100644 --- a/src-ui/src/theme.scss +++ b/src-ui/src/theme.scss @@ -133,6 +133,10 @@ $form-check-radio-checked-bg-image-dark: url("data:image/svg+xml,