diff --git a/ng6-seed/package-lock.json b/ng6-seed/package-lock.json
index 2e4cd6022..e076f93e2 100755
--- a/ng6-seed/package-lock.json
+++ b/ng6-seed/package-lock.json
@@ -2002,7 +2002,7 @@
},
"sax": {
"version": "1.2.1",
- "resolved": "http://registry.npmjs.org/sax/-/sax-1.2.1.tgz",
+ "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz",
"integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=",
"dev": true
},
@@ -2483,7 +2483,7 @@
},
"buffer": {
"version": "4.9.1",
- "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz",
"integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=",
"requires": {
"base64-js": "^1.0.2",
@@ -2618,7 +2618,7 @@
},
"calendar-utils": {
"version": "0.1.2",
- "resolved": "http://registry.npmjs.org/calendar-utils/-/calendar-utils-0.1.2.tgz",
+ "resolved": "https://registry.npmjs.org/calendar-utils/-/calendar-utils-0.1.2.tgz",
"integrity": "sha512-9j4Zd1itopNYTSWzFU4MqD2IDHMqznfxsGr8UWGh7hWv+lKzjRJz0LS29iAg5rHtP6+6x3ikQnhoMGqFUzoD2Q=="
},
"caller-callsite": {
@@ -7686,7 +7686,7 @@
},
"lodash": {
"version": "3.10.1",
- "resolved": "http://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",
"integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=",
"dev": true
},
@@ -7874,7 +7874,7 @@
},
"load-json-file": {
"version": "1.1.0",
- "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
"requires": {
"graceful-fs": "^4.1.2",
@@ -7967,7 +7967,7 @@
},
"log4js": {
"version": "0.6.38",
- "resolved": "http://registry.npmjs.org/log4js/-/log4js-0.6.38.tgz",
+ "resolved": "https://registry.npmjs.org/log4js/-/log4js-0.6.38.tgz",
"integrity": "sha1-LElBFmldb7JUgJQ9P8hy5mKlIv0=",
"dev": true,
"requires": {
@@ -8261,7 +8261,7 @@
},
"meow": {
"version": "3.7.0",
- "resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz",
+ "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz",
"integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=",
"requires": {
"camelcase-keys": "^2.0.0",
@@ -8390,7 +8390,7 @@
},
"minimist": {
"version": "1.2.0",
- "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
},
"minipass": {
@@ -8479,7 +8479,7 @@
},
"mkdirp": {
"version": "0.5.1",
- "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"requires": {
"minimist": "0.0.8"
@@ -8487,7 +8487,7 @@
"dependencies": {
"minimist": {
"version": "0.0.8",
- "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
}
}
@@ -8949,7 +8949,7 @@
"dependencies": {
"semver": {
"version": "5.3.0",
- "resolved": "http://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
"integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8="
}
}
@@ -9391,7 +9391,7 @@
"dependencies": {
"minimist": {
"version": "0.0.10",
- "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
"integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=",
"dev": true
},
@@ -9450,7 +9450,7 @@
},
"os-locale": {
"version": "1.4.0",
- "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
+ "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
"requires": {
"lcid": "^1.0.0"
@@ -11964,7 +11964,7 @@
},
"sax": {
"version": "0.5.8",
- "resolved": "http://registry.npmjs.org/sax/-/sax-0.5.8.tgz",
+ "resolved": "https://registry.npmjs.org/sax/-/sax-0.5.8.tgz",
"integrity": "sha1-1HLbIo6zMcJQaw6MFVJK25OdEsE=",
"dev": true
},
@@ -12878,7 +12878,7 @@
},
"sax": {
"version": "0.6.1",
- "resolved": "http://registry.npmjs.org/sax/-/sax-0.6.1.tgz",
+ "resolved": "https://registry.npmjs.org/sax/-/sax-0.6.1.tgz",
"integrity": "sha1-VjsZx8HeiS4Jv8Ty/DDjwn8JUrk=",
"dev": true
},
@@ -13415,7 +13415,7 @@
},
"wrap-ansi": {
"version": "2.1.0",
- "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
"requires": {
"string-width": "^1.0.1",
diff --git a/ng6-seed/src/app/layouts/http-loader/http-loader.component.ts b/ng6-seed/src/app/layouts/http-loader/http-loader.component.ts
index 0e4be33ea..014a94812 100755
--- a/ng6-seed/src/app/layouts/http-loader/http-loader.component.ts
+++ b/ng6-seed/src/app/layouts/http-loader/http-loader.component.ts
@@ -18,7 +18,9 @@ export class HttpLoaderComponent implements OnInit {
ngOnInit() {
this.subscription = this.loaderService.loaderState
.subscribe((state: LoaderState) => {
+ setTimeout(()=>{
this.show = state.show;
+ })
});
}
ngOnDestroy() {
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.html
new file mode 100644
index 000000000..09e114a1e
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.html
@@ -0,0 +1,69 @@
+
\ No newline at end of file
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.spec.ts
new file mode 100644
index 000000000..ad74d0cb1
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { IonicModule } from '@ionic/angular';
+
+import { DynamicFormComponent } from './dynamic-form.component';
+
+describe('DynamicFormComponent', () => {
+ let component: DynamicFormComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ DynamicFormComponent ],
+ imports: [IonicModule.forRoot()]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(DynamicFormComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ }));
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.ts
new file mode 100644
index 000000000..51d62390b
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component.ts
@@ -0,0 +1,68 @@
+import { Component, OnInit, Input } from '@angular/core';
+import { FormGroup, FormBuilder, FormArray } from '@angular/forms';
+import { QuesFormService } from '../ques-form/ques-form.service';
+
+
+@Component({
+ selector: 'app-dynamic-form',
+ templateUrl: './dynamic-form.component.html',
+ styleUrls: ['./dynamic-form.component.scss'],
+})
+export class DynamicFormComponent implements OnInit {
+ // form_group_name: FormGroup;
+ @Input() form_group_name:FormGroup;
+ @Input() questions_JSON:any;
+ @Input() json_answers:any;
+ step: number=0;
+ constructor(private _fb:FormBuilder,private questionService:QuesFormService) { }
+
+ ngOnInit() {
+ // this.form_group_name=new FormGroup({questions:this._fb.array([])})
+ console.log(this.questions_JSON,this.json_answers,this.questionService);
+ this.form_group_name=this.questionService.assignFormControl_array(this.form_group_name,this.questions_JSON.questions)
+ // debugger
+ }
+ ngOnChanges() {
+ console.log(this.questions_JSON,this.json_answers,this.questionService);
+ // this.form_group_name=new FormGroup({questions:this._fb.array([])})
+
+ console.log(this.form_group_name);
+ // this.form_group_name.valueChanges.subscribe(()=>{
+ // this.form_group_name.updateValueAndValidity();
+ // })
+ // debugger;
+ // this.form_group_name.patchValue(this.json_answers)
+ }
+ addData(index,json_obj) {
+ let control_names:any= {}
+ let control = this.form_group_name.get(json_obj.group_key) as FormArray
+ json_obj.question.map(val=>{
+ control_names[val.question_key] = ''
+ })
+ console.log(control,json_obj.group_key,control_names);
+ json_obj.group_questions.push(json_obj.question);
+ control.push(this._fb.group(control_names))
+
+ json_obj.question.forEach((group_indi,arr_index)=>{
+ // console.log("sd",childControl)
+ this.questionService.addAdditionalControl(group_indi, control.controls[control.length-1], arr_index)
+ })
+ json_obj.question = JSON.parse(JSON.stringify(json_obj.question))
+ control.updateValueAndValidity();
+ control.controls[control.length-1].updateValueAndValidity();
+ this.form_group_name.updateValueAndValidity();
+ this.step = control.length-1
+ console.log(this.form_group_name.value);
+ }
+
+ removeData(index,json_obj) {
+ console.log(json_obj)
+ // debugger;
+ let control = this.form_group_name.get(json_obj.group_key) as FormArray
+ control.removeAt(index)
+ json_obj.group_questions.splice(index,1)
+ this.step = control.length-1
+ console.log(json_obj)
+ }
+
+}
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.html
new file mode 100644
index 000000000..05a11f623
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.html
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.scss
new file mode 100644
index 000000000..eec25d91c
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.scss
@@ -0,0 +1,34 @@
+mat-radio-button,mat-checkbox{
+ margin-top: 13px;
+}
+mat-form-field {
+ width: 100%;
+}
+.radio-gap{
+ margin-top: 10px;
+ margin-bottom: 10px;
+}
+.radio-btn-gap{
+ margin:10px;
+}
+
+::ng-deep .mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle{
+ border-color:rgb(212, 15, 15);
+ }
+
+ ::ng-deep .mat-radio-button.mat-accent .mat-radio-inner-circle{
+ color:rgb(212, 15, 15);
+ background-color:rgb(212, 15, 15);
+ }
+
+ ::ng-deep .mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element {
+ background-color:rgba(224, 22, 22, 0.308);
+ }
+ input{
+ // width: 100px;
+ // border-radius: 4px;
+ // border-color: gray;
+ // font-size: 12px;
+ height: 28px;
+
+ }
\ No newline at end of file
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.spec.ts
new file mode 100644
index 000000000..2fbd70c50
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { IonicModule } from '@ionic/angular';
+
+import { DynamicQuestionTemplateComponent } from './dynamic-question-template.component';
+
+describe('DynamicQuestionTemplateComponent', () => {
+ let component: DynamicQuestionTemplateComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ DynamicQuestionTemplateComponent ],
+ imports: [IonicModule.forRoot()]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(DynamicQuestionTemplateComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ }));
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts
new file mode 100644
index 000000000..2a21fa810
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts
@@ -0,0 +1,397 @@
+import { Component, OnInit, Input } from '@angular/core';
+import { FormGroup, FormArray, FormControl } from '@angular/forms';
+import { QuesFormService } from '../ques-form/ques-form.service';
+
+@Component({
+ selector: 'app-dynamic-question-template',
+ templateUrl: './dynamic-question-template.component.html',
+ styleUrls: ['./dynamic-question-template.component.scss'],
+})
+export class DynamicQuestionTemplateComponent implements OnInit {
+ @Input() formGroupN : FormGroup;
+ @Input() currFormArrayObj;
+ parent_ques: any;
+ fileredSearchValue: any=[];
+ @Input() whole_json:any;
+ @Input() json_index:any;
+ @Input() whole_form:FormGroup;
+ @Input() json_answers:any;
+ local_city: any;
+ local_pincode: any;
+ constructor(private quesService:QuesFormService) { }
+
+ ngOnInit() {}
+
+ ngOnChanges() {
+ this.parent_ques = this.currFormArrayObj
+ console.log(this.parent_ques,this.formGroupN);
+ if(this.json_answers!=null && this.json_answers != undefined && this.json_answers) {
+ console.log("ddddddddddddddd",this.json_answers[this.parent_ques.question_key],this.parent_ques)
+ setTimeout(()=>{
+ this.formGroupN.get(this.parent_ques.question_key).patchValue(this.json_answers[this.parent_ques.question_key])
+ this.onChangeProperty({value:this.json_answers[this.parent_ques.question_key]},this.parent_ques,'')
+ })
+ // this.formGroupN.get(this.parent_ques.question_key).patchValue(this.json_answers[this.parent_ques.question_key])
+ // this.onChangeProperty({value:this.json_answers[this.parent_ques.question_key]},this.parent_ques,'')
+ setTimeout(()=>{
+ this.json_answers = null
+ },700)
+ }
+ }
+ onChange_checkbox(event,sec_control){
+ console.log(event,sec_control)
+ const control=this.formGroupN.get(sec_control.question_key) as FormArray
+
+ if(event.checked) {
+ control.push(new FormControl(event.source.value))
+ } else {
+ const i = control.controls.findIndex(x => x.value === event.source.value);
+ control.removeAt(i);
+ }
+ }
+ onChangeProperty(event,sec_control,question_key,options?,sec_index?){
+ this.fileredSearchValue=[]
+
+ if( sec_control.answers!= null && sec_control.answers.length > 0){
+ // this.creatSubField(sec_control,event.value)
+ }
+ //FOR API CALLS
+ // console.log(sec_control.value);
+ if(sec_control.onchange_properties != null && sec_control.onchange_properties.length >0){
+
+ let onChangeProperties_value=sec_control.onchange_properties
+
+// let new_name=`{
+// "purpose":"FORM_CTRL",
+// "form_controls":[
+// {
+// "insert_index":"total_work_exp",
+// "expression":"(total_work_exp > vintage_in_current_biz)",
+// "value_keys":[
+// "total_work_exp",
+// "vintage_in_current_biz"],
+// "questions":[
+// {
+// "question_key":"previous_experience_details2",
+// "question":"Previous Experience2",
+// "type":"1",
+// "api_properties":null,
+// "answers":null,
+// "onchange_properties":null,
+// "is_repeatable":null,
+// "field_type":"string",
+// "validations":[{
+// "isactive": "1",
+// "message": "Name Required",
+// "name": "required",
+// "validator": "Validators.required",
+// "value": null
+// }]
+
+// }]
+
+// },
+// {
+// "insert_index":"vintage_in_current_biz",
+// "expression":"(total_work_exp > vintage_in_current_biz)",
+// "value_keys":[
+// "total_work_exp",
+// "vintage_in_current_biz"],
+// "questions":[{
+// "question_key":"vintage1",
+// "question":"Vintage check",
+// "type":"1",
+// "api_properties":null,
+// "answers":null,
+// "onchange_properties":null,
+// "is_repeatable":null,
+// "field_type":"string",
+// "validations":[]
+
+// }]
+
+// }
+// ]
+
+// }`
+// onChangeProperties_value.push(JSON.parse(new_name))
+
+ onChangeProperties_value.forEach(onChangeProperty=>{
+ console.log("api",onChangeProperty)
+ if(onChangeProperty.purpose == 'api'){
+ if(onChangeProperty.api == 'getListOfStatesAndCities'){
+ // console.log(event.value,onChangeProperty.params)
+ // onChangeProperty.params = JSON.stringify(onChangeProperty.params);
+ let updatedParams =JSON.stringify(onChangeProperty.params);
+ updatedParams = updatedParams.replace('value_of_answer',event.value);
+ // console.log(JSON.parse(updatedParams),updatedParams,JSON.parse(JSON.stringify(updatedParams)))
+ // debugger;
+ console.log("after",onChangeProperty)
+ this.quesService.apiCall(onChangeProperty.api,JSON.parse(updatedParams),onChangeProperty.api_method).subscribe(res=>{
+ if(res['dataStatus']){
+ this.local_city=res['records'].cities
+ this.local_pincode=res['records'].pincode
+
+ this.whole_json.forEach((val,index)=>{
+
+ if(val.api_properties == 'local_city'){
+
+ this.local_city=this.quesService.convertArrayNames(['city_id','city_name'],this.local_city)
+ val.answers = (this.local_city)
+ }
+ else if(val.api_properties == 'local_pincode'){
+ this.local_pincode=this.quesService.convertArrayNames(['pincode_id','pincode'],this.local_pincode)
+ val.answers = (this.local_pincode)
+ }
+
+ })
+
+ }
+ })
+ }
+ else{
+ this.quesService.apiCall(onChangeProperty.api,onChangeProperty.params,onChangeProperty.api_method).subscribe(result=>{
+ if(result['dataStatus']){
+ if(result.hasOwnProperty('records')){
+ result=result['records']
+ }
+ // let ques_control= this.quesAnsForm.controls.questions['controls']
+ // if(options == 2){
+ // ques_control=group_ques.controls.questions['controls']
+ // }
+
+ this.whole_json.forEach((val,index)=>{
+
+ if(val.api_properties == onChangeProperty.local_variable){
+ let values1=this.quesService.convertArrayNames(onChangeProperty.fields,result)
+ val.answers = (values1)
+ }
+
+ })
+ }
+ })
+ }
+ }
+ if(onChangeProperty.purpose == 'validations'){
+
+ // if(options == 2){
+ this.setValidations_onChange(onChangeProperty,this.formGroupN,sec_control,sec_index)
+ // }
+ // else{
+ // this.setValidations_onChange(onChangeProperty,this.quesAnsForm,sec_control,sec_index)
+ // }
+ }
+ if(onChangeProperty.purpose == 'FORM_CTRL'){
+
+ // if(options == 2){
+ console.log(sec_control)
+ // debugger;
+ this.creteNewField(onChangeProperty,this.formGroupN,sec_control,sec_index)
+ // }
+ // else{
+ // this.creteNewField(onChangeProperty,this.quesAnsForm,sec_control,sec_index)
+ // }
+ }
+ })
+ }
+ }
+ creteNewField(form_control_obj_raw,group_ques,sec_control,sec_index,purpose?){
+ console.log(group_ques,form_control_obj_raw,sec_index);
+ if(form_control_obj_raw.form_controls.length > 0){
+ form_control_obj_raw.form_controls.forEach(form_control_obj=>{
+ if(form_control_obj.value_keys != null && form_control_obj.value_keys.length > 0 ){
+ let expression_value=form_control_obj.expression
+ form_control_obj.value_keys.forEach(res=>{
+ let control_value_obj
+ if(purpose != 'edit'){
+ control_value_obj =group_ques.value[res]
+ }
+ else{
+ control_value_obj = sec_index.questions.filter(val=>val.question_key == res)[0]
+ }
+ if(control_value_obj){
+ // if(control_value_obj.answer_value == ''){
+ // control_value_obj.answer_value =0
+ // }
+ expression_value=expression_value.replace(res,control_value_obj)
+ }
+ })
+ console.log("Expression",expression_value)
+ let calc_exp=eval(expression_value)
+ console.log("Expression result",calc_exp)
+ if(calc_exp != false){
+ if(form_control_obj.questions.length > 0){
+ let question_index_after
+ this.whole_json.forEach((val,index,arr)=>{
+
+ if(val.question_key == form_control_obj.insert_index){
+ question_index_after= arr.indexOf(val)
+ }
+ })
+ console.log("after result",question_index_after,sec_index);
+ this.createControl(form_control_obj,group_ques,question_index_after,1) //FOR ADD CONTOL
+ }
+ }
+ else{
+ this.createControl(form_control_obj,group_ques,'',2) //FOR REMOVE CONTROL
+ }
+ }
+ })
+ }
+ }
+ createControl(form_control_obj,group_ques,question_index_after,options){
+ console.log(form_control_obj,group_ques,question_index_after)
+ let ques_control=this.whole_json
+ let inserted_control_obj=form_control_obj
+ inserted_control_obj.questions.sort()
+ inserted_control_obj.questions.reverse()
+ inserted_control_obj.questions.forEach(val=>{
+ if(options == 1){
+ let check_dup=ques_control.filter(control_key=>control_key.question_key == val.question_key)
+ console.log(check_dup,this.formGroupN);
+
+ // let check_dup = []
+ if(check_dup.length == 0){
+ val.raw_validations=val.validations
+ // ques_control.insert(question_index_after+1,this.questionService.createValue(val))
+ this.whole_json.splice(question_index_after+1,0,val);
+ this.formGroupN.addControl(val.question_key,new FormControl(''))
+ console.log("After adding control",this.whole_json,this.formGroupN,this.whole_form);
+ this.quesService.addAdditionalControl(val, this.formGroupN, question_index_after+1,"")
+ }
+ }
+ else{
+ ques_control.forEach((control_key,index)=>{
+ if(control_key.question_key == val.question_key){
+ this.whole_json.splice(index,1)
+ this.formGroupN.controls[val.question_key].reset()
+ this.formGroupN.removeControl(val.question_key);
+ }
+ })
+ }
+ })
+ }
+ setValidations_onChange(validation_obj_raw,group_ques,sec_control,sec_index){
+
+
+ if(validation_obj_raw.validations.length > 0){
+ validation_obj_raw.validations.forEach(validation_obj=>{
+ console.log("sing",validation_obj)
+ //FOR CHECKING THE EXPRESSION OR NORMAL VALIDATION
+ if(validation_obj.hasOwnProperty('value_keys')){
+
+ if( validation_obj.value_keys != null){
+
+
+ let expression_value=validation_obj.value
+ validation_obj.value_keys.forEach(res=>{
+ let validator_value_obj=this.formGroupN.value[res]
+ if(validator_value_obj){
+ expression_value=expression_value.replace(res,validator_value_obj)
+ }
+ })
+
+ // validation_obj.value=expression_value
+ validation_obj.validator=eval(expression_value)
+
+ if(validation_obj.validator == false){
+ validation_obj.isactive='0'
+ // // MAKING THE DECISION FOR SETTING THE VALIDATOR FOR CURRENT CONTROL OR OTHERS
+ this.proceedValidationSet(validation_obj,group_ques,sec_control,'')
+ }
+ else{
+ validation_obj.isactive='1'
+ let validator_single=this.quesService.setValueForValidator(validation_obj)
+ console.log(validator_single)
+ // // MAKING THE DECISION FOR SETTING THE VALIDATOR FOR CURRENT CONTROL OR OTHERS
+ this.proceedValidationSet(validation_obj,group_ques,sec_control,validator_single)
+ }
+ //END OF EXPRESSION CHECK
+ }
+ else{
+ // STARTING VALUE VALIDATION
+ let validator_value_obj
+
+
+
+ validator_value_obj=this.formGroupN.value[ validation_obj.value]
+ console.log(validator_value_obj)
+
+ validation_obj.validator=validator_value_obj
+
+ // let validator_single=this.questionService.setValueForValidator(validation_obj)
+ // console.log(validator_single)
+ // MAKING THE DECISION FOR SETTING THE VALIDATOR FOR CURRENT CONTROL OR OTHERS
+ this.proceedValidationSet(validation_obj,group_ques,sec_control,'')
+
+ // END OF VALUE VALIDATION
+ }
+
+ //
+
+ // }
+ // else{
+
+ // }
+
+ }
+ })
+ }
+ }
+
+ proceedValidationSet(validation_obj,group_ques,sec_control,validator_single?){
+ let ques_control;
+ if(validation_obj.validation_to == null){
+ console.log("entered",group_ques,sec_control);
+ ques_control=this.whole_json[this.json_index]
+
+
+ // if(validation_obj.isactive == '1'){
+ // ques_control.controls.answer_value.setValidators(validator_single)
+ // ques_control.controls.answer_value.updateValueAndValidity()
+ // }
+ // else{
+ // ques_control.controls.answer_value.clearValidators()
+ // ques_control.controls.answer_value.updateValueAndValidity()
+ // }
+ // validation_obj.validator=validator_single
+ let new_validation_obj=this.updateValidationMsg(ques_control,validation_obj)
+
+ this.quesService.settingArrayofValidators({validations:new_validation_obj,question_key:sec_control.question_key},this.formGroupN,'')
+ }
+ else{
+ ques_control=this.whole_json
+ let other_control=ques_control.filter(val=>{
+ if(val.question_key == validation_obj.validation_to){
+ return val
+ }
+ })[0]
+ // let updateMsg=other_control.value.validations.filter(val=>val.name != validation_obj.name)
+ // updateMsg.push(validation_obj)
+ console.log("OTHER CONTROL",other_control)
+ // other_control.controls.answer_value.setValidators(validator_single)
+ // if(validation_obj.isactive == '1'){
+ // other_control.controls.answer_value.setValidators(validator_single)
+ // other_control.controls.answer_value.updateValueAndValidity()
+ // }
+ // else{
+ // other_control.controls.answer_value.clearValidators()
+ // other_control.controls.answer_value.updateValueAndValidity()
+ // }
+
+ // other_control.controls.validations.setValue(updateMsg);
+ // validation_obj.validator=validator_single
+ let new_validations_obj=this.updateValidationMsg(other_control,validation_obj)
+ console.log("new validations obj",new_validations_obj,other_control)
+ this.quesService.settingArrayofValidators({validations:new_validations_obj,question_key:validation_obj.validation_to},this.formGroupN,'')
+ }
+ }
+ updateValidationMsg(ques_control,validation_obj){
+ console.log("updae msg",ques_control,validation_obj);
+ let updateMsg=ques_control.validations.filter(val=>val.name != validation_obj.name)
+ updateMsg.push(validation_obj)
+ // ques_control.controls.validations.setValue(updateMsg);
+ ques_control.validations = updateMsg
+ return updateMsg;
+ }
+}
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service.spec.ts
new file mode 100644
index 000000000..56b5b153f
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service.spec.ts
@@ -0,0 +1,12 @@
+import { TestBed } from '@angular/core/testing';
+
+import { QuesFormService } from './ques-form.service';
+
+describe('QuesFormService', () => {
+ beforeEach(() => TestBed.configureTestingModule({}));
+
+ it('should be created', () => {
+ const service: QuesFormService = TestBed.get(QuesFormService);
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service.ts
new file mode 100644
index 000000000..7ebfc7c03
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service.ts
@@ -0,0 +1,379 @@
+import { Injectable } from '@angular/core';
+import { FormGroup, FormArray, FormBuilder, FormControl, Validators } from '@angular/forms';
+import { HttpClient } from '@angular/common/http';
+import { environment } from 'environments/environment';
+
+const apiUrl = environment.apiEndpoint
+
+@Injectable({
+ providedIn: 'root'
+})
+export class QuesFormService {
+
+ constructor(private _fb:FormBuilder,private http:HttpClient) {
+ // this.apiUrl = constantProvider.environment().url
+ }
+ // FOR CREATING A FORM CONTROL DYNAMICALLY
+ assignFormControl_array(formgroup: FormGroup, ques_data: any) {
+ console.log(formgroup, ques_data)
+ const control: any = formgroup
+
+ ques_data.forEach((val, index) => {
+ console.log("quees", val)
+ if (val.hasOwnProperty('is_repeatable') && val.is_repeatable == '1') {
+ // control.push(this._fb.group({
+ // "is_repeatable": [val.is_repeatable || null],
+ // "group_title": [val.group_title || null], "group_type": [val.group_type || null]
+ // ,"question_key":[val.question[0].question_key]
+ // }))
+
+ control.addControl(val.group_key, this._fb.array([]))
+
+ let childControl: any = control.get(val.group_key) as FormArray
+
+ // childControl.push(this._fb.group({ 'questions': this._fb.array([]) }))
+ console.log("cc", childControl, control, index)
+ // let sub_childControl: any = childControl.controls[0].get('questions') as FormArray
+ let control_names:any={}
+ ques_data[index].group_questions = []
+ ques_data[index].group_questions.push(val.question)
+ val.group_questions[0].forEach((group_indi, arr_index) => {
+ // if(group_indi.api_properties != null && typeof(group_indi.api_properties) == 'object'){
+ console.log("api pro", val.api_properties)
+ // let param
+ // val.api_properties.forEach(val=>param=val)
+ // console.log(param)
+ group_indi.raw_validations = group_indi.validations
+ // sub_childControl.push(this.createValue(group_indi))
+ // childControl.addControl(group_indi.question_key,new FormControl(''))
+ control_names[group_indi.question_key] = ''
+ // childControl.push(this._fb.group({
+ // [group_indi.question_key] :['']
+ // }))
+ // setTimeout(()=>{
+ // this.addAdditionalControl(group_indi, childControl.at(arr_index), arr_index)
+ // },2000)
+ // if(group_indi.type == '5'){
+ // sub_childControl.controls[arr_index].removeControl('answer_value');
+ // console.log("loop",arr_index,sub_childControl);
+ // sub_childControl.controls[arr_index].addControl('answer_value',this._fb.array([]))
+ // }
+ // if(group_indi.type == '1'){
+ // sub_childControl.controls[arr_index].addControl('field_type',new FormControl(group_indi.field_type))
+ // }
+ // if(val.type == '8'){
+ // sub_childControl.controls[index].addControl('select_search',new FormControl(val.field_type))
+ // }
+
+ if (group_indi.api_properties != null) {
+ this.apiPropertiesCall(group_indi).then(res => {
+ if (res != false) {
+ group_indi.answers = []
+ // group_indi.answers=this.convertArrayNames(val.api_properties.fields,res)
+ group_indi.answers = (this.convertArrayNames(group_indi.api_properties.fields, res))
+ val.question[arr_index].answers = group_indi.answers
+
+ }
+ })
+ }
+
+ const question_temp:any = JSON.parse(JSON.stringify(val.question));
+ ques_data[index].question = question_temp
+ // else{
+ // setTimeout(()=>{
+ // sub_childControl.push(this.createValue(group_indi))
+ // },200)
+ // }
+ // sub_childControl.push(this.createValue(group_indi))
+ })
+ console.log(control_names);
+ // val.questions[0]=val.question;
+
+ childControl.push(this._fb.group(control_names))
+ console.log(formgroup.value);
+ // debugger;
+ val.group_questions[0].forEach((group_indi,arr_index)=>{
+ console.log("sd",childControl)
+ this.addAdditionalControl(group_indi, childControl.controls[0], arr_index)
+ })
+
+ // }
+ // else{
+ // sub_childControl.push(this.createValue(group_indi))
+ // }
+ // setTimeout(()=>{
+
+ // },500)
+
+ console.log("dd112", formgroup, childControl)
+ // let key_list=Object.keys(val)
+ // console.log(Object.keys(val))
+ // key_list.forEach(key=>{
+ // childControl.controls
+ // })
+ }
+ else {
+ // console.log("con",control)
+ // let key_list=Object.keys(val)
+ // console.log(Object.keys(val))
+ // let curr_object
+ // console.log("apikd",typeof(val.api_properties))
+ // if(val.api_properties != null && typeof(val.api_properties) == 'object'){
+ val.raw_validations = val.validations
+ // control.push(this.createValue(val))
+ formgroup.addControl(val.question_key,new FormControl(''))
+ // for checkbox remove the form control and add the formarray for multiple values
+ this.addAdditionalControl(val, formgroup, index)
+ // if(val.type == '5'){
+ // control.controls[index].removeControl('answer_value');
+ // console.log("loop",index,control);
+ // control.controls[index].addControl('answer_value',this._fb.array([]))
+ // }
+ // if(val.type == '1'){
+ // control.controls[index].addControl('field_type',new FormControl(val.field_type))
+ // }
+ // if(val.type == '8'){
+ // control.controls[index].addControl('select_search',new FormControl(val.field_type))
+ // }
+ if (val.api_properties != null) {
+ this.apiPropertiesCall(val).then(res => {
+ console.log("chekc", res)
+ if (res != false) {
+ // val.answers=[]
+ // val.answers=this.convertArrayNames(val.api_properties.fields,res)
+ val.answers = this.convertArrayNames(val.api_properties.fields, res)
+
+ }
+ }, err => console.log(err))
+ }
+ // else{
+ // setTimeout(()=>{
+ // control.push(this.createValue(val))
+ // },200)
+ // }
+
+ // }
+ // else{
+ // control.push(this.createValue(val))
+ // }
+ console.log(formgroup)
+
+ }
+ }, err => console.log(err))
+ return formgroup
+ }
+ // END OF FORM CREATION
+
+
+ // FOR CREATING THE FORM CONTROL FOR SPECIFIC FORM ARRAY
+ createValue(data){
+ let is_amt_in_words=false
+ let answer_value_loc='';
+ let answers_from_client=[]
+ // if(data.hasOwnProperty('answer_value') && data.answer_value != '' || null){
+ // let values_for_cli:any = this.getAnswerValue(data)
+ // if(values_for_cli.flag == 1){
+ // answer_value_loc=values_for_cli.values
+ // }
+ // else{
+ // answers_from_client=values_for_cli.values
+ // }
+ // }
+ // if(data.hasOwnProperty('field_type')){
+ // if(data.field_type == 'num'){
+ // is_amt_in_words=true
+ // }
+ // }
+ return this._fb.group({
+ "answer_value":[{value:answer_value_loc,disabled:answer_value_loc != '' ? true : false}], // OLD VALIDATION >>>> data.type != '6' ? Validators.compose([Validators.required]) : ''
+ "question":[data.question],
+ "question_key":[data.question_key],
+ "type":[data.type],
+ "raw_validations":[data.raw_validations],
+ "validations":[data.raw_validations],
+ "api_properties":[data.api_properties],
+ "onchange_properties":[data.onchange_properties],
+ "answers":[answers_from_client.length != 0 ? answers_from_client: data.answers],
+ "is_repeatable":[data.is_repeatable || null],
+ "group_title":[data.group_title || null]
+ })
+ }
+ // END OF CREATEVALUE FUN
+
+ // FOR REQUESTING THE API AUTOMATICALLY FROM JSON
+ apiPropertiesCall(val){
+ return new Promise((resolve,reject)=>{
+ if(val.api_properties != null && typeof(val.api_properties) == 'object'){
+ this.apiCall(val.api_properties.api,val.api_properties.params,val.api_properties.api_method).subscribe(res=>{
+ if(res['dataStatus']){
+ if(res.hasOwnProperty('records')){
+ res=res['records']
+ }
+ resolve(res)
+ console.log(res)
+ // val.answers=res
+ }
+ else{
+ resolve(false)
+ }
+ })
+ }
+ else{
+ resolve(false)
+ }
+ })
+ }
+ apiCall(api_name:string,params,api_method?){
+ if(api_method.toUpperCase() == 'POST'){
+ return this.http.post(apiUrl+api_name,params)
+ }
+ else{
+ return this.http.get(apiUrl+api_name)
+ }
+
+ }
+ // END OF API PROPERTIES CALL
+
+ // ---FOR CONVERTING THE ANSWER KEYS UNIQUE
+ convertArrayNames(fieldName,data_from_api){
+ let val1=[]
+ let modified_json = data_from_api.map(
+ obj => {
+ return {
+ "answer_id" : obj[fieldName[0]],
+ "answer":obj[fieldName[1]],
+
+ }
+ });
+ return modified_json
+ }
+ // END OF CONVERTARRAYNAMES FUN--
+
+ addAdditionalControl(data,curr_control,curr_index,purpose?){
+ console.log(curr_control);
+ //FOR CHECKBOX CHANGE THE VALUE STORAGE AS ARRAY
+ if(data.type == '5'){
+ // curr_control.controls[curr_index].removeControl('answer_value');
+ // curr_control.controls[curr_index].addControl('answer_value',this._fb.array([]))
+ curr_control.removeControl(data.question_key)
+ curr_control.addControl(data.question_key,this._fb.array([]))
+ }
+
+ //FOR numeric of string field
+ if(data.type == '1'){
+ // curr_control.controls[curr_index].addControl('field_type',new FormControl(data.field_type))
+ // curr_control.controls[curr_index].addControl('place_holder',new FormControl(data.place_holder))
+ }
+
+ //FOR SEARCHABLE FIELD VALUE KEY ()
+ if(data.type == '8'){
+ // curr_control.controls[curr_index].addControl('select_search',new FormControl(data.field_type))
+ curr_control.addControl(data.question_key+'_searchControl',new FormControl(data.field_type))
+ }
+ if(purpose == 'additional_field'){
+ curr_control.controls[curr_index].addControl('additional_field',new FormControl(1))
+ }
+
+ // FOR IMAGE STATUS
+ if(data.type == '6'){
+ curr_control.controls[curr_index].addControl('is_loader',new FormControl(''))
+ curr_control.controls[curr_index].addControl('is_saved',new FormControl(''))
+ curr_control.controls[curr_index].addControl('is_image_status',new FormControl(false))
+ }
+
+ //FOR SETTING THE VALIDATORS
+ this.settingArrayofValidators(data,curr_control,curr_index)
+ }
+
+ // FOR SETTING THE ARRAY OF VALIDATORS COMING FROM JSON Temp,
+ settingArrayofValidators(data,curr_control,curr_index){
+ console.log("entered",data);
+ if(data.hasOwnProperty('validations') && data.validations.length > 0 ){
+ const validList :any= [];
+ let validator_value
+ data.validations=data.validations.filter(val=>val.isactive != '0')
+ data.validations.forEach(valid => {
+ if(valid.value != null && !valid.hasOwnProperty('validation_to')){
+ validator_value= this.getvalidatorValue(valid)
+ }
+ else{
+ validator_value=this.setValueForValidator(valid)
+ console.log("cc",validator_value)
+
+ }
+ validList.push(validator_value);
+ });
+ // console.log("valid",validList,curr_control)
+ // let val="Validators.required"
+ // console.log(typeof(Validators))
+ // console.log(typeof(`${val}`))
+
+ // let val1=`${val}`
+ // console.log(typeof(eval(val)))
+ // console.log(eval(val))
+ console.log(validList)
+ // curr_control.controls[curr_index].controls.answer_value.setValidators(validList)
+ curr_control.controls[data.question_key].setValidators(validList)
+ console.log("ddvdeeqq",validList)
+ curr_control.controls[data.question_key].updateValueAndValidity()
+ console.log("after setting validators",curr_control.controls[data.question_key])
+ // debugger;
+ }
+ }
+ // END OF SETTINGARRAYOFVALIDATORS FUN
+
+ // FOR GETTING THE VALIDATION VALUE
+ getvalidatorValue(value_obj){
+ if(value_obj != null && value_obj.hasOwnProperty('value')){
+ let value_of_validator
+ switch(value_obj.value){
+ case 'CURRENT_YEAR':
+ value_of_validator=new Date().getFullYear()
+ break;
+ default:
+ value_of_validator=''
+ break;
+ }
+ value_obj.validator=String(value_of_validator)
+ return this.setValueForValidator(value_obj)
+ }
+ }
+ // END OF GETVALIDATORVALUE FUN
+
+ // FOR CREATING THE CORRECT VALIDATION
+ setValueForValidator(value_obj){
+ console.log("setvlaue of validator",value_obj.validator,typeof(value_obj.validator))
+ let return_value
+ if(value_obj != null && value_obj.hasOwnProperty('validator')){
+ switch(value_obj.name)
+ {
+ case 'required':
+ return_value=Validators.required
+ break;
+ case 'minLength':
+ return_value=Validators.minLength(value_obj.validator)
+ break;
+ case 'maxLength':
+ return_value=Validators.maxLength(value_obj.validator)
+ break;
+ case 'min':
+ return_value=Validators.min(value_obj.validator)
+ break;
+ case 'max':
+ return_value=Validators.max(value_obj.validator)
+ break;
+ case 'pattern':
+ return_value=Validators.pattern(value_obj.validator)
+ break;
+ default:
+ return_value=''
+ break;
+ }
+ return return_value
+ }
+ else{
+ return false
+ }
+ }
+ // END OF SETVALUEFORVALIDATOR FUN
+}
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.html
index c9d401bf3..7827f1c6e 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.html
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.html
@@ -106,6 +106,16 @@
+ 0">
+
+
+ {{questions_JSON.section_name}}
+
+
+
+
+
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.ts
index 9cadc91c2..bd6c86d1b 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.ts
@@ -33,6 +33,25 @@ export class QueriesDocsComponent implements OnInit {
fk_pd_type: any;
image_doc_params: { pdid: string; form_id: number; company_id: string; };
+ covid19QuesForm:FormGroup;
+ // temlateQues:any
+ // `{
+ // "form_name":"Personal Discussion Sheet - Working Capital Term Loan (For Sales Team)",
+ // "sections":[
+ // `
+ questions_JSON: any = {questions:[]};
+ covidAnswers :any = null;
+ // = {
+ // "business_impacted_by_covid19": "No",
+ // "avail_loan_moratorium_facility": "Yes",
+ // "avail_any_loan": "Yes",
+ // "sales_or_revenue_amt": "233",
+ // "mentioned_turover_validated": "Yes",
+ // "business_impacted_by_covid19_No": "Business falls under essential services like chemist",
+ // "avail_any_loan_Yes": "df",
+ // "mentioned_turover_validated_Yes": "records shown"
+ // }
+
constructor(notifier: NotifierService,
private _ngZone: NgZone,
private fb: FormBuilder,
@@ -71,6 +90,7 @@ export class QueriesDocsComponent implements OnInit {
addtional_requirements:this.fb.array([this.createview()])
})
this.getFullPD();
+ this.getCovidQuesTemplate()
}
createview(){
@@ -78,7 +98,25 @@ export class QueriesDocsComponent implements OnInit {
name:['']
})
}
-
+ getCovidQuesTemplate() {
+ // this.qustCat.covid19Ques().subscribe(res=>{
+ let covidQuesTemplate: any = localStorage.getItem('dynamicQuesTemplate')
+ if (covidQuesTemplate && covidQuesTemplate != null && covidQuesTemplate != undefined
+ ) {
+ covidQuesTemplate = JSON.parse(covidQuesTemplate)
+ if (covidQuesTemplate.hasOwnProperty('template') && covidQuesTemplate.template) {
+ covidQuesTemplate =JSON.parse(covidQuesTemplate.template);
+ this.covid19QuesForm = new FormGroup({})
+ this.questions_JSON = covidQuesTemplate;
+ console.log(this.questions_JSON);
+ setTimeout(() => {
+ this.covidAnswers = null
+ console.log("cleared")
+ }, 2000)
+ }
+ }
+ // })
+ }
getFullPD(){
// let records = {'parent_pdid': this.pdDetails.parent_pd_id,'pdid':this.pdDetails.pd_id,'random_string':this.pdDetails.random_string};
@@ -152,6 +190,10 @@ export class QueriesDocsComponent implements OnInit {
// this.docs_change_fun(index,data)
})
}
+ if(retrieved_data.hasOwnProperty('covid_section') && retrieved_data.covid_section) {
+ this.covidAnswers = retrieved_data.covid_section
+
+ }
// console.log("form123",this.docsCollectedForm.value);
this.docsCollectedForm.patchValue(retrieved_data)
@@ -207,6 +249,40 @@ export class QueriesDocsComponent implements OnInit {
// console.log("Error",err)
// })
// }
+ /**
+ * Marks all controls in a form group as touched
+ * @param formGroup - The form group to touch
+ */
+ private markFormGroupTouched(formGroup: FormGroup) {
+ (Object).values(formGroup.controls).forEach(control => {
+ control.markAsTouched();
+
+ if (control.controls) {
+ this.markFormGroupTouched(control);
+ }
+ });
+ }
+ public findInvalidControls() {
+ const controls = this.covid19QuesForm.controls;
+ console.log(controls)
+ for (const name in controls) {
+ if (controls[name].invalid) {
+ let invalidFields = [].slice.call(document.getElementsByClassName('ng-invalid'));
+ let firstInvalidField;
+ for(let val in invalidFields){
+ if( invalidFields[val].nodeName == 'MAT-FORM-FIELD'){ //INPUT FOR INPUT FIELD
+ firstInvalidField=invalidFields[val]
+ break;
+ }
+ }
+ if(firstInvalidField != undefined){
+ firstInvalidField.scrollIntoView(true)
+ }
+ break;
+ }
+ }
+ // return invalid;
+ }
saveForm(){
// console.log(this.docsCollectedForm.value);
// this.docsCollectedForm.value.docs_to_be_sighted.forEach(value=>{
@@ -218,11 +294,34 @@ export class QueriesDocsComponent implements OnInit {
// }
// })
if(this.docsCollectedForm.invalid){
+ if(this.docsCollectedForm.invalid && (this.queries_docs.length > 0 || this.docs_array_value.length > 0)){
this.notifier.notify("warning","Please Fill all the Fields and capture the image if required");
return
+ }
}
+ if(this.questions_JSON.questions.length > 0) {
+ console.log(this.covid19QuesForm.getRawValue(),this.covid19QuesForm.valid,JSON.stringify(this.covid19QuesForm.getRawValue()),this.questions_JSON.questions);
+ if(this.covid19QuesForm.invalid) {
+ this.covid19QuesForm.markAsDirty()
+ this.markFormGroupTouched(this.covid19QuesForm)
+ this.findInvalidControls()
+ this.notifier.notify("warning","Please Fill all the required Fields");
+ // console.log(geneatedQues)
+ // let group_ques = this.questions_JSON.question.filter(val=>val.is_repeatable == '1')
+ // if(group_ques.length >0 && group_ques.hasOwnProperty('question') && group_ques.question) {
+ // group_ques=group_ques.question.map(vv=>{
+ // return {question_key:vv.question_key,question:vv.question,is_repeatable:'0'}
+ // })
+ // }
+
+ return;
+ }
+ }
+ let formParams:any;
this.disableAfterSubmit=true
- this.docsCollectedForm.value.addtional_requirements[0].hasOwnProperty('name') ? delete this.docsCollectedForm.value.addtional_requirements[0].name : ''
+ if((this.queries_docs.length > 0 || this.docs_array_value.length > 0)) {
+ formParams = this.docsCollectedForm.value
+ formParams.addtional_requirements[0].hasOwnProperty('name') ? delete formParams.addtional_requirements[0].name : ''
// console.log(JSON.stringify(this.docsCollectedForm.value));
// this.constantProvider.getGeoTag().then(geoCoords=>{
// if(this.docsCollectedForm.value.link == ""){
@@ -237,8 +336,19 @@ export class QueriesDocsComponent implements OnInit {
}, error => {
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
});
+ }
- this.pdTriggerService.saveForm(this.docsCollectedForm.value).subscribe(res=>{
+ if(this.questions_JSON.questions.length > 0) {
+ let geneatedQues = this.questions_JSON.questions.filter(val=>val.is_repeatable != '1').map(vv=>{
+ return {question_key:vv.question_key,question:vv.question,is_repeatable:'0',type:vv.type}
+ })
+ let covidFormAnswers = this.covid19QuesForm.getRawValue()
+ covidFormAnswers.question_info = geneatedQues
+ formParams.covid_section = covidFormAnswers
+ }
+ console.log(formParams);
+
+ this.pdTriggerService.saveForm(formParams).subscribe(res=>{
if(res['dataStatus']){
this.notifier.notify("success","Record Saved Successfully..")
setTimeout(()=>{
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts
index 4cde14ecb..ff3935b67 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts
@@ -89,7 +89,21 @@ export class StartPdComponent implements OnInit, OnDestroy {
// Ps.initialize(elemContent, { wheelSpeed: 2, suppressScrollX: true });
}
this.loadTemplates(this.startPD,1,this.randomString);
+ this.getCreditPDTemplate();
}
+ getCreditPDTemplate() {
+ // let params = { "fk_entity_id":this.pddetails.fk_lender_id,"fk_product_id":this.pddetails.fk_product_id,"pd_form_id":this.pddetails.pd_id }
+ let params = { "fk_entity_id":"","fk_product_id":"","pd_form_id":"24" }
+ this._pd.loadCreditPDTemplate(params).subscribe(result=> {
+ let creditTemplate:any = null;
+ if(result['dataStatus']) {
+ if(result.hasOwnProperty('records') && result['records']) {
+ creditTemplate = result['records'];
+ }
+ }
+ localStorage.setItem("dynamicQuesTemplate",JSON.stringify(creditTemplate));
+ })
+ }
isMac(): boolean {
let bool = false;
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts
index e82d22d87..32fda8e70 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts
@@ -133,6 +133,9 @@ import { ImageDocsComponent } from './list-pd/start-pd/forms/image-docs/image-do
import { environment } from 'environments/environment'
import { CustomTitleCaseDirective } from '../pd-directive/custom-title-case.directive';
import { SpeedDialFabComponent } from './list-pd/view-pd/speed-dial-fab/speed-dial-fab.component';
+import { DynamicFormComponent } from './list-pd/start-pd/forms/dynamic-form/dynamic-form/dynamic-form.component';
+import { DynamicQuestionTemplateComponent } from './list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component';
+import { QuesFormService } from './list-pd/start-pd/forms/dynamic-form/ques-form/ques-form.service';
/**
* Custom angular notifier options
@@ -179,7 +182,8 @@ const pdCustomNotifierOptions: NotifierOptions = {
};
@NgModule({
- declarations: [TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent,VendorPdAllocationComponent, DuplicatePdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent,PdCollectedDocsComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent, SearchRelationPipe, RupeeCurrencyFormatPipe, NumberToWordsPipe, DeleteRecordsCountPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent, SalesDetailsComponent, DailySalesDetailsComponent, SalesCalculationComponent, ManageSalesComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent ,ManageDailyPurchaseComponent, DailyPurchaseDetailsComponent, ManageRentalVerificationComponent, FuturePlansAndBusinessEnvironmentComponent, ImageCropComponent,PurchaseCalculationComponent,QueriesDocsComponent, ImageDocsComponent,CustomTitleCaseDirective, SpeedDialFabComponent],
+ declarations: [TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent,VendorPdAllocationComponent, DuplicatePdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent,PdCollectedDocsComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent, SearchRelationPipe, RupeeCurrencyFormatPipe, NumberToWordsPipe, DeleteRecordsCountPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent, SalesDetailsComponent, DailySalesDetailsComponent, SalesCalculationComponent, ManageSalesComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent ,ManageDailyPurchaseComponent, DailyPurchaseDetailsComponent, ManageRentalVerificationComponent, FuturePlansAndBusinessEnvironmentComponent, ImageCropComponent,PurchaseCalculationComponent,QueriesDocsComponent, ImageDocsComponent,CustomTitleCaseDirective, SpeedDialFabComponent,
+ DynamicFormComponent,DynamicQuestionTemplateComponent],
imports: [
CommonModule,
ManagePdRoutingModule,
@@ -218,10 +222,11 @@ const pdCustomNotifierOptions: NotifierOptions = {
exports: [DuplicatePdComponent,VendorPdAllocationComponent,PdLocatedMapViewDirective, PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent, AssessedIncomeComponent, AllocationViewMoreComponent, GeneralInfoComponent, PdRequirementComponent,PdCollectedDocsComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, BusinessOtherFamilyMemberComponent, BusinessInfoGroupComponent,DailySalesDetailsComponent, SalesCalculationComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent, DailyPurchaseDetailsComponent, ManageDailyPurchaseComponent,ManageRentalVerificationComponent,ImageCropComponent,PurchaseCalculationComponent],
providers: [PdTrigerService, GetGeometricLocationService,{provide: MAT_DATE_LOCALE, useValue: 'en-GB'},
{provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]},
- {provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS}, PdLocatedMapViewDirective],
+ {provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS}, PdLocatedMapViewDirective,QuesFormService],
entryComponents: [DuplicatePdComponent,VendorPdAllocationComponent,PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, AllocationViewMoreComponent, PersonalInfoComponent,BusinessAssetsInfoComponent,
- ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent,PdCollectedDocsComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent,BusinessBankingDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, ManageDailySalesComponent,PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent, ManageDailyPurchaseComponent,ManageRentalVerificationComponent,FuturePlansAndBusinessEnvironmentComponent,ImageCropComponent,QueriesDocsComponent],
+ ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent,PdCollectedDocsComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent,BusinessBankingDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, ManageDailySalesComponent,PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent, ManageDailyPurchaseComponent,ManageRentalVerificationComponent,FuturePlansAndBusinessEnvironmentComponent,ImageCropComponent,QueriesDocsComponent,
+ DynamicFormComponent,DynamicQuestionTemplateComponent],
})
export class ManagePdModule {
}
\ No newline at end of file
diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts
index 9f4ba477a..fde0cf085 100755
--- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts
+++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts
@@ -360,6 +360,9 @@ export class PdTrigerService {
catchError(this.handleError('operation', []))
)
}
+ loadCreditPDTemplate(params) {
+ return this._http.post(this.apiUrl+'loadCreditPDTemplate', params)
+ }
// load PD question answers
getAnswersForPD(list: any): Observable {
@@ -949,4 +952,9 @@ export class PdTrigerService {
getVendorAnswers(params):Observable {
return this._http.post(this.apiUrl+'getVendorAnswers',params)
}
+
+
+ covid19Ques() {
+ return this._http.get('../../../assets/sample_covid19_ques.json')
+ }
}
diff --git a/ng6-seed/src/assets/sample_covid19_ques.json b/ng6-seed/src/assets/sample_covid19_ques.json
new file mode 100644
index 000000000..3f418f3bf
--- /dev/null
+++ b/ng6-seed/src/assets/sample_covid19_ques.json
@@ -0,0 +1,628 @@
+{
+ "section_id":"1",
+ "section_name":"Covid 19 Questions",
+ "onsubmit":null,
+ "questions":[
+ {
+
+ "question":"State",
+ "question_key":"state",
+ "type":"3",
+ "answers":null,
+ "api_properties":{
+ "api":"getListOfMaster",
+ "api_method":"POST",
+ "params":{
+ "master_name":"STATE"
+ },
+ "fields":[
+ "state_id",
+ "name"
+ ]
+ },
+ "onchange_properties":[
+ {
+ "purpose":"api",
+ "api":"getListOfStatesAndCities",
+ "api_method":"POST",
+ "params":{"records":{"state_id":"value_of_answer"}},
+ "fields":[
+ "state_id",
+ "name"
+ ],
+ "local_variable":"local_city"
+ }
+ ],
+ "is_repeatable":null,
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"State Required",
+ "value":null
+ }
+ ]
+ },
+ {
+ "question":"City",
+ "question_key":"city",
+ "type":"3",
+ "answers":null,
+ "api_properties":"local_city",
+ "onchange_properties":null,
+ "is_repeatable":null,
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"CIty Required",
+ "value":null
+ }
+ ]
+ },
+ {
+ "question":[
+ {
+ "question":"Name",
+ "question_key":"name",
+ "place_holder":"Enter text",
+ "type":"1",
+ "api_properties":null,
+ "answers":null,
+ "onchange_properties":null,
+ "is_repeatable":null,
+ "field_type":"string",
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Name Required",
+ "value":null
+ },
+ {
+ "name":"pattern",
+ "isactive":"1",
+ "validator":"[A-Za-z ]*",
+ "message":"alphabets only ",
+ "value":null
+ }
+ ]
+ },
+ {
+ "question":"Share Holding (%)",
+ "question_key":"share_holding",
+ "place_holder":"Enter number",
+ "type":"1",
+ "api_properties":null,
+ "answers":null,
+ "onchange_properties":null,
+ "is_repeatable":null,
+ "field_type":"num",
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Share value Required",
+ "value":null
+ },
+ {
+ "name":"max",
+ "validator":"100",
+ "isactive":"1",
+ "message":"Number must be less than 100",
+ "value":null
+ }
+ ]
+ },
+ {
+ "question":"Vintage in Current Business",
+ "question_key":"vintage_in_current_biz",
+ "place_holder":"Enter in years",
+ "type":"1",
+ "api_properties":null,
+ "answers":null,
+ "is_repeatable":null,
+ "field_type":"num",
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Current vintage Required",
+ "value":null
+ },
+ {
+ "name":"pattern",
+ "isactive":"1",
+ "validator":"[0-9]{0,3}",
+ "message":"Year should be 3 digit",
+ "value":null
+ }
+ ],
+ "onchange_properties":[
+ {
+ "purpose":"validations",
+ "validations":[
+ {
+ "name":"max",
+ "isactive":"1",
+ "validator":"",
+ "message":"should be less or equal to Total Work Exp",
+ "value":"total_work_exp",
+ "validation_to":null,
+ "value_keys":null
+ }
+ ]
+ },
+ {
+ "purpose":"FORM_CTRL",
+ "form_controls":[
+ {
+ "insert_index":"total_work_exp",
+ "expression":"(total_work_exp > vintage_in_current_biz)",
+ "value_keys":[
+ "total_work_exp",
+ "vintage_in_current_biz"
+ ],
+ "questions":[
+ {
+ "question_key":"previous_experience_details",
+ "question":"Previous Experience Details",
+ "place_holder":"Enter text",
+ "type":"1",
+ "api_properties":null,
+ "answers":null,
+ "onchange_properties":null,
+ "is_repeatable":null,
+ "field_type":"string",
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Previous Experience Required",
+ "value":null
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "question":"Total Work Exp",
+ "question_key":"total_work_exp",
+ "place_holder":"Enter in years",
+ "type":"1",
+ "api_properties":null,
+ "answers":null,
+ "is_repeatable":null,
+ "field_type":"num",
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Total experience Required",
+ "value":null
+ },
+ {
+ "name":"maxLength",
+ "isactive":"1",
+ "validator":"2",
+ "message":"Year should be two digit",
+ "value":null
+ }
+ ],
+ "onchange_properties":[
+ {
+ "purpose":"validations",
+ "validations":[
+ {
+ "name":"min",
+ "isactive":"1",
+ "validator":"",
+ "message":"should be greater or equal to current work exp",
+ "value":"vintage_in_current_biz",
+ "validation_to":null,
+ "value_keys":null
+ }
+ ]
+ },
+ {
+ "purpose":"FORM_CTRL",
+ "form_controls":[
+ {
+ "insert_index":"total_work_exp",
+ "expression":"(total_work_exp > vintage_in_current_biz)",
+ "value_keys":[
+ "total_work_exp",
+ "vintage_in_current_biz"
+ ],
+ "questions":[
+ {
+ "question":"Previous Experience Details",
+ "question_key":"previous_experience_details",
+ "place_holder":"Enter text",
+ "type":"1",
+ "api_properties":null,
+ "answers":null,
+ "onchange_properties":null,
+ "is_repeatable":null,
+ "field_type":"string",
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Previous Experience Required",
+ "value":null
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "question":"Started Business",
+ "question_key":"started_biz",
+ "type":"3",
+ "api_properties":null,
+ "onchange_properties":null,
+ "is_repeatable":null,
+ "answers":[
+ {
+ "answer_id":"Yes",
+ "answer":"Yes",
+ "subfield_key":"",
+ "subfield_caption":"",
+ "subfield_type":""
+ },
+ {
+ "answer_id":"No",
+ "answer":"No",
+ "subfield_key":"",
+ "subfield_caption":"",
+ "subfield_type":""
+ }
+ ],
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Started Business Required",
+ "value":null
+ }
+ ]
+ }
+ ],
+ "is_repeatable":"1",
+ "group_title":"Details of Key Stakeholders in the Business",
+ "group_key":"section_3"
+ },
+ {
+ "question":" Is your business adversely impacted by coronavirus outbreak? ",
+ "question_key":"business_impacted_by_covid19",
+ "type":"2",
+ "field_width":"45",
+ "answers":[
+ {
+ "answer_id":"Yes",
+ "answer":"Yes"
+ },
+ {
+ "answer_id":"No",
+ "answer":"No"
+ }
+ ],
+ "api_properties":null,
+ "onchange_properties":[
+ {
+ "purpose":"FORM_CTRL",
+ "form_controls":[
+ {
+ "insert_index":"business_impacted_by_covid19",
+ "expression":"(String('business_impacted_by_covid19') == String('Yes'))",
+ "value_keys":[
+ "business_impacted_by_covid19"
+ ],
+ "questions":[
+ {
+ "question":"Choose any one",
+ "question_key":"business_impacted_by_covid19_Yes",
+ "type":"3",
+ "field_width":"45",
+ "api_properties":null,
+ "onchange_properties":null,
+ "is_repeatable":null,
+ "answers":[
+ {
+ "answer_id":"",
+ "answer":"Select"
+ },
+ {
+ "answer_id":"Employees/labour not available",
+ "answer":"Employees/labour not available"
+ },
+ {
+ "answer_id":"business closed during lockdown",
+ "answer":"business closed during lockdown"
+ },
+ {
+ "answer_id":"sales reduced due to lockdown",
+ "answer":"sales reduced due to lockdown"
+ },
+ {
+ "answer_id":"sales not picking up post lock down etc",
+ "answer":"sales not picking up post lock down etc"
+ }
+ ],
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Field required",
+ "value":null
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "purpose":"FORM_CTRL",
+ "form_controls":[
+ {
+ "insert_index":"business_impacted_by_covid19",
+ "expression":"(String('business_impacted_by_covid19') == String('No'))",
+ "value_keys":[
+ "business_impacted_by_covid19"
+ ],
+ "questions":[
+ {
+ "question":"Choose any one",
+ "question_key":"business_impacted_by_covid19_No",
+ "type":"3",
+ "field_width":"45",
+ "api_properties":null,
+ "onchange_properties":null,
+ "is_repeatable":null,
+ "answers":[
+ {
+ "answer_id":"",
+ "answer":"Select"
+ },
+ {
+ "answer_id":"Business falls under essential services like chemist",
+ "answer":"Business falls under essential services like chemist"
+ },
+ {
+ "answer_id":" grocery store etc",
+ "answer":"grocery store etc"
+ }
+ ],
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Field required",
+ "value":null
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "is_repeatable":null,
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Field Required",
+ "value":null
+ }
+ ]
+ },
+ {
+ "question":" Did you avail the loan moratorium facility on your existing loans which is extended by your bank or financial institution? ",
+ "question_key":"avail_loan_moratorium_facility",
+ "type":"2",
+ "field_width":"45",
+ "onchange_properties":[],
+ "api_properties":null,
+ "answers":[
+ {
+ "answer":"Yes",
+ "answer_id":"Yes"
+ },
+ {
+ "answer":"No",
+ "answer_id":"No"
+ }
+ ],
+ "is_repeatable":null,
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Field Required",
+ "value":null
+ }
+ ]
+ },
+ {
+ "question":"Are you planning to avail/ or already availed any loan or any other term facility for your business or personal use?",
+ "question_key":"avail_any_loan",
+ "type":"2",
+ "field_width":"45",
+ "api_properties":null,
+ "answers":[
+ {
+ "answer":"Yes",
+ "answer_id":"Yes"
+ },
+ {
+ "answer":"No",
+ "answer_id":"No"
+ }
+ ],
+ "onchange_properties":[
+ {
+ "purpose":"FORM_CTRL",
+ "form_controls":[
+ {
+ "insert_index":"avail_any_loan",
+ "expression":"(String('avail_any_loan') == String('Yes'))",
+ "value_keys":[
+ "avail_any_loan"
+ ],
+ "questions":[
+ {
+ "question":"Please specify amount,lender etc.",
+ "question_key":"avail_any_loan_Yes",
+ "type":"7",
+ "field_width":"100",
+ "api_properties":null,
+ "onchange_properties":null,
+ "is_repeatable":null,
+ "answers":[],
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Field Required",
+ "value":null
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }],
+ "is_repeatable":null,
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Field Required",
+ "value":null
+ }
+ ]
+ },
+ {
+ "question":"How much is your sales/revenue from April till date?",
+ "question_key":"sales_or_revenue_amt",
+ "place_holder":"Enter amount",
+ "type":"1",
+ "field_width":"45",
+ "answers":null,
+ "api_properties":null,
+ "is_repeatable":null,
+ "field_type":"numtoword",
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Field Required",
+ "value":null
+ }
+ ]
+ },
+ {
+ "question":"Is turnover mentioned above validated?",
+ "question_key":"mentioned_turover_validated",
+ "type":"2",
+ "field_width":"45",
+ "api_properties":null,
+ "answers":[
+ {
+ "answer":"Yes",
+ "answer_id":"Yes"
+ },
+ {
+ "answer":"No",
+ "answer_id":"No"
+ }
+ ],
+ "onchange_properties":[
+ {
+ "purpose":"FORM_CTRL",
+ "form_controls":[
+ {
+ "insert_index":"mentioned_turover_validated",
+ "expression":"(String('mentioned_turover_validated') == String('Yes'))",
+ "value_keys":[
+ "mentioned_turover_validated"
+ ],
+ "questions":[
+ {
+ "question":"Choose any one",
+ "question_key":"mentioned_turover_validated_Yes",
+ "type":"3",
+ "field_width":"45",
+ "api_properties":null,
+ "onchange_properties":null,
+ "is_repeatable":null,
+ "answers":[
+ {
+ "answer_id":"",
+ "answer":"Select"
+ },
+ {
+ "answer_id":"Bills",
+ "answer":"Gst returns"
+ },
+ {
+ "answer_id":"records shown",
+ "answer":"records shown"
+ }
+ ],
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Field required",
+ "value":null
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "is_repeatable":null,
+ "validations":[
+ {
+ "name":"required",
+ "isactive":"1",
+ "validator":"Validators.required",
+ "message":"Field Required",
+ "value":null
+ }
+ ]
+ }
+
+ ]
+ }
\ No newline at end of file