assets changes

This commit is contained in:
gandhimathi 2019-01-11 12:30:20 +05:30
parent 832838b56b
commit 1061d03edd
2 changed files with 116 additions and 184 deletions

View File

@ -174,7 +174,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field style="width:30%"> <mat-form-field style="width:30%">
<mat-select placeholder="Is there any asset loan?" formControlName="any_other_asset_loan" (selectionChange)="selectedAssetLoanType($event.value,2)"> <mat-select placeholder="Is there any asset loan?" formControlName="any_other_asset_loan">
<mat-option value="{{data.value}}" *ngFor="let data of m_any_asset_loan_type">{{data.viewValue | titlecase}}</mat-option> <mat-option value="{{data.value}}" *ngFor="let data of m_any_asset_loan_type">{{data.viewValue | titlecase}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@ -186,24 +186,6 @@
</div> </div>
<!-- <div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:30%">
<input matInput placeholder="Value of the Assets" formControlName="any_other_asset_value" autocomplete="off">
</mat-form-field>
<!-- <mat-form-field class="ml-xs example-full-width"> -->
<!-- <input matInput placeholder="Is Any Loan" formControlName="any_other_asset_loan" > -->
<!-- </mat-form-field> --
<mat-form-field style="width:30%">
<mat-select placeholder="Is there any asset loan?" formControlName="any_other_asset_loan" (selectionChange)="selectedAssetLoanType($event.value,2)">
<mat-option value="{{data.value}}" *ngFor="let data of m_any_asset_loan_type">{{data.viewValue}}</mat-option>
</mat-select>
</mat-form-field>
<!-- <mat-form-field class="ml-xs example-full-width" *ngIf="detail.get(any_other_asset_loan).value == 'yes'"> --
<mat-form-field style="width:95%" *ngIf="businessEmiAmtFlag">
<input matInput placeholder="What is the EMI amount ?" formControlName="other_asset_emi_amt" autocomplete="off">
<!-- <span matSuffix>.00</span> --
</mat-form-field>
</div>-->
</div> </div>
</div> </div>
</div> </div>
@ -237,11 +219,18 @@
<span *ngIf="sup.get('business_assets_mode').value != ''"> <span *ngIf="sup.get('business_assets_mode').value != ''">
<mat-form-field style="width:30%">
<mat-label>Vintage</mat-label>
<input matInput autocomplete="off" placeholder="eg.999" formControlName="business_vintage" minlength="1" maxlength="3" (keypress)="keyPress($event)" (keyup)="calculateVintagePurchase($event.target.value,i,1)">
<!-- <mat-error> Invalid format</mat-error> -->
</mat-form-field>
<mat-form-field style="width:30%"> <mat-form-field style="width:30%">
<mat-label>Purchase Year</mat-label> <mat-label>Purchase Year</mat-label>
<input matInput autocomplete="off" placeholder="YYYY eg.2018" formControlName="business_purchase_year" (keypress)="keyPress($event)"> <input matInput autocomplete="off" placeholder="YYYY eg.2018" formControlName="business_purchase_year" minlength="4" maxlength="4" (keypress)="keyPress($event)" (keyup)="calculateVintagePurchase($event.target.value,i,2)">
<mat-error> Invalid year format</mat-error> <!-- <mat-error> Invalid year format</mat-error> -->
</mat-form-field> </mat-form-field>
</span> </span>
@ -249,29 +238,11 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:95%"> <mat-form-field style="width:95%">
<mat-select placeholder="Is there a loan existing against this asset?" formControlName="business_emi"> <mat-select placeholder="Is There a Loan Existing Against This Asset?" formControlName="business_emi">
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width:95%" *ngIf="sup.get('business_emi').value === 'yes'">
<input matInput placeholder="Amount of EMI on This Loan?" formControlName="business_emi_paid" (keypress)="keyPress($event)" autocomplete="off" (keyup)="inWords($event,i,3)">
<mat-hint align="start" style="font-size:70%" *ngIf="sup.get('business_emi_paid').value != ''">{{"&#8377;"}} {{emiAmtInwords[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field *ngIf="sup.get('business_emi').value === 'yes'" style="width:30%">
<input matInput placeholder="Original Loan Tenure in Months" formControlName="business_original_loan_tenure" autocomplete="off" (change)="loanTenureCalc(sup,2)" (keypress)="keyPress($event)">
</mat-form-field>
<mat-form-field *ngIf="sup.get('business_emi').value === 'yes'" style="width:30%">
<input matInput placeholder="Balance Tenure in Months" formControlName="business_balance_tenure" autocomplete="off" (change)="loanTenureCalc(sup,2)" (keypress)="keyPress($event)">
</mat-form-field>
<mat-form-field *ngIf="sup.get('business_emi').value === 'yes' && sup.get('business_original_loan_tenure').value != '' && sup.get('business_balance_tenure').value != '' " style="width:30%">
<input matInput placeholder="Elapsed Tenure in Months" formControlName="business_elapsed_tenure" autocomplete="off" readonly>
</mat-form-field>
</div> </div>
</span> </span>
@ -305,7 +276,7 @@
</div> </div>
</ng-template> </ng-template>
</mat-tab> </mat-tab>
<mat-tab label="Other Personal Assets"> <mat-tab label="Other Assets">
<ng-template matTabContent> <ng-template matTabContent>
<div fxLayout="row wrap"> <div fxLayout="row wrap">
<div fxFlex="100"> <div fxFlex="100">
@ -474,26 +445,34 @@
</div> </div>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:30%"> <mat-form-field style="width:45%">
<mat-select placeholder="Name of the Owner" <!-- <mat-select placeholder="Name of the Owner"
formControlName="name_of_the_owner" > formControlName="name_of_the_owner" >
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name | titlecase}}</mat-option> <mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name | titlecase}}</mat-option>
</mat-select> -->
<mat-select placeholder="Name of the Owner"
formControlName="name_of_the_owner" [compareWith]="compareObjects" required>
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
</mat-option>
</mat-optgroup>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="sup.get('name_of_the_owner').value == 0" style="width:30%"> <mat-form-field *ngIf="checkOthers(sup.get('name_of_the_owner').value)===true" style="width:45%">
<input matInput placeholder="Specify Owner Name" <input matInput placeholder="Specify Owner Name"
formControlName="other_owner" autocomplete="off"> formControlName="other_owner" autocomplete="off">
</mat-form-field> </mat-form-field>
<mat-form-field style="width:30%"> <!-- <mat-form-field style="width:30%">
<mat-select placeholder="Relation" formControlName="relation" > <mat-select placeholder="Relation" formControlName="relation" >
<mat-option value="{{relations.relationship_id}}" <mat-option value="{{relations.relationship_id}}"
*ngFor="let relations of m_relation"> *ngFor="let relations of m_relation">
{{relations.name | titlecase}} {{relations.name | titlecase}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field> -->
</div> </div>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
@ -502,21 +481,11 @@
<input matInput placeholder="Value of the Assets" formControlName="any_other_asset_value" autocomplete="off" (keyup)="inWords($event,s,12)" (keypress)="keyPress($event)"> <input matInput placeholder="Value of the Assets" formControlName="any_other_asset_value" autocomplete="off" (keyup)="inWords($event,s,12)" (keypress)="keyPress($event)">
<mat-hint align="start" style="font-size:70%" *ngIf="detail.get('any_other_asset_value').value != ''">{{"&#8377;"}} {{OtherAssetValueInwords[s]}} Only</mat-hint> <mat-hint align="start" style="font-size:70%" *ngIf="detail.get('any_other_asset_value').value != ''">{{"&#8377;"}} {{OtherAssetValueInwords[s]}} Only</mat-hint>
</mat-form-field> </mat-form-field>
<!-- <mat-form-field class="ml-xs example-full-width"> -->
<!-- <input matInput placeholder="Is Any Loan" formControlName="any_other_asset_loan" > -->
<!-- </mat-form-field> -->
<mat-form-field style="width:30%"> <mat-form-field style="width:30%">
<mat-select placeholder="Is there any asset loan?" formControlName="any_other_asset_loan" (selectionChange)="selectedAssetLoanType($event.value,1)"> <mat-select placeholder="Is there any asset loan?" formControlName="any_other_asset_loan">
<mat-option value="{{data.value}}" *ngFor="let data of m_any_asset_loan_type">{{data.viewValue | titlecase}}</mat-option> <mat-option value="{{data.value}}" *ngFor="let data of m_any_asset_loan_type">{{data.viewValue | titlecase}}</mat-option>
</mat-select> </mat-select>
<!-- <input matInput placeholder="What is the EMI amount ?" formControlName="any_other_asset_loan" autocomplete="off"> -->
</mat-form-field>
<!-- <mat-form-field class="ml-xs example-full-width" *ngIf="detail.get(any_other_asset_loan).value == 'yes'"> -->
<mat-form-field style="width:30%" *ngIf="otherEmiamtFlag">
<!-- <mat-form-field class="ml-xs example-full-width"> -->
<input matInput placeholder="What is the EMI amount ?" formControlName="other_asset_emi_amt" autocomplete="off"(keyup)="inWords($event,s,14)" (keypress)="keyPress($event)">
<mat-hint align="start" style="font-size:70%" *ngIf="detail.get('other_asset_emi_amt').value != ''">{{"&#8377;"}} {{O_emiAmtInwords[s]}} Only</mat-hint>
<!-- <span matSuffix>.00</span> -->
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -530,33 +499,49 @@
<mat-hint align="start" style="font-size:70%" *ngIf="sup.get('approximate_market_value').value != ''">{{"&#8377;"}} {{OtherAppxMarketAmtInwords[i]}} Only</mat-hint> <mat-hint align="start" style="font-size:70%" *ngIf="sup.get('approximate_market_value').value != ''">{{"&#8377;"}} {{OtherAppxMarketAmtInwords[i]}} Only</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5" style="width:30%"> <mat-form-field *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5" style="width:45%">
<mat-select placeholder="Name of the Owner" formControlName="name_of_the_owner" > <!-- <mat-select placeholder="Name of the Owner" formControlName="name_of_the_owner" >
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name | titlecase}}</mat-option> <mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name | titlecase}}</mat-option>
</mat-select> -->
<mat-select placeholder="Name of the Owner"
formControlName="name_of_the_owner" [compareWith]="compareObjects" required>
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
</mat-option>
</mat-optgroup>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="sup.get('name_of_the_owner').value == 0 && sup.get('name_of_the_owner').value != ''" style="width:30%"> <mat-form-field *ngIf="checkOthers(sup.get('name_of_the_owner').value)===true" style="width:45%">
<input matInput placeholder="Specify Owner Name" <input matInput placeholder="Specify Owner Name"
formControlName="other_owner" autocomplete="off"> formControlName="other_owner" autocomplete="off">
</mat-form-field> </mat-form-field>
<!-- check --> <!-- check -->
<mat-form-field *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5" style="width:30%"> <!-- <mat-form-field *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5" style="width:30%">
<mat-select placeholder="Relation" formControlName="relation" > <mat-select placeholder="Relation" formControlName="relation" >
<mat-option value="{{relations.relationship_id}}" <mat-option value="{{relations.relationship_id}}"
*ngFor="let relations of m_relation"> *ngFor="let relations of m_relation">
{{relations.name | titlecase}} {{relations.name | titlecase}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field> -->
</div> </div>
<span *ngIf="sup.get('assets_mode').value != ''"> <span *ngIf="sup.get('assets_mode').value != ''">
<mat-form-field style="width:30%">
<mat-label>Vintage</mat-label>
<input matInput autocomplete="off" placeholder="eg.999" formControlName="vintage_personal" minlength="1" maxlength="3" (keypress)="keyPress($event)" (keyup)="calculateVintagePurchase($event.target.value,i,3)">
<!-- <mat-error> Invalid format</mat-error> -->
</mat-form-field>
<mat-form-field style="width:30%"> <mat-form-field style="width:30%">
<mat-label>Purchase Year</mat-label> <mat-label>Purchase Year</mat-label>
<input matInput autocomplete="off" placeholder="YYYY eg.2018" formControlName="purchase_year" (keypress)="keyPress($event)"> <input matInput autocomplete="off" placeholder="YYYY eg.2018" formControlName="purchase_year" minlength="4" maxlength="4" (keypress)="keyPress($event)" (keyup)="calculateVintagePurchase($event.target.value,i,4)">
<mat-error> Invalid year format</mat-error> <!-- <mat-error> Invalid year format</mat-error> -->
</mat-form-field> </mat-form-field>
</span> </span>
@ -564,29 +549,12 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5" style="width:95%"> <mat-form-field *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5" style="width:95%">
<mat-select placeholder="Is there a loan existing against this asset?" formControlName="emi"> <mat-select placeholder="Is There a Loan Existing Against This Asset?" formControlName="emi">
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="sup.get('emi').value === 'yes'" style="width:95%">
<input matInput placeholder="Amount of EMI on This Loan?" formControlName="emi_paid" (keypress)="keyPress($event)" autocomplete="off" (keyup)="inWords($event,i,4)">
<mat-hint align="start" style="font-size:70%" *ngIf="sup.get('emi_paid').value != ''">{{"&#8377;"}} {{OtherEmiAmtInwords[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field *ngIf="sup.get('emi').value === 'yes'" style="width:30%">
<input matInput placeholder="Original Loan Tenure in Months" formControlName="original_loan_tenure" (change)="loanTenureCalc(sup,1)" (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field>
<mat-form-field *ngIf="sup.get('emi').value === 'yes'" style="width:30%">
<input matInput placeholder="Balance Tenure in Months" formControlName="balance_tenure" (change)="loanTenureCalc(sup,1)"(keypress)="keyPress($event)" autocomplete="off">
</mat-form-field>
<mat-form-field *ngIf="sup.get('emi').value === 'yes' && sup.get('original_loan_tenure').value != '' && sup.get('balance_tenure').value != '' " style="width:30%">
<input matInput placeholder="Elapsed Tenure in Months" formControlName="elapsed_tenure" autocomplete="off" readonly>
</mat-form-field>
</div> </div>
</div> </div>
<div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none">

View File

@ -37,7 +37,7 @@ export class AssetsInfoComponent implements OnInit {
public _assetsQuesFrom: FormGroup; public _assetsQuesFrom: FormGroup;
public submitted = false; public submitted = false;
public m_assets_type = []; public m_assets_type = [];
public m_relation = []; //public m_relation = [];
public applicants: any; public applicants: any;
otherEmiamtFlag : boolean = false; otherEmiamtFlag : boolean = false;
businessEmiAmtFlag : boolean = false; businessEmiAmtFlag : boolean = false;
@ -186,7 +186,7 @@ public m_investmentType = [];
private notifier: NotifierService; private notifier: NotifierService;
existCompanyList: any =[]; existCompanyList: any =[];
mergeCompanyApplicant: any=[]; mergeCompanyApplicant: any=[];
currentYear:any=new Date().getFullYear();
constructor( constructor(
notifier: NotifierService, notifier: NotifierService,
private _formBuilder: FormBuilder, private _formBuilder: FormBuilder,
@ -252,7 +252,7 @@ public m_investmentType = [];
this.getM_PropertyType(); this.getM_PropertyType();
this.getM_InvestmentType(); this.getM_InvestmentType();
this.getM_FreqOfPurchase(); this.getM_FreqOfPurchase();
this.getM_Relation(); //this.getM_Relation();
//this.getM_InsuranceType(); //this.getM_InsuranceType();
} }
@ -295,16 +295,16 @@ public m_investmentType = [];
) )
} }
getM_Relation() { // getM_Relation() {
this.pdTrigerService.getAllMasterDatas('RELATIONSHIPS').subscribe( // this.pdTrigerService.getAllMasterDatas('RELATIONSHIPS').subscribe(
data => { // data => {
this.m_relation = data.records.filter(data => data.isactive == 1); // this.m_relation = data.records.filter(data => data.isactive == 1);
}, // },
error => { // error => {
this.notifier.notify('warning', 'No Category Records Found.!'); // this.notifier.notify('warning', 'No Category Records Found.!');
} // }
) // )
} // }
getM_FreqOfPurchase() { getM_FreqOfPurchase() {
this.pdTrigerService.getAllMasterDatas('FREQUENCY').subscribe( this.pdTrigerService.getAllMasterDatas('FREQUENCY').subscribe(
@ -395,14 +395,11 @@ public m_investmentType = [];
approximate_market_value: [''], approximate_market_value: [''],
name_of_the_owner: [''], name_of_the_owner: [''],
other_owner:[''], other_owner:[''],
relation: [''], // relation: [''],
purchase_year: ['',Validators.compose([Validators.minLength(4),Validators.maxLength(4)])], vintage_personal : [''],
purchase_year: ['',Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
//purchase_month: [''], //purchase_month: [''],
emi: [''], emi: [''],
emi_paid: [''],
original_loan_tenure: [''],
balance_tenure: [''],
elapsed_tenure: [''],
}); });
} }
@ -415,13 +412,10 @@ public m_investmentType = [];
business_name_of_the_other_owner: [], business_name_of_the_other_owner: [],
//other_owner:[''], //other_owner:[''],
//relation:[''], //relation:[''],
business_purchase_year: ['',Validators.compose([Validators.minLength(4),Validators.maxLength(4)])], business_vintage: [''],
business_purchase_year: ['',Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
//purchase_month: [''], //purchase_month: [''],
business_emi: [''], business_emi: [''],
business_emi_paid: [''],
business_original_loan_tenure: [''],
business_balance_tenure: [''],
business_elapsed_tenure: [''],
}); });
} }
@ -523,10 +517,9 @@ public m_investmentType = [];
any_other_assets: [''], any_other_assets: [''],
name_of_the_owner:[''], name_of_the_owner:[''],
other_owner:[''], other_owner:[''],
relation:[''], //relation:[''],
any_other_asset_value : [''], any_other_asset_value : [''],
any_other_asset_loan : [''], any_other_asset_loan : [''],
other_asset_emi_amt : ['']
}); });
} }
@ -536,8 +529,6 @@ public m_investmentType = [];
any_other_assets: [''], any_other_assets: [''],
any_other_asset_value : [''], any_other_asset_value : [''],
any_other_asset_loan : [''], any_other_asset_loan : [''],
other_asset_emi_amt : ['']
}); });
} }
@ -598,10 +589,9 @@ public m_investmentType = [];
any_other_assets: [data.any_other_assets], any_other_assets: [data.any_other_assets],
name_of_the_owner:[data.name_of_the_owner], name_of_the_owner:[data.name_of_the_owner],
other_owner:[data.other_owner], other_owner:[data.other_owner],
relation:[data.relation], // relation:[data.relation],
any_other_asset_value : [data.any_other_asset_value], any_other_asset_value : [data.any_other_asset_value],
any_other_asset_loan : [data.any_other_asset_loan], any_other_asset_loan : [data.any_other_asset_loan],
other_asset_emi_amt : [data.other_asset_emi_amt]
}); });
} }
@ -610,7 +600,6 @@ public m_investmentType = [];
any_other_assets: [data.any_other_assets], any_other_assets: [data.any_other_assets],
any_other_asset_value : [data.any_other_asset_value], any_other_asset_value : [data.any_other_asset_value],
any_other_asset_loan : [data.any_other_asset_loan], any_other_asset_loan : [data.any_other_asset_loan],
other_asset_emi_amt : [data.other_asset_emi_amt]
}); });
} }
@ -657,34 +646,29 @@ public m_investmentType = [];
approximate_market_value: [data.approximate_market_value], approximate_market_value: [data.approximate_market_value],
name_of_the_owner: [data.name_of_the_owner], name_of_the_owner: [data.name_of_the_owner],
other_owner:[data.other_owner || ''], other_owner:[data.other_owner || ''],
relation: [data.relation || ''], //relation: [data.relation || ''],
purchase_year: [data.purchase_year], vintage_personal : [data. vintage_personal],
purchase_year: [data. purchase_year,Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
// purchase_month: [data.purchase_month], // purchase_month: [data.purchase_month],
emi: [data.emi || 0], emi: [data.emi || 0],
emi_paid: [data.emi_paid || ''],
original_loan_tenure: [data.original_loan_tenure || ''],
balance_tenure: [data.balance_tenure || ''],
elapsed_tenure: [data.elapsed_tenure || '']
}); });
} }
initBusinessDetailsWithdata(data) { initBusinessDetailsWithdata(data) {
return this._formBuilder.group({ let formGroup= this._formBuilder.group({
business_assets_mode: [data.business_assets_mode], business_assets_mode: [data.business_assets_mode],
business_details: this._formBuilder.array([]), business_details: this._formBuilder.array([]),
business_approximate_market_value: [data.business_approximate_market_value], business_approximate_market_value: [data.business_approximate_market_value],
business_name_of_the_owner: [data.business_name_of_the_owner], business_name_of_the_owner: [data.business_name_of_the_owner],
business_name_of_the_other_owner:[data.business_name_of_the_other_owner || ''], business_name_of_the_other_owner:[data.business_name_of_the_other_owner || ''],
// relation: [data.relation || ''], // relation: [data.relation || ''],
business_purchase_year: [data. business_purchase_year], business_vintage: [data. business_vintage],
business_purchase_year: [data. business_purchase_year,Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
// purchase_month: [data.purchase_month], // purchase_month: [data.purchase_month],
business_emi: [data.business_emi || 0], business_emi: [data.business_emi || 0],
business_emi_paid: [data.business_emi_paid || ''],
business_original_loan_tenure: [data.business_original_loan_tenure || ''],
business_balance_tenure: [data.business_balance_tenure || ''],
business_elapsed_tenure: [data.business_elapsed_tenure || '']
}); });
return formGroup;
} }
loadDetails: boolean; loadDetails: boolean;
@ -695,7 +679,6 @@ public m_investmentType = [];
result.forEach((datas,index) => { result.forEach((datas,index) => {
this.OtherAppxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.approximate_market_value); this.OtherAppxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.approximate_market_value);
this.OtherEmiAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.emi_paid);
}); });
if (result.length > 0) { if (result.length > 0) {
@ -705,14 +688,11 @@ public m_investmentType = [];
approximate_market_value: val.approximate_market_value, approximate_market_value: val.approximate_market_value,
name_of_the_owner: val.name_of_the_owner, name_of_the_owner: val.name_of_the_owner,
other_owner:val.other_owner, other_owner:val.other_owner,
relation: val.relation, // relation: val.relation,
vintage_personal: val.vintage_personal,
purchase_year: val.purchase_year, purchase_year: val.purchase_year,
// purchase_month: val.purchase_month, // purchase_month: val.purchase_month,
emi: val.emi, emi: val.emi,
emi_paid: val.emi_paid,
original_loan_tenure: val.original_loan_tenure,
elapsed_tenure: val.elapsed_tenure,
balance_tenure: val.balance_tenure
}; };
const control = <FormArray>this._assetsQuesFrom.controls['assets_details']; const control = <FormArray>this._assetsQuesFrom.controls['assets_details'];
control.push(this.initDetailsWithdata(vals)); control.push(this.initDetailsWithdata(vals));
@ -731,7 +711,6 @@ public m_investmentType = [];
if (result.length > 0) { if (result.length > 0) {
result.forEach((datas,index) => { result.forEach((datas,index) => {
this.appxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.business_approximate_market_value); this.appxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.business_approximate_market_value);
this.emiAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.business_emi_paid);
}); });
for (let val of result) { for (let val of result) {
@ -742,12 +721,9 @@ public m_investmentType = [];
business_name_of_the_other_owner: val.business_name_of_the_other_owner, business_name_of_the_other_owner: val.business_name_of_the_other_owner,
// relation : val.relation, // relation : val.relation,
business_purchase_year: val. business_purchase_year, business_purchase_year: val. business_purchase_year,
business_vintage : val.business_vintage,
// purchase_month: val.purchase_month, // purchase_month: val.purchase_month,
business_emi: val.business_emi, business_emi: val.business_emi,
business_emi_paid: val.business_emi_paid,
business_original_loan_tenure: val.business_original_loan_tenure,
business_elapsed_tenure: val.business_elapsed_tenure,
business_balance_tenure: val.business_balance_tenure
}; };
const control = <FormArray>this._assetsQuesFrom.controls['business_assets_details']; const control = <FormArray>this._assetsQuesFrom.controls['business_assets_details'];
@ -847,13 +823,11 @@ public m_investmentType = [];
array_data = { 'any_other_assets': datas.any_other_assets, array_data = { 'any_other_assets': datas.any_other_assets,
'name_of_the_owner':datas.name_of_the_owner, 'name_of_the_owner':datas.name_of_the_owner,
'other_owner':datas.other_owner, 'other_owner':datas.other_owner,
'relation':datas.relation, //'relation':datas.relation,
'any_other_asset_value' : datas.any_other_asset_value, 'any_other_asset_value' : datas.any_other_asset_value,
'any_other_asset_loan' : datas.any_other_asset_loan, 'any_other_asset_loan' : datas.any_other_asset_loan,
'other_asset_emi_amt' : datas.other_asset_emi_amt
}; };
this.OtherAssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.any_other_asset_value); this.OtherAssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.any_other_asset_value);
this.O_emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.other_asset_emi_amt);
}); });
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.otherAssetsDescriptionWithData(array_data)); control.push(this.otherAssetsDescriptionWithData(array_data));
@ -947,12 +921,10 @@ public m_investmentType = [];
let array_datas : any; let array_datas : any;
data.forEach((datas,i) => { data.forEach((datas,i) => {
this.AssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(+data.any_other_asset_value); this.AssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(+data.any_other_asset_value);
this.B_emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.other_asset_emi_amt);
array_datas = { array_datas = {
'any_other_assets': datas.any_other_assets, 'any_other_assets': datas.any_other_assets,
'any_other_asset_value' : datas.any_other_asset_value, 'any_other_asset_value' : datas.any_other_asset_value,
'any_other_asset_loan' : datas.any_other_asset_loan, 'any_other_asset_loan' : datas.any_other_asset_loan,
'other_asset_emi_amt' : datas.other_asset_emi_amt
}; };
}); });
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ; const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
@ -997,19 +969,6 @@ public m_investmentType = [];
selectedFreqPurchase(e) { selectedFreqPurchase(e) {
this.freqPurchaseTextBox = e.value; this.freqPurchaseTextBox = e.value;
} }
/** Show/hide EMI amount Field using Flag Both "other Asset" and "business"
* REF = "Other Asset type at last Field"
**/
selectedAssetLoanType(e: any,flag): void {
if(flag == 1){
this.otherEmiamtFlag = (e == 'yes') ? true : false;
}
else if(flag == 2){
this.businessEmiAmtFlag = (e == 'yes') ? true : false;
}
}
// compare objects for merge two master table details // compare objects for merge two master table details
compareObjects(o1: any, o2: any) { compareObjects(o1: any, o2: any) {
if(o1.id == o2.id && o1.group_id == o2.group_id) if(o1.id == o2.id && o1.group_id == o2.group_id)
@ -1028,6 +987,29 @@ public m_investmentType = [];
} }
// calculate vintage and purchase {}
calculateVintagePurchase(value: any, controlKey: any,type: number){
if(type==1){
let control: any = <FormArray>this._assetsQuesFrom.controls['business_assets_details'];
control.controls[controlKey].controls['business_purchase_year'].setValue(value!='' ? parseInt(this.currentYear)-parseInt(value) : '');
}
else if(type==2) {
let control: any = <FormArray>this._assetsQuesFrom.controls['business_assets_details'];
value!='' && value<=this.currentYear ? control.controls[controlKey].controls['business_purchase_year'].setValue(value) : control.controls[controlKey].controls['business_purchase_year'].setValue('');
value!='' && value<=this.currentYear ? control.controls[controlKey].controls['business_vintage'].setValue(parseInt(this.currentYear)-parseInt(value)) : control.controls[controlKey].controls['business_vintage'].setValue('')
}
else if(type==3){
let control: any = <FormArray>this._assetsQuesFrom.controls['assets_details'];
control.controls[controlKey].controls['purchase_year'].setValue(value!='' ? parseInt(this.currentYear)-parseInt(value) : '');
}
else if(type==4) {
let control: any = <FormArray>this._assetsQuesFrom.controls['assets_details'];
value!='' && value<=this.currentYear ? control.controls[controlKey].controls['purchase_year'].setValue(value) : control.controls[controlKey].controls['purchase_year'].setValue('');
value!='' && value<=this.currentYear ? control.controls[controlKey].controls['vintage_personal'].setValue(parseInt(this.currentYear)-parseInt(value)) : control.controls[controlKey].controls['vintage_personal'].setValue('')
}
}
/** To Save/Edited Popup Data */ /** To Save/Edited Popup Data */
onSubmit() { onSubmit() {
this.submitted = true; this.submitted = true;
@ -1040,24 +1022,6 @@ public m_investmentType = [];
//To Remove The "Null" With Key also //To Remove The "Null" With Key also
Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]); Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
answerFormValues.assets_details.map(val => {
if (val.emi == '0') {
val.emi_paid = '';
val.original_loan_tenure = '';
val.balance_tenure = '';
val.elapsed_tenure = '';
}
});
//To Remove The "Null" With Key also
answerFormValues.business_assets_details.map(val => {
if (val.business_emi == '0') {
val.business_emi_paid = '';
val.business_original_loan_tenure = '';
val.business_balance_tenure = '';
val.business_elapsed_tenure = '';
}
});
// Save the data with help of Service // Save the data with help of Service
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe( this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
dataresult => { dataresult => {