From 526cdc360d378999c5058646851038d95a633cd0 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 11 Mar 2019 18:39:53 +0530 Subject: [PATCH] merge : kms --- .../family-details.component.html | 22 ++- .../family-details.component.ts | 59 ++++--- .../final-remarks.component.html | 87 +++++++++- .../final-remarks/final-remarks.component.ts | 161 ++++++++++++------ .../general-info/general-info.component.ts | 11 +- 5 files changed, 246 insertions(+), 94 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html index 110b9415b..af3ae4b74 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html @@ -120,7 +120,7 @@ - +
@@ -146,7 +146,7 @@ - + {{"₹"}} {{IncomePerMonth[i]}} Only @@ -180,20 +180,32 @@
-
+
+ +
+ +
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts index 55cf81097..19f6a1319 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts @@ -35,7 +35,6 @@ export class FamilyDetailsComponent implements OnInit { public apiFamilyMembers : any = []; pdid: string; form_id: number; - isReadOnly:any = []; count: number; IncomePerMonth: any = []; RentAmount: any = []; @@ -361,38 +360,43 @@ export class FamilyDetailsComponent implements OnInit { control.removeAt(i); } + prevFamilyMembersCtrlLength: number = 0; + currFamilyMembersCtrlLength: number = 0; + selectedPerson(e,inx){ - + console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength); this.FamilyMemberAsLabel[inx] = this.selectPerson.filter(item => item.pd_co_applicant_id == e)[0].applicant_name; const control = this.familyForm.controls['family_details']['controls'][inx].controls.family_members_details; + // console.log('current control length',control.length); + this.currFamilyMembersCtrlLength = control.length; - let newControlLength: number; - let oldControlLength: number = control.length; - let index: number = 0; + let i : number = 0 ; + for(i ;i < this.prevFamilyMembersCtrlLength;i++){ + console.log(i,this.prevFamilyMembersCtrlLength); + control.removeAt(i); + } + // while(index < this.prevFamilyMembersCtrlLength) + // { + // } + this.prevFamilyMembersCtrlLength = this.currFamilyMembersCtrlLength; + console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength); if(this.apiFamilyMembers.length>0){ let arraydata : any; let data = this.apiFamilyMembers.filter(item => item.relation_to == e); - + if(data.length > 0){ - - newControlLength = data.length; - while(index < oldControlLength) - { - control.removeAt(index); - index++; - } - oldControlLength = newControlLength - + this.prevFamilyMembersCtrlLength = data.length; + console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength); data.forEach((val,inx) => { - if(val.age){ - // this.isReadOnly[inx] = true; - }else{ - // this.isReadOnly[inx] = false; - } + // if(val.age){ + // // this.isReadOnly[inx] = true; + // }else{ + // // this.isReadOnly[inx] = false; + // } arraydata = { 'family_member_name' : val.name, 'family_member_relationship' : val.relationship, @@ -412,24 +416,19 @@ export class FamilyDetailsComponent implements OnInit { }); } else{ - - newControlLength = 1; - while(index < oldControlLength) - { - control.removeAt(index); - index++; - } - oldControlLength = newControlLength; - + this.prevFamilyMembersCtrlLength = 1; + console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength); control.push(this.generateFamilyMembersDetailsGet()); } } else{ + this.prevFamilyMembersCtrlLength = 1; + console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength); control.push(this.generateFamilyMembersDetailsGet()); } } -addFamilyMembers(inx,i) { +addFamilyMembers(inx) { let mainControl = this.familyForm.get('family_details') as FormArray; let control = mainControl.controls[inx].get('family_members_details') as FormArray; control.push(this.generateFamilyMembersDetailsGet()); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html index 5a7ae5e8e..60a138bba 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html @@ -37,7 +37,7 @@
- + Select {{ list.pdofficer_recommendation }} @@ -45,6 +45,89 @@ + + +
+
+ + + + + +
+
+
+ +
+
+ + + + + + + + +
+
+
+ +
+
+ + + + + + + + + + + + +
+
+
+ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts index ed805499b..06cd7b5b2 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts @@ -69,14 +69,65 @@ export class FinalRemarksComponent implements OnInit { is_service_provided: ['', Validators.required], pd_officers_recommendation:['', Validators.required], others_pd_officers_recommendation:[''], - reason_for_positive:[''], - reason_for_negative:[''], - reason_for_refer_to_credit:[''], + // reason_for_positive:[''], + // reason_for_negative:[''], + // reason_for_refer_to_credit:[''], + recommendation_positive:this._formBuilder.array([ + this.CreateRecommendationPositive(null), + ]), + recommendation_negative:this._formBuilder.array([ + this.CreateRecommendationNegative(null), + ]), + recommendation_refer_to_credit:this._formBuilder.array([ + this.CreateRecommendationReferToCredit(null), + ]), final_form_remarks: [''] }); this.getM_Type(); this.getM_Recommendation(); } + + CreateRecommendationPositive(data) { + return this._formBuilder.group({ + reason_for_positive: data == null ? [''] : [data.reason_for_positive], + }); + } + + addRecommendationPositive() { + const control = this._finalRemarkForm.controls['recommendation_positive']; + control.push(this.CreateRecommendationPositive(null)); +} +deleteRecommendationPositive(index) { + const control = this._finalRemarkForm.controls['recommendation_positive']; + control.removeAt(index); +} + + CreateRecommendationNegative(data) { + return this._formBuilder.group({ + reason_for_negative: data == null ? [''] : [data.reason_for_negative], + }); + } + addRecommendationNegative() { + const control = this._finalRemarkForm.controls['recommendation_negative']; + control.push(this.CreateRecommendationNegative(null)); +} +deleteRecommendationNegative(index) { + const control = this._finalRemarkForm.controls['recommendation_negative']; + control.removeAt(index); +} + CreateRecommendationReferToCredit(data) { + return this._formBuilder.group({ + reason_for_refer_to_credit: data == null ? [''] : [data.reason_for_refer_to_credit], + }); + } + addRecommendationReferToCredit() { + const control = this._finalRemarkForm.controls['recommendation_refer_to_credit']; + control.push(this.CreateRecommendationReferToCredit(null)); +} +deleteRecommendationReferToCredit(index) { + const control = this._finalRemarkForm.controls['recommendation_refer_to_credit']; + control.removeAt(index); +} public viewerOptions: any = { navbar: false, toolbar: { @@ -101,15 +152,15 @@ export class FinalRemarksComponent implements OnInit { ngOnInit() { this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '20').subscribe(data=>{ if(data.dataStatus){ - this.RecommendationChange(data.records.pd_officers_recommendation); + // this.RecommendationChange(data.records.pd_officers_recommendation); this._finalRemarkForm.controls.final_custormer_remark_type.setValue(data.records.final_custormer_remark_type); this._finalRemarkForm.controls.final_other_customer_behaviour.setValue(data.records.final_other_customer_behaviour); this._finalRemarkForm.controls.pd_officers_recommendation.setValue(data.records.pd_officers_recommendation); this._finalRemarkForm.controls.others_pd_officers_recommendation.setValue(data.records.others_pd_officers_recommendation); - this._finalRemarkForm.controls.reason_for_positive.setValue(data.records.reason_for_positive); - this._finalRemarkForm.controls.reason_for_negative.setValue(data.records.reason_for_negative); - this._finalRemarkForm.controls.reason_for_refer_to_credit.setValue(data.records.reason_for_refer_to_credit); + // this._finalRemarkForm.controls.reason_for_positive.setValue(data.records.reason_for_positive); + // this._finalRemarkForm.controls.reason_for_negative.setValue(data.records.reason_for_negative); + // this._finalRemarkForm.controls.reason_for_refer_to_credit.setValue(data.records.reason_for_refer_to_credit); this._finalRemarkForm.controls.is_service_provided.setValue(data.records.is_service_provided); this._finalRemarkForm.controls.final_form_remarks.setValue(data.records.final_form_remarks); @@ -204,78 +255,78 @@ export class FinalRemarksComponent implements OnInit { } } - RecommendationChange(e){ - // if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 1){ + // RecommendationChange(e){ + // // if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 1){ - // } - // if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 3){ + // // } + // // if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 3){ - // } - // if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 4){ + // // } + // // if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 4){ - // } + // // } - if(e==1){ + // if(e==1){ - this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValidators([Validators.required]); + // this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValidators([Validators.required]); - this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators(); - this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue(''); + // this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators(); + // this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue(''); - this._finalRemarkForm.controls['reason_for_positive'].clearValidators(); - this._finalRemarkForm.controls['reason_for_positive'].setValue(''); + // this._finalRemarkForm.controls['reason_for_positive'].clearValidators(); + // this._finalRemarkForm.controls['reason_for_positive'].setValue(''); - this._finalRemarkForm.controls['reason_for_negative'].clearValidators(); - this._finalRemarkForm.controls['reason_for_negative'].setValue(''); + // this._finalRemarkForm.controls['reason_for_negative'].clearValidators(); + // this._finalRemarkForm.controls['reason_for_negative'].setValue(''); - } - if(e==2){ + // } + // if(e==2){ - this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators(); - this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue(''); + // this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators(); + // this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue(''); - this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators(); - this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue(''); + // this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators(); + // this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue(''); - this._finalRemarkForm.controls['reason_for_positive'].setValidators([Validators.required]); + // this._finalRemarkForm.controls['reason_for_positive'].setValidators([Validators.required]); - this._finalRemarkForm.controls['reason_for_negative'].clearValidators(); - this._finalRemarkForm.controls['reason_for_negative'].setValue(''); + // this._finalRemarkForm.controls['reason_for_negative'].clearValidators(); + // this._finalRemarkForm.controls['reason_for_negative'].setValue(''); - } - if(e==3){ + // } + // if(e==3){ - this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue(''); - this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity(); + // this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue(''); + // this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity(); - this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue(''); - this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators(); + // this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue(''); + // this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators(); - this._finalRemarkForm.controls['reason_for_positive'].clearValidators(); - this._finalRemarkForm.controls['reason_for_positive'].setValue(''); + // this._finalRemarkForm.controls['reason_for_positive'].clearValidators(); + // this._finalRemarkForm.controls['reason_for_positive'].setValue(''); - this._finalRemarkForm.controls['reason_for_negative'].setValidators([Validators.required]); + // this._finalRemarkForm.controls['reason_for_negative'].setValidators([Validators.required]); - } - if(e==4){ + // } + // if(e==4){ - this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue(''); - this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators(); + // this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue(''); + // this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators(); - this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValidators([Validators.required]); + // this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValidators([Validators.required]); - this._finalRemarkForm.controls['reason_for_positive'].clearValidators(); - this._finalRemarkForm.controls['reason_for_positive'].setValue(''); + // this._finalRemarkForm.controls['reason_for_positive'].clearValidators(); + // this._finalRemarkForm.controls['reason_for_positive'].setValue(''); - this._finalRemarkForm.controls['reason_for_negative'].setValue(''); - this._finalRemarkForm.controls['reason_for_negative'].clearValidators(); + // this._finalRemarkForm.controls['reason_for_negative'].setValue(''); + // this._finalRemarkForm.controls['reason_for_negative'].clearValidators(); - } - this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity(); - this._finalRemarkForm.controls['reason_for_refer_to_credit'].updateValueAndValidity(); - this._finalRemarkForm.controls['reason_for_positive'].updateValueAndValidity(); - this._finalRemarkForm.controls['reason_for_negative'].updateValueAndValidity(); - } + // } + // this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity(); + // this._finalRemarkForm.controls['reason_for_refer_to_credit'].updateValueAndValidity(); + // this._finalRemarkForm.controls['reason_for_positive'].updateValueAndValidity(); + // this._finalRemarkForm.controls['reason_for_negative'].updateValueAndValidity(); + // } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts index f22f71483..cd1978452 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts @@ -612,6 +612,7 @@ export class GeneralInfoComponent implements OnInit { // greater than zero means not applicable here if(this.customer_segment_abbr == 'SE-RI'){ let otherControl: any = this._generalForm.get('companies') as FormArray; + if(otherControl.controls.length > 0){ otherControl = otherControl.controls[0]; // otherControl.controls.business_entity_type_other.clearValidators(); // otherControl.controls.business_entity_type_other.updateValueAndValidity(); @@ -621,7 +622,8 @@ export class GeneralInfoComponent implements OnInit { otherControl.controls.business_entity_type.clearValidators(); otherControl.controls.business_entity_type.updateValueAndValidity(); - + + } } // console.log(formData.individuals.length); // console.log(formData.individuals); @@ -637,9 +639,11 @@ export class GeneralInfoComponent implements OnInit { } else { if(formData.individuals.length > 0){ - // console.log(this.temp,formData.individuals.length); + formData.individuals.forEach((val,index) => { + if(val.is_person_met == false){ + this.temp++; } @@ -647,6 +651,9 @@ export class GeneralInfoComponent implements OnInit { if(this.temp == formData.individuals.length){ this.notifier.notify('warning', 'Please Choose Name of Person Met.!'); + + this.temp = 0; + return; } }