From 3c1807160f5c12a72b9107f75e36d48f5fabf1a9 Mon Sep 17 00:00:00 2001 From: saravanakumarkandasami Date: Mon, 3 Jun 2019 10:18:34 +0530 Subject: [PATCH] imagee changes - ps --- .../pd-question-address.html | 8 ++ .../pd-question-address.ts | 110 ++++++++++-------- .../pd-question-business-info.html | 18 ++- .../pd-question-business-info.ts | 22 ++-- .../pd-question-client-info.html | 7 +- .../pd-question-client-info.ts | 20 ++++ .../pd-question-financial-info.html | 1 + .../pd-question-financial-info.ts | 48 +++++--- .../pd-question-supplier-info.html | 7 +- .../pd-question-supplier-info.ts | 22 ++++ .../pd-question-other-income.ts | 85 ++++++++++++-- .../pd-question-rental-info.html | 5 +- .../pd-question-rental-info.ts | 16 ++- src/providers/common-provider/camera.ts | 2 + 14 files changed, 278 insertions(+), 93 deletions(-) diff --git a/src/pages/pd-question/pd-question-address/pd-question-address.html b/src/pages/pd-question/pd-question-address/pd-question-address.html index d1b801c6..b88411d1 100755 --- a/src/pages/pd-question/pd-question-address/pd-question-address.html +++ b/src/pages/pd-question/pd-question-address/pd-question-address.html @@ -58,6 +58,7 @@
+
@@ -75,8 +76,15 @@
+
+
+ + Shown On Report + Hide On Report + +

