conflict merge : suren

This commit is contained in:
venbatechnologies@gmail.com 2018-12-17 18:34:14 +05:30
commit 0223efee67
4 changed files with 740 additions and 107 deletions

View File

@ -22,7 +22,7 @@
<mat-form-field> <mat-form-field>
<!-- <input matInput placeholder="Name" formControlName="name_ans" type="text" required> --> <!-- <input matInput placeholder="Name" formControlName="name_ans" type="text" required> -->
<input matInput placeholder="Address" formControlName="address" required> <input matInput placeholder="Address" formControlName="address" required autocomplete="off">
</mat-form-field> </mat-form-field>
@ -35,7 +35,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="addressForm.controls['address_type'].value == 12"> <mat-form-field *ngIf="addressForm.controls['address_type'].value == 12">
<input matInput placeholder="Address Type Others" formControlName="address_type_others"> <input matInput placeholder="Address Type Others" formControlName="address_type_others" autocomplete="off">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
@ -48,7 +48,7 @@
<mat-form-field *ngIf="addressForm.controls.locality.value == 'Others'"> <mat-form-field *ngIf="addressForm.controls.locality.value == 'Others'">
<input matInput placeholder="Specify Locality" <input matInput placeholder="Specify Locality"
formControlName="locality_others"> formControlName="locality_others" autocomplete="off">
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 30%"> <mat-form-field style="width: 30%">
@ -87,11 +87,11 @@
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="addressForm.controls['address_ownership'].value == 4 " style="width: 38%"> <mat-form-field *ngIf="addressForm.controls['address_ownership'].value == 4 " style="width: 38%">
<input matInput placeholder="Specify Other Ownership" formControlName="other_ownership"> <input matInput placeholder="Specify Other Ownership" formControlName="other_ownership" autocomplete="off">
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="addressForm.controls['address_ownership'].value == 3 " style="width: 38%"> <mat-form-field *ngIf="addressForm.controls['address_ownership'].value == 3 " style="width: 38%">
<input matInput placeholder="What is the monthly rent paid?" formControlName="rent_amt"> <input matInput placeholder="What is the monthly rent paid?" formControlName="rent_amt" autocomplete="off">
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 42%"> <mat-form-field style="width: 42%">
@ -102,35 +102,33 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="addressForm.controls['bussiness_activity'].value == 'yes'" style="width: 100%"> <!-- <mat-form-field *ngIf="addressForm.controls['bussiness_activity'].value == 'yes'" style="width: 100%">
<!-- <mat-select placeholder="Bussiness Type" formControlName="bussiness_address_type"> <!-- <mat-select placeholder="Bussiness Type" formControlName="bussiness_address_type">
<mat-option value="{{m_addressType.address_type_id}}" <mat-option value="{{m_addressType.address_type_id}}"
*ngFor="let m_addressType of addressData">{{m_addressType.address_type}} *ngFor="let m_addressType of addressData">{{m_addressType.address_type}}
</mat-option> </mat-option>
</mat-select> --> </mat-select> -->
<mat-select placeholder="Type of Premises" formControlName="bussiness_address_type" multiple> <!-- --<mat-select placeholder="Type of Premises" formControlName="bussiness_address_type" multiple>
<mat-option *ngFor="let m_addressType of addressData" [value]="m_addressType.address_type_id" (onSelectionChange)="SelectedPremises($event)" > {{m_addressType.address_type}} </mat-option> <mat-option *ngFor="let m_addressType of addressData" [value]="m_addressType.address_type_id" (onSelectionChange)="SelectedPremises($event)" > {{m_addressType.address_type}} </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field> -->
<mat-form-field *ngIf="PremisesOtherFlag == true" style="width: 40%"> <mat-form-field *ngIf="PremisesOtherFlag == true" style="width: 40%">
<input matInput placeholder="Specify Other Premises Type" formControlName="bussiness_address_type_others"> <input matInput placeholder="Specify Other Premises Type" formControlName="bussiness_address_type_others" autocomplete="off">
</mat-form-field> </mat-form-field>
<mat-card formArrayName="premises"> <span formArrayName="additional_premises">
<div <div
*ngFor="let item of addressForm.controls.premises['controls']; let i = index;" [formGroupName]="i"> *ngFor="let item of addressForm.controls.additional_premises['controls']; let i = index;" [formGroupName]="i">
<p>{{i+1}} . {{PremisesLabel[i]}}</p>
<mat-card-header>
<mat-card-title>{{i+1}} . {{PremisesLabel[i]}}</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-form-field style="width: 40%;"> <mat-form-field style="width: 40%;">
<input matInput placeholder="Number Of Additional Units" <input matInput placeholder="Number Of Additional Units"
formControlName="no_of_additional_units"> formControlName="no_of_additional_units" autocomplete="off">
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="item.get('no_of_additional_units').value > 2" style="width: 40%;"> <mat-form-field *ngIf="item.get('no_of_additional_units').value > 2" style="width: 40%;">
<mat-select placeholder="City" formControlName="premises_city"> <!--multiple (selectionChange)="relationChanged($event)"> --> <mat-select placeholder="City" formControlName="premises_city" multiple > <!-- (selectionChange)="relationChanged($event)"> -->
<mat-option *ngFor="let CL of cityData" [value]="CL.city_id"> <mat-option *ngFor="let CL of cityData" [value]="CL.city_id">
{{CL.name}} {{CL.name}}
</mat-option> </mat-option>
@ -148,18 +146,17 @@
<!-- <mat-form-field *ngIf="addressForm.controls['premises_ownership'].value == 4 "> --> <!-- <mat-form-field *ngIf="addressForm.controls['premises_ownership'].value == 4 "> -->
<mat-form-field *ngIf="item.get('premises_ownership').value == 4" style="width: 40%;"> <mat-form-field *ngIf="item.get('premises_ownership').value == 4" style="width: 40%;">
<input matInput placeholder="Specify Other Ownership" formControlName="premises_ownership_others"> <input matInput placeholder="Specify Other Ownership" formControlName="premises_ownership_others" autocomplete="off">
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="item.get('premises_ownership').value == 3" style="width: 40%;"> <mat-form-field *ngIf="item.get('premises_ownership').value == 3" style="width: 40%;">
<input matInput placeholder="What is the monthly rent paid?" formControlName="premises_rent_amt"> <input matInput placeholder="What is the monthly rent paid?" formControlName="premises_rent_amt" autocomplete="off">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Remarks" <input matInput placeholder="Remarks"
formControlName="premises_remarks" style="width: 65%;"> formControlName="premises_remarks" style="width: 65%;" autocomplete="off">
</mat-form-field> </mat-form-field>
</mat-card-content>
</div> </div>
</mat-card> </span>
<!--- Don't Remove To replace atlast of the PD Completion and creating new form (Neighbourhood check) -- <!--- Don't Remove To replace atlast of the PD Completion and creating new form (Neighbourhood check) --
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>

