+
@@ -30,7 +32,7 @@
{{ displayedDictionaryLabel }}
acc && a.AREA, true);
+
+ readonly isModifyDictionary = this.annotations.every(annotation => annotation.isModifyDictionary);
+ 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 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);
+
options: DetailsRadioOption[] | undefined;
legalOptions: LegalBasisOption[] = [];
dictionaries: Dictionary[] = [];
+ typeSelectOptions: TypeSelectOptions[] = [];
readonly form = this.#getForm();
hasTypeChanged = false;
initialReasonDisabled = this.someSkipped;
@@ -40,19 +51,12 @@ export class EditRedactionDialogComponent
private readonly _dictionaryService: DictionaryService,
) {
super();
- const annotations = this.data.annotations;
- this.isImage = annotations.reduce((acc, next) => acc && next.isImage, true);
- this.redactedTexts = !this.isImage ? annotations.map(annotation => annotation.value) : null;
- this.isModifyDictionary = annotations.every(annotation => annotation.isModifyDictionary);
- this.isManualRedaction = annotations.every(annotation => annotation.type === SuperTypes.ManualRedaction);
- this.isHint = annotations.every(annotation => annotation.HINT);
- this.isRedacted = annotations.every(annotation => annotation.isRedacted);
}
get displayedDictionaryLabel() {
const selectedDictionaryType = this.form.controls.type.value;
if (selectedDictionaryType) {
- return this.dictionaries.find(d => d.type === selectedDictionaryType)?.label ?? null;
+ return this.typeSelectOptions.find(option => option.type === selectedDictionaryType)?.label ?? null;
}
return null;
}
@@ -69,7 +73,7 @@ export class EditRedactionDialogComponent
}
get someSkipped() {
- return this.data.annotations.some(annotation => annotation.isSkipped);
+ return this.annotations.some(annotation => annotation.isSkipped);
}
get redactBasedTypes() {
@@ -83,7 +87,7 @@ export class EditRedactionDialogComponent
}
get hideReasonPlaceholder() {
- return (this.hasTypeChanged && this.isRedactBasedType) || this.#isFieldEmpty('legalBasis');
+ return (this.hasTypeChanged && this.isRedactBasedType) || this.#isFieldEmpty('legalBasisValue');
}
get hideParagraphPlaceholder() {
@@ -95,7 +99,7 @@ export class EditRedactionDialogComponent
}
get isBulkEdit() {
- return this.data.annotations.length > 1;
+ return this.annotations.length > 1;
}
async ngOnInit() {
@@ -107,8 +111,8 @@ export class EditRedactionDialogComponent
label: lbm.name,
}));
- const reason = this.legalOptions.find(o => o.legalBasis === this.data.annotations[0].legalBasis);
- const sameLegalBasis = this.data.annotations.every(annotation => annotation.legalBasis === reason?.legalBasis);
+ const reason = this.legalOptions.find(o => o.legalBasis === this.annotations[0].legalBasis);
+ const sameLegalBasis = this.annotations.every(annotation => annotation.legalBasis === reason?.legalBasis);
this.form.patchValue({
reason: sameLegalBasis ? reason : null,
});
@@ -152,8 +156,19 @@ export class EditRedactionDialogComponent
this.#dossier.dossierTemplateId,
this.isImage,
this.isHint,
- this.data.annotations.every(annotation => annotation.isOCR),
+ this.annotations.every(annotation => annotation.isOCR),
);
+
+ this.typeSelectOptions = this.dictionaries.map(dictionary => ({
+ type: dictionary.type,
+ label: dictionary.label,
+ description: dictionary.description,
+ }));
+
+ if (this.isImported) {
+ const importedAnnotation = this.annotations[0];
+ this.typeSelectOptions.push({ type: this.annotations[0].type, label: importedAnnotation.typeLabel, description: '' });
+ }
}
#setOptions(type: string, reasonChanged = false) {
@@ -173,19 +188,22 @@ export class EditRedactionDialogComponent
}
#getForm() {
- const sameType = this.data.annotations.every(annotation => annotation.type === this.data.annotations[0].type);
- const sameSection = this.data.annotations.every(annotation => annotation.section === this.data.annotations[0].section);
+ const sameType = this.annotations.every(annotation => annotation.type === this.annotations[0].type);
+ const sameSection = this.annotations.every(annotation => annotation.section === this.annotations[0].section);
return new FormGroup({
reason: new FormControl({ value: null, disabled: this.someSkipped }),
comment: new FormControl(null),
- type: new FormControl(sameType ? this.data.annotations[0].type : null),
- section: new FormControl(sameSection ? this.data.annotations[0].section : null),
+ type: new FormControl({
+ value: sameType ? this.annotations[0].type : null,
+ disabled: this.isImported,
+ }),
+ section: new FormControl({ value: sameSection ? this.annotations[0].section : null, disabled: this.isImported }),
option: new FormControl(null),
- value: new FormControl(this.allRectangles ? this.data.annotations[0].value : null),
+ value: new FormControl(this.allRectangles ? this.annotations[0].value : null),
});
}
#isFieldEmpty(field: string) {
- return this.data.annotations.every(annotation => !annotation[field].length);
+ return this.annotations.every(annotation => !annotation[field]?.length);
}
}
diff --git a/apps/red-ui/src/assets/i18n/redact/de.json b/apps/red-ui/src/assets/i18n/redact/de.json
index f323a369d..3de74291a 100644
--- a/apps/red-ui/src/assets/i18n/redact/de.json
+++ b/apps/red-ui/src/assets/i18n/redact/de.json
@@ -1211,6 +1211,7 @@
},
"reason": "Reason",
"redacted-text": "Annotated text",
+ "imported": "Imported Redaction",
"section": "Paragraph / location",
"type": "Type",
"unchanged": "Unchanged"
diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json
index 3773fbb39..09b0ea996 100644
--- a/apps/red-ui/src/assets/i18n/redact/en.json
+++ b/apps/red-ui/src/assets/i18n/redact/en.json
@@ -1211,6 +1211,7 @@
},
"reason": "Reason",
"redacted-text": "Annotated text",
+ "imported": "Imported Redaction",
"section": "Paragraph / location",
"type": "Type",
"unchanged": "Unchanged"