From 4287a99485f9d97d273be6d93386bfcdbd303b52 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Fri, 26 Jun 2020 17:42:59 +0530 Subject: [PATCH] Fairoj : smart PD Data Fetching and video call enabled for smart pd --- .../forms/address/address.component.ts | 40 +++++++++++++++---- .../business-assets-info.component.ts | 31 ++++++++++++++ .../business-info/business-info.component.ts | 34 ++++++++++++++++ .../final-remarks/final-remarks.component.ts | 28 +++++++++++++ .../general-info/general-info.component.html | 9 ++--- .../general-info/general-info.component.ts | 20 ++++++++++ .../neighbour-hood.component.ts | 35 ++++++++++++++++ .../list-pd/view-pd/view-pd.component.html | 24 +++++++++-- .../list-pd/view-pd/view-pd.component.ts | 1 + .../pd-service/pd-triger.service.ts | 18 +++++++++ 10 files changed, 223 insertions(+), 17 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts index 1b85e5ad3..fe9c5eb07 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts @@ -171,8 +171,9 @@ export class AddressComponent implements OnInit { ChildCtrl.controls['pincode_others'].updateValueAndValidity(); } - - this.addressForm.controls.pd_location.setValue(datas.pd_location ? datas.pd_location : ''); + if(datas.pd_location) { + this.addressForm.controls.pd_location.setValue(datas.pd_location); + } this.addressForm.controls.address_type.setValue(datas.address_type ? datas.address_type : ''); if (datas.address_type) { let selectedAddressType = this.addressData.filter(element => element.address_type_id == datas.address_type)[0]; @@ -187,7 +188,9 @@ export class AddressComponent implements OnInit { } - this.addressForm.controls.comment_locality.setValue(datas.comment_locality ? datas.comment_locality : ''); + if(datas.comment_locality) { + this.addressForm.controls.comment_locality.setValue(datas.comment_locality); + } this.addressForm.controls.locality.setValue(datas.locality ? datas.locality : ''); if (datas.locality) { @@ -746,8 +749,9 @@ export class AddressComponent implements OnInit { } if (initiated_address_check === true) { - - this.addressForm.controls.pd_location.setValue(datas.pd_location ? datas.pd_location : ''); + if(datas.pd_location) { + this.addressForm.controls.pd_location.setValue(datas.pd_location); + } this.addressForm.controls.address_type.setValue(datas.address_type ? datas.address_type : ''); let selectedAddressType = this.addressData.filter(element => element.address_type_id == datas.address_type)[0]; @@ -760,8 +764,9 @@ export class AddressComponent implements OnInit { this.addressForm.controls.address_type_others.setValue(datas.address_type_others); this.selectedAddressType(datas.address_type_others); } - - this.addressForm.controls.comment_locality.setValue(datas.comment_locality ? datas.comment_locality : ''); + if(datas.comment_locality) { + this.addressForm.controls.comment_locality.setValue(datas.comment_locality); + } this.addressForm.controls.locality.setValue(datas.locality ? datas.locality : ''); this.setOthers(datas.locality, '', 4); @@ -863,9 +868,28 @@ export class AddressComponent implements OnInit { // else { // control.push(this.createAddresses(null)); // } - }); + if(this.pd_all_details.pdmaster_details.fk_pd_type == '2' && this.pd_all_details.pdmaster_details.hasOwnProperty('vendor_status') && this.pd_all_details.pdmaster_details.vendor_status == 'COMPLETED' ) { + console.log(this.pd_all_details.pdmaster_details.vendor_status); + this.getDataFromVendor() + } + }); } + /************************* START OF VENDOR FORM DATAS *********************************/ + + getDataFromVendor() { + + this._pd.getVendorDatas('address',this.pdid).subscribe(result=>{ + if(result) { + this.addressForm.patchValue(result.records); + // console.log(this.addressForm.value,this.commentData,this.locationdata); + // console.log(this.a.value) + } + }) + + } + /************************* END OF VENDOR FORM DATAS *********************************/ + // retriveFile(){ // this._pd.retriveFile(this.pdid, '5', null).subscribe(data => { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts index 458c8c366..e418c7f30 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts @@ -220,8 +220,39 @@ export class BusinessAssetsInfoComponent implements OnInit { } else { // this.noRecordFound = true; } + if(this.pd_all_details.pdmaster_details.fk_pd_type == '2' && this.pd_all_details.pdmaster_details.hasOwnProperty('vendor_status') && this.pd_all_details.pdmaster_details.vendor_status == 'COMPLETED') { + console.log(this.pd_all_details.pdmaster_details.vendor_status); + setTimeout(()=>{ + this.getDataFromVendor() + },1000) + } + + }); } + /************************* START OF VENDOR FORM DATAS *********************************/ + + getDataFromVendor() { + + this.pdTrigerService.getVendorDatas('business_assets',this.pdid).subscribe(result=>{ + if(result) { + let ParCtrls = this._businessAssetsQuesFrom.controls.business_assets_for_address; + + let assetCtrl: any = ParCtrls.controls[0]; + result.records.business_address_availability ='yes' + console.log("Vendor Datas",result.records) + console.log(assetCtrl); + // assetCtrl = assetCtrl.at(0) as FormArray + // assetCtrl = assetCtrl['controls'] + this.setRequiredValidation('yes',assetCtrl,1); + + assetCtrl.patchValue(result.records); + // console.log(this._generalForm.value) + } + }) + + } + /************************* END OF VENDOR FORM DATAS *********************************/ loadaddresses(flag) { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts index 009e805c3..e83310390 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts @@ -656,6 +656,10 @@ export class BusinessInfoComponent implements OnInit { }); } } + if(this.pd_all_details.pdmaster_details.fk_pd_type == '2' && this.pd_all_details.pdmaster_details.hasOwnProperty('vendor_status') && this.pd_all_details.pdmaster_details.vendor_status == 'COMPLETED') { + console.log(this.pd_all_details.pdmaster_details.vendor_status); + this.getDataFromVendor() + } }); // Desgn.push(this.createDesignation()); @@ -683,6 +687,36 @@ export class BusinessInfoComponent implements OnInit { // this.retriveFile(); } + + + /************************* START OF VENDOR FORM DATAS *********************************/ + + getDataFromVendor() { + + this._pd.getVendorDatas('business_info',this.pdid).subscribe(result=>{ + if(result) { + let individualsControl = this.businessForm.controls['individuals']; + console.log("Vendor Datas",result.records) + // individualsControl.patchValue(result.records.individuals); + result.records.documents_info.forEach(val=>{ + if(val) { + if(this.businessForm.value[val.document_name] != 'yes') { + this.businessForm.addControl(val.document_name+'_pic', new FormControl(val.document_image)); + } + // result.records[val.document_name+'_pic'] =val.document_image + result.records[val.document_name] = 'yes' + } + }) + delete result.records.documents_info + this.businessForm.patchValue(result.records); + console.log(this.businessForm.value,result.records) + } + }) + + } + /************************* END OF VENDOR FORM DATAS *********************************/ + + public initBusinessForm(): void { this.businessForm = this.fb.group({ parent_pdid: this.parent_pdid, diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts index 15bb49fa4..06bdd4622 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts @@ -283,12 +283,40 @@ export class FinalRemarksComponent implements OnInit { recommendationReferToCredit.push(this.CreateRecommendationReferToCredit(null)); this.noRecordsFound = true; } + + if(this.pd_all_details.pdmaster_details.fk_pd_type == '2' && this.pd_all_details.pdmaster_details.hasOwnProperty('vendor_status') && this.pd_all_details.pdmaster_details.vendor_status == 'COMPLETED') { + if((this.lender_short_name == 'CLIX' || this.lender_short_name == 'MWISE' || this.prod_catagory == 'LAEP')) { + console.log(this.pd_all_details.pdmaster_details.vendor_status); + this.getDataFromVendor() + } + } + + }, err => { }) // this.retriveFile(); } + /************************* START OF VENDOR FORM DATAS *********************************/ + + getDataFromVendor() { + + this.pdTrigerService.getVendorDatas('final_remarks',this.pdid).subscribe(result=>{ + if(result) { + // let individualsControl = this._finalRemarkForm.controls['individuals']; + console.log("Vendor Datas",result.records) + this.clixChange(result.records.is_competition,1) + this.clixChange(result.records.demolition_activity,2) + this.clixChange(result.records.sealing_activity,3) + this._finalRemarkForm.patchValue(result.records); + console.log(this._finalRemarkForm.value) + } + }) + + } + /************************* END OF VENDOR FORM DATAS *********************************/ + getM_Recommendation() { this.pdTrigerService.getAllMasterDatas('PDOFFICERRECOMMENDATIONS').subscribe( data => { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html index 7db4ed0db..5fd85d2e4 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html @@ -98,18 +98,17 @@ - + -
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts index 9f3f33a6a..d523c5063 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts @@ -366,11 +366,31 @@ export class GeneralInfoComponent implements OnInit { } } + if(this.pd_all_details.pdmaster_details.fk_pd_type == '2' && this.pd_all_details.pdmaster_details.hasOwnProperty('vendor_status') && this.pd_all_details.pdmaster_details.vendor_status == 'COMPLETED') { + console.log(this.pd_all_details.pdmaster_details.vendor_status); + this.getDataFromVendor() + } }, error => this.errorMessage = error); } /******************************* load form data Ends Here *************************/ + /************************* START OF VENDOR FORM DATAS *********************************/ + + getDataFromVendor() { + + this._pd.getVendorDatas('general',this.pdid).subscribe(result=>{ + if(result) { + let individualsControl = this._generalForm.controls['individuals']; + console.log("Vendor Datas",result.records) + individualsControl.patchValue(result.records.individuals); + console.log(this._generalForm.value) + } + }) + + } + /************************* END OF VENDOR FORM DATAS *********************************/ + // create individuals createIndividulas(elementValue: any) { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts index c3a392532..07be62bec 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts @@ -179,10 +179,45 @@ pdf(fileURL){ neighbourhoodControl.push(this.createNeighbourhood(this.default_neighbourhood_details)); referencecheckControl.push(this.createReerenceCheck(this.default_reference_details)); } + if(this.data.pdmaster_details.fk_pd_type == '2' && this.data.pdmaster_details.hasOwnProperty('vendor_status') && this.data.pdmaster_details.vendor_status == 'COMPLETED') { + console.log(this.data.pdmaster_details.vendor_status); + this.getDataFromVendor() + } }, error => this.errorMessage = error); } + /************************* START OF VENDOR FORM DATAS *********************************/ + + getDataFromVendor() { + + this._pd.getVendorDatas('neighbourhood_details',this.pdid).subscribe(result => { + if (result) { + const neighbourhoodControl = this._neighbourhoodForm.controls['neighbourhood_list']; + console.log("Vendor Datas", result.records) + if (result.records.hasOwnProperty('neighbourhood_list') && result.records.neighbourhood_list.length > 0) { + // result.records.neighbourhood_list.forEach(neighbour_obj => { + this.toggleVisibility(result.records.neighbourhood_list[0].did_not_know_the_business_operation,0,1) + this.toggleVisibility(result.records.neighbourhood_list[0].did_not_know_the_owner,0,2) + for (let i = 1; i <= result.records.neighbourhood_list.length; i++) { + let neighbour_obj = result.records.neighbourhood_list[i] + if (neighbour_obj) { + this.toggleVisibility(neighbour_obj.did_not_know_the_business_operation,i,1) + this.toggleVisibility(neighbour_obj.did_not_know_the_owner,i,2) + neighbourhoodControl.push(this.createNeighbourhood(neighbour_obj)) + } + // }) + } + console.log(this._neighbourhoodForm.value) + neighbourhoodControl.patchValue(result.records.neighbourhood_list); + console.log(this._neighbourhoodForm.value) + } + } + }) + + } + /************************* END OF VENDOR FORM DATAS *********************************/ + // get all master details getMasterDetails(table:string,type:number){ this._pd.getAllMasterDatas(table).subscribe( diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html index 2aeefe05a..58eb4e547 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html @@ -126,9 +126,13 @@
+ +
+ +
- + + +    - - diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts index 01e334b0b..c3e792ee9 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts @@ -614,6 +614,7 @@ export class ViewPdComponent implements OnInit, OnDestroy { pd_id: master.pd_id, mobile_no: this.pdApplicantData[0].mobile_no, random_string: master.random_string, + // pd_type:master.fk_pd_type } this._pd.smsLink(param).subscribe(res=>{ if(res['dataStatus']){ diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index 8966516cc..8eb272598 100755 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -905,4 +905,22 @@ export class PdTrigerService { getRecordedPlaybackUrl(params){ return this._http.post(this.apiUrl+'getVideoURL',params) } + + /*************************** Dummy Datas *********************/ + + getVendorDatas(form_name,pd_id?) { + let formsDet = [{form_name:"general",form_id:"18"},{form_name:"address",form_id:"5"},{form_name:"business_info",form_id:"13"}, + {form_name:"business_assets",form_id:"22"},{form_name:"neighbourhood_details",form_id:"19"}, + {form_name:"final_remarks",form_id:"20"} + ] + + // let records = {"records":data[form_name]} + let form_id = formsDet.filter(val=>val.form_name == form_name).map(r=>r.form_id)[0]; + return this.getVendorAnswers({fk_pd_id:pd_id,fk_form_id:form_id}) + console.log(form_id) + // return of(records) + } + getVendorAnswers(params):Observable { + return this._http.post(this.apiUrl+'getVendorAnswers',params) + } }