diff --git a/dmp-frontend/src/app/form/fields/dynamic-form-field.component.html b/dmp-frontend/src/app/form/fields/dynamic-form-field.component.html index d41023252..eb1141ace 100644 --- a/dmp-frontend/src/app/form/fields/dynamic-form-field.component.html +++ b/dmp-frontend/src/app/form/fields/dynamic-form-field.component.html @@ -34,25 +34,23 @@ - - + -
- -
- - -
-
-
+
+ +
+ + +
+
+
diff --git a/dmp-frontend/src/app/form/fields/dynamic-form-field.component.ts b/dmp-frontend/src/app/form/fields/dynamic-form-field.component.ts index 894a6ff9f..856eee33e 100644 --- a/dmp-frontend/src/app/form/fields/dynamic-form-field.component.ts +++ b/dmp-frontend/src/app/form/fields/dynamic-form-field.component.ts @@ -31,9 +31,9 @@ export class DynamicFormFieldComponent { if(field.visible == true) return true; } - FieldValueRuleMethod(field, rule, dataModel){ //fieldValue rule -- checks the value of target + FieldValueRuleMethod(field, rule){ //fieldValue rule -- checks the value of target if (rule._ruleStyle == "range"){ - dataModel.fields.forEach(fld => { + this.dataModel.fields.forEach(fld => { if (fld.key == rule._target && rule._from< fld.value ; - // group = this.dataModel.groups.find(x => x.key === field.group); - // group.groupFields.forEach(element => {debugger; - // if (element.order == (field.order + 1)){ - // element.rules.forEach(element => { - // if (element.target == field.id){ - // console.log (element); - // } - - // }); - // } - // }); - // console.log(this.dataModel); - + toggleVisibility(e, field, ckb){ + console.log(field);debugger; + if(ckb) + field.value = ckb.checked; + field.rules.forEach(rule => { + if (rule._type=="fieldValue"){ + this.FieldValueRuleMethod(field, rule); + } + }); } } \ No newline at end of file diff --git a/dmp-frontend/src/app/services/dataModelBuilder.service.ts b/dmp-frontend/src/app/services/dataModelBuilder.service.ts index 57bcf4e6f..657f392f4 100644 --- a/dmp-frontend/src/app/services/dataModelBuilder.service.ts +++ b/dmp-frontend/src/app/services/dataModelBuilder.service.ts @@ -25,6 +25,7 @@ export class dataModelBuilder { this.fields = this.buildFields(data.dataset.profile.viewstyle.definition.root.fields.field); this.dataModel.groups = this.getGroups(data.dataset.profile.viewstyle.definition.root.fieldGroups.fieldGroup, fldGroup, this.fields); //this.getDummyGroups(); + this.dataModel.buildIndex(); return this.dataModel; } @@ -97,11 +98,13 @@ export class dataModelBuilder { answers: [ { id: 1, - answer: "Yes" + answer: "Yes", + value: true }, { id: 2, - answer: "No" + answer: "No", + value:false }] }); fieldsVisible.push(newfield);