diff --git a/ng6-seed/salespd_pwa___testing___22-08-2022.zip b/ng6-seed/salespd_pwa___testing___22-08-2022.zip deleted file mode 100644 index 11e6308..0000000 Binary files a/ng6-seed/salespd_pwa___testing___22-08-2022.zip and /dev/null differ diff --git a/ng6-seed/src/app/app.routing.ts b/ng6-seed/src/app/app.routing.ts index 1fe1b9e..0a88f48 100755 --- a/ng6-seed/src/app/app.routing.ts +++ b/ng6-seed/src/app/app.routing.ts @@ -7,7 +7,7 @@ import { AuthGuard } from './_guard/auth.guard'; // import { SalesPdComponent } from './sales-pd/sales-pd.component'; // let role = localStorage.g('user_role'); // console.log(role) -var route: string = "sales-pd-list"; +var route: string = "fly-hi"; const role = JSON.parse(localStorage.getItem("user_role")); if (role == "20") { @@ -23,7 +23,7 @@ export const AppRoutes: Routes = [{ path: '', redirectTo: route, pathMatch: 'full', -}, { +} , { path: '', component: AdminLayoutComponent, canActivateChild:[AuthGuard], @@ -45,6 +45,7 @@ export const AppRoutes: Routes = [{ // loadChildren:'./quality-check/quality-check.module#QualityCheckModule' // }, // { + { path:'sales-pd-list', loadChildren:'./sales-pd/sales-pd.module#SalesPdModule' diff --git a/ng6-seed/src/app/fly-hi/forms-dynamic/dynamic-form/dynamic-form/dynamic-form.component.ts b/ng6-seed/src/app/fly-hi/forms-dynamic/dynamic-form/dynamic-form/dynamic-form.component.ts index 41bb621..e9863db 100644 --- a/ng6-seed/src/app/fly-hi/forms-dynamic/dynamic-form/dynamic-form/dynamic-form.component.ts +++ b/ng6-seed/src/app/fly-hi/forms-dynamic/dynamic-form/dynamic-form/dynamic-form.component.ts @@ -33,27 +33,27 @@ export class DynamicFormComponent { this.questionService.currentMessageSubscriber.subscribe((data : any)=>{ - console.log(data) + //console.log(data) }) } ngOnInit() { - console.log(this.form_group_name) - console.log(this.questions_JSON.questions) + // console.log(this.form_group_name) + //.log(this.questions_JSON.questions) this.form_group_name=this.questionService.assignFormControl_array(this.form_group_name,this.questions_JSON.questions) this.generateGroupControls(); - console.log( this.questions_JSON.questions) + // console.log( this.questions_JSON.questions) this.questionService.notify(this.questions_JSON) if(this.questions_JSON.questions){ this.questions_JSON.questions.forEach(element => { if(element.question instanceof Array){ element.question.forEach(e => { - console.log(e.question) + // console.log(e.question) }); }else{ - console.log(this.questions_JSON.questions) + // console.log(this.questions_JSON.questions) } }); diff --git a/ng6-seed/src/app/fly-hi/forms-dynamic/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts b/ng6-seed/src/app/fly-hi/forms-dynamic/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts index 1e6e722..fee277e 100644 --- a/ng6-seed/src/app/fly-hi/forms-dynamic/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts +++ b/ng6-seed/src/app/fly-hi/forms-dynamic/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts @@ -32,6 +32,8 @@ export class DynamicQuestionTemplateComponent implements OnInit { local_pincode1: any; json_answers1:any; isChecked:any=[]; + city_array:any =[]; + pincode_array:any=[]; autoCompleteAns:Observable public commonFilterCtrl:FormControl = new FormControl(); public ngxFilteredValue:ReplaySubject = new ReplaySubject(1); @@ -46,7 +48,7 @@ export class DynamicQuestionTemplateComponent implements OnInit { ngOnInit() { this.quesService.currentMessageSubscriber.subscribe((data : any)=>{ - console.log(data) + //console.log(data) if(data){ this.check = true }else{ @@ -56,7 +58,7 @@ export class DynamicQuestionTemplateComponent implements OnInit { // output : {msg : 'do something'} }) localStorage.setItem('use',"0"); - console.log( this.whole_json) + //console.log( this.whole_json) this.parent_ques = this.currFormArrayObj @@ -70,7 +72,7 @@ export class DynamicQuestionTemplateComponent implements OnInit { } checkCat(data,w){ - console.log(this.isChecked) + // console.log(this.isChecked) if( this.isChecked.length == 0){ this.isChecked = this.json_answers[w.question_key] let ref = this.isChecked.find(x => x == data); // this checks the cat[] array @@ -166,16 +168,16 @@ export class DynamicQuestionTemplateComponent implements OnInit { ] setTimeout(()=>{ - console.log(this.parent_ques); + // console.log(this.parent_ques); if( this.parent_ques.answers && this.parent_ques.answers instanceof Array){ - console.log(this.parent_ques.answers.length) - console.log( this.formGroupN.get(this.parent_ques.question_key)) + // console.log(this.parent_ques.answers.length) + // console.log( this.formGroupN.get(this.parent_ques.question_key)) if(this.parent_ques.type == '3' && this.parent_ques.answers.length == 1){ - console.log(this.parent_ques.answers.answer_id) + // console.log(this.parent_ques.answers.answer_id) this.formGroupN.get(this.parent_ques.question_key).patchValue(this.parent_ques.answers[0].answer_id || '') }else if(this.parent_ques.type == '3' && this.parent_ques.answers.length == 0){ - console.log(this.parent_ques.answers.answer_id) + // console.log(this.parent_ques.answers.answer_id) this.formGroupN.get(this.parent_ques.question_key).patchValue(this.parent_ques.answers[0].answer_id || '') } } @@ -190,12 +192,12 @@ export class DynamicQuestionTemplateComponent implements OnInit { this.formGroupN.get(this.parent_ques.question_key).patchValue((this.json_answers[this.parent_ques.question_key] || '')) if(this.parent_ques.question_key == '5'){ - this.isChecked = this.json_answers[this.parent_ques.question_key] - console.log( this.isChecked) + this.isChecked = this.json_answers[this.parent_ques.question_key] + .log( this.isChecked) } this.onChangeProperty({value:this.json_answers[this.parent_ques.question_key]},this.parent_ques,'','','','TS') - console.log( this.json_answers[this.parent_ques.question_key]) + // console.log( this.json_answers[this.parent_ques.question_key]) } else if(this.json_answers!=null && this.json_answers != undefined && this.json_answers){ // this.formGroupN.patchValue((this.json_answers[this.group_key] || '')) @@ -314,9 +316,9 @@ export class DynamicQuestionTemplateComponent implements OnInit { } } onChange_checkbox(event,sec_control){ - console.log(this.isChecked) + // console.log(this.isChecked) // this.isChecked =[]; - console.log( this.formGroupN.get(sec_control.question_key).value) + // console.log( this.formGroupN.get(sec_control.question_key).value) const control=this.formGroupN.get(sec_control.question_key) as FormArray @@ -333,7 +335,7 @@ export class DynamicQuestionTemplateComponent implements OnInit { onChangeProperty(event,sec_control,question_key,options?,sec_index?,from?){ // alert('datatamil'); if(!from && from != 'TS' && this.quesService.formanswers != null) { - console.log("Value changes",from); + // console.log("Value changes",from); this.quesService.formanswers = null } @@ -404,11 +406,11 @@ export class DynamicQuestionTemplateComponent implements OnInit { // onChangeProperties_value.push(JSON.parse(new_name)) onChangeProperties_value.forEach(onChangeProperty=>{ - console.log(onChangeProperty) + // console.log(onChangeProperty) if(onChangeProperty.purpose == 'api2'){ - console.log(event.value,onChangeProperty.params) + // console.log(event.value,onChangeProperty.params) if(onChangeProperty.api == 'getListOfStatesAndCities'){ - console.log(event.value,onChangeProperty.params) + // console.log(event.value,onChangeProperty.params) // onChangeProperty.params = JSON.stringify(onChangeProperty.params); // let updatedParams =JSON.stringify(onChangeProperty.params); // updatedParams = updatedParams.replace('value_of_answer',event.value); @@ -416,26 +418,50 @@ export class DynamicQuestionTemplateComponent implements OnInit { // console.log(JSON.parse(updatedParams),updatedParams,JSON.parse(JSON.stringify(updatedParams))) // debugger; let params={records:{state_id:event.value}} - + // console.log( params) this.quesService.apiCall(onChangeProperty.api,params,onChangeProperty.api_method).subscribe(res=>{ if(res['dataStatus']){ - this.local_city1=res['records'].cities - this.local_pincode1=res['records'].pincode - + this.local_city1=res['records'].cities + this.local_pincode1=res['records'].pincode + // console.log( local_city1,local_pincode1) this.whole_json.forEach((val,index)=>{ - - + // let i= index-2 + // console.log( params) if(val.api_properties == 'local_city1' ){ - this.local_city1=this.quesService.convertArrayNames(['city_id','city_name'],this.local_city1) - console.log( this.local_city1) - val.answers = (this.local_city1) + this.local_city1=this.quesService.convertArrayNames(['city_id','city_name'], this.local_city1) + // console.log( this.local_city1) + this.city_array.push( this.local_city1) + + if(this.city_array[this.json_index] == undefined){ + val.answers = this.local_city1 + }else{ + val.answers = this.city_array[this.json_index] + } + + //console.log( this.city_array[0] ) + // val.answers = this.city_array[this.json_index] + //val.answers = local_city1 + // console.log(this.whole_json,this.json_index, val.answers) } else if(val.api_properties == 'local_pincode1'){ - this.local_pincode1=this.quesService.convertArrayNames(['pincode_id','pincode'],this.local_pincode1) - val.answers = (this.local_pincode1) + this.local_pincode1=this.quesService.convertArrayNames(['pincode_id','pincode'], this.local_pincode1) + this.pincode_array.push( this.local_pincode1) + // val.answers = local_pincode1 + // setTimeout(() => { + // console.log( this.pincode_array[index-1] ) + // }, 1000); + + if(this.pincode_array[this.json_index] == undefined){ + val.answers = this.local_pincode1 + }else{ + val.answers = this.pincode_array[this.json_index] + } + // console.log( this.pincode_array,index) + // val.answers = local_pincode2 + // console.log(this.whole_json, val.answers ) } }) @@ -467,12 +493,12 @@ export class DynamicQuestionTemplateComponent implements OnInit { if(val.api_properties == 'local_city' ){ this.local_city=this.quesService.convertArrayNames(['city_id','city_name'],this.local_city) - console.log( this.local_city) - val.answers = (this.local_city) + // console.log( this.local_city) + val.answers = (this.local_city) } else if(val.api_properties == 'local_pincode'){ this.local_pincode=this.quesService.convertArrayNames(['pincode_id','pincode'],this.local_pincode) - val.answers = (this.local_pincode) + val.answers = (this.local_pincode) } // if(val.api_properties == 'local_city1' ){ @@ -490,10 +516,10 @@ export class DynamicQuestionTemplateComponent implements OnInit { } }) }else if(onChangeProperty.purpose == 'api2'){ - console.log(event.value,onChangeProperty.params) + // console.log(event.value,onChangeProperty.params) if(onChangeProperty.api == 'getListOfStatesAndCities'){ - console.log(event.value,onChangeProperty.params) - // onChangeProperty.params = JSON.stringify(onChangeProperty.params); + // console.log(event.value,onChangeProperty.params) + // // onChangeProperty.params = JSON.stringify(onChangeProperty.params); // let updatedParams =JSON.stringify(onChangeProperty.params); // updatedParams = updatedParams.replace('value_of_answer',event.value); // // updatedParams = JSON.parse(updatedParams) @@ -514,8 +540,8 @@ export class DynamicQuestionTemplateComponent implements OnInit { if(val.api_properties == 'local_city1' ){ this.local_city1=this.quesService.convertArrayNames(['city_id','city_name'],this.local_city1) - console.log( this.local_city1) - val.answers = (this.local_city1) + // console.log( this.local_city1) + val.answers = (this.local_city1) } else if(val.api_properties == 'local_pincode1'){ this.local_pincode1=this.quesService.convertArrayNames(['pincode_id','pincode'],this.local_pincode1) @@ -567,7 +593,7 @@ export class DynamicQuestionTemplateComponent implements OnInit { // } } if(onChangeProperty.purpose == 'FORM_CTRL'){ - console.log(onChangeProperty) + // console.log(onChangeProperty) // if(options == 2){ // debugger; @@ -789,7 +815,7 @@ export class DynamicQuestionTemplateComponent implements OnInit { }) const question_temp:any = JSON.parse(JSON.stringify(val.question)); inserted_control_obj.questions[index].question = question_temp - console.log(control_names) + // console.log(control_names) childControl.push(this._fb.group(control_names)) val.group_questions[0].forEach((group_indi,arr_index)=>{ @@ -812,10 +838,10 @@ export class DynamicQuestionTemplateComponent implements OnInit { }) } addOrRemoveControl(val,ques_control,question_index_after,options,paren_ques) { - console.log(val); - console.log(ques_control); - console.log(question_index_after); - console.log(paren_ques); + // console.log(val); + // console.log(ques_control); + // console.log(question_index_after); + // console.log(paren_ques); if(options == 1){ let check_dup=ques_control.filter(control_key=>control_key.question_key == val.question_key) @@ -1037,20 +1063,20 @@ export class DynamicQuestionTemplateComponent implements OnInit { return updateMsg; } updateAllComplete(a,b){ - console.log(a) - console.log(b.checked) + // console.log(a) + // console.log(b.checked) if(b.checked){ - console.log( this.whole_json) + //console.log( this.whole_json) this.formGroupN.get(a).disable() this.parent_ques.disable =true this.vr = true }else{ - console.log( this.whole_json) + // console.log( this.whole_json) this.formGroupN.get(a).enable() this.parent_ques.disable = false this.vr = false - console.log(this.parent_ques.disable) + // console.log(this.parent_ques.disable) } diff --git a/ng6-seed/src/app/layouts/admin/admin-layout.component.html b/ng6-seed/src/app/layouts/admin/admin-layout.component.html index a973418..882a94e 100755 --- a/ng6-seed/src/app/layouts/admin/admin-layout.component.html +++ b/ng6-seed/src/app/layouts/admin/admin-layout.component.html @@ -105,7 +105,7 @@ - | {{userDep}} + | {{userDep}} diff --git a/ng6-seed/src/app/layouts/admin/admin-layout.component.ts b/ng6-seed/src/app/layouts/admin/admin-layout.component.ts index 0fbb06a..9f1e106 100755 --- a/ng6-seed/src/app/layouts/admin/admin-layout.component.ts +++ b/ng6-seed/src/app/layouts/admin/admin-layout.component.ts @@ -55,10 +55,13 @@ export class AdminLayoutComponent implements OnInit, OnDestroy { alertCount: any; userRoleType: any; userDetails: any; + role_id: any; constructor(private router: Router, public menuItems: MenuItems, public horizontalMenuItems : HorizontalMenuItems, public translate: TranslateService,public aws:AwsService,public users:UserService,private _dashboardService: DashboardService) { const browserLang: string = translate.getBrowserLang(); + this.role_id = localStorage.getItem('user_role_nav') translate.use(browserLang.match(/en|fr/) ? browserLang : 'en'); this.users.getroles().subscribe(res=>{ + console.log(res) this.currentUser = res; this.userDetails = this.currentUser.records[0] localStorage.setItem("user_details",JSON.stringify(this.userDetails)); @@ -315,4 +318,15 @@ export class AdminLayoutComponent implements OnInit, OnDestroy { } }) } + route(){ + + console.log(this.role_id, this.currentUser.user_role) + // user_role_nav + if(this.role_id == '20'){ + this.router.navigate(['fly-hi/flyhi-list-pd']); + }else if(this.role_id == '19'){ + this.router.navigate(['sales-pd-list/list-pd']); + } + + } } diff --git a/ng6-seed/src/app/sales-pd/components/ques-template/image-edit/image-edit.component.html b/ng6-seed/src/app/sales-pd/components/ques-template/image-edit/image-edit.component.html index 6da9334..01b233c 100644 --- a/ng6-seed/src/app/sales-pd/components/ques-template/image-edit/image-edit.component.html +++ b/ng6-seed/src/app/sales-pd/components/ques-template/image-edit/image-edit.component.html @@ -1,9 +1,9 @@
-
+ - Photograph's Editing Tools + +
-
+ --> + + + crop_original + + + + + + + + + + + + + + + + + + + +
@@ -26,21 +50,43 @@ (cropend)="cropendImage($event)">
+
+
+
+ +
+ + + +
+ +
+
+ +
+ +
+
-
Images:
+
Please Select Image:
+
Selected Image:
-
Toolbar:
+
-
+ -
+ -
+ -
+ -
+ -
+ -
+ +
--> -
-
- + -
+
diff --git a/ng6-seed/src/app/sales-pd/components/ques-template/image-edit/image-edit.component.scss b/ng6-seed/src/app/sales-pd/components/ques-template/image-edit/image-edit.component.scss index 6dc6278..05bdd38 100644 --- a/ng6-seed/src/app/sales-pd/components/ques-template/image-edit/image-edit.component.scss +++ b/ng6-seed/src/app/sales-pd/components/ques-template/image-edit/image-edit.component.scss @@ -1,4 +1,3 @@ -// @import "~bootstrap/dist/css/bootstrap.min.css"; .crop-res img { max-width: 100%; @@ -167,4 +166,42 @@ padding: 2px; margin: 3px; cursor: pointer; +} + +.toolbar { + color: #fff !important; + // background-color: #e00201 !important; +} + +.toolbar-icon { + padding: 0 14px; + color: #fff !important; +} + +.empty-spacer { + flex: 1 1 auto; +} + +.empty-little-spacer { + flex: 0.01 0 auto; +} + +.card-container { + text-align: center; +} +.img-container { + width: 640px; + height: 480px; + float: left; +} + +.img-preview { + width: 200px; + height: 200px; + float: left; + margin-left: 10px; +} +.cropper-container cropper-bg{ + width: 779px !important; + height: 393px !important; } \ No newline at end of file diff --git a/ng6-seed/src/app/sales-pd/components/ques-template/image-edit/image-edit.component.ts b/ng6-seed/src/app/sales-pd/components/ques-template/image-edit/image-edit.component.ts index 7b7bf18..f88acf0 100644 --- a/ng6-seed/src/app/sales-pd/components/ques-template/image-edit/image-edit.component.ts +++ b/ng6-seed/src/app/sales-pd/components/ques-template/image-edit/image-edit.component.ts @@ -6,7 +6,7 @@ import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.se import {AfterViewInit, Component, ElementRef, ViewChild,OnInit, Inject} from '@angular/core'; import {CropperComponent} from 'angular-cropperjs'; import mergeImages from 'merge-images'; - +import { SalesPdService } from '../../../services/sales-pd.service'; declare var $: any; @Component({ selector: 'app-image-edit', @@ -18,8 +18,8 @@ export class ImageEditComponent implements AfterViewInit { imageUrl: any; imageUrls = []; cropperRes: string; - showCropper: boolean; - savedImg: boolean; + showCropper: boolean =false + savedImg: boolean =false; resizedBase64: any; cropperConfig: object = { movable: true, @@ -38,18 +38,24 @@ export class ImageEditComponent implements AfterViewInit { private context: CanvasRenderingContext2D; role_id: string; - constructor(@Inject(MAT_DIALOG_DATA) public data,private dialogRef: MatDialogRef ) { + constructor(private SalesPdService:SalesPdService,@Inject(MAT_DIALOG_DATA) public data,private dialogRef: MatDialogRef ) { console.log(this.data) this.role_id = localStorage.getItem('LenderRoleID') - this.imageUrls.push(this.data); + this.imageUrls.push(this.data.img); // this.onFileSelected(this.data) - + console.log(this.imageUrls) +// setTimeout(() => { +// this.showCropper = true; +// this.refreshCrop(this.imageUrls[1]); +// }, 3000); + } ngAfterViewInit() { this.context = (this.canvasEl .nativeElement as HTMLCanvasElement).getContext("2d"); this.draw(''); + } private draw(src: string) { @@ -95,6 +101,7 @@ export class ImageEditComponent implements AfterViewInit { refreshCrop(img) { this.imageUrl = img; this.showCropper = true; + console.log(this.imageUrls) } cropendImage(event) { @@ -161,13 +168,35 @@ export class ImageEditComponent implements AfterViewInit { saveImg() { this.savedImg = true; - this.draw(this.cropperRes); + this.draw(this.cropperRes); console.log(this.cropperRes) + this.save() + } + preImg() { + this.savedImg = true; + this.draw(this.cropperRes); + console.log(this.cropperRes) + } mergeAll() { mergeImages(this.cropperResults) .then(b64 => this.mergedRes = b64); } + + save(){ + let params={"fk_sales_pd_id":this.data.sales_pd_id,"img":this.cropperRes,"img_name":this.data.question_key,"location": this.data.location,'img_id':this.data.img_id } + + let form_structure = this.data.json + console.log(params,form_structure) + this.SalesPdService.saveSalesPDImage(params,form_structure).subscribe(apiresult=>{ + console.log(apiresult) + if(apiresult['status'] == 200){ + console.log(apiresult) + this.dialogRef.close(1); + } + + }) + } } 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 a907792..5a78ecf 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 @@ -77,29 +77,39 @@
-
+
-
+ +
+ - + - -
-
+ + +

