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>
<p style="padding-left: 2% !important">No of Years in Current Business</p>
<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 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 style="width: 35%;">
<input matInput type="number" placeholder="Total Work Experience"
@ -151,10 +151,11 @@
</mat-card-header>
<mat-card-content>
<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 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 style="width: 40%;">
<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>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Permanent"
<input matInput placeholder="Permanent" (change)="checkTotal(businessForm)"
formControlName="employees_permanent" required>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Temporary"
<input matInput placeholder="Temporary" (change)="checkTotal(businessForm)"
formControlName="employees_temporary" required>
</mat-form-field>
</mat-card-content>

View File

@ -1214,6 +1214,37 @@ export class BusinessInfoComponent implements OnInit {
else {
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-form-field>
<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-select placeholder="Frequency" (selectionChange)="selectedfrequency($event.value,i)"
@ -53,7 +53,7 @@
<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="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-select placeholder="Loan Type" formControlName="loan_type" >

View File

@ -29,7 +29,7 @@
<div fxFlex="33">
<mat-form-field style="width: 80%">
<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 multiple placeholder="What is the end use"
formControlName="end_use" (selectionChange)="endUserChange($event)">

View File

@ -50,6 +50,7 @@ export class LoanDetailsComponent implements OnInit {
endUserList: any = [];
sourceList : any = [];
ownerNames: any = [];
m_endUseForLoan = [];
m_endUseofLoad = [];
m_sourceofamount = [];
m_mortageTypeProperty = [];
@ -109,6 +110,7 @@ export class LoanDetailsComponent implements OnInit {
console.clear();
this.initloanDetailsForm();
this.getM_EndUseofLoad();
this.getM_EndUseForLoan(this.pdid);
this.getM_sourceofamount();
this.getM_MortageTypeProperty();
this.getM_StatusofCunstruction();
@ -122,15 +124,13 @@ export class LoanDetailsComponent implements OnInit {
let result = Object.keys(value.records.end_use_group).map(function(key) {
return value.records.end_use_group[key];
});
let ownername: any = [];
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];
});
let enduse: any = [];
result.forEach(val => {
enduse.push(val.end_use);
});
let ownername: any = [];
owner.forEach(val => {
ownername.push(val.owner_name);
if(val.owner_name == 'Others'){
@ -140,15 +140,24 @@ export class LoanDetailsComponent implements OnInit {
this.OtherOwnerFlag = false;
}
});
}
let enduse: any = [];
result.forEach(val => {
enduse.push(val.end_use);
});
this.loanDetailsForm.controls['end_use'].setValue(enduse);
this.endUserChange(enduse);
// console.log('enduse', enduse);
// console.log('ownername', ownername);
this.loanDetailsForm.controls['loan_amount'].setValue(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) {
if (value.records.end_use_other != null) {
this.loanDetailsForm.controls['end_use_other'].setValue(value.records.end_use_other);
}
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.propertyType = 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);
if(this.mortageCardAccess == true){
this.loanDetailsForm.controls['property_type_others'].setValue(value.records.property_type_others);
this.loanDetailsForm.controls['owner_name'].setValue(ownername);
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.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); }
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() {
this._pd.getAllMasterDatas('SOURCEOFBALANCETRANSFER').subscribe(
@ -381,10 +408,12 @@ getM_sourceofamount() {
this.endUserList = [];
let OthersAvaliable;
event.forEach(option => {
let othersData = this.m_endUseofLoad.filter(sub=>sub.subproduct_id==option)[0];
OthersAvaliable = othersData.name.substr(0,6).toLowerCase();
// let othersData = this.m_endUseofLoad.filter(sub=>sub.subproduct_id==option)[0];
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 });
});
if(OthersAvaliable == 'others') {
@ -451,9 +480,11 @@ getM_sourceofamount() {
if (this.isOtherPurpose) {
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_topup = this.loanDetailsForm.controls['is_topup'].value;
if (this.loanDetailsForm.controls['is_transfer'].value == 'yes') {
records.balance_transfer_amount = this.loanDetailsForm.controls['balance_transfer_amount'].value;
}
@ -488,6 +519,7 @@ getM_sourceofamount() {
}
records.emi_level = this.loanDetailsForm.controls['emi_level'].value;
if(this.mortageCardAccess == true){
records.property_type = this.loanDetailsForm.controls['property_type'].value;
records.property_type_others = this.loanDetailsForm.controls['property_type_others'].value;
// records.owner_name_group = this.ownerNames;
@ -497,10 +529,26 @@ getM_sourceofamount() {
dataOwner_name.push({owner_name: element})
});
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.isOtherSource){
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;
}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.emv_per_customer = this.loanDetailsForm.controls['emv_per_customer'].value;
//records.value_per_agreement = this.loanDetailsForm.controls['value_per_agreement'].value;
@ -612,8 +660,6 @@ getM_sourceofamount() {
}else{
this.mortageAccess = false;
}
}
/**

View File

@ -164,7 +164,7 @@
</span> &nbsp;&nbsp;&nbsp;
<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>
&nbsp;<span matPrefix>+91</span>{{applicant.landline}}
&nbsp;{{applicant.landline}}
</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>

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) {
// return (error: any): Observable<T> => {
// return of(result as T);