From e4213ccaaa17d5d1460cbccd5026b7b4a8edd437 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Mon, 3 Aug 2020 18:57:54 +0530 Subject: [PATCH] Fairoj : covid 19 question feedback changes --- .../dynamic-question-template.component.html | 12 ++++----- .../queries-docs/queries-docs.component.ts | 21 ++++++++++----- .../list-pd/start-pd/start-pd.component.ts | 2 +- .../pd-pipes/number-to-words.pipe.ts | 8 +++++- ng6-seed/src/assets/sample_covid19_ques.json | 27 ++++++++++++++++--- 5 files changed, 53 insertions(+), 17 deletions(-) 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 index 176fd02f3..0da689391 100644 --- 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 @@ -1,7 +1,7 @@
+ [ngStyle]="{'margin-bottom':parent_ques.field_type == 'numtoword' || parent_ques.field_type == 'str&numtoword' ? '5%' : '0' }"> {{parent_ques.question}} {{"₹"}} {{formGroupN.value[parent_ques.question_key] | numberToWords}} @@ -21,20 +21,20 @@ + *ngIf="parent_ques.type == '9'" [ngStyle]="{'margin-bottom':parent_ques.field_type == 'numtoword' || parent_ques.field_type == 'str&numtoword' ? '5%' : '0' }"> {{parent_ques.question}} - - + {{val.answer}} {{"₹"}} {{formGroupN.value[parent_ques.question_key] | numberToWords}} 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 ad77555df..c62d88a06 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 @@ -382,15 +382,24 @@ export class QueriesDocsComponent implements OnInit { }); } - 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 ,is_subfield:vv.hasOwnProperty('is_subfield') ? vv.is_subfield : '0' - ,parent_question_key:vv.hasOwnProperty('parent_question_key') ? vv.parent_question_key : ''} + 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 ,is_subfield:vv.hasOwnProperty('is_subfield') ? vv.is_subfield : '0' + // ,parent_question_key:vv.hasOwnProperty('parent_question_key') ? vv.parent_question_key : ''} + let all_value = JSON.parse(JSON.stringify(vv)); + delete all_value.onchange_properties + delete all_value.api_properties + delete all_value.answers + delete all_value.validations + all_value.hasOwnProperty('raw_validations') ? delete all_value.raw_validations : '' + all_value.is_subfield = all_value.hasOwnProperty('is_subfield') ? all_value.is_subfield : '0' + all_value.parent_question_key = all_value.hasOwnProperty('parent_question_key') ? all_value.parent_question_key : '' + return all_value }) - let covidFormAnswers = this.covid19QuesForm.getRawValue() + let covidFormAnswers = this.covid19QuesForm.getRawValue() covidFormAnswers.question_info = geneatedQues formParams.covid_section = covidFormAnswers - } + } console.log(formParams); this.pdTriggerService.saveForm(formParams,this.pd_all_details.pdmaster_details.curr_vendor_ans_fetch_status).subscribe(res=>{ 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 b1c8822d7..fa01225bb 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 @@ -96,7 +96,7 @@ export class StartPdComponent implements OnInit, OnDestroy { } 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" } + let params = { "fk_entity_id":"","fk_product_id":"","pd_form_id":"24","fk_pd_id": this.startPD } this._pd.loadCreditPDTemplate(params).subscribe(result=> { let creditTemplate:any = null; if(result['dataStatus']) { diff --git a/ng6-seed/src/app/personal-discussion/pd-pipes/number-to-words.pipe.ts b/ng6-seed/src/app/personal-discussion/pd-pipes/number-to-words.pipe.ts index 381044068..87f8dca11 100755 --- a/ng6-seed/src/app/personal-discussion/pd-pipes/number-to-words.pipe.ts +++ b/ng6-seed/src/app/personal-discussion/pd-pipes/number-to-words.pipe.ts @@ -68,7 +68,13 @@ export class NumberToWordsPipe implements PipeTransform { str = words.reverse().join("") // str =(str.length > 2 && str.charAt(str.length-2)==',') ? str.slice(0, -2) : str; } else str = ""; - return str + if(str) { + return str + } + else { + return null + } + } diff --git a/ng6-seed/src/assets/sample_covid19_ques.json b/ng6-seed/src/assets/sample_covid19_ques.json index b4d884221..cb7151ee3 100644 --- a/ng6-seed/src/assets/sample_covid19_ques.json +++ b/ng6-seed/src/assets/sample_covid19_ques.json @@ -221,12 +221,33 @@ "question":"How much is your sales/revenue from April till date?", "question_key":"sales_or_revenue_amt", "place_holder":"Enter amount", - "type":"1", + "type":"9", + "answers":[ + { + "answer":"Not Disclosed", + "answer_id":"Not Disclosed" + } + ], + "onchange_properties":[ + { + "purpose": "validations", + "validations": [ + { + "name": "pattern", + "isactive": "1", + "validator": "", + "message": "Please enter the amount or choose the suggested text", + "value": "(String('sales_or_revenue_amt').toLowerCase() != String('not disclosed')) ? '[0-9]*' : false", + "validation_to": null, + "value_keys": ["sales_or_revenue_amt"] + } + ] + } + ], "field_width":"100", - "answers":null, "api_properties":null, "is_repeatable":null, - "field_type":"numtoword", + "field_type":"str&numtoword", "validations":[ { "name":"required",