This commit is contained in:
venbatechnologies@gmail.com 2019-01-11 15:01:24 +05:30
commit 8543eb5bf9
7 changed files with 305 additions and 228 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>
@ -238,40 +220,29 @@
<span *ngIf="sup.get('business_assets_mode').value != ''"> <span *ngIf="sup.get('business_assets_mode').value != ''">
<mat-form-field style="width:30%"> <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-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>
<span *ngIf="sup.get('business_assets_mode').value == 1 || sup.get('business_assets_mode').value == 2 || sup.get('business_assets_mode').value == 3 || sup.get('business_assets_mode').value == 4 || sup.get('business_assets_mode').value == 5"> <span *ngIf="sup.get('business_assets_mode').value == 1 || sup.get('business_assets_mode').value == 2 || sup.get('business_assets_mode').value == 3 || sup.get('business_assets_mode').value == 4 || sup.get('business_assets_mode').value == 5">
<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> -->
<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-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,63 +499,62 @@
<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> -->
<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-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-form-field style="width:30%">
<mat-label>Purchase Year</mat-label>
<input matInput autocomplete="off" placeholder="YYYY eg.2018" formControlName="purchase_year" (keypress)="keyPress($event)"> <mat-label>Vintage</mat-label>
<mat-error> Invalid year format</mat-error> <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>
<mat-form-field style="width:30%">
<mat-label>Purchase Year</mat-label>
<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-form-field>
</span> </span>
<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 : ['']
}); });
} }
@ -535,9 +528,7 @@ public m_investmentType = [];
return this._formBuilder.group({ return this._formBuilder.group({
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 => {

View File

@ -90,17 +90,26 @@
<mat-expansion-panel class="banlFields" [expanded]="step == i"> <mat-expansion-panel class="banlFields" [expanded]="step == i">
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title> <mat-panel-title>
<p>{{i+1}} , Banking Details <p>Banking Details #{{i+1}}
</p> </p>
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Account Name" formControlName="applicant_name" (selectionChange)="selectedBorrower($event.value,i)"> <mat-select placeholder="Account Name" formControlName="applicant_name" [compareWith]="compareObjects">
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option> <mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
</mat-select> <mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
</mat-option>
</mat-optgroup>
</mat-select>
</mat-form-field> </mat-form-field>
<!-- <mat-form-field *ngIf="itemrow.get('applicant_name').value == 0"> --> <!-- <mat-select placeholder="Account Name" formControlName="applicant_name" (selectionChange)="selectedBorrower($event.value,i)">
<mat-form-field *ngIf="this.OtherFlag[i]"> <mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
</mat-select> --
!-- <mat-form-field *ngIf="itemrow.get('applicant_name').value == 0"> --
!-- <mat-form-field *ngIf="this.OtherFlag[i]"> -->
<mat-form-field *ngIf="checkOthers(itemrow.get('applicant_name').value)===true" style="width:45%">
<input matInput placeholder="Specify Applicant Name" formControlName="other_applicant" autocomplete="off"> <input matInput placeholder="Specify Applicant Name" formControlName="other_applicant" autocomplete="off">
</mat-form-field> </mat-form-field>

View File

@ -42,6 +42,9 @@ export class BankingDetailsComponent implements OnInit {
limitCaseFlag : any = []; limitCaseFlag : any = [];
amtInwords : any = []; amtInwords : any = [];
emiAmtInwords : any = []; emiAmtInwords : any = [];
existCompanyList: any =[];
mergeCompanyApplicant: any=[];
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router, private router: Router,
@ -79,6 +82,30 @@ export class BankingDetailsComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.step = 0; this.step = 0;
this.initBankingForm(); this.initBankingForm();
this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{
if(data.dataStatus){
this.existCompanyList = data.records.filter(val =>val.is_active);
}
let modifyCompanyList : any=[];
if(this.existCompanyList.length>0){
modifyCompanyList = this.existCompanyList.map(element => {
return {id:element.company_order_id.toString(),name:element.company_name,group_id:1};
});
this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList})
}
let modifyApplicantList: any=[];
if(this.applicants.length > 0){
modifyApplicantList = this.applicants.map(element => {
return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2};
});
this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList})
}
})
this.getM_AccountType(); this.getM_AccountType();
this.getM_BTLenderList(); this.getM_BTLenderList();
@ -89,6 +116,7 @@ export class BankingDetailsComponent implements OnInit {
// // console.log(this.pd_cus_segment); // // console.log(this.pd_cus_segment);
// this.pd_cus_segment = this.pd_cus_segment.substring(0,3); // this.pd_cus_segment = this.pd_cus_segment.substring(0,3);
// this.applicants = this.pd_all_details.pdapplicants_detials; // this.applicants = this.pd_all_details.pdapplicants_detials;
let params: any = {}; let params: any = {};
params.pd_id = this.pdid; params.pd_id = this.pdid;
params.pd_form_id = '7'; params.pd_form_id = '7';
@ -105,7 +133,7 @@ export class BankingDetailsComponent implements OnInit {
} else { } else {
result.forEach((datas,index) => { result.forEach((datas,index) => {
this.amtInwords[index] = this._pd.convertNumberToWords(+datas.limit); this.amtInwords[index] = this._pd.convertNumberToWords(+datas.limit);
this.selectedBorrower(datas.applicant_name,index); // this.selectedBorrower(datas.applicant_name,index);
this.selectedAccTypeChanges(+datas.account_type,index) this.selectedAccTypeChanges(+datas.account_type,index)
// this.emiAmtInwords[index] = this._pd.convertNumberToWords(val.emi); // this.emiAmtInwords[index] = this._pd.convertNumberToWords(val.emi);
@ -216,14 +244,34 @@ export class BankingDetailsComponent implements OnInit {
}); });
} }
selectedBorrower(e,i){ // selectedBorrower(e,i){
if(e == 0){ // if(e == 0){
this.OtherFlag[i] = true; // this.OtherFlag[i] = true;
} // }
else{ // else{
this.OtherFlag[i] = false; // this.OtherFlag[i] = false;
} // }
// }
// compare objects for merge two master table details
compareObjects(o1: any, o2: any) {
if(o1.id == o2.id && o1.group_id == o2.group_id)
return true;
else return false
}
// check others
checkOthers(values){
if(values!=null) {
return values.id==0 ? true : false;
} }
else {
return false;
}
}
selectedAccTypeChanges(event: any,i){ selectedAccTypeChanges(event: any,i){

View File

@ -42,16 +42,17 @@
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('loan_amount').value != ''">{{"&#8377;"}} {{amtInwords[i]}} Only</mat-hint> <mat-hint align="start" style="font-size:70%" *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 (selectionChange)="selectedfrequency($event.value,i)" placeholder="Frequency" <mat-select placeholder="Frequency" (selectionChange)="selectedfrequency($event.value,i)"
formControlName="frequency" > formControlName="frequency" >
<mat-option *ngFor="let freq of frequencyData" value="{{freq.frequency_id}}">{{freq.name}}</mat-option> <mat-option *ngFor="let freq of frequencyData" value="{{freq.frequency_id}}">{{freq.name}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="details.get('frequency').value == 8"> <mat-form-field *ngIf="details.get('frequency').value == 7">
<input matInput autocomplete="off" placeholder="Specify Frequency" formControlName="other_frequency"> <input matInput autocomplete="off" placeholder="Specify Frequency" formControlName="other_frequency">
</mat-form-field> </mat-form-field>
<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)"> -->
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('emi').value != ''">{{"&#8377;"}} {{emiAmtInwords[i]}} Only</mat-hint> <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>
@ -64,14 +65,21 @@
<input matInput autocomplete="off" placeholder="Specify Loan Type" formControlName="others_loan_type"> <input matInput autocomplete="off" placeholder="Specify Loan Type" formControlName="others_loan_type">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Loan Taken By" formControlName="loan_taken_by" (selectionChange)="selectedBorrower($event.value,i)"> <!-- <mat-select placeholder="Loan Taken By" formControlName="loan_taken_by" (selectionChange)="selectedBorrower($event.value,i)">
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option> <mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
<!-- <mat-option value= 0 >Others</mat-option> --> <!-- <mat-option value= 0 >Others</mat-option> ->
</mat-select> </mat-select> -->
<mat-select placeholder="Loan Taken By" formControlName="loan_taken_by" [compareWith]="compareObjects">
<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-form-field> </mat-form-field>
<!-- {{details.get('loan_taken_by').value}} --> <!-- {{details.get('loan_taken_by').value}} -->
<!-- <mat-form-field *ngIf="details.get('loan_taken_by').value == 0"> --> <!-- <mat-form-field *ngIf="details.get('loan_taken_by').value == 0"> -->
<mat-form-field *ngIf="this.OtherFlag[i]"> <mat-form-field *ngIf="checkOthers(details.get('loan_taken_by').value)===true" style="width:45%">
<input matInput autocomplete="off" placeholder="Specify Borrower" formControlName="others_loan_taken"> <input matInput autocomplete="off" placeholder="Specify Borrower" formControlName="others_loan_taken">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
@ -87,10 +95,12 @@
</mat-form-field> --> </mat-form-field> -->
<div style="width:100%"> <div style="width:100%">
<mat-form-field style="width:35%"> <mat-form-field style="width:35%">
<input matInput autocomplete="off" placeholder="Original Tenure in Months" formControlName="original_tenure" > <input matInput autocomplete="off" placeholder="Original Tenure in Months" formControlName="original_tenure" (change)="checkTenure(details)">
</mat-form-field> </mat-form-field>
<mat-form-field style="width:35%"> <mat-form-field style="width:35%">
<input matInput autocomplete="off" placeholder="Current Balance Tenure in Months" formControlName="current_balance_tenure" > <input matInput autocomplete="off" placeholder="Current Balance Tenure in Months" formControlName="current_balance_tenure">
<mat-error>Invalid Balance Tenure.</mat-error>
<!-- //*ngIf="current_balance_tenure.hasError('min')" class="mat-text-warn" -->
</mat-form-field> </mat-form-field>
</div> </div>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Add More Loan Details" matTooltipPosition="above" color="primary" (click)="addLoanDetails()" <button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Add More Loan Details" matTooltipPosition="above" color="primary" (click)="addLoanDetails()"

View File

@ -22,19 +22,24 @@
color: #fff !important; color: #fff !important;
background-color: #e00201 !important; background-color: #e00201 !important;
} }
.my-mat-hint {
line-height: 1.2em;
transform: translateY(10px);
font-size: 75%;
}
.mat-card-content { .mat-card-content {
background-color: white; background-color: white;
} }
.mat-card-actions { .mat-card-actions {
background-color: white; background-color: white;
} }
::ng-deep .cdk-global-overlay-wrapper{ ::ng-deep .cdk-global-overlay-wrapper{
justify-content: center !important; justify-content: center !important;
} }
mat-form-field { mat-form-field {
margin: 0 2%; margin: 0 2%;
} }
$base-card-box-shadow:1.5px 2.6px 24px 0 rgba(0, 35, 136, 0.08) !important; $base-card-box-shadow:1.5px 2.6px 24px 0 rgba(0, 35, 136, 0.08) !important;
$product-bg-color-hover: rgba(103, 58, 183, 0.7); $product-bg-color-hover: rgba(103, 58, 183, 0.7);
.p-list-main { .p-list-main {
background: white; background: white;

View File

@ -47,6 +47,9 @@ export class CurrentLoanComponent implements OnInit {
OtherFlag : any = []; OtherFlag : any = [];
amtInwords : any = []; amtInwords : any = [];
emiAmtInwords : any = []; emiAmtInwords : any = [];
existCompanyList: any =[];
mergeCompanyApplicant: any=[];
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router, private router: Router,
@ -83,6 +86,30 @@ export class CurrentLoanComponent implements OnInit {
this.getMasterDetails('FREQUENCY',2); this.getMasterDetails('FREQUENCY',2);
this.getMasterDetails('EXISTINGLOANTYPES',3); this.getMasterDetails('EXISTINGLOANTYPES',3);
this.initCurrentloanForm(); this.initCurrentloanForm();
this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{
if(data.dataStatus){
this.existCompanyList = data.records.filter(val =>val.is_active);
}
let modifyCompanyList : any=[];
if(this.existCompanyList.length>0){
modifyCompanyList = this.existCompanyList.map(element => {
return {id:element.company_order_id.toString(),name:element.company_name,group_id:1};
});
this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList})
}
let modifyApplicantList: any=[];
if(this.applicants.length > 0){
modifyApplicantList = this.applicants.map(element => {
return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2};
});
this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList})
}
})
let params: any = {}; let params: any = {};
params.pd_id = this.pdid; params.pd_id = this.pdid;
params.pd_form_id = this.form_id; params.pd_form_id = this.form_id;
@ -118,6 +145,33 @@ export class CurrentLoanComponent implements OnInit {
} }
}) })
} }
checkTenure(details){
let originalTenure = details.value.original_tenure;
// alert(originalTenure);
details.controls.current_balance_tenure.setValidators([Validators.required, Validators.max(+originalTenure)]);
details.controls.current_balance_tenure.updateValueAndValidity();
// details.controls.current_balance_tenure.setValidators([Validators.max(+originalTenure)]);
// details.controls.current_balance_tenure.updateValueAndValidity();
// let BalanceTenure = details.value.current_balance_tenure;
// if( originalTenure < BalanceTenure){
// alert('Greater');
// details.controls.current_balance_tenure.setValue('');
// alert('validation setted For');
// details.controls.current_balance_tenure.setValidators([Validators.min(+originalTenure)]);
// details.controls.current_balance_tenure.updateValueAndValidity();
// }
}
// validateNumber(input: AbstractControl) {
// const wordControl = input.get("word");
// if(wordControl.value != null && wordControl.value.length > 4) {
// wordControl.setValidators([Validators.required, Validators.minLength(8)]);
// wordControl.updateValueAndValidity();
// }
// }
public initCurrentloanForm(): void { public initCurrentloanForm(): void {
this.currentLoanForm = this.fb.group({ this.currentLoanForm = this.fb.group({
existing_loan: [''], existing_loan: [''],
@ -138,26 +192,25 @@ export class CurrentLoanComponent implements OnInit {
arr.removeAt(0); arr.removeAt(0);
} }
} }
selectedBorrower(e,i){ // selectedBorrower(e,i){
if(e == 0){ // if(e == 0){
this.OtherFlag[i] = true; // this.OtherFlag[i] = true;
} // }
else{ // else{
this.OtherFlag[i] = false; // this.OtherFlag[i] = false;
} // }
} // }
selectedfrequency(e,i){ selectedfrequency(e,i){
switch(+e){ switch(+e){
case 1: this.placeholderName[i] = 'Weekly Instalment Amount'; break; case 1: this.placeholderName[i] = 'Monthly Instalment Amount'; break;
case 2: this.placeholderName[i] = 'Daily Instalment Amount'; break; case 2: this.placeholderName[i] = 'Annual Instalment Amount'; break;
case 3: this.placeholderName[i] = 'Annual Instalment Amount'; break; case 3: this.placeholderName[i] = 'Halfyearly Instalment Amount'; break;
case 4: this.placeholderName[i] = 'Hourly Instalment Amount'; break; case 4: this.placeholderName[i] = 'Fortnightly Instalment Amount'; break;
case 5: this.placeholderName[i] = 'EMI Amount'; break; case 5: this.placeholderName[i] = 'Daily Instalment Amount'; break;
case 6: this.placeholderName[i] = 'Quarterly Instalment Amount'; break; case 6: this.placeholderName[i] = 'Quarterly Instalment Amount'; break;
case 7: this.placeholderName[i] = 'Halfyearly Instalment Amount'; break; default: this.placeholderName[i] = 'Instalment Amount'; break;
default : this.placeholderName[i] = ''; break;
} }
} }
@ -177,6 +230,26 @@ export class CurrentLoanComponent implements OnInit {
current_balance_tenure: [''], current_balance_tenure: [''],
}); });
} }
// compare objects for merge two master table details
compareObjects(o1: any, o2: any) {
if(o1.id == o2.id && o1.group_id == o2.group_id)
return true;
else return false
}
// check others
checkOthers(values){
if(values!=null) {
return values.id==0 ? true : false;
}
else {
return false;
}
}
addLoanDetails() { addLoanDetails() {
const control = <FormArray>this.currentLoanForm.controls['loan_details']; const control = <FormArray>this.currentLoanForm.controls['loan_details'];
control.push(this.createLoanDetail()); control.push(this.createLoanDetail());