RED-3515 -> As a user I want to edit the add-to-dictionary text
This commit is contained in:
parent
de38288e05
commit
f5f66a5712
@ -4,10 +4,27 @@
|
||||
|
||||
<div class="dialog-content">
|
||||
<ng-container *ngIf="!data.manualRedactionEntryWrapper.manualRedactionEntry.rectangle">
|
||||
<div class="iqser-input-group">
|
||||
<div class="iqser-input-group w-400">
|
||||
<label translate="manual-annotation.dialog.content.text"></label>
|
||||
<div class="flex-align-items-center" *ngIf="!isEditingSelectedText">
|
||||
{{ data.manualRedactionEntryWrapper.manualRedactionEntry.value }}
|
||||
<iqser-circle-button
|
||||
(action)="isEditingSelectedText = true"
|
||||
[tooltip]="'manual-annotation.dialog.content.edit-selected-text' | translate"
|
||||
[type]="circleButtonTypes.dark"
|
||||
icon="iqser:edit"
|
||||
tooltipPosition="below"
|
||||
></iqser-circle-button>
|
||||
</div>
|
||||
<iqser-input-with-action
|
||||
*ngIf="isEditingSelectedText"
|
||||
(action)="isEditingSelectedText = false"
|
||||
[(value)]="data.manualRedactionEntryWrapper.manualRedactionEntry.value"
|
||||
[placeholder]="'manual-annotation.dialog.content.selected-text' | translate"
|
||||
icon="iqser:check"
|
||||
width="full"
|
||||
></iqser-input-with-action>
|
||||
</div>
|
||||
{{ format(data.manualRedactionEntryWrapper.manualRedactionEntry.value) }}
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="data.manualRedactionEntryWrapper.manualRedactionEntry.rectangle">
|
||||
|
||||
@ -8,7 +8,7 @@ import { JustificationsService } from '@services/entity-services/justifications.
|
||||
import { Dictionary, Dossier, IAddRedactionRequest } from '@red/domain';
|
||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||
import { BaseDialogComponent } from '@iqser/common-ui';
|
||||
import { BaseDialogComponent, CircleButtonTypes } from '@iqser/common-ui';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
|
||||
export interface LegalBasisOption {
|
||||
@ -22,9 +22,11 @@ export interface LegalBasisOption {
|
||||
styleUrls: ['./manual-annotation-dialog.component.scss'],
|
||||
})
|
||||
export class ManualAnnotationDialogComponent extends BaseDialogComponent implements OnInit {
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
isDocumentAdmin: boolean;
|
||||
isDictionaryRequest: boolean;
|
||||
isFalsePositiveRequest: boolean;
|
||||
isEditingSelectedText: boolean = false;
|
||||
|
||||
possibleDictionaries: Dictionary[] = [];
|
||||
legalOptions: LegalBasisOption[] = [];
|
||||
@ -66,7 +68,7 @@ export class ManualAnnotationDialogComponent extends BaseDialogComponent impleme
|
||||
}
|
||||
|
||||
get disabled() {
|
||||
return this.form.invalid;
|
||||
return this.form.invalid || this.isEditingSelectedText;
|
||||
}
|
||||
|
||||
get commentIsMandatory() {
|
||||
@ -87,6 +89,9 @@ export class ManualAnnotationDialogComponent extends BaseDialogComponent impleme
|
||||
}));
|
||||
|
||||
this.legalOptions.sort((a, b) => a.label.localeCompare(b.label));
|
||||
if (!this.data.manualRedactionEntryWrapper.manualRedactionEntry.rectangle) {
|
||||
this._formatSelectedTextValue();
|
||||
}
|
||||
}
|
||||
|
||||
save() {
|
||||
@ -94,12 +99,13 @@ export class ManualAnnotationDialogComponent extends BaseDialogComponent impleme
|
||||
this._dialogRef.close(this.data.manualRedactionEntryWrapper);
|
||||
}
|
||||
|
||||
format(value: string) {
|
||||
return 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',
|
||||
);
|
||||
private _formatSelectedTextValue() {
|
||||
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',
|
||||
);
|
||||
}
|
||||
|
||||
private _getForm(): FormGroup {
|
||||
|
||||
@ -1472,11 +1472,13 @@
|
||||
"classification": "Wert / Klassifizierung",
|
||||
"comment": "Kommentar",
|
||||
"dictionary": "Wörterbuch",
|
||||
"edit-selected-text": "",
|
||||
"legalBasis": "Rechtsgrundlage",
|
||||
"reason": "Begründung",
|
||||
"reason-placeholder": "Wählen Sie eine Begründung aus ...",
|
||||
"rectangle": "Benutzerdefinierter Bereich",
|
||||
"section": "Absatz / Ort",
|
||||
"selected-text": "",
|
||||
"text": "Ausgewählter Text:"
|
||||
},
|
||||
"header": {
|
||||
|
||||
@ -1472,11 +1472,13 @@
|
||||
"classification": "Value / Classification",
|
||||
"comment": "Comment",
|
||||
"dictionary": "Dictionary",
|
||||
"edit-selected-text": "Edit selected text",
|
||||
"legalBasis": "Legal Basis",
|
||||
"reason": "Reason",
|
||||
"reason-placeholder": "Select a reason ...",
|
||||
"rectangle": "Custom Rectangle",
|
||||
"section": "Paragraph / Location",
|
||||
"selected-text": "Selected text",
|
||||
"text": "Selected text:"
|
||||
},
|
||||
"header": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user