From 8441c37ede17633d508b09eeb06e85ffd776c43f Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Tue, 24 Nov 2020 16:56:34 +0530 Subject: [PATCH] Feedback changes and issues fixes --- .../list-pd/add-pd/add-pd.component.html | 12 +- .../list-pd/add-pd/add-pd.component.scss | 3 + .../list-pd/add-pd/add-pd.component.ts | 16 +- .../dynamic-question-template.component.ts | 14 +- .../ques-form/ques-form.service.ts | 4 +- .../capture-btn/capture-btn.component.ts | 24 +-- .../image-capture/image-capture.component.ts | 5 + .../data/SMC_CREDIT_TEMPLATES/LFMP/1.json | 138 ++++++++++-------- .../data/SMC_CREDIT_TEMPLATES/LFMP/10.json | 19 +-- .../data/SMC_CREDIT_TEMPLATES/LFMP/12.json | 7 - .../data/SMC_CREDIT_TEMPLATES/LFMP/13.json | 9 +- .../data/SMC_CREDIT_TEMPLATES/LFMP/15.json | 13 +- .../data/SMC_CREDIT_TEMPLATES/LFMP/16.json | 28 +++- .../data/SMC_CREDIT_TEMPLATES/LFMP/2.json | 28 +++- .../data/SMC_CREDIT_TEMPLATES/LFMP/3.json | 39 +---- .../data/SMC_CREDIT_TEMPLATES/LFMP/8.json | 26 +++- .../data/SMC_CREDIT_TEMPLATES/WCTL/3.json | 39 +---- 17 files changed, 224 insertions(+), 200 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html index e22a9d2..4a68725 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html @@ -58,6 +58,7 @@ {{LB.branch_name}} + Branch Required. @@ -124,7 +125,7 @@ - + Product Required. @@ -135,7 +136,7 @@ {{SPL.subproduct_name}} - + Sub Product Required. @@ -184,7 +185,7 @@ - + Address required. @@ -200,7 +201,7 @@ - + State Required. @@ -213,7 +214,7 @@ {{CL.city_name}} - + City Required. @@ -225,6 +226,7 @@ {{PL.pincode}} + Pincode Required. diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.scss index aab0f0f..fe41fbc 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.scss @@ -4,4 +4,7 @@ mat-form-field { .mat-form-field-appearance-legacy .mat-hint{ color:rgba(0, 0, 0, 0.8) !important; } +.mat-error { + float: right; +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts index b3a2f13..e4acb12 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts @@ -159,7 +159,7 @@ export class AddPdComponent implements OnInit, OnDestroy { fk_lender_id: [{value:this.userDetails.fk_entity_id,disabled: true} || ''], // fk_lender_id: [{value:this.userDetails.fk_entity_id,disabled: this.userDetails.short_name != 'CHFPL' && this.userDetails.short_name != 'CLIX' ? true : false} || ''], sub_entity_id: [{value:this.userDetails.fk_entity_id,disabled: this.userDetails.short_name != 'CHFPL' ? true : false} || ''], - pd_branch_id: [null], + pd_branch_id: [null,Validators.required], lender_applicant_id: [null, Validators.compose([Validators.required])], lender_sales_person:[null], mwise_sales_person:[null], @@ -170,7 +170,7 @@ export class AddPdComponent implements OnInit, OnDestroy { // lender_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])], // lender_landline: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])], //lender_billing: [null], - fk_product_id: [null], + fk_product_id: [null,Validators.required], fk_subproduct_id: [null], fk_pd_type: ['1'], fk_customer_segment: [null], @@ -337,6 +337,7 @@ export class AddPdComponent implements OnInit, OnDestroy { } // console.log('productID',productID,productabbr); /**customer segment */ + this._PDtriggerForm.controls['fk_subproduct_id'].clearValidators() switch(productabbr){ case 'WCTL' : // console.log(1); @@ -360,9 +361,10 @@ export class AddPdComponent implements OnInit, OnDestroy { // console.log(3); this.customerSegmentList = this.customerSegmentAllList; this.isSubproductShown = true; + this._PDtriggerForm.controls['fk_subproduct_id'].setValidators(Validators.required) break; } - + this._PDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity(); // if(this.lenderShortName == 'CLIX' && productabbr != ''){ // this._PDtriggerForm.controls['fk_pd_type'].setValue('1'); // this._PDtriggerForm.controls['fk_customer_segment'].setValue('5'); @@ -472,13 +474,13 @@ export class AddPdComponent implements OnInit, OnDestroy { get pdAddresses() { return this._PDtriggerForm.get('addresses') as FormArray; } createAddresses(): FormGroup { return this._fb.group({ - addressline1: [null], - fk_city: [null], - fk_state: [null], + addressline1: [null,Validators.required], + fk_city: [null,Validators.required], + fk_state: [null,Validators.required], stateSearch:[null], citySearch:[null], pinSearch:[null], - pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */ + pincode: [null,Validators.required],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */ other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])], }); }; 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 1932f04..63253f6 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 @@ -652,12 +652,14 @@ export class DynamicQuestionTemplateComponent implements OnInit { 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] + ques_control=this.whole_json[this.json_index] + console.log(ques_control,this.whole_json,this.json_index) + let other_control = ques_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) 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 f64735c..71cda50 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 @@ -387,7 +387,7 @@ export class QuesFormService { // FOR SETTING THE ARRAY OF VALIDATORS COMING FROM JSON Temp, settingArrayofValidators(data,curr_control,curr_index){ - console.log("entered",data); + console.log("entered",data,curr_control); if(data.hasOwnProperty('validations') && data.validations.length > 0 ){ const validList :any= []; let validator_value @@ -413,9 +413,11 @@ export class QuesFormService { // console.log(eval(val)) console.log(validList) // curr_control.controls[curr_index].controls.answer_value.setValidators(validList) + if(curr_control.controls[data.question_key]) { 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; } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/image-capture/capture-btn/capture-btn.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/image-capture/capture-btn/capture-btn.component.ts index d67b5fc..a2530ee 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/image-capture/capture-btn/capture-btn.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/image-capture/capture-btn/capture-btn.component.ts @@ -32,19 +32,19 @@ export class CaptureBtnComponent implements OnInit { } capture(event){ event.preventDefault(); - this.cameraService.getPosition().then(geoCords=>{ - let geoCoordinates - if(geoCords != 'error') { - geoCoordinates = geoCords - // let element:HTMLElement = document.getElementById('input-file') as HTMLElement - // element.click(); + // this.cameraService.getPosition().then(geoCords=>{ + // let geoCoordinates + // if(geoCords != 'error') { + // geoCoordinates = geoCords + let element:HTMLElement = document.getElementById('input-file') as HTMLElement + element.click(); console.log(this.fileBtn) - this.fileBtn.nativeElement.click() + // this.fileBtn.nativeElement.click() console.log("After Click") - } - else{ - alert("Location is OFF. Make sure Location is turned ON in your device before capturing images") - } - }) + // } + // else{ + // alert("Location is OFF. Make sure Location is turned ON in your device before capturing images") + // } + // }) } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/image-capture/image-capture.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/image-capture/image-capture.component.ts index c854afd..a1e3b8d 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/image-capture/image-capture.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/image-capture/image-capture.component.ts @@ -111,6 +111,9 @@ export class ImageCaptureComponent implements OnInit { } else { geoCoordinates = null; + alert("Location is OFF. Make sure Location is turned ON in your device before capturing images"); + this.loaderService.closeMatSpinnerDialog() + return; } console.log(geoCords); this.cameraService.addWatermarks(reader.result,geoCoordinates).then(watermarked_img=>{ @@ -153,6 +156,8 @@ export class ImageCaptureComponent implements OnInit { console.log("dk",err); this.loaderService.closeMatSpinnerDialog(); }) + },err=>{ + this.loaderService.closeMatSpinnerDialog() }) } } diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/1.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/1.json index 8d09e13..9efcbe7 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/1.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/1.json @@ -11,7 +11,55 @@ "field_width":"100", "answers":null, "api_properties":null, - "onchange_properties":null, + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[ + { + "insert_index":"relationship", + "expression":"(String('borrower_type').toLowerCase() != String('guarantor'))", + "value_keys":[ + "borrower_type" + ], + "questions":[ + { + "question":"Numbers of years for which the business has been running", + "question_key":"numbers_of_years_business_running", + "type":"1", + "field_width":"45", + "field_type":"num", + "api_properties":null, + "answers":null, + "onchange_properties":null, + "is_subfield":"1", + "parent_question_key":"entity_type", + "is_repeatable":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Field Required", + "value":null + } + ] + } + ] + } + ] + }, + { + "purpose":"validations", + "validations":[{ + "value_keys":["borrower_type"], + "value":"(String('borrower_type').toLowerCase() != String('guarantor'))", + "validation_to":"borrower_age", + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required" + }]} + ], "is_repeatable":null, "validations":[ { @@ -59,45 +107,6 @@ "value_keys":[ "entity_type" ], - "questions":[ - { - "question":"Met / Not Met", - "question_key":"borrower_met", - "type":"2", - "field_width":"100", - "api_properties":null, - "answers":[ - { - "answer_id":"Yes", - "answer":"Yes" - }, - { - "answer_id":"No", - "answer":"No" - } - ], - "onchange_properties":null, - "is_subfield":"1", - "parent_question_key":"entity_type", - "is_repeatable":null, - "validations":[ - { - "name":"required", - "isactive":"1", - "validator":"Validators.required", - "message":"Field Required", - "value":null - } - ] - } - ] - }, - { - "insert_index":"relationship", - "expression":"(String('entity_type').toLowerCase() != String('borrower'))", - "value_keys":[ - "entity_type" - ], "questions":[ { "question":"Age", @@ -124,19 +133,27 @@ ]}, { "insert_index":"relationship", - "expression":"(String('entity_type').toLowerCase() != String('guarantor'))", + "expression":"(String('entity_type').toLowerCase() == String('individual'))", "value_keys":[ "entity_type" ], "questions":[ { - "question":"Numbers of years for which the business has been running", - "question_key":"numbers_of_years_business_running", - "type":"1", - "field_width":"45", - "field_type":"num", + "question":"Met / Not Met", + "question_key":"borrower_met", + "type":"2", + "field_width":"100", "api_properties":null, - "answers":null, + "answers":[ + { + "answer_id":"Yes", + "answer":"Yes" + }, + { + "answer_id":"No", + "answer":"No" + } + ], "onchange_properties":null, "is_subfield":"1", "parent_question_key":"entity_type", @@ -151,7 +168,9 @@ } ] } - ]} + ] + } + ] }, { @@ -162,17 +181,18 @@ ], "insert_control":"numbers_of_years_business_running" }, - { - "purpose":"validations", - "validations":[{ - "value_keys":["entity_type"], - "value":"(String('entity_type').toLowerCase() != String('guarantor'))", - "validation_to":"borrower_age", - "name":"required", - "isactive":"1", - "validator":"Validators.required", - "message":"Required" - }]}], + { + "purpose":"validations", + "validations":[{ + "value_keys":["borrower_type"], + "value":"(String('borrower_type').toLowerCase() != String('guarantor'))", + "validation_to":"borrower_age", + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required" + }]} + ], "is_repeatable":null, "validations":[ { diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/10.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/10.json index ac83557..7265bb9 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/10.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/10.json @@ -3,7 +3,7 @@ "section_name":"Financial Information", "onsubmit":[ { - "expression":"(function (){let sum_val=null;let ques_key=[];control.questions_group.forEach(ques_obj=>{ques_obj.questions.map(ques=>{if(ques.question_key == submitProperty.key_name){ques_key.push(ques.answer_value)}})});console.log('none',ques_key);return new Set(ques_key).size === ques_key.length}())", + "expression":"(function (){let sum_val=null;let ques_key=[];control.forEach(ques_obj=>{ques_key.push(ques_obj[submitProperty.key_name])});console.log('none',ques_key);return new Set(ques_key).size === ques_key.length}())", "group_key":"financial_info", "key_name":"fy", "msg":"Financial Year already entered earlier" @@ -112,7 +112,7 @@ "onchange_properties":[ { "purpose":"answer_value", - "expression":"(Number(net_profit)/Number(sales_revenue))*100", + "expression":"((Number(net_profit)/Number(sales_revenue))*100).toFixed(2)", "value_keys":[ "sales_revenue","net_profit" ], @@ -130,7 +130,7 @@ { "purpose":"answer_value_arr", "arr_include":["py","now"], - "expression":"((Number(net_profit_sales_percent[now])-Number(net_profit_sales_percent[py]))/Number(net_profit_sales_percent[py]))*100", + "expression":"(((Number(net_profit_sales_percent[now])-Number(net_profit_sales_percent[py]))/Number(net_profit_sales_percent[py]))*100).toFixed(2)", "value_keys":[ "net_profit_sales_percent" ], @@ -162,7 +162,7 @@ { "purpose":"answer_value_arr", "arr_include":["py","now"], - "expression":"((Number(net_profit_sales_percent[now])-Number(net_profit_sales_percent[py]))/Number(net_profit_sales_percent[py]))*100", + "expression":"(((Number(net_profit_sales_percent[now])-Number(net_profit_sales_percent[py]))/Number(net_profit_sales_percent[py]))*100).toFixed(2)", "value_keys":[ "net_profit_sales_percent" ], @@ -597,13 +597,6 @@ "onchange_properties": null, "is_repeatable": null, "validations": [ - { - "name": "required", - "isactive": "1", - "validator": "Validators.required", - "message": "Field Required", - "value": null - } ] } ] @@ -664,7 +657,7 @@ }, { "purpose":"answer_value", - "expression":"(function (){let final_value; Number(net_profit_rs) ? final_value = (Number(net_profit_rs)/Number(sales_amount))*100 : '';return final_value}())", + "expression":"(function (){let final_value; Number(net_profit_rs) ? final_value = (Number(net_profit_rs)/Number(sales_amount))*100 : '';return final_value.toFixed(2)}())", "value_keys":[ "sales_amount", "net_profit_rs" ], @@ -741,7 +734,7 @@ "onchange_properties":[ { "purpose":"answer_value", - "expression":"(Number(net_profit_rs)/Number(sales_amount))*100", + "expression":"((Number(net_profit_rs)/Number(sales_amount))*100).toFixed(2)", "value_keys":[ "sales_amount", "net_profit_rs" ], diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/12.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/12.json index 5440241..cffc0d9 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/12.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/12.json @@ -151,13 +151,6 @@ "parent_question_key":"client_info_available", "answers":null, "validations":[ - { - "name":"required", - "isactive":"1", - "validator":"Validators.required", - "message":"Field required", - "value":null - }, { "name":"pattern", "isactive":"1", 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 13ba301..46ceb5b 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 @@ -253,20 +253,13 @@ "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": "num", + "field_type": "numtoword", "field_width": "100", "api_properties": null, "onchange_properties": [ diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/15.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/15.json index b0e7857..86d1392 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/15.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/15.json @@ -28,7 +28,7 @@ "question": "Loan amount", "question_key": "loan_amount", "type": "1", - "field_type": "num", + "field_type": "numtoword", "field_width": "100", "onchange_properties": null, "api_properties": null, @@ -216,7 +216,16 @@ "field_type": "num", "api_properties": null, "answers": null, - "onchange_properties": null, + "onchange_properties": [ + { + "purpose":"answer_value", + "expression":"(Number(original_tenure_months)-Number(elapsed_tenure_months))", + "value_keys":[ + "original_tenure_months", "elapsed_tenure_months" + ], + "insert_control":"current_tenure_months" + } + ], "is_repeatable": null, "validations": [ { diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/16.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/16.json index 7f590cd..00388db 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/16.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/16.json @@ -64,7 +64,33 @@ ] }, "answers":null, - "onchange_properties":null, + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[{ + "insert_index":"relationship", + "expression":"(String('relationship').toLowerCase() == String('1'))", + "value_keys":[ + "relationship" + ], + "questions":[ + { + "question": "Specify Facility details", + "question_key": "relationship_other", + "type": "1", + "field_width": "45", + "field_type": "string", + "api_properties": null, + "answers": null, + "onchange_properties": null, + "is_repeatable": null, + "validations": [ + ] + } + ] + }] + } + ], "is_repeatable":null, "validations":[ { diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/2.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/2.json index 44f02c2..47acef5 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/2.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/2.json @@ -168,7 +168,33 @@ ] }, "answers":null, - "onchange_properties":null, + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[{ + "insert_index":"pd_locality", + "expression":"(String('pd_locality').toLowerCase() == String('1'))", + "value_keys":[ + "pd_locality" + ], + "questions":[ + { + "question": "Specify Locality", + "question_key": "locality_other", + "type": "1", + "field_width": "45", + "field_type": "string", + "api_properties": null, + "answers": null, + "onchange_properties": null, + "is_repeatable": null, + "validations": [ + ] + } + ] + }] + } + ], "is_repeatable":null, "validations":[ { diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/3.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/3.json index c5f06db..18e6d39 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/3.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/3.json @@ -134,44 +134,9 @@ "type":"1", "field_width":"45", "api_properties":null, + "field_type":"numtoword", "answers":null, - "onchange_properties": [{ - "purpose":"FORM_CTRL", - "form_controls":[ - { - "insert_index":"total_fund_requirement", - "expression":"(String('total_fund_requirement').toLowerCase() == String('disclosed')) && (String('total_fund_requirement'))", - "value_keys":[ - "total_fund_requirement" - ], - "questions":[ - { - "question":"Fund Requirement for end use", - "question_key":"end_use_fund_requirement", - "place_holder":"", - "field_type":"string", - "type":"1", - "field_width":"100", - "api_properties":null, - "onchange_properties":null, - "is_repeatable":null, - "is_subfield":"1", - "parent_question_key":"total_fund_requirement", - "answers":null, - "validations":[ - { - "name":"required", - "isactive":"1", - "validator":"Validators.required", - "message":"Field required", - "value":null - } - ] - } - ] - } - ] - }, + "onchange_properties": [ { "purpose":"FORM_CTRL", "form_controls":[ diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/8.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/8.json index 240e19a..66ce862 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/8.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/LFMP/8.json @@ -196,9 +196,9 @@ ] }, { - "question":"Factory owned by", + "question":"Owned by", "question_key":"business_name_of_the_owner", - "type":"3", + "type":"4", "field_width":"45", "api_properties": { @@ -229,7 +229,16 @@ "type":"1", "field_width":"45", "api_properties":null, - "onchange_properties":null, + "onchange_properties":[ + { + "purpose":"answer_value", + "expression":"(function(){let current_year = new Date().getFullYear(); return current_year-Number(business_vintage)}())", + "value_keys":[ + "business_vintage" + ], + "insert_control":"business_purchase_year" + } + ], "is_repeatable":null, "is_subfield":"1", "parent_question_key":"business_ownership_type", @@ -245,7 +254,16 @@ "type":"1", "field_width":"45", "api_properties":null, - "onchange_properties":null, + "onchange_properties":[ + { + "purpose":"answer_value", + "expression":"(function(){let current_year = new Date().getFullYear(); return current_year-Number(business_purchase_year)}())", + "value_keys":[ + "business_purchase_year" + ], + "insert_control":"business_vintage" + } + ], "is_repeatable":null, "is_subfield":"1", "parent_question_key":"business_ownership_type", diff --git a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/WCTL/3.json b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/WCTL/3.json index 6bc8ff2..c453bca 100644 --- a/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/WCTL/3.json +++ b/ng6-seed/src/assets/data/SMC_CREDIT_TEMPLATES/WCTL/3.json @@ -103,46 +103,11 @@ "question":"Total fund requirement", "question_key":"total_fund_requirement", "type":"1", + "field_type":"numtoword", "field_width":"45", "api_properties":null, "answers":null, - "onchange_properties": [{ - "purpose":"FORM_CTRL", - "form_controls":[ - { - "insert_index":"total_fund_requirement", - "expression":"(String('total_fund_requirement').toLowerCase() == String('disclosed')) && (String('total_fund_requirement'))", - "value_keys":[ - "total_fund_requirement" - ], - "questions":[ - { - "question":"Fund Requirement for end use", - "question_key":"end_use_fund_requirement", - "place_holder":"", - "field_type":"string", - "type":"1", - "field_width":"100", - "api_properties":null, - "onchange_properties":null, - "is_repeatable":null, - "is_subfield":"1", - "parent_question_key":"total_fund_requirement", - "answers":null, - "validations":[ - { - "name":"required", - "isactive":"1", - "validator":"Validators.required", - "message":"Field required", - "value":null - } - ] - } - ] - } - ] - }, + "onchange_properties": [ { "purpose":"FORM_CTRL", "form_controls":[