From 6d5ef47405867ec4e2de41497f60e9e163793013 Mon Sep 17 00:00:00 2001 From: annampak Date: Thu, 21 Sep 2017 13:34:55 +0300 Subject: [PATCH] delete file --- .../app/services/fieldVisibility.service.ts | 127 ------------------ 1 file changed, 127 deletions(-) delete mode 100644 dmp-frontend/src/app/services/fieldVisibility.service.ts diff --git a/dmp-frontend/src/app/services/fieldVisibility.service.ts b/dmp-frontend/src/app/services/fieldVisibility.service.ts deleted file mode 100644 index 6d4cd2c45..000000000 --- a/dmp-frontend/src/app/services/fieldVisibility.service.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { Injectable } from '@angular/core'; -import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown'; -import { FieldBase } from '../../app/form/fields/field-base'; -import { TextboxField } from '../../app/form/fields/textbox/field-textbox'; -import { CheckBoxField } from '../../app/form/fields/checkbox/field-checkbox'; -import { DataModel } from '../entities/DataModel'; -import {Rule} from '../entities/common/rule'; -import { GroupBase } from '../form/dynamic-form-group/group-base'; - -@Injectable() -export class FieldVisibility { - - private dataModel : DataModel; - - public getDataModel(fields:any[]){ - - if(this.dataModel != null) - return this.dataModel; - - this.dataModel = new DataModel(); - this.dataModel.fields = this.getFieldVisibility(fields); - this.dataModel.groups = this.getGroups(); - - return this.dataModel; - } - - - private getFieldVisibility(fields:any[]) { - console.log(fields); - let fieldsVisible :FieldBase[] =[]; - fields.forEach(element => { - if (element.viewStyle._renderstyle == "freetext"){ - let newfield:FieldBase ; - let rule = new Rule(); - //rule.target = element.visible.rule._target; - //rule.ruleType = element.visible.rule._type; - newfield = new TextboxField({ - label: element._id, - key:element.title.__cdata, - value: 'DMP1', - required: true, - ordinal:element._ordinal, - rules: new Array(), - visible: true, - group : element._group - }); - if (element.visible.rule) - if(element.visible.rule.length){ - element.visible.rule.forEach(rule => { - newfield.rules.push(rule) - }); - } - else { - newfield.rules.push(element.visible.rule) - } - - fieldsVisible.push(newfield); - } - if (element.viewStyle._renderstyle == "combobox"){ - let newfield:DropdownField; - let rule = new Rule(); - //rule.target = element.visible.rule._target; - //rule.ruleType = element.visible.rule._type; - newfield = new DropdownField({ - label: element._id, - key:element.title.__cdata, - value: 'DMP1', - required: true, - ordinal:element._ordinal, - rule: element.visible.rule, - visible: true - }); - fieldsVisible.push(newfield); - } - }); - fieldsVisible.sort((a, b) => a.order - b.order); - return fieldsVisible; - } - - private getGroups(){ - - let groups :GroupBase[] =[]; - - - let group: GroupBase; - group = new GroupBase({ - key: "adfgadfsg", - title: "GroupA", - rules: new Array(), - groupFields: new Array(), - //value = "value", - visible: true, - order: 1 - //, - //controlType: "none" - }); - - - let newfield1:FieldBase ; - newfield1 = new TextboxField({ - key:"tf1-455", - label: "Field from group1", - value: 'this is a groupfield', - required: true, - ordinal:1 - }); - group.groupFields.push(newfield1); - - let newfield2:FieldBase ; - newfield2 = new TextboxField({ - key:"tf1-443", - label: "Another field from group1", - value: 'this is a groupfield', - required: true, - ordinal:2 - }); - group.groupFields.push(newfield2); - - groups.push(group); - - - return groups; - - } - - -} \ No newline at end of file