diff --git a/src/assets/data/sales_pd_templates/22.json b/src/assets/data/sales_pd_templates/22.json index cc83217..1afb345 100644 --- a/src/assets/data/sales_pd_templates/22.json +++ b/src/assets/data/sales_pd_templates/22.json @@ -3,7 +3,7 @@ "config":[ { "purpose":"LOCAL_OR_API_FORM_VALUES", - "expression":"(function () {if(control.question_key == 'constitution'){addorUpdateLocalStorage('constitution',control.answer_value);}return true}());", + "expression":"(function () {if('constitution'.toLowerCase() == '9' || 'constitution'.toLowerCase() == '10'){ removeSection('3') } else { addSection('3')}return true}());", "value_keys":[{"key_names":["constitution"],"section_id":"1"},{"key_names":["institution_type"],"section_id":"4"}] } ], @@ -76,13 +76,21 @@ { "question":"Constitution", "question_key":"constitution", - "place_holder":"Enter text", - "type":"1", + "type":"8", "answers":null, - "api_properties":null, + "api_properties":{ + "api":"getListOfMaster", + "api_method":"POST", + "params":{ + "master_name":"BUSINESSENTITYTYPE" + }, + "fields":[ + "business_entity_type_id", + "business_entity_type_name" + ] + }, "onchange_properties":null, "is_repeatable":null, - "field_type":"string", "validations":[ { "name":"required", @@ -90,13 +98,6 @@ "validator":"Validators.required", "message":"Constitution Required", "value":null - }, - { - "name":"pattern", - "isactive":"1", - "validator":"[A-Za-z ]*", - "message":"alphabets only ", - "value":null } ] }, @@ -1119,7 +1120,42 @@ "equipment" ] }, - "onchange_properties":null, + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[ + { + "insert_index":"equipment_list", + "expression":"(String(JSON.stringify('equipment_list')).includes(String('24')))", + "value_keys":[ + "equipment_list" + ], + "questions":[ + { + "question":"Please Specify the Equipments", + "question_key":"equipment_list_other", + "place_holder": "Enter the 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": "Required", + "value": null + } + ] + } + ] + } + ] + } + ], "is_repeatable":null, "answers":null, "validations":[ @@ -1168,7 +1204,42 @@ "vendor" ] }, - "onchange_properties":null, + "onchange_properties":[ + { + "purpose":"FORM_CTRL", + "form_controls":[ + { + "insert_index":"vendor_list", + "expression":"(String(JSON.stringify('vendor_list')).includes(String('16')))", + "value_keys":[ + "vendor_list" + ], + "questions":[ + { + "question":"Please Specify the Vendors", + "question_key":"vendor_list_other", + "place_holder": "Enter the 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": "Required", + "value": null + } + ] + } + ] + } + ] + } + ], "is_repeatable":null, "answers":null, "validations":[ diff --git a/src/pages/sales_pd/components/ques-template/ques-template.ts b/src/pages/sales_pd/components/ques-template/ques-template.ts index 56bf9dd..c76fda5 100755 --- a/src/pages/sales_pd/components/ques-template/ques-template.ts +++ b/src/pages/sales_pd/components/ques-template/ques-template.ts @@ -1000,7 +1000,8 @@ this.proceedonChangeProperty(modified) ques_control.controls.validations.setValue(updateMsg); return updateMsg; } - onSubmitProperty(){ + onSubmitProperty(sales_pd_id = this.sales_pd_id){ + console.log(this.sales_pd_id) let return_val=[] let send_val:boolean=true // this.local_ques_JSON.onsubmit=[ @@ -1022,7 +1023,7 @@ this.proceedonChangeProperty(modified) // ] // console.log(this.local_ques_JSON); if(this.local_ques_JSON.hasOwnProperty('onsubmit') && this.local_ques_JSON.onsubmit != null){ - this.salesPDProvider.getData_fromLocal('sales_pd_id_PRIMARYKEY').then((sales_pd_id)=>{ + // this.salesPDProvider.getData_fromLocal('sales_pd_id_PRIMARYKEY').then((sales_pd_id)=>{ for(let i=0; i{ let parent_ques @@ -1068,7 +1069,7 @@ this.proceedonChangeProperty(modified) break; } } -}) +// }) console.log(return_val) if(return_val.length > 0){ if(return_val.filter(res=>res == false).length > 0){ @@ -1335,6 +1336,7 @@ this.proceedonChangeProperty(modified) this.salesPDProvider.saveQuestions(params).subscribe((apiresult:any)=>{ if(apiresult['dataStatus']){ if(apiresult['records'] != true && typeof(apiresult['records']) != 'object'){ + this.sales_pd_id = apiresult['records'] this.salesPDProvider.insertData_Replace('sales_pd_id_PRIMARYKEY',String(apiresult['records'])).then(local_result=>{ this.salesPDProvider.insertData_Replace('sales_rand_string',String(apiresult['rand_string'])).then(()=>{ if(!this.submit_btn){ diff --git a/src/pages/sales_pd/pages/section-list/section-list.ts b/src/pages/sales_pd/pages/section-list/section-list.ts index 1ed569d..cba9587 100755 --- a/src/pages/sales_pd/pages/section-list/section-list.ts +++ b/src/pages/sales_pd/pages/section-list/section-list.ts @@ -72,7 +72,8 @@ export class SectionListPage { else { currFormDatas = {} } - this.config_expression = `(function () {console.log("c",'constitution'.toLowerCase() == 'trust');if('constitution'.toLowerCase() == 'trust' || 'constitution'.toLowerCase() == 'society'){ removeSection('3') } else { addSection('3')}return true}());` + // this.config_expression = `(function () {if('constitution'.toLowerCase() == '9' || 'constitution'.toLowerCase() == '10'){ removeSection('3') } else { addSection('3')}return true}());` + this.config_expression = temp_config.expression temp_config.value_keys.forEach((obj,index)=>{ console.log(currFormDatas[obj.key_names[0]]) // FOR VERIFY SECTION VALUE STORED diff --git a/src/pages/sales_pd/providers/offline-manager/offline-manager.ts b/src/pages/sales_pd/providers/offline-manager/offline-manager.ts index a23bff0..8da2e32 100755 --- a/src/pages/sales_pd/providers/offline-manager/offline-manager.ts +++ b/src/pages/sales_pd/providers/offline-manager/offline-manager.ts @@ -337,6 +337,8 @@ export class OfflineManagerProvider { deleteCompletedPD(pd_id) { return this.ionicStorage.get(pd_key).then(result => { let result_arr = result + let storageKey ='PD_FORM_VALUES-'+pd_id + localStorage.removeItem(storageKey) if(result_arr && result_arr.length > 0) { let updated_local_pds = result_arr.filter(val=>val.sales_pd_id != pd_id) console.log(updated_local_pds) diff --git a/src/pages/sales_pd/providers/sales-pd/sales-pd.ts b/src/pages/sales_pd/providers/sales-pd/sales-pd.ts index c4cf704..a2aca94 100755 --- a/src/pages/sales_pd/providers/sales-pd/sales-pd.ts +++ b/src/pages/sales_pd/providers/sales-pd/sales-pd.ts @@ -38,12 +38,12 @@ current_section:any; let users:any=localStorage.getItem('user_details') users=JSON.parse(users) let params = {records:{lender_id:users.fk_entity_id,product_id:product_id,sales_pd_type:sales_pd_type}} - return Observable.create((observer:any)=>{ + return new Observable((observer:any)=>{ if(this.networkProvider.getCurrentNetworkStatus() == ConnectionStatus.online) { console.log(this.platform.is('cordova')) let api_properties = {method:'post', api_name:this.apiUrl+'loadSalesPDTemplate',params : params} if(!this.platform.is('cordova')) { - // api_properties = {method:'get', api_name:`assets/data/sales_pd_templates/${product_id}.json`,params : params + // api_properties = {method:'get', api_name:`assets/data/sales_pd_templates/${product_id}.json`,params : params} } return this.http[api_properties.method](api_properties.api_name,api_properties.params).subscribe(result=>{ if(!this.platform.is('cordova') && !result.hasOwnProperty('dataStatus')) {