family and neigbour : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-03-18 10:43:41 +05:30
parent eb930a31b3
commit 6f4c029ca5
3 changed files with 46 additions and 21 deletions

View File

@ -582,13 +582,36 @@ export class FamilyDetailsComponent implements OnInit {
Ctrls.controls['earning_number_of_years_in_employment_or_business'].clearValidators(); Ctrls.controls['earning_number_of_years_in_employment_or_business'].clearValidators();
if(Ctrls.controls['non_earning_occupation'].value==1){ if(Ctrls.controls['non_earning_occupation'].value==1)
Ctrls.controls['non_earning_if_others'].setValidators([Validators.required]); {
} Ctrls.controls['non_earning_if_others'].setValidators([Validators.required])
Ctrls.controls['non_earning_if_schoolorcollege'].setValue('');
Ctrls.controls['non_earning_if_schoolorcollege'].clearValidators();
Ctrls.controls['non_earning_if_retired_from'].setValue('');
Ctrls.controls['non_earning_if_retired_from'].clearValidators();
}
if(Ctrls.controls['non_earning_occupation'].value==2){ if(Ctrls.controls['non_earning_occupation'].value==2){
Ctrls.controls['non_earning_if_others'].setValue('');
Ctrls.controls['non_earning_if_others'].clearValidators();
Ctrls.controls['non_earning_if_schoolorcollege'].setValidators([Validators.required]); Ctrls.controls['non_earning_if_schoolorcollege'].setValidators([Validators.required]);
Ctrls.controls['non_earning_if_retired_from'].setValue('');
Ctrls.controls['non_earning_if_retired_from'].clearValidators();
} }
if(Ctrls.controls['non_earning_occupation'].value==3){ if(Ctrls.controls['non_earning_occupation'].value==3){
Ctrls.controls['non_earning_if_others'].setValue('');
Ctrls.controls['non_earning_if_others'].clearValidators();
Ctrls.controls['non_earning_if_schoolorcollege'].setValue('');
Ctrls.controls['non_earning_if_schoolorcollege'].clearValidators();
Ctrls.controls['non_earning_if_retired_from'].setValidators([Validators.required]); Ctrls.controls['non_earning_if_retired_from'].setValidators([Validators.required]);
} }
} }

View File

@ -167,7 +167,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 28%"> <mat-form-field style="width: 28%">
<input matInput autocomplete="off" [placeholder]="reference.controls.relationship_with.value ==4 ? 'Rent Amount' : 'Volume of Business'" <input matInput autocomplete="off" [placeholder]="reference.controls.relationship_with.value ==4 ? 'Rent Amount' : 'Volume of Business'"
formControlName="business_volume_amount" type="text" OnlyNumber type="text" (keyup)="inWords($event,r)"> formControlName="business_volume_amount" type="text" OnlyNumber type="text" (keyup)="inWords($event.target.value,r)">
<mat-hint align="start" style="font-size:70%" *ngIf="reference.controls.business_volume_amount.value != ''">{{"&#8377;"}} <mat-hint align="start" style="font-size:70%" *ngIf="reference.controls.business_volume_amount.value != ''">{{"&#8377;"}}
{{amtInwords[r]}} Only</mat-hint> {{amtInwords[r]}} Only</mat-hint>
</mat-form-field> </mat-form-field>

View File

