Fairoj : Sales PD MEQ product changes

This commit is contained in:
venbatechnologies@gmail.com 2020-12-14 10:21:33 +05:30
parent 377f4c6607
commit 4c4f60e5e4
5 changed files with 96 additions and 20 deletions

View File

@ -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":[

View File

@ -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<this.local_ques_JSON.onsubmit.length ; i++){
// this.quesAnsForm.value.questions.forEach(parent_ques=>{
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){

View File

@ -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

View File

@ -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)

View File

@ -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')) {