small fixes plan blueprint editor
This commit is contained in:
parent
481e712edd
commit
83091ee428
|
@ -106,7 +106,7 @@
|
|||
<div class="col-12 col-xl-4">
|
||||
<mat-form-field class="mt-3 w-100">
|
||||
<mat-label>{{'PLAN-BLUEPRINT-EDITOR.FIELDS.CATEGORY' | translate}}</mat-label>
|
||||
<mat-select [formControl]="field.get('category')" [disabled]="field.disabled" (selectionChange)="fieldCategoryChanged(sectionIndex, fieldIndex)">
|
||||
<mat-select [formControl]="field.get('category')" (selectionChange)="fieldCategoryChanged(sectionIndex, fieldIndex)">
|
||||
<mat-option *ngFor="let fieldCategory of planBlueprintFieldCategoryEnum" [value]="fieldCategory">{{enumUtils.toPlanBlueprintFieldCategoryString(fieldCategory)}}</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="field.get('category').hasError('backendError')">{{field.get('category').getError('backendError').message}}</mat-error>
|
||||
|
@ -116,7 +116,7 @@
|
|||
<div class="col-12 col-xl-4" *ngIf="field.get('category').value === planBlueprintSectionFieldCategory.System">
|
||||
<mat-form-field class="mt-3 w-100">
|
||||
<mat-label>{{'PLAN-BLUEPRINT-EDITOR.FIELDS.SYSTEM-FIELD-TYPE' | translate}}</mat-label>
|
||||
<mat-select [formControl]="field.get('systemFieldType')" [disabled]="field.disabled">
|
||||
<mat-select [formControl]="field.get('systemFieldType')">
|
||||
<mat-option *ngFor="let systemFieldType of planBlueprintSystemFieldTypeEnum" [disabled]="systemFieldDisabled(systemFieldType)" [value]="systemFieldType">{{enumUtils.toPlanBlueprintSystemFieldTypeString(systemFieldType)}}</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="field.get('systemFieldType').hasError('backendError')">{{field.get('systemFieldType').getError('backendError').message}}</mat-error>
|
||||
|
|
|
@ -180,13 +180,9 @@ export class PlanBlueprintEditorComponent extends BaseEditor<PlanBlueprintEditor
|
|||
|
||||
prepareForm(data: PlanBlueprint) {
|
||||
try {
|
||||
const dataCopy = data ? JSON.parse(JSON.stringify(data)) : null;
|
||||
if(dataCopy && this.isClone) {
|
||||
dataCopy.belongsToCurrentTenant = true;
|
||||
}
|
||||
this.editorModel = dataCopy ? new PlanBlueprintEditorModel().fromModel(dataCopy) : new PlanBlueprintEditorModel();
|
||||
this.isDeleted = dataCopy ? dataCopy.isActive === IsActive.Inactive : false;
|
||||
this.belongsToCurrentTenant = this.isNew || dataCopy.belongsToCurrentTenant;
|
||||
this.editorModel = data ? new PlanBlueprintEditorModel().fromModel(data) : new PlanBlueprintEditorModel();
|
||||
this.isDeleted = data ? data.isActive === IsActive.Inactive : false;
|
||||
this.belongsToCurrentTenant = this.isNew || data.belongsToCurrentTenant;
|
||||
|
||||
this.buildForm();
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ export class PlanBlueprintEditorModel extends BaseEditorModel implements PlanBlu
|
|||
buildForm(context: ValidationContext = null, disabled: boolean = false, isNewOrClone: boolean = false): UntypedFormGroup {
|
||||
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: !isNewOrClone }, context.getValidation('code').validators],
|
||||
|
@ -51,6 +51,7 @@ export class PlanBlueprintEditorModel extends BaseEditorModel implements PlanBlu
|
|||
}),
|
||||
hash: [{ value: this.hash, disabled }, context.getValidation('hash').validators]
|
||||
});
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
createValidationContext(): ValidationContext {
|
||||
|
|
|
@ -78,11 +78,14 @@ export class PlanBlueprintEditorResolver extends BaseEditorResolver {
|
|||
tap(x => this.breadcrumbService.addIdResolvedValue(cloneid, x.label)),
|
||||
takeUntil(this._destroyed),
|
||||
map((blueprint: PlanBlueprint) => {
|
||||
blueprint.id = null;
|
||||
blueprint.hash = null;
|
||||
blueprint.code = null;
|
||||
blueprint.isActive = IsActive.Active;
|
||||
return blueprint;
|
||||
return {
|
||||
...blueprint,
|
||||
id: null,
|
||||
hash: null,
|
||||
code: null,
|
||||
isActive: IsActive.Active,
|
||||
belongsToCurrentTenant: true
|
||||
}
|
||||
}));
|
||||
} else if (newversion != null) {
|
||||
return this.planBlueprintService.getSingle(Guid.parse(newversion), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(newversion, x.label)), takeUntil(this._destroyed));
|
||||
|
|
Loading…
Reference in New Issue