A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
front end support for downloading multiple documents
jonaswinkler203bc162cd88
diff --git a/src-ui/messages.xlf b/src-ui/messages.xlfindex 731fdff7f..95e0fad15 100644--- a/src-ui/messages.xlf+++ b/src-ui/messages.xlf@@ -1226,21 +1226,21 @@<source>Error executing bulk operation: <x id="PH" equiv-text="JSON.stringify(error.error)"/></source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">73</context>+ <context context-type="linenumber">74</context></context-group></trans-unit><trans-unit id="7894972847287473517" datatype="html"><source>"<x id="PH" equiv-text="items[0].name"/>"</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">112</context>+ <context context-type="linenumber">113</context></context-group></trans-unit><trans-unit id="8639884465898458690" datatype="html"><source>"<x id="PH" equiv-text="items[0].name"/>" and "<x id="PH_1" equiv-text="items[1].name"/>"</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">114</context>+ <context context-type="linenumber">115</context></context-group><note priority="1" from="description">This is for messages like 'modify "tag1" and "tag2"'</note></trans-unit>@@ -1248,7 +1248,7 @@<source>, </source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">116</context>+ <context context-type="linenumber">117</context></context-group><note priority="1" from="description">this is used to separate enumerations and should probably be a comma and a whitespace in most languages</note></trans-unit>@@ -1256,7 +1256,7 @@<source><x id="PH" equiv-text="list"/> and "<x id="PH_1" equiv-text="items[items.length - 1].name"/>"</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">117</context>+ <context context-type="linenumber">118</context></context-group><note priority="1" from="description">this is for messages like 'modify "tag1", "tag2" and "tag3"'</note></trans-unit>@@ -1264,112 +1264,112 @@<source>Confirm tags assignment</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">126</context>+ <context context-type="linenumber">127</context></context-group></trans-unit><trans-unit id="6619516195038467207" datatype="html"><source>This operation will add the tag "<x id="PH" equiv-text="tag.name"/>" to <x id="PH_1" equiv-text="this.list.selected.size"/> selected document(s).</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">129</context>+ <context context-type="linenumber">130</context></context-group></trans-unit><trans-unit id="1894412783609570695" datatype="html"><source>This operation will add the tags <x id="PH" equiv-text="this._localizeList(changedTags.itemsToAdd)"/> to <x id="PH_1" equiv-text="this.list.selected.size"/> selected document(s).</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">131</context>+ <context context-type="linenumber">132</context></context-group></trans-unit><trans-unit id="7181166515756808573" datatype="html"><source>This operation will remove the tag "<x id="PH" equiv-text="tag.name"/>" from <x id="PH_1" equiv-text="this.list.selected.size"/> selected document(s).</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">134</context>+ <context context-type="linenumber">135</context></context-group></trans-unit><trans-unit id="3819792277998068944" datatype="html"><source>This operation will remove the tags <x id="PH" equiv-text="this._localizeList(changedTags.itemsToRemove)"/> from <x id="PH_1" equiv-text="this.list.selected.size"/> selected document(s).</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">136</context>+ <context context-type="linenumber">137</context></context-group></trans-unit><trans-unit id="2739066218579571288" datatype="html"><source>This operation will add the tags <x id="PH" equiv-text="this._localizeList(changedTags.itemsToAdd)"/> and remove the tags <x id="PH_1" equiv-text="this._localizeList(changedTags.itemsToRemove)"/> on <x id="PH_2" equiv-text="this.list.selected.size"/> selected document(s).</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">138</context>+ <context context-type="linenumber">139</context></context-group></trans-unit><trans-unit id="2996713129519325161" datatype="html"><source>Confirm correspondent assignment</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">158</context>+ <context context-type="linenumber">159</context></context-group></trans-unit><trans-unit id="6900893559485781849" datatype="html"><source>This operation will assign the correspondent "<x id="PH" equiv-text="correspondent.name"/>" to <x id="PH_1" equiv-text="this.list.selected.size"/> selected document(s).</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">160</context>+ <context context-type="linenumber">161</context></context-group></trans-unit><trans-unit id="1257522660364398440" datatype="html"><source>This operation will remove the correspondent from <x id="PH" equiv-text="this.list.selected.size"/> selected document(s).</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">162</context>+ <context context-type="linenumber">163</context></context-group></trans-unit><trans-unit id="5393409374423140648" datatype="html"><source>Confirm document type assignment</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">181</context>+ <context context-type="linenumber">182</context></context-group></trans-unit><trans-unit id="332180123895325027" datatype="html"><source>This operation will assign the document type "<x id="PH" equiv-text="documentType.name"/>" to <x id="PH_1" equiv-text="this.list.selected.size"/> selected document(s).</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">183</context>+ <context context-type="linenumber">184</context></context-group></trans-unit><trans-unit id="2236642492594872779" datatype="html"><source>This operation will remove the document type from <x id="PH" equiv-text="this.list.selected.size"/> selected document(s).</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">185</context>+ <context context-type="linenumber">186</context></context-group></trans-unit><trans-unit id="749430623564850405" datatype="html"><source>Delete confirm</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">200</context>+ <context context-type="linenumber">201</context></context-group></trans-unit><trans-unit id="4303174930844518780" datatype="html"><source>This operation will permanently delete <x id="PH" equiv-text="this.list.selected.size"/> selected document(s).</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">201</context>+ <context context-type="linenumber">202</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-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">202</context>+ <context context-type="linenumber">203</context></context-group></trans-unit><trans-unit id="6734339521247847366" datatype="html"><source>Delete document(s)</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>- <context context-type="linenumber">204</context>+ <context context-type="linenumber">205</context></context-group></trans-unit><trans-unit id="8b0609df23817024b3bed12beb9b64fc1009f588" datatype="html">@@ -1393,6 +1393,13 @@<context context-type="linenumber">27</context></context-group></trans-unit>+ <trans-unit id="fc2de37422d7c4af6686842283cc2afd781b6848" datatype="html">+ <source>Download originals</source>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.html</context>+ <context context-type="linenumber">68</context>+ </context-group>+ </trans-unit><trans-unit id="a1e6c11f20d4bf6e8e6b43e3c6d2561b2080645e" datatype="html"><source>Suggestions:</source><context-group purpose="location">diff --git a/src-ui/package-lock.json b/src-ui/package-lock.jsonindex c3827f80c..148bc72eb 100644--- a/src-ui/package-lock.json+++ b/src-ui/package-lock.json@@ -5545,6 +5545,11 @@"schema-utils": "^2.6.5"}},+ "file-saver": {+ "version": "2.0.5",+ "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz",+ "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="+ },"file-uri-to-path": {"version": "1.0.0","resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",diff --git a/src-ui/package.json b/src-ui/package.jsonindex 14d828483..d6082c6b9 100644--- a/src-ui/package.json+++ b/src-ui/package.json@@ -23,6 +23,7 @@"@ng-bootstrap/ng-bootstrap": "^8.0.0","@ng-select/ng-select": "^5.0.9","bootstrap": "^4.5.0",+ "file-saver": "^2.0.5","ng-bootstrap": "^1.6.3","ng2-pdf-viewer": "^6.3.2","ngx-cookie-service": "^10.1.1",diff --git a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.html b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.htmlindex 053126445..98716e2f9 100644--- a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.html+++ b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.html@@ -56,6 +56,20 @@</div></div><div class="col-auto ml-auto mb-2 mb-xl-0 d-flex">+ <div class="btn-group btn-group-sm mr-2">+ <button type="button" class="btn btn-outline-primary btn-sm" (click)="downloadSelected()">+ <svg width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor">+ <use xlink:href="assets/bootstrap-icons.svg#download" />+ </svg> <ng-container i18n>Download</ng-container>+ </button>+ <div class="btn-group" ngbDropdown role="group" aria-label="Button group with nested dropdown">+ <button class="btn btn-outline-primary btn-sm dropdown-toggle-split" ngbDropdownToggle></button>+ <div class="dropdown-menu" ngbDropdownMenu>+ <button ngbDropdownItem i18n (click)="downloadSelected('originals')">Download originals</button>+ </div>+ </div>+ </div>+<button type="button" class="btn btn-sm btn-outline-danger" (click)="applyDelete()"><svg width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor"><use xlink:href="assets/bootstrap-icons.svg#trash" />diff --git a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.tsindex ebc7a8c11..310290291 100644--- a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts+++ b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts@@ -15,6 +15,7 @@ import { ToggleableItemState } from '../../common/filterable-dropdown/toggleableimport { MatchingModel } from 'src/app/data/matching-model';import { SettingsService, SETTINGS_KEYS } from 'src/app/services/settings.service';import { ToastService } from 'src/app/services/toast.service';+import { saveAs } from 'file-saver';@Component({selector: 'app-bulk-editor',@@ -207,4 +208,10 @@ export class BulkEditorComponent {this.executeBulkOperation(modal, "delete", {})})}++ downloadSelected(content = "archive") {+ this.documentService.bulkDownload(Array.from(this.list.selected), content).subscribe((result: any) => {+ saveAs(result, 'documents.zip');+ })+ }}diff --git a/src-ui/src/app/services/rest/document.service.ts b/src-ui/src/app/services/rest/document.service.tsindex 19b18cfeb..40dbc64f7 100644--- a/src-ui/src/app/services/rest/document.service.ts+++ b/src-ui/src/app/services/rest/document.service.ts@@ -134,4 +134,8 @@ export class DocumentService extends AbstractPaperlessService<PaperlessDocument>return this.http.get<PaperlessDocumentSuggestions>(this.getResourceUrl(id, 'suggestions'))}+ bulkDownload(ids: number[], content="both") {+ return this.http.post(this.getResourceUrl(null, 'bulk_download'), {"documents": ids, "content": content}, { responseType: 'blob' })+ }+}