From f558910905931bb414c537849397f3937e452083 Mon Sep 17 00:00:00 2001 From: annampak Date: Tue, 28 Nov 2017 13:42:30 +0200 Subject: [PATCH] fixes, add ordinal & multiplicity fields --- .../compositefield-form.component.html | 33 ++++++++++++------- .../app/field-form/field-form.component.html | 16 ++++++--- .../groupfield-form.component.html | 8 ++--- dmp-admin/src/app/models/CompositeField.ts | 7 ++-- dmp-admin/src/app/models/Field.ts | 8 ++++- .../section-form/section-form.component.html | 2 +- 6 files changed, 51 insertions(+), 23 deletions(-) diff --git a/dmp-admin/src/app/compositefield-form/compositefield-form.component.html b/dmp-admin/src/app/compositefield-form/compositefield-form.component.html index 6f44aa2d4..8973b51c4 100644 --- a/dmp-admin/src/app/compositefield-form/compositefield-form.component.html +++ b/dmp-admin/src/app/compositefield-form/compositefield-form.component.html @@ -1,12 +1,23 @@ -
-

FieldSet

-
- +
+

FieldSet

+
+
+
+
+ + +
+
+
- - -
+
+
+ +
+ +
+ + Add another field + + +
+
\ No newline at end of file diff --git a/dmp-admin/src/app/field-form/field-form.component.html b/dmp-admin/src/app/field-form/field-form.component.html index 1fea8d714..26e2884f3 100644 --- a/dmp-admin/src/app/field-form/field-form.component.html +++ b/dmp-admin/src/app/field-form/field-form.component.html @@ -35,12 +35,12 @@
- +
-
- +
+ @@ -48,13 +48,21 @@ false
+
+ + +
+
+ + +
-
+
Add another rule + 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 d22e9f3c6..6aadc154c 100644 --- a/dmp-admin/src/app/groupfield-form/groupfield-form.component.html +++ b/dmp-admin/src/app/groupfield-form/groupfield-form.component.html @@ -1,4 +1,4 @@ -
+

GroupFields

@@ -11,17 +11,17 @@
- +
- +
- +
diff --git a/dmp-admin/src/app/models/CompositeField.ts b/dmp-admin/src/app/models/CompositeField.ts index 4de8a6122..02e55f321 100644 --- a/dmp-admin/src/app/models/CompositeField.ts +++ b/dmp-admin/src/app/models/CompositeField.ts @@ -5,16 +5,19 @@ import { BaseModel } from './BaseModel'; import {Field} from './Field' export class CompositeField extends BaseModel implements Serializable { public fields:Array = new Array(); - + public multiplicity:number; fromJSONObject(item:any):CompositeField{ this.fields = new JsonSerializer().fromJSONArray(item.fields,Field); + this.multiplicity = item.multiplicity; return this; } buildForm():FormGroup{ - let formGroup = this.formBuilder.group({}); + let formGroup = this.formBuilder.group({ + multiplicity:[this.multiplicity] + }); let fieldsFormArray = new Array(); this.fields.forEach(item => { diff --git a/dmp-admin/src/app/models/Field.ts b/dmp-admin/src/app/models/Field.ts index e512ddfee..0de1568aa 100644 --- a/dmp-admin/src/app/models/Field.ts +++ b/dmp-admin/src/app/models/Field.ts @@ -15,6 +15,8 @@ export class Field extends BaseModel implements Serializable,FormGenerato public viewStyle:string; public defaultVisibility:boolean; public page:number; + public multiplicity: number; + public ordinal: number; public rules: Array = new Array(); fromJSONObject(item:any):Field{ @@ -26,6 +28,8 @@ export class Field extends BaseModel implements Serializable,FormGenerato this.viewStyle = item.viewStyle; this.defaultVisibility = item.defaultVisibility; this.page = item.page; + this.multiplicity = item.multiplicity; + this.ordinal = item.ordinal; this.rules = new JsonSerializer().fromJSONArray(item.rule, Rule); return this; } @@ -39,7 +43,9 @@ export class Field extends BaseModel implements Serializable,FormGenerato extendedDescription:[this.extendedDescription], viewStyle: [this.viewStyle], defaultVisibility:[this.defaultVisibility], - page:[this.page] + page:[this.page] , + multiplicity: [this.multiplicity], + ordinal:[this.ordinal] }); let rulesFormArray = new Array(); 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 fd537e14d..c72b5c26c 100644 --- a/dmp-admin/src/app/section-form/section-form.component.html +++ b/dmp-admin/src/app/section-form/section-form.component.html @@ -1,4 +1,4 @@ -
+

Section