fix error handler, change listing details filters
This commit is contained in:
parent
5ba302bd83
commit
13d8a7da04
@ -10,7 +10,7 @@
|
|||||||
<div class="dossier-stats-item">
|
<div class="dossier-stats-item">
|
||||||
<mat-icon svgIcon="red:needs-work"></mat-icon>
|
<mat-icon svgIcon="red:needs-work"></mat-icon>
|
||||||
<div>
|
<div>
|
||||||
<div class="heading">{{ totalPages | number }}</div>
|
<div class="heading">{{ appStateService.totalAnalysedPages | number }}</div>
|
||||||
<div translate="dossier-listing.stats.analyzed-pages"></div>
|
<div translate="dossier-listing.stats.analyzed-pages"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -18,7 +18,7 @@
|
|||||||
<div class="dossier-stats-item">
|
<div class="dossier-stats-item">
|
||||||
<mat-icon svgIcon="red:user"></mat-icon>
|
<mat-icon svgIcon="red:user"></mat-icon>
|
||||||
<div>
|
<div>
|
||||||
<div class="heading">{{ totalPeople }}</div>
|
<div class="heading">{{ appStateService.totalPeople }}</div>
|
||||||
<div translate="dossier-listing.stats.total-people"></div>
|
<div translate="dossier-listing.stats.total-people"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -26,9 +26,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<redaction-simple-doughnut-chart
|
<redaction-simple-doughnut-chart
|
||||||
(toggleFilter)="toggleFilter('statusFilters', $event)"
|
(toggleFilter)="toggleFilter($event)"
|
||||||
[config]="documentsChartData"
|
[config]="documentsChartData"
|
||||||
[filter]="filters.statusFilters"
|
[filter]="filters"
|
||||||
[radius]="80"
|
[radius]="80"
|
||||||
[strokeWidth]="15"
|
[strokeWidth]="15"
|
||||||
[subtitle]="'dossier-listing.stats.charts.total-documents'"
|
[subtitle]="'dossier-listing.stats.charts.total-documents'"
|
||||||
|
|||||||
@ -11,21 +11,13 @@ import { FilterModel } from '@shared/components/filters/popup-filter/model/filte
|
|||||||
export class DossierListingDetailsComponent {
|
export class DossierListingDetailsComponent {
|
||||||
@Input() dossiersChartData: DoughnutChartConfig[];
|
@Input() dossiersChartData: DoughnutChartConfig[];
|
||||||
@Input() documentsChartData: DoughnutChartConfig[];
|
@Input() documentsChartData: DoughnutChartConfig[];
|
||||||
@Input() filters: { statusFilters: FilterModel[] };
|
@Input() filters: FilterModel[];
|
||||||
@Output() filtersChanged = new EventEmitter();
|
@Output() filtersChanged = new EventEmitter();
|
||||||
|
|
||||||
constructor(private readonly _appStateService: AppStateService) {}
|
constructor(readonly appStateService: AppStateService) {}
|
||||||
|
|
||||||
get totalPages() {
|
toggleFilter(key: string): void {
|
||||||
return this._appStateService.totalAnalysedPages;
|
const filter = this.filters.find(f => f.key === key);
|
||||||
}
|
|
||||||
|
|
||||||
get totalPeople() {
|
|
||||||
return this._appStateService.totalPeople;
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleFilter(filterType: 'needsWorkFilters' | 'statusFilters', key: string): void {
|
|
||||||
const filter = this.filters[filterType].find(f => f.key === key);
|
|
||||||
filter.checked = !filter.checked;
|
filter.checked = !filter.checked;
|
||||||
this.filtersChanged.emit(this.filters);
|
this.filtersChanged.emit(this.filters);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,10 +69,8 @@
|
|||||||
| async
|
| async
|
||||||
| sortBy: sortingOption.order:sortingOption.column
|
| sortBy: sortingOption.order:sortingOption.column
|
||||||
"
|
"
|
||||||
[class.pointer]="canOpenDossier(dw)"
|
[class.pointer]="!!dw"
|
||||||
[routerLink]="[
|
[routerLink]="[!!dw ? '/main/dossiers/' + dw.dossier.dossierId : []]"
|
||||||
canOpenDossier(dw) ? '/main/dossiers/' + dw.dossier.dossierId : []
|
|
||||||
]"
|
|
||||||
class="table-item"
|
class="table-item"
|
||||||
>
|
>
|
||||||
<div class="filename">
|
<div class="filename">
|
||||||
@ -100,7 +98,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<mat-icon svgIcon="red:user"></mat-icon>
|
<mat-icon svgIcon="red:user"></mat-icon>
|
||||||
{{ userCount(dw) }}
|
{{ dw.numberOfMembers }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<mat-icon svgIcon="red:calendar"></mat-icon>
|
<mat-icon svgIcon="red:calendar"></mat-icon>
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { groupBy } from '@utils/functions';
|
|||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
import { DossierWrapper } from '@state/model/dossier.wrapper';
|
import { DossierWrapper } from '@state/model/dossier.wrapper';
|
||||||
import { Observable, Subscription, timer } from 'rxjs';
|
import { Subscription, timer } from 'rxjs';
|
||||||
import { filter, tap } from 'rxjs/operators';
|
import { filter, tap } from 'rxjs/operators';
|
||||||
import { TranslateChartService } from '@services/translate-chart.service';
|
import { TranslateChartService } from '@services/translate-chart.service';
|
||||||
import { RedactionFilterSorter } from '@utils/sorters/redaction-filter-sorter';
|
import { RedactionFilterSorter } from '@utils/sorters/redaction-filter-sorter';
|
||||||
@ -31,7 +31,7 @@ import { SearchService } from '../../../shared/services/search.service';
|
|||||||
import { ScreenStateService } from '../../../shared/services/screen-state.service';
|
import { ScreenStateService } from '../../../shared/services/screen-state.service';
|
||||||
import { NewBaseListingComponent } from '../../../shared/base/new-base-listing.component';
|
import { NewBaseListingComponent } from '../../../shared/base/new-base-listing.component';
|
||||||
import { FilterWrapper } from '../../../shared/components/filters/popup-filter/model/filter-wrapper.model';
|
import { FilterWrapper } from '../../../shared/components/filters/popup-filter/model/filter-wrapper.model';
|
||||||
import { SortingService } from '../../../../services/sorting.service';
|
import { ScreenNames, SortingService } from '../../../../services/sorting.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './dossier-listing-screen.component.html',
|
templateUrl: './dossier-listing-screen.component.html',
|
||||||
@ -48,11 +48,7 @@ export class DossierListingScreenComponent
|
|||||||
peopleFilters: FilterModel[];
|
peopleFilters: FilterModel[];
|
||||||
needsWorkFilters: FilterModel[];
|
needsWorkFilters: FilterModel[];
|
||||||
dossierTemplateFilters: FilterModel[];
|
dossierTemplateFilters: FilterModel[];
|
||||||
detailsContainerFilters: {
|
detailsContainerFilters: FilterModel[] = [];
|
||||||
statusFilters: FilterModel[];
|
|
||||||
} = {
|
|
||||||
statusFilters: []
|
|
||||||
};
|
|
||||||
quickFilters: FilterModel[];
|
quickFilters: FilterModel[];
|
||||||
filterConfigs: FilterConfig[];
|
filterConfigs: FilterConfig[];
|
||||||
buttonConfigs: ButtonConfig[] = [
|
buttonConfigs: ButtonConfig[] = [
|
||||||
@ -87,13 +83,14 @@ export class DossierListingScreenComponent
|
|||||||
protected readonly _injector: Injector
|
protected readonly _injector: Injector
|
||||||
) {
|
) {
|
||||||
super(_injector);
|
super(_injector);
|
||||||
this._sortingService.screenName = 'dossier-listing';
|
this._sortingService.screenName = ScreenNames.DOSSIER_LISTING;
|
||||||
this._appStateService.reset();
|
this._appStateService.reset();
|
||||||
this._searchService.searchKey = 'name';
|
this._searchService.searchKey = 'name';
|
||||||
this._loadEntitiesFromState();
|
this._loadEntitiesFromState();
|
||||||
}
|
}
|
||||||
|
|
||||||
get activeDossiersCount(): number {
|
get activeDossiersCount(): number {
|
||||||
|
console.log('active dossiers');
|
||||||
return this._screenStateService.entities.filter(
|
return this._screenStateService.entities.filter(
|
||||||
p => p.dossier.status === Dossier.StatusEnum.ACTIVE
|
p => p.dossier.status === Dossier.StatusEnum.ACTIVE
|
||||||
).length;
|
).length;
|
||||||
@ -180,14 +177,6 @@ export class DossierListingScreenComponent
|
|||||||
return dossier.files.length;
|
return dossier.files.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
userCount(dossier: DossierWrapper) {
|
|
||||||
return dossier.numberOfMembers;
|
|
||||||
}
|
|
||||||
|
|
||||||
canOpenDossier(dw: DossierWrapper): boolean {
|
|
||||||
return !!dw;
|
|
||||||
}
|
|
||||||
|
|
||||||
getDossierTemplate(dw: DossierWrapper): DossierTemplateModel {
|
getDossierTemplate(dw: DossierWrapper): DossierTemplateModel {
|
||||||
return this._appStateService.getDossierTemplateById(dw.dossier.dossierTemplateId);
|
return this._appStateService.getDossierTemplateById(dw.dossier.dossierTemplateId);
|
||||||
}
|
}
|
||||||
@ -214,9 +203,7 @@ export class DossierListingScreenComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected _preFilter() {
|
protected _preFilter() {
|
||||||
this.detailsContainerFilters = {
|
this.detailsContainerFilters = this.statusFilters.map(f => ({ ...f }));
|
||||||
statusFilters: this.statusFilters.map(f => ({ ...f }))
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _loadEntitiesFromState() {
|
private _loadEntitiesFromState() {
|
||||||
@ -257,14 +244,12 @@ export class DossierListingScreenComponent
|
|||||||
const allDistinctPeople = new Set<string>();
|
const allDistinctPeople = new Set<string>();
|
||||||
const allDistinctNeedsWork = new Set<string>();
|
const allDistinctNeedsWork = new Set<string>();
|
||||||
const allDistinctDossierTemplates = new Set<string>();
|
const allDistinctDossierTemplates = new Set<string>();
|
||||||
this._screenStateService.logCurrentState();
|
|
||||||
this._screenStateService?.entities?.forEach(entry => {
|
this._screenStateService?.entities?.forEach(entry => {
|
||||||
// all people
|
// all people
|
||||||
entry.dossier.memberIds.forEach(f => allDistinctPeople.add(f));
|
entry.dossier.memberIds.forEach(f => allDistinctPeople.add(f));
|
||||||
// file statuses
|
|
||||||
entry.files.forEach(f => allDistinctFileStatus.add(f.status));
|
|
||||||
// Needs work
|
// Needs work
|
||||||
entry.files.forEach(file => {
|
entry.files.forEach(file => {
|
||||||
|
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');
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { Pipe, PipeTransform } from '@angular/core';
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
import { orderBy } from 'lodash';
|
import { orderBy } from 'lodash';
|
||||||
|
import { SortingOrders } from '@services/sorting.service';
|
||||||
|
|
||||||
@Pipe({ name: 'sortBy' })
|
@Pipe({ name: 'sortBy' })
|
||||||
export class SortByPipe implements PipeTransform {
|
export class SortByPipe implements PipeTransform {
|
||||||
@ -8,7 +9,7 @@ export class SortByPipe implements PipeTransform {
|
|||||||
return value;
|
return value;
|
||||||
} // no array
|
} // no array
|
||||||
if (!column || column === '') {
|
if (!column || column === '') {
|
||||||
if (order === 'asc') {
|
if (order === SortingOrders.ASC) {
|
||||||
return value.sort();
|
return value.sort();
|
||||||
} else {
|
} else {
|
||||||
return value.sort().reverse();
|
return value.sort().reverse();
|
||||||
|
|||||||
@ -37,9 +37,7 @@ export class ScreenStateService<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setDisplayedEntities(newEntities: Partial<T[]>) {
|
setDisplayedEntities(newEntities: Partial<T[]>) {
|
||||||
console.log(this.displayedEntities);
|
|
||||||
this.displayedEntities$.next(newEntities);
|
this.displayedEntities$.next(newEntities);
|
||||||
console.log(this.displayedEntities);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set selectionKey(value: string) {
|
set selectionKey(value: string) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user