loan details : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-01-11 18:24:13 +05:30
parent fc804356c7
commit b056937d0f
8 changed files with 145 additions and 53 deletions

View File

@ -117,10 +117,10 @@
</mat-form-field> </mat-form-field>
<p style="padding-left: 2% !important">No of Years in Current Business</p> <p style="padding-left: 2% !important">No of Years in Current Business</p>
<mat-form-field style="width: 20%;"> <mat-form-field style="width: 20%;">
<input matInput type="number" placeholder="Year" formControlName="current_business_experiance_year" (keyup)="getWorkExperience(members.value,i)" required min='0'> <input matInput placeholder="Year" formControlName="current_business_experiance_year" (keyup)="getWorkExperience(members.value,i)" required autocomplete="off" (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 21%;"> <mat-form-field style="width: 21%;">
<input matInput type="number" placeholder="Month" formControlName="current_business_experiance_month" required min='0' max='12'> <input matInput placeholder="Month" formControlName="current_business_experiance_month" required (keypress)="keyPress($event)" (change)="ConvertMonthintoYear(members,$event.target.value)" autocomplete="off">
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 35%;"> <mat-form-field style="width: 35%;">
<input matInput type="number" placeholder="Total Work Experience" <input matInput type="number" placeholder="Total Work Experience"
@ -151,10 +151,11 @@
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<mat-form-field style="width: 20%;"> <mat-form-field style="width: 20%;">
<input matInput type="number" placeholder="Year" formControlName="business_years" required min='0'> <input matInput placeholder="Year" formControlName="business_years" required autocomplete="off" (keypress)="keyPress($event)">
<mat-error>Please Enter Correct Year</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 20%;"> <mat-form-field style="width: 20%;">
<input matInput type="number" placeholder="Month" formControlName="business_month" required min='0' max='12'> <input matInput type="number" placeholder="Month" formControlName="business_month" required (keypress)="keyPress($event)" (change)="ConvertMonthintoYearforBusiness($event.target.value)">
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 40%;"> <mat-form-field style="width: 40%;">
<input matInput [max]="maxDate" [matDatepicker]="picker" formControlName="business_date_object" placeholder="Enter Date of Formation, If Available"> <input matInput [max]="maxDate" [matDatepicker]="picker" formControlName="business_date_object" placeholder="Enter Date of Formation, If Available">
@ -1173,11 +1174,11 @@
formControlName="employees_total" required> formControlName="employees_total" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Permanent" <input matInput placeholder="Permanent" (change)="checkTotal(businessForm)"
formControlName="employees_permanent" required> formControlName="employees_permanent" required>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Temporary" <input matInput placeholder="Temporary" (change)="checkTotal(businessForm)"
formControlName="employees_temporary" required> formControlName="employees_temporary" required>
</mat-form-field> </mat-form-field>
</mat-card-content> </mat-card-content>

View File

@ -1214,6 +1214,37 @@ export class BusinessInfoComponent implements OnInit {
else { else {
control.controls[key].removeControl('total_business_previous_experience') control.controls[key].removeControl('total_business_previous_experience')
} }
let total ;
if(control.length > 0){
total = control.value.reduce((sum, val) => sum + +val.current_business_experiance_year, 0);
console.log(total);
this.businessForm.controls.business_years.setValidators([Validators.required, Validators.min(+total)]);
this.businessForm.controls.business_years.updateValueAndValidity();
}
}
/** To Convert Month into Year */
ConvertMonthintoYear(itemrow,e){
let year = itemrow.controls.current_business_experiance_year.value;
let converted_month : number = e%12;
let converted_year : number = e/12;
itemrow.controls.current_business_experiance_year.setValue(+year + +Math.floor(converted_year));
itemrow.controls.current_business_experiance_month.setValue(Math.floor(converted_month));
}
ConvertMonthintoYearforBusiness(e){
let business_year = this.businessForm.controls.business_years.value;
let converted_month : number = e%12;
let converted_year : number = e/12;
this.businessForm.controls.business_years.setValue(+business_year + +Math.floor(converted_year));
this.businessForm.controls.business_month.setValue(Math.floor(converted_month));
} }
@ -1452,4 +1483,11 @@ export class BusinessInfoComponent implements OnInit {
} }
}) })
} }
checkTotal(FormData){
// console.log(FormData.value.employees_permanent);
// console.log(FormData.value.employees_temporary);
// console.log(FormData.value.employees_total);
this.businessForm.controls['employees_total'].setValue((+FormData.value.employees_permanent ||0)+(+FormData.value.employees_temporary||0));
}
} }

View File