diff --git a/src/pages/pd-question/pd-question-address/pd-question-address.ts b/src/pages/pd-question/pd-question-address/pd-question-address.ts index 815123aa..ad8e2d2d 100755 --- a/src/pages/pd-question/pd-question-address/pd-question-address.ts +++ b/src/pages/pd-question/pd-question-address/pd-question-address.ts @@ -113,7 +113,6 @@ export class PdQuestionAddressPage { this.getdropdownlist(); //const control=this.pdQuestionAddress.controls['addresses'] - // console.log("co",control) this.pdQuestionAddress = this.fb.group( { @@ -159,7 +158,7 @@ export class PdQuestionAddressPage { searchFun(control:any,i:number,option){ -// console.log(control,i) + if (option == 'city') { control.controls['citySearch'].valueChanges .pipe(takeUntil(this._onDestroy)) @@ -168,7 +167,7 @@ export class PdQuestionAddressPage { }) } if (option == 'state') { - console.log("state") + control.controls['stateSearch'].valueChanges .pipe(takeUntil(this._onDestroy)) .subscribe(()=>{ @@ -176,7 +175,7 @@ export class PdQuestionAddressPage { }) } if (option == 'pin') { - console.log("Pin") + control.controls['pinSearch'].valueChanges .pipe(takeUntil(this._onDestroy)) .subscribe(()=>{ @@ -216,7 +215,7 @@ export class PdQuestionAddressPage { } searchState(val: any) { - console.log("statedata") + if (!this.stateData) { return } @@ -235,8 +234,8 @@ export class PdQuestionAddressPage { countRowsForTextarea(text){ - // console.log('text.length%100',text.length%190); - // console.log('text.length/100',text.length/100); + + if(text !='' && text != undefined){ if(text.length%100 > 5) return 5; @@ -279,13 +278,13 @@ countRowsForTextarea(text){ ionViewCanLeave(){ this.timer.unsubscribe(); - console.log("dirty",this.pdQuestionAddress.dirty); + if(this.pdQuestionAddress.dirty){ return new Promise((resolve,reject)=>{ let alert=this.toast.setAlert("Form is Modified","Are you sure want to Go Back") alert.present(); alert.onDidDismiss((data)=>{ - console.log("d",data); + if(data== false){ reject(); return true; @@ -297,7 +296,6 @@ countRowsForTextarea(text){ let alert = this.toast.setAlert("Captured Images are not Saved", "Note:To Save the image press the Save Image button
Are you sure want to Go Back?") alert.present(); alert.onDidDismiss((data) => { - console.log("d", data); if (data == false) { //reject1(); reject(); @@ -326,7 +324,6 @@ countRowsForTextarea(text){ let alert = this.toast.setAlert("Captured Images are not Saved", "Note:To Save the image press the 'Save Image' button
Are you sure want to Go Back?") alert.present(); alert.onDidDismiss((data) => { - console.log("d", data); if (data == false) { reject(); } @@ -345,14 +342,13 @@ countRowsForTextarea(text){ * Param 'stateID' -> selected StateId */ getCityAndPincodeDetails(stateID: string,i,pincode) { - // console.log(this.pdQuestionAddress.controls['addresses']['controls'][0].controls['citySearch']) - console.log(this.pdQuestionAddress) + //this.pdQuestionAddress.controls['addresses']['controls'].controls this.qustCat.getStateWiseCities(stateID).subscribe(data => { if (data.status == 200) { this.cityData[i] = data.records.cities; this.search=this.cityData[i] - console.log("Slice",this.cityData[i].slice); + //this.filteredCity.next(this.cityData[i].slice()) this.cityDataValue[i]=this.cityData[i].slice() this.pincodeData[i] = data.records.pincode; @@ -364,8 +360,7 @@ countRowsForTextarea(text){ // if(pincode != 1){ // this.pincodeValue[i]=this.pincodeData[i].filter(res=>res.pincode_id == pincode).map(val=>val.pincode)[0] // //this.pincodeValue[i]=[].concat.apply([],this.pincodeValue[i]) - // console.log(this.pincodeValue[i]) - // console.log(this.pdQuestionAddress) + // } // } @@ -393,10 +388,8 @@ countRowsForTextarea(text){ { if(res['dataStatus']==true){ this.addressTypes = res['records'].filter(add=>add.isactive==1); - console.log("dk",this.addressTypes) // this.cacheObservable.register('addressType',this.addressTypes).subscribe(res=>{ // this.data$=res.get$ - // console.log("data",this.data$) // }) } // this.cacheObservable.loadFromObservable() @@ -534,7 +527,7 @@ countRowsForTextarea(text){ } initAddress(AddressDetails){ - console.log("pin init", this.pincodeValue[0]) + if(AddressDetails != null){ return this.fb.group({ address: [AddressDetails.address], @@ -650,7 +643,6 @@ countRowsForTextarea(text){ this.toast.pdTriggerappmessage("Please Fill all the Mandatory Fields marked with ' * '") return } - console.log("Answer DAta",answerData) records.addresses=answerData.addresses // records.addressess records.address_form_remark=answerData.address_form_remark @@ -673,7 +665,6 @@ countRowsForTextarea(text){ this.qustCat.saveForm(records).subscribe(data => { - console.log(data); // let params: any = {}; // params.pd_id = '250'; // params.pd_form_id = '250'; @@ -702,7 +693,7 @@ countRowsForTextarea(text){ // data.pd_id=this.pdDetails.pd_id // data.form_id=this.FormId.form_id this.storagedb.retrieveLocalStorage(data).then(res=>{ - console.log("address get",res) + if(res){ let val_rec:any={} val_rec.records=res[0] @@ -727,7 +718,7 @@ countRowsForTextarea(text){ if(datas.pincode == 1){ this.pincodeValue[index]=datas.pincode_others }//if(val==true){ - console.log( "Pin" ,this.pincodeValue[index]); + let val={ 'address': datas.address, 'address_type': datas.address_type, @@ -747,7 +738,7 @@ countRowsForTextarea(text){ } // let selectedAddressType = this.addressTypes.filter(element => element.address_type_id == datas.address_type)[0]; - // console.log("selected add type",selectedAddressType) + if(datas.address_type != ''){ this.selectedAddressType(datas.address_type,index); // this.selectedAddressType(selectedAddressType.address_type,index); @@ -775,13 +766,12 @@ countRowsForTextarea(text){ }) - // console.log("add",local_value) - + + } getaddressForm() { - console.log("pd",this.pdDetails); let res:any; @@ -807,7 +797,7 @@ countRowsForTextarea(text){ if(datas.pincode == 1){ this.pincodeValue[index]=datas.pincode_others }//if(val==true){ - console.log( "Pin" ,this.pincodeValue[index]); + let val={ 'address': datas.address, 'address_type': datas.address_type, @@ -949,7 +939,7 @@ countRowsForTextarea(text){ this.qustCat.getAddressDetails(this.pdDetails.pd_id).subscribe(res=>{ if(res.dataStatus == true){ this.addressesList = res.records.filter(item => item.isactive == 1 && item.assigned_pd == this.pdDetails.pd_id); - console.log('this.addressesList',this.addressesList); + if(this.addressesList.length > 0){ this.addressesList.forEach((datas,index)=>{ this.getCityAndPincodeDetails(datas.fk_state,index,datas.pincode) @@ -985,36 +975,53 @@ countRowsForTextarea(text){ }) } getPDImages(){ + //FOR RETRIEVING PICTURES this.imageDisplay=[] let record_for_pic = {'pd_id':this.pdDetails.pd_id,'form_id':this.FormId.form_id,'company_id':null} this.qustCat.getPDImages(record_for_pic).subscribe(val=>{ + console.log('inside getPDImages Fn - its response ',val); if(!val['msg']){ - console.log(val['records']) + console.log('Response Data - records only',val['records']) if(val['records'].length>0){ val['records'].forEach(result=>{ - this.imageDisplay.push({'image':result.doc_url,'Name':result.pd_document_title,'option':'dummy'}) + this.imageDisplay.push({'image':result.doc_url,'Name':result.pd_document_title,'option':'dummy','is_show_report': result.is_show_report == null ? 0 : result.is_show_report }) }) - console.log("imageBuck",this.imageDisplay); + console.log("image Display Data Are",this.imageDisplay); } } }) } + changeName(value,index,img){ - console.log(value); - this.imageDisplay[index]={'image':img,'Name':value} + console.log('inside changeName Fn - its param are ',value,'Index are ',index,'active are'); + this.imageDisplay[index]={'image':img,'Name':value,'is_show_report':0} + console.log("image Display Data Are",this.imageDisplay); + } + + changeNameForBucket(value,index,img,active){ + console.log('inside change-Name-For-Bucket Fn - its param are',value,'Index are ',index,'active are',active); + this.imageBucket[index]={'image':img,'Name':value,'is_show_report':0} } - changeNameForBucket(value,index,img){ - this.imageBucket[index]={'image':img,'Name':value} + changeOptions(event: any,index: any){ + console.log('Option Changed ' + event); + this.imageBucket[index].is_show_report=event; + console.log('this.imageBucket',JSON.stringify(this.imageBucket)); } removeImg(index){ + console.log('inside removeImg Fn - its param are - Index only ',index); this.imageDisplay.splice(index,1); + } removeImgForBucket(index){ + console.log('inside removeImgForBucket Fn - its param are - Index only ',index); this.imageBucket.splice(index,1) + console.log("image Display Data Are",this.imageDisplay); } savePhoto(){ + console.log('savePhoto'); + this.camera.getPicture({ quality: 100, destinationType: this.camera.DestinationType.DATA_URL, @@ -1022,11 +1029,11 @@ countRowsForTextarea(text){ targetHeight: 600, correctOrientation: true }).then((imageData)=>{ + console.log('inside savePhoto Fn - its response ',imageData); this.base64='data:image/png;base64,'+imageData - this.imageBucket.push({'image':this.base64,'Name':''}); + this.imageBucket.push({'image':this.base64,'Name':'','is_show_report':''}); // this.imageDisplay.push({'image':this.base64,'Name':''}) - this. getImageName(this.imageBucket.length-1) - + this.getImageName(this.imageBucket.length-1) },(err)=>{ //alert("error"); }) @@ -1036,15 +1043,16 @@ countRowsForTextarea(text){ // this.content.scrollTo(0, dimensions.contentHeight+100, 100); // this.inputFocus.setFocus(); } + getImageName(index){ - console.log("index",index); + console.log('inside get Image Name Fn - its param are - Index only ',index); let alert =this.toast.setAlertForDocName() - alert.present() - - alert.onDidDismiss(value=>{ - console.log(value.Name) - this.imageBucket[index].Name=value.Name - }) + + alert.present() + alert.onDidDismiss(value=>{ + console.log('Reponse',value,'Reponse AS Name',value.Name,value.IsShowReport); + this.imageBucket[index].Name=value.Name; + }); // let alert=this.alerCtrl.create({ @@ -1062,7 +1070,6 @@ countRowsForTextarea(text){ // { // text:'Submit', // handler:data=>{ - // console.log(data.Name) // this.imageBucket[index].Name=data.Name // alert.dismiss // } @@ -1078,14 +1085,16 @@ countRowsForTextarea(text){ // } sendImage(){ this.loading.loaderForSendImage() - console.log("ll",JSON.stringify(this.imageBucket)); + + let records:any={ 'pd_id':this.pdDetails.pd_id, 'formid':this.FormId.form_id, 'images':this.imageBucket, 'company_id':'' } - console.log("records",JSON.stringify(records)) + + console.log("inside SendImage Function - records array",JSON.stringify(records)) this.qustCat.savePDImages(records).subscribe(res=>{ if(res['dataStatus']== true){ @@ -1098,6 +1107,7 @@ countRowsForTextarea(text){ } }) } + localInsert(option){ let datas:any=this.pdQuestionAddress.value datas.pd_id=this.pdDetails.pd_id @@ -1107,7 +1117,7 @@ countRowsForTextarea(text){ this.storagedb.insertData(datas).then(res=>{ // let alert=this.toast.setAlert('data',JSON.stringify(res)) // alert.present(); - console.log("insert add",res); + console.log("inside localInsert Fn - its Response",res); }) } } \ No newline at end of file diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-business-info/pd-question-business-info.html b/src/pages/pd-question/pd-question-business-group/pd-question-business-info/pd-question-business-info.html index 34026a56..8a5db1e6 100755 --- a/src/pages/pd-question/pd-question-business-group/pd-question-business-info/pd-question-business-info.html +++ b/src/pages/pd-question/pd-question-business-group/pd-question-business-info/pd-question-business-info.html @@ -1648,7 +1648,7 @@ Image
- +
@@ -1857,10 +1857,24 @@
- + + +
+ +
+ +
+ +
+ +
+ +
+ diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-business-info/pd-question-business-info.ts b/src/pages/pd-question/pd-question-business-group/pd-question-business-info/pd-question-business-info.ts index 731dd4a4..43348f96 100755 --- a/src/pages/pd-question/pd-question-business-group/pd-question-business-info/pd-question-business-info.ts +++ b/src/pages/pd-question/pd-question-business-group/pd-question-business-info/pd-question-business-info.ts @@ -150,10 +150,6 @@ export class PdQuestionBusinessInfoPage { other_documents: [''], documents: this.fb.array([]), business_remarks:[''] - - - - }) this.getdropdown(); @@ -354,7 +350,7 @@ changeOfStartedBusiness(members,i,e){ otherDoc.push(this.createDocument()); }); } else { - DocArray = [{document: ''}]; + DocArray = [{document: '',document_pic: ''}]; otherDoc.push(this.createDocument()); } businessVal.parent_pdid=this.pdDetails.parent_pd_id @@ -1437,7 +1433,8 @@ maxSaleState():FormGroup{ } createDocument() { return this.fb.group({ - document: [''] + document: [''], + document_pic: [''], }); } addDesignation() { @@ -1662,6 +1659,16 @@ deleteDocuments(index) { } } +UploadDocuments(index) { + const control = this.businessForm.controls['documents']; + const control_with_index = control.controls[index]; + this.cameraProvider.getpicture().then(res=>{ + control_with_index.controls['document_pic'].setValue(res !='error' ? res : ''); + },error=>{ + console.log("Camera Error ",JSON.stringify(error)); + }) +} + relationChanged(event) { this.relativeNames = []; event.value.forEach(option => { @@ -1997,7 +2004,7 @@ if(records.pos_machines_details){ otherDoc.push(this.createDocument()); }); } else { - DocArray = [{document: ''}]; + DocArray = [{document: '',document_pic: ''}]; otherDoc.push(this.createDocument()); } if (data['records'].ownership_setup != 'others') { @@ -2276,6 +2283,7 @@ toGetPOSMachinesDetails(e,flag){ //FOR RETRIEVING PICTURES this.imageDisplay=[] let record_for_pic = {'pd_id':this.pdDetails.pd_id,'form_id':this.FormId,'company_id':this.pdDetails.company_id} + this.qustCat.getPDImages(record_for_pic).subscribe(val=>{ if(!val['msg']){ console.log(val['records']) diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.html b/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.html index 0fc01eb6..009a553c 100755 --- a/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.html +++ b/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.html @@ -5,9 +5,9 @@ {{formDetails.form_name}} - + @@ -79,6 +79,7 @@
Product #{{l+1}} +
@@ -194,6 +195,7 @@
Trading Product #{{l+1}} +
@@ -316,6 +318,7 @@
Service Provided #{{l+1}} +
diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.ts b/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.ts index 65ec0e45..15b44319 100755 --- a/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.ts +++ b/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.ts @@ -672,6 +672,26 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false; removeImgForBucket(index){ this.imageBucket.splice(index,1) } + + captureTheClientPics(materialName,index,clientName){ + + if(clientName != ''){ + // 'Raw Material','l',items.get('manufacturing_supplier_name').value + this.cameraProvider.getpicture().then(res=>{ + if(res != 'error'){ + this.imageBucket.push({'image':res,'Name':clientName + ' - ' + materialName + ' ' + (index+1)}); + } + },error=>{ + console.log("Camera Error ",JSON.stringify(error)); + }) + this.tab='1'; + } + else if(clientName == ''){ + alert('Please Fill The Client Name'); + } + + } + capture(){ //FOR CAPTURING PICS this.cameraProvider.getpicture().then(res=>{ diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-financial-info/pd-question-financial-info.html b/src/pages/pd-question/pd-question-business-group/pd-question-financial-info/pd-question-financial-info.html index d4e204f0..888a4e7d 100755 --- a/src/pages/pd-question/pd-question-business-group/pd-question-financial-info/pd-question-financial-info.html +++ b/src/pages/pd-question/pd-question-business-group/pd-question-financial-info/pd-question-financial-info.html @@ -77,6 +77,7 @@
Data As Per Financial Statements
+
diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-financial-info/pd-question-financial-info.ts b/src/pages/pd-question/pd-question-business-group/pd-question-financial-info/pd-question-financial-info.ts index 00c89a3d..a9d1045c 100755 --- a/src/pages/pd-question/pd-question-business-group/pd-question-financial-info/pd-question-financial-info.ts +++ b/src/pages/pd-question/pd-question-business-group/pd-question-financial-info/pd-question-financial-info.ts @@ -48,6 +48,7 @@ export class PdQuestionFinancialInfoPage { formDetails: any; CustSegAbbr:any; temparray : any = []; + picsArrayLength :any = 0; ServiceDataAvailability:boolean = false; av : any =[{id:6, name:'Letter of Credit'}, @@ -310,8 +311,7 @@ submitDetails(){ if(this.CustSegAbbr == 'AI'){ this.financialForm.removeControl('estimated_value'); this.financialForm.controls['is_financial_customer'].setValue(''); - } - + } if(this.financialForm.value.date_per_financial['finanical_profit_or_loss'] == 1){ this.financialForm.value.date_per_financial['financial_net_profit'].setValidators([Validators.required]); @@ -342,6 +342,12 @@ submitDetails(){ } let records=this.financialForm.value; + + if(records.is_financial_statements == 'yes' && this.picsArrayLength == 0){ + this.toast.pdTriggerappmessage("Photos of Finanical Statements are Required"); + return; + } + records.select_working_capital_facilities_availed = records.select_working_capital_facilities_availed.filter(value => value.exist_status == 1); if(records.is_there_working_capital_available == "no"){ records.select_working_capital_facilities_availed = []; @@ -355,20 +361,20 @@ submitDetails(){ if(records.reason_for_working_capital_facilities_availed) delete records.reason_for_working_capital_facilities_availed ; } - this.qustCat.saveForm(records).subscribe(res=>{ - if(res['status']== 200){ - this.financialForm.markAsUntouched(); - this.toast.pdTriggerappmessage("Record Saved Successfully"); - setTimeout(()=>{ - this.navCtrl.pop(); - },2000); - } - else{ - this.toast.pdTriggerappmessage("Warning !! Something went Wrong"); - } - },err=>{ - this.toast.pdTriggerappmessage("Server is not Responding"); - }) + // this.qustCat.saveForm(records).subscribe(res=>{ + // if(res['status']== 200){ + // this.financialForm.markAsUntouched(); + // this.toast.pdTriggerappmessage("Record Saved Successfully"); + // setTimeout(()=>{ + // this.navCtrl.pop(); + // },2000); + // } + // else{ + // this.toast.pdTriggerappmessage("Warning !! Something went Wrong"); + // } + // },err=>{ + // this.toast.pdTriggerappmessage("Server is not Responding"); + // }) } getDetails(){ const financeDate=this.financialForm.controls['date_per_financial'] @@ -1471,6 +1477,7 @@ calculateLossAmount( i, details){ let record_for_pic = {'pd_id':this.pdDetails.pd_id,'form_id':this.formDetails.form_id,'company_id':this.pdDetails.company_id} this.qustCat.getPDImages(record_for_pic).subscribe(val=>{ if(!val['msg']){ + this.picsArrayLength = val['records'].length; console.log(val['records']) if(val['records'].length>0){ val['records'].forEach(result=>{ @@ -1495,6 +1502,15 @@ calculateLossAmount( i, details){ removeImgForBucket(index){ this.imageBucket.splice(index,1) } + captureTheFinancialPics(value){ + alert('Value '+value+' - '+this.picsArrayLength); + if(value == 'yes' && this.picsArrayLength == 0){ + alert('You Must Take The Finanical Pic'); + } + else{ + alert('No Need'); + } + } capture(){ //FOR CAPTURING PICS this.cameraProvider.getpicture().then(res=>{ diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.html b/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.html index 1555104a..7c63efa7 100755 --- a/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.html +++ b/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.html @@ -5,9 +5,9 @@ {{formDetails.form_name}} - + @@ -69,6 +69,7 @@
+
Manufacturing Product Details
@@ -80,6 +81,7 @@
Raw Material #{{l+1}} +
@@ -186,6 +188,7 @@
Trading Product #{{l+1}} +
diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.ts b/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.ts index 75bbbac3..ae0756f4 100755 --- a/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.ts +++ b/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.ts @@ -535,6 +535,28 @@ export class PdQuestionSupplierInfoPage { removeImgForBucket(index){ this.imageBucket.splice(index,1) } + + + captureTheSupplierPics(materialName,index,supplierName){ + console.log('ds'); + alert('dsa'); + if(supplierName != ''){ + // 'Raw Material','l',items.get('manufacturing_supplier_name').value + this.cameraProvider.getpicture().then(res=>{ + if(res != 'error'){ + this.imageBucket.push({'image':res,'Name':supplierName + ' - ' + materialName + ' ' + (index+1)}); + } + },error=>{ + console.log("Camera Error ",JSON.stringify(error)); + }) + this.tab='1'; + } + else if(supplierName == ''){ + alert('Please Fill The Supplier Name'); + } + + } + capture(){ //FOR CAPTURING PICS this.cameraProvider.getpicture().then(res=>{ diff --git a/src/pages/pd-question/pd-question-other-income/pd-question-other-income.ts b/src/pages/pd-question/pd-question-other-income/pd-question-other-income.ts index cdc0da68..04b863a4 100755 --- a/src/pages/pd-question/pd-question-other-income/pd-question-other-income.ts +++ b/src/pages/pd-question/pd-question-other-income/pd-question-other-income.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { IonicPage, NavController, NavParams } from 'ionic-angular'; +import { IonicPage, NavController, NavParams,AlertController } from 'ionic-angular'; import { FormGroup, FormBuilder,FormArray, Validators } from '@angular/forms'; import { QuestionCategoryProvider } from '../../../providers/question-category/question-category'; import { AwsServiceProvider } from '../../../providers/aws-service/aws-service'; @@ -49,7 +49,7 @@ export class PdQuestionOtherIncomePage { constructor(public navCtrl: NavController, public navParams: NavParams,public fb:FormBuilder, public qustCat:QuestionCategoryProvider,public aws:AwsServiceProvider, public toast:ToastProvider, public constant:ConstantsProvider,private cameraProvider:CameraProvider, - private loading:LoadingProvider) + private loading:LoadingProvider,public alertCtrl:AlertController) { this.pdDetails = this.navParams.get('pdDetails'); this.pdid=this.pdDetails.pd_id; @@ -310,6 +310,10 @@ submitOtherIncome(answerData) { let records: any = {}; + let rentOptionCount: number = 0; + let validateFlag: number = 0; + let TextMessage :any; + records.parent_pdid=this.pdDetails.parent_pd_id records.pdid = this.pdDetails.pd_id; records.formid = this.FormId.form_id; @@ -317,16 +321,75 @@ submitOtherIncome(answerData) records.other_income = answerData.other_income; records.income_details = answerData.income_details; records.otherincome_remarks = answerData.otherincome_remarks; - this.qustCat.saveForm(records).subscribe(data => { - //TO CHANGE THE FORM STATE - this.otherIncomeForm.reset(this.otherIncomeForm.value); - this.toast.pdTriggerappmessage('Record Saved Successfully.!'); - setTimeout(()=>{ - this.navCtrl.pop(); - },2000); - }, error => { + console.log(records); + // this.callSaveApi(records); + + if (records.other_income == 'Yes') { + records.income_details.forEach(option => { + if (+option.source == 5) { + rentOptionCount++; + validateFlag = 1; + } + }); - }) + if(validateFlag == 1){ + let params: any = {}; + params.parent_pdid = this.pdDetails.parent_pd_id; + params.pd_id = this.pdDetails.pd_id; + params.pd_form_id = 17; + + this.qustCat.retiverForm(params).subscribe(data=>{ + if(!data['dataStatus']){ + let text : any = rentOptionCount > 1 ? rentOptionCount + ' properties' : rentOptionCount + ' property' ; + TextMessage = '
You have chosen '+ text +' as rental income, but rental verification form is not filled
'; + + let alert=this.alertCtrl.create({ + title:'Please Confirm', + message:TextMessage, + buttons:[ + { + text:'Cancel', + role:'cancel', + handler:()=>{ + alert.dismiss + } + }, + { + text:'Confirm', + handler:()=>{ + this.callSaveApi(records); + } + } + ] + }); + alert.present(); + } + else if(data['dataStatus']){ + this.callSaveApi(records); + } + }) + } + else{ + this.callSaveApi(records); + } + } + else{ + this.callSaveApi(records); + } +} + +callSaveApi(records){ + + this.qustCat.saveForm(records).subscribe(data => { + //TO CHANGE THE FORM STATE + this.otherIncomeForm.reset(this.otherIncomeForm.value); + this.toast.pdTriggerappmessage('Record Saved Successfully.!'); + setTimeout(()=>{ + this.navCtrl.pop(); + },2000); +}, error => { + +}) } getOtherIncome() diff --git a/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.html b/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.html index fa623a55..7cbe8402 100755 --- a/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.html +++ b/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.html @@ -5,9 +5,9 @@ {{pageTitle}} - + @@ -71,6 +71,7 @@ Property Details + diff --git a/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.ts b/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.ts index 801be2f1..43a00bad 100755 --- a/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.ts +++ b/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.ts @@ -82,7 +82,7 @@ export class PdQuestionRentalInfoPage { private loading:LoadingProvider,private cameraProvider:CameraProvider) { this.data=this.navParams.get('values'); // for get the data from dash page - console.log("values",this.data) + console.log("From Dashboard of Rental - values are ",this.data); this.pageTitle = this.data.manage_status==1 ? 'Add RI Details' : 'Update RI Details'; this.FormId = this.navParams.get('FormId'); this.pdDetails = this.navParams.get('pdDetails'); @@ -1483,6 +1483,7 @@ forSearchableDropdown(val:any,Flag:any){ this.imageDisplay=[] let record_for_pic = {'pd_id':this.pdDetails.pd_id,'form_id':this.FormId.form_id,'company_id':null} this.qustCat.getPDImages(record_for_pic).subscribe(val=>{ + console.log('From getPDImages',val); if(!val['msg']){ console.log(val['records']) if(val['records'].length>0){ @@ -1509,6 +1510,19 @@ removeImg(index){ removeImgForBucket(index){ this.imageBucket.splice(index,1) } + +captureThePropertyPics(){ + alert('rentalDataCount '+this.data.existing_rental_count_id); + this.cameraProvider.getpicture().then(res=>{ + if(res != 'error'){ + this.imageBucket.push({'image':res,'Name':'Property '+this.data.existing_rental_count_id}); + } + },error=>{ + console.log("Camera Error ",JSON.stringify(error)); + }) + this.tab='1'; +} + capture(){ //FOR CAPTURING PICS this.cameraProvider.getpicture().then(res=>{ diff --git a/src/providers/common-provider/camera.ts b/src/providers/common-provider/camera.ts index 83f1380d..3f543ddc 100755 --- a/src/providers/common-provider/camera.ts +++ b/src/providers/common-provider/camera.ts @@ -30,6 +30,7 @@ export class CameraProvider { return this.camera.getPicture(options).then(imageData => { + console.log('From Camera.ts - getPicture fn image are',imageData) const base64Image = 'data:image/png;base64,' + imageData; console.log("base 64",base64Image); return base64Image; @@ -54,6 +55,7 @@ export class CameraProvider { return this.camera.getPicture(options).then(imageData => { + console.log('From Camera.ts - getcommonpicture fn image are',imageData) const base64Image = 'data:image/png;base64,' + imageData.filter(data=>data.fk_form_id == null); console.log("base 64",base64Image); return base64Image;