mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	ASN 'is null' from frontend
This commit is contained in:
		| @@ -8,7 +8,13 @@ | ||||
|               <button *ngFor="let t of textFilterTargets" ngbDropdownItem [class.active]="textFilterTarget == t.id" (click)="changeTextFilterTarget(t.id)">{{t.name}}</button> | ||||
|             </div> | ||||
|           </div> | ||||
|           <input #textFilterInput class="form-control form-control-sm" type="text" [(ngModel)]="textFilter" (keyup.enter)="textFilterEnter()" [readonly]="textFilterTarget == 'fulltext-morelike'"> | ||||
|           <div *ngIf="textFilterTarget == 'asn'" class="input-group-text py-0"> | ||||
|             <div class="form-check form-switch m-0"> | ||||
|               <input class="form-check-input" type="checkbox" role="switch" [(ngModel)]="textFilterTargetIsNull" (change)="updateRules()"> | ||||
|               <label class="form-check-label" [class.text-muted]="!textFilterTargetIsNull" i18n>Is empty</label> | ||||
|             </div> | ||||
|           </div> | ||||
|           <input #textFilterInput class="form-control form-control-sm" type="text" [disabled]="textFilterTargetIsNull" [(ngModel)]="textFilter" (keyup.enter)="textFilterEnter()" [readonly]="textFilterTarget == 'fulltext-morelike'"> | ||||
|          </div> | ||||
|      </div> | ||||
|   </div> | ||||
|   | ||||
| @@ -33,6 +33,7 @@ import { | ||||
|   FILTER_DOES_NOT_HAVE_TAG, | ||||
|   FILTER_TITLE, | ||||
|   FILTER_TITLE_CONTENT, | ||||
|   FILTER_ASN_ISNULL, | ||||
| } from 'src/app/data/filter-rule-type' | ||||
| import { FilterableDropdownSelectionModel } from '../../common/filterable-dropdown/filterable-dropdown.component' | ||||
| import { ToggleableItemState } from '../../common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component' | ||||
| @@ -135,6 +136,7 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | ||||
|   } | ||||
|  | ||||
|   textFilterTarget = TEXT_FILTER_TARGET_TITLE_CONTENT | ||||
|   textFilterTargetIsNull: boolean = false | ||||
|  | ||||
|   get textFilterTargetName() { | ||||
|     return this.textFilterTargets.find((t) => t.id == this.textFilterTarget) | ||||
| @@ -176,6 +178,7 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | ||||
|     this.dateAddedAfter = null | ||||
|     this.dateCreatedBefore = null | ||||
|     this.dateCreatedAfter = null | ||||
|     this.textFilterTargetIsNull = false | ||||
|  | ||||
|     value.forEach((rule) => { | ||||
|       switch (rule.rule_type) { | ||||
| @@ -254,6 +257,10 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | ||||
|             false | ||||
|           ) | ||||
|           break | ||||
|         case FILTER_ASN_ISNULL: | ||||
|           this.textFilterTarget = TEXT_FILTER_TARGET_ASN | ||||
|           this.textFilterTargetIsNull = rule.value == 'true' | ||||
|           break | ||||
|       } | ||||
|     }) | ||||
|     this.checkIfRulesHaveChanged() | ||||
| @@ -273,8 +280,15 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | ||||
|     if (this._textFilter && this.textFilterTarget == TEXT_FILTER_TARGET_TITLE) { | ||||
|       filterRules.push({ rule_type: FILTER_TITLE, value: this._textFilter }) | ||||
|     } | ||||
|     if (this._textFilter && this.textFilterTarget == TEXT_FILTER_TARGET_ASN) { | ||||
|     if (this.textFilterTarget == TEXT_FILTER_TARGET_ASN) { | ||||
|       if (this.textFilter?.length && !this.textFilterTargetIsNull) { | ||||
|         filterRules.push({ rule_type: FILTER_ASN, value: this._textFilter }) | ||||
|       } else if (!this.textFilter?.length) { | ||||
|         filterRules.push({ | ||||
|           rule_type: FILTER_ASN_ISNULL, | ||||
|           value: this.textFilterTargetIsNull.toString(), | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|     if ( | ||||
|       this._textFilter && | ||||
| @@ -398,7 +412,7 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | ||||
|   } | ||||
|  | ||||
|   get textFilter() { | ||||
|     return this._textFilter | ||||
|     return this.textFilterTargetIsNull ? '' : this._textFilter | ||||
|   } | ||||
|  | ||||
|   set textFilter(value) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon