DM-414 fix save button not enabled
This commit is contained in:
parent
6fa0a7860c
commit
7cb9c3604a
@ -4,12 +4,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dialog-content">
|
<div class="dialog-content">
|
||||||
<redaction-add-edit-entity
|
<redaction-add-edit-entity [dossierTemplateId]="data.dossierTemplateId" [entity]="null"></redaction-add-edit-entity>
|
||||||
#redactionAddEditEntity
|
|
||||||
[dossierTemplateId]="data.dossierTemplateId"
|
|
||||||
[entity]="null"
|
|
||||||
[readOnly]="false"
|
|
||||||
></redaction-add-edit-entity>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dialog-actions">
|
<div class="dialog-actions">
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { ChangeDetectionStrategy, Component, inject, ViewChild } from '@angular/core';
|
import { Component, inject, ViewChild } from '@angular/core';
|
||||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { AddEditEntityComponent } from '@shared/components/add-edit-entity/add-edit-entity.component';
|
|
||||||
import { BaseDialogComponent, getConfig, IconButtonTypes } from '@iqser/common-ui';
|
import { BaseDialogComponent, getConfig, IconButtonTypes } from '@iqser/common-ui';
|
||||||
|
import { AddEditEntityComponent } from '@shared/components/add-edit-entity/add-edit-entity.component';
|
||||||
|
|
||||||
interface DialogData {
|
interface DialogData {
|
||||||
readonly dossierTemplateId: string;
|
readonly dossierTemplateId: string;
|
||||||
@ -10,7 +10,6 @@ interface DialogData {
|
|||||||
@Component({
|
@Component({
|
||||||
templateUrl: './add-entity-dialog.component.html',
|
templateUrl: './add-entity-dialog.component.html',
|
||||||
styleUrls: ['./add-entity-dialog.component.scss'],
|
styleUrls: ['./add-entity-dialog.component.scss'],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
||||||
})
|
})
|
||||||
export class AddEntityDialogComponent extends BaseDialogComponent {
|
export class AddEntityDialogComponent extends BaseDialogComponent {
|
||||||
@ViewChild(AddEditEntityComponent, { static: true }) private readonly _addEditEntityComponent: AddEditEntityComponent;
|
@ViewChild(AddEditEntityComponent, { static: true }) private readonly _addEditEntityComponent: AddEditEntityComponent;
|
||||||
@ -30,6 +29,10 @@ export class AddEntityDialogComponent extends BaseDialogComponent {
|
|||||||
return this._addEditEntityComponent.changed;
|
return this._addEditEntityComponent.changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get disabled(): boolean {
|
||||||
|
return this._addEditEntityComponent.disabled;
|
||||||
|
}
|
||||||
|
|
||||||
async save(): Promise<void> {
|
async save(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await this._addEditEntityComponent.save();
|
await this._addEditEntityComponent.save();
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit } from '@angular/core';
|
import { booleanAttribute, ChangeDetectorRef, Component, Input, OnInit } from '@angular/core';
|
||||||
import { Dictionary, IDictionary } from '@red/domain';
|
|
||||||
import { FormGroup, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
|
import { FormGroup, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
|
||||||
import { map, startWith } from 'rxjs/operators';
|
|
||||||
import { firstValueFrom, Observable } from 'rxjs';
|
|
||||||
import { toSnakeCase } from '@utils/functions';
|
|
||||||
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
|
||||||
import { BaseFormComponent, getConfig, LoadingService, Toaster } from '@iqser/common-ui';
|
import { BaseFormComponent, getConfig, LoadingService, Toaster } from '@iqser/common-ui';
|
||||||
|
import { Dictionary, IDictionary } from '@red/domain';
|
||||||
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||||
|
import { toSnakeCase } from '@utils/functions';
|
||||||
|
import { firstValueFrom, Observable } from 'rxjs';
|
||||||
|
import { map, startWith } from 'rxjs/operators';
|
||||||
|
|
||||||
const REDACTION_FIELDS = ['defaultReason'];
|
const REDACTION_FIELDS = ['defaultReason'];
|
||||||
|
|
||||||
@ -20,15 +20,14 @@ interface Color {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-add-edit-entity [entity] [dossierTemplateId] [readOnly]',
|
selector: 'redaction-add-edit-entity [entity] [dossierTemplateId]',
|
||||||
templateUrl: './add-edit-entity.component.html',
|
templateUrl: './add-edit-entity.component.html',
|
||||||
styleUrls: ['./add-edit-entity.component.scss'],
|
styleUrls: ['./add-edit-entity.component.scss'],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
||||||
})
|
})
|
||||||
export class AddEditEntityComponent extends BaseFormComponent implements OnInit {
|
export class AddEditEntityComponent extends BaseFormComponent implements OnInit {
|
||||||
@Input() dossierTemplateId: string;
|
@Input({ required: true }) dossierTemplateId: string;
|
||||||
@Input() entity: Dictionary;
|
@Input({ required: true }) entity: Dictionary;
|
||||||
@Input() readOnly: boolean;
|
@Input({ transform: booleanAttribute }) readOnly = false;
|
||||||
@Input() dossierId?: string;
|
@Input() dossierId?: string;
|
||||||
|
|
||||||
technicalName$: Observable<string>;
|
technicalName$: Observable<string>;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user