assest form changes

This commit is contained in:
gandhimathi 2019-01-24 10:59:32 +05:30
parent 1e2c1f4b0c
commit d377a86f14
3 changed files with 60 additions and 91 deletions

View File

@ -28,23 +28,23 @@
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width:100%">
<mat-select (selectionChange)="selectedAssetsType($event,i,1)" placeholder="Assets Type" formControlName="assets_mode" requried>
<mat-option *ngFor="let asset of m_assets_type" [value]="asset.id">{{ asset.name | titlecase }}</mat-option>
<mat-option *ngFor="let asset of m_assets_type" [value]="asset.id">{{ asset.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<!--Desction Dynamic details: START-->
<div formArrayName="details" class="example-full-width">
<!--Property-->
<div *ngIf="sup.get('assets_mode').value == 1 ">
<div *ngIf="sup.get('assets_mode').value == 2 ">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:40%">
<mat-select placeholder="Property Type" formControlName="property_type" >
<mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{ prop.name | titlecase }}</mat-option>
<mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{ prop.name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="detail.get('property_type').value == 5" style="width:40%">
<mat-form-field *ngIf="detail.get('property_type').value == 1" style="width:40%">
<input matInput placeholder="Other Property Type" formControlName="other_property_type" autocomplete="off">
</mat-form-field>
</div>
@ -52,7 +52,7 @@
</div>
</div>
<!--Four Wheeler-->
<div *ngIf="sup.get('assets_mode').value == 2">
<div *ngIf="sup.get('assets_mode').value == 3">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
@ -67,7 +67,7 @@
</div>
<!-- Eqipment Manufacturing -->
<div *ngIf="sup.get('assets_mode').value == 3">
<div *ngIf="sup.get('assets_mode').value == 4">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
@ -85,7 +85,7 @@
</div>
</div>
<!--jwell details -->
<!--<div *ngIf="sup.get('assets_mode').value == 4">
<!--<div *ngIf="sup.get('assets_mode').value == 5">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
@ -99,7 +99,7 @@
</div>
</div>-->
<!--Consumer Durable-->
<div *ngIf="sup.get('assets_mode').value == 5">
<!-- <div *ngIf="sup.get('assets_mode').value == 6">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
@ -109,7 +109,7 @@
</div>
</div>
</div>
</div>
</div> -->
<!--Insurance-->
<div *ngIf="sup.get('assets_mode').value == 6">
@ -122,10 +122,10 @@
</mat-form-field>
<mat-form-field style="width:40%">
<mat-select placeholder="Frequency" formControlName="frequency_mode" >
<mat-option *ngFor="let freqn of m_freqOfPurchase" [value]="freqn.frequency_id">{{ freqn.name | titlecase }}</mat-option>
<mat-option *ngFor="let freqn of m_freqOfPurchase" [value]="freqn.frequency_id">{{ freqn.name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:40%" *ngIf="detail.get('frequency_mode').value == 8 ">
<mat-form-field style="width:40%" *ngIf="detail.get('frequency_mode').value == 1 ">
<input matInput placeholder="Specify Frequency" formControlName="other_frequency_mode" autocomplete="off">
</mat-form-field>
</div>
@ -154,16 +154,16 @@
<mat-form-field style="width:40%">
<mat-select placeholder="Type" formControlName="investments_type" >
<mat-option *ngFor="let ins_type of m_investmentType" [value]="ins_type.id">{{ ins_type.name | titlecase }}</mat-option>
<mat-option *ngFor="let ins_type of m_investmentType" [value]="ins_type.id">{{ ins_type.name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:40%" *ngIf="detail.get('investments_type').value == 6">
<mat-form-field style="width:40%" *ngIf="detail.get('investments_type').value == 1">
<input matInput placeholder="Specify Type" formControlName="other_investments_type" autocomplete="off">
</mat-form-field>
<mat-form-field style="width:40%">
<input matInput placeholder="Amount of Investment" formControlName="amount_of_invest" (keypress)="keyPress($event)" autocomplete="off" (keyup)="inWords($event,i,10)">
<input matInput placeholder="Current Market Value" formControlName="amount_of_invest" (keypress)="keyPress($event)" autocomplete="off" (keyup)="inWords($event,i,10)">
<!--<mat-hint align="start" style="font-size:90%" *ngIf="sup.get('amount_of_invest').value != ''">{{"&#8377;"}} {{OtherAmtInvestInwords[i]}} Only</mat-hint>-->
@ -182,7 +182,7 @@
</div>
<!--other assets-->
<div *ngIf="sup.get('assets_mode').value == 8">
<div *ngIf="sup.get('assets_mode').value == 1">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
@ -192,27 +192,7 @@
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:45%">
<!-- <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-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 *ngIf="checkOthers(sup.get('name_of_the_owner').value)===true" style="width:45%">
<input matInput placeholder="Specify Owner Name"
formControlName="other_owner" autocomplete="off">
</mat-form-field>
<!-- <mat-form-field style="width:40%">
<mat-select placeholder="Relation" formControlName="relation" >
<mat-option value="{{relations.relationship_id}}"
@ -232,7 +212,7 @@
<mat-form-field style="width:40%">
<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}}</mat-option>
</mat-select>
</mat-form-field>
</div>
@ -242,12 +222,12 @@
</div>
<!--Desction Dynamic details : END -->
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 4" style="width:40%">
<mat-form-field *ngIf="sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 5" style="width:40%">
<input matInput placeholder="Approximate Market Value" formControlName="approximate_market_value" (keypress)="keyPress($event)" autocomplete="off" (keyup)="inWords($event,i,2)">
<mat-hint align="start" style="font-size:90%" *ngIf="sup.get('approximate_market_value').value != ''">{{"&#8377;"}} {{OtherAppxMarketAmtInwords[i]}} Only</mat-hint>
</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:45%">
<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 || sup.get('assets_mode').value == 6" style="width:45%">
<!-- <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-select> -->
@ -276,7 +256,7 @@
</mat-form-field> -->
</div>
<span *ngIf="sup.get('assets_mode').value != ''">
<span *ngIf="sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 1">
<mat-form-field style="width:40%">
@ -296,7 +276,7 @@
<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 == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5 || sup.get('assets_mode').value == 6 || sup.get('assets_mode').value == 7" style="width:95%">
<mat-select placeholder="Is There a Loan Existing Against This Asset?" formControlName="emi">
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
@ -317,7 +297,7 @@
<mat-card-actions>
<div align="center">
<button type="button" mat-flat-button (click)="addAssetDetails($event,1); false"
matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last">
matTooltip="Add More" matTooltipPosition="above" color="primary" *ngIf="last">
<strong>Add More Other Asset </strong>
</button>
</div>

View File

@ -143,7 +143,7 @@ export class AssetsInfoComponent implements OnInit {
getM_Assets_Type() {
this.pdTrigerService.getAllMasterDatas('ASSETTYPE').subscribe(
data => {
this.m_assets_type = data.records.filter(data => data.isactive == 1);
this.m_assets_type = data.records.filter(data => data.isactive == 1 && data.id != 4);
},
error => {
this.notifier.notify('warning', 'No Category Records Found.!');
@ -298,35 +298,35 @@ export class AssetsInfoComponent implements OnInit {
switch (e.value) {
case '1': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray ;
control.push(this.otherAssetsDescription());
break;
}
case '2': {
let val = i;
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.loadProperty());
break;
}
case '2': {
case '3': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.load_Four_Weeler());
break;
}
case '3': {
case '4': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.loadEquipmentManufacturingDescription());
break;
}
case '4': {
case '5': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
//control.push(this.loadJwellDescription());
break;
}
case '5': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.loadConsumerDurableDescription());
break;
}
case '6': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
@ -339,11 +339,7 @@ export class AssetsInfoComponent implements OnInit {
control.push(this.loadInvestDescription());
break;
}
case '8': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray ;
control.push(this.otherAssetsDescription());
break;
}
default: {
break;
}
@ -379,8 +375,8 @@ export class AssetsInfoComponent implements OnInit {
otherAssetsDescription() {
return this._formBuilder.group({
any_other_assets: [''],
name_of_the_owner:[''],
other_owner:[''],
//name_of_the_owner:[''],
//other_owner:[''],
//relation:[''],
any_other_asset_value : [''],
any_other_asset_loan : [''],
@ -411,7 +407,7 @@ export class AssetsInfoComponent implements OnInit {
return this._formBuilder.group({
investments_type: [''],
other_investments_type:[''],
amount_of_invest: [],
amount_of_invest: [''],
bank_name: ['']
});
}
@ -456,8 +452,8 @@ export class AssetsInfoComponent implements OnInit {
otherAssetsDescriptionWithData(data) {
return this._formBuilder.group({
any_other_assets: [data.any_other_assets],
name_of_the_owner:[data.name_of_the_owner],
other_owner:[data.other_owner],
// name_of_the_owner:[data.name_of_the_owner],
// other_owner:[data.other_owner],
// relation:[data.relation],
any_other_asset_value : [data.any_other_asset_value],
any_other_asset_loan : [data.any_other_asset_loan],
@ -584,6 +580,22 @@ export class AssetsInfoComponent implements OnInit {
switch (assets_details_mode) {
case '1': {
let array_data : any;
data.forEach((datas,i) => {
array_data = { 'any_other_assets': datas.any_other_assets,
'name_of_the_owner':datas.name_of_the_owner,
'other_owner':datas.other_owner,
//'relation':datas.relation,
'any_other_asset_value' : datas.any_other_asset_value,
'any_other_asset_loan' : datas.any_other_asset_loan,
};
this.OtherAssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.any_other_asset_value);
});
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.otherAssetsDescriptionWithData(array_data));
break;
}
case '2': {
let array_data : any;
data.forEach((datas,i) => {
array_data = { 'property_type':datas.property_type,'other_property_type':datas.other_property_type };
@ -592,7 +604,7 @@ export class AssetsInfoComponent implements OnInit {
control.push(this.loadPropertyWithData(array_data));
break;
}
case '2': {
case '3': {
let array_data : any;
data.forEach((datas,i) => {
array_data = { 'manufacturer_model_vehicle': datas.manufacturer_model_vehicle };
@ -601,7 +613,7 @@ export class AssetsInfoComponent implements OnInit {
control.push(this.load_Four_WeelerWithData(array_data));
break;
}
case '3': {
case '4': {
let array_data : any;
data.forEach((datas,i) => {
array_data = { 'equipment_manufacturing_description': datas.equipment_manufacturing_description };
@ -610,20 +622,12 @@ export class AssetsInfoComponent implements OnInit {
control.push(this.loadEquipmentManufacturingDescriptionWithData(array_data));
break;
}
case '4': {
case '5': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
//control.push(this.loadJwellDescriptionWithData(data));
break;
}
case '5': {
let array_data : any;
data.forEach((datas,i) => {
array_data = { 'consumer_durable_description': datas.consumer_durable_description };
});
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.loadConsumerDurableDescriptionWithData(array_data));
break;
}
case '6': {
let array_data : any;
data.forEach((datas,i) => {
@ -654,22 +658,7 @@ export class AssetsInfoComponent implements OnInit {
control.push(this.loadInvestDescriptionWithData(array_data));
break;
}
case '8': {
let array_data : any;
data.forEach((datas,i) => {
array_data = { 'any_other_assets': datas.any_other_assets,
'name_of_the_owner':datas.name_of_the_owner,
'other_owner':datas.other_owner,
//'relation':datas.relation,
'any_other_asset_value' : datas.any_other_asset_value,
'any_other_asset_loan' : datas.any_other_asset_loan,
};
this.OtherAssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.any_other_asset_value);
});
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.otherAssetsDescriptionWithData(array_data));
break;
}
default: {
break;
}

View File

@ -221,7 +221,7 @@
</mat-form-field> -->
<!-- {{applicants | json}} -->
<!-- <mat-form-field *ngIf="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 || sup.get('business_assets_mode').value == 6" style="width:45%"> -->
<mat-form-field *ngIf="sup.get('business_assets_mode').value == 2 || sup.get('business_assets_mode').value == 3 || sup.get('business_assets_mode').value == 4" style="width:45%">
<mat-form-field *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" style="width:45%">
<mat-select placeholder="Asset Owned by" formControlName="business_name_of_the_owner" required>
<mat-option *ngFor="let status of applicants" [value]="status.pd_co_applicant_id">{{ status.applicant_name }}</mat-option>
</mat-select>