Image recategorization done

This commit is contained in:
Adina Țeudan 2021-07-07 15:20:51 +03:00
parent 6ed740d26a
commit b58e33d57c
3 changed files with 11 additions and 24 deletions

View File

@ -11,7 +11,7 @@
formControlName="type"
>
<mat-option *ngFor="let option of typeOptions" [value]="option">
{{ option }}
{{ 'recategorize-image-dialog.options.' + option | translate }}
</mat-option>
</mat-select>
</div>

View File

@ -1,7 +1,5 @@
import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { TranslateService } from '@ngx-translate/core';
import { AppStateService } from '../../../../state/app-state.service';
import { PermissionsService } from '../../../../services/permissions.service';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { AnnotationWrapper } from '../../../../models/file/annotation.wrapper';
@ -14,11 +12,9 @@ import { AnnotationWrapper } from '../../../../models/file/annotation.wrapper';
export class RecategorizeImageDialogComponent implements OnInit {
recategorizeImageForm: FormGroup;
isDocumentAdmin: boolean;
typeOptions: string[] = ['signature', 'image', 'logo'];
typeOptions: string[] = ['signature', 'logo', 'formula', 'image'];
constructor(
private readonly _translateService: TranslateService,
private readonly _appStateService: AppStateService,
private readonly _permissionsService: PermissionsService,
private readonly _formBuilder: FormBuilder,
public dialogRef: MatDialogRef<RecategorizeImageDialogComponent>,
@ -26,31 +22,16 @@ export class RecategorizeImageDialogComponent implements OnInit {
) {}
get changed(): boolean {
return true;
// return this.recategorizeImageForm.get('reason').
// value.legalBasis !== this.annotation.legalBasis;
return this.recategorizeImageForm.get('type').value !== this.annotation.dictionary;
}
async ngOnInit() {
this.isDocumentAdmin = this._permissionsService.isApprover();
this.recategorizeImageForm = this._formBuilder.group({
type: [null, Validators.required],
type: [this.annotation.dictionary, Validators.required],
comment: this.isDocumentAdmin ? [null] : [null, Validators.required]
});
// this.typeOptions = data
// .map(lbm => ({
// legalBasis: lbm.reason,
// description: lbm.description,
// label: lbm.name
// }))
// .sort((a, b) => a.label.localeCompare(b.label));
// this.annotation.
this.recategorizeImageForm.patchValue({
type: 'signature'
});
}
save() {

View File

@ -330,7 +330,13 @@
"type": "Select image type",
"type-placeholder": "Select a type..."
},
"header": "Edit Image Type"
"header": "Edit Image Type",
"options": {
"image": "Image",
"logo": "Logo",
"signature": "Signature",
"formula": "Formula"
}
},
"comment": "Comment",
"comments": {