mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-21 10:29:29 -05:00
Implemented 'Filter by: ASN'
This commit is contained in:
parent
59bc467c50
commit
6535a20b21
@ -8,12 +8,13 @@ import { DocumentTypeService } from 'src/app/services/rest/document-type.service
|
|||||||
import { TagService } from 'src/app/services/rest/tag.service';
|
import { TagService } from 'src/app/services/rest/tag.service';
|
||||||
import { CorrespondentService } from 'src/app/services/rest/correspondent.service';
|
import { CorrespondentService } from 'src/app/services/rest/correspondent.service';
|
||||||
import { FilterRule } from 'src/app/data/filter-rule';
|
import { FilterRule } from 'src/app/data/filter-rule';
|
||||||
import { FILTER_ADDED_AFTER, FILTER_ADDED_BEFORE, FILTER_CORRESPONDENT, FILTER_CREATED_AFTER, FILTER_CREATED_BEFORE, FILTER_DOCUMENT_TYPE, FILTER_HAS_ANY_TAG, FILTER_HAS_TAG, FILTER_TITLE, FILTER_TITLE_CONTENT } from 'src/app/data/filter-rule-type';
|
import { FILTER_ADDED_AFTER, FILTER_ADDED_BEFORE, FILTER_ASN, FILTER_CORRESPONDENT, FILTER_CREATED_AFTER, FILTER_CREATED_BEFORE, FILTER_DOCUMENT_TYPE, FILTER_HAS_ANY_TAG, FILTER_HAS_TAG, FILTER_TITLE, FILTER_TITLE_CONTENT } from 'src/app/data/filter-rule-type';
|
||||||
import { FilterableDropdownSelectionModel } from '../../common/filterable-dropdown/filterable-dropdown.component';
|
import { FilterableDropdownSelectionModel } from '../../common/filterable-dropdown/filterable-dropdown.component';
|
||||||
import { ToggleableItemState } from '../../common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component';
|
import { ToggleableItemState } from '../../common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component';
|
||||||
|
|
||||||
const TEXT_FILTER_TARGET_TITLE = "title"
|
const TEXT_FILTER_TARGET_TITLE = "title"
|
||||||
const TEXT_FILTER_TARGET_TITLE_CONTENT = "title-content"
|
const TEXT_FILTER_TARGET_TITLE_CONTENT = "title-content"
|
||||||
|
const TEXT_FILTER_TARGET_ASN = "asn"
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-filter-editor',
|
selector: 'app-filter-editor',
|
||||||
@ -51,6 +52,9 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
case FILTER_TITLE:
|
case FILTER_TITLE:
|
||||||
return $localize`Title: ${rule.value}`
|
return $localize`Title: ${rule.value}`
|
||||||
|
|
||||||
|
case FILTER_ASN:
|
||||||
|
return $localize`ASN: ${rule.value}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +75,8 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
textFilterTargets = [
|
textFilterTargets = [
|
||||||
{id: TEXT_FILTER_TARGET_TITLE, name: $localize`Title`},
|
{id: TEXT_FILTER_TARGET_TITLE, name: $localize`Title`},
|
||||||
{id: TEXT_FILTER_TARGET_TITLE_CONTENT, name: $localize`Title & content`}
|
{id: TEXT_FILTER_TARGET_TITLE_CONTENT, name: $localize`Title & content`},
|
||||||
|
{id: TEXT_FILTER_TARGET_ASN, name: $localize`ASN`}
|
||||||
]
|
]
|
||||||
|
|
||||||
textFilterTarget = TEXT_FILTER_TARGET_TITLE_CONTENT
|
textFilterTarget = TEXT_FILTER_TARGET_TITLE_CONTENT
|
||||||
@ -111,6 +116,10 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
|
|||||||
this._textFilter = rule.value
|
this._textFilter = rule.value
|
||||||
this.textFilterTarget = TEXT_FILTER_TARGET_TITLE_CONTENT
|
this.textFilterTarget = TEXT_FILTER_TARGET_TITLE_CONTENT
|
||||||
break
|
break
|
||||||
|
case FILTER_ASN:
|
||||||
|
this._textFilter = rule.value
|
||||||
|
this.textFilterTarget = TEXT_FILTER_TARGET_ASN
|
||||||
|
break
|
||||||
case FILTER_CREATED_AFTER:
|
case FILTER_CREATED_AFTER:
|
||||||
this.dateCreatedAfter = rule.value
|
this.dateCreatedAfter = rule.value
|
||||||
break
|
break
|
||||||
@ -147,6 +156,9 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
|
|||||||
if (this._textFilter && this.textFilterTarget == TEXT_FILTER_TARGET_TITLE) {
|
if (this._textFilter && this.textFilterTarget == TEXT_FILTER_TARGET_TITLE) {
|
||||||
filterRules.push({rule_type: FILTER_TITLE, value: this._textFilter})
|
filterRules.push({rule_type: FILTER_TITLE, value: this._textFilter})
|
||||||
}
|
}
|
||||||
|
if (this._textFilter && this.textFilterTarget == TEXT_FILTER_TARGET_ASN) {
|
||||||
|
filterRules.push({rule_type: FILTER_ASN, value: this._textFilter})
|
||||||
|
}
|
||||||
if (this.tagSelectionModel.isNoneSelected()) {
|
if (this.tagSelectionModel.isNoneSelected()) {
|
||||||
filterRules.push({rule_type: FILTER_HAS_ANY_TAG, value: "false"})
|
filterRules.push({rule_type: FILTER_HAS_ANY_TAG, value: "false"})
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user