A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Show number of comments on cards, tab
shamoon3911740360ad
diff --git a/src-ui/messages.xlf b/src-ui/messages.xlfindex 1f46b1d6c..eee391f14 100644--- a/src-ui/messages.xlf+++ b/src-ui/messages.xlf@@ -1922,7 +1922,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-card-small/document-card-small.component.html</context>- <context context-type="linenumber">70</context>+ <context context-type="linenumber">78</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>@@ -2349,18 +2349,29 @@<context context-type="linenumber">11</context></context-group></trans-unit>+ <trans-unit id="7978668497183230348" datatype="html">+ <source>Delete comment</source>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/document-comments/document-comments.component.html</context>+ <context context-type="linenumber">21</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/document-comments/document-comments.component.html</context>+ <context context-type="linenumber">25</context>+ </context-group>+ </trans-unit><trans-unit id="5438997040668245251" datatype="html"><source>Error saving comment: <x id="PH" equiv-text="e.toString()"/></source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-comments/document-comments.component.ts</context>- <context context-type="linenumber">71</context>+ <context context-type="linenumber">75</context></context-group></trans-unit><trans-unit id="7593210124183303626" datatype="html"><source>Error deleting comment: <x id="PH" equiv-text="e.toString()"/></source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-comments/document-comments.component.ts</context>- <context context-type="linenumber">86</context>+ <context context-type="linenumber">91</context></context-group></trans-unit><trans-unit id="1407560924967345762" datatype="html">@@ -2397,7 +2408,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-card-small/document-card-small.component.html</context>- <context context-type="linenumber">86</context>+ <context context-type="linenumber">94</context></context-group></trans-unit><trans-unit id="8659635229098859487" datatype="html">@@ -2653,15 +2664,11 @@<context context-type="linenumber">215</context></context-group></trans-unit>- <trans-unit id="3807699453257291879" datatype="html">- <source>Comments</source>+ <trans-unit id="8403302283555274795" datatype="html">+ <source>Comments <x id="START_TAG_SPAN" ctype="x-span" equiv-text="<span *ngIf="document?.n_comments" class="badge text-bg-secondary ms-1">"/><x id="INTERPOLATION" equiv-text="ts}}"/><x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="</a>"/></source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.html</context>- <context context-type="linenumber">175</context>- </context-group>- <context-group purpose="location">- <context context-type="sourcefile">src/app/components/manage/settings/settings.component.html</context>- <context context-type="linenumber">159</context>+ <context context-type="linenumber">175,176</context></context-group></trans-unit><trans-unit id="3823219296477075982" datatype="html">@@ -2682,32 +2689,32 @@<source>Error retrieving metadata</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">305</context>+ <context context-type="linenumber">340</context></context-group></trans-unit><trans-unit id="2374084708811774419" datatype="html"><source>Error retrieving suggestions</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">325</context>+ <context context-type="linenumber">360</context></context-group></trans-unit><trans-unit id="448882439049417053" datatype="html"><source>Error saving document</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">439</context>+ <context context-type="linenumber">474</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">483</context>+ <context context-type="linenumber">518</context></context-group></trans-unit><trans-unit id="9021887951960049161" datatype="html"><source>Confirm delete</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">512</context>+ <context context-type="linenumber">547</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>@@ -2718,35 +2725,35 @@<source>Do you really want to delete document "<x id="PH" equiv-text="this.document.title"/>"?</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">513</context>+ <context context-type="linenumber">548</context></context-group></trans-unit><trans-unit id="6691075929777935948" datatype="html"><source>The files for this document will be deleted permanently. This operation cannot be undone.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">514</context>+ <context context-type="linenumber">549</context></context-group></trans-unit><trans-unit id="719892092227206532" datatype="html"><source>Delete document</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">516</context>+ <context context-type="linenumber">551</context></context-group></trans-unit><trans-unit id="1844801255494293730" datatype="html"><source>Error deleting document: <x id="PH" equiv-text="JSON.stringify(error)"/></source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">532</context>+ <context context-type="linenumber">567</context></context-group></trans-unit><trans-unit id="7362691899087997122" datatype="html"><source>Redo OCR confirm</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">552</context>+ <context context-type="linenumber">587</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>@@ -2757,14 +2764,14 @@<source>This operation will permanently redo OCR for this document.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">553</context>+ <context context-type="linenumber">588</context></context-group></trans-unit><trans-unit id="5641451190833696892" datatype="html"><source>This operation cannot be undone.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">554</context>+ <context context-type="linenumber">589</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>@@ -2795,7 +2802,7 @@<source>Proceed</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">556</context>+ <context context-type="linenumber">591</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>@@ -2822,7 +2829,7 @@<source>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.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">564</context>+ <context context-type="linenumber">599</context></context-group></trans-unit><trans-unit id="8008978164775353960" datatype="html">@@ -2831,7 +2838,7 @@)"/></source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>- <context context-type="linenumber">575,577</context>+ <context context-type="linenumber">610,612</context></context-group></trans-unit><trans-unit id="6857598786757174736" datatype="html">@@ -3166,11 +3173,25 @@<context context-type="linenumber">185</context></context-group></trans-unit>+ <trans-unit id="3758078190163790058" datatype="html">+ <source>View comments</source>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/document-list/document-card-large/document-card-large.component.html</context>+ <context context-type="linenumber">70</context>+ </context-group>+ </trans-unit>+ <trans-unit id="6326693689225506833" datatype="html">+ <source><x id="INTERPOLATION" equiv-text="_comments}}"/> Comments</source>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/document-list/document-card-large/document-card-large.component.html</context>+ <context context-type="linenumber">74</context>+ </context-group>+ </trans-unit><trans-unit id="78870852467682010" datatype="html"><source>Filter by document type</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-card-large/document-card-large.component.html</context>- <context context-type="linenumber">69</context>+ <context context-type="linenumber">76</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-list.component.html</context>@@ -3181,7 +3202,7 @@<source>Filter by storage path</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-card-large/document-card-large.component.html</context>- <context context-type="linenumber">76</context>+ <context context-type="linenumber">83</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-list.component.html</context>@@ -3192,40 +3213,40 @@<source>Created: <x id="INTERPOLATION" equiv-text="{{ document.created | customDate }}"/></source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-card-large/document-card-large.component.html</context>- <context context-type="linenumber">91,92</context>+ <context context-type="linenumber">98,99</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-card-small/document-card-small.component.html</context>- <context context-type="linenumber">48,49</context>+ <context context-type="linenumber">56,57</context></context-group></trans-unit><trans-unit id="2030261243264601523" datatype="html"><source>Added: <x id="INTERPOLATION" equiv-text="{{ document.added | customDate }}"/></source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-card-large/document-card-large.component.html</context>- <context context-type="linenumber">92,93</context>+ <context context-type="linenumber">99,100</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-card-small/document-card-small.component.html</context>- <context context-type="linenumber">49,50</context>+ <context context-type="linenumber">57,58</context></context-group></trans-unit><trans-unit id="4235671847487610290" datatype="html"><source>Modified: <x id="INTERPOLATION" equiv-text="{{ document.modified | customDate }}"/></source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-card-large/document-card-large.component.html</context>- <context context-type="linenumber">93,94</context>+ <context context-type="linenumber">100,101</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-card-small/document-card-small.component.html</context>- <context context-type="linenumber">50,51</context>+ <context context-type="linenumber">58,59</context></context-group></trans-unit><trans-unit id="2332107018974972998" datatype="html"><source>Score:</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-card-large/document-card-large.component.html</context>- <context context-type="linenumber">104</context>+ <context context-type="linenumber">110</context></context-group></trans-unit><trans-unit id="3661756380991326939" datatype="html">@@ -3239,21 +3260,21 @@<source>Toggle correspondent filter</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-card-small/document-card-small.component.html</context>- <context context-type="linenumber">24</context>+ <context context-type="linenumber">32</context></context-group></trans-unit><trans-unit id="5319701482646590642" datatype="html"><source>Toggle document type filter</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-card-small/document-card-small.component.html</context>- <context context-type="linenumber">31</context>+ <context context-type="linenumber">39</context></context-group></trans-unit><trans-unit id="8950368321707344185" datatype="html"><source>Toggle storage path filter</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/document-card-small/document-card-small.component.html</context>- <context context-type="linenumber">38</context>+ <context context-type="linenumber">46</context></context-group></trans-unit><trans-unit id="5145213156408463657" datatype="html">@@ -4018,6 +4039,13 @@<context context-type="linenumber">155</context></context-group></trans-unit>+ <trans-unit id="3807699453257291879" datatype="html">+ <source>Comments</source>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/settings/settings.component.html</context>+ <context context-type="linenumber">159</context>+ </context-group>+ </trans-unit><trans-unit id="4666858503087488647" datatype="html"><source>Enable comments</source><context-group purpose="location">@@ -4670,11 +4698,11 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/services/open-documents.service.ts</context>- <context context-type="linenumber">103</context>+ <context context-type="linenumber">104</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/services/open-documents.service.ts</context>- <context context-type="linenumber">130</context>+ <context context-type="linenumber">131</context></context-group></trans-unit><trans-unit id="2573823578527613511" datatype="html">@@ -4685,7 +4713,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/services/open-documents.service.ts</context>- <context context-type="linenumber">131</context>+ <context context-type="linenumber">132</context></context-group></trans-unit><trans-unit id="3305084982600522070" datatype="html">@@ -4857,35 +4885,35 @@<source>You have unsaved changes to the document</source><context-group purpose="location"><context context-type="sourcefile">src/app/services/open-documents.service.ts</context>- <context context-type="linenumber">105</context>+ <context context-type="linenumber">106</context></context-group></trans-unit><trans-unit id="2089045849587358256" datatype="html"><source>Are you sure you want to close this document?</source><context-group purpose="location"><context context-type="sourcefile">src/app/services/open-documents.service.ts</context>- <context context-type="linenumber">109</context>+ <context context-type="linenumber">110</context></context-group></trans-unit><trans-unit id="2885986061416655600" datatype="html"><source>Close document</source><context-group purpose="location"><context context-type="sourcefile">src/app/services/open-documents.service.ts</context>- <context context-type="linenumber">111</context>+ <context context-type="linenumber">112</context></context-group></trans-unit><trans-unit id="6755718693176327396" datatype="html"><source>Are you sure you want to close all documents?</source><context-group purpose="location"><context context-type="sourcefile">src/app/services/open-documents.service.ts</context>- <context context-type="linenumber">132</context>+ <context context-type="linenumber">133</context></context-group></trans-unit><trans-unit id="4215561719980781894" datatype="html"><source>Close documents</source><context-group purpose="location"><context context-type="sourcefile">src/app/services/open-documents.service.ts</context>- <context context-type="linenumber">134</context>+ <context context-type="linenumber">135</context></context-group></trans-unit><trans-unit id="3553216189604488439" datatype="html">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.htmlindex 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 @@</div><div class="d-flex card-footer small bg-light text-primary justify-content-between align-items-center"><span>{{displayName(comment)}} - {{ comment.created | customDate}}</span>- <button type="button" class="btn btn-link btn-sm p-0 fade" (click)="deleteComment(comment.id)" *appIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.Comment }">+ <button type="button" class="btn btn-link btn-sm p-0 fade" title="Delete comment" i18n-title (click)="deleteComment(comment.id)" *appIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.Comment }"><svg width="13" height="13" fill="currentColor"><use xlink:href="assets/bootstrap-icons.svg#trash" /></svg>+ <span class="visually-hidden" i18n>Delete comment</span></button></div></div>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.tsindex 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<number> = new EventEmitter<number>()+constructor(private commentsService: DocumentCommentsService,private toastService: ToastService@@ -64,6 +67,7 @@ export class DocumentCommentsComponent extends ComponentWithPermissions {this.comments = resultthis.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 = resultthis.networkActive = false+ this.updated.emit(this.comments.length)},error: (e) => {this.networkActive = falsediff --git a/src-ui/src/app/components/document-detail/document-detail.component.html b/src-ui/src/app/components/document-detail/document-detail.component.htmlindex 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 @@</li><li [ngbNavItem]="5" *ngIf="commentsEnabled">- <a ngbNavLink i18n>Comments</a>+ <a ngbNavLink i18n>Comments <span *ngIf="document?.n_comments" class="badge text-bg-secondary ms-1">{{document.n_comments}}</span></a><ng-template ngbNavContent>- <app-document-comments [documentId]="documentId"></app-document-comments>+ <app-document-comments [documentId]="documentId" (updated)="commentsUpdated($event)"></app-document-comments></ng-template></li>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.tsindex 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 editingdiff --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.htmlindex 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 @@</a></div>+<div class="list-group list-group-horizontal border-0 card-info ms-md-auto mt-2 mt-md-0">+ <button *ngIf="document.n_comments" class="list-group-item btn btn-sm bg-light text-dark p-1 border-0 me-2" title="View comments" i18n-title>+ <svg class="metadata-icon me-2 text-muted" fill="currentColor">+ <use xlink:href="assets/bootstrap-icons.svg#chat-left-text"/>+ </svg>+ <small i18n>{{document.n_comments}} Comments</small>+ </button><button *ngIf="document.document_type" type="button" class="list-group-item btn btn-sm bg-light text-dark p-1 border-0 me-2" title="Filter by document type" i18n-title(click)="clickDocumentType.emit(document.document_type);$event.stopPropagation()">- <svg class="metadata-icon me-2 text-muted bi bi-file-earmark" viewBox="0 0 16 16" fill="currentColor">- <path d="M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5L14 4.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5h-2z"/>+ <svg class="metadata-icon me-2 text-muted" fill="currentColor">+ <use xlink:href="assets/bootstrap-icons.svg#file-earmark"/></svg><small>{{(document.document_type$ | async)?.name}}</small></button><button *ngIf="document.storage_path" type="button" class="list-group-item btn btn-sm bg-light text-dark p-1 border-0 me-2" title="Filter by storage path" i18n-title(click)="clickStoragePath.emit(document.storage_path);$event.stopPropagation()">- <svg class="metadata-icon me-2 text-muted bi bi-folder" viewBox="0 0 16 16" fill="currentColor">- <path d="M0 2a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1v7.5a2.5 2.5 0 0 1-2.5 2.5h-9A2.5 2.5 0 0 1 1 12.5V5a1 1 0 0 1-1-1V2zm2 3v7.5A1.5 1.5 0 0 0 3.5 14h9a1.5 1.5 0 0 0 1.5-1.5V5H2zm13-3H1v2h14V2zM5 7.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5z"/>+ <svg class="metadata-icon me-2 text-muted" fill="currentColor">+ <use xlink:href="assets/bootstrap-icons.svg#archive"/></svg><small>{{(document.storage_path$ | async)?.name}}</small></button><div *ngIf="document.archive_serial_number" class="list-group-item me-2 bg-light text-dark p-1 border-0">- <svg class="metadata-icon me-2 text-muted bi bi-upc-scan" viewBox="0 0 16 16" fill="currentColor">- <path d="M1.5 1a.5.5 0 0 0-.5.5v3a.5.5 0 0 1-1 0v-3A1.5 1.5 0 0 1 1.5 0h3a.5.5 0 0 1 0 1h-3zM11 .5a.5.5 0 0 1 .5-.5h3A1.5 1.5 0 0 1 16 1.5v3a.5.5 0 0 1-1 0v-3a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 1-.5-.5zM.5 11a.5.5 0 0 1 .5.5v3a.5.5 0 0 0 .5.5h3a.5.5 0 0 1 0 1h-3A1.5 1.5 0 0 1 0 14.5v-3a.5.5 0 0 1 .5-.5zm15 0a.5.5 0 0 1 .5.5v3a1.5 1.5 0 0 1-1.5 1.5h-3a.5.5 0 0 1 0-1h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 1 .5-.5zM3 4.5a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0v-7zm2 0a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0v-7zm2 0a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0v-7zm2 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-7zm3 0a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0v-7z"/>+ <svg class="metadata-icon me-2 text-muted" fill="currentColor">+ <use xlink:href="assets/bootstrap-icons.svg#upc-scan"/></svg><small>#{{document.archive_serial_number}}</small></div>@@ -94,9 +101,8 @@</div></ng-template><div class="list-group-item bg-light text-dark p-1 border-0" [ngbTooltip]="dateTooltip">- <svg class="metadata-icon me-2 text-muted bi bi-calendar-event" viewBox="0 0 16 16" fill="currentColor">- <path d="M11 6.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1z"/>- <path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"/>+ <svg class="metadata-icon me-2 text-muted" fill="currentColor">+ <use xlink:href="assets/bootstrap-icons.svg#calendar-event"/></svg><small>{{document.created_date | customDate:'mediumDate'}}</small></div>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.htmlindex 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 @@</div></div>+ <div *ngIf="document.n_comments" class="document-card-comments pe-none py-2 px-1">+ <span class="badge rounded-pill bg-light border text-primary">+ <svg class="metadata-icon ms-1 me-1" fill="currentColor">+ <use xlink:href="assets/bootstrap-icons.svg#chat-left-text"/>+ </svg>+ {{document.n_comments}}</span>+ </div>+<div class="card-body p-2"><p class="card-text"><ng-container *ngIf="document.correspondent">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.scssindex 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.tsindex 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 : 7return 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.tsindex 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.tsindex 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.tsindex 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<T extends ObjectWithId> {protected baseUrl: string = environment.apiBaseUrldiff --git a/src-ui/src/theme.scss b/src-ui/src/theme.scssindex 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,<svg xmlns='httfilter: brightness(.8);}+ .badge.bg-light.border {+ border-color: rgba(0,0,0,0) !important;+ }+.doc-img {mix-blend-mode: normal;border-radius: 0;diff --git a/src/documents/serialisers.py b/src/documents/serialisers.pyindex 1f74a43c0..c672ee07c 100644--- a/src/documents/serialisers.py+++ b/src/documents/serialisers.py@@ -16,6 +16,7 @@ from rest_framework import serializersfrom rest_framework.fields import SerializerMethodFieldfrom . import bulk_edit+from .models import Commentfrom .models import Correspondentfrom .models import Documentfrom .models import DocumentType@@ -382,6 +383,8 @@ class DocumentSerializer(OwnedObjectSerializer, DynamicFieldsModelSerializer):archived_file_name = SerializerMethodField()created_date = serializers.DateField(required=False)+ n_comments = SerializerMethodField()+owner = serializers.PrimaryKeyRelatedField(queryset=User.objects.all(),required=False,@@ -397,6 +400,9 @@ class DocumentSerializer(OwnedObjectSerializer, DynamicFieldsModelSerializer):else:return None+ def get_n_comments(self, obj):+ return Comment.objects.filter(document=obj).count()+def to_representation(self, instance):doc = super().to_representation(instance)if self.truncate_content:@@ -442,6 +448,7 @@ class DocumentSerializer(OwnedObjectSerializer, DynamicFieldsModelSerializer):"owner","permissions","set_permissions",+ "n_comments",)