From c85fb1c66ebc8b30a03d7ac5f3e49a0949555d56 Mon Sep 17 00:00:00 2001 From: =eyJraWQiOiJta Date: Fri, 17 Dec 2021 11:14:48 +0530 Subject: [PATCH] image capture loader add --- ng6-seed/git | 0 .../ques-template/ques-template.html | 4 +- .../components/ques-template/ques-template.ts | 44 ++++++++++++++++--- 3 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 ng6-seed/git diff --git a/ng6-seed/git b/ng6-seed/git new file mode 100644 index 0000000..e69de29 diff --git a/ng6-seed/src/app/sales-pd/components/ques-template/ques-template.html b/ng6-seed/src/app/sales-pd/components/ques-template/ques-template.html index 71ca3d0..d8668e0 100755 --- a/ng6-seed/src/app/sales-pd/components/ques-template/ques-template.html +++ b/ng6-seed/src/app/sales-pd/components/ques-template/ques-template.html @@ -368,8 +368,8 @@ - - + + diff --git a/ng6-seed/src/app/sales-pd/components/ques-template/ques-template.ts b/ng6-seed/src/app/sales-pd/components/ques-template/ques-template.ts index 64e3b06..b3511fc 100755 --- a/ng6-seed/src/app/sales-pd/components/ques-template/ques-template.ts +++ b/ng6-seed/src/app/sales-pd/components/ques-template/ques-template.ts @@ -75,6 +75,7 @@ export class QuesTemplateComponent { tmp_ques:any; imageData: any; records: any; + image_question_name:any =[] tmp_control: QuestionServiceService; tmp:any =[]; constructor( private cameraService: CameraService,public dialogRef: MatDialogRef,private route: ActivatedRoute,private router: Router,private dialog:MatDialog,private _fb:FormBuilder,private questionService:QuestionServiceService,private SalesPdService:SalesPdService,notifier: NotifierService,private loaderService:LoaderService) { @@ -436,6 +437,7 @@ this.proceedonChangeProperty(modified) this.quesAnsForm.get('questions').patchValue(this.original_result_data.questions); + console.log( this.quesAnsForm) } setStep(index: number) { this.step = index; @@ -460,6 +462,7 @@ this.proceedonChangeProperty(modified) getIndex(index,q,data,single_ques) { console.log('curr', index); console.log(q); + // setTimeout(function(){ // console.log(q); // },3000); @@ -471,23 +474,39 @@ this.proceedonChangeProperty(modified) console.log(element.question_key); }); console.log(this.tmp); + + this.tmp[0].value.question_key + console.log( this.tmp[0].value.group_title) + console.log( this.tmp[0].value.question_key) + + + + this.tmp_ques = single_ques; console.log(single_ques) this.tmp_control = this.questionService - this.tmp_ques = single_ques; + this.current_index = index; } addImage(event, index, parent_index, data,single_ques1) { + this.loaderService.showMatSpinnerDialog('Fetching Data...') // this.ngxService.start(); console.log(this.quesAnsForm) console.log(parent_index) console.log(this.tmp_ques) console.log(parent_index['controls'].questions_group) + + this.tmp[0].value.group_title + console.log( this.tmp[0].value.question_key) + console.log(data) + data[0].question = this.tmp[0].value.group_title + data[0].question_key = this.tmp[0].value.question_key data=data.filter(group_indi=>!group_indi.hasOwnProperty('additional_field') && group_indi.additional_field != 1 ) - + console.log(data) console.log(single_ques1) let single_ques = this.tmp_ques + console.log(single_ques) console.log(event, index); this.imageData = this.quesAnsForm.value.questions @@ -530,7 +549,7 @@ this.proceedonChangeProperty(modified) console.log(result); this.imageData.push( { img_key: 'common_image', - img_name: result, + img_name:this.tmp[0].value.group_title, img_url: watermarked_img, fk_form_id: '', is_base64: true, @@ -545,6 +564,10 @@ this.proceedonChangeProperty(modified) }); } console.log(watermarked_img); + console.log(single_ques.controls) + console.log(single_ques.value.question) + + this.image_question_name = single_ques.value.question single_ques.controls.answer_value.setValue(watermarked_img) // this.sales_pd_id = Number(this.sales_pd_id) // console.log(this.sales_pd_id) @@ -557,6 +580,7 @@ this.proceedonChangeProperty(modified) let storage_param=this.questions_JSON let form_structure=this.questions_JSON form_structure.questions=this.quesAnsForm.getRawValue().questions + console.log( form_structure.questions) form_structure.is_complete=1 @@ -578,6 +602,7 @@ this.proceedonChangeProperty(modified) this.SalesPdService.updateSectionDataLocally(params,form_structure).subscribe(res=>{ }) storage_param.questions=this.quesAnsForm.getRawValue().questions + console.log( storage_param.questions) let key_value = localStorage.getItem('sales_pd_id_PRIMARYKEY') // this.SalesPdService.getData_fromLocal('sales_pd_id_PRIMARYKEY').then(key_value=>{ @@ -598,16 +623,25 @@ this.proceedonChangeProperty(modified) // console.log(parent_index['controls'].questions_group) // let control: any = parent_index['controls'].questions_group as FormArray this.tmp.length + console.log(this.tmp[0]) let control: any = this.tmp[0].controls.questions_group + console.log(control) + console.log(this.current_index ) parent_index control.push(this._fb.group({ 'questions': this._fb.array([]) })) let sub_childControl: any = control.controls[this.current_index + 1].get('questions') as FormArray console.log(sub_childControl) + console.log(data) + + data.forEach((group_indi,arr_index )=> { + console.log(group_indi,arr_index) delete group_indi.answer_value sub_childControl.push(this.questionService.createValue(group_indi)) this.questionService.addAdditionalControl(group_indi, sub_childControl, arr_index) + this.tmp = [] + this.loaderService.closeMatSpinnerDialog() }) }) @@ -1809,7 +1843,7 @@ this.proceedonChangeProperty(modified) form_structure.forEach((parent_ques,p_index, p_object)=>{ if(parent_ques.hasOwnProperty('is_repeatable') && parent_ques.is_repeatable != '1'){ if(parent_ques.answer_value != '' && parent_ques.answer_value != null){ - parent_ques.answer_value = 'SAVED' + //parent_ques.answer_value = 'SAVED' if(parent_ques.is_loader == false && parent_ques.is_saved == false){ p_object.splice(p_index,1) } @@ -1819,7 +1853,7 @@ this.proceedonChangeProperty(modified) parent_ques.questions_group.forEach((group_ques,g_index,g_object)=>{ group_ques.questions.forEach((single_ques,s_index, s_object)=>{ if(single_ques.answer_value != '' && single_ques.answer_value != null){ - single_ques.answer_value = 'SAVED' + // single_ques.answer_value = 'SAVED' if(single_ques.is_loader == false && single_ques.is_saved == false){ // single_ques.is_saved = '' // single_ques.is_loader = ''