add only active dossiers filter
This commit is contained in:
parent
7a39ba96ca
commit
346baaf7ec
@ -5,6 +5,7 @@ import {
|
|||||||
CircleButtonTypes,
|
CircleButtonTypes,
|
||||||
ConfirmationDialogInput,
|
ConfirmationDialogInput,
|
||||||
DefaultListingServices,
|
DefaultListingServices,
|
||||||
|
getLeftDateTime,
|
||||||
IListable,
|
IListable,
|
||||||
IRouterPath,
|
IRouterPath,
|
||||||
ListingComponent,
|
ListingComponent,
|
||||||
@ -16,7 +17,6 @@ import {
|
|||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { ConfigService } from '@services/config.service';
|
import { ConfigService } from '@services/config.service';
|
||||||
import { getLeftDateTime } from '@utils/functions';
|
|
||||||
import { firstValueFrom, Observable, of } from 'rxjs';
|
import { firstValueFrom, Observable, of } from 'rxjs';
|
||||||
import { distinctUntilChanged, map } from 'rxjs/operators';
|
import { distinctUntilChanged, map } from 'rxjs/operators';
|
||||||
import { DossiersDialogService } from '../../../services/dossiers-dialog.service';
|
import { DossiersDialogService } from '../../../services/dossiers-dialog.service';
|
||||||
|
|||||||
@ -89,6 +89,8 @@ export class SearchScreenComponent extends ListingComponent<ISearchListItem> imp
|
|||||||
checker: keyChecker('dossierId'),
|
checker: keyChecker('dossierId'),
|
||||||
};
|
};
|
||||||
this.filterService.addFilterGroups([dossierNameFilter]);
|
this.filterService.addFilterGroups([dossierNameFilter]);
|
||||||
|
const onlyActiveLabel = this._translateService.instant('search-screen.filters.only-active');
|
||||||
|
this.filterService.addSingleFilter({ id: 'onlyActiveDossiers', label: onlyActiveLabel, checked: this._routeOnlyActive });
|
||||||
}
|
}
|
||||||
|
|
||||||
private get _routeDossierIds(): string[] {
|
private get _routeDossierIds(): string[] {
|
||||||
@ -112,11 +114,12 @@ export class SearchScreenComponent extends ListingComponent<ISearchListItem> imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
private get _filtersChanged$(): Observable<[string[], boolean]> {
|
private get _filtersChanged$(): Observable<[string[], boolean]> {
|
||||||
return this.filterService.filterGroups$.pipe(
|
const onlyActiveDossiers$ = this.filterService.getSingleFilter('onlyActiveDossiers').pipe(map(f => !!f.checked));
|
||||||
map(groups => {
|
const filterGroups$ = this.filterService.filterGroups$;
|
||||||
|
return combineLatest([filterGroups$, onlyActiveDossiers$]).pipe(
|
||||||
|
map(([groups, onlyActive]) => {
|
||||||
const dossierIds: string[] = groups[0].filters.filter(v => v.checked).map(v => v.id);
|
const dossierIds: string[] = groups[0].filters.filter(v => v.checked).map(v => v.id);
|
||||||
// TODO: Only active filter
|
return [dossierIds, onlyActive];
|
||||||
return [dossierIds, this._routeOnlyActive];
|
|
||||||
}),
|
}),
|
||||||
startWith<[string[], boolean]>([this._routeDossierIds, this._routeOnlyActive]),
|
startWith<[string[], boolean]>([this._routeDossierIds, this._routeOnlyActive]),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -3,9 +3,9 @@ import * as moment from 'moment';
|
|||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { DatePipe as BaseDatePipe } from '@angular/common';
|
import { DatePipe as BaseDatePipe } from '@angular/common';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { getLeftDateTime } from '@utils/functions';
|
import { getLeftDateTime } from '@iqser/common-ui';
|
||||||
|
|
||||||
const MONTH_NAMES = {
|
const MONTH_NAMES: Record<number, string> = {
|
||||||
0: _('months.jan'),
|
0: _('months.jan'),
|
||||||
1: _('months.feb'),
|
1: _('months.feb'),
|
||||||
2: _('months.mar'),
|
2: _('months.mar'),
|
||||||
@ -29,16 +29,18 @@ export class DatePipe extends BaseDatePipe implements PipeTransform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null;
|
transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null;
|
||||||
transform(value: Date | string | number | null | undefined, format?: string, timezone?: string, locale?: string): string | null;
|
transform(value: Date | string | number, format?: string, timezone?: string, locale?: string): string;
|
||||||
transform(value: any, format?: string, timezone?: string, locale?: string): string {
|
transform(value: Date | string | number | null | undefined, format?: string, timezone?: string, locale?: string): string | null {
|
||||||
if (format === 'timeFromNow') {
|
if (typeof value === 'string') {
|
||||||
return this._getTimeFromNow(value);
|
if (format === 'timeFromNow') {
|
||||||
}
|
return this._getTimeFromNow(value);
|
||||||
if (format === 'sophisticatedDate') {
|
}
|
||||||
return this._getSophisticatedDate(value);
|
if (format === 'sophisticatedDate') {
|
||||||
}
|
return this._getSophisticatedDate(value);
|
||||||
if (format === 'exactDate') {
|
}
|
||||||
return this._getExactDate(value);
|
if (format === 'exactDate') {
|
||||||
|
return this._getExactDate(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.transform(value, format, timezone, locale);
|
return super.transform(value, format, timezone, locale);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import * as moment from 'moment';
|
|
||||||
import { List } from '@iqser/common-ui';
|
import { List } from '@iqser/common-ui';
|
||||||
import { filter } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
import { ActivationEnd } from '@angular/router';
|
import { ActivationEnd } from '@angular/router';
|
||||||
@ -76,22 +75,6 @@ export function toNumber(str: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const HOURS_IN_A_DAY = 24;
|
|
||||||
const MINUTES_IN_AN_HOUR = 60;
|
|
||||||
|
|
||||||
export function getLeftDateTime(ISOString: string) {
|
|
||||||
const date = moment(ISOString);
|
|
||||||
const now = new Date(Date.now());
|
|
||||||
|
|
||||||
const daysLeft = date.diff(now, 'days');
|
|
||||||
const hoursFromNow = date.diff(now, 'hours');
|
|
||||||
const hoursLeft = hoursFromNow - HOURS_IN_A_DAY * daysLeft;
|
|
||||||
const minutesFromNow = date.diff(now, 'minutes');
|
|
||||||
const minutesLeft = minutesFromNow - HOURS_IN_A_DAY * MINUTES_IN_AN_HOUR * daysLeft;
|
|
||||||
|
|
||||||
return { daysLeft, hoursLeft, minutesLeft };
|
|
||||||
}
|
|
||||||
|
|
||||||
export function removeBraces(str: any): string {
|
export function removeBraces(str: any): string {
|
||||||
return str.replace(/[{}]/g, '');
|
return str.replace(/[{}]/g, '');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1719,6 +1719,7 @@
|
|||||||
},
|
},
|
||||||
"filters": {
|
"filters": {
|
||||||
"by-dossier": "Nach Dossier filtern",
|
"by-dossier": "Nach Dossier filtern",
|
||||||
|
"only-active": "",
|
||||||
"search-placeholder": "Dossiername..."
|
"search-placeholder": "Dossiername..."
|
||||||
},
|
},
|
||||||
"missing": "Fehlt",
|
"missing": "Fehlt",
|
||||||
|
|||||||
@ -1754,6 +1754,7 @@
|
|||||||
},
|
},
|
||||||
"filters": {
|
"filters": {
|
||||||
"by-dossier": "Filter by Dossier",
|
"by-dossier": "Filter by Dossier",
|
||||||
|
"only-active": "Active dossiers only",
|
||||||
"search-placeholder": "Dossier name..."
|
"search-placeholder": "Dossier name..."
|
||||||
},
|
},
|
||||||
"missing": "Missing",
|
"missing": "Missing",
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit 0157507f661ab216413ec0cf6f4a03128ecb5fce
|
Subproject commit c11f73ba9e202ae86e60a6e6eb1639a3a59d04a8
|
||||||
@ -1,7 +1,6 @@
|
|||||||
import { List } from '@iqser/common-ui';
|
import { getLeftDateTime, List } from '@iqser/common-ui';
|
||||||
import { DownloadFileType } from '../shared';
|
import { DownloadFileType } from '../shared';
|
||||||
import { DossierStatus, IDossier } from '@red/domain';
|
import { DossierStatus, IDossier } from '../dossiers';
|
||||||
import { getLeftDateTime } from '@utils/functions';
|
|
||||||
|
|
||||||
export class TrashDossier implements IDossier {
|
export class TrashDossier implements IDossier {
|
||||||
readonly dossierId: string;
|
readonly dossierId: string;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user