diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/add-hint-dialog/add-hint-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/add-hint-dialog/add-hint-dialog.component.html index b51e471cb..3d4c41376 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/add-hint-dialog/add-hint-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/add-hint-dialog/add-hint-dialog.component.html @@ -2,9 +2,9 @@
-
+
- + {{ form.get('selectedText').value }}
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/add-hint-dialog/add-hint-dialog.component.scss b/apps/red-ui/src/app/modules/file-preview/dialogs/add-hint-dialog/add-hint-dialog.component.scss deleted file mode 100644 index 0bc0b2eb8..000000000 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/add-hint-dialog/add-hint-dialog.component.scss +++ /dev/null @@ -1,8 +0,0 @@ -label { - font-weight: bold; - padding-bottom: 8px; -} - -iqser-details-radio { - padding-top: 20px; -} diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/add-hint-dialog/add-hint-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/add-hint-dialog/add-hint-dialog.component.ts index 84fb04590..28c252c09 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/add-hint-dialog/add-hint-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/add-hint-dialog/add-hint-dialog.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { DetailsRadioOption, IconButtonTypes, IqserPermissionsService } from '@iqser/common-ui'; -import { Dictionary, Dossier, IAddRedactionRequest, SuperTypes } from '@red/domain'; +import { Dictionary, Dossier, IAddRedactionRequest } from '@red/domain'; import { FormBuilder, UntypedFormGroup } from '@angular/forms'; import { Roles } from '@users/roles'; import { JustificationsService } from '@services/entity-services/justifications.service'; @@ -14,7 +14,6 @@ import { AddHintData, AddHintResult } from '../../utils/dialog-types'; @Component({ templateUrl: './add-hint-dialog.component.html', - styleUrls: ['./add-hint-dialog.component.scss'], }) export class AddHintDialogComponent extends IqserDialogComponent implements OnInit { readonly roles = Roles; diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.html index e08222606..61dd8955e 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.html @@ -2,9 +2,9 @@
-
+
- + {{ form.get('selectedText').value }}
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.scss b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.scss deleted file mode 100644 index 0bc0b2eb8..000000000 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/add-annotation-dialog/add-annotation-dialog.component.scss +++ /dev/null @@ -1,8 +0,0 @@ -label { - font-weight: bold; - padding-bottom: 8px; -} - -iqser-details-radio { - padding-top: 20px; -} 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 946b3e521..c3d9f3d86 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 @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { IconButtonTypes, IqserPermissionsService } from '@iqser/common-ui'; -import { Dictionary, Dossier, IAddRedactionRequest, SuperTypes } from '@red/domain'; +import { Dictionary, Dossier, IAddRedactionRequest } from '@red/domain'; import { FormBuilder, UntypedFormGroup } from '@angular/forms'; import { Roles } from '@users/roles'; import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service'; @@ -10,7 +10,6 @@ import { AddAnnotationData, AddAnnotationResult } from '../../../utils/dialog-ty @Component({ templateUrl: './add-annotation-dialog.component.html', - styleUrls: ['./add-annotation-dialog.component.scss'], }) export class AddAnnotationDialogComponent extends IqserDialogComponent diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component.scss b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component.ts index 38360893b..155a21324 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component.ts @@ -8,7 +8,6 @@ import { getRemoveRedactionOptions, RemoveAnnotationOption, RemoveAnnotationOpti @Component({ templateUrl: './remove-annotation-dialog.component.html', - styleUrls: ['./remove-annotation-dialog.component.scss'], }) export class RemoveAnnotationDialogComponent extends IqserDialogComponent< RemoveAnnotationDialogComponent, diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.html index 5c4700cd9..833b087ee 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.html @@ -2,9 +2,9 @@
-
+
- + {{ form.get('selectedText').value }}
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.scss b/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.scss deleted file mode 100644 index 0bc0b2eb8..000000000 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.scss +++ /dev/null @@ -1,8 +0,0 @@ -label { - font-weight: bold; - padding-bottom: 8px; -} - -iqser-details-radio { - padding-top: 20px; -} diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.ts index d30c5586a..eb8a98f73 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.ts @@ -16,7 +16,6 @@ import { RedactTextData, RedactTextResult } from '../../utils/dialog-types'; @Component({ templateUrl: './redact-text-dialog.component.html', - styleUrls: ['./redact-text-dialog.component.scss'], }) export class RedactTextDialogComponent extends IqserDialogComponent diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.scss b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts index cc1c0d386..27e37a39d 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts @@ -10,7 +10,6 @@ import { getRemoveRedactionOptions, RemoveRedactionOption } from '../../utils/di @Component({ templateUrl: './remove-redaction-dialog.component.html', - styleUrls: ['./remove-redaction-dialog.component.scss'], }) export class RemoveRedactionDialogComponent extends IqserDialogComponent< RemoveRedactionDialogComponent, diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/resize-annotation-dialog/resize-annotation-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/resize-annotation-dialog/resize-annotation-dialog.component.html deleted file mode 100644 index 280456868..000000000 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/resize-annotation-dialog/resize-annotation-dialog.component.html +++ /dev/null @@ -1,31 +0,0 @@ -
- -
- -
-
- - -
- -
- - -
-
- -
- - -
-
- - - -
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/resize-annotation-dialog/resize-annotation-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/resize-annotation-dialog/resize-annotation-dialog.component.ts deleted file mode 100644 index 4596a3b48..000000000 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/resize-annotation-dialog/resize-annotation-dialog.component.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Component, Inject, OnInit } from '@angular/core'; -import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { BaseDialogComponent } from '@iqser/common-ui'; -import { AnnotationWrapper } from '@models/file/annotation.wrapper'; - -@Component({ - templateUrl: './resize-annotation-dialog.component.html', -}) -export class ResizeAnnotationDialogComponent extends BaseDialogComponent implements OnInit { - constructor( - protected readonly _dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) private readonly _data: { annotation: AnnotationWrapper; text?: string }, - ) { - super(_dialogRef); - } - - get disabled(): boolean { - return !this.valid; - } - - get text(): string { - return this._data.text; - } - - ngOnInit() { - const controlsConfig = { comment: [null] }; - - if (this._data.annotation.isModifyDictionary) { - controlsConfig['updateDictionary'] = [false]; - } - - this.form = this._formBuilder.group(controlsConfig); - this.initialFormValue = this.form.getRawValue(); - } - - save() { - this._dialogRef.close(this.form.getRawValue()); - } -} diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/resize-redaction-dialog/resize-redaction-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/resize-redaction-dialog/resize-redaction-dialog.component.html new file mode 100644 index 000000000..a64e7987e --- /dev/null +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/resize-redaction-dialog/resize-redaction-dialog.component.html @@ -0,0 +1,55 @@ +
+
+
+ +
+
+ + {{ redaction.value }} +
+ +
+ + {{ data.text }} +
+ + + + +
+ + + + + {{ displayedDictionaryLabel }} + + {{ redaction.entity.label }} + + + +
+
+ +
+ + +
+
+ +
+ + +
+
+
+ + +
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/resize-redaction-dialog/resize-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/resize-redaction-dialog/resize-redaction-dialog.component.ts new file mode 100644 index 000000000..5b2eb7ff4 --- /dev/null +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/resize-redaction-dialog/resize-redaction-dialog.component.ts @@ -0,0 +1,89 @@ +import { Component, OnInit } from '@angular/core'; +import { DetailsRadioOption, IconButtonTypes, IqserDialogComponent, IqserPermissionsService } from '@iqser/common-ui'; +import { ResizeRedactionData, ResizeRedactionResult } from '../../utils/dialog-types'; +import { FormBuilder, FormControl, UntypedFormGroup } from '@angular/forms'; +import { AnnotationWrapper } from '@models/file/annotation.wrapper'; +import { getResizeRedactionOptions, ResizeOptions, ResizeRedactionOption } from '../../utils/dialog-options'; +import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service'; +import { Dictionary, Dossier } from '@red/domain'; +import { Roles } from '@users/roles'; +import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service'; + +@Component({ + templateUrl: './resize-redaction-dialog.component.html', +}) +export class ResizeRedactionDialogComponent + extends IqserDialogComponent + implements OnInit +{ + readonly roles = Roles; + readonly iconButtonTypes = IconButtonTypes; + readonly options: DetailsRadioOption[]; + + dictionaries: Dictionary[] = []; + redaction: AnnotationWrapper; + form!: UntypedFormGroup; + + #applyToAllDossiers: boolean; + + readonly #dossier: Dossier; + readonly #isRss = this._iqserPermissionsService.has(Roles.getRss); + + constructor( + private readonly _activeDossiersService: ActiveDossiersService, + private readonly _iqserPermissionsService: IqserPermissionsService, + private readonly _dictionariesMapService: DictionariesMapService, + private readonly _formBuilder: FormBuilder, + ) { + super(); + this.#dossier = _activeDossiersService.find(this.data.dossierId); + this.#applyToAllDossiers = this.data.applyToAllDossiers ?? true; + this.redaction = this.data.redaction; + this.options = getResizeRedactionOptions( + this.redaction, + this.#dossier, + this.#isRss, + this.#applyToAllDossiers, + this.data.isApprover, + ); + this.form = this.#getForm(); + } + + get displayedDictionaryLabel() { + const dictType = this.form.get('dictionary').value; + if (dictType) { + return this.dictionaries.find(d => d.type === dictType)?.label ?? null; + } + return null; + } + + get disabled(): boolean { + return !this.valid; + } + + get text(): string { + return this.data.text; + } + + async ngOnInit() { + this.dictionaries = this._dictionariesMapService.get(this.#dossier.dossierTemplateId); + } + + #getForm(): UntypedFormGroup { + return this._formBuilder.group({ + comment: [null], + dictionary: new FormControl({ value: this.redaction.entity.type, disabled: true }), + option: [this.options[0]], + }); + } + + save(): void { + const formValue = this.form.getRawValue(); + const updateDictionary = formValue.option.value === ResizeOptions.IN_DOSSIER; + + this.dialogRef.close({ + comment: formValue.comment, + updateDictionary, + }); + } +} diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts b/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts index 4a617762c..7ce983bf6 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts @@ -42,7 +42,7 @@ import { HighlightsSeparatorComponent } from './components/highlights-separator/ import { PendingChangesGuard } from '@guards/can-deactivate.guard'; import { ManualAnnotationDialogComponent } from './dialogs/manual-redaction-dialog/manual-annotation-dialog.component'; import { ForceAnnotationDialogComponent } from './dialogs/force-redaction-dialog/force-annotation-dialog.component'; -import { ResizeAnnotationDialogComponent } from './dialogs/resize-annotation-dialog/resize-annotation-dialog.component'; +import { ResizeRedactionDialogComponent } from './dialogs/resize-redaction-dialog/resize-redaction-dialog.component'; import { ChangeLegalBasisDialogComponent } from './dialogs/change-legal-basis-dialog/change-legal-basis-dialog.component'; import { RecategorizeImageDialogComponent } from './dialogs/recategorize-image-dialog/recategorize-image-dialog.component'; import { HighlightActionDialogComponent } from './dialogs/highlight-action-dialog/highlight-action-dialog.component'; @@ -82,7 +82,7 @@ const routes: IqserRoutes = [ const dialogs = [ ManualAnnotationDialogComponent, ForceAnnotationDialogComponent, - ResizeAnnotationDialogComponent, + ResizeRedactionDialogComponent, ChangeLegalBasisDialogComponent, RecategorizeImageDialogComponent, HighlightActionDialogComponent, diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts index e3f608ec9..99563135e 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts @@ -34,15 +34,10 @@ import { IqserDialog } from '@common-ui/dialog/iqser-dialog.service'; import { DossierTemplatesService } from '@services/dossier-templates/dossier-templates.service'; import { isJustOne, List } from '@iqser/common-ui/lib/utils'; import { PermissionsService } from '@services/permissions.service'; -import { - RedactTextData, - RemoveAnnotationResult, - RemoveRedactionData, - RemoveRedactionPermissions, - RemoveRedactionResult, -} from '../utils/dialog-types'; +import { RemoveRedactionData, RemoveRedactionPermissions, RemoveRedactionResult, ResizeRedactionData } from '../utils/dialog-types'; import { RemoveRedactionOptions } from '../utils/dialog-options'; import { RemoveAnnotationDialogComponent } from '../dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component'; +import { ResizeRedactionDialogComponent } from '../dialogs/resize-redaction-dialog/resize-redaction-dialog.component'; @Injectable() export class AnnotationActionsService { @@ -221,11 +216,24 @@ export class AnnotationActionsService { return this.convertRecommendationToAnnotation([recommendation]); } + const dossier = this._state.dossier(); + const isImageText = annotation.isImage ? 'Image' : textAndPositions.text; const text = annotation.rectangle ? annotation.value : isImageText; - const data = { annotation, text }; + const isApprover = this._permissionsService.isApprover(dossier); + const dossierTemplate = this._dossierTemplatesService.find(this._state.dossierTemplateId); - this._dialogService.openDialog('resizeAnnotation', data, (result: { comment: string; updateDictionary: boolean }) => { + const data = { + redaction: annotation, + text, + applyToAllDossiers: isApprover && dossierTemplate.applyDictionaryUpdatesToAllDossiersByDefault, + isApprover, + dossierId: dossier.dossierId, + }; + + const result = await this.#getResizeRedactionDialog(data).result(); + + if (result) { const resizeRequest: IResizeRequest = { annotationId: annotation.id, comment: result.comment, @@ -239,7 +247,7 @@ export class AnnotationActionsService { const { fileId, dossierId } = this._state; const request = this._manualRedactionService.resizeOrSuggestResize([resizeRequest], dossierId, fileId); this.#processObsAndEmit(request); - }); + } } async cancelResize(annotationWrapper: AnnotationWrapper) { @@ -415,4 +423,11 @@ export class AnnotationActionsService { } return this._iqserDialog.openDefault(RemoveRedactionDialogComponent, { data }); } + + #getResizeRedactionDialog(data: ResizeRedactionData) { + // if (this.#isDocumine) { + // return this._iqserDialog.openDefault(RemoveAnnotationDialogComponent, { data }); + // } + return this._iqserDialog.openDefault(ResizeRedactionDialogComponent, { data }); + } } diff --git a/apps/red-ui/src/app/modules/file-preview/services/file-preview-dialog.service.ts b/apps/red-ui/src/app/modules/file-preview/services/file-preview-dialog.service.ts index d25300155..cc65e1cee 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/file-preview-dialog.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/file-preview-dialog.service.ts @@ -6,7 +6,6 @@ import { ManualAnnotationDialogComponent } from '../dialogs/manual-redaction-dia import { ChangeLegalBasisDialogComponent } from '../dialogs/change-legal-basis-dialog/change-legal-basis-dialog.component'; import { RecategorizeImageDialogComponent } from '../dialogs/recategorize-image-dialog/recategorize-image-dialog.component'; import { ConfirmationDialogComponent, DialogConfig, DialogService } from '@iqser/common-ui'; -import { ResizeAnnotationDialogComponent } from '../dialogs/resize-annotation-dialog/resize-annotation-dialog.component'; import { HighlightActionDialogComponent } from '../dialogs/highlight-action-dialog/highlight-action-dialog.component'; import { RssDialogComponent } from '../dialogs/rss-dialog/rss-dialog.component'; @@ -16,7 +15,6 @@ type DialogType = | 'rss' | 'recategorizeImage' | 'changeLegalBasis' - | 'resizeAnnotation' | 'forceAnnotation' | 'manualAnnotation' | 'highlightAction'; @@ -38,9 +36,6 @@ export class FilePreviewDialogService extends DialogService { changeLegalBasis: { component: ChangeLegalBasisDialogComponent, }, - resizeAnnotation: { - component: ResizeAnnotationDialogComponent, - }, forceAnnotation: { component: ForceAnnotationDialogComponent, }, diff --git a/apps/red-ui/src/app/modules/file-preview/utils/dialog-options.ts b/apps/red-ui/src/app/modules/file-preview/utils/dialog-options.ts index 6a4774e68..257e3f9b5 100644 --- a/apps/red-ui/src/app/modules/file-preview/utils/dialog-options.ts +++ b/apps/red-ui/src/app/modules/file-preview/utils/dialog-options.ts @@ -5,6 +5,8 @@ import { Dossier } from '@red/domain'; import { removeRedactionTranslations } from '@translations/remove-redaction-translations'; import { RemoveRedactionData } from './dialog-types'; import { removeAnnotationTranslations } from '@translations/remove-annotation-translations'; +import { resizeRedactionTranslations } from '@translations/resize-redaction-translations'; +import { AnnotationWrapper } from '@models/file/annotation.wrapper'; const PIN_ICON = 'red:push-pin'; const FOLDER_ICON = 'red:folder'; @@ -17,6 +19,9 @@ export const RedactOrHintOptions = { export type RedactOrHintOption = keyof typeof RedactOrHintOptions; +export const ResizeOptions = RedactOrHintOptions; +export type ResizeRedactionOption = RedactOrHintOption; + export const RemoveRedactionOptions = { ONLY_HERE: 'ONLY_HERE', IN_DOSSIER: 'IN_DOSSIER', @@ -40,7 +45,7 @@ export const getRedactOrHintOptions = ( label: translations.onlyHere.label, description: translations.onlyHere.description, icon: PIN_ICON, - value: RedactOrHintOptions.ONLY_HERE, + value: ResizeOptions.ONLY_HERE, }, ]; if (!isRss) { @@ -49,6 +54,42 @@ export const getRedactOrHintOptions = ( description: translations.inDossier.description, descriptionParams: { dossierName: dossier.dossierName }, icon: FOLDER_ICON, + value: ResizeOptions.IN_DOSSIER, + extraOption: { + label: translations.inDossier.extraOptionLabel, + checked: applyToAllDossiers, + hidden: !isApprover, + }, + }); + } + return options; +}; + +export const getResizeRedactionOptions = ( + redaction: AnnotationWrapper, + dossier: Dossier, + isRss: boolean, + applyToAllDossiers: boolean, + isApprover: boolean, +): DetailsRadioOption[] => { + const translations = resizeRedactionTranslations; + const options: DetailsRadioOption[] = [ + { + label: translations.onlyHere.label, + description: translations.onlyHere.description, + icon: PIN_ICON, + value: RedactOrHintOptions.ONLY_HERE, + }, + ]; + if (!isRss) { + const dictBasedType = redaction.isModifyDictionary; + options.push({ + label: translations.inDossier.label, + description: translations.inDossier.description, + descriptionParams: { dossierName: dossier.dossierName }, + disabled: !dictBasedType, + tooltip: !dictBasedType ? translations.inDossier.tooltip : null, + icon: FOLDER_ICON, value: RedactOrHintOptions.IN_DOSSIER, extraOption: { label: translations.inDossier.extraOptionLabel, 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 d252100b5..e9a099295 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 @@ -25,6 +25,19 @@ export interface RedactTextResult { export type AddHintResult = RedactTextResult; export type AddAnnotationResult = RedactTextResult; +export interface ResizeRedactionData { + redaction: AnnotationWrapper; + dossierId: string; + text: string; + applyToAllDossiers?: boolean; + isApprover?: boolean; +} + +export interface ResizeRedactionResult { + comment: string; + updateDictionary: boolean; +} + export interface RemoveRedactionPermissions { canRemoveOnlyHere: boolean; canRemoveFromDictionary: boolean; diff --git a/apps/red-ui/src/app/translations/resize-redaction-translations.ts b/apps/red-ui/src/app/translations/resize-redaction-translations.ts new file mode 100644 index 000000000..efcda8cca --- /dev/null +++ b/apps/red-ui/src/app/translations/resize-redaction-translations.ts @@ -0,0 +1,19 @@ +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; +import { DialogOption } from '@translations/redact-text-translations'; + +interface ResizeDialogOption extends DialogOption { + tooltip?: string; +} + +export const resizeRedactionTranslations: Record<'onlyHere' | 'inDossier', ResizeDialogOption> = { + onlyHere: { + label: _('resize-redaction.dialog.content.options.only-here.label'), + description: _('resize-redaction.dialog.content.options.only-here.description'), + }, + inDossier: { + label: _('resize-redaction.dialog.content.options.in-dossier.label'), + description: _('resize-redaction.dialog.content.options.in-dossier.description'), + extraOptionLabel: _('resize-redaction.dialog.content.options.in-dossier.extraOptionLabel'), + tooltip: _('resize-redaction.dialog.content.options.in-dossier.tooltip'), + }, +} as const; diff --git a/apps/red-ui/src/assets/i18n/redact/de.json b/apps/red-ui/src/assets/i18n/redact/de.json index 51474b85a..059d6adad 100644 --- a/apps/red-ui/src/assets/i18n/redact/de.json +++ b/apps/red-ui/src/assets/i18n/redact/de.json @@ -2103,16 +2103,32 @@ }, "header": "Temporäres Passwort für {userName} festlegen" }, - "resize-annotation-dialog": { - "actions": { - "cancel": "Abbrechen", - "save": "Änderungen speichern" - }, - "content": { - "comment": "Kommentar", - "update-dictionary": "" - }, - "header": "Schwärzung ändern" + "resize-redaction": { + "dialog": { + "actions": { + "cancel": "", + "save": "" + }, + "content": { + "comment": "", + "options": { + "in-dossier": { + "description": "", + "extraOptionLabel": "", + "label": "", + "tooltip": "" + }, + "only-here": { + "description": "", + "label": "" + } + }, + "original-text": "", + "resized-text": "", + "type": "" + }, + "header": "" + } }, "roles": { "inactive": "Inaktiv", diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json index 3e3de999f..fa9aaea0a 100644 --- a/apps/red-ui/src/assets/i18n/redact/en.json +++ b/apps/red-ui/src/assets/i18n/redact/en.json @@ -2103,16 +2103,32 @@ }, "header": "Set Temporary Password for {userName}" }, - "resize-annotation-dialog": { - "actions": { - "cancel": "Cancel", - "save": "Save Changes" - }, - "content": { - "comment": "Comment", - "update-dictionary": "Update dictionary: {text}" - }, - "header": "Resize Redaction" + "resize-redaction": { + "dialog": { + "actions": { + "cancel": "Cancel", + "save": "Save Changes" + }, + "content": { + "comment": "Comment", + "options": { + "in-dossier": { + "description": "Resize in every document in {dossierName}.", + "extraOptionLabel": "Apply to all dossiers", + "label": "Resize in dossier", + "tooltip": "Only available for dictionary-based types" + }, + "only-here": { + "description": "Resize only at this position in this document.", + "label": "Resize only here" + } + }, + "original-text": "Original text:", + "resized-text": "Resized text:", + "type": "Type" + }, + "header": "Resize {type}" + } }, "roles": { "inactive": "Inactive", diff --git a/apps/red-ui/src/assets/i18n/scm/de.json b/apps/red-ui/src/assets/i18n/scm/de.json index 9c4ff5b64..fd3614034 100644 --- a/apps/red-ui/src/assets/i18n/scm/de.json +++ b/apps/red-ui/src/assets/i18n/scm/de.json @@ -2103,16 +2103,32 @@ }, "header": "Temporäres Passwort für {userName} festlegen" }, - "resize-annotation-dialog": { - "actions": { - "cancel": "Abbrechen", - "save": "Änderungen speichern" - }, - "content": { - "comment": "Kommentar", - "update-dictionary": "" - }, - "header": "Schwärzung ändern" + "resize-redaction": { + "dialog": { + "actions": { + "cancel": "", + "save": "" + }, + "content": { + "comment": "", + "options": { + "in-dossier": { + "description": "", + "extraOptionLabel": "", + "label": "", + "tooltip": "" + }, + "only-here": { + "description": "", + "label": "" + } + }, + "original-text": "", + "resized-text": "", + "type": "" + }, + "header": "" + } }, "roles": { "inactive": "Inaktiv", diff --git a/apps/red-ui/src/assets/i18n/scm/en.json b/apps/red-ui/src/assets/i18n/scm/en.json index 9dbe556f9..aca676e22 100644 --- a/apps/red-ui/src/assets/i18n/scm/en.json +++ b/apps/red-ui/src/assets/i18n/scm/en.json @@ -2103,16 +2103,32 @@ }, "header": "Set Temporary Password for {userName}" }, - "resize-annotation-dialog": { - "actions": { - "cancel": "Cancel", - "save": "Save Changes" - }, - "content": { - "comment": "Comment", - "update-dictionary": "Update dictionary: {text}" - }, - "header": "Resize Component" + "resize-redaction": { + "dialog": { + "actions": { + "cancel": "Cancel", + "save": "Save Changes" + }, + "content": { + "comment": "Comment", + "options": { + "in-dossier": { + "description": "Resize in every document in {dossierName}.", + "extraOptionLabel": "Apply to all dossiers", + "label": "Resize in dossier", + "tooltip": "Only available for dictionary-based types" + }, + "only-here": { + "description": "Resize only at this position in this document.", + "label": "Resize only here" + } + }, + "original-text": "Original text:", + "resized-text": "Resized text:", + "type": "Type" + }, + "header": "Resize {type}" + } }, "roles": { "inactive": "Inactive", diff --git a/libs/common-ui b/libs/common-ui index 5aa064ac6..b368fa6fe 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 5aa064ac65e631f0871f2833ae91007a7c9b7a55 +Subproject commit b368fa6fe89b1cf65eb76ce15868bccf1a51ff67