common question validation

This commit is contained in:
sriram-at-840620226347 2020-10-17 15:34:13 +05:30
parent a46e2641f0
commit bc74e60d95
5 changed files with 51 additions and 29 deletions

View File

@ -74,6 +74,7 @@
(click)="saveApplicantInfo(applicant,'is_person_met_id_proof')"
fill="clear" ><ion-icon style="font-size: 30px" name="camera"></ion-icon></ion-button><br/> -->
<mat-label>ID Proof of the person</mat-label>
<!-- <mat-error align="end" style="font-size:12px" *ngIf="getQuestionControl().at(0)['controls']['is_person_met_id_proof'].errors?.required ">Required</mat-error> -->
</div>
</div>
</div>
@ -418,7 +419,7 @@
padding: 0px;
margin: 0px;">*</span></ion-button> -->
<!-- <mat-label *ngIf="getQuestionControl().at(1).value.pd_location_pic == ''" style="font-size: 11px">Capture the Image </mat-label> -->
<mat-error align="end" style="font-size:12px" *ngIf="getQuestionControl().at(1)['controls']['pd_location_pic'].errors?.required || getQuestionControl().at(1)['controls']['pd_location_pic'].touched">Approach to pd location pic is Required</mat-error>
<mat-error align="end" style="font-size:12px" *ngIf="getQuestionControl().at(1)['controls']['pd_location_pic'].errors?.required || getQuestionControl().at(1)['controls']['pd_location_pic'].touched">Required</mat-error>
</div>
</div>
<div fxLayout="row">
@ -482,7 +483,8 @@
padding: 0px;
margin: 0px;">*</span></ion-button><br/> -->
<!-- <mat-label *ngIf="getBusinessInfoControls().at(0).value.name_board_sighted_pic == ''" style="font-size: 11px">Capture the Image</mat-label> -->
</div>
<mat-error align="end" style="font-size:12px" *ngIf="getBusinessInfoControls().at(0)['controls']['name_board_sighted_pic'].errors?.required "> Required</mat-error>
</div>
</div>
<div fxLayout="row">
<div fxLayout="column" fxFlex="85%">
@ -524,7 +526,8 @@
<!-- <ion-button (click)="capturePic(documents['controls'].document_image,documents.value.document_name,getBusinessInfoControls().at(0).value.form_id)"
fill="clear" ><ion-icon name="camera"></ion-icon></ion-button><br/> -->
<!-- <mat-label *ngIf="documents.value.document_image == ''" style="font-size: 11px">Capture the Image</mat-label> -->
</div>
<mat-error align="end" style="font-size:12px" *ngIf="documents['controls']['document_image'].errors?.required"> Required</mat-error>
</div>
</div>
<!--<div fxLayout="row"> -->
<div align="end" style="justify-content: flex-end">
@ -583,6 +586,7 @@
<span (click)="captureControls(documents['controls'].document_pic,documents.value.document,getBusinessInfoControls().at(0).value.form_id)">
<app-capture-btn addMoreBtn="true" class="file-btn" (imageDataEmitter)="capturePic($event,documents['controls'].document_pic,documents.value.document,getBusinessInfoControls().at(0).value.form_id)"></app-capture-btn>
</span>
<mat-error align="end" style="font-size:12px" *ngIf="documents['controls']['document_pic'].errors?.required"> Required</mat-error>
<!-- <ion-button (click)="capturePic(documents['controls'].document_pic,documents.value.document,getBusinessInfoControls().at(0).value.form_id)"
fill="clear" ><ion-icon name="camera"></ion-icon></ion-button><br/>
<mat-label *ngIf="documents.value.document_pic == ''" style="font-size: 11px">Capture the Image</mat-label> -->

View File

