RED-9045: made the current type always available.
This commit is contained in:
parent
5d52904f76
commit
8f55db2279
@ -112,6 +112,10 @@ export class EditRedactionDialogComponent
|
||||
return DialogHelpModeKeys.REDACTION_EDIT;
|
||||
}
|
||||
|
||||
get sameType() {
|
||||
return this.annotations.every(annotation => annotation.type === this.annotations[0].type);
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.#setTypes();
|
||||
const data = await firstValueFrom(this._justificationsService.loadAll(this.#dossier.dossierTemplateId));
|
||||
@ -167,6 +171,7 @@ export class EditRedactionDialogComponent
|
||||
this.isImage,
|
||||
this.isHint,
|
||||
this.annotations.every(annotation => annotation.isOCR),
|
||||
this.sameType ? this.annotations[0].type : null,
|
||||
);
|
||||
|
||||
this.typeSelectOptions = this.dictionaries.map(dictionary => ({
|
||||
@ -198,13 +203,12 @@ export class EditRedactionDialogComponent
|
||||
}
|
||||
|
||||
#getForm() {
|
||||
const sameType = this.annotations.every(annotation => annotation.type === this.annotations[0].type);
|
||||
const sameSection = this.annotations.every(annotation => annotation.section === this.annotations[0].section);
|
||||
return new FormGroup({
|
||||
reason: new FormControl<LegalBasisOption>({ value: null, disabled: this.someSkipped }),
|
||||
comment: new FormControl<string>(null),
|
||||
type: new FormControl<string>({
|
||||
value: sameType ? this.annotations[0].type : null,
|
||||
value: this.sameType ? this.annotations[0].type : null,
|
||||
disabled: this.isImported,
|
||||
}),
|
||||
section: new FormControl<string>({ value: sameSection ? this.annotations[0].section : null, disabled: this.isImported }),
|
||||
|
||||
@ -162,7 +162,13 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
||||
.sort((a, b) => a.label.localeCompare(b.label));
|
||||
}
|
||||
|
||||
getEditableRedactionTypes(dossierId: string, isImage: boolean, isHint: boolean, isOCR: boolean): Dictionary[] {
|
||||
getEditableRedactionTypes(
|
||||
dossierId: string,
|
||||
isImage: boolean,
|
||||
isHint: boolean,
|
||||
isOCR: boolean,
|
||||
currentlySelectedType: string,
|
||||
): Dictionary[] {
|
||||
return this.#extractDossierLevelTypes(dossierId)
|
||||
.filter(
|
||||
d =>
|
||||
@ -170,7 +176,7 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
||||
(isImage
|
||||
? (isOCR ? [...IMAGE_CATEGORIES, 'ocr'] : IMAGE_CATEGORIES).includes(d.type)
|
||||
: (isHint ? d.hint : !d.hint) &&
|
||||
d.addToDictionaryAction &&
|
||||
(d.addToDictionaryAction || currentlySelectedType === d.type) &&
|
||||
!d.virtual &&
|
||||
!d.systemManaged &&
|
||||
![...IMAGE_CATEGORIES, 'ocr'].includes(d.type)),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user