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 bfc59b526..430a76a23 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 @@ -7,7 +7,7 @@
-
+
{{(document.correspondent$ | async)?.name}} {{(document.correspondent$ | async)?.name}}: @@ -52,4 +52,4 @@
- \ No newline at end of file + 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 95cf2e191..b2e7b0218 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 @@ -11,7 +11,7 @@ - +

@@ -44,7 +44,7 @@

{{document.created | date}} - + - - \ No newline at end of file + + diff --git a/src-ui/src/app/components/document-list/document-list.component.html b/src-ui/src/app/components/document-list/document-list.component.html index f8c3445c5..a6ec1b741 100644 --- a/src-ui/src/app/components/document-list/document-list.component.html +++ b/src-ui/src/app/components/document-list/document-list.component.html @@ -64,7 +64,7 @@
- +
@@ -75,7 +75,7 @@
- +
@@ -95,16 +95,16 @@ - {{(d.correspondent$ | async)?.name}} + {{(d.correspondent$ | async)?.name}} {{d.title}} - + - {{(d.document_type$ | async)?.name}} + {{(d.document_type$ | async)?.name}} @@ -119,5 +119,5 @@
- +
diff --git a/src-ui/src/app/components/document-list/document-list.component.ts b/src-ui/src/app/components/document-list/document-list.component.ts index 3ce00beab..5bbd5b49d 100644 --- a/src-ui/src/app/components/document-list/document-list.component.ts +++ b/src-ui/src/app/components/document-list/document-list.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ViewChild } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { ActivatedRoute } from '@angular/router'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; @@ -11,6 +11,10 @@ import { SavedViewConfigService } from 'src/app/services/saved-view-config.servi import { Toast, ToastService } from 'src/app/services/toast.service'; import { environment } from 'src/environments/environment'; import { SaveViewConfigDialogComponent } from './save-view-config-dialog/save-view-config-dialog.component'; +import { FilterEditorComponent } from './filter-editor/filter-editor.component'; +import { PaperlessTag } from 'src/app/data/paperless-tag'; +import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'; +import { PaperlessDocumentType } from 'src/app/data/paperless-document-type'; @Component({ selector: 'app-document-list', @@ -31,6 +35,8 @@ export class DocumentListComponent implements OnInit { filterRules: FilterRule[] = [] + @ViewChild('filterEditor') filterEditor: FilterEditorComponent + get isFiltered() { return this.list.filterRules?.length > 0 } @@ -99,4 +105,16 @@ export class DocumentListComponent implements OnInit { }) } + clickTag(tagID: number) { + this.filterEditor.toggleFilterByItem(tagID, FILTER_HAS_TAG) + } + + clickCorrespondent(correspondentID: number) { + this.filterEditor.toggleFilterByItem(correspondentID, FILTER_CORRESPONDENT) + } + + clickDocumentType(documentTypeID: number) { + this.filterEditor.toggleFilterByItem(documentTypeID, FILTER_DOCUMENT_TYPE) + } + } diff --git a/src-ui/src/app/components/filter-editor/filter-editor.component.ts b/src-ui/src/app/components/filter-editor/filter-editor.component.ts index 93a91473f..b73b4387b 100644 --- a/src-ui/src/app/components/filter-editor/filter-editor.component.ts +++ b/src-ui/src/app/components/filter-editor/filter-editor.component.ts @@ -1,9 +1,9 @@ import { Component, EventEmitter, Input, OnInit, Output, ElementRef, AfterViewInit, QueryList, ViewChild, ViewChildren } from '@angular/core'; import { FilterRule } from 'src/app/data/filter-rule'; import { FilterRuleType, FILTER_RULE_TYPES, FILTER_CORRESPONDENT, FILTER_DOCUMENT_TYPE, FILTER_HAS_TAG, FILTER_TITLE, FILTER_ADDED_BEFORE, FILTER_ADDED_AFTER, FILTER_CREATED_BEFORE, FILTER_CREATED_AFTER, FILTER_CREATED_YEAR, FILTER_CREATED_MONTH, FILTER_CREATED_DAY } from 'src/app/data/filter-rule-type'; +import { PaperlessTag } from 'src/app/data/paperless-tag'; import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'; import { PaperlessDocumentType } from 'src/app/data/paperless-document-type'; -import { PaperlessTag } from 'src/app/data/paperless-tag'; import { AbstractPaperlessService } from 'src/app/services/rest/abstract-paperless-service'; import { ObjectWithId } from 'src/app/data/object-with-id'; import { CorrespondentService } from 'src/app/services/rest/correspondent.service'; @@ -120,7 +120,11 @@ export class FilterEditorComponent implements OnInit, AfterViewInit { this.applySelected() } - toggleFilterByItem(item: ObjectWithId, filterRuleTypeID: number) { + toggleFilterByItem(item: any, filterRuleTypeID: number) { + let dropdown = this.getDropdownByFilterRuleTypeID(filterRuleTypeID) + if (typeof item == 'number') { + item = dropdown.items.find(i => i.id == item) + } let filterRules = this.filterRules let filterRuleType: FilterRuleType = FILTER_RULE_TYPES.find(t => t.id == filterRuleTypeID) let existingRule = filterRules.find(rule => rule.type.id == filterRuleType.id) @@ -137,7 +141,6 @@ export class FilterEditorComponent implements OnInit, AfterViewInit { filterRules.push({type: FILTER_RULE_TYPES.find(t => t.id == filterRuleType.id), value: item.id}) } - let dropdown = this.getDropdownByFilterRuleTypeID(filterRuleTypeID) this.updateDropdownActiveItems(dropdown) this.filterRules = filterRules