@ -1110,6 +1110,9 @@ capturePic(event,controls,img_name?:String,form_id?) {
console.log("params savePDImage", records)
this.quesService.savePDImages(records).subscribe(result => {
if(result['dataStatus']) {
if(img_name == 'Person Met Pic') {
this.sendGeoCords(geoCoordinates)
}
controls.setValue(result['uri'])
}
else {
@ -1128,6 +1131,13 @@ capturePic(event,controls,img_name?:String,form_id?) {
)}
}
sendGeoCords(location) {
let params = {"pd_id":this.pdDetails.pd_id,"geo_location":location,"comment":"","fk_updatedby":this.users}
this.quesService.renewSatellite(params).subscribe(rr=>{
})
}
compareObjects(o1: any, o2: any) {
if(o1.id == o2.id && o1.group_id == o2.group_id)
return true;
@ -1212,6 +1222,7 @@ saveApplicantInfo(event,applicant_obj,image_key) {
this.quesService.saveApplicantImgFromVendorForm(params).subscribe(result=>{
if(result['dataStatus']) {
this.sendGeoCords(geoCoordinates)
applicant_obj.controls[image_key].setValue(result['uri']);
}
else {
@ -1268,6 +1279,9 @@ public findInvalidControls() {
// this.myStepper.selectedIndex = 0;
}
else {
msg = this.stepperInfo[index].form_name+" images are not taken"
}
console.log("kkdd",group['controls'][name],firstInvalidField)
@ -1567,6 +1581,7 @@ if(applicant_arr && applicant_arr.length > 0) {
this.getQuestionControl().at(0)['controls'].relation_entered.setValidators(Validators.required)
this.getQuestionControl().at(0)['controls'].relation_to.setValidators(Validators.required) // return true
this.getQuestionControl().at(0)['controls'].person_met_entered_pic.setValidators(Validators.required)
this.getQuestionControl().at(0)['controls'].person_met_entered_id_proof.setValidators(Validators.required)
returnVal = true
}
else {
@ -1582,6 +1597,7 @@ if(applicant_arr && applicant_arr.length > 0) {
this.getQuestionControl().at(0)['controls'].relation_entered.clearValidators();
this.getQuestionControl().at(0)['controls'].relation_to.clearValidators();
this.getQuestionControl().at(0)['controls'].person_met_entered_pic.clearValidators()
this.getQuestionControl().at(0)['controls'].person_met_entered_id_proof.clearValidators()
// return false
returnVal = false
}
@ -1590,6 +1606,7 @@ if(applicant_arr && applicant_arr.length > 0) {
this.getQuestionControl().at(0)['controls'].relation_to.updateValueAndValidity();
this.getQuestionControl().at(0)['controls'].relation_entered.updateValueAndValidity();
this.getQuestionControl().at(0)['controls'].person_met_entered_pic.updateValueAndValidity();
this.getQuestionControl().at(0)['controls'].person_met_entered_id_proof.updateValueAndValidity();
return returnVal
}
// debugger;

View File

@ -24,6 +24,7 @@
<span (click)="capture($event,i,item)">
<app-capture-btn addMoreBtn="true" *ngIf="camera_btn[i] == true" class="file-btn" (imageDataEmitter)="capture($event,i,item)"></app-capture-btn>
</span>
<mat-error align="end" style="font-size:12px" *ngIf="camera_btn[i] == true && item.controls['img'].errors?.required "><p>Required</p></mat-error>
<!-- <div style="width: 100%"> -->
<!-- <ion-buttons slot="end"> -->
<!-- <ion-button style="color:#E00201" *ngIf="camera_btn[i] == true" slot="end" fill="clear" size="small" class="ion-float-right" (click)="capture(i,item)"><ion-icon style="font-size:30px;float:right;" name="camera"></ion-icon></ion-button> -->

View File

@ -1444,28 +1444,28 @@ export class EmployerInfoComponent implements OnInit {
// return;
let records= this.employerForm.getRawValue()
// FOR VERFYING THE IMAGE ARE CAPTURED
// if(flag != 'go_back') {
// let photCheck=records.questions[2]
// let index = this.stepperInfo.findIndex(vv=>vv.form_id == photCheck.form_id);
// console.log("Index",index);
// FOR VERFYING THE IMAGE ARE CAPTURED
if(flag != 'go_back') {
let photCheck=records.questions[2]
let index = this.stepperInfo.findIndex(vv=>vv.form_id == photCheck.form_id);
console.log("Index",index);
// if(photCheck.hasOwnProperty('nameboard_photographs') && photCheck.nameboard_photographs.length <1) {
// if(index != -1) {
// this.myStepper.selectedIndex = this.stepperInfo[index].stepper_index
// }
// console.log("asdf");
// this.notifier.notify("info","Minimum 1 photo required on Name Board")
// return
// }
// if(photCheck.hasOwnProperty('office_photographs') && photCheck.office_photographs.length <3) {
// if(index != -1) {
// this.myStepper.selectedIndex = this.stepperInfo[index].stepper_index
// }
// this.notifier.notify("info","Minimum 3 photos required on Office Setup")
// return
// }
// }
if(photCheck.hasOwnProperty('nameboard_photographs') && photCheck.nameboard_photographs.length <1) {
if(index != -1) {
this.myStepper.selectedIndex = this.stepperInfo[index].stepper_index
}
console.log("asdf");
this.notifier.notify("info","Minimum 1 photo required on Name Board")
return
}
if(photCheck.hasOwnProperty('office_photographs') && photCheck.office_photographs.length <3) {
if(index != -1) {
this.myStepper.selectedIndex = this.stepperInfo[index].stepper_index
}
this.notifier.notify("info","Minimum 3 photos required on Office Setup")
return
}
}
// FOR MERGING EMPLOYMENT SECTION,DOCS SIGHTED,OFFICE AND NAME BOARD PHOTOGRAPH INTO SINGLE OBJ
if(this.getQuestionControl().at(7).get('docs_sighted')) {

View File

@ -318,11 +318,11 @@ export class PdTrigerService {
catchError(this.handleError('operation', []))
)
}
saveApplicantImgFromVendorForm(params) {
let userId= this._aws.getlocale();
params.fk_createdby= userId
return this._http.post(this.apiUrl+'saveApplicantImgFromVendorForm',params)
}
// saveApplicantImgFromVendorForm(params) {
// let userId= this._aws.getlocale();
// params.fk_createdby= userId
// return this._http.post(this.apiUrl+'saveApplicantImgFromVendorForm',params)
// }
// load PD question answers
// getAnswersForPD(list: any): Observable<any> {