mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-13 01:57:08 +01:00
Merge pull request #2704 from paperless-ngx/feature-dynamic-document-counts
This commit is contained in:
commit
65167625c4
9 changed files with 75 additions and 8 deletions
|
|
@ -25,7 +25,7 @@
|
|||
</div>
|
||||
<div *ngIf="selectionModel.items" class="items">
|
||||
<ng-container *ngFor="let item of selectionModel.itemsSorted | filter: filterText">
|
||||
<app-toggleable-dropdown-button *ngIf="allowSelectNone || item.id" [item]="item" [state]="selectionModel.get(item.id)" (toggle)="selectionModel.toggle(item.id)" (exclude)="excludeClicked(item.id)" [disabled]="disabled"></app-toggleable-dropdown-button>
|
||||
<app-toggleable-dropdown-button *ngIf="allowSelectNone || item.id" [item]="item" [state]="selectionModel.get(item.id)" [count]="getUpdatedDocumentCount(item.id)" (toggle)="selectionModel.toggle(item.id)" (exclude)="excludeClicked(item.id)" [disabled]="disabled"></app-toggleable-dropdown-button>
|
||||
</ng-container>
|
||||
</div>
|
||||
<button *ngIf="editing" class="list-group-item list-group-item-action bg-light" (click)="applyClicked()" [disabled]="!modelIsDirty || disabled">
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
|
|||
import { ToggleableItemState } from './toggleable-dropdown-button/toggleable-dropdown-button.component'
|
||||
import { MatchingModel } from 'src/app/data/matching-model'
|
||||
import { Subject } from 'rxjs'
|
||||
import { SelectionDataItem } from 'src/app/services/rest/document.service'
|
||||
|
||||
export interface ChangedItems {
|
||||
itemsToAdd: MatchingModel[]
|
||||
|
|
@ -333,6 +334,15 @@ export class FilterableDropdownComponent {
|
|||
)
|
||||
}
|
||||
|
||||
@Input()
|
||||
documentCounts: SelectionDataItem[]
|
||||
|
||||
getUpdatedDocumentCount(id: number) {
|
||||
if (this.documentCounts) {
|
||||
return this.documentCounts.find((c) => c.id === id)?.document_count
|
||||
}
|
||||
}
|
||||
|
||||
modelIsDirty: boolean = false
|
||||
|
||||
constructor(private filterPipe: FilterPipe) {
|
||||
|
|
|
|||
|
|
@ -20,5 +20,5 @@
|
|||
<app-tag *ngIf="isTag; else displayName" [tag]="item" [clickable]="false"></app-tag>
|
||||
<ng-template #displayName><small>{{item.name}}</small></ng-template>
|
||||
</div>
|
||||
<div class="badge badge-light rounded-pill ms-auto me-1">{{item.document_count}}</div>
|
||||
<div class="badge badge-light rounded-pill ms-auto me-1">{{count ?? item.document_count}}</div>
|
||||
</button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue