From c712de67f9fb362532a83c1b42de374e7fe01cd3 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 11 Mar 2019 18:38:55 +0530 Subject: [PATCH 1/2] RI changes --- .../rental-verification.component.html | 4 +- .../rental-verification.component.ts | 143 ++++++++++-------- 2 files changed, 78 insertions(+), 69 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.html index e27dded56..e3adb2011 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.html @@ -182,7 +182,7 @@ Type of Units as per Loan Applicants - + {{unit.name}} @@ -517,7 +517,7 @@ - diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts index 15a112c9f..d9bfc9e7e 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts @@ -31,7 +31,7 @@ export class RentalVerificationComponent implements OnInit { relationToList: any=[]; rentAmtInwords : String; paymentOptions: any=[{id:1,name:"Received in Cash"},{id:2,name:"Received through Banking Channel"},{id:3,name:"Combination of Cash & Bank"}]; - propertyNature: any=[{id:2,name:"ResiDential Property"},{id:3,name:"Commercial Property"},{id:4,name:"Industrial Property"},{id:1,name:"Others (Please Specify)"}]; + propertyNature: any=[{id:2,name:"Residential Property"},{id:3,name:"Commercial Property"},{id:4,name:"Industrial Property"},{id:1,name:"Others (Please Specify)"}]; unitTypeList: any=[]; stateList:any=[]; cityList:any=[]; @@ -60,7 +60,6 @@ export class RentalVerificationComponent implements OnInit { } }; constructor(notifier: NotifierService, private _pd: PdTrigerService ,private _fb: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: any,private dialogRef: MatDialogRef) { - console.log('data',data); this.pdid = this.data.pdmaster_details.pd_id; this.notifier = notifier; this.form_id = 17; @@ -87,9 +86,9 @@ export class RentalVerificationComponent implements OnInit { let industrialProperty = [{id:2,name:'Factory',group_id:3},{id:3,name:'Industrial Shed',group_id:3},{id:1,name:'Other (Please Specify)',group_id:3}]; - this.unitTypeList.push({groupName:'Residential Property',groupValues:resiDentialProperty}); - this.unitTypeList.push({groupName:'Commercial Property',groupValues:commercialProperty}); - this.unitTypeList.push({groupName:'Industrial Property',groupValues:industrialProperty}); + this.unitTypeList.push({groupID:2,groupName:'Residential Property',groupValues:resiDentialProperty}); + this.unitTypeList.push({groupID:3,groupName:'Commercial Property',groupValues:commercialProperty}); + this.unitTypeList.push({groupID:4,groupName:'Industrial Property',groupValues:industrialProperty}); } @@ -260,71 +259,80 @@ loadFormData(){ params.pd_id = this.pdid; params.pd_form_id = this.form_id; this._pd.retriveForm(params).subscribe(data => { - let rentalVal = data.records; - rentalVal.pdid = this.pdid; - rentalVal.formid = this.form_id; - rentalVal.other_name_person_type ? this._rentalForm.addControl('other_name_person_type', new FormControl('', Validators.required)): this._rentalForm.removeControl('other_name_person_type'); - rentalVal.other_sighted_documents ? this._rentalForm.addControl('other_sighted_documents', new FormControl('', Validators.required)) : this._rentalForm.removeControl('other_sighted_documents'); - - // get property unit details - if(data.records.property_unit_details){ - let selectedUnitDetails = Object.keys(data.records.property_unit_details).map(function (key) { - return data.records.property_unit_details[key]; - }); - if(selectedUnitDetails.length>0){ - selectedUnitDetails.forEach((element,index) => { - let control: any = this._rentalForm.controls['property_unit_details']; - control.push(this.createUnitDetails('')); - (element.name_tenant_lessees && element.tenant_lessees_options=="1") ? control.controls[index].addControl('name_tenant_lessees', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees'); - (element.name_tenant_lessees_reason && element.tenant_lessees_options=="0") ? control.controls[index].addControl('name_tenant_lessees_reason', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_reason'); - // for payment options - element.amount_received_cash ? control.controls[index].addControl('amount_received_cash', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_cash'); - element.amount_received_bank ? control.controls[index].addControl('amount_received_bank', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_bank'); - element.payment_received_reason ? control.controls[index].addControl('payment_received_reason', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason'); - - // unit of other measurement - element.other_unit_measurement ? control.controls[index].addControl('other_unit_measurement', new FormControl('', Validators.required)) : control.controls[index].removeControl('other_unit_measurement'); - // rent agreement seen - element.rent_agreement_seen ? control.controls[index].addControl('rent_agreement_seen', new FormControl('', Validators.required)) : control.controls[index].removeControl('rent_agreement_seen'); - element.rent_agreement_registered ? control.controls[index].addControl('rent_agreement_registered', new FormControl('', Validators.required)) : control.controls[index].removeControl('rent_agreement_registered'); - element.agreement_date ? control.controls[index].addControl('agreement_date', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_date'); - element.agreement_no_months ? control.controls[index].addControl('agreement_no_months', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_no_months'); - element.agreement_expiring_date ? control.controls[index].addControl('agreement_expiring_date', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_expiring_date'); - element.rental_remaining_months ? control.controls[index].addControl('rental_remaining_months', new FormControl('', Validators.required)) : control.controls[index].removeControl('rental_remaining_months'); - element.agreement_monthly_rent_amount ? control.controls[index].addControl('agreement_monthly_rent_amount', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_monthly_rent_amount'); - element.agreement_security_deposit_amount ? control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_security_deposit_amount'); - element.differences_loanapplicant_rentagreement ? control.controls[index].addControl('differences_loanapplicant_rentagreement', new FormControl('', Validators.required)) : control.controls[index].removeControl('differences_loanapplicant_rentagreement'); - - //agreement owners - element.agreement_property_owners_name ? control.controls[index].addControl('agreement_property_owners_name', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owners_name'); - element.agreement_property_owner_other ? control.controls[index].addControl('agreement_property_owner_other', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other'); - element.agreement_property_owner_other_relationship ? control.controls[index].addControl('agreement_property_owner_other_relationship', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relationship'); - element.agreement_property_owner_other_relation_to ? control.controls[index].addControl('agreement_property_owner_other_relation_to', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relation_to'); - - // name of tenant/lessess as agreement - element.agreement_tenant_lessees_name ? control.controls[index].addControl('agreement_tenant_lessees_name', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_tenant_lessees_name'); - - //met tenant details - element.name_tenant_lessees_per_met ? control.controls[index].addControl('name_tenant_lessees_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_per_met'); - element.name_tenant_lessees_reason_per_met ? control.controls[index].addControl('name_tenant_lessees_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_reason_per_met'); - element.property_owner_per_met ? control.controls[index].addControl('property_owner_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_per_met'); - element.property_owner_other_per_met ? control.controls[index].addControl('property_owner_other_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_per_met'); - element.property_owner_other_relationship_per_met ? control.controls[index].addControl('property_owner_other_relationship_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relationship_per_met'); - element.property_owner_other_relation_to_per_met ? control.controls[index].addControl('property_owner_other_relation_to_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relation_to_per_met'); - - // tennat payment - element.paid_monthly_rent_per_met ? control.controls[index].addControl('paid_monthly_rent_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('paid_monthly_rent_per_met'); - element.period_of_stay_per_met ? control.controls[index].addControl('period_of_stay_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('period_of_stay_per_met'); - element.payment_mode_per_met ? control.controls[index].addControl('payment_mode_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_mode_per_met'); - element.amount_received_cash_per_met ? control.controls[index].addControl('amount_received_cash_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_cash_per_met'); - element.amount_received_bank_per_met ? control.controls[index].addControl('amount_received_bank_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_bank_per_met'); - element.payment_received_reason_per_met ? control.controls[index].addControl('payment_received_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason_per_met'); - element.payment_difference_per_met ? control.controls[index].addControl('payment_difference_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_difference_per_met'); - + if(data.dataStatus){ + let rentalVal = data.records; + rentalVal.pdid = this.pdid; + rentalVal.formid = this.form_id; + rentalVal.other_name_person_type ? this._rentalForm.addControl('other_name_person_type', new FormControl('', Validators.required)): this._rentalForm.removeControl('other_name_person_type'); + rentalVal.other_sighted_documents ? this._rentalForm.addControl('other_sighted_documents', new FormControl('', Validators.required)) : this._rentalForm.removeControl('other_sighted_documents'); + + // get property unit details + if(data.records.property_unit_details){ + let selectedUnitDetails = Object.keys(data.records.property_unit_details).map(function (key) { + return data.records.property_unit_details[key]; }); + if(selectedUnitDetails.length>0){ + selectedUnitDetails.forEach((element,index) => { + let control: any = this._rentalForm.controls['property_unit_details']; + control.push(this.createUnitDetails('')); + (element.name_tenant_lessees && element.tenant_lessees_options=="1") ? control.controls[index].addControl('name_tenant_lessees', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees'); + (element.name_tenant_lessees_reason && element.tenant_lessees_options=="0") ? control.controls[index].addControl('name_tenant_lessees_reason', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_reason'); + // for payment options + element.amount_received_cash ? control.controls[index].addControl('amount_received_cash', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_cash'); + element.amount_received_bank ? control.controls[index].addControl('amount_received_bank', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_bank'); + element.payment_received_reason ? control.controls[index].addControl('payment_received_reason', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason'); + + // unit of other measurement + element.other_unit_measurement ? control.controls[index].addControl('other_unit_measurement', new FormControl('', Validators.required)) : control.controls[index].removeControl('other_unit_measurement'); + // rent agreement seen + element.rent_agreement_seen ? control.controls[index].addControl('rent_agreement_seen', new FormControl('', Validators.required)) : control.controls[index].removeControl('rent_agreement_seen'); + element.rent_agreement_registered ? control.controls[index].addControl('rent_agreement_registered', new FormControl('', Validators.required)) : control.controls[index].removeControl('rent_agreement_registered'); + element.agreement_date ? control.controls[index].addControl('agreement_date', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_date'); + element.agreement_no_months ? control.controls[index].addControl('agreement_no_months', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_no_months'); + element.agreement_expiring_date ? control.controls[index].addControl('agreement_expiring_date', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_expiring_date'); + (element.rental_remaining_months=='' || element.rental_remaining_months>=0) ? control.controls[index].addControl('rental_remaining_months', new FormControl('', Validators.required)) : control.controls[index].removeControl('rental_remaining_months'); + element.agreement_monthly_rent_amount ? control.controls[index].addControl('agreement_monthly_rent_amount', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_monthly_rent_amount'); + element.agreement_security_deposit_amount ? control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_security_deposit_amount'); + element.differences_loanapplicant_rentagreement ? control.controls[index].addControl('differences_loanapplicant_rentagreement', new FormControl('', Validators.required)) : control.controls[index].removeControl('differences_loanapplicant_rentagreement'); + + //agreement owners + element.agreement_property_owners_name ? control.controls[index].addControl('agreement_property_owners_name', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owners_name'); + element.agreement_property_owner_other ? control.controls[index].addControl('agreement_property_owner_other', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other'); + element.agreement_property_owner_other_relationship ? control.controls[index].addControl('agreement_property_owner_other_relationship', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relationship'); + element.agreement_property_owner_other_relation_to ? control.controls[index].addControl('agreement_property_owner_other_relation_to', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relation_to'); + + // name of tenant/lessess as agreement + element.agreement_tenant_lessees_name ? control.controls[index].addControl('agreement_tenant_lessees_name', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_tenant_lessees_name'); + + //met tenant details + element.name_tenant_lessees_per_met ? control.controls[index].addControl('name_tenant_lessees_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_per_met'); + element.name_tenant_lessees_reason_per_met ? control.controls[index].addControl('name_tenant_lessees_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_reason_per_met'); + element.property_owner_per_met ? control.controls[index].addControl('property_owner_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_per_met'); + element.property_owner_other_per_met ? control.controls[index].addControl('property_owner_other_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_per_met'); + element.property_owner_other_relationship_per_met ? control.controls[index].addControl('property_owner_other_relationship_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relationship_per_met'); + element.property_owner_other_relation_to_per_met ? control.controls[index].addControl('property_owner_other_relation_to_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relation_to_per_met'); + + // tennat payment + element.paid_monthly_rent_per_met ? control.controls[index].addControl('paid_monthly_rent_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('paid_monthly_rent_per_met'); + element.period_of_stay_per_met ? control.controls[index].addControl('period_of_stay_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('period_of_stay_per_met'); + element.payment_mode_per_met ? control.controls[index].addControl('payment_mode_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_mode_per_met'); + element.amount_received_cash_per_met ? control.controls[index].addControl('amount_received_cash_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_cash_per_met'); + element.amount_received_bank_per_met ? control.controls[index].addControl('amount_received_bank_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_bank_per_met'); + element.payment_received_reason_per_met ? control.controls[index].addControl('payment_received_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason_per_met'); + element.payment_difference_per_met ? control.controls[index].addControl('payment_difference_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_difference_per_met'); + console.log(control) + }); + } } + this._rentalForm.patchValue(rentalVal); } - this._rentalForm.patchValue(rentalVal); + else{ + let control: any = this._rentalForm.controls['property_unit_details']; + control.push(this.createUnitDetails('')); + + } + + }); } @@ -525,6 +533,7 @@ calculateExpiryDate(e: any,index){ let getEnteredMonth = control.value[index].agreement_no_months > 0 ? control.value[index].agreement_no_months : '0'; if(getSeletedDate && getEnteredMonth>0){ let modifySeletedDate:any = new Date(new Date(getSeletedDate).setMonth(new Date(getSeletedDate).getMonth() + Number(getEnteredMonth))); + modifySeletedDate.setDate(modifySeletedDate.getDate() - 1); let getExpiryDate=this.pipe.transform(modifySeletedDate, 'dd/MM/yyyy'); control.controls[index].controls['agreement_expiring_date'].setValue(getExpiryDate); // calculate remaining month From 526cdc360d378999c5058646851038d95a633cd0 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 11 Mar 2019 18:39:53 +0530 Subject: [PATCH 2/2] 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; } }