@ -39,7 +39,7 @@
<mat-card-content class="matcard"> <mat-card-content class="matcard">
<mat-form-field> <mat-form-field>
<input matInput autocomplete="off" placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" (keyup)="inWords($event,i,1)"> <input matInput autocomplete="off" placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" (keyup)="inWords($event,i,1)">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('loan_amount').value != ''">{{"&#8377;"}} {{amtInwords[i]}} Only</mat-hint> <mat-hint my-mat-hint align="start" *ngIf="details.get('loan_amount').value != ''">{{"&#8377;"}} {{amtInwords[i]}} Only</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Frequency" (selectionChange)="selectedfrequency($event.value,i)" <mat-select placeholder="Frequency" (selectionChange)="selectedfrequency($event.value,i)"
@ -53,7 +53,7 @@
<mat-form-field *ngIf="details.get('frequency').value != ''" style="width:35%"> <mat-form-field *ngIf="details.get('frequency').value != ''" style="width:35%">
<input matInput autocomplete="off" [placeholder]="placeholderName[i] != '' ? placeholderName[i] : 'Instalment Amount' " formControlName="emi" (keypress)="keyPress($event)" (keyup)="inWords($event,i,2)"> <input matInput autocomplete="off" [placeholder]="placeholderName[i] != '' ? placeholderName[i] : 'Instalment Amount' " formControlName="emi" (keypress)="keyPress($event)" (keyup)="inWords($event,i,2)">
<!-- <input matInput autocomplete="off" placeholder="details.get('loan_type').value + Instalment Amount " formControlName="emi" (keypress)="keyPress($event)" (keyup)="inWords($event,i,2)"> --> <!-- <input matInput autocomplete="off" placeholder="details.get('loan_type').value + Instalment Amount " formControlName="emi" (keypress)="keyPress($event)" (keyup)="inWords($event,i,2)"> -->
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('emi').value != ''">{{"&#8377;"}} {{emiAmtInwords[i]}} Only</mat-hint> <mat-hint my-mat-hint align="start" style="font-size:70%" *ngIf="details.get('emi').value != ''">{{"&#8377;"}} {{emiAmtInwords[i]}} Only</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Loan Type" formControlName="loan_type" > <mat-select placeholder="Loan Type" formControlName="loan_type" >

View File

@ -26,7 +26,7 @@
line-height: 1.2em; line-height: 1.2em;
transform: translateY(10px); transform: translateY(10px);
font-size: 75%; font-size: 75%;
} }
.mat-card-content { .mat-card-content {
background-color: white; background-color: white;
} }

View File

@ -29,7 +29,7 @@
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field style="width: 80%"> <mat-form-field style="width: 80%">
<mat-select multiple (selectionChange)="endUserChange($event.value)" placeholder="What is the end use" formControlName="end_use" > <mat-select multiple (selectionChange)="endUserChange($event.value)" placeholder="What is the end use" formControlName="end_use" >
<mat-option *ngFor="let enduse of m_endUseofLoad" [value]="enduse.subproduct_id">{{ enduse.name }}</mat-option> <mat-option *ngFor="let enduse of m_endUseForLoan" [value]="enduse.enduse_of_loan_id">{{ enduse.enduse_of_loan}}</mat-option>
</mat-select> </mat-select>
<!--<mat-select multiple placeholder="What is the end use" <!--<mat-select multiple placeholder="What is the end use"
formControlName="end_use" (selectionChange)="endUserChange($event)"> formControlName="end_use" (selectionChange)="endUserChange($event)">

View File

