fixes : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-03-30 10:16:21 +05:30
parent 91af04fd8d
commit 662ec38892
4 changed files with 174 additions and 38 deletions

View File

@ -1510,9 +1510,10 @@
</div>
<mat-form-field style="width:62%">
<input matInput placeholder="Approximate total monthly salary paid to employees"
formControlName="employees_appx_salary"
required type="number">
<mat-hint align="start" style="font-size:90%" *ngIf="businessForm.controls['employees_appx_salary'].value != ''">{{"&#8377;"}} {{businessForm.controls['employees_appx_salary'].value | numberToWords}} Only</mat-hint>
formControlName="employees_appx_salary" required type="number">
<mat-hint align="start" style="font-size:90%" *ngIf="businessForm.controls['employees_appx_salary'].value != ''">{{"&#8377;"}}
{{businessForm.controls['employees_appx_salary'].value | numberToWords}}
Only</mat-hint>
<!-- <input matInput placeholder="Approximate total monthly salary paid to employees"
(keyup)="inWords($event,1)" formControlName="employees_appx_salary"

View File

@ -22,7 +22,7 @@
<mat-form-field style="width:22%">
<!-- <input matInput> -->
<mat-select placeholder="Name of Employer" formControlName="employer_name" required>
<mat-select placeholder="Name of Employer" formControlName="employer_name" (selectionChange)="checkWithExistYear($event.value)" required>
<mat-option>Select</mat-option>
<mat-option *ngFor="let cl of company_list" [value]="cl.company_order_id+'-'+cl.company_name">{{
cl.company_name }}</mat-option>
@ -40,17 +40,20 @@
<mat-form-field>
<input matInput OnlyNumber type="text" autocomplete="off" placeholder="Year"
formControlName="how_long_year" required min='0'>
<mat-error *ngIf="employmentForm.controls.how_long_year.hasError('max')">Higer then business vintage</mat-error>
</mat-form-field>
<mat-form-field>
<input matInput OnlyNumber type="text" autocomplete="off" placeholder="Month"
formControlName="how_long_month" min='0' (change)="ConvertMonthintoYear($event.target.value)">
<mat-error *ngIf="employmentForm.controls.how_long_month.hasError('max')">Higer then business vintage</mat-error>
</mat-form-field>
<mat-form-field style="width: 22%">
<input matInput placeholder="Total Work Experience" formControlName="total_business_experience"
OnlyNumber autocomplete="off" (change)="checkWorkingExperiences()">
<mat-hint style="color: red;" *ngIf="employmentForm.controls['total_business_experience'].value !=undefined && this.workExperienceErrorFlag">
<!-- <mat-hint style="color: red;" *ngIf="employmentForm.controls['total_business_experience'].value !=undefined && this.workExperienceErrorFlag">
Total working Experience is Lower
</mat-hint>
</mat-hint> -->
<mat-error *ngIf="employmentForm.controls.total_business_experience.hasError('min')">Total working Experience is Lower</mat-error>
</mat-form-field>
<mat-form-field style="width: 34%" *ngIf="workExperienceFlag">
<input matInput placeholder="Previous Work Experience Details" formControlName="total_business_previous_experience">
@ -186,13 +189,15 @@
</mat-form-field>
<mat-form-field style="width: 33%">
<input matInput placeholder="Amount paid in Cash"
formControlName="amount_paid_in_cash" OnlyNumber type="text" autocomplete="off">
formControlName="amount_paid_in_cash" OnlyNumber type="text" autocomplete="off" (change)="ValidateNetSalary()">
<mat-hint align="start" style="font-size:90%" *ngIf="employmentForm.controls['amount_paid_in_cash'].value != ''">{{"&#8377;"}} {{employmentForm.controls['amount_paid_in_cash'].value | numberToWords}} Only</mat-hint>
<mat-error *ngIf="employmentForm.controls.amount_paid_in_cash.hasError('max')">Given Value is Maximum of Net Salary</mat-error>
</mat-form-field>
<mat-form-field style="width: 33%">
<input matInput placeholder="Amount paid through Bank"
formControlName="amount_paid_through_bank" OnlyNumber type="text" autocomplete="off">
formControlName="amount_paid_through_bank" OnlyNumber type="text" autocomplete="off" (change)="ValidateNetSalary()">
<mat-hint align="start" style="font-size:90%" *ngIf="employmentForm.controls['amount_paid_through_bank'].value != ''">{{"&#8377;"}} {{employmentForm.controls['amount_paid_through_bank'].value | numberToWords}} Only</mat-hint>
<mat-error *ngIf="employmentForm.controls.amount_paid_through_bank.hasError('max')">Given Value is Maximum of Net Salary</mat-error>
</mat-form-field>
<mat-form-field style="width: 33%" *ngIf="employmentForm.controls['amount_paid_in_cash'].value != '' && employmentForm.controls['amount_paid_in_cash'].value != 0">
<mat-select placeholder="Is the Amount is Validated or Not" formControlName="check_validated">

View File

@ -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]/;

View File

@ -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() {