From 3481447e6e873ddf7b716067cdd8fa74839a5efd Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Sat, 26 Dec 2020 20:01:59 +0530 Subject: [PATCH] Fairoj : Sales PD Dynamic product listing --- config.xml | 2 +- src/assets/data/sales_pd_templates/22.json | 253 +++++++++--------- src/pages/sales_pd/pages/home/home.ts | 12 +- .../sales_pd/pages/home/product-list.html | 1 + src/providers/pdtrigger/pdtrigger.ts | 4 +- 5 files changed, 144 insertions(+), 128 deletions(-) diff --git a/config.xml b/config.xml index 218db3a..f79a898 100755 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - + PD Genie info@pdgenie.com PD Genie diff --git a/src/assets/data/sales_pd_templates/22.json b/src/assets/data/sales_pd_templates/22.json index b5bbdcf..d87a0f4 100644 --- a/src/assets/data/sales_pd_templates/22.json +++ b/src/assets/data/sales_pd_templates/22.json @@ -77,18 +77,79 @@ "question":"Constitution", "question_key":"constitution", "type":"8", - "answers":null, - "api_properties":{ - "api":"getListOfMaster", - "api_method":"POST", - "params":{ - "master_name":"BUSINESSENTITYTYPE" + "answers":[ + { + "answer_id":"6", + "answer":"Cooperative", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" }, - "fields":[ - "business_entity_type_id", - "business_entity_type_name" - ] - }, + { + "answer_id":"4", + "answer":"HUF (Hindu Undivided Family)", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"7", + "answer":"Limited Liability Partnership(LLP)", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"5", + "answer":"Partnership", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"11", + "answer":"Private Limited Company", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"2", + "answer":"Public Ltd Company", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"12", + "answer":"Self Employed-Individual", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"9", + "answer":"Society", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"3", + "answer":"Sole proprietorship", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"10", + "answer":"Trust", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + } + ], + "api_properties":null, "onchange_properties":null, "is_repeatable":null, "validations":[ @@ -367,12 +428,26 @@ "type":"4", "answers":[ { - "answer_id":"Puchase of Medical Equipment", - "answer":"Puchase of Medical Equipment", + "answer_id":"Purchase of Medical Equipment (New)", + "answer":"Purchase of Medical Equipment (New)", "subfield_key":"", "subfield_caption":"", "subfield_type":"" }, + { + "answer_id":"Purchase of Medical Equipment (Refurbished)", + "answer":"Purchase of Medical Equipment (Refurbished)", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, + { + "answer_id":"Purchase of Medical Equipment (New and Refurbished)", + "answer":"Purchase of Medical Equipment (New and Refurbished)", + "subfield_key":"", + "subfield_caption":"", + "subfield_type":"" + }, { "answer_id":"Refinance", "answer":"Refinance", @@ -510,41 +585,6 @@ "value_keys":null } ] - }, - { - "purpose":"FORM_CTRL", - "form_controls":[ - { - "insert_index":"total_work_exp", - "expression":"(total_work_exp > vintage_in_current_biz)", - "value_keys":[ - "total_work_exp", - "vintage_in_current_biz" - ], - "questions":[ - { - "question_key":"previous_experience_details", - "question":"Previous Experience Details", - "place_holder":"Enter 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":"Previous Experience Required", - "value":null - } - ] - } - ] - } - ] } ] }, @@ -587,41 +627,6 @@ "value_keys":null } ] - }, - { - "purpose":"FORM_CTRL", - "form_controls":[ - { - "insert_index":"total_work_exp", - "expression":"(total_work_exp > vintage_in_current_biz)", - "value_keys":[ - "total_work_exp", - "vintage_in_current_biz" - ], - "questions":[ - { - "question":"Previous Experience Details", - "question_key":"previous_experience_details", - "place_holder":"Enter 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":"Previous Experience Required", - "value":null - } - ] - } - ] - } - ] } ] }, @@ -685,12 +690,52 @@ "purpose":"FORM_CTRL", "form_controls":[ { - "insert_index":"occupancy_ratio", + "insert_index":"floor", "expression":"(String('institution_type') == String('Hospital')) || (String('institution_type') == String('Nursing Home'))", "value_keys":[ "institution_type" ], "questions":[ + { + "question":"How many Bedded", + "question_key":"how_many_beds", + "type":"1", + "field_type":"num", + "place_holder": "Enter the number", + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "answers":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + }, + { + "question":"Occupancy Ratio", + "question_key":"occupancy_ratio", + "type":"1", + "field_type":"num", + "place_holder": "Enter the number", + "api_properties":null, + "onchange_properties":null, + "is_repeatable":null, + "answers":null, + "validations":[ + { + "name":"required", + "isactive":"1", + "validator":"Validators.required", + "message":"Required", + "value":null + } + ] + }, { "question_key":"tot_doctors", "question":"How many doctor’s", @@ -1025,46 +1070,6 @@ } ] }, - { - "question":"How many Bedded", - "question_key":"how_many_beds", - "type":"1", - "field_type":"num", - "place_holder": "Enter the number", - "api_properties":null, - "onchange_properties":null, - "is_repeatable":null, - "answers":null, - "validations":[ - { - "name":"required", - "isactive":"1", - "validator":"Validators.required", - "message":"Required", - "value":null - } - ] - }, - { - "question":"Occupancy Ratio", - "question_key":"occupancy_ratio", - "type":"1", - "field_type":"num", - "place_holder": "Enter the number", - "api_properties":null, - "onchange_properties":null, - "is_repeatable":null, - "answers":null, - "validations":[ - { - "name":"required", - "isactive":"1", - "validator":"Validators.required", - "message":"Required", - "value":null - } - ] - }, { "question":"Number of staff observed", "question_key":"staff_observer_number", diff --git a/src/pages/sales_pd/pages/home/home.ts b/src/pages/sales_pd/pages/home/home.ts index 09c7374..4d46678 100755 --- a/src/pages/sales_pd/pages/home/home.ts +++ b/src/pages/sales_pd/pages/home/home.ts @@ -23,7 +23,7 @@ import { NetworkDetectionProvider, ConnectionStatus } from '../../../../provider templateUrl: 'product-list.html', }) export class HomePage{ - productList: any; + productList: any = []; product:string=''; sales_pd_type:string='' pd_type_list:any=[{ @@ -42,6 +42,16 @@ export class HomePage{ this.pdTriggerProvider.getEntityPreferences(users.fk_entity_id).subscribe(result=>{ if(result['dataStatus']){ this.productList=result['records'].salespd_products; + let user_info = JSON.parse(localStorage.getItem('user_details')) + if(user_info && user_info.user_config && user_info.user_config.salespd_products) { + let product_config = user_info.user_config.salespd_products + console.log(product_config) + this.productList = this.productList.filter(vv=>product_config.includes(vv.product_id)) + console.log(this.productList) + } + else { + this.productList = [] + } let old_product_id=localStorage.getItem('product_id_salesPD') this.product=old_product_id } diff --git a/src/pages/sales_pd/pages/home/product-list.html b/src/pages/sales_pd/pages/home/product-list.html index 575d925..b616b46 100755 --- a/src/pages/sales_pd/pages/home/product-list.html +++ b/src/pages/sales_pd/pages/home/product-list.html @@ -35,6 +35,7 @@ border-radius: 10px;" *ngFor="let val of pd_type_list" [value]="val.id" (change)="getProductForAlert($event)">{{val.dis_name}}
Choose the Product
+

No Products available