@ -50,6 +50,7 @@ export class LoanDetailsComponent implements OnInit {
endUserList: any = []; endUserList: any = [];
sourceList : any = []; sourceList : any = [];
ownerNames: any = []; ownerNames: any = [];
m_endUseForLoan = [];
m_endUseofLoad = []; m_endUseofLoad = [];
m_sourceofamount = []; m_sourceofamount = [];
m_mortageTypeProperty = []; m_mortageTypeProperty = [];
@ -109,6 +110,7 @@ export class LoanDetailsComponent implements OnInit {
console.clear(); console.clear();
this.initloanDetailsForm(); this.initloanDetailsForm();
this.getM_EndUseofLoad(); this.getM_EndUseofLoad();
this.getM_EndUseForLoan(this.pdid);
this.getM_sourceofamount(); this.getM_sourceofamount();
this.getM_MortageTypeProperty(); this.getM_MortageTypeProperty();
this.getM_StatusofCunstruction(); this.getM_StatusofCunstruction();
@ -122,33 +124,40 @@ export class LoanDetailsComponent implements OnInit {
let result = Object.keys(value.records.end_use_group).map(function(key) { let result = Object.keys(value.records.end_use_group).map(function(key) {
return value.records.end_use_group[key]; return value.records.end_use_group[key];
}); });
let owner = Object.keys(value.records.owner_name_group).map(function(key) { let ownername: any = [];
return value.records.owner_name_group[key]; if(value.records.owner_name_group != null){
}); let owner = Object.keys(value.records.owner_name_group).map(function(key) {
return value.records.owner_name_group[key];
});
owner.forEach(val => {
ownername.push(val.owner_name);
if(val.owner_name == 'Others'){
this.OtherOwnerFlag = true;
}
else{
this.OtherOwnerFlag = false;
}
});
}
let enduse: any = []; let enduse: any = [];
result.forEach(val => { result.forEach(val => {
enduse.push(val.end_use); enduse.push(val.end_use);
}); });
let ownername: any = [];
owner.forEach(val => { this.loanDetailsForm.controls['end_use'].setValue(enduse);
ownername.push(val.owner_name); this.endUserChange(enduse);
if(val.owner_name == 'Others'){
this.OtherOwnerFlag = true;
}
else{
this.OtherOwnerFlag = false;
}
});
// console.log('enduse', enduse); // console.log('enduse', enduse);
// console.log('ownername', ownername); // console.log('ownername', ownername);
this.loanDetailsForm.controls['loan_amount'].setValue(value.records.loan_amount); this.loanDetailsForm.controls['loan_amount'].setValue(value.records.loan_amount);
if(value.records.loan_amount){ this.loanAmtInWords = this._pd.convertNumberToWords(value.records.loan_amount); } if(value.records.loan_amount){ this.loanAmtInWords = this._pd.convertNumberToWords(value.records.loan_amount); }
this.loanDetailsForm.controls['end_use'].setValue(enduse);
this.endUserChange(enduse); if (value.records.end_use_other != null) {
if (value.records.end_use_other) {
this.loanDetailsForm.controls['end_use_other'].setValue(value.records.end_use_other); this.loanDetailsForm.controls['end_use_other'].setValue(value.records.end_use_other);
} }
this.loanDetailsForm.controls['is_transfer'].setValue(value.records.is_transfer); this.loanDetailsForm.controls['is_transfer'].setValue(value.records.is_transfer);
@ -211,8 +220,11 @@ export class LoanDetailsComponent implements OnInit {
this.loanDetailsForm.controls['property_type'].setValue(value.records.property_type); this.loanDetailsForm.controls['property_type'].setValue(value.records.property_type);
this.propertyType = value.records.property_type; this.propertyType = value.records.property_type;
//console.log(value.records.property_type); //console.log(value.records.property_type);
this.mortage_type(value.records.property_type); if(this.propertyType != null){
this.mortage_type(this.propertyType);
}
//console.log(this.propertyType); //console.log(this.propertyType);
if(this.mortageCardAccess == true){
this.loanDetailsForm.controls['property_type_others'].setValue(value.records.property_type_others); this.loanDetailsForm.controls['property_type_others'].setValue(value.records.property_type_others);
this.loanDetailsForm.controls['owner_name'].setValue(ownername); this.loanDetailsForm.controls['owner_name'].setValue(ownername);
this.loanDetailsForm.controls['other_owners_name'].setValue(value.records.other_owners_name); this.loanDetailsForm.controls['other_owners_name'].setValue(value.records.other_owners_name);
@ -229,6 +241,10 @@ export class LoanDetailsComponent implements OnInit {
this.emvAmtInWords = this._pd.convertNumberToWords(value.records.emv_per_customer); this.emvAmtInWords = this._pd.convertNumberToWords(value.records.emv_per_customer);
} }
}
// this.loanDetailsForm.controls['value_per_agreement'].setValue(value.records.value_per_agreement); // this.loanDetailsForm.controls['value_per_agreement'].setValue(value.records.value_per_agreement);
// if(value.records.value_per_agreement){ this.valAsPerAgmtInWords = this._pd.convertNumberToWords(value.records.value_per_agreement); } // if(value.records.value_per_agreement){ this.valAsPerAgmtInWords = this._pd.convertNumberToWords(value.records.value_per_agreement); }
this.loanDetailsForm.controls['loandetails_remarks'].setValue(value.records.loandetails_remarks); this.loanDetailsForm.controls['loandetails_remarks'].setValue(value.records.loandetails_remarks);
@ -256,6 +272,17 @@ export class LoanDetailsComponent implements OnInit {
} }
) )
} }
getM_EndUseForLoan(pdid) {
this._pd.getEndUseForLoan(pdid).subscribe(
data => {
this.m_endUseForLoan = data.records.filter(data => data.isactive == 1);
},
error => {
// this.notifier.notify('warning', 'No Category Records Found.!');
// this.m_assets_type = "No Category Records Found.";
}
)
}
getM_sourceofamount() { getM_sourceofamount() {
this._pd.getAllMasterDatas('SOURCEOFBALANCETRANSFER').subscribe( this._pd.getAllMasterDatas('SOURCEOFBALANCETRANSFER').subscribe(
@ -381,13 +408,15 @@ getM_sourceofamount() {
this.endUserList = []; this.endUserList = [];
let OthersAvaliable; let OthersAvaliable;
event.forEach(option => { event.forEach(option => {
let othersData = this.m_endUseofLoad.filter(sub=>sub.subproduct_id==option)[0]; // let othersData = this.m_endUseofLoad.filter(sub=>sub.subproduct_id==option)[0];
OthersAvaliable = othersData.name.substr(0,6).toLowerCase(); let othersData = this.m_endUseForLoan.filter(sub=>sub.enduse_of_loan_id==option)[0];
console.log(othersData);
OthersAvaliable = othersData.enduse_of_loan.substr(0,6).toLowerCase();
console.log(OthersAvaliable);
this.endUserList.push({ end_use: option }); this.endUserList.push({ end_use: option });
}); });
if (OthersAvaliable == 'others') { if(OthersAvaliable == 'others') {
this.isOtherPurpose = true; this.isOtherPurpose = true;
}else }else
{ {
@ -442,23 +471,25 @@ getM_sourceofamount() {
records.fk_createdby = this.pdid; records.fk_createdby = this.pdid;
records.loan_amount = this.loanDetailsForm.controls['loan_amount'].value; records.loan_amount = this.loanDetailsForm.controls['loan_amount'].value;
// get end user final group data // get end user final group data
let dataEnd_user_data = []; let dataEnd_user_data = [];
this.loanDetailsForm.controls['end_use'].value.forEach(element => { this.loanDetailsForm.controls['end_use'].value.forEach(element => {
dataEnd_user_data.push({end_use: element}) dataEnd_user_data.push({end_use: element})
}); });
records.end_use_group = dataEnd_user_data; records.end_use_group = dataEnd_user_data;
if (this.isOtherPurpose) { if (this.isOtherPurpose) {
records.end_use_other = this.loanDetailsForm.controls['end_use_other'].value; records.end_use_other = this.loanDetailsForm.controls['end_use_other'].value;
}else{ records.end_use_other = '' ;} }else{ records.end_use_other = null ;}
records.is_transfer = this.loanDetailsForm.controls['is_transfer'].value; records.is_transfer = this.loanDetailsForm.controls['is_transfer'].value;
records.is_topup = this.loanDetailsForm.controls['is_topup'].value; records.is_topup = this.loanDetailsForm.controls['is_topup'].value;
if (this.loanDetailsForm.controls['is_transfer'].value == 'yes') { if (this.loanDetailsForm.controls['is_transfer'].value == 'yes') {
records.balance_transfer_amount = this.loanDetailsForm.controls['balance_transfer_amount'].value; records.balance_transfer_amount = this.loanDetailsForm.controls['balance_transfer_amount'].value;
} }
else if(this.loanDetailsForm.controls['is_transfer'].value == 'no') { else if(this.loanDetailsForm.controls['is_transfer'].value == 'no') {
records.own_contribution = this.loanDetailsForm.controls['own_contribution'].value; records.own_contribution = this.loanDetailsForm.controls['own_contribution'].value;
// records.source = this.loanDetailsForm.controls['source'].value; // records.source = this.loanDetailsForm.controls['source'].value;
// if (this.loanDetailsForm.controls['source'].value == 'other') { // if (this.loanDetailsForm.controls['source'].value == 'other') {
// records.lender_name_type = this.loanDetailsForm.controls['lender_name_type'].value; // records.lender_name_type = this.loanDetailsForm.controls['lender_name_type'].value;
@ -488,19 +519,36 @@ getM_sourceofamount() {
} }
records.emi_level = this.loanDetailsForm.controls['emi_level'].value; records.emi_level = this.loanDetailsForm.controls['emi_level'].value;
records.property_type = this.loanDetailsForm.controls['property_type'].value; if(this.mortageCardAccess == true){
records.property_type_others = this.loanDetailsForm.controls['property_type_others'].value; records.property_type = this.loanDetailsForm.controls['property_type'].value;
// records.owner_name_group = this.ownerNames; records.property_type_others = this.loanDetailsForm.controls['property_type_others'].value;
// console.log(this.loanDetailsForm.controls['owner_name'].value); // records.owner_name_group = this.ownerNames;
let dataOwner_name = []; // console.log(this.loanDetailsForm.controls['owner_name'].value);
this.loanDetailsForm.controls['owner_name'].value.forEach(element => { let dataOwner_name = [];
this.loanDetailsForm.controls['owner_name'].value.forEach(element => {
dataOwner_name.push({owner_name: element}) dataOwner_name.push({owner_name: element})
}); });
records.owner_name_group = dataOwner_name; records.owner_name_group = dataOwner_name;
if(this.OtherOwnerFlag){
records.other_owners_name = this.loanDetailsForm.controls['other_owners_name'].value;
}else{ records.other_owners_name = ''; }
records.construction_status = this.loanDetailsForm.controls['construction_status'].value;
records.emv_per_customer = this.loanDetailsForm.controls['emv_per_customer'].value;
}else{
records.property_type = null;
records.property_type_others = null;
records.owner_name_group = null;
records.other_owners_name = null;
records.construction_status = null;
records.emv_per_customer = null;
}
if(this.OtherOwnerFlag){
records.other_owners_name = this.loanDetailsForm.controls['other_owners_name'].value;
}else{ records.other_owners_name = ''; }
if(this.isOtherSource){ if(this.isOtherSource){
records.other_source = this.loanDetailsForm.controls['other_source'].value; records.other_source = this.loanDetailsForm.controls['other_source'].value;
@ -510,7 +558,7 @@ getM_sourceofamount() {
records.personal_loan_source = this.loanDetailsForm.controls['personal_loan_source'].value; records.personal_loan_source = this.loanDetailsForm.controls['personal_loan_source'].value;
}else{ records.personal_loan_source = ''; } }else{ records.personal_loan_source = ''; }
records.construction_status = this.loanDetailsForm.controls['construction_status'].value;
//records.percentage_of_construction = this.loanDetailsForm.controls['percentage_of_construction'].value; //records.percentage_of_construction = this.loanDetailsForm.controls['percentage_of_construction'].value;
records.emv_per_customer = this.loanDetailsForm.controls['emv_per_customer'].value; records.emv_per_customer = this.loanDetailsForm.controls['emv_per_customer'].value;
//records.value_per_agreement = this.loanDetailsForm.controls['value_per_agreement'].value; //records.value_per_agreement = this.loanDetailsForm.controls['value_per_agreement'].value;
@ -612,8 +660,6 @@ getM_sourceofamount() {
}else{ }else{
this.mortageAccess = false; this.mortageAccess = false;
} }
} }
/** /**

View File

@ -164,7 +164,7 @@
</span> &nbsp;&nbsp;&nbsp; </span> &nbsp;&nbsp;&nbsp;
<span *ngIf="applicant.landline != '' && applicant.landline != 'null-null' && applicant.landline != null " class="mb-2 text-center hover-icon"> <span *ngIf="applicant.landline != '' && applicant.landline != 'null-null' && applicant.landline != null " class="mb-2 text-center hover-icon">
<i class="fa-1x fa fa-phone" style="width: 37px;padding: 8px 9px 8px 9px;border-bottom: 2px solid red;"></i> <i class="fa-1x fa fa-phone" style="width: 37px;padding: 8px 9px 8px 9px;border-bottom: 2px solid red;"></i>
&nbsp;<span matPrefix>+91</span>{{applicant.landline}} &nbsp;{{applicant.landline}}
</span> </span>
<span *ngIf="applicant.applicant_type=='1';else codetails" style="font-size:12px;">( Main Applicant ) </span> <span *ngIf="applicant.applicant_type=='1';else codetails" style="font-size:12px;">( Main Applicant ) </span>
<ng-template #codetails><span>( {{applicant.relation_name}} )</span></ng-template> <ng-template #codetails><span>( {{applicant.relation_name}} )</span></ng-template>

View File

@ -477,6 +477,13 @@ export class PdTrigerService {
) )
} }
getEndUseForLoan(pdid: any): Observable<any> {
return this._http.post<any>(this.apiUrl + "getEndUseOfLoan",{ "records":{ "pd_id" : pdid}})
.pipe(
catchError(this.handleError('operation', []))
)
}
// private handleError<T>(operation = 'operation', result?: T) { // private handleError<T>(operation = 'operation', result?: T) {
// return (error: any): Observable<T> => { // return (error: any): Observable<T> => {
// return of(result as T); // return of(result as T);