diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html index cb5b3a1f0..eae5e9d7d 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html @@ -35,7 +35,12 @@ - - +
@@ -58,12 +57,12 @@
-
-
- - -
+
+ + +
+
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 2df530cec..e7f904677 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 @@ -27,13 +27,12 @@ export class EditRedactionDialogComponent readonly isManualRedaction: boolean; readonly showLegalReason: boolean; readonly isHint: boolean; + readonly showExtras: boolean; options: DetailsRadioOption[] | undefined; legalOptions: LegalBasisOption[] = []; dictionaries: Dictionary[] = []; form: UntypedFormGroup; - readonly #initialType: string; - readonly #initialReason: string; readonly #dossier: Dossier; #applyToAllDossiers: boolean; @@ -51,27 +50,11 @@ export class EditRedactionDialogComponent const firstEntry = annotations[0]; this.isImage = IMAGE_CATEGORIES.includes(firstEntry.type); this.redactedText = annotations.length === 1 && !this.isImage ? firstEntry.value : null; - this.#initialReason = firstEntry.legalBasis; - this.#initialType = firstEntry.type; this.isModifyDictionary = firstEntry.isModifyDictionary; this.isManualRedaction = firstEntry.type === SuperTypes.ManualRedaction; this.isHint = firstEntry.isHint; - this.showLegalReason = !(firstEntry.isSkipped || firstEntry.isHint || this.isImage); + this.showExtras = this.isManualRedaction || ((firstEntry.isRedacted || firstEntry.isSkipped) && firstEntry.dictionaryOperation); this.form = this.#getForm(); - console.log(firstEntry); - - // this.form.valueChanges - // .pipe( - // tap(value => { - // const reasonChanged = this.#initialReason !== value?.reason?.legalBasis; - // const typeChanged = this.#initialType !== value?.type; - // if (typeChanged || reasonChanged) { - // this.#setOptions(value.type, reasonChanged); - // } - // }), - // takeUntilDestroyed(), - // ) - // .subscribe(); } get displayedDictionaryLabel() { @@ -110,8 +93,7 @@ export class EditRedactionDialogComponent save(): void { const value = this.form.value; this.dialogRef.close({ - typeChanged: this.#initialType !== value.type, - legalBasis: value.reason?.legalBasis ?? null, + legalBasis: value.reason?.legalBasis ?? '', section: value.section, comment: value.comment, type: value.type, diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts index ffa1e89be..1e18dd0e3 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts @@ -117,7 +117,7 @@ export class AnnotationActionsService { return; } - if (!this.#isDocumine) { + if (!this.#isDocumine && result.legalBasis !== annotations[0].legalBasis) { const changeLegalBasisBody = annotations.map(annotation => ({ annotationId: annotation.id, legalBasis: result.legalBasis, @@ -126,7 +126,7 @@ export class AnnotationActionsService { })); requests.push(this._manualRedactionService.changeLegalBasis(changeLegalBasisBody, dossierId, fileId)); } - if (result.typeChanged || this.#isDocumine) { + if (result.type !== annotations[0].type || this.#isDocumine) { const recategorizeBody: List = annotations.map(({ id }) => ({ annotationId: id, type: result.type, @@ -134,7 +134,7 @@ export class AnnotationActionsService { requests.push(this._manualRedactionService.recategorizeRedactions(recategorizeBody, dossierId, fileId)); } - if (result.comment) { + if (result.comment && requests.length) { requests.push( from(Promise.all(annotations.map(a => this._manualRedactionService.addComment(result.comment, a.id, dossierId, fileId)))), ); diff --git a/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts index 238727638..ab888107e 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts @@ -51,7 +51,12 @@ export class PdfAnnotationActionsService { availableActions.push(resizeButton); } - if (permissions.canChangeLegalBasis || permissions.canRecategorizeAnnotation) { + if ( + permissions.canChangeLegalBasis || + permissions.canRecategorizeAnnotation || + permissions.canForceHint || + permissions.canForceRedaction + ) { const editButton = this.#getButton('edit', _('annotation-actions.edit-redaction.label'), () => this.#annotationActionsService.editRedaction(annotations), ); 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 093e039e2..ac5b4ceb0 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 @@ -1,6 +1,6 @@ import { List, ValuesOf } from '@iqser/common-ui/lib/utils'; -export const IMAGE_CATEGORIES: readonly string[] = ['signature', 'logo', 'formula', 'image']; +export const IMAGE_CATEGORIES: readonly string[] = ['signature', 'logo', 'formula', 'image', 'ocr']; export const ActionsHelpModeKeys = { redaction: 'redaction', 'manual-redaction': 'redaction', diff --git a/apps/red-ui/src/app/modules/file-preview/utils/dialog-types.ts b/apps/red-ui/src/app/modules/file-preview/utils/dialog-types.ts index 679285324..11d89beee 100644 --- a/apps/red-ui/src/app/modules/file-preview/utils/dialog-types.ts +++ b/apps/red-ui/src/app/modules/file-preview/utils/dialog-types.ts @@ -35,7 +35,6 @@ export interface RedactRecommendationResult { } export interface EditRedactResult { - typeChanged: boolean; legalBasis: string; section: string; comment: string; diff --git a/apps/red-ui/src/app/services/entity-services/dictionary.service.ts b/apps/red-ui/src/app/services/entity-services/dictionary.service.ts index 2a7330941..59a407b9c 100644 --- a/apps/red-ui/src/app/services/entity-services/dictionary.service.ts +++ b/apps/red-ui/src/app/services/entity-services/dictionary.service.ts @@ -167,14 +167,16 @@ export class DictionaryService extends EntitiesService } getEditableRedactionTypes(dossierTemplateId: string, isImage: boolean, isHint: boolean): Dictionary[] { - return this._dictionariesMapService + const types = []; + this._dictionariesMapService .get(dossierTemplateId) .filter(d => isImage ? IMAGE_CATEGORIES.includes(d.type) - : (isHint ? d.hint : !d.hint) && !d.systemManaged && !d.virtual && d.hasDictionary, + : (isHint ? d.hint : !d.hint) && !d.virtual && !IMAGE_CATEGORIES.includes(d.type), ) - .sort((a, b) => a.label.localeCompare(b.label)); + .forEach(d => !types.find(t => t.id === d.id) && types.push(d)); + return types.sort((a, b) => a.label.localeCompare(b.label)); } getAddHintDictionaries(dossierTemplateId: string, dossierDictionaryOnly: boolean, dictionaryRequest: boolean): Dictionary[] { diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index e3ee6fa7b..27c9f3c29 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -3,7 +3,7 @@ "ADMIN_CONTACT_URL": null, "API_URL": "https://qa2.iqser.cloud", "APP_NAME": "RedactManager", - "IS_DOCUMINE": true, + "IS_DOCUMINE": false, "RULE_EDITOR_DEV_ONLY": false, "AUTO_READ_TIME": 3, "BACKEND_APP_VERSION": "4.4.40", diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json index 3b9ec027b..748f217ba 100644 --- a/apps/red-ui/src/assets/i18n/redact/en.json +++ b/apps/red-ui/src/assets/i18n/redact/en.json @@ -1239,7 +1239,7 @@ "section": "Paragraph / Location", "type": "Type" }, - "title-edit-image": "Edit image redaction", + "title-edit-image": "Edit image", "title-edit-text": "Edit redaction", "title-hint": "Edit hint" }