From e3863410aa0506eb5104cc1a787c2416136ec606 Mon Sep 17 00:00:00 2001 From: Diamadis Tziotzios Date: Fri, 8 Dec 2017 16:58:23 +0200 Subject: [PATCH] no message --- .../groupfield-form.component.html | 9 +++--- .../section-form/section-form.component.html | 29 ++++++++++++++----- .../section-form/section-form.component.ts | 13 +++++++++ 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/dmp-admin/src/app/groupfield-form/groupfield-form.component.html b/dmp-admin/src/app/groupfield-form/groupfield-form.component.html index 2bc5326fb..3c63d1cd3 100644 --- a/dmp-admin/src/app/groupfield-form/groupfield-form.component.html +++ b/dmp-admin/src/app/groupfield-form/groupfield-form.component.html @@ -1,6 +1,5 @@
- -
+
@@ -59,9 +58,9 @@
-
+
\ No newline at end of file diff --git a/dmp-admin/src/app/section-form/section-form.component.html b/dmp-admin/src/app/section-form/section-form.component.html index 2313a557b..ea9172e17 100644 --- a/dmp-admin/src/app/section-form/section-form.component.html +++ b/dmp-admin/src/app/section-form/section-form.component.html @@ -28,19 +28,19 @@
\ No newline at end of file diff --git a/dmp-admin/src/app/section-form/section-form.component.ts b/dmp-admin/src/app/section-form/section-form.component.ts index fd1f68d8d..50239e796 100644 --- a/dmp-admin/src/app/section-form/section-form.component.ts +++ b/dmp-admin/src/app/section-form/section-form.component.ts @@ -4,6 +4,8 @@ import { Section } from '../models/Section'; import { FieldGroup } from '../models/FieldGroup'; import { FormArray } from '@angular/forms/src/model'; import { DatasetProfileModel } from '../models/DatasetProfileModel'; +import { CompositeField } from '../models/CompositeField'; +import { Field } from '../models/Field'; @Component({ @@ -31,6 +33,17 @@ export class SectionFormComponent { (this.form.get("fieldGroups")).push(fieldGroup.buildForm()); } + addField() { + let fieldSet: CompositeField = new CompositeField(); + let field: Field = new Field(); + let fieldGroup: FieldGroup = new FieldGroup(); + fieldSet.fields.push(field); + fieldGroup.compositeFields.push(fieldSet); + if (this.dataModel.fieldGroups) + this.dataModel.fieldGroups.push(fieldGroup); + (this.form.get("fieldGroups")).push(fieldGroup.buildForm()); + } + DeleteFieldGroup(index) { this.dataModel.fieldGroups.splice(index, 1); (this.form.get("fieldGroups")).removeAt(index)