From f410e46d738df1402bed90f983041dda4bef6193 Mon Sep 17 00:00:00 2001 From: sriram-at-840620226347 Date: Tue, 28 Jul 2020 18:47:10 +0530 Subject: [PATCH 1/2] Vendor Question Validators remove --- .../forms/address/address.component.html | 18 ++++--- .../forms/address/address.component.ts | 47 +++++++++++++++++-- .../business-info.component.html | 6 +-- .../neighbour-hood.component.ts | 23 +++++---- .../queries-docs/queries-docs.component.ts | 6 +-- 5 files changed, 71 insertions(+), 29 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html index fc226dbb2..4a5f1f083 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html @@ -132,7 +132,7 @@ placeholder="Enter actual PD address" formControlName="alternative_address" [value]="alter_addr.get('alternative_address').value" - required autocomplete="off" appCustomTitleCase> + autocomplete="off" appCustomTitleCase> Alternative Address Required @@ -202,7 +202,7 @@ + autocomplete="off"> Reason Required @@ -218,7 +218,6 @@
Select - @@ -248,7 +246,7 @@
- Select - @@ -283,7 +281,7 @@
+ formControlName="pd_location"> Select {{data.description}} @@ -296,7 +294,7 @@ + formControlName="comment_locality"> Select {{data.rating}} @@ -329,7 +327,7 @@ + autocomplete="off" > UOM Required diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts index 37cdae108..0b725742d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts @@ -246,11 +246,32 @@ export class AddressComponent implements OnInit { address_form_remark: [''] }); if(this.fk_pd_type == '3' || this.fk_pd_type == '2'){ + this.addressForm.controls['is_pd_done_on_initiated_address'].clearValidators(); + this.addressForm.controls['is_pd_done_on_initiated_address'].updateValueAndValidity(); + + this.addressForm.controls['address_type'].clearValidators(); + this.addressForm.controls['address_type'].updateValueAndValidity(); + + this.addressForm.controls['locality'].clearValidators(); + this.addressForm.controls['locality'].updateValueAndValidity(); + + this.addressForm.controls['locality_mixuse'].clearValidators(); + this.addressForm.controls['locality_mixuse'].updateValueAndValidity(); + + this.addressForm.controls['pd_location'].clearValidators(); + this.addressForm.controls['pd_location'].updateValueAndValidity(); + this.addressForm.controls['pd_location'].clearValidators(); this.addressForm.controls['pd_location'].updateValueAndValidity(); this.addressForm.controls['comment_locality'].clearValidators(); this.addressForm.controls['comment_locality'].updateValueAndValidity(); + + this.addressForm.controls['estimated_area'].clearValidators(); + this.addressForm.controls['estimated_area'].updateValueAndValidity(); + + this.addressForm.controls['uom'].clearValidators(); + this.addressForm.controls['uom'].updateValueAndValidity(); } if(this.lender_short_name == 'CLIX' || this.prod_catagory == 'BL'){ this.addressForm.removeControl('estimated_area'); @@ -296,7 +317,7 @@ export class AddressComponent implements OnInit { createAlternativeAddresses(AddressDetails): FormGroup { if (AddressDetails != null) { return this.fb.group({ - alternative_address: [this.transformName(AddressDetails.alternative_address), Validators.compose([Validators.required])], + alternative_address: [this.transformName(AddressDetails.alternative_address)], alternative_state: [AddressDetails.alternative_state], alternative_city: [AddressDetails.alternative_city], alternative_pincode: [AddressDetails.alternative_pincode], @@ -305,13 +326,13 @@ export class AddressComponent implements OnInit { pinSearch:[''], alternative_pd_address_id:[''], alternative_pincode_others: [AddressDetails.alternative_pincode_others, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])], - reason_for_alternative_address: [AddressDetails.reason_for_alternative_address, Validators.compose([Validators.required])], + reason_for_alternative_address: [AddressDetails.reason_for_alternative_address], }); } else if (AddressDetails == null) { return this.fb.group({ - alternative_address: ['', Validators.compose([Validators.required])], + alternative_address: [''], alternative_state: [''], alternative_city: [''], alternative_pincode: [''], @@ -320,9 +341,11 @@ export class AddressComponent implements OnInit { pinSearch:[''], alternative_pd_address_id: [''], alternative_pincode_others:['', Validators.compose([Validators.minLength(6), Validators.maxLength(6)])], - reason_for_alternative_address: ['', Validators.compose([Validators.required])], + reason_for_alternative_address: [''], }); } + + } // addAddresses() { @@ -395,11 +418,17 @@ export class AddressComponent implements OnInit { this.addressForm.addControl('alternative_addresses', this.fb.array([])); const alternative_address_control = this.addressForm.controls['alternative_addresses']; alternative_address_control.push(this.createAlternativeAddresses(null)); + if(this.fk_pd_type != '2'){ + alternative_address_control.at(0)['controls'].reason_for_alternative_address.setValidators(Validators.required); + alternative_address_control.at(0)['controls'].alternative_address.setValidators(Validators.required); + + } } else if (e === true) { // console.log('alternativeAddress',e); this.addressForm.removeControl('alternative_addresses'); } + } // Add and Remove The SpecifyOthers Field @@ -831,6 +860,11 @@ export class AddressComponent implements OnInit { } this.getCityAndPincodeDetails(datas.alternative_state, index, 2); alternative_address_control.push(this.createAlternativeAddresses(obj)); + if(this.fk_pd_type != '2'){ + alternative_address_control.at(0)['controls'].reason_for_alternative_address.setValidators(Validators.required); + alternative_address_control.at(0)['controls'].alternative_address.setValidators(Validators.required); + + } this.setOthers(+datas.alternative_pincode, index, 2); if(datas.alternative_pincode == 1) { let AltCtrl: any = alternative_address_control.controls[index]; @@ -927,6 +961,11 @@ export class AddressComponent implements OnInit { alternative_address_control.removeAt(0); } alternative_address_control.push(this.createAlternativeAddresses(obj)); + if(this.fk_pd_type != '2'){ + alternative_address_control.at(0)['controls'].reason_for_alternative_address.setValidators(Validators.required); + alternative_address_control.at(0)['controls'].alternative_address.setValidators(Validators.required); + + } this.setOthers(+datas.alternative_pincode, index, 2); if(datas.alternative_pincode == 1) { let AltCtrl: any = alternative_address_control.controls[index]; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html index 940482b11..03653e846 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html @@ -1603,12 +1603,12 @@ - - + + No of Employees Sighted By PD Officer During His Visit Company Name Board - + Total Required diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts index 8fac62b43..e45d3b7f0 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts @@ -133,6 +133,8 @@ pdf(fileURL){ this.getMasterDetails('RELATIONWITHBUSINESS',1); this.getMasterDetails('FREQUENCY',2); + + } // load form data @@ -362,17 +364,20 @@ pdf(fileURL){ Ncnt++; } } - + if(this.fk_pd_type != '2'){ this._neighbourhoodForm.controls.neighbourhood_status.setValidators([Validators.required]); this._neighbourhoodForm.controls.neighbourhood_status.updateValueAndValidity(); - if(this._neighbourhoodForm.controls.neighbourhood_status.value != 'Positive'){ - this._neighbourhoodForm.controls.neighbour_reference_remark.setValidators([Validators.required]); - this._neighbourhoodForm.controls.neighbour_reference_remark.updateValueAndValidity(); - } - else{ - this._neighbourhoodForm.controls.neighbour_reference_remark.clearValidators(); - this._neighbourhoodForm.controls.neighbour_reference_remark.updateValueAndValidity(); - } + + + if(this._neighbourhoodForm.controls.neighbourhood_status.value != 'Positive'){ + this._neighbourhoodForm.controls.neighbour_reference_remark.setValidators([Validators.required]); + this._neighbourhoodForm.controls.neighbour_reference_remark.updateValueAndValidity(); + } + else{ + this._neighbourhoodForm.controls.neighbour_reference_remark.clearValidators(); + this._neighbourhoodForm.controls.neighbour_reference_remark.updateValueAndValidity(); + } + } // } // if(formData.check_type==1){ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.ts index 42dad9bd8..e17488041 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.ts @@ -261,7 +261,7 @@ export class QueriesDocsComponent implements OnInit { let control:any=this.docsCollectedForm.controls['docs_to_be_sighted'] this.docs_array_value.forEach((data,index)=>{ control.push(this.createDocsArray(data)) - control.controls[index].addControl(data.pd_doc_to_be_collect_id,new FormControl('',Validators.required)) + control.controls[index].addControl(data.pd_doc_to_be_collect_id,new FormControl('',this.fk_pd_type != '2' ? Validators.required : [])) }) } } @@ -415,14 +415,14 @@ export class QueriesDocsComponent implements OnInit { if(value == 'yes'){ // this.camera_btn[index]=true control.controls[index].removeControl('reason') - control.controls[index].addControl('img',new FormControl('',Validators.required)) + control.controls[index].addControl('img',new FormControl('')) // control.controls[index].addControl('is_new',new FormControl('',Validators.required)) } else if(value == 'no'){ // this.camera_btn[index]=false control.controls[index].removeControl('img') control.controls[index].removeControl('is_new') - control.controls[index].addControl('reason',new FormControl('',Validators.required)); + control.controls[index].addControl('reason',new FormControl('',this.fk_pd_type != '2' ? Validators.required : [])); } } From ab9db6b7d71abd3a275c865f0961ce91a48314d7 Mon Sep 17 00:00:00 2001 From: sriram-at-840620226347 Date: Tue, 28 Jul 2020 18:49:35 +0530 Subject: [PATCH 2/2] merge --- .../queries-docs/queries-docs.component.ts | 8 +++-- .../qc-cus-images/qc-cus-images.component.ts | 36 +++++++++++++++---- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.ts index e17488041..a35e2aefb 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/queries-docs/queries-docs.component.ts @@ -161,7 +161,7 @@ export class QueriesDocsComponent implements OnInit { retrieved_data.pdid=this.pdid retrieved_data.formid="24" retrieved_data.fk_createdby=this.awsService.getlocale(); - retrieved_data.addtional_requirements[0].name='' + retrieved_data.hasOwnProperty('addtional_requirements') ? retrieved_data.addtional_requirements[0].name='' : '' retrieved_data.hasOwnProperty('link') ? retrieved_data.link : retrieved_data.link='' // let geoCoords // if(retrieved_data.link == ''){ @@ -191,6 +191,7 @@ export class QueriesDocsComponent implements OnInit { }) } if(retrieved_data.hasOwnProperty('covid_section') && retrieved_data.covid_section) { + console.log(retrieved_data.covid_section) this.covidAnswers = retrieved_data.covid_section } @@ -357,7 +358,10 @@ export class QueriesDocsComponent implements OnInit { return; } } - let formParams:any; + let formParams:any ={ parent_pdid:this.parent_pdid, + formid:"24", + pdid:this.pdid, + fk_createdby:this.awsService.getlocale(),}; this.disableAfterSubmit=true if((this.queries_docs.length > 0 || this.docs_array_value.length > 0)) { formParams = this.docsCollectedForm.value diff --git a/ng6-seed/src/app/quality-check/qc-cus-images/qc-cus-images.component.ts b/ng6-seed/src/app/quality-check/qc-cus-images/qc-cus-images.component.ts index 8ead15055..c561a66f2 100644 --- a/ng6-seed/src/app/quality-check/qc-cus-images/qc-cus-images.component.ts +++ b/ng6-seed/src/app/quality-check/qc-cus-images/qc-cus-images.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit, ViewChild, ElementRef, Inject } from '@angular/core'; import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material'; import { QcService } from '../qc-service/qc.service'; +import { NotifierService } from 'angular-notifier'; @Component({ selector: 'app-qc-cus-images', @@ -14,10 +15,13 @@ export class QcCusImagesComponent implements OnInit { current_index: any; @ViewChild('dummy_img_more') dummyImgMoreRef:ElementRef imgReCaptureBucket: any[] =[]; + notifier: NotifierService; constructor(private apiService:QcService, private dialogRef: MatDialogRef, - private dialog: MatDialog, - @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { } + private dialog: MatDialog, notifier:NotifierService, + @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { + this.notifier = notifier + } ngOnInit() { // this.records = JSON.parse(this.records) @@ -50,14 +54,20 @@ export class QcCusImagesComponent implements OnInit { // } } else{ - let msgObj ={title:'',subtitle:result.msg?result.msg : 'Invalid Link',is_homebtn:false,message:'The requested url is Invalid. Please contant info@pdgenie.com'} - this.goToErrorComponent(msgObj) + // this.records.is_loaded = false + this.imageData =[] + this.notifier.notify('error',result.hasOwnProperty('msg') && result.msg ?result.msg : 'Something went wrong try again later!!'); + // let msgObj ={title:'',subtitle:result.msg?result.msg : 'Invalid Link',is_homebtn:false,message:'The requested url is Invalid. Please contant info@pdgenie.com'} + // this.goToErrorComponent(msgObj) } },err=>{ - - let msgObj ={title:'404',subtitle:'Not Found',is_homebtn:false,message:'The requested url returns 404. Please check your internet connection'} - this.goToErrorComponent(msgObj) + console.log(err) + // this.records.is_loaded = false + this.imageData =[] + this.notifier.notify('error','Network Error. Please check your internet connection!!'); + // let msgObj ={title:'404',subtitle:'Not Found',is_homebtn:false,message:'The requested url returns 404. Please check your internet connection'} + // this.goToErrorComponent(msgObj) }) } goToErrorComponent(msgObj) { @@ -261,7 +271,19 @@ openBase64(url) { submitQcImages() { console.log(this.imgReCaptureBucket,JSON.stringify(this.imgReCaptureBucket)) this.apiService.auditSmartPDImages(this.imgReCaptureBucket).subscribe(res=>{ + if(res['dataStatus']) { + this.notifier.notify('info','Submitted successfully..'); + setTimeout(()=>{ + this.dialogRef.close() + },2000) + } + else { + this.notifier.notify('warning',res.hasOwnProperty('msg') && res['msg'] ? res['msg'] : 'Something went wrong try again later!!') + } + },err=>{ + console.log(err); + this.notifier.notify('error','Network Error. Please check your internet connection') }) } clearSelected() {