@ -147,19 +147,22 @@ export class NeighbourHoodComponent implements OnInit {
} }
if(exist_ref_details.length>0){ /**&& data.records.check_type==1 */ if(exist_ref_details.length>0){ /**&& data.records.check_type==1 */
exist_ref_details.forEach((element,index) => { exist_ref_details.forEach((element,index) => {
this.amtInwords[index] = this._pd.convertNumberToWords(element.business_volume_amount); if(element.business_volume_amount != null){
this.inWords(element.business_volume_amount,index);
}
// this.amtInwords[index] = this._pd.convertNumberToWords(element.business_volume_amount);
referencecheckControl.push(this.createReerenceCheck(element)); referencecheckControl.push(this.createReerenceCheck(element));
}); });
} }
this._neighbourhoodForm.controls['neighbourhood_status'].setValue(data.records.check_type==0 ? data.records.neighbourhood_status : ''); this._neighbourhoodForm.controls['neighbourhood_status'].setValue(data.records.neighbourhood_status!='' ? data.records.neighbourhood_status : '');
this._neighbourhoodForm.controls['neighbour_reference_remark'].setValue(data.records.neighbour_reference_remark ? data.records.neighbour_reference_remark : ''); this._neighbourhoodForm.controls['neighbour_reference_remark'].setValue(data.records.neighbour_reference_remark ? data.records.neighbour_reference_remark : '');
// this._neighbourhoodForm.controls['check_type'].setValue(data.records.check_type==1 ? 1 : data.records.check_type==0 ? 0 : ''); // this._neighbourhoodForm.controls['check_type'].setValue(data.records.check_type==1 ? 1 : data.records.check_type==0 ? 0 : '');
} }
else { else {
console.log('else',data.dataStatus);
console.log('else',data);
neighbourhoodControl.push(this.createNeighbourhood(this.default_neighbourhood_details)); neighbourhoodControl.push(this.createNeighbourhood(this.default_neighbourhood_details));
referencecheckControl.push(this.createReerenceCheck(this.default_reference_details)); referencecheckControl.push(this.createReerenceCheck(this.default_reference_details));
} }
@ -257,7 +260,6 @@ export class NeighbourHoodComponent implements OnInit {
tempCount : number = 0; tempCount : number = 0;
saveNeighbourhood(formData:any){ saveNeighbourhood(formData:any){
// console.log('formData',formData);
// let resultMessage:string=''; // let resultMessage:string='';
// const referencecheckControl = <FormGroup>this._neighbourhoodForm.controls['referencecheck_list']; // const referencecheckControl = <FormGroup>this._neighbourhoodForm.controls['referencecheck_list'];
@ -276,16 +278,16 @@ export class NeighbourHoodComponent implements OnInit {
nbhdChildCtrl.controls['do_know'].setValidators([Validators.required]); nbhdChildCtrl.controls['do_know'].setValidators([Validators.required]);
nbhdChildCtrl.controls['do_know'].updateValueAndValidity(); nbhdChildCtrl.controls['do_know'].updateValueAndValidity();
// console.log('nbhdChildCtrl.controls.did_not_know_the_business_operation.value',nbhdChildCtrl.controls.did_not_know_the_business_operation.value)
if(nbhdChildCtrl.controls.did_not_know_the_business_operation.value == '' || nbhdChildCtrl.controls.did_not_know_the_business_operation.value == false){ if(nbhdChildCtrl.controls.did_not_know_the_business_operation.value == '' || nbhdChildCtrl.controls.did_not_know_the_business_operation.value == false){
// console.log('IF nbhdChildCtrl.controls.did_not_know_the_business_operation.value',nbhdChildCtrl.controls.did_not_know_the_business_operation.value)
nbhdChildCtrl.controls['how_long_do_know_in_month'].setValidators([Validators.required]); nbhdChildCtrl.controls['how_long_do_know_in_month'].setValidators([Validators.required]);
nbhdChildCtrl.controls['how_long_do_know_in_month'].updateValueAndValidity(); nbhdChildCtrl.controls['how_long_do_know_in_month'].updateValueAndValidity();
nbhdChildCtrl.controls['how_long_do_know_in_year'].setValidators([Validators.required]); nbhdChildCtrl.controls['how_long_do_know_in_year'].setValidators([Validators.required]);
nbhdChildCtrl.controls['how_long_do_know_in_year'].updateValueAndValidity(); nbhdChildCtrl.controls['how_long_do_know_in_year'].updateValueAndValidity();
} }
else if(nbhdChildCtrl.controls.did_not_know_the_business_operation.value == true){ else if(nbhdChildCtrl.controls.did_not_know_the_business_operation.value == true){
// console.log('ELSE nbhdChildCtrl.controls.did_not_know_the_business_operation.value',nbhdChildCtrl.controls.did_not_know_the_business_operation.value)
nbhdChildCtrl.controls['how_long_do_know_in_month'].setValue(''); nbhdChildCtrl.controls['how_long_do_know_in_month'].setValue('');
nbhdChildCtrl.controls['how_long_do_know_in_month'].clearValidators(); nbhdChildCtrl.controls['how_long_do_know_in_month'].clearValidators();
nbhdChildCtrl.controls['how_long_do_know_in_month'].updateValueAndValidity(); nbhdChildCtrl.controls['how_long_do_know_in_month'].updateValueAndValidity();
@ -476,7 +478,7 @@ checkOthers(values){
/** Amount InWords */ /** Amount InWords */
inWords(e,i){ inWords(e,i){
this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value); this.amtInwords[i] = this._pd.convertNumberToWords(e);
} }
compareObjects(o1: any, o2: any) { compareObjects(o1: any, o2: any) {
@ -486,14 +488,14 @@ compareObjects(o1: any, o2: any) {
} }
getOtherOrganisationOwner(value,i) { getOtherOrganisationOwner(value,i) {
// console.log('value',value,'I',i);
let Ctrls = <FormArray>this._neighbourhoodForm.controls['neighbourhood_list']; let Ctrls = <FormArray>this._neighbourhoodForm.controls['neighbourhood_list'];
// console.log('ParCtrls',Ctrls);
let ChdCtrls:any = <FormArray>Ctrls.controls[i]; let ChdCtrls:any = <FormArray>Ctrls.controls[i];
// console.log('ChdCtrls',ChdCtrls);
// return; // return;
let Avaliablity = 1; let Avaliablity = 1;
// console.log('val',value);
if(value.length>0){ if(value.length>0){
value.forEach(option => { value.forEach(option => {
if(option.id == 0 && option.group_id == 2){ if(option.id == 0 && option.group_id == 2){
@ -502,17 +504,17 @@ getOtherOrganisationOwner(value,i) {
}); });
} }
if(Avaliablity == 0){ if(Avaliablity == 0){
// console.log('if Avaliablity',Avaliablity);
ChdCtrls.controls.other_organisation_owner.setValidators([Validators.required]); ChdCtrls.controls.other_organisation_owner.setValidators([Validators.required]);
this.isOrganisationOwner[i] = true; this.isOrganisationOwner[i] = true;
}else if(Avaliablity == 1){ }else if(Avaliablity == 1){
// console.log('else Avaliablity',Avaliablity);
// console.log('esle this.isOrganisationOwner[ParInx]',this.isOrganisationOwner[i]);
ChdCtrls.controls.other_organisation_owner.setValue(''); ChdCtrls.controls.other_organisation_owner.setValue('');
ChdCtrls.controls.other_organisation_owner.clearValidators(); ChdCtrls.controls.other_organisation_owner.clearValidators();
this.isOrganisationOwner[i] = false; this.isOrganisationOwner[i] = false;
// console.log('else this.isOrganisationOwner[ParInx]',this.isOrganisationOwner[i]);
} }
ChdCtrls.controls.other_organisation_owner.updateValueAndValidity(); ChdCtrls.controls.other_organisation_owner.updateValueAndValidity();