Hide filter / bulk editor for better switching

This commit is contained in:
Michael Shamoon 2020-12-19 22:14:52 -08:00
parent ee4e026ba2
commit 39b35c090b
3 changed files with 8 additions and 5 deletions

View File

@ -57,7 +57,7 @@ export class BulkEditorComponent {
get tagsToggleableItems(): ToggleableItem[] { get tagsToggleableItems(): ToggleableItem[] {
let tagsToggleableItems = [] let tagsToggleableItems = []
let selectedDocuments: PaperlessDocument[] = this.allDocuments.filter(d => this.selectedDocuments.has(d.id)) let selectedDocuments: PaperlessDocument[] = this.allDocuments.filter(d => this.selectedDocuments.has(d.id))
this.tags.forEach(t => { this.tags?.forEach(t => {
let selectedDocumentsWithTag: PaperlessDocument[] = selectedDocuments.filter(d => d.tags.includes(t.id)) let selectedDocumentsWithTag: PaperlessDocument[] = selectedDocuments.filter(d => d.tags.includes(t.id))
let state = ToggleableItemState.NotSelected let state = ToggleableItemState.NotSelected
if (selectedDocumentsWithTag.length == selectedDocuments.length) state = ToggleableItemState.Selected if (selectedDocumentsWithTag.length == selectedDocuments.length) state = ToggleableItemState.Selected
@ -71,7 +71,7 @@ export class BulkEditorComponent {
let correspondentsToggleableItems = [] let correspondentsToggleableItems = []
let selectedDocuments: PaperlessDocument[] = this.allDocuments.filter(d => this.selectedDocuments.has(d.id)) let selectedDocuments: PaperlessDocument[] = this.allDocuments.filter(d => this.selectedDocuments.has(d.id))
this.correspondents.forEach(c => { this.correspondents?.forEach(c => {
let selectedDocumentsWithCorrespondent: PaperlessDocument[] = selectedDocuments.filter(d => d.correspondent == c.id) let selectedDocumentsWithCorrespondent: PaperlessDocument[] = selectedDocuments.filter(d => d.correspondent == c.id)
let state = ToggleableItemState.NotSelected let state = ToggleableItemState.NotSelected
if (selectedDocumentsWithCorrespondent.length == selectedDocuments.length) state = ToggleableItemState.Selected if (selectedDocumentsWithCorrespondent.length == selectedDocuments.length) state = ToggleableItemState.Selected
@ -85,7 +85,7 @@ export class BulkEditorComponent {
let documentTypesToggleableItems = [] let documentTypesToggleableItems = []
let selectedDocuments: PaperlessDocument[] = this.allDocuments.filter(d => this.selectedDocuments.has(d.id)) let selectedDocuments: PaperlessDocument[] = this.allDocuments.filter(d => this.selectedDocuments.has(d.id))
this.documentTypes.forEach(dt => { this.documentTypes?.forEach(dt => {
let selectedDocumentsWithDocumentType: PaperlessDocument[] = selectedDocuments.filter(d => d.document_type == dt.id) let selectedDocumentsWithDocumentType: PaperlessDocument[] = selectedDocuments.filter(d => d.document_type == dt.id)
let state = ToggleableItemState.NotSelected let state = ToggleableItemState.NotSelected
if (selectedDocumentsWithDocumentType.length == selectedDocuments.length) state = ToggleableItemState.Selected if (selectedDocumentsWithDocumentType.length == selectedDocuments.length) state = ToggleableItemState.Selected

View File

@ -78,9 +78,9 @@
</app-page-header> </app-page-header>
<div class="w-100 mb-2 mb-sm-4"> <div class="w-100 mb-2 mb-sm-4">
<app-filter-editor *ngIf="!isBulkEditing" [(filterRules)]="list.filterRules" #filterEditor></app-filter-editor> <app-filter-editor [hidden]="isBulkEditing" [(filterRules)]="list.filterRules" #filterEditor></app-filter-editor>
<app-bulk-editor *ngIf="isBulkEditing" <app-bulk-editor [hidden]="!isBulkEditing"
[allDocuments]="list.documents" [allDocuments]="list.documents"
[(selectedDocuments)]="list.selected" [(selectedDocuments)]="list.selected"
(selectPage)="list.selectPage()" (selectPage)="list.selectPage()"

View File

@ -119,14 +119,17 @@ export class DocumentListComponent implements OnInit {
} }
clickTag(tagID: number) { clickTag(tagID: number) {
this.list.selectNone()
this.filterEditor.toggleTag(tagID) this.filterEditor.toggleTag(tagID)
} }
clickCorrespondent(correspondentID: number) { clickCorrespondent(correspondentID: number) {
this.list.selectNone()
this.filterEditor.toggleCorrespondent(correspondentID) this.filterEditor.toggleCorrespondent(correspondentID)
} }
clickDocumentType(documentTypeID: number) { clickDocumentType(documentTypeID: number) {
this.list.selectNone()
this.filterEditor.toggleDocumentType(documentTypeID) this.filterEditor.toggleDocumentType(documentTypeID)
} }