diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/bulk-actions/dossier-overview-bulk-actions.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/bulk-actions/dossier-overview-bulk-actions.component.ts index 8f2b6f6eb..aeeb3d51c 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/bulk-actions/dossier-overview-bulk-actions.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/components/bulk-actions/dossier-overview-bulk-actions.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Output } from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; import { AppStateService } from '../../../../../../state/app-state.service'; import { FileManagementControllerService, ReanalysisControllerService } from '@redaction/red-ui-http'; import { PermissionsService } from '../../../../../../services/permissions.service'; @@ -10,6 +10,7 @@ import { CircleButtonTypes, EntitiesService, LoadingService } from '@iqser/commo import { ConfirmationDialogInput } from '../../../../../shared/dialogs/confirmation-dialog/confirmation-dialog.component'; import { TranslateService } from '@ngx-translate/core'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; +import { Dossier } from '@state/model/dossier'; @Component({ selector: 'redaction-dossier-overview-bulk-actions', @@ -19,6 +20,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; export class DossierOverviewBulkActionsComponent { readonly circleButtonTypes = CircleButtonTypes; + @Input() dossier: Dossier; @Output() readonly reload = new EventEmitter(); constructor( @@ -33,19 +35,12 @@ export class DossierOverviewBulkActionsComponent { private readonly _entitiesService: EntitiesService ) {} - get dossier() { - return this._appStateService?.activeDossier; - } - get selectedFiles(): File[] { return this._entitiesService.selected; } get areAllFilesSelected() { - return ( - this._appStateService.activeDossier.files.length !== 0 && - this.selectedFiles.length === this._appStateService.activeDossier.files.length - ); + return this.dossier.files.length !== 0 && this.selectedFiles.length === this.dossier.files.length; } get areSomeFilesSelected() { @@ -134,7 +129,7 @@ export class DossierOverviewBulkActionsComponent { await this._fileManagementControllerService .deleteFiles( this.selectedFiles.map(item => item.fileId), - this._appStateService.activeDossierId + this.dossier.dossierId ) .toPromise(); await this._appStateService.reloadActiveDossierFiles(); @@ -147,20 +142,16 @@ export class DossierOverviewBulkActionsComponent { setToUnderApproval() { // If more than 1 approver - show dialog and ask who to assign - if (this._appStateService.activeDossier.approverIds.length > 1) { + if (this.dossier.approverIds.length > 1) { this._assignFiles('approver', true); } else { - this._performBulkAction( - this._fileActionService.setFilesUnderApproval(this.selectedFiles, this._appStateService.activeDossier.approverIds[0]) - ); + this._performBulkAction(this._fileActionService.setFilesUnderApproval(this.selectedFiles, this.dossier.approverIds[0])); } } async reanalyse() { const fileIds = this.selectedFiles.filter(file => file.analysisRequired).map(file => file.fileId); - this._performBulkAction( - this._reanalysisControllerService.reanalyzeFilesForDossier(fileIds, this._appStateService.activeDossier.id) - ); + this._performBulkAction(this._reanalysisControllerService.reanalyzeFilesForDossier(fileIds, this.dossier.id)); } ocr() { 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 3d7189521..5201a21e5 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 @@ -1,4 +1,4 @@ - +
{{ 'dossier-overview.dossier-details.stats.documents' | translate: { count: dossier.files.length } }} @@ -37,7 +37,7 @@
- {{ dossierTemplate?.name }} + {{ dossierTemplate(dossier).name }}