asset issues : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-01-04 13:37:14 +05:30
parent 683777c7e1
commit b384753650
3 changed files with 187 additions and 36 deletions

View File

@ -32,7 +32,7 @@
<div fxFlex="33">
<mat-form-field style="width: 80%;">
<mat-select placeholder="Address Type" formControlName="address_type" required>
<mat-select placeholder="Address Type" formControlName="address_type" required (selectionChange)="selectedAddressType($event.source.triggerValue)">
<mat-option value="{{m_addressType.address_type_id}}"
*ngFor="let m_addressType of addressData">{{m_addressType.address_type}}
</mat-option>
@ -42,7 +42,7 @@
<div *ngIf="addressForm.controls['address_type'].value == 12" fxFlex="33">
<mat-form-field style="width: 80%;">
<input matInput placeholder="Specify Address Type" formControlName="address_type_others" autocomplete="off">
<input matInput placeholder="Specify Address Type" formControlName="address_type_others" autocomplete="off" (change)="selectedAddressType($event.target.value)">
</mat-form-field>
</div>
@ -83,6 +83,12 @@
</mat-form-field>
</div>
<div *ngIf="addressForm.controls['comment_locality'].value == 10 " fxFlex="33">
<mat-form-field style="width: 80%;">
<input matInput placeholder="Specify Comment on Locality" formControlName="other_comment_locality" autocomplete="off">
</mat-form-field>
</div>
<div fxFlex="33">
<mat-form-field style="width: 80%;">
<mat-select placeholder="Ownership" formControlName="address_ownership">
@ -95,7 +101,6 @@
</div>
<div *ngIf="addressForm.controls['address_ownership'].value == 4 " fxFlex="33">
<mat-form-field style="width: 80%;">
<input matInput placeholder="Specify Ownership" formControlName="other_ownership" autocomplete="off">
</mat-form-field>
@ -103,7 +108,8 @@
<div *ngIf="addressForm.controls['address_ownership'].value == 3 " fxFlex="33">
<mat-form-field style="width: 80%;">
<input matInput placeholder="What is the monthly rent paid?" formControlName="rent_amt" autocomplete="off">
<input matInput placeholder="What is the monthly rent paid?" formControlName="rent_amt" autocomplete="off" (keypress)="keyPress($event)" (keyup)="inWords($event,'')">
<mat-hint align="start" style="font-size:70%" *ngIf="addressForm.controls['rent_amt'].value != ''">{{"&#8377;"}} {{rentAmtInwords}} Only</mat-hint>
</mat-form-field>
</div>
@ -119,17 +125,36 @@
<input matInput autocomplete="off" placeholder="Month(s)" formControlName="business_month" (keypress)="keyPress($event)" (change)="ConvertMonthintoYear($event.target.value)">
</mat-form-field>
</div>
</div>
<div fxLayout="row wrap">
<div fxFlex="68">
<mat-form-field style="width: 95%;">
<mat-select [placeholder]="placeholderName"
formControlName="other_premises_bussiness_activity" required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
</div>
<div fxFlex="32">
<mat-form-field *ngIf="addressForm.controls['other_premises_bussiness_activity'].value != ''" style="width: 80%;">
<input matInput autocomplete="off" placeholder="Remark" formControlName="bussiness_activity_remark">
</mat-form-field>
</div>
</div>
<div fxLayout="row wrap">
<div fxFlex="100">
<mat-form-field style="width: 80%;">
<!-- <mat-select placeholder="Is there any other premises from which business activity is being run?"-->
<mat-select placeholder="Was any business activity seen at the (Address Type) seen during PD visit?"
formControlName="bussiness_activity" required>
<mat-form-field style="width: 95%;">
<!--placeholder="Was any business activity seen at the (Address Type) seen during PD visit?"-->
<mat-select placeholder="Is there any other premises from which business activity is being run?" formControlName="bussiness_activity" required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</div>
@ -209,7 +234,8 @@
<input matInput placeholder="Specify Ownership" formControlName="premises_ownership_others" autocomplete="off">
</mat-form-field>
<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" autocomplete="off">
<input matInput placeholder="What is the monthly rent paid?" formControlName="premises_rent_amt" autocomplete="off" (keypress)="keyPress($event)" (keyup)="inWords($event,i)">
<mat-hint align="start" style="font-size:70%" *ngIf="item.get('premises_rent_amt').value != ''">{{"&#8377;"}} {{premisesRentAmtInwords[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 40%">
<input matInput placeholder="Remarks"

View File

@ -57,7 +57,10 @@ export class AddressComponent implements OnInit {
formPremisesCityArray: any = [];
additional_premises: any=[];
bussiness_address_type: any=[];
premisesRentAmtInwords:any=[];
rentAmtInwords:any;
tempArr: any[];
placeholderName : any = 'Was any business activity seen at the Address Type during PD visit?';
//neighbourStatusData:any=["Yes","No"];
//applicantOwnerData:any=["Yes","No","Dont Know"];
@ -69,10 +72,13 @@ export class AddressComponent implements OnInit {
public locality: AbstractControl;
public pdLocation: AbstractControl;
public commentlocality: AbstractControl;
public other_comment_locality: AbstractControl;
public customerBehaviour: AbstractControl;
public ownership: AbstractControl;
public other_ownership: AbstractControl;
public rent_amt : AbstractControl;
public other_premises_bussiness_activity : AbstractControl;
public bussiness_activity_remark: AbstractControl;
public bussinessActivity: AbstractControl;
public business_years: AbstractControl;
public business_month: AbstractControl;
@ -118,11 +124,15 @@ export class AddressComponent implements OnInit {
this.addressForm.controls.address.setValue(data.records.address);
this.addressForm.controls.pd_location.setValue(data.records.pd_location);
this.addressForm.controls.address_type.setValue(data.records.address_type);
this.selectedAddressType(data.records.address_type);
if(data.records.address_type == 12) {
this.addressForm.controls.address_type_others.setValue(data.records.address_type_others);
this.selectedAddressType(data.records.address_type_others);
}
this.addressForm.controls.comment_locality.setValue(data.records.comment_locality);
if(data.records.comment_locality == 10){
this.addressForm.controls.other_comment_locality.setValue(data.records.other_comment_locality);
}
// this.addressForm.controls.customer_behaviour.setValue(data.records.customer_behaviour);
this.addressForm.controls.locality.setValue(data.records.locality);
if(data.records.locality == 7 ){
@ -132,6 +142,16 @@ export class AddressComponent implements OnInit {
this.addressForm.controls.address_ownership.setValue(data.records.address_ownership);
this.addressForm.controls.other_ownership.setValue(data.records.other_ownership);
this.addressForm.controls.rent_amt.setValue(data.records.rent_amt);
if(data.records.rent_amt != ''){
this.rentAmtInwords = this._pd.convertNumberToWords(data.records.rent_amt);
}
this.addressForm.controls.other_premises_bussiness_activity.setValue(data.records.other_premises_bussiness_activity);
if(data.records.other_premises_bussiness_activity != '' && data.records.other_premises_bussiness_activity !=null) {
this.addressForm.controls.bussiness_activity_remark.setValue(data.records.other_premises_bussiness_activity);
}
else{
this.addressForm.controls.bussiness_activity_remark.setValue('');
}
this.addressForm.controls.bussiness_activity.setValue(data.records.bussiness_activity);
if(data.records.bussiness_activity == 'yes' && data.records.bussiness_address_type !=null) {
@ -152,7 +172,13 @@ export class AddressComponent implements OnInit {
})
}
this.additional_premises.forEach((item,index)=>
{
console.log(item);
console.log(index);
//this.premisesRentAmtInwords[index] = this._pd.convertNumberToWords(item.premises_rent_amt);
});
this.selectedValue(this.bussiness_address_type,this.additional_premises);
if (data.records.locality_others) {
this.addressForm.controls.locality_others.setValue(data.records.locality_others);
@ -181,12 +207,15 @@ export class AddressComponent implements OnInit {
locality_others: [''],
pd_location: ['', Validators.compose([Validators.required])],
comment_locality: ['', Validators.compose([Validators.required])],
other_comment_locality : [''],
//customer_behaviour: ['', Validators.compose([Validators.required])],
//neighbourhood: this.fb.array([]),
address_form_remark:[''],
address_ownership:[''],
other_ownership:[''],
rent_amt:[''],
other_premises_bussiness_activity : [''],
bussiness_activity_remark:[''],
bussiness_activity:[''],
business_years:[''],
business_month:[''],
@ -199,10 +228,13 @@ export class AddressComponent implements OnInit {
this.locality = this.addressForm.controls['locality'];
this.pdLocation = this.addressForm.controls['pd_location'];
this.commentlocality = this.addressForm.controls['comment_locality'];
this.other_comment_locality = this.addressForm.controls['other_comment_locality'];
//this.customerBehaviour = this.addressForm.controls['customer_behaviour'];
this.ownership = this.addressForm.controls['address_ownership'];
this.other_ownership = this.addressForm.controls['other_ownership'];
this.rent_amt = this.addressForm.controls['rent_amt'];
this.other_premises_bussiness_activity = this.addressForm.controls['other_premises_bussiness_activity'],
this.bussiness_activity_remark = this.addressForm.controls['bussiness_activity_remark'],
this.bussinessActivity = this.addressForm.controls['bussiness_activity'];
this.business_years = this.addressForm.controls['business_years'];
this.business_month = this.addressForm.controls['business_month'];
@ -303,12 +335,15 @@ export class AddressComponent implements OnInit {
}
records.pd_location = this.pdLocation.value;
records.comment_locality = this.commentlocality.value;
records.other_comment_locality = this.other_comment_locality.value;
//records.customer_behaviour = this.commentlocality.value;
//records.neighbourhood = this.addressForm.controls.neighbourhood.value;
records.address_form_remark = this.addressForm.controls.address_form_remark.value;
records.address_ownership = this.ownership.value;
records.other_ownership = this.other_ownership.value;
records.rent_amt = this.rent_amt.value;
records.other_premises_bussiness_activity = this.other_premises_bussiness_activity.value;
records.bussiness_activity_remark = this.bussiness_activity_remark.value;
records.bussiness_activity = this.bussinessActivity.value;
records.business_years = this.business_years.value;
records.business_month = this.business_month.value;
@ -323,7 +358,7 @@ export class AddressComponent implements OnInit {
}
}
console.log('this.addressForm.controls.additional_premises.value',this.addressForm.controls.additional_premises.value);
// console.log('this.addressForm.controls.additional_premises.value',this.addressForm.controls.additional_premises.value);
this.addressForm.controls.additional_premises.value.forEach((val,index)=>
{
@ -348,7 +383,7 @@ export class AddressComponent implements OnInit {
records.formid = '5';
// records.fk_createdby = '250';
console.log(JSON.stringify(records));
// console.log(JSON.stringify(records));
this._pd.saveForm(records).subscribe(data => {
@ -364,6 +399,10 @@ export class AddressComponent implements OnInit {
// this.formPremisesCityArray.push({city: option});
// });
// }
selectedAddressType(e: any){
// console.log(e);
this.placeholderName = 'Was any business activity seen at the '+e+' during PD visit?';
}
SelectedPremises($event){
let premisesData = $event.source.value;
@ -516,4 +555,15 @@ export class AddressComponent implements OnInit {
event.preventDefault();
}
}
inWords(e,i){
console.log(e);
console.log(i);
if(i != ''){
this.premisesRentAmtInwords[i] = this._pd.convertNumberToWords(e.target.value);
}
else if(i == '' ){
this.rentAmtInwords = this._pd.convertNumberToWords(e.target.value);
}
}
}

View File

@ -551,11 +551,10 @@ public m_investmentType = [];
});
}
loadPropertyWithData(data) {
loadPropertyWithData(data) {
return this._formBuilder.group({
property_type: [data.property_type]
property_type: [data.property_type],
other_property_type: [data.other_property_type]
//property_type:['']
});
}
@ -740,28 +739,41 @@ public m_investmentType = [];
setAssetsDetailsWithData(assets_details_mode: any, datas: any, i: any): void {
let val = i;
// var data = Object.keys(datas).map(function (key) {
// let data = Object.keys(datas).map(function (key) {
// return datas[key];
// });
// alert(JSON.stringify(datas));
//alert('JSON Other Asset'+JSON.stringify(datas));
let data = datas;
const arr = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
arr.controls.splice(0);
switch (assets_details_mode) {
case '1': {
let array_data : any;
data.forEach((datas,i) => {
array_data = { 'property_type':datas.property_type,'other_property_type':datas.other_property_type };
});
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.loadPropertyWithData(data));
control.push(this.loadPropertyWithData(array_data));
break;
}
case '2': {
let array_data : any;
data.forEach((datas,i) => {
array_data = { 'manufacturer_model_four_weeler': datas.manufacturer_model_four_weeler };
});
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.load_Four_WeelerWithData(data));
control.push(this.load_Four_WeelerWithData(array_data));
break;
}
case '3': {
let array_data : any;
data.forEach((datas,i) => {
array_data = { 'manufacturer_model_two_weeler': datas.manufacturer_model_two_weeler };
});
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.load_Two_WeelerWithData(data));
control.push(this.load_Two_WeelerWithData(array_data));
break;
}
case '4': {
@ -770,34 +782,60 @@ public m_investmentType = [];
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(data));
control.push(this.loadConsumerDurableDescriptionWithData(array_data));
break;
}
case '6': {
let array_data : any;
data.forEach((datas,i) => {
this.OtherPremiumPaidInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.premium_paid);
this.OtherSumAssuredInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.sum_assured);
array_data = {
'premium_paid': datas.premium_paid,
'frequency_mode': datas.frequency_mode,
'other_frequency_mode':datas.other_frequency_mode,
'sum_assured': datas.sum_assured,
'members_coverd': datas.members_coverd
};
});
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.loadInsuranceDescriptionWithData(data));
control.push(this.loadInsuranceDescriptionWithData(array_data));
break;
}
case '7': {
let array_data : any;
data.forEach((datas,i) => {
this.OtherAmtInvestInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.amount_of_invest);
array_data = { 'investments_type': datas.investments_type,
'other_investments_type' : datas.other_investments_type,
'amount_of_invest': datas.amount_of_invest,
'bank_name': datas.bank_name };
});
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.loadInvestDescriptionWithData(data));
control.push(this.loadInvestDescriptionWithData(array_data));
break;
}
case '8': {
let array_data : any;
data.forEach((datas,i) => {
this.OtherAssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(+data.any_other_asset_value);
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,
'other_asset_emi_amt' : datas.other_asset_emi_amt
};
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;
control.push(this.otherAssetsDescriptionWithData(data));
control.push(this.otherAssetsDescriptionWithData(array_data));
break;
}
default: {
@ -807,60 +845,97 @@ public m_investmentType = [];
}
setBusinessAssetsDetailsWithData(assets_details_mode: any, datas: any, i: any): void {
console.log(datas);
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': {
let business_property_datas : any;
data.forEach((datas,i) => {
business_property_datas = { 'property_type':datas.property_type,'other_property_type':datas.other_property_type };
});
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadPropertyWithData(data));
control.push(this.loadPropertyWithData(business_property_datas));
break;
}
case '2': {
let business_Four_Weeler_datas : any;
data.forEach((datas,i) => {
business_Four_Weeler_datas = { 'manufacturer_model_four_weeler': datas.manufacturer_model_four_weeler };
});
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Four_WeelerWithData(data));
control.push(this.load_Four_WeelerWithData(business_Four_Weeler_datas));
break;
}
case '3': {
let business_Two_Weeler_datas : any;
data.forEach((datas,i) => {
business_Two_Weeler_datas = { 'manufacturer_model_two_weeler': datas.manufacturer_model_two_weeler };
});
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Two_WeelerWithData(data));
control.push(this.load_Two_WeelerWithData(business_Two_Weeler_datas));
break;
}
case '4': {
break;
}
case '5': {
let business_ConsumerDurableDescription_datas : any;
data.forEach((datas,i) => {
business_ConsumerDurableDescription_datas = { 'consumer_durable_description': datas.consumer_durable_description };
});
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadConsumerDurableDescriptionWithData(data));
control.push(this.loadConsumerDurableDescriptionWithData(business_ConsumerDurableDescription_datas));
break;
}
case '6': {
let business_InsuranceDescription_datas : any;
data.forEach((datas,i) => {
this.PremiumPaidInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.premium_paid);
this.SumAssuredInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.sum_assured);
business_InsuranceDescription_datas = {
'premium_paid': datas.premium_paid,
'frequency_mode': datas.frequency_mode,
'other_frequency_mode':datas.other_frequency_mode,
'sum_assured': datas.sum_assured,
'members_coverd': datas.members_coverd
};
});
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadInsuranceDescriptionWithData(data));
control.push(this.loadInsuranceDescriptionWithData(business_InsuranceDescription_datas));
break;
}
case '7': {
let business_InvestDescription_datas : any;
data.forEach((datas,i) => {
this.AmtInvestInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.amount_of_invest);
business_InvestDescription_datas = { 'investments_type': datas.investments_type,
'other_investments_type' : datas.other_investments_type,
'amount_of_invest': datas.amount_of_invest,
'bank_name': datas.bank_name };
});
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadInvestDescriptionWithData(data));
control.push(this.loadInvestDescriptionWithData(business_InvestDescription_datas));
break;
}
case '8': {
let array_datas : any;
data.forEach((datas,i) => {
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 = {
'any_other_assets': datas.any_other_assets,
'any_other_asset_value' : datas.any_other_asset_value,
'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 ;
control.push(this.otherBusinessAssetsDescriptionWithData(data));
control.push(this.otherBusinessAssetsDescriptionWithData(array_datas));
break;
}
default: {