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();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
get #isDossierRedaction(): boolean {
|
|
||||||
return this.entity?.type === 'dossier_redaction';
|
|
||||||
}
|
|
||||||
|
|
||||||
get #isSystemManaged(): boolean {
|
get #isSystemManaged(): boolean {
|
||||||
return !!this.entity?.systemManaged;
|
return !!this.entity?.systemManaged;
|
||||||
}
|
}
|
||||||
@ -132,28 +128,27 @@ export class AddEditEntityComponent extends BaseFormComponent implements OnInit
|
|||||||
hexColor: [this.entity?.hexColor, [Validators.required, Validators.minLength(7)]],
|
hexColor: [this.entity?.hexColor, [Validators.required, Validators.minLength(7)]],
|
||||||
recommendationHexColor: [this.entity?.recommendationHexColor, [Validators.required, Validators.minLength(7)]],
|
recommendationHexColor: [this.entity?.recommendationHexColor, [Validators.required, Validators.minLength(7)]],
|
||||||
skippedHexColor: [this.entity?.skippedHexColor, [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) {
|
if (!this.entity?.hint) {
|
||||||
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) {
|
|
||||||
controlsConfig = {
|
controlsConfig = {
|
||||||
...controlsConfig,
|
...controlsConfig,
|
||||||
defaultReason: [{ value: null, disabled: true }],
|
defaultReason: [{ value: null, disabled: true }],
|
||||||
@ -165,20 +160,18 @@ export class AddEditEntityComponent extends BaseFormComponent implements OnInit
|
|||||||
this.#initializeColors(form);
|
this.#initializeColors(form);
|
||||||
this.technicalName$ = form.get('label').valueChanges.pipe(map((value: string) => this.#toTechnicalName(value)));
|
this.technicalName$ = form.get('label').valueChanges.pipe(map((value: string) => this.#toTechnicalName(value)));
|
||||||
|
|
||||||
if (!this.#isDossierRedaction) {
|
form.get('hint').valueChanges.subscribe(isHint => {
|
||||||
form.get('hint').valueChanges.subscribe(isHint => {
|
if (isHint) {
|
||||||
if (isHint) {
|
REDACTION_FIELDS.forEach(field => form.removeControl(field));
|
||||||
REDACTION_FIELDS.forEach(field => form.removeControl(field));
|
} else {
|
||||||
} else {
|
form.addControl('defaultReason', new UntypedFormControl({ value: null, disabled: true }));
|
||||||
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.entity) {
|
||||||
|
form.get('label').valueChanges.subscribe((label: string) => {
|
||||||
|
form.get('type').setValue(this.#toTechnicalName(label));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.readOnly) {
|
if (this.readOnly) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user