diff --git a/apps/red-ui/src/app/modules/admin/shared/components/add-edit-entity/add-edit-entity.component.ts b/apps/red-ui/src/app/modules/admin/shared/components/add-edit-entity/add-edit-entity.component.ts index 1a8194c0d..90ce98b15 100644 --- a/apps/red-ui/src/app/modules/admin/shared/components/add-edit-entity/add-edit-entity.component.ts +++ b/apps/red-ui/src/app/modules/admin/shared/components/add-edit-entity/add-edit-entity.component.ts @@ -10,7 +10,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { DictionaryService } from '@services/entity-services/dictionary.service'; import { BaseFormComponent, LoadingService, Toaster } from '@iqser/common-ui'; -const REDACTION_FIELDS = ['defaultReason', 'caseSensitive', 'addToDictionaryAction']; +const REDACTION_FIELDS = ['defaultReason', 'addToDictionaryAction']; @Component({ selector: 'redaction-add-edit-entity [entity] [dossierTemplateId]', @@ -38,10 +38,6 @@ export class AddEditEntityComponent extends BaseFormComponent implements OnInit super(); } - get #caseSensitiveControl() { - return { value: this.entity ? !this.entity.caseInsensitive : false, disabled: this.#isSystemManaged }; - } - get #isSystemManaged(): boolean { return !!this.entity?.systemManaged; } @@ -91,12 +87,12 @@ export class AddEditEntityComponent extends BaseFormComponent implements OnInit recommendationHexColor: [this.entity?.recommendationHexColor, [Validators.required, Validators.minLength(7)]], hint: [{ value: !!this.entity?.hint, disabled: this.#isSystemManaged }], hasDictionary: [{ value: !!this.entity?.hasDictionary, disabled: this.#isSystemManaged }], + caseSensitive: [{ value: this.entity ? !this.entity.caseInsensitive : false, disabled: this.#isSystemManaged }], }; if (!this.entity?.hint) { Object.assign(controlsConfig, { defaultReason: [{ value: null, disabled: true }], - caseSensitive: [this.#caseSensitiveControl], }); if (this.entity?.hasDictionary) { @@ -116,7 +112,6 @@ export class AddEditEntityComponent extends BaseFormComponent implements OnInit REDACTION_FIELDS.forEach(field => form.removeControl(field)); } else { form.addControl('defaultReason', new FormControl({ value: null, disabled: true })); - form.addControl('caseSensitive', new FormControl(this.#caseSensitiveControl)); if (form.get('hasDictionary').value) { form.addControl('addToDictionaryAction', new FormControl(this.#addToDictionaryActionControl)); @@ -167,7 +162,6 @@ export class AddEditEntityComponent extends BaseFormComponent implements OnInit private _formToObject(): IDictionary { // Fields that aren't set for hints, need additional check - const caseInsensitive = this.form.get('caseSensitive') ? !this.form.get('caseSensitive').value : null; const addToDictionaryAction = !!this.form.get('addToDictionaryAction')?.value; const hasDictionary = !!this.form.get('hasDictionary')?.value; @@ -180,7 +174,7 @@ export class AddEditEntityComponent extends BaseFormComponent implements OnInit hint: this.form.get('hint').value, rank: this.form.get('rank').value, dossierTemplateId: this.dossierTemplateId, - caseInsensitive, + caseInsensitive: !this.form.get('caseSensitive').value, addToDictionaryAction, hasDictionary, };