From 662ec3889253d1515b7553a88cabf80066953a1e Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Sat, 30 Mar 2019 10:16:21 +0530 Subject: [PATCH] fixes : ps --- .../business-info.component.html | 7 +- .../employment-info.component.html | 15 +- .../employment-info.component.ts | 146 +++++++++++++++--- .../loan-details/loan-details.component.ts | 44 ++++-- 4 files changed, 174 insertions(+), 38 deletions(-) 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 408ab90d5..57bf1b88f 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 @@ -1510,9 +1510,10 @@ - {{"₹"}} {{businessForm.controls['employees_appx_salary'].value | numberToWords}} Only + formControlName="employees_appx_salary" required type="number"> + {{"₹"}} + {{businessForm.controls['employees_appx_salary'].value | numberToWords}} + Only - + Select {{ cl.company_name }} @@ -40,17 +40,20 @@ + Higer then business vintage + Higer then business vintage - + + Total working Experience is Lower @@ -186,13 +189,15 @@ + formControlName="amount_paid_in_cash" OnlyNumber type="text" autocomplete="off" (change)="ValidateNetSalary()"> {{"₹"}} {{employmentForm.controls['amount_paid_in_cash'].value | numberToWords}} Only + Given Value is Maximum of Net Salary + formControlName="amount_paid_through_bank" OnlyNumber type="text" autocomplete="off" (change)="ValidateNetSalary()"> {{"₹"}} {{employmentForm.controls['amount_paid_through_bank'].value | numberToWords}} Only + Given Value is Maximum of Net Salary diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts index c185314f2..a0b6ba751 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts @@ -52,7 +52,8 @@ export class EmploymentInfoComponent implements OnInit { public filtered_company_relationship_list: any[]; public dateonly: any = [{date:1,isdisabled:false},{date:2,isdisabled:false},{date:3,isdisabled:false},{date:4,isdisabled:false},{date:5,isdisabled:false},{date:6,isdisabled:false},{date:7,isdisabled:false},{date:8,isdisabled:false},{date:9,isdisabled:false},{date:10,isdisabled:false},{date:11,isdisabled:false},{date:12,isdisabled:false},{date:13,isdisabled:false},{date:14,isdisabled:false},{date:15,isdisabled:false},{date:16,isdisabled:false},{date:17,isdisabled:false},{date:18,isdisabled:false},{date:19,isdisabled:false},{date:20,isdisabled:false},{date:21,isdisabled:false},{date:22,isdisabled:false},{date:23,isdisabled:false},{date:24,isdisabled:false},{date:25,isdisabled:false},{date:26,isdisabled:false},{date:27,isdisabled:false},{date:28,isdisabled:false},{date:29,isdisabled:false},{date:30,isdisabled:false},{date:31,isdisabled:false}]; public todate: any[] = this.dateonly; - + generalExistBusinessYear:any; + generalExistBusinessMonth:any; constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, @@ -67,6 +68,8 @@ export class EmploymentInfoComponent implements OnInit { this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + this.generalExistBusinessYear=100; + this.generalExistBusinessMonth=12; } @@ -180,7 +183,7 @@ export class EmploymentInfoComponent implements OnInit { this.employmentForm = this.fb.group({ employer_name: ['', Validators.compose([Validators.required])], employer_in_brief: ['', Validators.compose([Validators.required])], - how_long_year: ['', Validators.compose([Validators.required])], + how_long_year: ['', Validators.compose([Validators.required]),Validators.max(this.generalExistBusinessYear)], how_long_month: [''], total_business_experience: [''], total_business_previous_experience: [''], @@ -222,18 +225,106 @@ export class EmploymentInfoComponent implements OnInit { } } + checkWithExistYear(e) { + + let data1 = this.company_list.filter(c => c.company_name == e.split('-')[1])[0]; + + console.log('this.generalExistBusinessMonth',this.generalExistBusinessMonth); + console.log('this.generalExistBusinessYear',this.generalExistBusinessYear); + if(data1.business_month != null && data1.business_month != '' && data1.business_month != undefined){ + this.generalExistBusinessMonth = data1.business_month + } + if(data1.business_years){ + this.generalExistBusinessYear = data1.business_years + } + this.employmentForm.controls['how_long_year'].setValidators([Validators.max(this.generalExistBusinessYear)]); + this.employmentForm.controls['how_long_year'].updateValueAndValidity(); + + } + + // ConvertMonthintoYear(e) { + + // let how_long_year = this.employmentForm.controls.how_long_year.value; + + // let converted_month: number = e % 12; + // let converted_year: number = e / 12; + // // if (how_long_year > this.generalExistBusinessYear) { + // // this.employmentForm.controls['how_long_year'].setValidators([Validators.max(this.generalExistBusinessYear)]); + // // this.employmentForm.controls['how_long_year'].updateValueAndValidity(); + // // this.employmentForm.controls['how_long_year'].setValue(''); + // // this.employmentForm.controls['how_long_month'].setValue(''); + // // } + // // else { + // this.employmentForm.controls.how_long_year.setValue(+how_long_year + +Math.floor(converted_year)); + // this.employmentForm.controls.how_long_month.setValue(Math.floor(converted_month)); + // // } + // } + ConvertMonthintoYear(e) { let how_long_year = this.employmentForm.controls.how_long_year.value; - - let converted_month: number = e % 12; + + let converted_month: number = +e%12; let converted_year: number = e / 12; - - this.employmentForm.controls.how_long_year.setValue(+how_long_year + +Math.floor(converted_year)); - this.employmentForm.controls.how_long_month.setValue(Math.floor(converted_month)); - + + if (how_long_year > this.generalExistBusinessYear) { + this.employmentForm.controls['how_long_year'].setValidators([Validators.max(this.generalExistBusinessYear)]); + this.employmentForm.controls['how_long_year'].updateValueAndValidity(); + this.employmentForm.controls['how_long_year'].setValue(''); + this.employmentForm.controls['how_long_month'].setValue(''); + } + else { + if (how_long_year == this.generalExistBusinessYear && +converted_month > this.generalExistBusinessMonth) { + + this.employmentForm.controls['how_long_year'].setValidators([Validators.max(this.generalExistBusinessYear)]); + this.employmentForm.controls['how_long_year'].updateValueAndValidity(); + + this.employmentForm.controls['how_long_month'].setValidators([Validators.max(this.generalExistBusinessMonth)]); + this.employmentForm.controls['how_long_month'].updateValueAndValidity(); + + } else { + + this.employmentForm.controls.how_long_year.setValue(+how_long_year + +Math.floor(converted_year)); + this.employmentForm.controls.how_long_month.setValue(Math.floor(converted_month)); + + } + } } - + + ValidateNetSalary(){ + let salary = this.employmentForm.controls['net_monthly_salary'].value; + console.log('this.employmentForm.controls[amount_paid_in_cash].value',this.employmentForm.controls['amount_paid_in_cash'].value); + + if(salary != ''){ + let cash_amount = this.employmentForm.controls['amount_paid_in_cash'].value; + // let Bank_amount = this.employmentForm.controls['amount_paid_through_bank'].value; + + this.employmentForm.controls['amount_paid_in_cash'].setValidators([Validators.max(salary)]); + this.employmentForm.controls['amount_paid_in_cash'].updateValueAndValidity(); + let maxamt = salary-cash_amount + if(maxamt >= 0 ){ + this.employmentForm.controls['amount_paid_through_bank'].setValidators([Validators.max(salary-cash_amount)]); + } + else{ + this.employmentForm.controls['amount_paid_through_bank'].setValue('0'); + this.employmentForm.controls['amount_paid_through_bank'].setValidators([Validators.max(0)]); + } + this.employmentForm.controls['amount_paid_through_bank'].updateValueAndValidity(); + + } + else{ + // this.toast.pdTriggerappmessage('Net Monthly Salary Is Empty.!'); + this.notifier.notify('warning', 'Net Monthly Salary Is Empty.!'); + this.employmentForm.controls['amount_paid_in_cash'].setValue(''); + this.employmentForm.controls['amount_paid_in_cash'].updateValueAndValidity(); + this.employmentForm.controls['amount_paid_through_bank'].setValue(''); + this.employmentForm.controls['amount_paid_through_bank'].updateValueAndValidity(); + return; + } + + + } + submitDetails() { if(this.pd_cus_segment != 'SAL-CHQ'){ if(this.employmentForm.controls.was_met.value == 'no'){ @@ -394,20 +485,37 @@ export class EmploymentInfoComponent implements OnInit { }) } /** On Key Press Event For Numbers */ + // checkWorkingExperiences(){ + // // this.workExperienceErrorFlag = (+this.employmentForm.controls.total_business_experience.value ) <= (+this.employmentForm.controls.how_long_year.value) ? true : false; + // // this.workExperienceFlag = (+this.employmentForm.controls.total_business_experience.value ) < (+this.employmentForm.controls.how_long_year.value) ? false : true; + // if((+this.employmentForm.controls.total_business_experience.value ) < (+this.employmentForm.controls.how_long_year.value)){ + // console.log(+this.employmentForm.controls.total_business_experience.value , +this.employmentForm.controls.how_long_year.value); + // this.workExperienceFlag = false; + // this.workExperienceErrorFlag = true; + // } + // else{ + // this.workExperienceFlag = true; + // this.workExperienceErrorFlag = false; + // } + // } + checkWorkingExperiences(){ // this.workExperienceErrorFlag = (+this.employmentForm.controls.total_business_experience.value ) <= (+this.employmentForm.controls.how_long_year.value) ? true : false; // this.workExperienceFlag = (+this.employmentForm.controls.total_business_experience.value ) < (+this.employmentForm.controls.how_long_year.value) ? false : true; - if((+this.employmentForm.controls.total_business_experience.value ) < (+this.employmentForm.controls.how_long_year.value)){ - console.log(+this.employmentForm.controls.total_business_experience.value , +this.employmentForm.controls.how_long_year.value); - this.workExperienceFlag = false; - this.workExperienceErrorFlag = true; + + this.employmentForm.controls['total_business_experience'].setValidators([Validators.min(+this.employmentForm.controls.how_long_year.value)]); + this.employmentForm.controls['total_business_experience'].updateValueAndValidity(); + + this.workExperienceFlag = +this.employmentForm.controls.total_business_experience.value > +this.employmentForm.controls.how_long_year.value ? true : false; + + if(!this.workExperienceFlag){ + this.employmentForm.controls['total_business_previous_experience'].setValue(''); + this.employmentForm.controls['total_business_previous_experience'].updateValueAndValidity(); } - else{ - this.workExperienceFlag = true; - this.workExperienceErrorFlag = false; - } - } - + + } + + // keyPress(event: any) { // const pattern = /[0-9]/; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts index d02a1833e..71d02886d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts @@ -334,7 +334,7 @@ export class LoanDetailsComponent implements OnInit { return data; } - else if (data.group_name == that.productAbbr && data.sub_group_name != null && data.isactive == 1) { + else if (data.group_name == that.productAbbr && data.sub_group_name == null && data.isactive == 1) { return data; } @@ -557,22 +557,44 @@ export class LoanDetailsComponent implements OnInit { } /** Using Selected Mortage Type Set validation */ - mortage_type(mortage_value) { + // mortage_type(mortage_value) { - //let mortagetypes = this.m_mortageTypeProperty.filter(mor=>mor.mortage_property_id==mortage_value)[0]; - let mortagetypes = this.m_mortageTypeProperty.filter(mor => mor.mortage_property_id == mortage_value)[0]; + // //let mortagetypes = this.m_mortageTypeProperty.filter(mor=>mor.mortage_property_id==mortage_value)[0]; + // let mortagetypes = this.m_mortageTypeProperty.filter(mor => mor.mortage_property_id == mortage_value)[0]; - if (mortagetypes.property_name == 'Others (Please Specify)') { - this.mortageAccess = true; - this.loanDetailsForm.controls['property_type_others'].setValidators([Validators.required]); - this.loanDetailsForm.controls['property_type_others'].updateValueAndValidity(); - } else { + // if (mortagetypes.property_name == 'Others (Please Specify)') { + // this.mortageAccess = true; + // this.loanDetailsForm.controls['property_type_others'].setValidators([Validators.required]); + // this.loanDetailsForm.controls['property_type_others'].updateValueAndValidity(); + // } else { + // this.mortageAccess = false; + // this.loanDetailsForm.controls['property_type_others'].setValue(''); + // this.loanDetailsForm.controls['property_type_others'].clearValidators(); + // this.loanDetailsForm.controls['property_type_others'].updateValueAndValidity(); + // } + // } + + mortage_type(mortage_value) + { + console.log('mortage_value',mortage_value); + console.log('this.m_mortageTypeProperty',this.m_mortageTypeProperty); + let mortagetypes = this.m_mortageTypeProperty.filter(mor => mor.mortage_property_id == mortage_value)[0]; + let property_name = mortagetypes.property_name.replace(/\s/g, "").toLowerCase(); + if(property_name=='others(pleasespecify)') + { + this.mortageAccess = true; + this.loanDetailsForm.controls['property_type_others'].setValidators([Validators.required]); + this.loanDetailsForm.controls['property_type_others'].updateValueAndValidity(); + }else + { this.mortageAccess = false; this.loanDetailsForm.controls['property_type_others'].setValue(''); this.loanDetailsForm.controls['property_type_others'].clearValidators(); this.loanDetailsForm.controls['property_type_others'].updateValueAndValidity(); - } - } + } + + + } /** For Loan Calculation */ loanCalc() {