This commit is contained in:
Diamantis Tziotzios 2024-02-01 11:36:55 +02:00
parent 5373e2d867
commit 30902bbab8
3 changed files with 27 additions and 29 deletions

View File

@ -1019,7 +1019,7 @@ export class DescriptionTemplateLabelDataEditorModel implements DescriptionTempl
}
export class DescriptionTemplateLabelAndMultiplicityDataEditorModel extends DescriptionTemplateLabelDataEditorModel implements DescriptionTemplateLabelAndMultiplicityDataPersist {
multipleSelect: boolean;
multipleSelect: boolean = false;
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
constructor(
@ -1029,7 +1029,7 @@ export class DescriptionTemplateLabelAndMultiplicityDataEditorModel extends Desc
fromModel(item: DescriptionTemplateLabelAndMultiplicityDataPersist): DescriptionTemplateLabelAndMultiplicityDataEditorModel {
if (item) {
super.fromModel(item);
this.multipleSelect = item.multipleSelect;
this.multipleSelect = item.multipleSelect ?? false;
}
return this;
}
@ -1158,7 +1158,7 @@ export class DescriptionTemplateExternalDatasetDataEditorModel extends Descripti
//
//
export class DescriptionTemplateExternalSelectDataEditorModel extends DescriptionTemplateLabelDataEditorModel implements DescriptionTemplateExternalSelectDataPersist {
multipleSelect: boolean;
multipleSelect: boolean = false;
sources: DescriptionTemplateExternalSelectSourceEditorModel[] = [];
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
@ -1169,7 +1169,7 @@ export class DescriptionTemplateExternalSelectDataEditorModel extends Descriptio
fromModel(item: DescriptionTemplateExternalSelectDataPersist): DescriptionTemplateExternalSelectDataEditorModel {
if (item) {
super.fromModel(item);
this.multipleSelect = item.multipleSelect;
this.multipleSelect = item.multipleSelect ?? false;
if (item.sources) { item.sources.map(x => this.sources.push(new DescriptionTemplateExternalSelectSourceEditorModel(this.validationErrorModel).fromModel(x))); }
}
return this;
@ -1655,7 +1655,7 @@ export class DescriptionTemplateRadioBoxOptionEditorModel implements Description
//
export class DescriptionTemplateSelectDataEditorModel extends DescriptionTemplateLabelDataEditorModel implements DescriptionTemplateSelectDataPersist {
options: DescriptionTemplateSelectOptionEditorModel[] = [];
multipleSelect: boolean;
multipleSelect: boolean = false;
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
constructor(
@ -1665,7 +1665,7 @@ export class DescriptionTemplateSelectDataEditorModel extends DescriptionTemplat
fromModel(item: DescriptionTemplateSelectDataPersist): DescriptionTemplateSelectDataEditorModel {
if (item) {
super.fromModel(item);
this.multipleSelect = item.multipleSelect;
this.multipleSelect = item.multipleSelect ?? false;
if (item.options) { item.options.map(x => this.options.push(new DescriptionTemplateSelectOptionEditorModel(this.validationErrorModel).fromModel(x))); }
}
return this;

View File

@ -139,7 +139,7 @@
<div *ngIf="field.category === dmpBlueprintSectionFieldCategoryEnum.SYSTEM">
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.TEXT">
<mat-form-field class="w-100">
<input matInput placeholder="{{'DMP-EDITOR.FIELDS.TITLE' | translate}}" type="text" name="label" [formControl]="formGroup.get('label')" required>
<input matInput placeholder="{{field.placeholder ?? 'DMP-EDITOR.FIELDS.TITLE' | translate}}" type="text" name="label" [formControl]="formGroup.get('label')" required>
<mat-error *ngIf="formGroup.get('label').hasError('backendError')">
{{formGroup.get('label').getError('backendError').message}}</mat-error>
<mat-error *ngIf="formGroup.get('label').hasError('required')">
@ -295,6 +295,7 @@
</div>
</div>
</div>
</div>
<div class="col-12 card" *ngIf="section.hasTemplates">
{{formGroup.get('descriptionTemplates').get(section.id).value | json}}
<div class="row">
@ -322,4 +323,3 @@
</div>
</div>
</div>
</div>

View File

@ -193,9 +193,7 @@ export class DmpPropertiesEditorModel implements DmpPropertiesPersist {
const formGroup = this.formBuilder.group({
contacts: this.formBuilder.array(
(this.contacts ?? []).map(
(item, index) => new DmpContactEditorModel(
this.validationErrorModel
).fromModel(item).buildForm({
(item, index) => item.buildForm({
rootPath: `${rootPath}contacts[${index}].`
})
), context.getValidation('contacts').validators
@ -350,7 +348,7 @@ export class DmpContactEditorModel implements DmpContactPersist {
this.firstName = item.firstName;
this.lastName = item.lastName;
this.email = item.email;
this.contactType = item == null ? DmpContactType.Internal : (this.userId != null ? DmpContactType.Internal : DmpContactType.External);
this.contactType = (item == null || this.userId != null) ? DmpContactType.Internal : DmpContactType.External;
return this;
}