From eac1d9f2a8fd8fad12e91e3d8aea14e14752d5d2 Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Tue, 14 Dec 2021 09:25:14 +0200 Subject: [PATCH] Legal basis port --- .../src/app/models/file/annotation.wrapper.ts | 2 ++ .../app/models/file/redaction-log-entry.wrapper.ts | 1 + .../change-legal-basis-dialog.component.html | 10 ++++++++++ .../change-legal-basis-dialog.component.ts | 14 +++++++++++++- .../document-info/document-info.component.html | 1 + .../document-info/document-info.component.ts | 2 ++ .../red-ui/src/app/services/permissions.service.ts | 6 +++++- apps/red-ui/src/app/utils/functions.ts | 2 +- apps/red-ui/src/assets/i18n/en.json | 2 ++ libs/red-domain/src/lib/files/file.model.ts | 2 +- .../src/lib/redaction-log/redaction-log-entry.ts | 1 + 11 files changed, 39 insertions(+), 4 deletions(-) diff --git a/apps/red-ui/src/app/models/file/annotation.wrapper.ts b/apps/red-ui/src/app/models/file/annotation.wrapper.ts index b7994d106..a7dde41e1 100644 --- a/apps/red-ui/src/app/models/file/annotation.wrapper.ts +++ b/apps/red-ui/src/app/models/file/annotation.wrapper.ts @@ -42,6 +42,8 @@ export class AnnotationWrapper { legalBasisValue: string; legalBasisChangeValue?: string; resizing?: boolean; + rectangle?: boolean; + section?: string; manual?: boolean; diff --git a/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts b/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts index 72a70f608..9dc800a87 100644 --- a/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts +++ b/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts @@ -10,6 +10,7 @@ export interface RedactionLogEntryWrapper { reference?: Array; startOffset?: number; type?: string; + rectangle?: boolean; color?: Array; dictionaryEntry?: boolean; diff --git a/apps/red-ui/src/app/modules/dossier/dialogs/change-legal-basis-dialog/change-legal-basis-dialog.component.html b/apps/red-ui/src/app/modules/dossier/dialogs/change-legal-basis-dialog/change-legal-basis-dialog.component.html index 690ff3b32..97a07755e 100644 --- a/apps/red-ui/src/app/modules/dossier/dialogs/change-legal-basis-dialog/change-legal-basis-dialog.component.html +++ b/apps/red-ui/src/app/modules/dossier/dialogs/change-legal-basis-dialog/change-legal-basis-dialog.component.html @@ -21,6 +21,16 @@ +
+ + +
+ +
+ + +
+
diff --git a/apps/red-ui/src/app/modules/dossier/dialogs/change-legal-basis-dialog/change-legal-basis-dialog.component.ts b/apps/red-ui/src/app/modules/dossier/dialogs/change-legal-basis-dialog/change-legal-basis-dialog.component.ts index c48c4fafc..16f9f5e8f 100644 --- a/apps/red-ui/src/app/modules/dossier/dialogs/change-legal-basis-dialog/change-legal-basis-dialog.component.ts +++ b/apps/red-ui/src/app/modules/dossier/dialogs/change-legal-basis-dialog/change-legal-basis-dialog.component.ts @@ -31,7 +31,15 @@ export class ChangeLegalBasisDialogComponent implements OnInit { ) {} get changed(): boolean { - return this.form.get('reason').value.legalBasis !== this._data.annotations[0].legalBasis; + return ( + this.form.get('reason').value.legalBasis !== this._data.annotations[0].legalBasis || + this.form.get('section').value !== this._data.annotations[0].section || + this.form.get('classification').value !== this._data.annotations[0].value + ); + } + + get allRectangles(): boolean { + return this._data.annotations.reduce((acc, a) => acc && a.rectangle, true); } async ngOnInit() { @@ -55,13 +63,17 @@ export class ChangeLegalBasisDialogComponent implements OnInit { return this._formBuilder.group({ reason: [null, Validators.required], comment: this.isDocumentAdmin ? [null] : [null, Validators.required], + classification: [this.allRectangles ? this._data.annotations[0].value : null], + section: [this._data.annotations[0].section], }); } save() { this.dialogRef.close({ legalBasis: this.form.get('reason').value.legalBasis, + section: this.form.get('section').value, comment: this.form.get('comment').value, + value: this.form.get('classification').value, }); } } diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/document-info/document-info.component.html b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/document-info/document-info.component.html index f5f1120fe..d4b4d65fd 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/document-info/document-info.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/document-info/document-info.component.html @@ -2,6 +2,7 @@
= 2; + return spaceCount >= 3; }; if (direction === 'FORWARD') { diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index ce5e8969d..e7fbced47 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -359,6 +359,8 @@ "comment": "Comment", "legalBasis": "Legal Basis", "reason": "Select redaction reason", + "section": "Paragraph / Location", + "classification": "Value / Classification", "reason-placeholder": "Select a reason..." }, "header": "Edit Redaction Reason" diff --git a/libs/red-domain/src/lib/files/file.model.ts b/libs/red-domain/src/lib/files/file.model.ts index 4e839dace..81148059e 100644 --- a/libs/red-domain/src/lib/files/file.model.ts +++ b/libs/red-domain/src/lib/files/file.model.ts @@ -104,7 +104,7 @@ export class File extends Entity implements IFile { this.isNew = this.workflowStatus === WorkflowFileStatuses.NEW; this.isUnderReview = this.workflowStatus === WorkflowFileStatuses.UNDER_REVIEW; this.isUnderApproval = this.workflowStatus === WorkflowFileStatuses.UNDER_APPROVAL; - this.canBeApproved = !this.analysisRequired && !this.hasSuggestions; + this.canBeApproved = !this.analysisRequired && !this.hasSuggestions && !this.isProcessing && !this.isError; this.canBeOpened = !this.isError && !this.isPending && this.numberOfAnalyses > 0; this.canBeOCRed = !this.excluded && !this.lastOCRTime && (this.isNew || this.isUnderReview || this.isUnderApproval); diff --git a/libs/red-domain/src/lib/redaction-log/redaction-log-entry.ts b/libs/red-domain/src/lib/redaction-log/redaction-log-entry.ts index 209fc808f..c2577442e 100644 --- a/libs/red-domain/src/lib/redaction-log/redaction-log-entry.ts +++ b/libs/red-domain/src/lib/redaction-log/redaction-log-entry.ts @@ -14,6 +14,7 @@ export interface IRedactionLogEntry { engines?: List; excluded?: boolean; hint?: boolean; + rectangle?: boolean; id?: string; image?: boolean; imageHasTransparency?: boolean;