loan details Changes :ps

This commit is contained in:
venbatechnologies@gmail.com 2018-12-12 20:36:32 +05:30
parent 9457aef317
commit 2c91799dd6
2 changed files with 150 additions and 42 deletions

View File

@ -73,12 +73,13 @@
<input matInput placeholder="Top Up Amt" (keypress)="keyPress($event)" formControlName="topup_amount" (keyup)="inWords($event,5)">
<mat-hint align="end" *ngIf="loanDetailsForm.controls['topup_amount'].value != ''">{{"&#8377;"}} {{topUpAmtInWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value != 'yes'">
<input matInput placeholder="Amount of Own Contribution" formControlName="own_contribution" (keypress)="keyPress($event)" required (keyup)="inWords($event,4)">
<mat-hint align="end" *ngIf="loanDetailsForm.controls['own_contribution'].value != ''">{{"&#8377;"}} {{ownContributionInWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value != 'yes'">
<mat-select placeholder="Source" formControlName="source" required>
<mat-option *ngFor="let sour of m_sourceofamount" [value]="sour.id">{{ sour.name }}</mat-option>
</mat-select>
@ -97,17 +98,14 @@
<input matInput placeholder="EMI Comfort Level" formControlName="emi_level" (keypress)="keyPress($event)" required>
</mat-form-field>
<!-- <div *ngIf="productAbbr === 'HL' || productAbbr === 'LL' || productAbbr === 'LAP' "> -->
<mat-card>
<mat-card-header *ngIf="loanDetailsForm.controls['source'].value =='other'" >
<p>Mortgage
<p>
<!-- {{m_mortageTypeProperty | json}} -->
</mat-card-header>
<mat-card *ngIf="mortageCardAccess">
<mat-card-header><p>Mortgage</p></mat-card-header>
<mat-card-content class="matcard">
<mat-form-field>
<mat-select placeholder="Type of Property" formControlName="property_type" required>
<mat-select placeholder="Type of Property" formControlName="property_type" (selectionChange)="mortage_type($event.value)" required>
<mat-option *ngFor="let typeprop of m_mortageTypeProperty" [value]="typeprop.mortage_property_id">{{ typeprop.property_name }}</mat-option>
</mat-select>
</mat-form-field>
<!--<mat-select placeholder="Type of property" formControlName="property_type">
<mat-option value="bungalow">Bungalow</mat-option>
@ -125,21 +123,23 @@
<mat-option value="vacant_land">Vacant Land</mat-option>
<mat-option value="others">Others</mat-option>
</mat-select>-->
</mat-form-field>
<mat-form-field *ngIf="loanDetailsForm.controls['property_type'].value == 'others'">
<input matInput placeholder="Specify Type of Property" formControlName="ownershipOther">
<mat-form-field *ngIf="mortageAccess">
<input matInput placeholder="Specify Type of Property" formControlName="property_type_others">
</mat-form-field>
<mat-form-field>
<mat-select multiple placeholder="Name of Owner"
formControlName="owner_name" (selectionChange)="ownerNameChange($event)" required>
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
<mat-option value="Others">Others</mat-option>
<mat-option value="Others">Others (Please Specify)</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="OtherOwnerFlag">
<input matInput placeholder="Specify Other Owner Name" formControlName="other_owners_name">
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Status of Construction" formControlName="construction_status" required>
<mat-option *ngFor="let status of m_statusofCunstruction" [value]="status.id">{{ status.name }} {{status.id}}</mat-option>
</mat-select>
@ -166,10 +166,6 @@
formControlName="value_per_agreement" (keypress)="keyPress($event)" required (keyup)="inWords($event,3)">
<mat-hint align="end" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"&#8377;"}} {{valAsPerAgmtInWords}} Only</mat-hint>
</mat-form-field> -->
<mat-form-field>
<input matInput placeholder="Estimate Market Value as Per Customer"
formControlName="emv_per_customer" (keypress)="keyPress($event)" required>
</mat-form-field>
</mat-card-content>
</mat-card>
</mat-card>

View File

@ -31,15 +31,20 @@ import {ActivatedRoute, Router} from '@angular/router';
export class LoanDetailsComponent implements OnInit {
public loanDetailsForm: FormGroup;
private notifier: NotifierService;
pdid: number;
form_id: number;
exist_loan_amt: any;
applicants: any;
productAbbr: any;
subProductName: any;
isOtherPurpose: boolean = false;
isSource: boolean = false;
mortageCheck : boolean = true;
OtherOwnerFlag : boolean;
endUserList: any = [];
ownerNames: any = [];
m_endUseofLoad = [];
@ -55,6 +60,10 @@ export class LoanDetailsComponent implements OnInit {
topUpAmtInWords: any;
pageTitle: string ="Loan Details";
mortageCardAccess: boolean;
mortageAccess: boolean = false;
propertyType : any;
constructor(notifier: NotifierService,
private fb: FormBuilder,
private route: ActivatedRoute,
@ -63,6 +72,7 @@ export class LoanDetailsComponent implements OnInit {
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
this.applicants = this.pd_all_details.pdapplicants_detials;
this.productAbbr = this.pd_all_details.pdmaster_details.product_abbr;
this.subProductName = this.pd_all_details.pdmaster_details.subproduct_name;
this.exist_loan_amt = this.pd_all_details.pdmaster_details.loan_amount != '' ? this.pd_all_details.pdmaster_details.loan_amount :'';
this.loanAmtInWords = this._pd.convertNumberToWords(this.exist_loan_amt);
this.form_id = 10;
@ -99,9 +109,15 @@ export class LoanDetailsComponent implements OnInit {
let ownername: any = [];
owner.forEach(val => {
ownername.push(val.owner_name);
if(val.owner_name == 'Others'){
this.OtherOwnerFlag = true;
}
else{
this.OtherOwnerFlag = false;
}
});
console.log('enduse', enduse);
console.log('ownername', ownername);
// 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); }
@ -126,18 +142,28 @@ export class LoanDetailsComponent implements OnInit {
if (value.records.other_bt_lender) {
this.loanDetailsForm.controls['other_bt_lender'].setValue(value.records.other_bt_lender);
}
if(value.records.is_transfer != 'yes'){
this.loanDetailsForm.controls['own_contribution'].setValue(value.records.own_contribution);
if(value.records.own_contribution){ this.ownContributionInWords = this._pd.convertNumberToWords(value.records.own_contribution); }
this.loanDetailsForm.controls['source'].setValue(value.records.source);
}
if (value.records.lender_name_type) {
this.loanDetailsForm.controls['lender_name_type'].setValue(value.records.lender_name_type);
}
this.loanDetailsForm.controls['emi_level'].setValue(value.records.emi_level);
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);
//console.log(this.propertyType);
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);
this.loanDetailsForm.controls['construction_status'].setValue(value.records.construction_status);
if(value.records.construction_status == 4 ){
this.loanDetailsForm.controls['percentage_of_construction'].setValue(value.records.percentage_of_construction);
}
@ -150,6 +176,12 @@ export class LoanDetailsComponent implements OnInit {
this.loanDetailsForm.controls['loandetails_remarks'].setValue(value.records.loandetails_remarks);
}
})
if(this.productAbbr == 'BL' || this.productAbbr == 'PL' || this.productAbbr == 'LL'){
this.mortageCardAccess = false;
}else{
this.mortageCardAccess = true;
}
}
// =============
@ -182,9 +214,42 @@ getM_sourceofamount() {
// this._pd.getAllMasterDatas('MORTAGEPROPERTYTYPE').subscribe(
this._pd.getAllMasterDatas('MORTAGEPROPERTIES').subscribe(
data => {
// console.log('sadfdfads',this.productAbbr);
this.m_mortageTypeProperty = data.records.filter(data => data.isactive == 1);
this.m_mortageTypeProperty = data.records.filter(data => data.group_name == this.productAbbr);
// this.m_mortageTypeProperty = data.records.filter(data => data.isactive == 1);
// this.m_mortageTypeProperty = data.records.filter(data => data.group_name == this.productAbbr);
if(data.dataStatus==true){
let that = this;
this.m_mortageTypeProperty = data.records.filter(
function(data){
if(that.productAbbr != "LAP"){
if(data.group_name == that.productAbbr && data.isactive==1){
console.log('if data');
return data;
}
}
else if(that.productAbbr == "LAP"){
if(data.sub_group_name == that.subProductName && data.isactive==1){
console.log('else data');
return data;
}
}
// if(data.isactive==1 && data.group_name != "LAP"){
// if(data.group_name == that.productAbbr){
// return data;}
// }else if(data.group_name == "LAP" && data.sub_group_name == that.subProductName){
// return data;
// }else{
// return ;
// }
});
// console.log(this.m_mortageTypeProperty);
// console.log(this.propertyType);
// this.mortage_type(this.propertyType);
// if(this.propertyType != ''){
// this.mortage_type(this.propertyType);
// }
}
},
error => {
// this.notifier.notify('warning', 'No Category Records Found.!');
@ -227,12 +292,14 @@ getM_sourceofamount() {
topup_amount: [''],
lender: [''],
other_bt_lender : [''],
own_contribution: ['', Validators.compose([Validators.required])],
source: ['', Validators.compose([Validators.required])],
own_contribution: [''],
source: [''],
lender_name_type: [''],
emi_level: ['', Validators.compose([Validators.required])],
property_type: ['', Validators.compose([Validators.required])],
property_type_others:[''],
owner_name: ['', Validators.compose([Validators.required])],
other_owners_name :[''],
construction_status: ['', Validators.compose([Validators.required])],
percentage_of_construction : [''],
emv_per_customer: ['', Validators.compose([Validators.required])],
@ -250,6 +317,18 @@ getM_sourceofamount() {
});
}
ownerNameChange(event) {
let EventValue;
event.value.forEach(option => {
EventValue = option;
if(EventValue == 'Others'){
this.OtherOwnerFlag = true;
}
else{
this.OtherOwnerFlag = false;
}
});
// this.ownerNames = [];
// event.value.forEach(option => {
// this.ownerNames.push({owner_name: option});
@ -282,6 +361,13 @@ getM_sourceofamount() {
if (this.loanDetailsForm.controls['is_transfer'].value == 'yes') {
records.balance_transfer_amount = this.loanDetailsForm.controls['balance_transfer_amount'].value;
}
else if(this.loanDetailsForm.controls['is_transfer'].value == 'no') {
records.own_contribution = this.loanDetailsForm.controls['own_contribution'].value;
records.source = this.loanDetailsForm.controls['source'].value;
if (this.loanDetailsForm.controls['source'].value == 'other') {
records.lender_name_type = this.loanDetailsForm.controls['lender_name_type'].value;
}
}
if (this.loanDetailsForm.controls['is_topup'].value == 'yes') {
records.topup_amount = this.loanDetailsForm.controls['topup_amount'].value;
}
@ -292,13 +378,9 @@ getM_sourceofamount() {
records.other_bt_lender = this.loanDetailsForm.controls['other_bt_lender'].value;
}
records.own_contribution = this.loanDetailsForm.controls['own_contribution'].value;
records.source = this.loanDetailsForm.controls['source'].value;
if (this.loanDetailsForm.controls['source'].value == 'other') {
records.lender_name_type = this.loanDetailsForm.controls['lender_name_type'].value;
}
records.emi_level = this.loanDetailsForm.controls['emi_level'].value;
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;
// console.log(this.loanDetailsForm.controls['owner_name'].value);
let dataOwner_name = [];
@ -306,6 +388,7 @@ getM_sourceofamount() {
dataOwner_name.push({owner_name: element})
});
records.owner_name_group = dataOwner_name;
records.other_owners_name = this.loanDetailsForm.controls['other_owners_name'].value;
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;
@ -337,10 +420,21 @@ getM_sourceofamount() {
this.loanDetailsForm.controls['is_topup'].clearValidators();
this.loanDetailsForm.controls['is_topup'].updateValueAndValidity();
// console.log('no',event.value);
this.loanDetailsForm.controls['source'].setValidators([Validators.required]);
this.loanDetailsForm.controls['source'].updateValueAndValidity();
this.loanDetailsForm.controls['own_contribution'].setValidators([Validators.required]);
this.loanDetailsForm.controls['own_contribution'].updateValueAndValidity();
}
else if(event.value == 'yes'){
this.loanDetailsForm.controls['is_topup'].setValidators([Validators.required]);
this.loanDetailsForm.controls['is_topup'].updateValueAndValidity();
this.loanDetailsForm.controls['source'].clearValidators();
this.loanDetailsForm.controls['source'].updateValueAndValidity();
this.loanDetailsForm.controls['own_contribution'].clearValidators();
this.loanDetailsForm.controls['own_contribution'].updateValueAndValidity();
// console.log('yes',event.value);
}
@ -379,4 +473,22 @@ getM_sourceofamount() {
}
}
/**
* mortage_type
*/
mortage_type(mortage_value)
{
//console.log(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];
// console.log(mortagetypes);
if(mortagetypes.property_name=='Others (Please Specify)'){
this.mortageAccess = true;
}else{
this.mortageAccess = false;
}
}
}