mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	fixes #121
This commit is contained in:
		| @@ -1,8 +1,14 @@ | ||||
| <div class="form-group"> | ||||
|   <label [for]="inputId">{{title}}</label> | ||||
|   <input type="number" class="form-control" [class.is-invalid]="error" [id]="inputId" [(ngModel)]="value" (change)="onChange(value)"> | ||||
|   <small *ngIf="hint" class="form-text text-muted">{{hint}}</small> | ||||
|   <div class="input-group" [class.is-invalid]="error"> | ||||
|     <input type="number" class="form-control" [id]="inputId" [(ngModel)]="value" (change)="onChange(value)" [class.is-invalid]="error"> | ||||
|     <div class="input-group-append"> | ||||
|       <button class="btn btn-outline-secondary" type="button" id="button-addon1" (click)="nextAsn()" [disabled]="value">+1</button> | ||||
|     </div> | ||||
|   </div> | ||||
|   <div class="invalid-feedback"> | ||||
|     {{error}} | ||||
|   </div> | ||||
|   <small *ngIf="hint" class="form-text text-muted">{{hint}}</small> | ||||
|  | ||||
| </div> | ||||
| @@ -1,5 +1,7 @@ | ||||
| import { Component, forwardRef } from '@angular/core'; | ||||
| import { NG_VALUE_ACCESSOR } from '@angular/forms'; | ||||
| import { FILTER_ASN_ISNULL } from 'src/app/data/filter-rule-type'; | ||||
| import { DocumentService } from 'src/app/services/rest/document.service'; | ||||
| import { AbstractInputComponent } from '../abstract-input'; | ||||
|  | ||||
| @Component({ | ||||
| @@ -14,8 +16,24 @@ import { AbstractInputComponent } from '../abstract-input'; | ||||
| }) | ||||
| export class NumberComponent extends AbstractInputComponent<number> { | ||||
|  | ||||
|   constructor() { | ||||
|   constructor(private documentService: DocumentService) { | ||||
|     super() | ||||
|   } | ||||
|  | ||||
|   nextAsn() { | ||||
|     if (this.value) { | ||||
|       return | ||||
|     } | ||||
|     this.documentService.listFiltered(1, 1, "archive_serial_number", true, [{rule_type: FILTER_ASN_ISNULL, value: "false"}]).subscribe( | ||||
|       results => { | ||||
|         if (results.count > 0) { | ||||
|           this.value = results.results[0].archive_serial_number + 1 | ||||
|         } else { | ||||
|           this.value + 1 | ||||
|         } | ||||
|         this.onChange(this.value) | ||||
|       } | ||||
|     ) | ||||
|   } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -18,6 +18,8 @@ export const FILTER_MODIFIED_AFTER = 16 | ||||
|  | ||||
| export const FILTER_DOES_NOT_HAVE_TAG = 17 | ||||
|  | ||||
| export const FILTER_ASN_ISNULL = 18 | ||||
|  | ||||
| export const FILTER_RULE_TYPES: FilterRuleType[] = [ | ||||
|  | ||||
|   {id: FILTER_TITLE, name: "Title contains", filtervar: "title__icontains", datatype: "string", multi: false, default: ""}, | ||||
| @@ -45,6 +47,7 @@ export const FILTER_RULE_TYPES: FilterRuleType[] = [ | ||||
|  | ||||
|   {id: FILTER_MODIFIED_BEFORE, name: "Modified before", filtervar: "modified__date__lt", datatype: "date", multi: false}, | ||||
|   {id: FILTER_MODIFIED_AFTER, name: "Modified after", filtervar: "modified__date__gt", datatype: "date", multi: false}, | ||||
|   {id: FILTER_ASN_ISNULL, name: "ASN is null", filtervar: "archive_serial_number__isnull", datatype: "boolean", multi: false} | ||||
| ] | ||||
|  | ||||
| export interface FilterRuleType { | ||||
|   | ||||
| @@ -4,7 +4,7 @@ from .models import Correspondent, Document, Tag, DocumentType, Log | ||||
|  | ||||
| CHAR_KWARGS = ["istartswith", "iendswith", "icontains", "iexact"] | ||||
| ID_KWARGS = ["in", "exact"] | ||||
| INT_KWARGS = ["exact", "gt", "gte", "lt", "lte"] | ||||
| INT_KWARGS = ["exact", "gt", "gte", "lt", "lte", "isnull"] | ||||
| DATE_KWARGS = ["year", "month", "day", "date__gt", "gt", "date__lt", "lt"] | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 jonaswinkler
					jonaswinkler