Fairoj : Selfie img saving time and pincode others field added in sales pd

This commit is contained in:
venbatechnologies@gmail.com 2020-03-19 19:09:09 +05:30
parent 7442ccb667
commit 0b12e44900
4 changed files with 39 additions and 3 deletions

View File

@ -130,6 +130,16 @@ export class QuesTemplateComponent {
this.quesAnsForm.controls.questions['controls'].forEach((val,p_i)=>{ this.quesAnsForm.controls.questions['controls'].forEach((val,p_i)=>{
// --- FOR ONCHANGE PROPERTIES---
if(val.value.onchange_properties != null){
let onChangeProperties_value=val.value.onchange_properties
onChangeProperties_value.forEach(onChangeProperty=>{
if(onChangeProperty.purpose == 'FORM_CTRL'){
this.creteNewField(onChangeProperty,this.quesAnsForm,'',this.original_result_data,"edit");
}
})
}
// JSON QUESTION CHANGE FOR SINGLE // JSON QUESTION CHANGE FOR SINGLE
console.log("key",p_i,this.quesAnsForm.value) console.log("key",p_i,this.quesAnsForm.value)
@ -269,6 +279,7 @@ this.proceedonChangeProperty(modified)
single_ques.controls.is_loader.setValue(true); single_ques.controls.is_loader.setValue(true);
single_ques.controls.is_saved.setValue(false); single_ques.controls.is_saved.setValue(false);
this.emittedFormGroup = this.quesAnsForm.getRawValue() this.emittedFormGroup = this.quesAnsForm.getRawValue()
// PASSING THE VALUE TO PARENT COMPONENT
this.imageUploadCheck.emit(this.emittedFormGroup); this.imageUploadCheck.emit(this.emittedFormGroup);
//SENDING SINGLE IMAGE TO API WITH PRIMARY KEY //SENDING SINGLE IMAGE TO API WITH PRIMARY KEY
@ -384,12 +395,17 @@ this.proceedonChangeProperty(modified)
} }
} }
sendGeoCordsForSatellite(geoCords){
let params = {"sales_pd_id":'',"geo_location":geoCords}
this.salesPDProvider.generateSatelliteImg(params).subscribe(val=>{})
}
captureImg(parent_index,parent_control){ captureImg(parent_index,parent_control){
// parent_control.controls.is_image_status.setValue('l') // parent_control.controls.is_image_status.setValue('l')
this.cameraProvider.getpicture().then(res => { this.cameraProvider.getpicture().then(res => {
if (res != 'error') { if (res != 'error') {
this.geoCoordinates=localStorage.getItem('current_coordinates') this.geoCoordinates=localStorage.getItem('current_coordinates')
this.cameraProvider.addWatermarks(res).then(watermarkedImage=>{ this.cameraProvider.addWatermarks(res).then(watermarkedImage=>{
this.sendGeoCordsForSatellite(this.geoCoordinates)
parent_control.controls.answer_value.setValue(watermarkedImage) parent_control.controls.answer_value.setValue(watermarkedImage)
parent_control.controls.is_image_status.setValue(true) parent_control.controls.is_image_status.setValue(true)
parent_control.controls.is_loader.setValue(true); parent_control.controls.is_loader.setValue(true);
@ -489,6 +505,7 @@ this.proceedonChangeProperty(modified)
this.creatSubField(sec_control,event.value) this.creatSubField(sec_control,event.value)
} }
//FOR API CALLS //FOR API CALLS
// console.log(sec_control.value);
if(sec_control.value.onchange_properties != null && sec_control.value.onchange_properties.length >0){ if(sec_control.value.onchange_properties != null && sec_control.value.onchange_properties.length >0){
let onChangeProperties_value=sec_control.value.onchange_properties let onChangeProperties_value=sec_control.value.onchange_properties
@ -1226,10 +1243,11 @@ this.proceedonChangeProperty(modified)
this.emitter.emit(section_data) this.emitter.emit(section_data)
}) })
} }
// SENDING SALES PD SECTION 9 STRUCTURE(photographs)
ngOnDestroy(){ ngOnDestroy(){
console.clear() console.clear()
console.log("dirty check",this.quesAnsForm.dirty) console.log("dirty check",this.quesAnsForm.dirty)
if(this.local_ques_JSON.section_id == 9){ if(this.local_ques_JSON.section_id == 9 && this.emittedFormGroup != null){
// FOR SENDING THE IMAGE SECTION (SECTION ID 9) JSON Structure // FOR SENDING THE IMAGE SECTION (SECTION ID 9) JSON Structure
let form_structure=this.quesAnsForm.getRawValue().questions let form_structure=this.quesAnsForm.getRawValue().questions
form_structure.forEach((parent_ques,p_index, p_object)=>{ form_structure.forEach((parent_ques,p_index, p_object)=>{

View File

@ -60,7 +60,7 @@ export class HomePage{
} }
} }
sendProduct(){ sendProduct(){
if(this.product != ''){ if(this.product != '' && this.product != null){
localStorage.setItem('product_id_salesPD',this.product) localStorage.setItem('product_id_salesPD',this.product)
this.navCtrl.push(SectionListPage,{product_id:this.product}) this.navCtrl.push(SectionListPage,{product_id:this.product})
} }

View File

@ -157,6 +157,24 @@ current_section:any;
}) })
}) })
} }
generateSatelliteImg(params):Observable<Response> {
return Observable.create((observer:Observer<any>)=>{
this.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{
params.sales_pd_id = key_value
this.http.post(this.apiUrl+'generateSatelliteImg',params).pipe()
.subscribe(result =>{
observer.next(result);
observer.complete();
}
,err=>{
console.clear();
console.log("err>>>>",err)
observer.next(err);
observer.complete();
})
})
})
}
getSalesPdpdf(pdfdetail): Observable<any> { getSalesPdpdf(pdfdetail): Observable<any> {
return this.http.get<any[]>(this.apiUrl + "downloadSalesPDReport/" + pdfdetail) return this.http.get<any[]>(this.apiUrl + "downloadSalesPDReport/" + pdfdetail)

File diff suppressed because one or more lines are too long