diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html index ec2c123f2..3c23f1f72 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html @@ -121,6 +121,8 @@ />
+ + diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts index a888e66e4..0c9c632c5 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts @@ -10,6 +10,8 @@ import { getEditRedactionOptions, RedactOrHintOption } from '../../utils/dialog- import { EditRedactionData, EditRedactResult } from '../../utils/dialog-types'; import { LegalBasisOption } from '../manual-redaction-dialog/manual-annotation-dialog.component'; import { editRedactionLabelsTranslations } from '@translations/redact-text-translations'; +import { Roles } from '@users/roles'; +import { DialogHelpModeKeys } from '../../utils/constants'; interface TypeSelectOptions { type: string; @@ -34,10 +36,11 @@ export class EditRedactionDialogComponent readonly isImage = this.annotations.reduce((acc, next) => acc && next.isImage, true); readonly redactedTexts = !this.isImage ? this.annotations.map(annotation => annotation.value).filter(value => !!value) : null; readonly isManualRedaction = this.annotations.every(annotation => annotation.type === SuperTypes.ManualRedaction); - readonly isHint = this.annotations.every(annotation => annotation.HINT); + readonly isHint = this.annotations.every(annotation => annotation.HINT || annotation.IMAGE_HINT); readonly isRedacted = this.annotations.every(annotation => annotation.isRedacted); readonly isImported: boolean = this.annotations.every(annotation => annotation.imported); readonly allRectangles = this.annotations.reduce((acc, a) => acc && a.AREA, true); + protected readonly roles = Roles; options: DetailsRadioOption[] | undefined; legalOptions: LegalBasisOption[] = []; @@ -52,6 +55,7 @@ export class EditRedactionDialogComponent private readonly _dictionaryService: DictionaryService, ) { super(); + console.log(this.annotations); } get displayedDictionaryLabel() { @@ -111,6 +115,16 @@ export class EditRedactionDialogComponent return editRedactionLabelsTranslations[this.label]; } + get helpButtonKey() { + if (this.isHint) { + return DialogHelpModeKeys.HINT_EDIT + } + if (this.someSkipped) { + return DialogHelpModeKeys.SKIPPED_EDIT + } + return DialogHelpModeKeys.REDACTION_EDIT; + } + async ngOnInit() { this.#setTypes(); const data = await firstValueFrom(this._justificationsService.loadAll(this.#dossier.dossierTemplateId)); diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/force-redaction-dialog/force-annotation-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/force-redaction-dialog/force-annotation-dialog.component.html index 5fc13333b..e7225bb7b 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/force-redaction-dialog/force-annotation-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/force-redaction-dialog/force-annotation-dialog.component.html @@ -38,6 +38,8 @@ [type]="iconButtonTypes.primary" > + + diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/force-redaction-dialog/force-annotation-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/force-redaction-dialog/force-annotation-dialog.component.ts index b7b2d0f7e..236caada2 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/force-redaction-dialog/force-annotation-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/force-redaction-dialog/force-annotation-dialog.component.ts @@ -6,6 +6,7 @@ import { JustificationsService } from '@services/entity-services/justifications. import { Dossier, ILegalBasisChangeRequest } from '@red/domain'; import { firstValueFrom } from 'rxjs'; import { AnnotationWrapper } from '@models/file/annotation.wrapper'; +import { Roles } from '@users/roles'; export interface LegalBasisOption { label?: string; @@ -22,6 +23,7 @@ const DOCUMINE_LEGAL_BASIS = 'n-a.'; }) export class ForceAnnotationDialogComponent extends BaseDialogComponent implements OnInit { readonly isDocumine = getConfig().IS_DOCUMINE; + protected readonly roles = Roles; legalOptions: LegalBasisOption[] = []; constructor( diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.html index c5356c9c0..922ac7054 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.html @@ -70,6 +70,8 @@
+ + 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 6c5746a77..d34385035 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 @@ -5,6 +5,8 @@ import { DetailsRadioOption, IconButtonTypes, IqserDialogComponent } from '@iqse import { tap } from 'rxjs/operators'; import { getRemoveRedactionOptions, RemoveAnnotationOptions, RemoveRedactionOption } from '../../utils/dialog-options'; import { RemoveRedactionData, RemoveRedactionResult } from '../../utils/dialog-types'; +import { Roles } from '@users/roles'; +import { DialogHelpModeKeys } from '../../utils/constants'; @Component({ templateUrl: './remove-redaction-dialog.component.html', @@ -18,15 +20,18 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent< #applyToAllDossiers: boolean; readonly iconButtonTypes = IconButtonTypes; readonly options: DetailsRadioOption[]; - readonly recommendation; + readonly recommendation: boolean; readonly hint: boolean; + readonly skipped: boolean; readonly redactedTexts: string[]; + protected readonly roles = Roles; form!: UntypedFormGroup; constructor(private readonly _formBuilder: FormBuilder) { super(); this.recommendation = this.data.redactions[0].isRecommendation; this.hint = this.data.redactions[0].HINT; + this.skipped = this.data.redactions.some(annotation => annotation.isSkipped); this.options = getRemoveRedactionOptions(this.data); this.redactedTexts = this.data.redactions.map(annotation => annotation.value); this.form = this.#getForm(); @@ -48,7 +53,20 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent< } get isFalsePositive(): boolean { - return this.form.get('option').value.value === RemoveAnnotationOptions.FALSE_POSITIVE; + return this.form.get('option').value.value === RemoveAnnotationOptions['FALSE' + '_POSITIVE']; + } + + get helpButtonKey() { + if (this.hint) { + return DialogHelpModeKeys.HINT_REMOVE + } + if (this.recommendation) { + return DialogHelpModeKeys.RECOMMENDATION_REMOVE + } + if (this.skipped) { + return DialogHelpModeKeys.SKIPPED_REMOVE + } + return DialogHelpModeKeys.REDACTION_REMOVE; } save(): void { diff --git a/apps/red-ui/src/app/modules/file-preview/utils/constants.ts b/apps/red-ui/src/app/modules/file-preview/utils/constants.ts index f6093ed2f..ad73a214b 100644 --- a/apps/red-ui/src/app/modules/file-preview/utils/constants.ts +++ b/apps/red-ui/src/app/modules/file-preview/utils/constants.ts @@ -19,6 +19,16 @@ export const ActionsHelpModeKeys = { 'hint-image': 'hint', } as const; +export const DialogHelpModeKeys = { + REDACTION_EDIT: 'redaction_edit', + REDACTION_REMOVE: 'redaction_remove', + SKIPPED_EDIT: 'skipped_edit', + SKIPPED_REMOVE: 'skipped_remove', + RECOMMENDATION_REMOVE: 'recommendation_remove', + HINT_EDIT: 'hint_edit', + HINT_REMOVE: 'hint_remove', +} as const; + export const ALL_HOTKEYS: List = ['Escape', 'F', 'f', 'ArrowUp', 'ArrowDown', 'H', 'h'] as const; export const HeaderElements = {