Merge branch 'RED-8639' into 'master'
RED-8639: fixed settings options for dossier dictionary only entities. See merge request redactmanager/red-ui!322
This commit is contained in:
commit
20d8a8d10e
@ -46,10 +46,6 @@ export class AddEditEntityComponent extends BaseFormComponent implements OnInit
|
||||
super();
|
||||
}
|
||||
|
||||
get #isDossierRedaction(): boolean {
|
||||
return this.entity?.type === 'dossier_redaction';
|
||||
}
|
||||
|
||||
get #isSystemManaged(): boolean {
|
||||
return !!this.entity?.systemManaged;
|
||||
}
|
||||
@ -132,28 +128,27 @@ export class AddEditEntityComponent extends BaseFormComponent implements OnInit
|
||||
hexColor: [this.entity?.hexColor, [Validators.required, Validators.minLength(7)]],
|
||||
recommendationHexColor: [this.entity?.recommendationHexColor, [Validators.required, Validators.minLength(7)]],
|
||||
skippedHexColor: [this.entity?.skippedHexColor, [Validators.required, Validators.minLength(7)]],
|
||||
type: [this.entity?.type],
|
||||
description: [this.entity?.description],
|
||||
rank: [{ value: this.entity?.rank, disabled: this.#isSystemManaged }, Validators.required],
|
||||
hint: [{ value: !!this.entity?.hint, disabled: this.#isSystemManaged }],
|
||||
hasDictionary: [
|
||||
{
|
||||
value: !!this.entity?.hasDictionary,
|
||||
disabled: this.#isSystemManaged || (this.entity?.dossierDictionaryOnly && this.entity?.hasDictionary),
|
||||
},
|
||||
],
|
||||
dossierDictionaryOnly: [{ value: !!this.entity?.dossierDictionaryOnly, disabled: this.#isSystemManaged || this.entity }],
|
||||
caseSensitive: [{ value: !this.entity?.caseInsensitive, disabled: this.#isSystemManaged }],
|
||||
manageEntriesInDictionaryEditorOnly: [
|
||||
{
|
||||
value: this.entity?.addToDictionaryAction,
|
||||
disabled: this.#isSystemManaged,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
if (!this.#isDossierRedaction) {
|
||||
controlsConfig = {
|
||||
...controlsConfig,
|
||||
type: [this.entity?.type],
|
||||
description: [this.entity?.description],
|
||||
rank: [{ value: this.entity?.rank, disabled: this.#isSystemManaged }, Validators.required],
|
||||
hint: [{ value: !!this.entity?.hint, disabled: this.#isSystemManaged }],
|
||||
hasDictionary: [{ value: !!this.entity?.hasDictionary, disabled: this.#isSystemManaged }],
|
||||
dossierDictionaryOnly: [{ value: !!this.entity?.dossierDictionaryOnly, disabled: this.#isSystemManaged || this.entity }],
|
||||
caseSensitive: [{ value: !this.entity?.caseInsensitive, disabled: this.#isSystemManaged }],
|
||||
manageEntriesInDictionaryEditorOnly: [
|
||||
{
|
||||
value: this.entity?.addToDictionaryAction,
|
||||
disabled: this.#isSystemManaged && !this.#isDossierRedaction,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
if (!this.entity?.hint && !this.#isDossierRedaction) {
|
||||
if (!this.entity?.hint) {
|
||||
controlsConfig = {
|
||||
...controlsConfig,
|
||||
defaultReason: [{ value: null, disabled: true }],
|
||||
@ -165,20 +160,18 @@ export class AddEditEntityComponent extends BaseFormComponent implements OnInit
|
||||
this.#initializeColors(form);
|
||||
this.technicalName$ = form.get('label').valueChanges.pipe(map((value: string) => this.#toTechnicalName(value)));
|
||||
|
||||
if (!this.#isDossierRedaction) {
|
||||
form.get('hint').valueChanges.subscribe(isHint => {
|
||||
if (isHint) {
|
||||
REDACTION_FIELDS.forEach(field => form.removeControl(field));
|
||||
} else {
|
||||
form.addControl('defaultReason', new UntypedFormControl({ value: null, disabled: true }));
|
||||
}
|
||||
});
|
||||
|
||||
if (!this.entity) {
|
||||
form.get('label').valueChanges.subscribe((label: string) => {
|
||||
form.get('type').setValue(this.#toTechnicalName(label));
|
||||
});
|
||||
form.get('hint').valueChanges.subscribe(isHint => {
|
||||
if (isHint) {
|
||||
REDACTION_FIELDS.forEach(field => form.removeControl(field));
|
||||
} else {
|
||||
form.addControl('defaultReason', new UntypedFormControl({ value: null, disabled: true }));
|
||||
}
|
||||
});
|
||||
|
||||
if (!this.entity) {
|
||||
form.get('label').valueChanges.subscribe((label: string) => {
|
||||
form.get('type').setValue(this.#toTechnicalName(label));
|
||||
});
|
||||
}
|
||||
|
||||
if (this.readOnly) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user