This commit is contained in:
Diamantis Tziotzios 2024-01-29 15:25:59 +02:00
parent 4542189a26
commit 953fa2710e
3 changed files with 4 additions and 11 deletions

View File

@ -14,7 +14,7 @@
<button [disabled]="saving" *ngIf="isDirty()" type="button" mat-raised-button class="discard-btn mr-3" (click)="discard()">
{{'DMP-EDITOR.ACTIONS.DISCARD' | translate}}
</button>
<button [disabled]="saving" *ngIf="isNew" mat-raised-button type="button" (click)="save()" class="save-btn">
<button [disabled]="saving" *ngIf="isNew" mat-raised-button type="button" (click)="formSubmit()" class="save-btn">
{{'DMP-EDITOR.ACTIONS.SAVE' | translate}}
</button>
<div *ngIf="!isNew && formGroup.enabled && !lockStatus">
@ -261,7 +261,6 @@
</div>
</div>
</div>
{{formGroup.value | json}}
</div>
</div>
</div>

View File

@ -199,7 +199,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
if (this.isNew) {
let route = [];
route.push('../' + id);
route.push('/plans/overview/' + id);
this.router.navigate(route, { queryParams: { 'lookup': this.queryParamsService.serializeLookup(this.lookupParams), 'lv': ++this.lv }, replaceUrl: true, relativeTo: this.route });
} else {
this.refreshData();
@ -218,13 +218,6 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
);
}
//Transform properties
// formData.properties.dmpBlueprintValues = [];
// for (const fieldId in (this.formGroup.get('properties').get('dmpBlueprintValues') as UntypedFormGroup).controls) {
// formData.properties.dmpBlueprintValues.push(this.formGroup.get('properties').get('dmpBlueprintValues').get(fieldId).value);
// }
this.dmpService.persist(formData)
.pipe(takeUntil(this._destroyed)).subscribe(
complete => onSuccess ? onSuccess(complete) : this.onCallbackSuccess(complete),
@ -320,6 +313,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
label: this.formGroup.get('label').value,
description: this.formGroup.get('description').value,
blueprint: this.selectedBlueprint,
status: DmpStatus.Draft
}
this.prepareForm(dmp);
}

View File

@ -33,7 +33,7 @@ export class DmpEditorModel extends BaseEditorModel implements DmpPersist {
super.fromModel(item);
this.label = item.label;
this.status = item.status;
this.properties = new DmpPropertiesEditorModel(this.validationErrorModel).fromModel(item.properties, item.dmpReferences.filter(x => x.isActive === IsActive.Active), item.blueprint);
this.properties = new DmpPropertiesEditorModel(this.validationErrorModel).fromModel(item.properties, item.dmpReferences?.filter(x => x.isActive === IsActive.Active), item.blueprint);
this.description = item.description;
this.language = item.language;
this.blueprint = item.blueprint?.id;