Legal basis port

This commit is contained in:
Timo Bejan 2021-12-14 09:25:14 +02:00
parent af293b1aed
commit eac1d9f2a8
11 changed files with 39 additions and 4 deletions

View File

@ -42,6 +42,8 @@ export class AnnotationWrapper {
legalBasisValue: string;
legalBasisChangeValue?: string;
resizing?: boolean;
rectangle?: boolean;
section?: string;
manual?: boolean;

View File

@ -10,6 +10,7 @@ export interface RedactionLogEntryWrapper {
reference?: Array<string>;
startOffset?: number;
type?: string;
rectangle?: boolean;
color?: Array<number>;
dictionaryEntry?: boolean;

View File

@ -21,6 +21,16 @@
<input [value]="form.get('reason').value?.legalBasis" disabled type="text" />
</div>
<div class="iqser-input-group w-400">
<label translate="change-legal-basis-dialog.content.section"></label>
<input formControlName="section" name="section" type="text" />
</div>
<div class="iqser-input-group w-400" *ngIf="this.allRectangles">
<label translate="change-legal-basis-dialog.content.classification"></label>
<input formControlName="classification" name="classification" type="text" />
</div>
<div [class.required]="!isDocumentAdmin" class="iqser-input-group w-300">
<label translate="change-legal-basis-dialog.content.comment"></label>
<textarea formControlName="comment" iqserHasScrollbar name="comment" rows="4" type="text"></textarea>

View File

@ -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,
});
}
}

View File

@ -2,6 +2,7 @@
<div>
<iqser-circle-button
(action)="edit()"
*ngIf="permissionsService.canEditFileAttributes(file)"
[tooltip]="'file-preview.tabs.document-info.edit' | translate"
icon="iqser:edit"
tooltipPosition="before"

View File

@ -5,6 +5,7 @@ import { AutoUnsubscribe } from '@iqser/common-ui';
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
import { DocumentInfoService } from '../../services/document-info.service';
import { Observable } from 'rxjs';
import { PermissionsService } from '../../../../../../services/permissions.service';
@Component({
selector: 'redaction-document-info [file] [dossier]',
@ -22,6 +23,7 @@ export class DocumentInfoComponent extends AutoUnsubscribe implements OnInit {
constructor(
private readonly _dossierTemplatesService: DossierTemplatesService,
private readonly _dialogService: DossiersDialogService,
readonly permissionsService: PermissionsService,
readonly documentInfoService: DocumentInfoService,
) {
super();

View File

@ -18,8 +18,12 @@ export class PermissionsService {
return this.isApprover(dossier);
}
canEditFileAttributes(file: File): boolean {
return this.isFileAssignee(file) && (file.isNew || file.isUnderReview || file.isUnderApproval);
}
canToggleAnalysis(file: File): boolean {
return this.isReviewerOrApprover(file) && (file.isNew || file.isUnderReview || file.isUnderApproval);
return this.isFileAssignee(file) && (file.isNew || file.isUnderReview || file.isUnderApproval);
}
canReanalyseFile(file: File | File[]): boolean {

View File

@ -41,7 +41,7 @@ export function getFirstRelevantTextPart(text, direction: 'FORWARD' | 'BACKWARD'
accumulator += char;
return spaceCount >= 2;
return spaceCount >= 3;
};
if (direction === 'FORWARD') {

View File

@ -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"

View File

@ -104,7 +104,7 @@ export class File extends Entity<IFile> 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);

View File

@ -14,6 +14,7 @@ export interface IRedactionLogEntry {
engines?: List<LogEntryEngine>;
excluded?: boolean;
hint?: boolean;
rectangle?: boolean;
id?: string;
image?: boolean;
imageHasTransparency?: boolean;