RED-7155 - Resize redaction/hint dialogs
This commit is contained in:
parent
d916015786
commit
e963e47709
@ -33,7 +33,7 @@
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<div class="iqser-input-group w-300">
|
||||
<div class="iqser-input-group w-450">
|
||||
<label [translate]="'resize-redaction.dialog.content.comment'"></label>
|
||||
<textarea formControlName="comment" iqserHasScrollbar name="comment" rows="4" type="text"></textarea>
|
||||
</div>
|
||||
|
||||
@ -3,11 +3,11 @@ import { DetailsRadioOption, IconButtonTypes, IqserDialogComponent, IqserPermiss
|
||||
import { ResizeRedactionData, ResizeRedactionResult } from '../../utils/dialog-types';
|
||||
import { FormBuilder, FormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { getRedactOrHintOptions, getResizeRedactionOptions, RedactOrHintOption, ResizeRedactionOption } from '../../utils/dialog-options';
|
||||
import { getResizeRedactionOptions, ResizeOptions, ResizeRedactionOption } from '../../utils/dialog-options';
|
||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||
import { Dictionary, Dossier } from '@red/domain';
|
||||
import { Roles } from '@users/roles';
|
||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||
|
||||
@Component({
|
||||
templateUrl: './resize-redaction-dialog.component.html',
|
||||
@ -32,14 +32,20 @@ export class ResizeRedactionDialogComponent
|
||||
constructor(
|
||||
private readonly _activeDossiersService: ActiveDossiersService,
|
||||
private readonly _iqserPermissionsService: IqserPermissionsService,
|
||||
private readonly _dictionaryService: DictionaryService,
|
||||
private readonly _dictionariesMapService: DictionariesMapService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
) {
|
||||
super();
|
||||
this.#dossier = _activeDossiersService.find(this.data.dossierId);
|
||||
this.#applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
||||
this.redaction = this.data.redaction;
|
||||
this.options = getResizeRedactionOptions(this.#dossier, this.#isRss, false, this.#applyToAllDossiers, this.data.isApprover);
|
||||
this.options = getResizeRedactionOptions(
|
||||
this.redaction,
|
||||
this.#dossier,
|
||||
this.#isRss,
|
||||
this.#applyToAllDossiers,
|
||||
this.data.isApprover,
|
||||
);
|
||||
this.form = this.#getForm();
|
||||
}
|
||||
|
||||
@ -60,7 +66,7 @@ export class ResizeRedactionDialogComponent
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.dictionaries = this._dictionaryService.getRedactionTypes(this.#dossier.dossierTemplateId);
|
||||
this.dictionaries = this._dictionariesMapService.get(this.#dossier.dossierTemplateId);
|
||||
}
|
||||
|
||||
#getForm(): UntypedFormGroup {
|
||||
@ -72,6 +78,12 @@ export class ResizeRedactionDialogComponent
|
||||
}
|
||||
|
||||
save(): void {
|
||||
this.dialogRef.close(this.form.getRawValue());
|
||||
const formValue = this.form.getRawValue();
|
||||
const updateDictionary = formValue.option.value === ResizeOptions.IN_DOSSIER;
|
||||
|
||||
this.dialogRef.close({
|
||||
comment: formValue.comment,
|
||||
updateDictionary,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,8 +221,15 @@ export class AnnotationActionsService {
|
||||
const isImageText = annotation.isImage ? 'Image' : textAndPositions.text;
|
||||
const text = annotation.rectangle ? annotation.value : isImageText;
|
||||
const isApprover = this._permissionsService.isApprover(dossier);
|
||||
const dossierTemplate = this._dossierTemplatesService.find(this._state.dossierTemplateId);
|
||||
|
||||
const data = { redaction: annotation, text, isApprover, dossierId: dossier.dossierId };
|
||||
const data = {
|
||||
redaction: annotation,
|
||||
text,
|
||||
applyToAllDossiers: isApprover && dossierTemplate.applyDictionaryUpdatesToAllDossiersByDefault,
|
||||
isApprover,
|
||||
dossierId: dossier.dossierId,
|
||||
};
|
||||
|
||||
const result = await this.#getResizeRedactionDialog(data).result();
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import { removeRedactionTranslations } from '@translations/remove-redaction-tran
|
||||
import { RemoveRedactionData } from './dialog-types';
|
||||
import { removeAnnotationTranslations } from '@translations/remove-annotation-translations';
|
||||
import { resizeRedactionTranslations } from '@translations/resize-redaction-translations';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
|
||||
const PIN_ICON = 'red:push-pin';
|
||||
const FOLDER_ICON = 'red:folder';
|
||||
@ -17,6 +18,8 @@ export const RedactOrHintOptions = {
|
||||
} as const;
|
||||
|
||||
export type RedactOrHintOption = keyof typeof RedactOrHintOptions;
|
||||
|
||||
export const ResizeOptions = RedactOrHintOptions;
|
||||
export type ResizeRedactionOption = RedactOrHintOption;
|
||||
|
||||
export const RemoveRedactionOptions = {
|
||||
@ -42,7 +45,7 @@ export const getRedactOrHintOptions = (
|
||||
label: translations.onlyHere.label,
|
||||
description: translations.onlyHere.description,
|
||||
icon: PIN_ICON,
|
||||
value: RedactOrHintOptions.ONLY_HERE,
|
||||
value: ResizeOptions.ONLY_HERE,
|
||||
},
|
||||
];
|
||||
if (!isRss) {
|
||||
@ -51,7 +54,7 @@ export const getRedactOrHintOptions = (
|
||||
description: translations.inDossier.description,
|
||||
descriptionParams: { dossierName: dossier.dossierName },
|
||||
icon: FOLDER_ICON,
|
||||
value: RedactOrHintOptions.IN_DOSSIER,
|
||||
value: ResizeOptions.IN_DOSSIER,
|
||||
extraOption: {
|
||||
label: translations.inDossier.extraOptionLabel,
|
||||
checked: applyToAllDossiers,
|
||||
@ -63,9 +66,9 @@ export const getRedactOrHintOptions = (
|
||||
};
|
||||
|
||||
export const getResizeRedactionOptions = (
|
||||
redaction: AnnotationWrapper,
|
||||
dossier: Dossier,
|
||||
isRss: boolean,
|
||||
hint: boolean,
|
||||
applyToAllDossiers: boolean,
|
||||
isApprover: boolean,
|
||||
): DetailsRadioOption<ResizeRedactionOption>[] => {
|
||||
@ -78,32 +81,23 @@ export const getResizeRedactionOptions = (
|
||||
value: RedactOrHintOptions.ONLY_HERE,
|
||||
},
|
||||
];
|
||||
// if (!isRss) {
|
||||
// options.push({
|
||||
// label: translations.inDossier.label,
|
||||
// description: translations.inDossier.description,
|
||||
// descriptionParams: { dossierName: dossier.dossierName },
|
||||
// icon: FOLDER_ICON,
|
||||
// value: RedactOrHintOptions.IN_DOSSIER,
|
||||
// extraOption: {
|
||||
// label: translations.inDossier.extraOptionLabel,
|
||||
// checked: applyToAllDossiers,
|
||||
// hidden: !isApprover,
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
options.push({
|
||||
label: translations.inDossier.label,
|
||||
description: translations.inDossier.description,
|
||||
descriptionParams: { dossierName: dossier.dossierName },
|
||||
icon: FOLDER_ICON,
|
||||
value: RedactOrHintOptions.IN_DOSSIER,
|
||||
extraOption: {
|
||||
label: translations.inDossier.extraOptionLabel,
|
||||
checked: applyToAllDossiers,
|
||||
hidden: !isApprover,
|
||||
},
|
||||
});
|
||||
if (!isRss) {
|
||||
const dictBasedType = redaction.isModifyDictionary;
|
||||
options.push({
|
||||
label: translations.inDossier.label,
|
||||
description: translations.inDossier.description,
|
||||
descriptionParams: { dossierName: dossier.dossierName },
|
||||
disabled: !dictBasedType,
|
||||
tooltip: !dictBasedType ? translations.inDossier.tooltip : null,
|
||||
icon: FOLDER_ICON,
|
||||
value: RedactOrHintOptions.IN_DOSSIER,
|
||||
extraOption: {
|
||||
label: translations.inDossier.extraOptionLabel,
|
||||
checked: applyToAllDossiers,
|
||||
hidden: !isApprover,
|
||||
},
|
||||
});
|
||||
}
|
||||
return options;
|
||||
};
|
||||
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { DialogOption } from '@translations/redact-text-translations';
|
||||
|
||||
export const resizeRedactionTranslations: Record<'onlyHere' | 'inDossier', DialogOption> = {
|
||||
interface ResizeDialogOption extends DialogOption {
|
||||
tooltip?: string;
|
||||
}
|
||||
|
||||
export const resizeRedactionTranslations: Record<'onlyHere' | 'inDossier', ResizeDialogOption> = {
|
||||
onlyHere: {
|
||||
label: _('resize-redaction.dialog.content.options.only-here.label'),
|
||||
description: _('resize-redaction.dialog.content.options.only-here.description'),
|
||||
@ -10,5 +14,6 @@ export const resizeRedactionTranslations: Record<'onlyHere' | 'inDossier', Dialo
|
||||
label: _('resize-redaction.dialog.content.options.in-dossier.label'),
|
||||
description: _('resize-redaction.dialog.content.options.in-dossier.description'),
|
||||
extraOptionLabel: _('resize-redaction.dialog.content.options.in-dossier.extraOptionLabel'),
|
||||
tooltip: _('resize-redaction.dialog.content.options.in-dossier.tooltip'),
|
||||
},
|
||||
} as const;
|
||||
|
||||
@ -2112,7 +2112,8 @@
|
||||
"in-dossier": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
"label": "",
|
||||
"tooltip": ""
|
||||
},
|
||||
"only-here": {
|
||||
"description": "",
|
||||
@ -2121,8 +2122,7 @@
|
||||
},
|
||||
"original-text": "",
|
||||
"resized-text": "",
|
||||
"type": "",
|
||||
"update-dictionary": ""
|
||||
"type": ""
|
||||
},
|
||||
"header": ""
|
||||
}
|
||||
|
||||
@ -2112,7 +2112,8 @@
|
||||
"in-dossier": {
|
||||
"description": "Resize in every document in {dossierName}.",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "Resize in dossier"
|
||||
"label": "Resize in dossier",
|
||||
"tooltip": "Only available for dictionary-based types"
|
||||
},
|
||||
"only-here": {
|
||||
"description": "Resize only at this position in this document.",
|
||||
@ -2121,8 +2122,7 @@
|
||||
},
|
||||
"original-text": "Original text:",
|
||||
"resized-text": "Resized text:",
|
||||
"type": "Type",
|
||||
"update-dictionary": "Update dictionary: {text}"
|
||||
"type": "Type"
|
||||
},
|
||||
"header": "Resize {type}"
|
||||
}
|
||||
|
||||
@ -2112,7 +2112,8 @@
|
||||
"in-dossier": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
"label": "",
|
||||
"tooltip": ""
|
||||
},
|
||||
"only-here": {
|
||||
"description": "",
|
||||
@ -2121,8 +2122,7 @@
|
||||
},
|
||||
"original-text": "",
|
||||
"resized-text": "",
|
||||
"type": "",
|
||||
"update-dictionary": ""
|
||||
"type": ""
|
||||
},
|
||||
"header": ""
|
||||
}
|
||||
|
||||
@ -2112,7 +2112,8 @@
|
||||
"in-dossier": {
|
||||
"description": "Resize in every document in {dossierName}.",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "Resize in dossier"
|
||||
"label": "Resize in dossier",
|
||||
"tooltip": "Only available for dictionary-based types"
|
||||
},
|
||||
"only-here": {
|
||||
"description": "Resize only at this position in this document.",
|
||||
@ -2121,8 +2122,7 @@
|
||||
},
|
||||
"original-text": "Original text:",
|
||||
"resized-text": "Resized text:",
|
||||
"type": "Type",
|
||||
"update-dictionary": "Update dictionary: {text}"
|
||||
"type": "Type"
|
||||
},
|
||||
"header": "Resize {type}"
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 2524896f460594d7766a7c572b63cd3199eac7db
|
||||
Subproject commit 8f4cc53d0f814d3f222801379497cff40d7801ee
|
||||
Loading…
x
Reference in New Issue
Block a user