description template editor, plan/description status editor > small fixes on forms

This commit is contained in:
mchouliara 2024-10-04 17:02:10 +03:00
parent 60b2e9cb90
commit acbfd8f7cb
4 changed files with 9 additions and 2 deletions

View File

@ -101,7 +101,9 @@ export class DescriptionStatusEditorModel extends BaseEditorModel implements Des
export interface DescriptionStatusForm {
id: FormControl<Guid>;
hash: FormControl<string>;
name: FormControl<string>;
action: FormControl<string>;
description: FormControl<string>;
internalStatus: FormControl<DescriptionStatusEnum>;
definition: FormGroup<DescriptionStatusDefinitionForm>;

View File

@ -130,7 +130,7 @@
</ng-container>
<div class="col-auto">
<mat-checkbox [formControl]="this.form.get('includeInExport')" [disabled]="viewOnly">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD-SET.FIELDS.EXPORT' | translate}}</mat-checkbox>
<mat-checkbox [formControl]="this.form.get('includeInExport')">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD-SET.FIELDS.EXPORT' | translate}}</mat-checkbox>
<mat-error *ngIf="form.get('includeInExport').hasError('backendError')">{{form.get('includeInExport').getError('backendError').message}}</mat-error>
</div>

View File

@ -62,7 +62,7 @@ export class DescriptionTemplateEditorModel extends BaseEditorModel implements D
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup<DescriptionTemplateForm> {
if (context == null) { context = this.createValidationContext(); }
return this.formBuilder.group({
const formGroup = this.formBuilder.group({
id: [{ value: this.id, disabled }, context.getValidation('id').validators],
label: [{ value: this.label, disabled }, context.getValidation('label').validators],
code: [{ value: this.code, disabled: !!this.id ?? disabled }, context.getValidation('code').validators],
@ -83,6 +83,10 @@ export class DescriptionTemplateEditorModel extends BaseEditorModel implements D
),
hash: [{ value: this.hash, disabled }, context.getValidation('hash').validators]
});
if(disabled){
formGroup.disable();
}
return formGroup;
}
createValidationContext(): ValidationContext {

View File

@ -104,6 +104,7 @@ export interface PlanStatusForm {
id: FormControl<Guid>;
hash: FormControl<string>;
name: FormControl<string>;
action: FormControl<string>;
description: FormControl<string>;
internalStatus: FormControl<PlanStatusEnum>;
definition: FormGroup<PlanStatusDefinitionForm>;