image capture loader add
This commit is contained in:
parent
d8332a80f6
commit
c85fb1c66e
0
ng6-seed/git
Normal file
0
ng6-seed/git
Normal file
@ -368,8 +368,8 @@
|
||||
<!-- <button mat-raised-button color="warn" style="min-width: 65px !important;" [disabled]="sales_pd_type == '2'" (click)="addData(g_i,parent_ques,group_ques.get('questions').value,$event,'camera',single_ques)">
|
||||
<mat-icon>camera_alt</mat-icon>+
|
||||
</button> -->
|
||||
<span>
|
||||
<app-capture-btn class="file-btn" (imageDataEmitter)="addImage($event,g_i,parent_ques,group_ques.get('questions').value,single_ques)" ></app-capture-btn>
|
||||
<span (click)="getIndex(g_i,parent_ques,group_ques.get('questions').value,single_ques)">
|
||||
<app-capture-btn class="file-btn" (imageDataEmitter)="addImage($event,g_i,parent_ques,group_ques.get('questions').value,single_ques)" ></app-capture-btn>
|
||||
</span>
|
||||
<!-- <button class="ml-1 mr-1 hover-icon" mat-raised-button clear style="color: #f3432c" [disabled]="sales_pd_type == '2'" (click)="addData(g_i,parent_ques,group_ques.get('questions').value,$event,'camera',single_ques)"><mat-icon style="font-size:25px">camera_alt</mat-icon>+</button> -->
|
||||
</div>
|
||||
|
||||
@ -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<SectionListComponent>,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 = ''
|
||||
|
||||
Loading…
Reference in New Issue
Block a user