RED-7155 - added back "apply to all dossiers" checkbox

This commit is contained in:
Valentin Mihai 2023-07-25 20:23:31 +03:00
parent 11cd73e3bd
commit 860c989a44
4 changed files with 28 additions and 5 deletions

View File

@ -24,6 +24,8 @@ export class ResizeRedactionDialogComponent
redaction: AnnotationWrapper;
form!: UntypedFormGroup;
#applyToAllDossiers: boolean;
readonly #dossier: Dossier;
readonly #isRss = this._iqserPermissionsService.has(Roles.getRss);
@ -35,8 +37,15 @@ export class ResizeRedactionDialogComponent
) {
super();
this.#dossier = _activeDossiersService.find(this.data.dossierId);
this.#applyToAllDossiers = this.data.applyToAllDossiers ?? true;
this.redaction = this.data.redaction;
this.options = getResizeRedactionOptions(this.redaction, this.#dossier, this.#isRss);
this.options = getResizeRedactionOptions(
this.redaction,
this.#dossier,
this.#isRss,
this.#applyToAllDossiers,
this.data.isApprover,
);
this.form = this.#getForm();
}

View File

@ -227,10 +227,14 @@ 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,
applyToAllDossiers: isApprover && dossierTemplate.applyDictionaryUpdatesToAllDossiersByDefault,
isApprover,
dossierId: dossier.dossierId,
};

View File

@ -69,6 +69,8 @@ export const getResizeRedactionOptions = (
redaction: AnnotationWrapper,
dossier: Dossier,
isRss: boolean,
applyToAllDossiers: boolean,
isApprover: boolean,
): DetailsRadioOption<ResizeRedactionOption>[] => {
const translations = resizeRedactionTranslations;
const options: DetailsRadioOption<ResizeRedactionOption>[] = [
@ -89,6 +91,11 @@ export const getResizeRedactionOptions = (
tooltip: !dictBasedType ? translations.inDossier.tooltip : null,
icon: FOLDER_ICON,
value: RedactOrHintOptions.IN_DOSSIER,
extraOption: {
label: translations.inDossier.extraOptionLabel,
checked: applyToAllDossiers,
hidden: !isApprover,
},
});
}
return options;

View File

@ -23,20 +23,23 @@ export interface RedactTextResult {
export type AddHintResult = RedactTextResult;
export type AddAnnotationResult = RedactTextResult;
export interface ResizeRedactionData {
export interface ResizeAnnotationData {
redaction: AnnotationWrapper;
text: string;
dossierId: string;
}
export type ResizeAnnotationData = ResizeRedactionData;
export interface ResizeRedactionData extends ResizeAnnotationData {
applyToAllDossiers?: boolean;
isApprover?: boolean;
}
export interface ResizeRedactionResult {
export interface ResizeAnnotationResult {
comment: string;
updateDictionary: boolean;
}
export type ResizeAnnotationResult = ResizeRedactionResult;
export type ResizeRedactionResult = ResizeAnnotationResult;
export interface RemoveRedactionPermissions {
canRemoveOnlyHere: boolean;