From 69f44751375c83f5704af1160d2f214b6ec1f242 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Wed, 5 Jan 2022 13:15:11 +0530 Subject: [PATCH] live issues changes --- .../dynamic-form/dynamic-form.component.ts | 3 +- .../dynamic-question-template.component.ts | 126 ++++++++++-------- .../ques-form/ques-form.service.ts | 13 +- .../start-pd/forms/form/form.component.ts | 7 +- .../list-pd/view-pd/view-pd.component.html | 6 +- .../data/SMC_CREDIT_TEMPLATES/LFMP/13.json | 39 +++++- .../data/SMC_CREDIT_TEMPLATES/WCTL/13.json | 24 +++- .../data/SMC_CREDIT_TEMPLATES/WCTL/4.json | 1 + 8 files changed, 145 insertions(+), 74 deletions(-) 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 index 39f1b31..20dcd3e 100644 --- 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 @@ -40,7 +40,8 @@ export class DynamicFormComponent implements OnInit { generateGroupControls() { - + console.log(this.json_answers); + console.log('answers'); if(this.json_answers && this.json_answers != null){ this.isDefaultGenerated = true; this.questions_JSON.questions.forEach(parent_ques=>{ 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 index bb79386..3242f53 100644 --- 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 @@ -47,81 +47,84 @@ export class DynamicQuestionTemplateComponent implements OnInit { } ngOnChanges() { - //alert('ans'); + this.parent_ques = this.currFormArrayObj - this.json_answers1=[{ - stakeholder_name0: "SUMIT KHANDELWAL", - share_holding0: 10, - vintage_in_current_biz0: 5, - total_work_exp0: 10, - started_biz0: "", + // this.json_answers1=[{ + // stakeholder_name0: "SUMIT KHANDELWAL", + // share_holding0: 10, + // vintage_in_current_biz0: 5, + // total_work_exp0: 10, + // started_biz0: "", - stakeholder_name1: "RAM", - share_holding1: 10.5, - vintage_in_current_biz1: 8, - total_work_exp1: 5, - started_biz1: "", + // stakeholder_name1: "RAM", + // share_holding1: 10.5, + // vintage_in_current_biz1: 8, + // total_work_exp1: 5, + // started_biz1: "", - stakeholder_name2: "VIGNESH", - share_holding2: 55, - vintage_in_current_biz2: 6, - total_work_exp2: 0, - started_biz2: "", - stakeholder_length:'2', - company_name: 3}, - { - stakeholder_name0: "SUMIT KHANDELWAL", - share_holding0: 15, - vintage_in_current_biz0: 6, - total_work_exp0: 11, - started_biz0: "", + // stakeholder_name2: "VIGNESH", + // share_holding2: 55, + // vintage_in_current_biz2: 6, + // total_work_exp2: 0, + // started_biz2: "", + // stakeholder_length:'2', + // company_name: 3}, + // { + // stakeholder_name0: "SUMIT KHANDELWAL", + // share_holding0: 15, + // vintage_in_current_biz0: 6, + // total_work_exp0: 11, + // started_biz0: "", - stakeholder_name1: "RAM", - share_holding1: 0, - vintage_in_current_biz1: 10, - total_work_exp1: 9, - started_biz1: "", + // stakeholder_name1: "RAM", + // share_holding1: 0, + // vintage_in_current_biz1: 10, + // total_work_exp1: 9, + // started_biz1: "", - stakeholder_name2: "VIGNESH", - share_holding2: 25, - vintage_in_current_biz2: 12, - total_work_exp2: 8, - started_biz2: "", + // stakeholder_name2: "VIGNESH", + // share_holding2: 25, + // vintage_in_current_biz2: 12, + // total_work_exp2: 8, + // started_biz2: "", - stakeholder_length:'2', - company_name: 2},{ - stakeholder_name0: "SUMIT KHANDELWAL", - share_holding0: 25, - vintage_in_current_biz0: 7, - total_work_exp0: 12, - started_biz0: "", + // stakeholder_length:'2', + // company_name: 2},{ + // stakeholder_name0: "SUMIT KHANDELWAL", + // share_holding0: 25, + // vintage_in_current_biz0: 7, + // total_work_exp0: 12, + // started_biz0: "", - stakeholder_name1: "RAM", - share_holding1: 25.5, - vintage_in_current_biz1: 15, - total_work_exp1: 0, - started_biz1: "", + // stakeholder_name1: "RAM", + // share_holding1: 25.5, + // vintage_in_current_biz1: 15, + // total_work_exp1: 0, + // started_biz1: "", - stakeholder_name2: "VIGNESH", - share_holding2: 0, - vintage_in_current_biz2: 10, - total_work_exp2: 9, - started_biz2: "", + // stakeholder_name2: "VIGNESH", + // share_holding2: 0, + // vintage_in_current_biz2: 10, + // total_work_exp2: 9, + // started_biz2: "", - stakeholder_length:'2', - company_name: 1} + // stakeholder_length:'2', + // company_name: 1} - ] - + // ] + this.json_answers1=[{"question":"a","answer":"a"},{"question":"b","answer":"b"},{"question":"c","answer":"c"}] + console.log('answers'); + console.log(this.json_answers); + //console.log(this.group_key); if(this.json_answers!=null && this.json_answers != undefined && this.json_answers) { // setTimeout(()=>{ @@ -138,16 +141,20 @@ export class DynamicQuestionTemplateComponent implements OnInit { // debugger; this.formGroupN.get(this.parent_ques.question_key) + this.whole_form.get(this.group_key).patchValue(this.json_answers) + + if(this.json_answers.length > 1) { this.generateGroupControls.emit() } - + // console.log('answers'); + // console.log(this.json_answers); this.json_answers.forEach((value,index)=>{ - + let keys= Object.keys(value) keys.forEach(vv=>{ @@ -259,8 +266,9 @@ export class DynamicQuestionTemplateComponent implements OnInit { control.removeAt(i); } } + //onchange properties function --json onchange properties// onChangeProperty(event,sec_control,question_key,options?,sec_index?,from?){ - // alert('datatamil'); + if(!from && from != 'TS' && this.quesService.formanswers != null) { console.log("Value changes",from); this.quesService.formanswers = null 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 453de1c..6b27ae8 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 @@ -57,7 +57,7 @@ export class QuesFormService { assignFormControl_array(formgroup: FormGroup, ques_data: any) { let pdid = JSON.parse(localStorage.getItem('pdid')) - const control: any = formgroup + const control: any = formgroup console.log(ques_data); console.log('quesdata'); ques_data.forEach((val, index) => { @@ -92,8 +92,7 @@ export class QuesFormService { "onchange_properties":null, "is_repeatable":null, "field_type":"string", - "validations":[ - + "validations":[ ] }, { @@ -722,6 +721,14 @@ export class QuesFormService { //ques_data[index].group_questions1 = [] + // console.log(val.question[0].answers.length); + console.log('maran'); + console.log(val.question[0].answers); + // if(val.question[0].company_length=='1') + // { + // alert('1'); + // } + ques_data[index].group_questions.push(val.question) val.group_questions[0].forEach((group_indi, arr_index) => { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/form/form.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/form/form.component.ts index 509092c..7f468d2 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/form/form.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/form/form.component.ts @@ -154,6 +154,7 @@ else } loadTemplate() { + console.log(this.pd_all_details); this.is_loading = true // let localId = this.getLocalFormId() // console.log("d",this.pd_all_details.form_id,Number(this.pd_all_details.form_id)) @@ -161,9 +162,13 @@ else let params = {"fk_entity_id":this.pd_all_details.pdmaster_details.fk_lender_id,"fk_product_id":this.pd_all_details.pdmaster_details.fk_product_id,"pd_form_id":this.pd_all_details.form_id,"fk_pd_id":this.pd_all_details.pdmaster_details.pd_id} this.pdTriggerService.loadCreditPDTemplate(params).subscribe(result=>{ if(!environment.production){ - //result.dataStatus = false + //result.dataStatus = false + //comment pannirundha api template .. + //comment pannalana local json.. } if(result.dataStatus) { + console.log('records'); + console.log(result.records); let question_template: any = result.records if (question_template && question_template != null && question_template != undefined ) { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html index 3e9c422..71039dd 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html @@ -32,7 +32,7 @@ QC Complete diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/13.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/13.json index 4fbfbe0..f3fb115 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/13.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/13.json @@ -178,10 +178,12 @@ "validator": "", "message": "Either Estimated Stock value or Estimated Quantity is required", "value": "(String('estimated_quantity') === String(''))", - "validation_to": "estimated_stock_value", + "validation_to": "estimated_uom", "value_keys": [ "estimated_quantity", - "estimated_stock_value" + "estimated_stock_value", + "estimated_uom" + ] } ] @@ -192,7 +194,13 @@ "parent_question_key": "provider_observed", "answers": null, "validations": [ - + { + "name": "required", + "isactive": "1", + "validator": "Validators.required", + "message": "Either Estimated Stock value or Estimated Quantity is required", + "value": null + } ] }, { @@ -217,16 +225,39 @@ "parent_question_key": "provider_observed", "answers": null, "validations": [ + { + "name": "required", + "isactive": "1", + "validator": "Validators.required", + "message": "Field required", + "value": null + } ] }, { "question": "Estimated value of stock observed", "question_key": "estimated_stock_value", "type": "1", - "field_type": "numtoword", + "field_type": "num", "field_width": "100", "api_properties": null, "onchange_properties": [ + { + "purpose": "validations", + "validations": [ + { + "name": "required", + "isactive": "1", + "validator": "", + "message": "Either Estimated Stock value or Estimated Quantity is required", + "value": "(String('estimated_stock_value') === String(''))", + "validation_to": "estimated_uom", + "value_keys": [ + "estimated_stock_value" + ] + } + ] + }, { "purpose": "validations", "validations": [ diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/WCTL/13.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/WCTL/13.json index 54483a6..2bfd26c 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/WCTL/13.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/WCTL/13.json @@ -41,7 +41,7 @@ } ] } - ] + ] } ] }, @@ -208,10 +208,12 @@ "validator": "", "message": "Either Estimated Stock value or Estimated Quantity is required", "value": "(String('estimated_quantity') === String(''))", - "validation_to": "estimated_stock_value", + "validation_to": "estimated_uom", "value_keys": [ "estimated_quantity", - "estimated_stock_value" + "estimated_stock_value", + "estimated_uom" + ] } ] @@ -270,6 +272,22 @@ "field_width": "100", "api_properties": null, "onchange_properties": [ + { + "purpose": "validations", + "validations": [ + { + "name": "required", + "isactive": "1", + "validator": "", + "message": "Either Estimated Stock value or Estimated Quantity is required", + "value": "(String('estimated_stock_value') === String(''))", + "validation_to": "estimated_uom", + "value_keys": [ + "estimated_stock_value" + ] + } + ] + }, { "purpose": "validations", "validations": [ diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/WCTL/4.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/WCTL/4.json index 2cc6fad..b5b6e7c 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/WCTL/4.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/WCTL/4.json @@ -10,6 +10,7 @@ "question_key":"company_name", "place_holder":"Enter text", "type":"3", + "company_length":"1", "api_properties":{ "api":"getCompanyListForSMCList", "api_method":"POST",