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 1b8ba9d00..f98e8d31e 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 @@ -104,6 +104,14 @@ > + +
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 2826b01a4..35c614eb4 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 @@ -130,7 +130,7 @@ export class AddHintDialogComponent extends IqserDialogComponent + +
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 8dd73df9b..41a32a1fd 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 @@ -138,7 +138,7 @@ export class RedactTextDialogComponent get applyToAll() { return this.isSystemDefault || this._userPreferences.getAddRedactionDefaultExtraOption() === 'undefined' - ? this.data.applyToAllDossiers ?? true + ? (this.data.applyToAllDossiers ?? true) : stringToBoolean(this._userPreferences.getAddRedactionDefaultExtraOption()); } @@ -190,6 +190,15 @@ export class RedactTextDialogComponent }); } + async saveAndRemember() { + const option = this.form.controls.option?.value; + await this._userPreferences.saveAddRedactionDefaultOption(option?.value ?? SystemDefaults.ADD_REDACTION_DEFAULT); + if (option?.additionalCheck) { + await this._userPreferences.saveAddRedactionDefaultExtraOption(option.additionalCheck.checked); + } + this.save(); + } + toggleEditingSelectedText() { this.isEditingSelectedText = !this.isEditingSelectedText; if (this.isEditingSelectedText) { 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 af6631396..cea51e224 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 @@ -42,6 +42,16 @@ >
+ @if (!allRectangles) { + + } +
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 0ffa843bb..648d4d06e 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 @@ -38,6 +38,12 @@ import { isJustOne } from '@common-ui/utils'; import { validatePageRange } from '../../utils/form-validators'; import { parseRectanglePosition, parseSelectedPageNumbers, prefillPageRange } from '../../utils/enhance-manual-redaction-request.utils'; +const ANNOTATION_TYPES = { + REDACTION: 'redaction', + HINT: 'hint', + RECOMMENDATION: 'recommendation', +}; + @Component({ templateUrl: './remove-redaction-dialog.component.html', styleUrls: ['./remove-redaction-dialog.component.scss'], @@ -65,7 +71,11 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent< readonly iconButtonTypes = IconButtonTypes; readonly recommendation = this.data.redactions.every(redaction => redaction.isRecommendation); readonly hint = this.data.redactions.every(redaction => redaction.isHint); - readonly annotationsType = this.hint ? 'hint' : this.recommendation ? 'recommendation' : 'redaction'; + readonly annotationsType = this.hint + ? ANNOTATION_TYPES.HINT + : this.recommendation + ? ANNOTATION_TYPES.RECOMMENDATION + : ANNOTATION_TYPES.REDACTION; readonly optionByType = { recommendation: { main: this._userPreferences.getRemoveRecommendationDefaultOption(), @@ -94,7 +104,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent< extra: false, }, }; - readonly #allRectangles = this.data.redactions.reduce((acc, a) => acc && a.AREA, true); + readonly allRectangles = this.data.redactions.reduce((acc, a) => acc && a.AREA, true); readonly #applyToAllDossiers = this.systemDefaultByType[this.annotationsType].extra; readonly isSystemDefault = this.optionByType[this.annotationsType].main === SystemDefaultOption.SYSTEM_DEFAULT; readonly isExtraOptionSystemDefault = this.optionByType[this.annotationsType].extra === 'undefined'; @@ -102,7 +112,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent< ? this.systemDefaultByType[this.annotationsType].main : this.optionByType[this.annotationsType].main; readonly extraOptionPreference = stringToBoolean(this.optionByType[this.annotationsType].extra); - readonly options: DetailsRadioOption[] = this.#allRectangles + readonly options: DetailsRadioOption[] = this.allRectangles ? getRectangleRedactOptions('remove') : getRemoveRedactionOptions( this.data, @@ -141,7 +151,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent< ) { super(); - if (this.#allRectangles) { + if (this.allRectangles) { prefillPageRange( this.data.redactions[0], this.data.allFileRedactions, @@ -198,6 +208,40 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent< }); } + async saveAndRemember() { + const option = this.form.controls.option?.value; + + switch (this.annotationsType) { + case ANNOTATION_TYPES.REDACTION: + await this._userPreferences.saveRemoveRedactionDefaultOption(option?.value ?? SystemDefaults.REMOVE_REDACTION_DEFAULT); + break; + case ANNOTATION_TYPES.HINT: + await this._userPreferences.saveRemoveHintDefaultOption(option?.value ?? SystemDefaults.REMOVE_HINT_DEFAULT); + break; + case ANNOTATION_TYPES.RECOMMENDATION: + await this._userPreferences.saveRemoveRecommendationDefaultOption( + option?.value ?? SystemDefaults.REMOVE_RECOMMENDATION_DEFAULT, + ); + break; + } + + if (option?.additionalCheck) { + switch (this.annotationsType) { + case ANNOTATION_TYPES.REDACTION: + await this._userPreferences.saveRemoveRedactionDefaultExtraOption(option.additionalCheck.checked); + break; + case ANNOTATION_TYPES.HINT: + await this._userPreferences.saveRemoveHintDefaultExtraOption(option.additionalCheck.checked); + break; + case ANNOTATION_TYPES.RECOMMENDATION: + await this._userPreferences.saveRemoveRecommendationDefaultExtraOption(option.additionalCheck.checked); + break; + } + } + + this.save(); + } + #getOption(option: RemoveRedactionOption): DetailsRadioOption { return this.options.find(o => o.value === option); } diff --git a/apps/red-ui/src/assets/i18n/redact/de.json b/apps/red-ui/src/assets/i18n/redact/de.json index 523364a19..c394633f6 100644 --- a/apps/red-ui/src/assets/i18n/redact/de.json +++ b/apps/red-ui/src/assets/i18n/redact/de.json @@ -224,7 +224,8 @@ "dialog": { "actions": { "cancel": "Abbrechen", - "save": "Speichern" + "save": "Speichern", + "save-and-remember": "" }, "content": { "comment": "Kommentar", @@ -2106,7 +2107,8 @@ "dialog": { "actions": { "cancel": "Abbrechen", - "save": "Speichern" + "save": "Speichern", + "save-and-remember": "" }, "content": { "comment": "Kommentar", @@ -2202,7 +2204,8 @@ "dialog": { "actions": { "cancel": "Abbrechen", - "save": "Speichern" + "save": "Speichern", + "save-and-remember": "" }, "content": { "comment": "Kommentar", diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json index f3c7d3b6a..a64aae978 100644 --- a/apps/red-ui/src/assets/i18n/redact/en.json +++ b/apps/red-ui/src/assets/i18n/redact/en.json @@ -224,7 +224,8 @@ "dialog": { "actions": { "cancel": "Cancel", - "save": "Save" + "save": "Save", + "save-and-remember": "Save and remember my choice" }, "content": { "comment": "Comment", @@ -2106,7 +2107,8 @@ "dialog": { "actions": { "cancel": "Cancel", - "save": "Save" + "save": "Save", + "save-and-remember": "Save and remember my choice" }, "content": { "comment": "Comment", @@ -2202,7 +2204,8 @@ "dialog": { "actions": { "cancel": "Cancel", - "save": "Save" + "save": "Save", + "save-and-remember": "Save and remember my choice" }, "content": { "comment": "Comment", diff --git a/apps/red-ui/src/assets/i18n/scm/de.json b/apps/red-ui/src/assets/i18n/scm/de.json index 0b9603749..62d882d6e 100644 --- a/apps/red-ui/src/assets/i18n/scm/de.json +++ b/apps/red-ui/src/assets/i18n/scm/de.json @@ -224,7 +224,8 @@ "dialog": { "actions": { "cancel": "Abbrechen", - "save": "Speichern" + "save": "Speichern", + "save-and-remember": "" }, "content": { "comment": "Kommentar", @@ -2106,7 +2107,8 @@ "dialog": { "actions": { "cancel": "Abbrechen", - "save": "Speichern" + "save": "Speichern", + "save-and-remember": "" }, "content": { "comment": "Kommentar", @@ -2202,7 +2204,8 @@ "dialog": { "actions": { "cancel": "Abbrechen", - "save": "Speichern" + "save": "Speichern", + "save-and-remember": "" }, "content": { "comment": "Kommentar", diff --git a/apps/red-ui/src/assets/i18n/scm/en.json b/apps/red-ui/src/assets/i18n/scm/en.json index 026460786..61f0d92a6 100644 --- a/apps/red-ui/src/assets/i18n/scm/en.json +++ b/apps/red-ui/src/assets/i18n/scm/en.json @@ -224,7 +224,8 @@ "dialog": { "actions": { "cancel": "Cancel", - "save": "Save" + "save": "Save", + "save-and-remember": "Save and remember my choice" }, "content": { "comment": "Comment", @@ -2106,7 +2107,8 @@ "dialog": { "actions": { "cancel": "Cancel", - "save": "Save" + "save": "Save", + "save-and-remember": "Save and remember my choice" }, "content": { "comment": "Comment", @@ -2202,7 +2204,8 @@ "dialog": { "actions": { "cancel": "Cancel", - "save": "Save" + "save": "Save", + "save-and-remember": "Save and remember my choice" }, "content": { "comment": "Comment",