mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
More simplification
This commit is contained in:
parent
6e79b771ec
commit
2ac6a02e31
@ -32,29 +32,29 @@
|
||||
<app-filterable-dropdown class="mr-2 mr-md-3" title="Tags" icon="tag-fill"
|
||||
[toggleableItems]="tagsToggleableItems"
|
||||
[type]="dropdownTypes.Editing"
|
||||
[showCounts]="!this.selectionSpansPages"
|
||||
[showRemoveAll]="this.selectionSpansPages"
|
||||
[showCounts]="!selectionSpansPages"
|
||||
[showRemoveAll]="selectionSpansPages"
|
||||
(open)="tagsDropdownOpen()"
|
||||
(removeAll)="removeAllTags()"
|
||||
(editingComplete)="applyTags($event)">
|
||||
(removeAll)="setTags(null)"
|
||||
(editingComplete)="setTags($event)">
|
||||
</app-filterable-dropdown>
|
||||
<app-filterable-dropdown class="mr-2 mr-md-3" title="Correspondent" icon="person-fill" singular="true"
|
||||
[toggleableItems]="correspondentsToggleableItems"
|
||||
[type]="dropdownTypes.Editing"
|
||||
[showCounts]="!this.selectionSpansPages"
|
||||
[showRemoveAll]="this.selectionSpansPages"
|
||||
[showCounts]="!selectionSpansPages"
|
||||
[showRemoveAll]="selectionSpansPages"
|
||||
(open)="correspondentsDropdownOpen()"
|
||||
(removeAll)="removeAllCorrespondents()"
|
||||
(editingComplete)="applyCorrespondent($event)">
|
||||
(removeAll)="setCorrespondents(null)"
|
||||
(editingComplete)="setCorrespondents($event)">
|
||||
</app-filterable-dropdown>
|
||||
<app-filterable-dropdown class="mr-2 mr-md-3" title="Document Type" icon="file-earmark-fill" singular="true"
|
||||
[toggleableItems]="documentTypesToggleableItems"
|
||||
[type]="dropdownTypes.Editing"
|
||||
[showCounts]="!this.selectionSpansPages"
|
||||
[showRemoveAll]="this.selectionSpansPages"
|
||||
[showCounts]="!selectionSpansPages"
|
||||
[showRemoveAll]="selectionSpansPages"
|
||||
(open)="documentTypesDropdownOpen()"
|
||||
(removeAll)="removeAllDocumentTypes()"
|
||||
(editingComplete)="applyDocumentType($event)">
|
||||
(removeAll)="setDocumentTypes(null)"
|
||||
(editingComplete)="setDocumentTypes($event)">
|
||||
</app-filterable-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -126,37 +126,6 @@ export class BulkEditorComponent {
|
||||
this.initialDocumentTypesToggleableItems = this._documentTypesToggleableItems
|
||||
}
|
||||
|
||||
applyTags(newTagsToggleableItems: ToggleableItem[]) {
|
||||
let changedTags = this.checkForChangedItems(this.initialTagsToggleableItems, newTagsToggleableItems)
|
||||
if (changedTags.itemsToAdd.length > 0 || changedTags.itemsToRemove.length > 0) this.bulkSetTags(changedTags)
|
||||
}
|
||||
|
||||
removeAllTags() {
|
||||
this.bulkSetTags(null)
|
||||
}
|
||||
|
||||
applyCorrespondent(newCorrespondentsToggleableItems: ToggleableItem[]) {
|
||||
let changedCorrespondents = this.checkForChangedItems(this.initialCorrespondentsToggleableItems, newCorrespondentsToggleableItems)
|
||||
if (changedCorrespondents.itemsToAdd.length > 0 || changedCorrespondents.itemsToRemove.length > 0) this.bulkSetCorrespondents(changedCorrespondents)
|
||||
}
|
||||
|
||||
removeAllCorrespondents() {
|
||||
this.bulkSetCorrespondents(null)
|
||||
}
|
||||
|
||||
applyDocumentType(newDocumentTypesToggleableItems: ToggleableItem[]) {
|
||||
let changedDocumentTypes = this.checkForChangedItems(this.initialDocumentTypesToggleableItems, newDocumentTypesToggleableItems)
|
||||
if (changedDocumentTypes.itemsToAdd.length > 0 || changedDocumentTypes.itemsToRemove.length > 0) this.bulkSetDocumentTypes(changedDocumentTypes)
|
||||
}
|
||||
|
||||
removeAllDocumentTypes() {
|
||||
this.bulkSetDocumentTypes(null)
|
||||
}
|
||||
|
||||
applyDelete() {
|
||||
this.bulkDelete()
|
||||
}
|
||||
|
||||
private checkForChangedItems(toggleableItemsA: ToggleableItem[], toggleableItemsB: ToggleableItem[]): ChangedItems {
|
||||
let itemsToAdd: any[] = []
|
||||
let itemsToRemove: any[] = []
|
||||
@ -181,7 +150,13 @@ export class BulkEditorComponent {
|
||||
)
|
||||
}
|
||||
|
||||
private bulkSetTags(changedTags: ChangedItems) {
|
||||
setTags(newTagsToggleableItems: ToggleableItem[]) {
|
||||
let changedTags: ChangedItems
|
||||
if (newTagsToggleableItems) {
|
||||
changedTags = this.checkForChangedItems(this.initialTagsToggleableItems, newTagsToggleableItems)
|
||||
if (changedTags.itemsToAdd.length == 0 && changedTags.itemsToRemove.length == 0) return
|
||||
}
|
||||
|
||||
let modal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'})
|
||||
modal.componentInstance.title = "Confirm Tags Assignment"
|
||||
let action = 'set_tags'
|
||||
@ -224,7 +199,13 @@ export class BulkEditorComponent {
|
||||
})
|
||||
}
|
||||
|
||||
private bulkSetCorrespondents(changedCorrespondents: ChangedItems) {
|
||||
setCorrespondents(newCorrespondentsToggleableItems: ToggleableItem[]) {
|
||||
let changedCorrespondents: ChangedItems
|
||||
if (newCorrespondentsToggleableItems) {
|
||||
changedCorrespondents = this.checkForChangedItems(this.initialCorrespondentsToggleableItems, newCorrespondentsToggleableItems)
|
||||
if (changedCorrespondents.itemsToAdd.length == 0 && changedCorrespondents.itemsToRemove.length == 0) return
|
||||
}
|
||||
|
||||
let modal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'})
|
||||
modal.componentInstance.title = "Confirm Correspondent Assignment"
|
||||
let correspondent
|
||||
@ -245,7 +226,13 @@ export class BulkEditorComponent {
|
||||
})
|
||||
}
|
||||
|
||||
private bulkSetDocumentTypes(changedDocumentTypes: ChangedItems) {
|
||||
setDocumentTypes(newDocumentTypesToggleableItems: ToggleableItem[]) {
|
||||
let changedDocumentTypes: ChangedItems
|
||||
if (newDocumentTypesToggleableItems) {
|
||||
changedDocumentTypes = this.checkForChangedItems(this.initialDocumentTypesToggleableItems, newDocumentTypesToggleableItems)
|
||||
if (changedDocumentTypes.itemsToAdd.length == 0 && changedDocumentTypes.itemsToRemove.length == 0) return
|
||||
}
|
||||
|
||||
let modal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'})
|
||||
modal.componentInstance.title = "Confirm Document Type Assignment"
|
||||
let documentType
|
||||
@ -266,7 +253,7 @@ export class BulkEditorComponent {
|
||||
})
|
||||
}
|
||||
|
||||
private bulkDelete() {
|
||||
applyDelete() {
|
||||
let modal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'})
|
||||
modal.componentInstance.delayConfirm(5)
|
||||
modal.componentInstance.title = "Delete confirm"
|
||||
|
Loading…
x
Reference in New Issue
Block a user