View File

@ -50,12 +50,10 @@ export class AddressComponent implements OnInit {
ownerShipData:any = []; ownerShipData:any = [];
cityData:any = []; cityData:any = [];
z = 0; z = 0;
formPremisesArray: any = []; formPremisesArray: any = [];
relativeNames2: any = []; formPremisesCityArray: any = [];
//neighbourStatusData:any=["Yes","No"]; //neighbourStatusData:any=["Yes","No"];
//applicantOwnerData:any=["Yes","No","Dont Know"]; //applicantOwnerData:any=["Yes","No","Dont Know"];
@ -96,13 +94,15 @@ export class AddressComponent implements OnInit {
this.getMasterDetails('RESIDENCEOWNERSHIP',6); this.getMasterDetails('RESIDENCEOWNERSHIP',6);
this.getMasterDetails('CITY',7); this.getMasterDetails('CITY',7);
this.initAddressForm(); this.initAddressForm();
let params: any = {}; let params: any = {};
params.pd_id = this.pdid; params.pd_id = this.pdid;
params.pd_form_id = '5'; params.pd_form_id = '5';
this._pd.retriveForm(params).subscribe(data => { this._pd.retriveForm(params).subscribe(data => {
console.log('data', data); console.log('data', data);
//const control = <FormArray>this.addressForm.controls['neighbourhood']; //const control = <FormArray>this.addressForm.controls['neighbourhood'];
const control = <FormArray>this.addressForm.controls['premises']; const additionalPremisesControl = <FormArray>this.addressForm.controls['additional_premises'];
if(data.status == 200) { if(data.status == 200) {
// var result = Object.keys(data.records.neighbourhood).map(function (key) { // var result = Object.keys(data.records.neighbourhood).map(function (key) {
// return data.records.neighbourhood[key]; // return data.records.neighbourhood[key];
@ -111,47 +111,95 @@ export class AddressComponent implements OnInit {
this.addressForm.controls.address.setValue(data.records.address); this.addressForm.controls.address.setValue(data.records.address);
this.addressForm.controls.pd_location.setValue(data.records.pd_location); this.addressForm.controls.pd_location.setValue(data.records.pd_location);
this.addressForm.controls.address_type.setValue(data.records.address_type); this.addressForm.controls.address_type.setValue(data.records.address_type);
if(data.records.address_type == 12) { if(data.records.address_type == 12) {
this.addressForm.controls.address_type_others.setValue(data.records.address_type_others); this.addressForm.controls.address_type_others.setValue(data.records.address_type_others);
} }
this.addressForm.controls.comment_locality.setValue(data.records.comment_locality); this.addressForm.controls.comment_locality.setValue(data.records.comment_locality);
// this.addressForm.controls.customer_behaviour.setValue(data.records.customer_behaviour); // this.addressForm.controls.customer_behaviour.setValue(data.records.customer_behaviour);
this.addressForm.controls.locality.setValue(data.records.locality); this.addressForm.controls.locality.setValue(data.records.locality);
this.addressForm.controls.address_form_remark.setValue(data.records.address_form_remark); this.addressForm.controls.address_form_remark.setValue(data.records.address_form_remark);
this.addressForm.controls.address_ownership.setValue(data.records.address_ownership); this.addressForm.controls.address_ownership.setValue(data.records.address_ownership);
this.addressForm.controls.other_ownership.setValue(data.records.other_ownership); this.addressForm.controls.other_ownership.setValue(data.records.other_ownership);
this.addressForm.controls.rent_amt.setValue(data.records.rent_amt); this.addressForm.controls.rent_amt.setValue(data.records.rent_amt);
this.addressForm.controls.bussiness_activity.setValue(data.records.bussiness_activity); this.addressForm.controls.bussiness_activity.setValue(data.records.bussiness_activity);
if(data.records.bussiness_activity == 'yes') { if(data.records.bussiness_activity == 'yes') {
let selectedMembers = Object.keys(data.records.bussiness_address_type).map(function (key) { let selectedPremisesDBData = Object.keys(data.records.bussiness_address_type).map(function (key) {
return data.records.bussiness_address_type[key]; return data.records.bussiness_address_type[key];
}); });
let enduse: any = []; let enduse: any = [];
let existPremises: any =[]; let existPremises: any =[];
selectedMembers.forEach(val => { selectedPremisesDBData.forEach(val => {
enduse.push(val.premises); enduse.push(val.premises_types);
existPremises.push(val); existPremises.push(val);
}); });
this.formPremisesArray = existPremises; this.formPremisesArray = existPremises;
this.addressForm.controls.bussiness_address_type.setValue(enduse); this.addressForm.controls.bussiness_address_type.setValue(enduse);
var result = Object.keys(data.records.premises).map(function (key) { var additionalPremisesResult = Object.keys(data.records.additional_premises).map(function (key) {
return data.records.premises[key]; return data.records.additional_premises[key];
}); });
if (result.length == 0) { // let cityenduse: any = [];
control.push(this.createPremises()); // let existcity: any =[];
} else {
result.forEach(datas => { // additionalPremisesResult.forEach(val => {
control.push(this.createPremises()); // cityenduse.push(val.premises_types);
// existcity.push(val);
// });
// this.formPremisesCityArray = existcity;
additionalPremisesResult.forEach((val,index)=>
{
console.log(val);
let cityenduse: any = [];
let existcity: any =[];
if(val.premises_city != ''){
this.formPremisesCityArray = [];
val.premises_city.forEach(option => {
// cityenduse.push(option);
// existcity.push(val);
//this.formPremisesCityArray.push({additional_premises_city: option});
//this.addressForm.controls.additional_premises.value[index].premises_city = cityenduse;
console.log(option);
}); });
//console.log(cityenduse);
//this.formPremisesCityArray = existcity;
}
});
if (additionalPremisesResult.length == 0) {
additionalPremisesControl.push(this.createPremises());
} else {
let cityenduse: any = [];
let existcity: any =[];
additionalPremisesResult.forEach(datas => {
if(datas.premises_city != ''){
cityenduse.push(datas.additional_premises_city);
existcity.push(datas);
}
additionalPremisesControl.push(this.createPremises());
});
this.formPremisesCityArray = existcity;
console.log(cityenduse);
console.log(existcity);
this.addressForm.controls['additional_premises'].setValue(additionalPremisesResult);
} }
this.addressForm.controls['premises'].setValue(result);
if(data.records.bussiness_address_type == 12) { if(data.records.bussiness_address_type == 12) {
this.addressForm.controls.bussiness_address_type_others.setValue(data.records.bussiness_address_type_others); this.addressForm.controls.bussiness_address_type_others.setValue(data.records.bussiness_address_type_others);
@ -191,7 +239,7 @@ export class AddressComponent implements OnInit {
bussiness_activity:[''], bussiness_activity:[''],
bussiness_address_type:[''], bussiness_address_type:[''],
bussiness_address_type_others: [''], bussiness_address_type_others: [''],
premises: this.fb.array([]) additional_premises: this.fb.array([])
}); });
this.address = this.addressForm.controls['address']; this.address = this.addressForm.controls['address'];
this.addressType = this.addressForm.controls['address_type']; this.addressType = this.addressForm.controls['address_type'];
@ -316,32 +364,47 @@ export class AddressComponent implements OnInit {
records.bussiness_address_type_others = this.addressForm.controls.bussiness_address_type_others.value; records.bussiness_address_type_others = this.addressForm.controls.bussiness_address_type_others.value;
} }
} }
this.addressForm.controls.additional_premises.value.forEach((val,index)=>
{
console.log(val);
records.premises = this.addressForm.controls.premises.value; if(val.premises_city != ''){
this.formPremisesCityArray = [];
val.premises_city.forEach(option => {
this.formPremisesCityArray.push({additional_premises_city: option});
this.addressForm.controls.additional_premises.value[index].premises_city = this.formPremisesCityArray;
// console.log(val);
});
}
console.log(this.addressForm.controls.premises.value);
});
records.additional_premises = this.addressForm.controls.additional_premises.value;
// console.log(this.formPremisesCityArray);
// console.log(this.addressForm.controls.premises.value);
records.pdid = this.pdid; records.pdid = this.pdid;
records.formid = '5'; records.formid = '5';
// records.fk_createdby = '250'; // records.fk_createdby = '250';
console.log('params', records); console.log('params', records);
this._pd.saveForm(records).subscribe(data => { this._pd.saveForm(records).subscribe(data => {
console.log('data', data); console.log('data', data);
this.notifier.notify('success', 'Saved Successfully.'); this.notifier.notify('success', 'Saved Successfully.');
}, error => {
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
relationChanged(event) {
this.relativeNames2 = [];
event.value.forEach(option => {
this.relativeNames2.push({city: option});
}); });
} }
// relationChanged(event) {
// this.formPremisesCityArray = [];
// event.value.forEach(option => {
// this.formPremisesCityArray.push({city: option});
// });
// }
SelectedPremises($event){ SelectedPremises($event){
console.log('event',$event);
let premisesData = $event.source.value; let premisesData = $event.source.value;
@ -354,7 +417,7 @@ export class AddressComponent implements OnInit {
//console.log(this.formPremisesArray); //console.log(this.formPremisesArray);
this.formPremisesArray.push({premises: $event.source.value}); this.formPremisesArray.push({premises_types: $event.source.value});
//console.log(this.formPremisesArray); //console.log(this.formPremisesArray);
@ -370,7 +433,7 @@ export class AddressComponent implements OnInit {
this.z++; this.z++;
const control = <FormArray>this.addressForm.controls['premises']; const control = <FormArray>this.addressForm.controls['additional_premises'];
control.push(this.createPremises()); control.push(this.createPremises());
@ -385,7 +448,7 @@ export class AddressComponent implements OnInit {
this.PremisesOtherFlag = false; this.PremisesOtherFlag = false;
} }
const control = <FormArray>this.addressForm.controls['neighbourhood']; const control = <FormArray>this.addressForm.controls['additional_premises'];
control.removeAt(this.z); control.removeAt(this.z);
this.z--; this.z--;
//let index = this.selectedSegmentDatas.indexOf(CustomerSegmentName.name); //let index = this.selectedSegmentDatas.indexOf(CustomerSegmentName.name);

View File

@ -14,7 +14,7 @@
<mat-tab-group> <mat-tab-group>
<mat-tab label="Questions"> <mat-tab label="Other Asset Questions">
<ng-template matTabContent> <ng-template matTabContent>
<div fxLayout="row wrap"> <div fxLayout="row wrap">
<div fxFlex="100"> <div fxFlex="100">
@ -29,7 +29,7 @@
<div [formGroupName]="i"> <div [formGroupName]="i">
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width:100%"> <mat-form-field style="width:100%">
<mat-select (selectionChange)="selectedAssetsType($event, i)" placeholder="Assets Type" formControlName="assets_mode" requried> <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 }}</mat-option> <mat-option *ngFor="let asset of m_assets_type" [value]="asset.id">{{ asset.name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@ -50,7 +50,7 @@
</div> </div>
<div> <div>
<mat-form-field *ngIf="detail.get('property_type').value == 5"> <mat-form-field *ngIf="detail.get('property_type').value == 5">
<input matInput placeholder="Other Property Type" formControlName="other_property_type"> <input matInput placeholder="Other Property Type" formControlName="other_property_type" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -64,7 +64,7 @@
<div [formGroupName]="s"> <div [formGroupName]="s">
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_four_weeler" required> <input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_four_weeler" required autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -78,7 +78,7 @@
<div [formGroupName]="s"> <div [formGroupName]="s">
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_two_weeler" required> <input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_two_weeler" required autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -92,7 +92,7 @@
<div [formGroupName]="s"> <div [formGroupName]="s">
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Description" formControlName="jwell_description"> <input matInput placeholder="Description" formControlName="jwell_description" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -128,7 +128,7 @@
</div>--> </div>-->
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Premium Paid" formControlName="premium_paid" required (keypress)="keyPress($event)"> <input matInput placeholder="Premium Paid" formControlName="premium_paid" required (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="33"> <div fxFlex="33">
@ -140,14 +140,14 @@
</div> </div>
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Sum Assured" formControlName="sum_assured" required (keypress)="keyPress($event)"> <input matInput placeholder="Sum Assured" formControlName="sum_assured" required (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Members Covered" formControlName="members_coverd" required> <input matInput placeholder="Members Covered" formControlName="members_coverd" required autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -170,17 +170,17 @@
</div> </div>
<!-- <div fxFlex="33" *ngIf="detail.get('investments_type').value == 6 "> --> <!-- <div fxFlex="33" *ngIf="detail.get('investments_type').value == 6 "> -->
<mat-form-field> <mat-form-field>
<input matInput placeholder="Specify Other Type" formControlName="other_investments_type"> <input matInput placeholder="Specify Other Type" formControlName="other_investments_type" autocomplete="off">
</mat-form-field> </mat-form-field>
<!-- </div> --> <!-- </div> -->
<div fxFlex="33" > <div fxFlex="33" >
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Amount of Investment" formControlName="amount_of_invest" required (keypress)="keyPress($event)"> <input matInput placeholder="Amount of Investment" formControlName="amount_of_invest" required (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Bank Name" formControlName="bank_name" required> <input matInput placeholder="Bank Name" formControlName="bank_name" required autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -195,10 +195,10 @@
<div [formGroupName]="s"> <div [formGroupName]="s">
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Description of the Assets" formControlName="any_other_assets" required> <input matInput placeholder="Description of the Assets" formControlName="any_other_assets" required autocomplete="off">
</mat-form-field> </mat-form-field>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Value of the Assets" formControlName="any_other_asset_value" required> <input matInput placeholder="Value of the Assets" formControlName="any_other_asset_value" required autocomplete="off">
</mat-form-field> </mat-form-field>
<!-- <mat-form-field class="ml-xs example-full-width"> --> <!-- <mat-form-field class="ml-xs example-full-width"> -->
<!-- <input matInput placeholder="Is Any Loan" formControlName="any_other_asset_loan" required> --> <!-- <input matInput placeholder="Is Any Loan" formControlName="any_other_asset_loan" required> -->
@ -209,10 +209,12 @@
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
<mat-option value="nan">NAN</mat-option> <mat-option value="nan">NAN</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>
<mat-form-field class="ml-xs example-full-width" *ngIf="detail.get(any_other_asset_loan).value == 'yes'"> <!-- <mat-form-field class="ml-xs example-full-width" *ngIf="detail.get(any_other_asset_loan).value == 'yes'"> -->
<input matInput placeholder="What is the EMI amount ?" formControlName="other_asset_emi_amt"> <mat-form-field class="ml-xs example-full-width">
<span matSuffix>.00</span> <input matInput placeholder="What is the EMI amount ?" formControlName="other_asset_emi_amt" autocomplete="off">
<!-- <span matSuffix>.00</span> -->
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -225,7 +227,7 @@
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 4"> <div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 4">
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Approximate Market Value" formControlName="approximate_market_value" (keypress)="keyPress($event)"> <input matInput placeholder="Approximate Market Value" formControlName="approximate_market_value" (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -233,7 +235,7 @@
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Name of the Owner" formControlName="name_of_the_owner"> <input matInput placeholder="Name of the Owner" formControlName="name_of_the_owner" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -261,24 +263,30 @@
</div> </div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33"> <div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width" style="width:95%"> <mat-form-field class="ml-xs example-full-width" style="width:95%">
<input matInput placeholder="Amount of EMI on This Loan?" formControlName="emi_paid" (keypress)="keyPress($event)"> <input matInput placeholder="Amount of EMI on This Loan?" formControlName="emi_paid" (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33"> <div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width" style="width:95%"> <mat-form-field class="ml-xs example-full-width" style="width:95%">
<input matInput placeholder="Original Loan Tenure in Months" formControlName="elapsed_tenure"> <input matInput placeholder="Original Loan Tenure in Months" formControlName="original_loan_tenure" (change)="loanCalc(sup)" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33" style="width:95%"> <div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33" style="width:95%">
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Balance Tenure in Months" formControlName="balance_tenure"> <input matInput placeholder="Balance Tenure in Months" formControlName="balance_tenure" (change)="loanCalc(sup)" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
</div> <div *ngIf="sup.get('emi').value === 'yes' && sup.get('original_loan_tenure').value != '' && sup.get('balance_tenure').value != '' " fxFlex="33" style="width:95%">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Elapsed Tenure in Months" formControlName="elapsed_tenure" autocomplete="off">
</mat-form-field>
<!-- <p>Elapsed tenure is {{elapsed_tenure}}</p> -->
</div>
</div>
</div> </div>
<div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none">
<div fxFlex="20"> <div fxFlex="20">
<span *ngIf="_assetsQuesFrom.controls.assets_details.controls.length > 1" (click)="removeLanguage(i)"> <span *ngIf="_assetsQuesFrom.controls.assets_details.controls.length > 1" (click)="removeLanguage(i,1)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button> <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span> </span>
</div> </div>
@ -292,10 +300,7 @@
<div class="row" style="text-align:right;"> <div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Asset Details" matTooltipPosition="above" <button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Asset Details" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" (click)="addSupplierDetails($event); false"><mat-icon>add</mat-icon></button> class="mr-1 mb-1 hover-icon" (click)="addSupplierDetails($event,1); false"><mat-icon>add</mat-icon></button>
</div> </div>
</mat-card-content> </mat-card-content>
@ -401,6 +406,387 @@
</div> </div>
</ng-template> </ng-template>
</mat-tab> </mat-tab>
</mat-tab>
<mat-tab label="Bussiness Asset Questions">
<ng-template matTabContent>
<div fxLayout="row wrap">
<div fxFlex="100">
<mat-card style="min-height: 550px;">
<mat-card-content>
<div fxLayout="row" fxLayoutAlign="start none">
<div formArrayName="business_assets_details" fxFill>
<div *ngFor="let sup of _assetsQuesFrom.controls.business_assets_details['controls']; let i=index">
<mat-card>
<mat-card-content>
<div [formGroupName]="i">
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width:100%">
<mat-select (selectionChange)="selectedAssetsType($event, i,2)" placeholder="Assets Type" formControlName="business_assets_mode" requried>
<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="business_details" class="example-full-width">
<!--Property-->
<div *ngIf="sup.get('business_assets_mode').value == 1 ">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field style="width:100%">
<mat-select placeholder="Property Type" formControlName="property_type" required>
<mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{ prop.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div>
<mat-form-field *ngIf="detail.get('property_type').value == 5">
<input matInput placeholder="Other Property Type" formControlName="other_property_type" autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
<!--Four Wheeler-->
<div *ngIf="sup.get('business_assets_mode').value == 2">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_four_weeler" required autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
<!--Two Wheeler-->
<div *ngIf="sup.get('business_assets_mode').value == 3">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_two_weeler" required autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
<!--Consumer Durable-->
<div *ngIf="sup.get('business_assets_mode').value == 5">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Description" formControlName="consumer_durable_description" required>
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
<!--Insurance-->
<div *ngIf="sup.get('business_assets_mode').value == 6">
<div fxFill>
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Premium Paid" formControlName="premium_paid" required (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field>
</div>
<div fxFlex="33">
<mat-form-field>
<mat-select placeholder="Frequency" formControlName="frequency_mode" required>
<mat-option *ngFor="let freqn of m_freqOfPurchase" [value]="freqn.frequency_id">{{ freqn.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Sum Assured" formControlName="sum_assured" required (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field>
</div>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Members Covered" formControlName="members_coverd" required autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
</div>
<!--Investments-->
<div *ngIf="sup.get('business_assets_mode').value == 7">
<div>
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33">
<mat-form-field>
<mat-select placeholder="Type" formControlName="investments_type" required>
<mat-option *ngFor="let ins_type of m_investmentType" [value]="ins_type.id">{{ ins_type.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<!-- <div fxFlex="33" *ngIf="detail.get('investments_type').value == 6 "> -->
<mat-form-field>
<input matInput placeholder="Specify Other Type" formControlName="other_investments_type" autocomplete="off">
</mat-form-field>
<!-- </div> -->
<div fxFlex="33" >
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Amount of Investment" formControlName="amount_of_invest" required (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field>
</div>
<div fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Bank Name" formControlName="bank_name" required autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
</div>
<!--other assets-->
<!-- <div *ngIf="sup.get('assets_mode').value == 8"> -->
<div *ngIf="sup.get('business_assets_mode').value == 8">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Description of the Assets" formControlName="any_other_assets" required autocomplete="off">
</mat-form-field>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Value of the Assets" formControlName="any_other_asset_value" required 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" required> -->
<!-- </mat-form-field> -->
<mat-form-field class="ml-xs example-full-width">
<mat-select placeholder="Is there any asset loan?" formControlName="any_other_asset_loan" required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
<mat-option value="nan">NAN</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 class="ml-xs example-full-width">
<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>
<!--Desction Dynamic details : END -->
<!-- {{sup.get('business_assets_mode').value}} -->
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngIf="sup.get('business_assets_mode').value == 1 || sup.get('business_assets_mode').value == 4">
<div fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Approximate Market Value" formControlName="business_approximate_market_value" (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field>
</div>
</div>
<div *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 fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Name of the Owner" formControlName="business_name_of_the_owner" autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
<div *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 fxFlex="33">
<mat-form-field class="ml-xs example-full-width" style="width:95%">
<mat-select placeholder="Is there a loan existing against this asset?" formControlName="business_emi">
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
</div>
<div *ngIf="sup.get('business_emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width" style="width:95%">
<input matInput placeholder="Amount of EMI on This Loan?" formControlName="business_emi_paid" (keypress)="keyPress($event)" autocomplete="off">
</mat-form-field>
</div>
<div *ngIf="sup.get('business_emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width" style="width:95%">
<input matInput placeholder="Original Loan Tenure in Months" formControlName="business_original_loan_tenure" autocomplete="off">
</mat-form-field>
</div>
<div *ngIf="sup.get('business_emi').value === 'yes'" fxFlex="33" style="width:95%">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Balance Tenure in Months" formControlName="business_balance_tenure" autocomplete="off">
</mat-form-field>
</div>
<!-- <div *ngIf="sup.get('emi').value === 'yes' && sup.get('original_loan_tenure').value != '' && sup.get('balance_tenure').value != '' " fxFlex="33" style="width:95%">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Elapsed Tenure in Months" formControlName="elapsed_tenure" autocomplete="off">
</mat-form-field> -->
<!-- <p>Elapsed tenure is {{elapsed_tenure}}</p> -->
<!-- </div> -->
</div>
</div>
<div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none">
<div fxFlex="20">
<span *ngIf="_assetsQuesFrom.controls.business_assets_details.controls.length > 1" (click)="removeLanguage(i,2)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
</div>
</div>
</div>
</mat-card-content>
</mat-card>
</div>
</div>
</div>
<div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Business Asset Details" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" (click)="addSupplierDetails($event,2); false"><mat-icon>add</mat-icon></button>
</div>
</mat-card-content>
</mat-card>
</div>
</div>
</ng-template>
</mat-tab>
<mat-tab label="Docs">
<ng-template matTabContent>
<div fxLayout="row wrap">
<div fxFlex="25" class="m-gap p-gap">
<div class="p-list-main mb-2">
<div class="p-list">
<div class="top"><img src="./../../../../../../../assets/images/face2.jpg" alt=""/></div>
<div class="bottom">
<div class="left">
<div class="details">
<small>Nivi SKM</small>
<!-- <p>{{docs.pd_document_name}}</p> -->
</div>
<!-- <div class="buy"><i class="material-icons">add_shopping_cart</i></div> -->
</div>
</div>
</div>
</div>
</div>
<div fxFlex="25" class="m-gap p-gap">
<div class="p-list-main mb-2">
<div class="p-list">
<div class="top"><img src="./../../../../../../../assets/images/face1.jpg" alt=""/></div>
<div class="bottom">
<div class="left">
<div class="details">
<small>Nivi SKM</small>
<!-- <p>{{docs.pd_document_name}}</p> -->
</div>
<!-- <div class="buy"><i class="material-icons">add_shopping_cart</i></div> -->
</div>
</div>
</div>
</div>
</div>
<div fxFlex="25" class="m-gap p-gap">
<div class="p-list-main mb-2">
<div class="p-list">
<div class="top"><img src="./../../../../../../../assets/images/face1.jpg" alt=""/></div>
<div class="bottom">
<div class="left">
<div class="details">
<small>Nivi SKM</small>
<!-- <p>{{docs.pd_document_name}}</p> -->
</div>
<!-- <div class="buy"><i class="material-icons">add_shopping_cart</i></div> -->
</div>
</div>
</div>
</div>
</div>
<div fxFlex="25" class="m-gap p-gap">
<div class="p-list-main mb-2">
<div class="p-list">
<div class="top"><img src="./../../../../../../../assets/images/face1.jpg" alt=""/></div>
<div class="bottom">
<div class="left">
<div class="details">
<small>Nivi SKM</small>
<!-- <p>{{docs.pd_document_name}}</p> -->
</div>
<!-- <div class="buy"><i class="material-icons">add_shopping_cart</i></div> -->
</div>
</div>
</div>
</div>
</div>
<div fxFlex="25" class="m-gap p-gap">
<div class="p-list-main mb-2">
<div class="p-list">
<div class="top"><img src="./../../../../../../../assets/images/face1.jpg" alt=""/></div>
<div class="bottom">
<div class="left">
<div class="details">
<small>Nivi SKM</small>
<!-- <p>{{docs.pd_document_name}}</p> -->
</div>
<!-- <div class="buy"><i class="material-icons">add_shopping_cart</i></div> -->
</div>
</div>
</div>
</div>
</div>
<div fxFlex="25" class="m-gap p-gap">
<div class="p-list-main mb-2">
<div class="p-list">
<div class="top"><img src="./../../../../../../../assets/images/face1.jpg" alt=""/></div>
<div class="bottom">
<div class="left">
<div class="details">
<small>Nivi SKM</small>
<!-- <p>{{docs.pd_document_name}}</p> -->
</div>
<!-- <div class="buy"><i class="material-icons">add_shopping_cart</i></div> -->
</div>
</div>
</div>
</div>
</div>
</div>
</ng-template>
</mat-tab>
</mat-tab-group> </mat-tab-group>
</mat-dialog-content> </mat-dialog-content>
<mat-dialog-actions> <mat-dialog-actions>
@ -408,7 +794,7 @@
<div fxFlex="60" class="pb-0 text-sm-left" align="left"> <div fxFlex="60" class="pb-0 text-sm-left" align="left">
<mat-form-field appearance="outline" style="width: 100%"> <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label> <mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="assets_form_remark"></textarea> <textarea matInput placeholder="Remarks" formControlName="assets_form_remark" autocomplete="off"></textarea>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="40" align="end"> <div fxFlex="40" align="end">

View File

@ -35,6 +35,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_assets_type = [ // public m_assets_type = [
// { // {
// 'id': "1", // 'id': "1",
@ -292,9 +293,11 @@ public m_investmentType = [];
assets_details: this._formBuilder.array([ assets_details: this._formBuilder.array([
// this.initDetails(), // this.initDetails(),
]), ]),
business_assets_details : this._formBuilder.array([]),
assets_form_remark:[value.assets_form_remark || 'check'] assets_form_remark:[value.assets_form_remark || 'check']
}); });
this.addAssetsDetailsWithData(value.assets_details); this.addAssetsDetailsWithData(value.assets_details);
this.addAssetsDetailsWithData2(value.business_assets_details);
} else { } else {
this._assetsQuesFrom = this._formBuilder.group({ this._assetsQuesFrom = this._formBuilder.group({
pdid: [this.pdid], pdid: [this.pdid],
@ -302,6 +305,9 @@ public m_investmentType = [];
assets_details: this._formBuilder.array([ assets_details: this._formBuilder.array([
this.initDetails(), this.initDetails(),
]), ]),
business_assets_details : this._formBuilder.array([
this.initnewDetails(),
]),
assets_form_remark:[''] assets_form_remark:['']
}); });
} }
@ -326,56 +332,90 @@ public m_investmentType = [];
//purchase_month: ['', Validators.compose([])], //purchase_month: ['', Validators.compose([])],
emi: [''], emi: [''],
emi_paid: [''], emi_paid: [''],
original_loan_tenure: [''],
balance_tenure: [''],
elapsed_tenure: [''], elapsed_tenure: [''],
balance_tenure: ['']
}); });
} }
initnewDetails() {
return this._formBuilder.group({
business_assets_mode: ['', Validators.compose([Validators.required])],
business_details: this._formBuilder.array([]),
business_approximate_market_value: ['', Validators.compose([])],
business_name_of_the_owner: ['', Validators.compose([])],
// purchase_year: ['', Validators.compose([])],
//purchase_month: ['', Validators.compose([])],
business_emi: [''],
business_emi_paid: [''],
business_original_loan_tenure: [''],
business_balance_tenure: [''],
business_elapsed_tenure: [''],
});
}
show: boolean; show: boolean;
selectedAssetsType(e: any, i: any): void { selectedAssetsType(e: any, i: any,flag : any): void {
console.log(e);
console.log(i);
console.log(flag);
let val = i; let val = i;
const arr = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; if(flag == 1){
arr.controls.splice(0); const arr = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
arr.controls.splice(0);
}
else if(flag == 2){
const arr = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray;
arr.controls.splice(0);
}
switch (e.value) { switch (e.value) {
case '1': { case '1': {
let val = i; let val = i;
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadProperty()); control.push(this.loadProperty());
break; break;
} }
case '2': { case '2': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Four_Weeler()); control.push(this.load_Four_Weeler());
break; break;
} }
case '3': { case '3': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Two_Weeler()); control.push(this.load_Two_Weeler());
break; break;
} }
case '4': { case '4': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
//control.push(this.loadJwellDescription()); //control.push(this.loadJwellDescription());
break; break;
} }
case '5': { case '5': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadConsumerDurableDescription()); control.push(this.loadConsumerDurableDescription());
break; break;
} }
case '6': { case '6': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadInsuranceDescription()); control.push(this.loadInsuranceDescription());
break; break;
} }
case '7': { case '7': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadInvestDescription()); control.push(this.loadInvestDescription());
break; break;
} }
case '8': { case '8': {
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('details') as FormArray ;
control.push(this.otherAssetsDescription()); control.push(this.otherAssetsDescription());
break; break;
} }
@ -428,7 +468,7 @@ public m_investmentType = [];
loadInvestDescription() { loadInvestDescription() {
return this._formBuilder.group({ return this._formBuilder.group({
investments_type: ['', Validators.compose([Validators.required])], investments_type: ['', Validators.compose([Validators.required])],
other_investment_type:[''], other_investments_type:[''],
amount_of_invest: ['', Validators.compose([Validators.required])], amount_of_invest: ['', Validators.compose([Validators.required])],
bank_name: ['', Validators.compose([Validators.required])] bank_name: ['', Validators.compose([Validators.required])]
}); });
@ -451,6 +491,14 @@ public m_investmentType = [];
loadPropertyWithData(data) { loadPropertyWithData(data) {
return this._formBuilder.group({ return this._formBuilder.group({
property_type: [data.property_type, Validators.compose([Validators.required])] property_type: [data.property_type, Validators.compose([Validators.required])]
//property_type:['']
});
}
loadPropertyWithData2(data) {
return this._formBuilder.group({
property_type: [data.property_type, Validators.compose([Validators.required])]
//property_type:['']
}); });
} }
@ -518,12 +566,29 @@ public m_investmentType = [];
// purchase_month: [data.purchase_month, Validators.compose([])], // purchase_month: [data.purchase_month, Validators.compose([])],
emi: [data.emi || 0], emi: [data.emi || 0],
emi_paid: [data.emi_paid || ''], emi_paid: [data.emi_paid || ''],
elapsed_tenure: [data.elapsed_tenure || ''], original_loan_tenure: [data.original_loan_tenure || ''],
balance_tenure: [data.balance_tenure || ''] balance_tenure: [data.balance_tenure || ''],
elapsed_tenure: [data.elapsed_tenure || '']
});
}
initnewDetailsWithdata(data) {
return this._formBuilder.group({
business_assets_mode: [data.business_assets_mode, Validators.compose([Validators.required])],
business_details: this._formBuilder.array([]),
business_approximate_market_value: [data.business_approximate_market_value, Validators.compose([])],
business_name_of_the_owner: [data.business_name_of_the_owner, Validators.compose([])],
// purchase_year: [data.purchase_year, Validators.compose([])],
// purchase_month: [data.purchase_month, Validators.compose([])],
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 || '']
}); });
} }
loadDetails: boolean; loadDetails: boolean;
addAssetsDetailsWithData(supp_data) { addAssetsDetailsWithData(supp_data) {
console.log(supp_data);
var result = Object.keys(supp_data).map(function (key) { var result = Object.keys(supp_data).map(function (key) {
return supp_data[key]; return supp_data[key];
}); });
@ -537,6 +602,7 @@ public m_investmentType = [];
// purchase_month: val.purchase_month, // purchase_month: val.purchase_month,
emi: val.emi, emi: val.emi,
emi_paid: val.emi_paid, emi_paid: val.emi_paid,
original_loan_tenure: val.original_loan_tenure,
elapsed_tenure: val.elapsed_tenure, elapsed_tenure: val.elapsed_tenure,
balance_tenure: val.balance_tenure balance_tenure: val.balance_tenure
}; };
@ -548,6 +614,39 @@ public m_investmentType = [];
this.loadDetails = true; this.loadDetails = true;
} }
addAssetsDetailsWithData2(supp_data) {
console.log(supp_data);
var result = Object.keys(supp_data).map(function (key) {
return supp_data[key];
});
if (result.length > 0) {
for (let val of result) {
let vals = {
business_assets_mode: val.business_assets_mode,
business_approximate_market_value: val.business_approximate_market_value,
business_name_of_the_owner: val.business_name_of_the_owner,
// purchase_year: val.purchase_year,
// purchase_month: val.purchase_month,
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['assets_details'];
// control.push(this.initDetailsWithdata(vals));
// this.setAssetsDetailsWithData(vals.business_assets_mode, val.details, control.length - 1)
const control = <FormArray>this._assetsQuesFrom.controls['business_assets_details'];
control.push(this.initnewDetailsWithdata(vals));
this.setAssetsDetailsWithData2(vals.business_assets_mode, val.business_details, control.length - 1)
}
}
//this.loadDetails = true;
}
setAssetsDetailsWithData(assets_details_mode: any, datas: any, i: any): void { setAssetsDetailsWithData(assets_details_mode: any, datas: any, i: any): void {
let val = i; let val = i;
// var data = Object.keys(datas).map(function (key) { // var data = Object.keys(datas).map(function (key) {
@ -557,6 +656,7 @@ public m_investmentType = [];
let data = datas; let data = datas;
const arr = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; const arr = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
arr.controls.splice(0); arr.controls.splice(0);
switch (assets_details_mode) { switch (assets_details_mode) {
case '1': { case '1': {
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;
@ -604,13 +704,76 @@ public m_investmentType = [];
} }
} }
addSupplierDetails(e) { setAssetsDetailsWithData2(assets_details_mode: any, datas: any, i: any): void {
let val = i;
let data = datas;
const arr = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
arr.controls.splice(0);
switch (assets_details_mode) {
case '1': {
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadPropertyWithData2(data));
break;
}
case '2': {
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Four_WeelerWithData(data));
break;
}
case '3': {
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Two_WeelerWithData(data));
break;
}
case '4': {
break;
}
case '5': {
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadConsumerDurableDescriptionWithData(data));
break;
}
case '6': {
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadInsuranceDescriptionWithData(data));
break;
}
case '7': {
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadInvestDescriptionWithData(data));
break;
}
case '8': {
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.otherAssetsDescriptionWithData(data));
break;
}
default: {
break;
}
}
}
addSupplierDetails(e,flag) {
console.log(flag);
console.log(e);
if(flag == 1){
const control = <FormArray>this._assetsQuesFrom.controls['assets_details']; const control = <FormArray>this._assetsQuesFrom.controls['assets_details'];
control.push(this.initDetails()); control.push(this.initDetails());
}else if(flag == 2){
const control = <FormArray>this._assetsQuesFrom.controls['business_assets_details'];
control.push(this.initnewDetails());
}
} }
removeLanguage(i: number) { removeLanguage(i: number,flag) {
if(flag == 1){
const control = <FormArray>this._assetsQuesFrom.controls['assets_details']; const control = <FormArray>this._assetsQuesFrom.controls['assets_details'];
control.removeAt(i); control.removeAt(i);
}else if(flag == 2){
const control = <FormArray>this._assetsQuesFrom.controls['business_assets_details'];
control.removeAt(i);
}
} }
public paymentModeTextBox: number; public paymentModeTextBox: number;
@ -639,8 +802,19 @@ public m_investmentType = [];
answerFormValues.assets_details.map(val => { answerFormValues.assets_details.map(val => {
if (val.emi == '0') { if (val.emi == '0') {
val.emi_paid = ''; val.emi_paid = '';
val.elapsed_tenure = ''; val.original_loan_tenure = '';
val.balance_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 = '';
} }
}); });
@ -682,6 +856,19 @@ public m_investmentType = [];
event.preventDefault(); event.preventDefault();
} }
} }
loanCalc(details)
{
//console.log(details.value);
let ElapsedValues;
if(details.value.original_loan_tenure != null && details.value.original_loan_tenure != '' && details.value.balance_tenure != null && details.value.balance_tenure != ''){
ElapsedValues = details.value.original_loan_tenure - details.value.balance_tenure ;
details.controls['elapsed_tenure'].setValue(ElapsedValues);
}
}
// { // {
// 'main_raw_materials': 'sdkjfal', // 'main_raw_materials': 'sdkjfal',
// 'supplier_details' ; [ // 'supplier_details' ; [