RED-6774 - split AddHint and RedactText actions in two separate dialogs
This commit is contained in:
parent
2cf40dfdbf
commit
f49c9ea485
@ -75,7 +75,7 @@ export class AnnotationActionsComponent implements OnChanges {
|
||||
}
|
||||
|
||||
removeOrSuggestRemoveRedaction() {
|
||||
this.annotationActionsService.removeOrSuggestRemoveRedaction(this.annotations[0], this.annotationPermissions);
|
||||
this.annotationActionsService.removeRedaction(this.annotations[0], this.annotationPermissions);
|
||||
}
|
||||
|
||||
acceptRecommendation() {
|
||||
|
||||
@ -0,0 +1,65 @@
|
||||
<section class="dialog">
|
||||
<form (submit)="save()" [formGroup]="form">
|
||||
<div [translate]="'add-hint.dialog.title'" class="dialog-header heading-l"></div>
|
||||
|
||||
<div class="dialog-content">
|
||||
<div class="iqser-input-group w-450">
|
||||
<label [translate]="'add-hint.dialog.content.selected-text'"></label>
|
||||
{{ form.get('selectedText').value }}
|
||||
</div>
|
||||
|
||||
<iqser-details-radio
|
||||
[options]="options"
|
||||
(extraOptionChanged)="extraOptionChanged($event)"
|
||||
formControlName="option"
|
||||
></iqser-details-radio>
|
||||
|
||||
<ng-container *deny="roles.getRss">
|
||||
<div class="iqser-input-group required w-450">
|
||||
<label [translate]="'add-hint.dialog.content.type'"></label>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-select formControlName="dictionary" [placeholder]="'add-hint.dialog.content.type-placeholder' | translate">
|
||||
<mat-select-trigger>{{ displayedDictionaryLabel }}</mat-select-trigger>
|
||||
<mat-option
|
||||
*ngFor="let dictionary of dictionaries"
|
||||
[matTooltip]="dictionary.description"
|
||||
[value]="dictionary.type"
|
||||
(click)="typeChanged()"
|
||||
matTooltipPosition="after"
|
||||
>
|
||||
<span> {{ dictionary.label }} </span>
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<div *ngIf="!dictionaryRequest" class="iqser-input-group w-450">
|
||||
<label [translate]="'add-hint.dialog.content.comment'"></label>
|
||||
<textarea
|
||||
formControlName="comment"
|
||||
iqserHasScrollbar
|
||||
name="comment"
|
||||
rows="4"
|
||||
type="text"
|
||||
[placeholder]="'add-hint.dialog.content.comment-placeholder' | translate"
|
||||
></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dialog-actions">
|
||||
<iqser-icon-button
|
||||
[label]="'add-hint.dialog.actions.save' | translate"
|
||||
[submit]="true"
|
||||
[type]="iconButtonTypes.primary"
|
||||
[disabled]="disabled"
|
||||
>
|
||||
</iqser-icon-button>
|
||||
|
||||
<div class="all-caps-label cancel" mat-dialog-close [translate]="'add-hint.dialog.actions.cancel'"></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<iqser-circle-button (action)="close()" class="dialog-close" icon="iqser:close"></iqser-circle-button>
|
||||
</section>
|
||||
@ -0,0 +1,8 @@
|
||||
label {
|
||||
font-weight: bold;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
iqser-details-radio {
|
||||
padding-top: 20px;
|
||||
}
|
||||
@ -0,0 +1,163 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { DetailsRadioOption, IconButtonTypes, IqserPermissionsService } from '@iqser/common-ui';
|
||||
import { Dictionary, Dossier, IAddRedactionRequest, SuperTypes } from '@red/domain';
|
||||
import { FormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { Roles } from '@users/roles';
|
||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { IqserDialogComponent } from '@common-ui/dialog/iqser-dialog-component.directive';
|
||||
import { RedactOrHintData, RedactOrHintResult } from '../../utils/dialog-types';
|
||||
import { getRedactOrHintOptions, RedactOrHintOption, RedactOrHintOptions } from '../../utils/dialog-options';
|
||||
|
||||
@Component({
|
||||
templateUrl: './add-hint-dialog.component.html',
|
||||
styleUrls: ['./add-hint-dialog.component.scss'],
|
||||
})
|
||||
export class AddHintDialogComponent
|
||||
extends IqserDialogComponent<AddHintDialogComponent, RedactOrHintData, RedactOrHintResult>
|
||||
implements OnInit
|
||||
{
|
||||
readonly roles = Roles;
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly options: DetailsRadioOption<RedactOrHintOption>[];
|
||||
dictionaryRequest = false;
|
||||
dictionaries: Dictionary[] = [];
|
||||
form!: UntypedFormGroup;
|
||||
|
||||
#manualRedactionTypeExists = true;
|
||||
#applyToAllDossiers: boolean;
|
||||
|
||||
readonly #dossier: Dossier;
|
||||
readonly #isRss = this._iqserPermissionsService.has(Roles.getRss);
|
||||
|
||||
constructor(
|
||||
private readonly _justificationsService: JustificationsService,
|
||||
private readonly _activeDossiersService: ActiveDossiersService,
|
||||
private readonly _dictionaryService: DictionaryService,
|
||||
private readonly _iqserPermissionsService: IqserPermissionsService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
) {
|
||||
super();
|
||||
this.#dossier = _activeDossiersService.find(this.data.dossierId);
|
||||
this.#applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
||||
this.#manualRedactionTypeExists = this._dictionaryService.hasManualType(this.#dossier.dossierTemplateId);
|
||||
this.options = getRedactOrHintOptions(this.#dossier, this.#isRss, true, this.#applyToAllDossiers, this.data.isApprover);
|
||||
|
||||
this.form = this.#getForm();
|
||||
|
||||
this.form
|
||||
.get('option')
|
||||
.valueChanges.pipe(
|
||||
tap((option: DetailsRadioOption<RedactOrHintOption>) => {
|
||||
this.dictionaryRequest = option.value === RedactOrHintOptions.IN_DOSSIER;
|
||||
this.#setDictionaries();
|
||||
this.#resetValues();
|
||||
}),
|
||||
takeUntilDestroyed(),
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
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() {
|
||||
if (this.dictionaryRequest || this.#isRss) {
|
||||
return !this.form.get('dictionary').value;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
async ngOnInit(): Promise<void> {
|
||||
this.#setDictionaries();
|
||||
this.#resetValues();
|
||||
}
|
||||
|
||||
extraOptionChanged(option: DetailsRadioOption<RedactOrHintOption>): void {
|
||||
this.#applyToAllDossiers = option.extraOption.checked;
|
||||
|
||||
this.#setDictionaries();
|
||||
if (this.#applyToAllDossiers && this.form.get('dictionary').value) {
|
||||
const selectedDictionaryLabel = this.form.get('dictionary').value;
|
||||
const selectedDictionary = this.dictionaries.find(d => d.type === selectedDictionaryLabel);
|
||||
if (!selectedDictionary) {
|
||||
this.form.get('dictionary').setValue(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typeChanged() {
|
||||
if (!this.#applyToAllDossiers) {
|
||||
const selectedDictionaryType = this.form.get('dictionary').value;
|
||||
const selectedDictionary = this.dictionaries.find(d => d.type === selectedDictionaryType);
|
||||
this.options[1].extraOption.disabled = selectedDictionary.dossierDictionaryOnly;
|
||||
}
|
||||
}
|
||||
|
||||
save(): void {
|
||||
this.#enhanceManualRedaction(this.data.manualRedactionEntryWrapper.manualRedactionEntry);
|
||||
const redaction = this.data.manualRedactionEntryWrapper.manualRedactionEntry;
|
||||
this.dialogRef.close({
|
||||
redaction,
|
||||
dictionary: this.dictionaries.find(d => d.type === this.form.get('dictionary').value),
|
||||
});
|
||||
}
|
||||
|
||||
#setDictionaries() {
|
||||
this.dictionaries = this._dictionaryService.getAddHintDictionaries(
|
||||
this.#dossier.dossierTemplateId,
|
||||
!this.#applyToAllDossiers,
|
||||
this.dictionaryRequest,
|
||||
);
|
||||
}
|
||||
|
||||
#getForm(): UntypedFormGroup {
|
||||
return this._formBuilder.group({
|
||||
selectedText: this.data?.manualRedactionEntryWrapper?.manualRedactionEntry?.value,
|
||||
reason: [null],
|
||||
comment: [null],
|
||||
dictionary: [this.#manualRedactionTypeExists ? SuperTypes.ManualRedaction : null],
|
||||
classification: ['non-readable content'],
|
||||
section: [null],
|
||||
option: [this.options[0]],
|
||||
});
|
||||
}
|
||||
|
||||
#enhanceManualRedaction(addRedactionRequest: IAddRedactionRequest) {
|
||||
addRedactionRequest.reason = 'Dictionary Request';
|
||||
addRedactionRequest.type = this.form.get('dictionary').value;
|
||||
addRedactionRequest.section = this.form.get('section').value;
|
||||
addRedactionRequest.value = this.form.get('selectedText').value;
|
||||
|
||||
const selectedType = this.dictionaries.find(d => d.type === addRedactionRequest.type);
|
||||
if (selectedType) {
|
||||
addRedactionRequest.addToDictionary = selectedType.hasDictionary;
|
||||
} else {
|
||||
addRedactionRequest.addToDictionary = this.dictionaryRequest && addRedactionRequest.type !== 'dossier_redaction';
|
||||
}
|
||||
|
||||
const commentValue = this.form.get('comment').value;
|
||||
addRedactionRequest.comment = commentValue ? { text: commentValue } : null;
|
||||
addRedactionRequest.addToAllDossiers = this.data.isApprover && this.dictionaryRequest && this.#applyToAllDossiers;
|
||||
}
|
||||
|
||||
#resetValues() {
|
||||
this.#applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
||||
if (!this.#isRss) {
|
||||
this.options[1].extraOption.checked = this.#applyToAllDossiers;
|
||||
}
|
||||
if (this.dictionaryRequest) {
|
||||
this.form.get('dictionary').setValue(null);
|
||||
return;
|
||||
}
|
||||
this.form.get('dictionary').setValue(this.#manualRedactionTypeExists ? SuperTypes.ManualRedaction : null);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
<section class="dialog">
|
||||
<form (submit)="save()" [formGroup]="form">
|
||||
<div [translate]="!hint ? 'redact-text.dialog.title' : 'redact-text.dialog.hint-title'" class="dialog-header heading-l"></div>
|
||||
<div [translate]="'redact-text.dialog.title'" class="dialog-header heading-l"></div>
|
||||
|
||||
<div class="dialog-content">
|
||||
<div class="iqser-input-group w-450">
|
||||
@ -14,7 +14,7 @@
|
||||
formControlName="option"
|
||||
></iqser-details-radio>
|
||||
|
||||
<ng-container *deny="roles.getRss; if: !dictionaryRequest && type !== 'HINT'">
|
||||
<ng-container *deny="roles.getRss; if: !dictionaryRequest">
|
||||
<div class="iqser-input-group required w-450">
|
||||
<label [translate]="'redact-text.dialog.content.reason'"></label>
|
||||
<mat-form-field>
|
||||
@ -41,7 +41,7 @@
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *deny="roles.getRss; if: dictionaryRequest || type === 'HINT'">
|
||||
<ng-container *deny="roles.getRss; if: dictionaryRequest">
|
||||
<div class="iqser-input-group required w-450">
|
||||
<label [translate]="'redact-text.dialog.content.type'"></label>
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { DetailsRadioOption, IconButtonTypes, IqserPermissionsService } from '@iqser/common-ui';
|
||||
import { Dictionary, Dossier, File, IAddRedactionRequest, IManualRedactionEntry, SuperTypes } from '@red/domain';
|
||||
import { Dictionary, Dossier, IAddRedactionRequest, SuperTypes } from '@red/domain';
|
||||
import { FormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { Roles } from '@users/roles';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
@ -8,44 +8,23 @@ import { JustificationsService } from '@services/entity-services/justifications.
|
||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||
import { LegalBasisOption } from '../manual-redaction-dialog/manual-annotation-dialog.component';
|
||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||
|
||||
import { ManualRedactionEntryType, ManualRedactionEntryWrapper } from '@models/file/manual-redaction-entry.wrapper';
|
||||
import { redactTextTranslations } from '@translations/redact-text-translations';
|
||||
import { RedactTextOption, RedactTextOptions } from './redact-text-options';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { IqserDialogComponent } from '../../../../../../../../libs/common-ui/src/lib/dialog/iqser-dialog-component.directive';
|
||||
|
||||
const PIN_ICON = 'red:push-pin';
|
||||
const FOLDER_ICON = 'red:folder';
|
||||
|
||||
interface RedactTextData {
|
||||
manualRedactionEntryWrapper: ManualRedactionEntryWrapper;
|
||||
dossierId: string;
|
||||
file: File;
|
||||
applyToAllDossiers: boolean;
|
||||
isApprover: boolean;
|
||||
hint: boolean;
|
||||
}
|
||||
|
||||
interface DialogResult {
|
||||
redaction: IManualRedactionEntry;
|
||||
dictionary: Dictionary;
|
||||
applyToAllDossiers: boolean | null;
|
||||
}
|
||||
import { IqserDialogComponent } from '@common-ui/dialog/iqser-dialog-component.directive';
|
||||
import { getRedactOrHintOptions, RedactOrHintOption, RedactOrHintOptions } from '../../utils/dialog-options';
|
||||
import { RedactOrHintData, RedactOrHintResult } from '../../utils/dialog-types';
|
||||
|
||||
@Component({
|
||||
templateUrl: './redact-text-dialog.component.html',
|
||||
styleUrls: ['./redact-text-dialog.component.scss'],
|
||||
})
|
||||
export class RedactTextDialogComponent
|
||||
extends IqserDialogComponent<RedactTextDialogComponent, RedactTextData, DialogResult>
|
||||
extends IqserDialogComponent<RedactTextDialogComponent, RedactOrHintData, RedactOrHintResult>
|
||||
implements OnInit
|
||||
{
|
||||
readonly roles = Roles;
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly options: DetailsRadioOption<RedactTextOption>[];
|
||||
readonly type: ManualRedactionEntryType;
|
||||
readonly options: DetailsRadioOption<RedactOrHintOption>[];
|
||||
dictionaryRequest = false;
|
||||
legalOptions: LegalBasisOption[] = [];
|
||||
dictionaries: Dictionary[] = [];
|
||||
@ -54,10 +33,8 @@ export class RedactTextDialogComponent
|
||||
#manualRedactionTypeExists = true;
|
||||
#applyToAllDossiers: boolean;
|
||||
|
||||
readonly #translations = redactTextTranslations;
|
||||
readonly #dossier: Dossier;
|
||||
readonly #isRss = this._iqserPermissionsService.has(Roles.getRss);
|
||||
readonly hint: boolean;
|
||||
|
||||
constructor(
|
||||
private readonly _justificationsService: JustificationsService,
|
||||
@ -68,19 +45,17 @@ export class RedactTextDialogComponent
|
||||
) {
|
||||
super();
|
||||
this.#dossier = _activeDossiersService.find(this.data.dossierId);
|
||||
this.type = this.data.manualRedactionEntryWrapper.type;
|
||||
this.hint = this.data.hint;
|
||||
this.#applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
||||
this.#manualRedactionTypeExists = this._dictionaryService.hasManualType(this.#dossier.dossierTemplateId);
|
||||
this.options = this.#options();
|
||||
this.options = getRedactOrHintOptions(this.#dossier, this.#isRss, false, this.#applyToAllDossiers, this.data.isApprover);
|
||||
|
||||
this.form = this.#getForm();
|
||||
|
||||
this.form
|
||||
.get('option')
|
||||
.valueChanges.pipe(
|
||||
tap((option: DetailsRadioOption<RedactTextOption>) => {
|
||||
this.dictionaryRequest = option.value === RedactTextOptions.IN_DOSSIER;
|
||||
tap((option: DetailsRadioOption<RedactOrHintOption>) => {
|
||||
this.dictionaryRequest = option.value === RedactOrHintOptions.IN_DOSSIER;
|
||||
this.#setDictionaries();
|
||||
this.#resetValues();
|
||||
}),
|
||||
@ -98,7 +73,7 @@ export class RedactTextDialogComponent
|
||||
}
|
||||
|
||||
get disabled() {
|
||||
if (this.dictionaryRequest || this.hint || this.#isRss) {
|
||||
if (this.dictionaryRequest || this.#isRss) {
|
||||
return !this.form.get('dictionary').value;
|
||||
}
|
||||
return !this.form.get('reason').value;
|
||||
@ -115,11 +90,10 @@ export class RedactTextDialogComponent
|
||||
this.legalOptions.sort((a, b) => a.label.localeCompare(b.label));
|
||||
|
||||
this.#selectReason();
|
||||
this.#formatSelectedTextValue();
|
||||
this.#resetValues();
|
||||
}
|
||||
|
||||
extraOptionChanged(option: DetailsRadioOption<RedactTextOption>): void {
|
||||
extraOptionChanged(option: DetailsRadioOption<RedactOrHintOption>): void {
|
||||
this.#applyToAllDossiers = option.extraOption.checked;
|
||||
|
||||
this.#setDictionaries();
|
||||
@ -150,9 +124,8 @@ export class RedactTextDialogComponent
|
||||
}
|
||||
|
||||
#setDictionaries() {
|
||||
this.dictionaries = this._dictionaryService.getPossibleDictionaries(
|
||||
this.dictionaries = this._dictionaryService.getRedactTextDictionaries(
|
||||
this.#dossier.dossierTemplateId,
|
||||
this.hint,
|
||||
!this.#applyToAllDossiers,
|
||||
this.dictionaryRequest,
|
||||
);
|
||||
@ -164,21 +137,11 @@ export class RedactTextDialogComponent
|
||||
reason: [null],
|
||||
comment: [null],
|
||||
dictionary: [this.#manualRedactionTypeExists ? SuperTypes.ManualRedaction : null],
|
||||
classification: ['non-readable content'],
|
||||
section: [null],
|
||||
option: [this.options[0]],
|
||||
});
|
||||
}
|
||||
|
||||
#formatSelectedTextValue(): void {
|
||||
this.data.manualRedactionEntryWrapper.manualRedactionEntry.value =
|
||||
this.data.manualRedactionEntryWrapper.manualRedactionEntry.value.replace(
|
||||
// eslint-disable-next-line no-control-regex,max-len
|
||||
/([^\s\d-]{2,})[-\u00AD]\u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029]/gi,
|
||||
'$1',
|
||||
);
|
||||
}
|
||||
|
||||
#selectReason() {
|
||||
if (this.legalOptions.length === 1) {
|
||||
this.form.get('reason').setValue(this.legalOptions[0]);
|
||||
@ -186,8 +149,11 @@ export class RedactTextDialogComponent
|
||||
}
|
||||
|
||||
#enhanceManualRedaction(addRedactionRequest: IAddRedactionRequest) {
|
||||
const legalOption: LegalBasisOption = this.form.get('reason').value;
|
||||
addRedactionRequest.type = this.form.get('dictionary').value;
|
||||
addRedactionRequest.section = this.form.get('section').value;
|
||||
addRedactionRequest.value = this.form.get('selectedText').value;
|
||||
|
||||
const legalOption: LegalBasisOption = this.form.get('reason').value;
|
||||
if (legalOption) {
|
||||
addRedactionRequest.reason = legalOption.description;
|
||||
addRedactionRequest.legalBasis = legalOption.legalBasis;
|
||||
@ -206,45 +172,15 @@ export class RedactTextDialogComponent
|
||||
}
|
||||
const commentValue = this.form.get('comment').value;
|
||||
addRedactionRequest.comment = commentValue ? { text: commentValue } : null;
|
||||
addRedactionRequest.section = this.form.get('section').value;
|
||||
addRedactionRequest.value = addRedactionRequest.rectangle
|
||||
? this.form.get('classification').value
|
||||
: this.form.get('selectedText').value;
|
||||
addRedactionRequest.addToAllDossiers = this.data.isApprover && this.dictionaryRequest && this.#applyToAllDossiers;
|
||||
}
|
||||
|
||||
#options() {
|
||||
const options: DetailsRadioOption<RedactTextOption>[] = [
|
||||
{
|
||||
label: this.#translations[this.type].onlyHere.label,
|
||||
description: this.#translations[this.type].onlyHere.description,
|
||||
icon: PIN_ICON,
|
||||
value: RedactTextOptions.ONLY_HERE,
|
||||
},
|
||||
];
|
||||
if (!this.#isRss) {
|
||||
options.push({
|
||||
label: this.#translations[this.type].inDossier.label,
|
||||
description: this.#translations[this.type].inDossier.description,
|
||||
descriptionParams: { dossierName: this.#dossier.dossierName },
|
||||
icon: FOLDER_ICON,
|
||||
value: RedactTextOptions.IN_DOSSIER,
|
||||
extraOption: {
|
||||
label: this.#translations[this.type].inDossier.extraOptionLabel,
|
||||
checked: this.data.applyToAllDossiers ?? true,
|
||||
hidden: !this.data.isApprover,
|
||||
},
|
||||
});
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
#resetValues() {
|
||||
this.#applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
||||
if (!this.#isRss) {
|
||||
this.options[1].extraOption.checked = this.#applyToAllDossiers;
|
||||
}
|
||||
if (this.dictionaryRequest || this.hint) {
|
||||
if (this.dictionaryRequest) {
|
||||
this.form.get('reason').setValue(null);
|
||||
this.form.get('dictionary').setValue(null);
|
||||
return;
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
export const RedactTextOptions = {
|
||||
ONLY_HERE: 'ONLY_HERE',
|
||||
IN_DOSSIER: 'IN_DOSSIER',
|
||||
} as const;
|
||||
|
||||
export type RedactTextOption = keyof typeof RedactTextOptions;
|
||||
@ -1,43 +1,15 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { DetailsRadioOption, IconButtonTypes } from '@iqser/common-ui';
|
||||
import { RemoveRedactionOption, RemoveRedactionOptions } from './remove-redaction-options';
|
||||
import { FormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { removeRedactionTranslations } from '@translations/remove-redaction-translations';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { Dossier } from '@red/domain';
|
||||
import { IqserDialogComponent } from '../../../../../../../../libs/common-ui/src/lib/dialog/iqser-dialog-component.directive';
|
||||
import { IqserDialogComponent } from '@common-ui/dialog/iqser-dialog-component.directive';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { RedactTextOption } from '../redact-text-dialog/redact-text-options';
|
||||
|
||||
const PIN_ICON = 'red:push-pin';
|
||||
const FOLDER_ICON = 'red:folder';
|
||||
const REMOVE_FROM_DICT_ICON = 'red:remove-from-dict';
|
||||
|
||||
export interface RemoveRedactionPermissions {
|
||||
canRemoveOnlyHere: boolean;
|
||||
canRemoveFromDictionary: boolean;
|
||||
canMarkAsFalsePositive: boolean;
|
||||
}
|
||||
|
||||
export interface RemoveRedactionData {
|
||||
redaction: AnnotationWrapper;
|
||||
dossier: Dossier;
|
||||
falsePositiveContext: string;
|
||||
permissions: RemoveRedactionPermissions;
|
||||
applyToAllDossiers: boolean;
|
||||
isApprover: boolean;
|
||||
}
|
||||
|
||||
export interface RemoveRedactionResult {
|
||||
comment: string;
|
||||
option: DetailsRadioOption<RemoveRedactionOption>;
|
||||
applyToAllDossiers: boolean | null;
|
||||
}
|
||||
import { RemoveRedactionData, RemoveRedactionResult } from '../../utils/dialog-types';
|
||||
import { getRemoveRedactionOptions, RemoveRedactionOption } from '../../utils/dialog-options';
|
||||
|
||||
@Component({
|
||||
templateUrl: './remove-redaction-dialog.html',
|
||||
templateUrl: './remove-redaction-dialog.component.html',
|
||||
styleUrls: ['./remove-redaction-dialog.component.scss'],
|
||||
})
|
||||
export class RemoveRedactionDialogComponent extends IqserDialogComponent<
|
||||
@ -51,17 +23,12 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
|
||||
form!: UntypedFormGroup;
|
||||
hint: boolean;
|
||||
|
||||
readonly #redaction: AnnotationWrapper;
|
||||
readonly #permissions: RemoveRedactionPermissions;
|
||||
readonly #translations = removeRedactionTranslations;
|
||||
#applyToAllDossiers: boolean;
|
||||
|
||||
constructor(private readonly _formBuilder: FormBuilder, private readonly _permissionsService: PermissionsService) {
|
||||
super();
|
||||
this.#redaction = this.data.redaction;
|
||||
this.hint = this.#redaction.hint;
|
||||
this.#permissions = this.data.permissions;
|
||||
this.options = this.#options();
|
||||
this.hint = this.data.redaction.hint;
|
||||
this.options = getRemoveRedactionOptions(this.data);
|
||||
this.form = this.#getForm();
|
||||
this.#applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
||||
|
||||
@ -90,46 +57,4 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
|
||||
option: [this.options[0]],
|
||||
});
|
||||
}
|
||||
|
||||
#options() {
|
||||
const options: DetailsRadioOption<RemoveRedactionOption>[] = [];
|
||||
if (this.#permissions.canRemoveOnlyHere) {
|
||||
options.push({
|
||||
label: this.#translations.ONLY_HERE.label,
|
||||
description: this.#translations.ONLY_HERE.description,
|
||||
descriptionParams: { type: this.hint ? 'hint' : 'redact', value: this.#redaction.value },
|
||||
icon: PIN_ICON,
|
||||
value: RemoveRedactionOptions.ONLY_HERE,
|
||||
});
|
||||
}
|
||||
if (this.#permissions.canRemoveFromDictionary) {
|
||||
options.push({
|
||||
label: this.#translations.IN_DOSSIER.label,
|
||||
description: this.#translations.IN_DOSSIER.description,
|
||||
descriptionParams: { type: this.hint ? 'hint' : 'redact', value: this.#redaction.value },
|
||||
icon: FOLDER_ICON,
|
||||
value: RemoveRedactionOptions.IN_DOSSIER,
|
||||
extraOption: {
|
||||
label: this.#translations.IN_DOSSIER.extraOptionLabel,
|
||||
checked: this.data.applyToAllDossiers ?? true,
|
||||
hidden: !this.data.isApprover,
|
||||
},
|
||||
});
|
||||
}
|
||||
if (this.#permissions.canMarkAsFalsePositive) {
|
||||
options.push({
|
||||
label: this.#translations.FALSE_POSITIVE.label,
|
||||
description: this.#translations.FALSE_POSITIVE.description,
|
||||
descriptionParams: { value: this.#redaction.value, type: this.#redaction.type, context: this.data.falsePositiveContext },
|
||||
icon: REMOVE_FROM_DICT_ICON,
|
||||
value: RemoveRedactionOptions.FALSE_POSITIVE,
|
||||
extraOption: {
|
||||
label: this.#translations.FALSE_POSITIVE.extraOptionLabel,
|
||||
checked: this.data.applyToAllDossiers ?? true,
|
||||
hidden: !this.data.isApprover,
|
||||
},
|
||||
});
|
||||
}
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
export const RemoveRedactionOptions = {
|
||||
ONLY_HERE: 'ONLY_HERE',
|
||||
IN_DOSSIER: 'IN_DOSSIER',
|
||||
FALSE_POSITIVE: 'FALSE_POSITIVE',
|
||||
} as const;
|
||||
|
||||
export type RemoveRedactionOption = keyof typeof RemoveRedactionOptions;
|
||||
@ -19,6 +19,7 @@ import {
|
||||
ConfirmOptions,
|
||||
CustomError,
|
||||
ErrorService,
|
||||
getConfig,
|
||||
HelpModeService,
|
||||
IConfirmationDialogData,
|
||||
IqserDialog,
|
||||
@ -71,6 +72,8 @@ import { DossierTemplatesService } from '@services/dossier-templates/dossier-tem
|
||||
import { copyLocalStorageFiltersValues, FilterService, NestedFilter, processFilters } from '@iqser/common-ui/lib/filtering';
|
||||
import { AutoUnsubscribe, Bind, bool, Debounce, List, OnAttach, OnDetach } from '@iqser/common-ui/lib/utils';
|
||||
import { TenantsService } from '@iqser/common-ui/lib/tenants';
|
||||
import { AddHintDialogComponent } from './dialogs/add-hint-dialog/add-hint-dialog.component';
|
||||
import { RedactOrHintData } from './utils/dialog-types';
|
||||
|
||||
const textActions = [TextPopups.REDACT_TEXT, TextPopups.ADD_HINT, TextPopups.ADD_FALSE_POSITIVE];
|
||||
|
||||
@ -95,6 +98,7 @@ export class FilePreviewScreenComponent
|
||||
readonly fileId = this.state.fileId;
|
||||
readonly dossierId = this.state.dossierId;
|
||||
readonly lastAssignee = computed(() => this.getLastAssignee());
|
||||
readonly #isDocumine;
|
||||
width: number;
|
||||
|
||||
constructor(
|
||||
@ -169,6 +173,7 @@ export class FilePreviewScreenComponent
|
||||
this._stampService.stampPDF().then();
|
||||
}
|
||||
});
|
||||
this.#isDocumine = getConfig().IS_DOCUMINE;
|
||||
}
|
||||
|
||||
get changed() {
|
||||
@ -365,20 +370,12 @@ export class FilePreviewScreenComponent
|
||||
|
||||
async openRedactTextDialog(manualRedactionEntryWrapper: ManualRedactionEntryWrapper) {
|
||||
const file = this.state.file();
|
||||
const dossierTemplate = this._dossierTemplatesService.find(this.state.dossierTemplateId);
|
||||
const isApprover = this.permissionsService.isApprover(this.state.dossier());
|
||||
const applyDictionaryUpdatesToAllDossiersByDefault = dossierTemplate.applyDictionaryUpdatesToAllDossiersByDefault;
|
||||
const hint = manualRedactionEntryWrapper.type === ManualRedactionEntryTypes.HINT;
|
||||
const ref = this._iqserDialog.openDefault(RedactTextDialogComponent, {
|
||||
data: {
|
||||
manualRedactionEntryWrapper,
|
||||
dossierId: this.dossierId,
|
||||
file,
|
||||
applyToAllDossiers: isApprover ? applyDictionaryUpdatesToAllDossiersByDefault : false,
|
||||
isApprover,
|
||||
hint,
|
||||
},
|
||||
});
|
||||
|
||||
const data = this.#getRedactTextDialogData(manualRedactionEntryWrapper, file);
|
||||
const ref = hint
|
||||
? this._iqserDialog.openDefault(AddHintDialogComponent, { data: data as RedactOrHintData })
|
||||
: this._iqserDialog.openDefault(RedactTextDialogComponent, { data: data as RedactOrHintData });
|
||||
|
||||
const result = await ref.result();
|
||||
if (!result) {
|
||||
@ -852,4 +849,25 @@ export class FilePreviewScreenComponent
|
||||
this.openRSSView();
|
||||
}
|
||||
}
|
||||
|
||||
#getRedactTextDialogData(manualRedactionEntryWrapper: ManualRedactionEntryWrapper, file: File) {
|
||||
const dossierTemplate = this._dossierTemplatesService.find(this.state.dossierTemplateId);
|
||||
|
||||
const data = {
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,6 +66,7 @@ import { IqserUsersModule } from '@iqser/common-ui/lib/users';
|
||||
import { IqserFiltersModule } from '@iqser/common-ui/lib/filtering';
|
||||
import { StatusBarComponent } from '@iqser/common-ui/lib/shared';
|
||||
import { TenantPipe } from '@iqser/common-ui/lib/tenants';
|
||||
import { AddHintDialogComponent } from './dialogs/add-hint-dialog/add-hint-dialog.component';
|
||||
|
||||
const routes: IqserRoutes = [
|
||||
{
|
||||
@ -88,6 +89,7 @@ const dialogs = [
|
||||
ImportRedactionsDialogComponent,
|
||||
RssDialogComponent,
|
||||
RedactTextDialogComponent,
|
||||
AddHintDialogComponent,
|
||||
RemoveRedactionDialogComponent,
|
||||
];
|
||||
|
||||
|
||||
@ -29,16 +29,13 @@ import { PdfViewer } from '../../pdf-viewer/services/pdf-viewer.service';
|
||||
import { REDAnnotationManager } from '../../pdf-viewer/services/annotation-manager.service';
|
||||
import { SkippedService } from './skipped.service';
|
||||
import { REDDocumentViewer } from '../../pdf-viewer/services/document-viewer.service';
|
||||
import {
|
||||
RemoveRedactionDialogComponent,
|
||||
RemoveRedactionPermissions,
|
||||
RemoveRedactionResult,
|
||||
} from '../dialogs/remove-redaction-dialog/remove-redaction-dialog.component';
|
||||
import { RemoveRedactionOptions } from '../dialogs/remove-redaction-dialog/remove-redaction-options';
|
||||
import { IqserDialog } from '../../../../../../../libs/common-ui/src/lib/dialog/iqser-dialog.service';
|
||||
import { RemoveRedactionDialogComponent } from '../dialogs/remove-redaction-dialog/remove-redaction-dialog.component';
|
||||
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 { RemoveRedactionPermissions, RemoveRedactionResult } from '../utils/dialog-types';
|
||||
import { RemoveRedactionOptions } from '../utils/dialog-options';
|
||||
|
||||
@Injectable()
|
||||
export class AnnotationActionsService {
|
||||
@ -121,7 +118,7 @@ export class AnnotationActionsService {
|
||||
);
|
||||
}
|
||||
|
||||
async removeOrSuggestRemoveRedaction(redaction: AnnotationWrapper, permissions) {
|
||||
async removeRedaction(redaction: AnnotationWrapper, permissions) {
|
||||
const removePermissions: RemoveRedactionPermissions = {
|
||||
canRemoveOnlyHere: permissions.canRemoveOnlyHere,
|
||||
canRemoveFromDictionary: permissions.canRemoveFromDictionary,
|
||||
|
||||
@ -86,7 +86,7 @@ export class PdfAnnotationActionsService {
|
||||
|
||||
if (permissions.canRemoveRedaction) {
|
||||
const removeRedactionButton = this.#getButton('trash', _('annotation-actions.remove-annotation.remove-redaction'), () =>
|
||||
this.#annotationActionsService.removeOrSuggestRemoveRedaction(annotations[0], permissions),
|
||||
this.#annotationActionsService.removeRedaction(annotations[0], permissions),
|
||||
);
|
||||
availableActions.push(removeRedactionButton);
|
||||
}
|
||||
|
||||
@ -262,11 +262,20 @@ export class PdfProxyService {
|
||||
}
|
||||
}
|
||||
|
||||
entry.value = text;
|
||||
entry.value = this.#formatSelectedText(text);
|
||||
entry.rectangle = !text;
|
||||
return entry;
|
||||
}
|
||||
|
||||
#formatSelectedText(text: string): string {
|
||||
text = text.replace(
|
||||
// eslint-disable-next-line no-control-regex,max-len
|
||||
/([^\s\d-]{2,})[-\u00AD]\u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029]/gi,
|
||||
'$1',
|
||||
);
|
||||
return text;
|
||||
}
|
||||
|
||||
#deactivateMultiSelect() {
|
||||
this._logger.info('[PDF] Deactivating multi-select');
|
||||
this._multiSelectService.deactivate();
|
||||
|
||||
103
apps/red-ui/src/app/modules/file-preview/utils/dialog-options.ts
Normal file
103
apps/red-ui/src/app/modules/file-preview/utils/dialog-options.ts
Normal file
@ -0,0 +1,103 @@
|
||||
import { DetailsRadioOption } from '@iqser/common-ui';
|
||||
import { addHintTranslations } from '@translations/add-hint-translations';
|
||||
import { redactTextTranslations } from '@translations/redact-text-translations';
|
||||
import { Dossier } from '@red/domain';
|
||||
import { removeRedactionTranslations } from '@translations/remove-redaction-translations';
|
||||
import { RemoveRedactionData } from './dialog-types';
|
||||
|
||||
const PIN_ICON = 'red:push-pin';
|
||||
const FOLDER_ICON = 'red:folder';
|
||||
const REMOVE_FROM_DICT_ICON = 'red:remove-from-dict';
|
||||
|
||||
export const RedactOrHintOptions = {
|
||||
ONLY_HERE: 'ONLY_HERE',
|
||||
IN_DOSSIER: 'IN_DOSSIER',
|
||||
} as const;
|
||||
|
||||
export type RedactOrHintOption = keyof typeof RedactOrHintOptions;
|
||||
|
||||
export const RemoveRedactionOptions = {
|
||||
ONLY_HERE: 'ONLY_HERE',
|
||||
IN_DOSSIER: 'IN_DOSSIER',
|
||||
FALSE_POSITIVE: 'FALSE_POSITIVE',
|
||||
} as const;
|
||||
|
||||
export type RemoveRedactionOption = keyof typeof RemoveRedactionOptions;
|
||||
|
||||
export const getRedactOrHintOptions = (
|
||||
dossier: Dossier,
|
||||
isRss: boolean,
|
||||
hint: boolean,
|
||||
applyToAllDossiers: boolean,
|
||||
isApprover: boolean,
|
||||
): DetailsRadioOption<RedactOrHintOption>[] => {
|
||||
const translations = hint ? addHintTranslations : redactTextTranslations;
|
||||
const options: DetailsRadioOption<RedactOrHintOption>[] = [
|
||||
{
|
||||
label: translations.onlyHere.label,
|
||||
description: translations.onlyHere.description,
|
||||
icon: PIN_ICON,
|
||||
value: RedactOrHintOptions.ONLY_HERE,
|
||||
},
|
||||
];
|
||||
if (!isRss) {
|
||||
options.push({
|
||||
label: translations.inDossier.label,
|
||||
description: translations.inDossier.description,
|
||||
descriptionParams: { dossierName: dossier.dossierName },
|
||||
icon: FOLDER_ICON,
|
||||
value: RedactOrHintOptions.IN_DOSSIER,
|
||||
extraOption: {
|
||||
label: translations.inDossier.extraOptionLabel,
|
||||
checked: applyToAllDossiers,
|
||||
hidden: !isApprover,
|
||||
},
|
||||
});
|
||||
}
|
||||
return options;
|
||||
};
|
||||
|
||||
export const getRemoveRedactionOptions = (data: RemoveRedactionData): DetailsRadioOption<RemoveRedactionOption>[] => {
|
||||
const translations = removeRedactionTranslations;
|
||||
const { permissions, redaction, applyToAllDossiers, isApprover, falsePositiveContext } = data;
|
||||
|
||||
const options: DetailsRadioOption<RemoveRedactionOption>[] = [];
|
||||
if (permissions.canRemoveOnlyHere) {
|
||||
options.push({
|
||||
label: translations.ONLY_HERE.label,
|
||||
description: translations.ONLY_HERE.description,
|
||||
descriptionParams: { type: redaction.hint ? 'hint' : 'redact', value: redaction.value },
|
||||
icon: PIN_ICON,
|
||||
value: RemoveRedactionOptions.ONLY_HERE,
|
||||
});
|
||||
}
|
||||
if (permissions.canRemoveFromDictionary) {
|
||||
options.push({
|
||||
label: translations.IN_DOSSIER.label,
|
||||
description: translations.IN_DOSSIER.description,
|
||||
descriptionParams: { type: redaction.hint ? 'hint' : 'redact', value: redaction.value },
|
||||
icon: FOLDER_ICON,
|
||||
value: RemoveRedactionOptions.IN_DOSSIER,
|
||||
extraOption: {
|
||||
label: translations.IN_DOSSIER.extraOptionLabel,
|
||||
checked: applyToAllDossiers ?? true,
|
||||
hidden: !isApprover,
|
||||
},
|
||||
});
|
||||
}
|
||||
if (permissions.canMarkAsFalsePositive) {
|
||||
options.push({
|
||||
label: translations.FALSE_POSITIVE.label,
|
||||
description: translations.FALSE_POSITIVE.description,
|
||||
descriptionParams: { value: redaction.value, type: redaction.type, context: falsePositiveContext },
|
||||
icon: REMOVE_FROM_DICT_ICON,
|
||||
value: RemoveRedactionOptions.FALSE_POSITIVE,
|
||||
extraOption: {
|
||||
label: translations.FALSE_POSITIVE.extraOptionLabel,
|
||||
checked: applyToAllDossiers ?? true,
|
||||
hidden: !isApprover,
|
||||
},
|
||||
});
|
||||
}
|
||||
return options;
|
||||
};
|
||||
@ -0,0 +1,39 @@
|
||||
import { ManualRedactionEntryWrapper } from '@models/file/manual-redaction-entry.wrapper';
|
||||
import { Dictionary, Dossier, File, IManualRedactionEntry } from '@red/domain';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { DetailsRadioOption } from '@iqser/common-ui';
|
||||
import { RemoveRedactionOption } from './dialog-options';
|
||||
|
||||
export interface RedactOrHintData {
|
||||
manualRedactionEntryWrapper: ManualRedactionEntryWrapper;
|
||||
dossierId: string;
|
||||
file: File;
|
||||
applyToAllDossiers: boolean;
|
||||
isApprover: boolean;
|
||||
}
|
||||
|
||||
export interface RedactOrHintResult {
|
||||
redaction: IManualRedactionEntry;
|
||||
dictionary: Dictionary;
|
||||
}
|
||||
|
||||
export interface RemoveRedactionPermissions {
|
||||
canRemoveOnlyHere: boolean;
|
||||
canRemoveFromDictionary: boolean;
|
||||
canMarkAsFalsePositive: boolean;
|
||||
}
|
||||
|
||||
export interface RemoveRedactionData {
|
||||
redaction: AnnotationWrapper;
|
||||
dossier: Dossier;
|
||||
falsePositiveContext: string;
|
||||
permissions: RemoveRedactionPermissions;
|
||||
applyToAllDossiers: boolean;
|
||||
isApprover: boolean;
|
||||
}
|
||||
|
||||
export interface RemoveRedactionResult {
|
||||
comment: string;
|
||||
option: DetailsRadioOption<RemoveRedactionOption>;
|
||||
applyToAllDossiers: boolean | null;
|
||||
}
|
||||
@ -147,6 +147,42 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
||||
return !!this._dictionariesMapService.get(dossierTemplateId).find(e => e.type === SuperTypes.ManualRedaction && !e.virtual);
|
||||
}
|
||||
|
||||
getRedactTextDictionaries(dossierTemplateId: string, dossierDictionaryOnly: boolean, dictionaryRequest: boolean): Dictionary[] {
|
||||
const dictionaries: Dictionary[] = [];
|
||||
|
||||
this._dictionariesMapService.get(dossierTemplateId).forEach((d: Dictionary) => {
|
||||
if (
|
||||
(!d.virtual && !d.hint && !d.systemManaged && d.hasDictionary && d.addToDictionaryAction) ||
|
||||
(dossierDictionaryOnly && d.dossierDictionaryOnly)
|
||||
) {
|
||||
dictionaries.push(d);
|
||||
}
|
||||
});
|
||||
|
||||
return dictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
||||
}
|
||||
|
||||
getAddHintDictionaries(dossierTemplateId: string, dossierDictionaryOnly: boolean, dictionaryRequest: boolean): Dictionary[] {
|
||||
const dictionaries: Dictionary[] = [];
|
||||
|
||||
this._dictionariesMapService.get(dossierTemplateId).forEach((d: Dictionary) => {
|
||||
if (
|
||||
(d.hint && d.hasDictionary && d.addToDictionaryAction && d.type) ||
|
||||
(dictionaryRequest && dossierDictionaryOnly && d.dossierDictionaryOnly)
|
||||
) {
|
||||
if (!dictionaryRequest) {
|
||||
if (!IMAGE_TYPES.includes(d.type)) {
|
||||
dictionaries.push(d);
|
||||
}
|
||||
} else {
|
||||
dictionaries.push(d);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return dictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
||||
}
|
||||
|
||||
getPossibleDictionaries(
|
||||
dossierTemplateId: string,
|
||||
hintTypes: boolean,
|
||||
|
||||
14
apps/red-ui/src/app/translations/add-hint-translations.ts
Normal file
14
apps/red-ui/src/app/translations/add-hint-translations.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { RedactOrHintOption } from '@translations/redact-text-translations';
|
||||
|
||||
export const addHintTranslations: Record<'onlyHere' | 'inDossier', RedactOrHintOption> = {
|
||||
onlyHere: {
|
||||
label: _('add-hint.dialog.content.options.only-here.label'),
|
||||
description: _('add-hint.dialog.content.options.only-here.description'),
|
||||
},
|
||||
inDossier: {
|
||||
label: _('add-hint.dialog.content.options.in-dossier.label'),
|
||||
description: _('add-hint.dialog.content.options.in-dossier.description'),
|
||||
extraOptionLabel: _('add-hint.dialog.content.options.in-dossier.extraOptionLabel'),
|
||||
},
|
||||
} as const;
|
||||
@ -1,32 +1,19 @@
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
|
||||
interface Option {
|
||||
export interface RedactOrHintOption {
|
||||
label: string;
|
||||
description: string;
|
||||
extraOptionLabel?: string;
|
||||
}
|
||||
|
||||
export const redactTextTranslations: Record<'REDACT' | 'HINT', Record<'onlyHere' | 'inDossier', Option>> = {
|
||||
REDACT: {
|
||||
onlyHere: {
|
||||
label: _('redact-text.dialog.content.options.redact.only-here.label'),
|
||||
description: _('redact-text.dialog.content.options.redact.only-here.description'),
|
||||
},
|
||||
inDossier: {
|
||||
label: _('redact-text.dialog.content.options.redact.in-dossier.label'),
|
||||
description: _('redact-text.dialog.content.options.redact.in-dossier.description'),
|
||||
extraOptionLabel: _('redact-text.dialog.content.options.redact.in-dossier.extraOptionLabel'),
|
||||
},
|
||||
export const redactTextTranslations: Record<'onlyHere' | 'inDossier', RedactOrHintOption> = {
|
||||
onlyHere: {
|
||||
label: _('redact-text.dialog.content.options.only-here.label'),
|
||||
description: _('redact-text.dialog.content.options.only-here.description'),
|
||||
},
|
||||
HINT: {
|
||||
onlyHere: {
|
||||
label: _('redact-text.dialog.content.options.hint.only-here.label'),
|
||||
description: _('redact-text.dialog.content.options.hint.only-here.description'),
|
||||
},
|
||||
inDossier: {
|
||||
label: _('redact-text.dialog.content.options.hint.in-dossier.label'),
|
||||
description: _('redact-text.dialog.content.options.hint.in-dossier.description'),
|
||||
extraOptionLabel: _('redact-text.dialog.content.options.hint.in-dossier.extraOptionLabel'),
|
||||
},
|
||||
inDossier: {
|
||||
label: _('redact-text.dialog.content.options.in-dossier.label'),
|
||||
description: _('redact-text.dialog.content.options.in-dossier.description'),
|
||||
extraOptionLabel: _('redact-text.dialog.content.options.in-dossier.extraOptionLabel'),
|
||||
},
|
||||
} as const;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { RemoveRedactionOption } from '../modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-options';
|
||||
import { RemoveRedactionOption } from '../modules/file-preview/utils/dialog-options';
|
||||
|
||||
interface Option {
|
||||
label: string;
|
||||
@ -15,11 +15,11 @@ export const removeRedactionTranslations: { [key in RemoveRedactionOption]: Opti
|
||||
IN_DOSSIER: {
|
||||
label: _('remove-redaction.dialog.content.options.in-dossier.label'),
|
||||
description: _('remove-redaction.dialog.content.options.in-dossier.description'),
|
||||
extraOptionLabel: _('remove-redaction.dialog.content.options.redact.in-dossier.extraOptionLabel'),
|
||||
extraOptionLabel: _('remove-redaction.dialog.content.options.in-dossier.extraOptionLabel'),
|
||||
},
|
||||
FALSE_POSITIVE: {
|
||||
label: _('remove-redaction.dialog.content.options.false-positive.label'),
|
||||
description: _('remove-redaction.dialog.content.options.false-positive.description'),
|
||||
extraOptionLabel: _('remove-redaction.dialog.content.options.redact.false-positive.extraOptionLabel'),
|
||||
extraOptionLabel: _('remove-redaction.dialog.content.options.false-positive.extraOptionLabel'),
|
||||
},
|
||||
};
|
||||
|
||||
@ -181,6 +181,33 @@
|
||||
"save": "Wörterbuch speichern",
|
||||
"title": "Wörterbuch erstellen"
|
||||
},
|
||||
"add-hint": {
|
||||
"dialog": {
|
||||
"actions": {
|
||||
"cancel": "",
|
||||
"save": ""
|
||||
},
|
||||
"content": {
|
||||
"comment": "",
|
||||
"comment-placeholder": "",
|
||||
"options": {
|
||||
"in-dossier": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"only-here": {
|
||||
"description": "",
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"selected-text": "",
|
||||
"type": "",
|
||||
"type-placeholder": ""
|
||||
},
|
||||
"title": ""
|
||||
}
|
||||
},
|
||||
"admin-side-nav": {
|
||||
"audit": "",
|
||||
"configurations": "",
|
||||
@ -1916,27 +1943,14 @@
|
||||
"comment-placeholder": "",
|
||||
"legal-basis": "",
|
||||
"options": {
|
||||
"hint": {
|
||||
"in-dossier": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"only-here": {
|
||||
"description": "",
|
||||
"label": ""
|
||||
}
|
||||
"in-dossier": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"redact": {
|
||||
"in-dossier": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"only-here": {
|
||||
"description": "",
|
||||
"label": ""
|
||||
}
|
||||
"only-here": {
|
||||
"description": "",
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"reason": "",
|
||||
@ -1945,7 +1959,6 @@
|
||||
"type": "",
|
||||
"type-placeholder": ""
|
||||
},
|
||||
"hint-title": "",
|
||||
"title": ""
|
||||
}
|
||||
},
|
||||
@ -1963,23 +1976,17 @@
|
||||
"options": {
|
||||
"false-positive": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"in-dossier": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"only-here": {
|
||||
"description": "",
|
||||
"label": ""
|
||||
},
|
||||
"redact": {
|
||||
"false-positive": {
|
||||
"extraOptionLabel": ""
|
||||
},
|
||||
"in-dossier": {
|
||||
"extraOptionLabel": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -181,6 +181,33 @@
|
||||
"save": "Save Entity",
|
||||
"title": "Create Entity"
|
||||
},
|
||||
"add-hint": {
|
||||
"dialog": {
|
||||
"actions": {
|
||||
"cancel": "Cancel",
|
||||
"save": "Save"
|
||||
},
|
||||
"content": {
|
||||
"comment": "Comment",
|
||||
"comment-placeholder": "Add remarks or mentions ...",
|
||||
"options": {
|
||||
"in-dossier": {
|
||||
"description": "Add hint in every document in {dossierName}.",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "Add hint in dossier"
|
||||
},
|
||||
"only-here": {
|
||||
"description": "Add hint only at this position in this document.",
|
||||
"label": "Add hint only here"
|
||||
}
|
||||
},
|
||||
"selected-text": "Selected text:",
|
||||
"type": "Type",
|
||||
"type-placeholder": "Select type ..."
|
||||
},
|
||||
"title": "Add hint"
|
||||
}
|
||||
},
|
||||
"admin-side-nav": {
|
||||
"audit": "Audit",
|
||||
"configurations": "Configurations",
|
||||
@ -1916,27 +1943,14 @@
|
||||
"comment-placeholder": "Add remarks or mentions ...",
|
||||
"legal-basis": "Legal Basis",
|
||||
"options": {
|
||||
"hint": {
|
||||
"in-dossier": {
|
||||
"description": "Add hint in every document in {dossierName}.",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "Add hint in dossier"
|
||||
},
|
||||
"only-here": {
|
||||
"description": "Add hint only at this position in this document.",
|
||||
"label": "Add hint only here"
|
||||
}
|
||||
"in-dossier": {
|
||||
"description": "Add redaction in every document in {dossierName}.",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "Redact in dossier"
|
||||
},
|
||||
"redact": {
|
||||
"in-dossier": {
|
||||
"description": "Add redaction in every document in {dossierName}.",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "Redact in dossier"
|
||||
},
|
||||
"only-here": {
|
||||
"description": "Add redaction only at this position in this document.",
|
||||
"label": "Redact only here"
|
||||
}
|
||||
"only-here": {
|
||||
"description": "Add redaction only at this position in this document.",
|
||||
"label": "Redact only here"
|
||||
}
|
||||
},
|
||||
"reason": "Reason",
|
||||
@ -1945,7 +1959,6 @@
|
||||
"type": "Type",
|
||||
"type-placeholder": "Select type ..."
|
||||
},
|
||||
"hint-title": "Add Hint",
|
||||
"title": "Redact text"
|
||||
}
|
||||
},
|
||||
@ -1963,23 +1976,17 @@
|
||||
"options": {
|
||||
"false-positive": {
|
||||
"description": "\"{value}\" is not a {type} in this context: \"{context}\".",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "False positive"
|
||||
},
|
||||
"in-dossier": {
|
||||
"description": "Do not {type} \"{value}\" in any document of the current dossier.",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "Remove from dossier"
|
||||
},
|
||||
"only-here": {
|
||||
"description": "Do not {type} \"{value}\" at this position in the current document.",
|
||||
"label": "Remove here"
|
||||
},
|
||||
"redact": {
|
||||
"false-positive": {
|
||||
"extraOptionLabel": "Apply to all dossiers"
|
||||
},
|
||||
"in-dossier": {
|
||||
"extraOptionLabel": "Apply to all dossiers"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -181,6 +181,33 @@
|
||||
"save": "Wörterbuch speichern",
|
||||
"title": "Wörterbuch erstellen"
|
||||
},
|
||||
"add-hint": {
|
||||
"dialog": {
|
||||
"actions": {
|
||||
"cancel": "",
|
||||
"save": ""
|
||||
},
|
||||
"content": {
|
||||
"comment": "",
|
||||
"comment-placeholder": "",
|
||||
"options": {
|
||||
"in-dossier": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"only-here": {
|
||||
"description": "",
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"selected-text": "",
|
||||
"type": "",
|
||||
"type-placeholder": ""
|
||||
},
|
||||
"title": ""
|
||||
}
|
||||
},
|
||||
"admin-side-nav": {
|
||||
"audit": "",
|
||||
"configurations": "",
|
||||
@ -1916,27 +1943,14 @@
|
||||
"comment-placeholder": "",
|
||||
"legal-basis": "",
|
||||
"options": {
|
||||
"hint": {
|
||||
"in-dossier": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"only-here": {
|
||||
"description": "",
|
||||
"label": ""
|
||||
}
|
||||
"in-dossier": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"redact": {
|
||||
"in-dossier": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"only-here": {
|
||||
"description": "",
|
||||
"label": ""
|
||||
}
|
||||
"only-here": {
|
||||
"description": "",
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"reason": "",
|
||||
@ -1945,7 +1959,6 @@
|
||||
"type": "",
|
||||
"type-placeholder": ""
|
||||
},
|
||||
"hint-title": "",
|
||||
"title": ""
|
||||
}
|
||||
},
|
||||
@ -1963,23 +1976,17 @@
|
||||
"options": {
|
||||
"false-positive": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"in-dossier": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"only-here": {
|
||||
"description": "",
|
||||
"label": ""
|
||||
},
|
||||
"redact": {
|
||||
"false-positive": {
|
||||
"extraOptionLabel": ""
|
||||
},
|
||||
"in-dossier": {
|
||||
"extraOptionLabel": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -181,6 +181,33 @@
|
||||
"save": "Save Entity",
|
||||
"title": "Create Entity"
|
||||
},
|
||||
"add-hint": {
|
||||
"dialog": {
|
||||
"actions": {
|
||||
"cancel": "Cancel",
|
||||
"save": "Save"
|
||||
},
|
||||
"content": {
|
||||
"comment": "Comment",
|
||||
"comment-placeholder": "Add remarks or mentions ...",
|
||||
"options": {
|
||||
"in-dossier": {
|
||||
"description": "Add hint in every document in {dossierName}.",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "Add hint in dossier"
|
||||
},
|
||||
"only-here": {
|
||||
"description": "Add hint only at this position in this document.",
|
||||
"label": "Add hint only here"
|
||||
}
|
||||
},
|
||||
"selected-text": "Selected text:",
|
||||
"type": "Type",
|
||||
"type-placeholder": "Select type ..."
|
||||
},
|
||||
"title": "Add hint"
|
||||
}
|
||||
},
|
||||
"admin-side-nav": {
|
||||
"audit": "Audit",
|
||||
"configurations": "Configurations",
|
||||
@ -1916,27 +1943,14 @@
|
||||
"comment-placeholder": "Add remarks or mentions ...",
|
||||
"legal-basis": "Legal Basis",
|
||||
"options": {
|
||||
"hint": {
|
||||
"in-dossier": {
|
||||
"description": "Add hint in every document in {dossierName}.",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "Add hint in dossier"
|
||||
},
|
||||
"only-here": {
|
||||
"description": "Add hint only at this position in this document.",
|
||||
"label": "Add hint only here"
|
||||
}
|
||||
"in-dossier": {
|
||||
"description": "Add redaction in every document in {dossierName}.",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "Redact in dossier"
|
||||
},
|
||||
"redact": {
|
||||
"in-dossier": {
|
||||
"description": "Add redaction in every document in {dossierName}.",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "Redact in dossier"
|
||||
},
|
||||
"only-here": {
|
||||
"description": "Add redaction only at this position in this document.",
|
||||
"label": "Redact only here"
|
||||
}
|
||||
"only-here": {
|
||||
"description": "Add redaction only at this position in this document.",
|
||||
"label": "Redact only here"
|
||||
}
|
||||
},
|
||||
"reason": "Reason",
|
||||
@ -1945,7 +1959,6 @@
|
||||
"type": "Type",
|
||||
"type-placeholder": "Select type ..."
|
||||
},
|
||||
"hint-title": "Add Hint",
|
||||
"title": "Redact text"
|
||||
}
|
||||
},
|
||||
@ -1963,23 +1976,17 @@
|
||||
"options": {
|
||||
"false-positive": {
|
||||
"description": "\"{value}\" is not a {type} in this context: \"{context}\".",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "False positive"
|
||||
},
|
||||
"in-dossier": {
|
||||
"description": "Do not {type} \"{value}\" in any document of the current dossier.",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "Remove from dossier"
|
||||
},
|
||||
"only-here": {
|
||||
"description": "Do not {type} \"{value}\" at this position in the current document.",
|
||||
"label": "Remove here"
|
||||
},
|
||||
"redact": {
|
||||
"false-positive": {
|
||||
"extraOptionLabel": "Apply to all dossiers"
|
||||
},
|
||||
"in-dossier": {
|
||||
"extraOptionLabel": "Apply to all dossiers"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user