diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/dossier-details-stats/dossier-details-stats.component.html b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/dossier-details-stats/dossier-details-stats.component.html
index 025a07aee..0abb33ec4 100644
--- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/dossier-details-stats/dossier-details-stats.component.html
+++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/dossier-details-stats/dossier-details-stats.component.html
@@ -44,10 +44,8 @@
{{ 'dossier-overview.dossier-details.dictionary' | translate }}
- \
-
- {{ files.length }} {{ 'dossier-overview.dossier-details.deleted' | translate }}
-
+
+ {{ 'dossier-overview.dossier-details.stats.deleted' | translate: { count: deletedFilesCount$ | async } }}
diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/dossier-details-stats/dossier-details-stats.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/dossier-details-stats/dossier-details-stats.component.ts
index 037ea0fa5..d52811feb 100644
--- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/dossier-details-stats/dossier-details-stats.component.ts
+++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/dossier-details-stats/dossier-details-stats.component.ts
@@ -1,10 +1,12 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { AppStateService } from '@state/app-state.service';
-import { Dossier, DossierAttributeWithValue, DossierTemplate, FileStatuses } from '@red/domain';
+import { Dossier, DossierAttributeWithValue, DossierTemplate } from '@red/domain';
import { DossiersDialogService } from '../../../../services/dossiers-dialog.service';
import { DossiersService } from '@services/entity-services/dossiers.service';
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
import { FilesService } from '../../../../../../services/entity-services/files.service';
+import { Observable } from 'rxjs';
+import { distinctUntilChanged, map, switchMap } from 'rxjs/operators';
@Component({
selector: 'redaction-dossier-details-stats',
@@ -13,6 +15,7 @@ import { FilesService } from '../../../../../../services/entity-services/files.s
})
export class DossierDetailsStatsComponent {
attributesExpanded = false;
+ deletedFilesCount$: Observable;
@Input() dossierAttributes: DossierAttributeWithValue[];
@Output() readonly openDossierDictionaryDialog = new EventEmitter();
@@ -20,9 +23,15 @@ export class DossierDetailsStatsComponent {
private readonly _appStateService: AppStateService,
private readonly _dossierTemplatesService: DossierTemplatesService,
private readonly _dialogService: DossiersDialogService,
- readonly filesService: FilesService,
+ private readonly _filesService: FilesService,
readonly dossiersService: DossiersService,
- ) {}
+ ) {
+ this.deletedFilesCount$ = dossiersService.activeDossier$.pipe(
+ switchMap(dossier => _filesService.getDeletedFilesFor(dossier.id)),
+ map(files => files.length),
+ distinctUntilChanged(),
+ );
+ }
dossierTemplate(dossier: Dossier): DossierTemplate {
return this._dossierTemplatesService.find(dossier.dossierTemplateId);
@@ -34,7 +43,4 @@ export class DossierDetailsStatsComponent {
section: section,
});
}
- butonel(dossier: Dossier): void {
- this.filesService.getDeletedFilesFor(dossier.id).subscribe(res => console.log(res.length));
- }
}
diff --git a/apps/red-ui/src/assets/i18n/de.json b/apps/red-ui/src/assets/i18n/de.json
index a337d7f60..2b78704fb 100644
--- a/apps/red-ui/src/assets/i18n/de.json
+++ b/apps/red-ui/src/assets/i18n/de.json
@@ -613,13 +613,13 @@
},
"description": "Beschreibung",
"dictionary": "",
- "deleted": "",
"stats": {
"analysed-pages": "{count} Seiten",
"created-on": "Erstellt am {date}",
"documents": "{count} Dokumente",
"due-date": "Geburtstermin",
- "people": "{count} Benutzer"
+ "people": "{count} Benutzer",
+ "deleted": "{count} "
}
},
"download-file": "Herunterladen",
diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json
index 4add5e0b3..119472d76 100644
--- a/apps/red-ui/src/assets/i18n/en.json
+++ b/apps/red-ui/src/assets/i18n/en.json
@@ -678,13 +678,13 @@
},
"description": "Description",
"dictionary": "Dossier Dictionary",
- "deleted": "deleted files",
"stats": {
"analysed-pages": "{count} {count, plural, one{page} other{pages}}",
"created-on": "Created on {date}",
"documents": "{count} {count, plural, one{document} other{documents}}",
"due-date": "Due {date}",
- "people": "{count} {count, plural, one{user} other{users}}"
+ "people": "{count} {count, plural, one{user} other{users}}",
+ "deleted": "{count} deleted files"
}
},
"download-file": "Download",