rectangle/value/section for 3.x
This commit is contained in:
parent
eac1d9f2a8
commit
82f7864a0a
@ -13,7 +13,6 @@ export class ManualRedactionEntryWrapper {
|
|||||||
readonly quads: any,
|
readonly quads: any,
|
||||||
readonly manualRedactionEntry: IManualRedactionEntry,
|
readonly manualRedactionEntry: IManualRedactionEntry,
|
||||||
readonly type: ManualRedactionEntryType,
|
readonly type: ManualRedactionEntryType,
|
||||||
readonly annotationType: 'TEXT' | 'RECTANGLE' = 'TEXT',
|
|
||||||
readonly rectId?: string,
|
readonly rectId?: string,
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,19 +3,37 @@
|
|||||||
<div [translate]="title" class="dialog-header heading-l"></div>
|
<div [translate]="title" class="dialog-header heading-l"></div>
|
||||||
|
|
||||||
<div class="dialog-content">
|
<div class="dialog-content">
|
||||||
<ng-container *ngIf="data.manualRedactionEntryWrapper.annotationType === 'TEXT'">
|
<ng-container *ngIf="!data.manualRedactionEntryWrapper.manualRedactionEntry.rectangle">
|
||||||
<div class="iqser-input-group">
|
<div class="iqser-input-group">
|
||||||
<label translate="manual-annotation.dialog.content.text"></label>
|
<label translate="manual-annotation.dialog.content.text"></label>
|
||||||
</div>
|
</div>
|
||||||
{{ format(data.manualRedactionEntryWrapper.manualRedactionEntry.value) }}
|
{{ format(data.manualRedactionEntryWrapper.manualRedactionEntry.value) }}
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container *ngIf="data.manualRedactionEntryWrapper.annotationType === 'RECTANGLE'">
|
<ng-container *ngIf="data.manualRedactionEntryWrapper.manualRedactionEntry.rectangle">
|
||||||
<div class="iqser-input-group">
|
<div class="iqser-input-group">
|
||||||
<label translate="manual-annotation.dialog.content.rectangle"></label>
|
<label translate="manual-annotation.dialog.content.rectangle"></label>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
<div *ngIf="!isFalsePositiveRequest && isDictionaryRequest" class="iqser-input-group required w-400">
|
||||||
|
<label translate="manual-annotation.dialog.content.dictionary"></label>
|
||||||
|
|
||||||
|
<mat-select formControlName="dictionary">
|
||||||
|
<mat-select-trigger>{{ displayedDictionaryLabel }}</mat-select-trigger>
|
||||||
|
<mat-option
|
||||||
|
*ngFor="let dictionary of possibleDictionaries"
|
||||||
|
[matTooltip]="dictionary.description"
|
||||||
|
[value]="dictionary.type"
|
||||||
|
matTooltipPosition="after"
|
||||||
|
>
|
||||||
|
<span>
|
||||||
|
{{ dictionary.label }}
|
||||||
|
</span>
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div *ngIf="!isDictionaryRequest" class="iqser-input-group required w-400">
|
<div *ngIf="!isDictionaryRequest" class="iqser-input-group required w-400">
|
||||||
<label translate="manual-annotation.dialog.content.reason"></label>
|
<label translate="manual-annotation.dialog.content.reason"></label>
|
||||||
<mat-select
|
<mat-select
|
||||||
@ -39,27 +57,19 @@
|
|||||||
<input [value]="redactionForm.get('reason').value?.legalBasis" disabled type="text" />
|
<input [value]="redactionForm.get('reason').value?.legalBasis" disabled type="text" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div [class.required]="!isDocumentAdmin" class="iqser-input-group w-300">
|
<div *ngIf="data.manualRedactionEntryWrapper.manualRedactionEntry.rectangle" class="iqser-input-group w-400">
|
||||||
<label translate="manual-annotation.dialog.content.comment"></label>
|
<label translate="manual-annotation.dialog.content.section"></label>
|
||||||
<textarea formControlName="comment" iqserHasScrollbar name="comment" rows="4" type="text"></textarea>
|
<input formControlName="section" name="section" type="text" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="isDictionaryRequest && !isFalsePositiveRequest" class="iqser-input-group required w-300">
|
<div *ngIf="data.manualRedactionEntryWrapper.manualRedactionEntry.rectangle" class="iqser-input-group w-400">
|
||||||
<label translate="manual-annotation.dialog.content.dictionary"></label>
|
<label translate="manual-annotation.dialog.content.classification"></label>
|
||||||
|
<input formControlName="classification" name="classification" type="text" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<mat-select formControlName="dictionary">
|
<div [class.required]="!isDocumentAdmin" class="iqser-input-group w-300">
|
||||||
<mat-select-trigger>{{ displayedDictionaryLabel }}</mat-select-trigger>
|
<label translate="manual-annotation.dialog.content.comment"></label>
|
||||||
<mat-option
|
<textarea formControlName="comment" name="comment" redactionHasScrollbar rows="4" type="text"></textarea>
|
||||||
*ngFor="let dictionary of redactionDictionaries"
|
|
||||||
[matTooltip]="dictionary.description"
|
|
||||||
[value]="dictionary.type"
|
|
||||||
matTooltipPosition="after"
|
|
||||||
>
|
|
||||||
<span>
|
|
||||||
{{ dictionary.label }}
|
|
||||||
</span>
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export class ManualAnnotationDialogComponent implements OnInit {
|
|||||||
isDictionaryRequest: boolean;
|
isDictionaryRequest: boolean;
|
||||||
isFalsePositiveRequest: boolean;
|
isFalsePositiveRequest: boolean;
|
||||||
|
|
||||||
redactionDictionaries: Dictionary[] = [];
|
possibleDictionaries: Dictionary[] = [];
|
||||||
legalOptions: LegalBasisOption[] = [];
|
legalOptions: LegalBasisOption[] = [];
|
||||||
|
|
||||||
private readonly _dossier: Dossier;
|
private readonly _dossier: Dossier;
|
||||||
@ -51,7 +51,7 @@ export class ManualAnnotationDialogComponent implements OnInit {
|
|||||||
|
|
||||||
this.redactionForm = this._getForm();
|
this.redactionForm = this._getForm();
|
||||||
|
|
||||||
this.redactionDictionaries = this._redactionDictionaries;
|
this.possibleDictionaries = this._possibleDictionaries;
|
||||||
}
|
}
|
||||||
|
|
||||||
get title() {
|
get title() {
|
||||||
@ -61,24 +61,25 @@ export class ManualAnnotationDialogComponent implements OnInit {
|
|||||||
get displayedDictionaryLabel() {
|
get displayedDictionaryLabel() {
|
||||||
const dictType = this.redactionForm.get('dictionary').value;
|
const dictType = this.redactionForm.get('dictionary').value;
|
||||||
if (dictType) {
|
if (dictType) {
|
||||||
return this.redactionDictionaries.find(d => d.type === dictType).label;
|
return this.possibleDictionaries.find(d => d.type === dictType).label;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private get _redactionDictionaries(): Dictionary[] {
|
private get _possibleDictionaries(): Dictionary[] {
|
||||||
const redactionDictionaries: Dictionary[] = [];
|
const possibleDictionaries: Dictionary[] = [];
|
||||||
const dossier = this._dossier;
|
const dossier = this._dossier;
|
||||||
|
|
||||||
for (const key of Object.keys(this._appStateService.dictionaryData[dossier.dossierTemplateId])) {
|
for (const key of Object.keys(this._appStateService.dictionaryData[dossier.dossierTemplateId])) {
|
||||||
const dictionaryData = this._appStateService.getDictionary(key, dossier.dossierTemplateId);
|
const dictionaryData = this._appStateService.getDictionary(key, dossier.dossierTemplateId);
|
||||||
if (!dictionaryData.virtual && dictionaryData.addToDictionaryAction) {
|
if (!dictionaryData.virtual && dictionaryData.addToDictionaryAction) {
|
||||||
redactionDictionaries.push(dictionaryData);
|
possibleDictionaries.push(dictionaryData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
redactionDictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
|
||||||
|
|
||||||
return redactionDictionaries;
|
possibleDictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
||||||
|
|
||||||
|
return possibleDictionaries;
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@ -111,11 +112,13 @@ export class ManualAnnotationDialogComponent implements OnInit {
|
|||||||
|
|
||||||
private _getForm(): FormGroup {
|
private _getForm(): FormGroup {
|
||||||
return this._formBuilder.group({
|
return this._formBuilder.group({
|
||||||
|
section: [null],
|
||||||
reason: this.isDictionaryRequest ? [null] : [null, Validators.required],
|
reason: this.isDictionaryRequest ? [null] : [null, Validators.required],
|
||||||
dictionary: this.isDictionaryRequest
|
dictionary: this.isDictionaryRequest
|
||||||
? [this.isFalsePositiveRequest ? 'false_positive' : null, Validators.required]
|
? [this.isFalsePositiveRequest ? 'false_positive' : null, Validators.required]
|
||||||
: ['manual', Validators.required],
|
: ['manual', Validators.required],
|
||||||
comment: this.isDocumentAdmin ? [null] : [null, Validators.required],
|
comment: this.isDocumentAdmin ? [null] : [null, Validators.required],
|
||||||
|
classification: ['non-readable content'],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,5 +136,9 @@ export class ManualAnnotationDialogComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
const commentValue = this.redactionForm.get('comment').value;
|
const commentValue = this.redactionForm.get('comment').value;
|
||||||
addRedactionRequest.comment = commentValue ? { text: commentValue } : null;
|
addRedactionRequest.comment = commentValue ? { text: commentValue } : null;
|
||||||
|
addRedactionRequest.section = this.redactionForm.get('section').value;
|
||||||
|
addRedactionRequest.value = addRedactionRequest.rectangle
|
||||||
|
? this.redactionForm.get('classification').value
|
||||||
|
: addRedactionRequest.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -495,12 +495,10 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
|||||||
const activeAnnotation = this.annotationManager.getSelectedAnnotations()[0];
|
const activeAnnotation = this.annotationManager.getSelectedAnnotations()[0];
|
||||||
const activePage = activeAnnotation.getPageNumber();
|
const activePage = activeAnnotation.getPageNumber();
|
||||||
const quads = [this._annotationDrawService.annotationToQuads(activeAnnotation, this.instance)];
|
const quads = [this._annotationDrawService.annotationToQuads(activeAnnotation, this.instance)];
|
||||||
const manualRedaction = this._getManualRedaction({ [activePage]: quads }, 'Rectangle');
|
const manualRedaction = this._getManualRedaction({ [activePage]: quads });
|
||||||
this._cleanUpSelectionAndButtonState();
|
this._cleanUpSelectionAndButtonState();
|
||||||
|
|
||||||
this.manualAnnotationRequested.emit(
|
this.manualAnnotationRequested.emit(new ManualRedactionEntryWrapper(quads, manualRedaction, 'REDACTION', activeAnnotation.Id));
|
||||||
new ManualRedactionEntryWrapper(quads, manualRedaction, 'REDACTION', 'RECTANGLE', activeAnnotation.Id),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _cleanUpSelectionAndButtonState() {
|
private _cleanUpSelectionAndButtonState() {
|
||||||
@ -619,7 +617,7 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
|||||||
|
|
||||||
private _getManualRedaction(
|
private _getManualRedaction(
|
||||||
quads: Readonly<Record<string, Core.Math.Quad[]>>,
|
quads: Readonly<Record<string, Core.Math.Quad[]>>,
|
||||||
text: string,
|
text?: string,
|
||||||
convertQuads = false,
|
convertQuads = false,
|
||||||
): IManualRedactionEntry {
|
): IManualRedactionEntry {
|
||||||
const entry: IManualRedactionEntry = { positions: [] };
|
const entry: IManualRedactionEntry = { positions: [] };
|
||||||
@ -633,6 +631,7 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entry.value = text;
|
entry.value = text;
|
||||||
|
entry.rectangle = !text;
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -88,10 +88,17 @@ export class AnnotationActionsService {
|
|||||||
'changeLegalBasis',
|
'changeLegalBasis',
|
||||||
$event,
|
$event,
|
||||||
{ annotations, dossier: this._dossier(file) },
|
{ annotations, dossier: this._dossier(file) },
|
||||||
(data: { comment: string; legalBasis: string }) => {
|
(data: { comment: string; legalBasis: string; section: string; value: string }) => {
|
||||||
annotations.forEach(annotation => {
|
annotations.forEach(annotation => {
|
||||||
this._processObsAndEmit(
|
this._processObsAndEmit(
|
||||||
this._manualAnnotationService.changeLegalBasis(annotation.annotationId, file, data.legalBasis, data.comment),
|
this._manualAnnotationService.changeLegalBasis(
|
||||||
|
annotation.annotationId,
|
||||||
|
file,
|
||||||
|
data.section,
|
||||||
|
data.value,
|
||||||
|
data.legalBasis,
|
||||||
|
data.comment,
|
||||||
|
),
|
||||||
annotation,
|
annotation,
|
||||||
annotationsChanged,
|
annotationsChanged,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -102,11 +102,11 @@ export class ManualAnnotationService extends GenericService<IManualAddResponse>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// /manualRedaction/request/legalBasis
|
// /manualRedaction/request/legalBasis
|
||||||
changeLegalBasis(annotationId: string, file: File, legalBasis: string, comment?: string) {
|
changeLegalBasis(annotationId: string, file: File, section: string, value: string, legalBasis: string, comment?: string) {
|
||||||
const mode: AnnotationActionMode = this._permissionsService.isApprover(this._dossier(file))
|
const mode: AnnotationActionMode = this._permissionsService.isApprover(this._dossier(file))
|
||||||
? 'change-legal-basis'
|
? 'change-legal-basis'
|
||||||
: 'request-change-legal-basis';
|
: 'request-change-legal-basis';
|
||||||
return this._makeRequest(mode, file, { annotationId, legalBasis, comment });
|
return this._makeRequest(mode, file, { annotationId, legalBasis, comment, section, value });
|
||||||
}
|
}
|
||||||
|
|
||||||
// this wraps
|
// this wraps
|
||||||
|
|||||||
@ -10,4 +10,6 @@ export interface IAddRedactionRequest {
|
|||||||
reason?: string;
|
reason?: string;
|
||||||
type?: string;
|
type?: string;
|
||||||
value?: string;
|
value?: string;
|
||||||
|
section?: string;
|
||||||
|
rectangle?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,4 +16,5 @@ export interface IManualRedactionEntry {
|
|||||||
type?: string;
|
type?: string;
|
||||||
user?: string;
|
user?: string;
|
||||||
value?: string;
|
value?: string;
|
||||||
|
rectangle?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user