temporary fix active filter
This commit is contained in:
parent
809ad98ed1
commit
51417fb3ae
@ -1,12 +1,4 @@
|
|||||||
import {
|
import { ChangeDetectionStrategy, Component, Injector, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core';
|
||||||
ChangeDetectionStrategy,
|
|
||||||
Component,
|
|
||||||
Injector,
|
|
||||||
OnDestroy,
|
|
||||||
OnInit,
|
|
||||||
TemplateRef,
|
|
||||||
ViewChild
|
|
||||||
} from '@angular/core';
|
|
||||||
import { Dossier, DossierTemplateModel } from '@redaction/red-ui-http';
|
import { Dossier, DossierTemplateModel } from '@redaction/red-ui-http';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
import { AppStateService } from '@state/app-state.service';
|
||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
@ -41,13 +33,9 @@ import { ScreenNames, SortingService } from '../../../../services/sorting.servic
|
|||||||
@Component({
|
@Component({
|
||||||
templateUrl: './dossier-listing-screen.component.html',
|
templateUrl: './dossier-listing-screen.component.html',
|
||||||
styleUrls: ['./dossier-listing-screen.component.scss'],
|
styleUrls: ['./dossier-listing-screen.component.scss'],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
||||||
providers: [FilterService, SearchService, ScreenStateService, SortingService]
|
providers: [FilterService, SearchService, ScreenStateService, SortingService]
|
||||||
})
|
})
|
||||||
export class DossierListingScreenComponent
|
export class DossierListingScreenComponent extends BaseListingComponent<DossierWrapper> implements OnInit, OnDestroy, OnAttach, OnDetach {
|
||||||
extends BaseListingComponent<DossierWrapper>
|
|
||||||
implements OnInit, OnDestroy, OnAttach, OnDetach
|
|
||||||
{
|
|
||||||
dossiersChartData: DoughnutChartConfig[] = [];
|
dossiersChartData: DoughnutChartConfig[] = [];
|
||||||
documentsChartData: DoughnutChartConfig[] = [];
|
documentsChartData: DoughnutChartConfig[] = [];
|
||||||
buttonConfigs: ButtonConfig[] = [
|
buttonConfigs: ButtonConfig[] = [
|
||||||
@ -147,10 +135,6 @@ export class DossierListingScreenComponent
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
filtersChanged() {
|
|
||||||
this.filterService.filterEntities();
|
|
||||||
}
|
|
||||||
|
|
||||||
private _loadEntitiesFromState() {
|
private _loadEntitiesFromState() {
|
||||||
this._screenStateService.setEntities(this._appStateService.allDossiers);
|
this._screenStateService.setEntities(this._appStateService.allDossiers);
|
||||||
}
|
}
|
||||||
@ -160,9 +144,7 @@ export class DossierListingScreenComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
private get _activeDossiersCount(): number {
|
private get _activeDossiersCount(): number {
|
||||||
return this._screenStateService.entities.filter(
|
return this._screenStateService.entities.filter(p => p.dossier.status === Dossier.StatusEnum.ACTIVE).length;
|
||||||
p => p.dossier.status === Dossier.StatusEnum.ACTIVE
|
|
||||||
).length;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private get _inactiveDossiersCount(): number {
|
private get _inactiveDossiersCount(): number {
|
||||||
@ -188,9 +170,7 @@ export class DossierListingScreenComponent
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.documentsChartData.sort((a, b) => StatusSorter[a.key] - StatusSorter[b.key]);
|
this.documentsChartData.sort((a, b) => StatusSorter[a.key] - StatusSorter[b.key]);
|
||||||
this.documentsChartData = this._translateChartService.translateStatus(
|
this.documentsChartData = this._translateChartService.translateStatus(this.documentsChartData);
|
||||||
this.documentsChartData
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _computeAllFilters() {
|
private _computeAllFilters() {
|
||||||
@ -205,8 +185,7 @@ export class DossierListingScreenComponent
|
|||||||
// Needs work
|
// Needs work
|
||||||
entry.files.forEach(file => {
|
entry.files.forEach(file => {
|
||||||
allDistinctFileStatus.add(file.status);
|
allDistinctFileStatus.add(file.status);
|
||||||
if (this.permissionsService.fileRequiresReanalysis(file))
|
if (this.permissionsService.fileRequiresReanalysis(file)) allDistinctNeedsWork.add('analysis');
|
||||||
allDistinctNeedsWork.add('analysis');
|
|
||||||
if (entry.hintsOnly) allDistinctNeedsWork.add('hint');
|
if (entry.hintsOnly) allDistinctNeedsWork.add('hint');
|
||||||
if (entry.hasRedactions) allDistinctNeedsWork.add('redaction');
|
if (entry.hasRedactions) allDistinctNeedsWork.add('redaction');
|
||||||
if (entry.hasRequests) allDistinctNeedsWork.add('suggestion');
|
if (entry.hasRequests) allDistinctNeedsWork.add('suggestion');
|
||||||
@ -276,17 +255,14 @@ export class DossierListingScreenComponent
|
|||||||
this.filterService.addFilter({
|
this.filterService.addFilter({
|
||||||
slug: 'quickFilters',
|
slug: 'quickFilters',
|
||||||
values: quickFilters,
|
values: quickFilters,
|
||||||
checker: (dw: DossierWrapper) =>
|
checker: (dw: DossierWrapper) => quickFilters.reduce((acc, f) => acc || (f.checked && f.checker(dw)), false)
|
||||||
quickFilters.reduce((acc, f) => acc || (f.checked && f.checker(dw)), false)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.filterService.filterEntities();
|
this.filterService.filterEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createQuickFilters() {
|
private _createQuickFilters() {
|
||||||
const myDossiersLabel = this._translateService.instant(
|
const myDossiersLabel = this._translateService.instant('dossier-listing.quick-filters.my-dossiers');
|
||||||
'dossier-listing.quick-filters.my-dossiers'
|
|
||||||
);
|
|
||||||
const filters: FilterModel[] = [
|
const filters: FilterModel[] = [
|
||||||
{
|
{
|
||||||
key: 'my-dossiers',
|
key: 'my-dossiers',
|
||||||
@ -310,8 +286,6 @@ export class DossierListingScreenComponent
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
return filters.filter(
|
return filters.filter(f => f.label === myDossiersLabel || this._userPreferenceService.areDevFeaturesEnabled);
|
||||||
f => f.label === myDossiersLabel || this._userPreferenceService.areDevFeaturesEnabled
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user