Image is not captured.

- +
@@ -358,7 +368,7 @@
-
{{parent_ques.get('group_title').value}}
+
{{parent_ques.get('group_title').value}}
@@ -377,9 +387,26 @@ group_ques.value.questions[0].answer_value == ''">Image is not captured.

-
+
-
+
+ +
+
+ + + +
+ +
+
+
diff --git a/ng6-seed/src/app/sales-pd/components/ques-template/ques-template.scss b/ng6-seed/src/app/sales-pd/components/ques-template/ques-template.scss index 4812461..f132be0 100755 --- a/ng6-seed/src/app/sales-pd/components/ques-template/ques-template.scss +++ b/ng6-seed/src/app/sales-pd/components/ques-template/ques-template.scss @@ -84,6 +84,7 @@ position: absolute; right: -10px; top: 4px; + background-color: #e00201 ; } .top .thumbnail .date1 { 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 8e3b81f..adf920b 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 @@ -85,7 +85,9 @@ export class QuesTemplateComponent { pdstatus: string; local_city1: any; local_pincode1: any; + role_id: 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) { + this.role_id = localStorage.getItem('LenderRoleID') console.log('Hello QuesTemplateComponent Component'); this.text = 'Hello World'; this.notifier = notifier; @@ -181,7 +183,7 @@ this.pdstatus = status.status console.log(this.pdstatus) // alert('pass'); console.log(sales_pd_id) - // this.loaderService.showMatSpinnerDialog('Fetching Data...') + this.loaderService.showMatSpinnerDialog('Fetching Data...') // this.checkGroupandPatchValues() // this.loadingProvider.pdloader("Fetching Data...") let params={sales_pd_id:sales_pd_id,section_id:this.local_ques_JSON.section_id} @@ -429,7 +431,8 @@ console.log(this.pdstatus) checkGroupandPatchValues(){ console.log('371') let modified=this.original_result_data - console.log(modified) + console.log( this.questions_JSON ,modified) + // this.questions_JSON = modified.questions modified.questions.forEach((parent_ques,p_i)=>{ // FOR ADDING THE GROUP QUES TO DISPLAY WITHOUT CONSIDERING INDEX 0 if(parent_ques.is_repeatable == '1'){ @@ -747,7 +750,7 @@ this.proceedonChangeProperty(modified) this.geoCoordinates = localStorage.getItem('current_coordinates') console.log(this.geoCoordinates) //SENDING SINGLE IMAGE TO API WITH PRIMARY KEY - let params={"fk_sales_pd_id":"","img":watermarked_img,"img_name":parent_control.value.question_key,"location": geoCoordinates} + let params={"fk_sales_pd_id":"","img":watermarked_img,"img_name":parent_control.value.question_key,"location": geoCoordinates ,"img_id":null} let storage_param=this.questions_JSON const form_structure=this.questions_JSON form_structure.questions=this.quesAnsForm.getRawValue().questions @@ -766,7 +769,7 @@ this.proceedonChangeProperty(modified) this.emittedFormGroup = this.quesAnsForm.getRawValue() this.imageUploadCheck.emit(this.emittedFormGroup); - + console.log(params,form_structure) this.SalesPdService.saveSalesPDImage(params,form_structure).subscribe(apiresult=>{ console.log(apiresult) @@ -2062,13 +2065,37 @@ this.proceedonChangeProperty(modified) } }); } - imageCrop(pic) { - + imageCrop(pic,question,index) { + let modified=this.original_result_data + console.log(modified,index) + console.log(pic,question) + let key = question.get('question_key').value + let location ; + let imgid ; + console.log(key,location) + modified.questions.forEach(element => { + if(element.question_key == key){ + + if(element.is_repeatable == null){ + location = element.image_location + imgid = element.image_id + }else{ + console.log( element.questions_group) + location = element.questions_group[index].questions[0].image_location + imgid = element.questions_group[index].questions[0].image_id + // element.questions_group.forEach(e => { + //location = e.questions[index].image_location + // }); + } + + } + }); + console.log(key,location) // let arr = { 'pic_name':pic_name,'pic':pic,'from_id':this.form_id} //pic.pdid = this.pdid; const imageRef = this.dialog.open(ImageEditComponent, { // const imageRef = this.dialog.open(CropToolsComponent, { - data: pic, + data: {'json':this.questions_JSON,img:pic,'sales_pd_id':modified.sales_pd_id,'question_key':key,'location':location,'img_id':imgid}, maxWidth: '100vw', maxHeight: '100vh', height: '200%', @@ -2076,10 +2103,10 @@ this.proceedonChangeProperty(modified) }); imageRef.afterClosed() .subscribe(dataresult => { - // if (dataresult == 1) { - // this.documentsAndFilesList = []; - // this.retriveFile(); - // } + if (dataresult == 1) { + this.notifier.notify("success","Image Saved Successfully"); + this.getSalesPDSectionFromApi(modified.sales_pd_id) + } }); } } diff --git a/ng6-seed/src/app/sales-pd/components/ques-template/single-capture-btn/single-capture-btn.component.ts b/ng6-seed/src/app/sales-pd/components/ques-template/single-capture-btn/single-capture-btn.component.ts index 4cb4d1e..5a98dc1 100644 --- a/ng6-seed/src/app/sales-pd/components/ques-template/single-capture-btn/single-capture-btn.component.ts +++ b/ng6-seed/src/app/sales-pd/components/ques-template/single-capture-btn/single-capture-btn.component.ts @@ -58,7 +58,7 @@ export class SingleCaptureBtnComponent implements OnInit { this.ng2ImgMax.resizeImage(imageData, 450, 650).subscribe( result => { console.log(result); - // this.singleDataEmitter.emit(result) + this.singleDataEmitter.emit(result) this.loaderService.closeMatSpinnerDialog() }, error => { diff --git a/ng6-seed/src/app/sales-pd/section-list/section-list.component.ts b/ng6-seed/src/app/sales-pd/section-list/section-list.component.ts index 854d111..3574940 100644 --- a/ng6-seed/src/app/sales-pd/section-list/section-list.component.ts +++ b/ng6-seed/src/app/sales-pd/section-list/section-list.component.ts @@ -400,8 +400,8 @@ export class SectionListComponent implements OnInit { } }); - // } - // }) + // } + // }) } getTemplate(){ diff --git a/ng6-seed/src/app/sales-pd/services/sales-pd.service.ts b/ng6-seed/src/app/sales-pd/services/sales-pd.service.ts index 42f8438..83f1293 100644 --- a/ng6-seed/src/app/sales-pd/services/sales-pd.service.ts +++ b/ng6-seed/src/app/sales-pd/services/sales-pd.service.ts @@ -715,4 +715,14 @@ generatesateliteimage(param:any): Observable{ // return this._http.get("http://localhost/AWSEC2/sparqapi/api/uploadSalesPDDataToCETApp/590"); return this._http.get(api_url +"uploadSalesPDDataToCETApp/"+id); } + + loadTemplatelocal(){ + + return this._http.get('assets/data/flyhi.json').map(rr=>{ + let returnValue ={dataStatus:true,status:200,records:{template:JSON.stringify(rr)}} + // this.raw_credit_pd_template= returnValue.records.template + return returnValue + }) + + } } diff --git a/ng6-seed/src/app/session/login/login.component.ts b/ng6-seed/src/app/session/login/login.component.ts index 9a81efa..ab5f5a9 100755 --- a/ng6-seed/src/app/session/login/login.component.ts +++ b/ng6-seed/src/app/session/login/login.component.ts @@ -76,12 +76,14 @@ export class LoginComponent implements OnInit{ let auth = { 'Username': mailid, 'Password': password }; this.loaderService.showMatSpinnerDialog(''); this.aws.dologin(auth).subscribe(res => { - // console.log("do login",res) + console.log("do login",res) if (res !== undefined) { this.getCommonSettings(); // local storage for validate user access localStorage.setItem('user_role',res.idToken.payload["custom:role_id"]); - console.log(res.idToken.payload ["custom:role_id"]); + localStorage.setItem('user_role_nav',res.idToken.payload["custom:role_id"]); + let role = localStorage.getItem('user_role'); + console.log(res.idToken.payload ["custom:role_id"],role); // alert(localStorage.getItem('user_role')) if(res.idToken.payload["custom:role_id"]=='30' || res.idToken.payload["custom:role_id"]=='10' || res.idToken.payload["custom:role_id"]=='11' || res.idToken.payload["custom:role_id"]=='13' || res.idToken.payload["custom:role_id"]=='15' || res.idToken.payload["custom:role_id"]=='17' || res.idToken.payload["custom:role_id"]=='19') { diff --git a/ng6-seed/src/assets/data/flyhi.json b/ng6-seed/src/assets/data/flyhi.json index 545076c..cf7567c 100644 --- a/ng6-seed/src/assets/data/flyhi.json +++ b/ng6-seed/src/assets/data/flyhi.json @@ -858,14 +858,7 @@ "validator": "Validators.required", "message": "Employer/Business Name Required", "value": null - }, - { - "name": "pattern", - "isactive": "1", - "validator": "[A-Za-z ]*", - "message": "alphabets only ", - "value": null - } + } ], "onchange_properties": null }, @@ -900,148 +893,157 @@ } ] }, + { - "question": "Pincode", - "question_key": "officer_pincode", - "field_width": "33", - "type": "3", - "answers": null, - "api_properties": "local_pincode", - "onchange_properties": [ - { - "purpose": "FORM_CTRL", - "form_controls": [ - { - "insert_index": "officer_pincode", - "expression": "(officer_pincode == 1)", - "value_keys": [ - "officer_pincode" - ], - "questions": [ - { - "question_key": "officer_pincode_others", - "question": "Specify the Pincode", - "place_holder": "Enter the Pincode", - "type": "1", - "api_properties": null, - "answers": null, - "onchange_properties": null, - "is_repeatable": null, - "field_type": "num", - "validations": [ - { - "name": "required", - "isactive": "1", - "validator": "Validators.required", - "message": "Pincode is Required", - "value": null - }, - { - "name": "pattern", - "isactive": "1", - "validator": "[0-9]{6}", - "message": "Pincode should be 6 digit", - "value": null - } - ] - } - ] - } - ] - } - ], - "is_repeatable": null, - "validations": [ - { - "name": "required", - "isactive": "1", - "validator": "Validators.required", - "message": "Pincode Required", - "value": null - } - ] - }, - { - "question": "City", - "question_key": "officer_city", - "field_width": "33", - "type": "3", - "answers": null, - "api_properties": "local_city", - "onchange_properties": null, - "is_repeatable": null, - "validations": [ - { - "name": "required", - "isactive": "1", - "validator": "Validators.required", - "message": "CIty Required", - "value": null - } - ] - }, - { - "question": "State", - "question_key": "officer_state", - "field_width": "33", - "type": "3", - "answers": null, - "api_properties": { - "api": "getListOfMaster", - "api_method": "POST", - "params": { - "master_name": "STATE" - }, - "fields": [ - "state_id", - "name" - ] - }, - "onchange_properties": [ - { - "purpose": "api", - "api": "getListOfStatesAndCities", - "api_method": "POST", - "params": "{records:{state_id:'value_of_answer'}}", - "fields": [ - "state_id", - "name" - ], - "local_variable": "local_city" - } - ], - "is_repeatable": null, - "validations": [ - { - "name": "required", - "isactive": "1", - "validator": "Validators.required", - "message": "State Required", - "value": null - } - ] - }, - { - "question": "Workplace Address Details", - "question_key": "officer_address", - "field_width": "33", - "place_holder": "Enter door no,street", - "type": "1", - "answers": null, - "api_properties": null, - "onchange_properties": null, - "is_repeatable": null, - "field_type": "str&num", - "validations": [ - { - "name": "required", - "isactive": "1", - "validator": "Validators.required", - "message": "Address Required", - "value": null - } - ] - } + "question": [ + { + "question": "Workplace Address Details", + "question_key": "officer_address", + "place_holder": "Enter door no,street", + "field_width": "33", + "type": "1", + "answers": null, + "api_properties": null, + "onchange_properties": null, + "is_repeatable": null, + "field_type": "str&num", + "validations": [ + { + "name": "required", + "isactive": "1", + "validator": "Validators.required", + "message": "Address Required", + "value": null + } + ] + }, + { + "question": "State", + "question_key": "residence_state", + "type": "3", + "field_width": "33", + "answers": null, + "api_properties": { + "api": "getListOfMaster", + "api_method": "POST", + "params": { + "master_name": "STATE" + }, + "fields": [ + "state_id", + "name" + ] + }, + "onchange_properties": [ + { + "purpose": "api2", + "api": "getListOfStatesAndCities", + "api_method": "POST", + "params": "{records:{state_id:'value_of_answer'}}", + "fields": [ + "state_id", + "name" + ], + "local_variable": "local_city1" + } + ], + "is_repeatable": null, + "validations": [ + { + "name": "required", + "isactive": "1", + "validator": "Validators.required", + "message": "State Required", + "value": null + } + ] + }, + { + "question": "City", + "question_key": "officer_state", + "type": "3", + "field_width": "33", + "answers": null, + "api_properties": "local_city1", + "onchange_properties": null, + "is_repeatable": null, + "validations": [ + { + "name": "required", + "isactive": "1", + "validator": "Validators.required", + "message": "CIty Required", + "value": null + } + ] + }, + { + "question": "Pincode", + "question_key": "officer_pincode", + "type": "3", + "field_width": "33", + "answers": null, + "api_properties": "local_pincode1", + "onchange_properties": [ + { + "purpose": "FORM_CTRL", + "form_controls": [ + { + "insert_index": "officer_pincode", + "expression": "(officer_pincode == 1)", + "value_keys": [ + "officer_pincode" + ], + "questions": [ + { + "question_key": "residence_pincode_others", + "question": "Specify the Pincode", + "place_holder": "Enter the Pincode", + "type": "1", + "api_properties": null, + "answers": null, + "onchange_properties": null, + "is_repeatable": null, + "field_type": "num", + "validations": [ + { + "name": "required", + "isactive": "1", + "validator": "Validators.required", + "message": "Pincode is Required", + "value": null + }, + { + "name": "pattern", + "isactive": "1", + "validator": "[0-9]{6}", + "message": "Pincode should be 6 digit", + "value": null + } + ] + } + ] + } + ] + } + ], + "is_repeatable": null, + "validations": [ + { + "name": "required", + "isactive": "1", + "validator": "Validators.required", + "message": "Pincode Required", + "value": null + } + ] + } + ], + "is_repeatable": "1", + "group_title": "Workplace verification", + "group_key": "Office verification", + "form_name": "Office verification" + } ] } ]