From 46a7e02fcd79fbf5a66218e11fbbca9d2756ad7f Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 13 Aug 2021 20:35:10 +0530 Subject: [PATCH] latest changes lfmp --- .../ques-form/ques-form.service.ts | 95 +++++++++++++++++-- .../data/SMC_CREDIT_TEMPLATES/LFMP/5.json | 7 +- 2 files changed, 92 insertions(+), 10 deletions(-) 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 index 6b7338f..3708cbd 100644 --- 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 @@ -42,7 +42,9 @@ export class QuesFormService { assignFormControl_array(formgroup: FormGroup, ques_data: any) { const control: any = formgroup + console.log('control'); console.log(formgroup); + ques_data.forEach((val, index) => { if (val.hasOwnProperty('is_repeatable') && val.is_repeatable == '1') { @@ -56,14 +58,17 @@ export class QuesFormService { // })) control.addControl(val.group_key, this._fb.array([])) - + + let childControl: any = control.get(val.group_key) as FormArray - + //let childControl1: any = control.get(val.value) as FormArray + console.log('childControl'); + console.log(childControl); + console.log(val.group_key); // childControl.push(this._fb.group({ 'questions': this._fb.array([]) })) this.length='3'; - - if(this.length=='3') + if(this.length=='3' && val.form_name=='Key Stakeholders in Business') { val.question.push({ @@ -331,7 +336,45 @@ export class QuesFormService { "value":null } ], - + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[ + { + "insert_index":"started_biz2", + "expression":"(total_work_exp2 > vintage_in_current_biz2)", + "value_keys":[ + "total_work_exp2", + "vintage_in_current_biz2" + ], + "questions":[ + { + "question_key":"previous_experience_details1", + "question":"Previous Experience Details1", + "place_holder":"Enter text", + "type":"1", + + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "parent_question_key":"vintage_in_current_biz2", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Previous Experience Required", + "value":null + } + ] + } + ] + } + ] + } + ] }, { "question":"", @@ -352,7 +395,45 @@ export class QuesFormService { "value":null } ], - + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[ + { + "insert_index":"started_biz2", + "expression":"(total_work_exp2 > vintage_in_current_biz2)", + "value_keys":[ + "total_work_exp2", + "vintage_in_current_biz2" + ], + "questions":[ + { + "question":"Previous Experience Details2", + "question_key":"previous_experience_details2", + "place_holder":"Enter text", + "type":"1", + + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_repeatable":null, + "field_type":"string", + "parent_question_key":"total_work_exp2", + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Previous Experience Required", + "value":null + } + ] + } + ] + } + ] + } + ] }, { "question":"", @@ -385,7 +466,7 @@ export class QuesFormService { } ) } - else if(this.length=='2') + else if(this.length=='2' && val.form_name=='Key Stakeholders in Business') { val.question.push({ diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/5.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/5.json index c500dac..1c2ac43 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/5.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/5.json @@ -120,7 +120,7 @@ ], "questions":[ { - "question_key":"previous_experience_details", + "question_key":"previous_experience_details0", "question":"Previous Experience Details0", "place_holder":"Enter text", "type":"1", @@ -179,7 +179,7 @@ ], "questions":[ { - "question":"Previous Experience Details", + "question":"Previous Experience Details0", "question_key":"previous_experience_details0", "place_holder":"Enter text", "type":"1", @@ -240,7 +240,8 @@ ], "is_repeatable":"1", "group_title":"Details of Key Stakeholders in the Business", - "group_key":"key_stakeholders" + "group_key":"key_stakeholders", + "form_name":"Key Stakeholders in Business" }, { "question_key":"common_remarks",