From 11cd73e3bdd33fbc9c3adcab0bcf357bb7dfc92f Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Tue, 25 Jul 2023 15:30:59 +0300 Subject: [PATCH] DM-337 - Add/Remove annotations dialog in DocuMine --- .../add-annotation-dialog.component.ts | 4 ++++ .../file-preview/file-preview-screen.component.ts | 13 +++---------- .../app/modules/file-preview/utils/dialog-types.ts | 6 ++---- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.ts index c3d9f3d86..6b5a5ac88 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.ts @@ -19,6 +19,8 @@ export class AddAnnotationDialogComponent dictionaries: Dictionary[] = []; form!: UntypedFormGroup; + #applyToAllDossiers: boolean; + readonly #dossier: Dossier; readonly #isRss = this._iqserPermissionsService.has(Roles.getRss); @@ -30,6 +32,7 @@ export class AddAnnotationDialogComponent ) { super(); this.#dossier = _activeDossiersService.find(this.data.dossierId); + this.#applyToAllDossiers = !!this.data.applyToAllDossiers; this.form = this.#getForm(); } @@ -79,5 +82,6 @@ export class AddAnnotationDialogComponent addRedactionRequest.comment = commentValue ? { text: commentValue } : null; addRedactionRequest.section = null; addRedactionRequest.value = this.form.get('selectedText').value; + addRedactionRequest.addToAllDossiers = this.data.isApprover && addRedactionRequest.addToDictionary && this.#applyToAllDossiers; } } diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts index 67ac0b29e..ee712b22e 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts @@ -860,20 +860,13 @@ export class FilePreviewScreenComponent #getRedactTextDialogData(manualRedactionEntryWrapper: ManualRedactionEntryWrapper, file: File): RedactTextData { const dossierTemplate = this._dossierTemplatesService.find(this.state.dossierTemplateId); + const isApprover = this.permissionsService.isApprover(this.state.dossier()); + const applyDictionaryUpdatesToAllDossiersByDefault = dossierTemplate.applyDictionaryUpdatesToAllDossiersByDefault; - const data = { + return { manualRedactionEntryWrapper, dossierId: this.dossierId, file, - }; - if (this.#isDocumine) { - return data; - } - - const isApprover = this.permissionsService.isApprover(this.state.dossier()); - const applyDictionaryUpdatesToAllDossiersByDefault = dossierTemplate.applyDictionaryUpdatesToAllDossiersByDefault; - return { - ...data, applyToAllDossiers: isApprover ? applyDictionaryUpdatesToAllDossiersByDefault : false, isApprover, }; diff --git a/apps/red-ui/src/app/modules/file-preview/utils/dialog-types.ts b/apps/red-ui/src/app/modules/file-preview/utils/dialog-types.ts index 222cbd54a..e4567dbc0 100644 --- a/apps/red-ui/src/app/modules/file-preview/utils/dialog-types.ts +++ b/apps/red-ui/src/app/modules/file-preview/utils/dialog-types.ts @@ -4,17 +4,15 @@ import { AnnotationWrapper } from '@models/file/annotation.wrapper'; import { DetailsRadioOption } from '@iqser/common-ui'; import { RemoveRedactionOption } from './dialog-options'; -export interface AddAnnotationData { +export interface RedactTextData { manualRedactionEntryWrapper: ManualRedactionEntryWrapper; dossierId: string; file: File; -} - -export interface RedactTextData extends AddAnnotationData { applyToAllDossiers?: boolean; isApprover?: boolean; } +export type AddAnnotationData = RedactTextData; export type AddHintData = RedactTextData; export interface RedactTextResult {