From b3847536507f316e362190b97650c6a84cfefe6e Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Fri, 4 Jan 2019 13:37:14 +0530 Subject: [PATCH 1/4] asset issues : ps --- .../forms/address/address.component.html | 46 +++++-- .../forms/address/address.component.ts | 58 ++++++++- .../assets-info/assets-info.component.ts | 119 ++++++++++++++---- 3 files changed, 187 insertions(+), 36 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html index bf2770284..76ae7e05c 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html @@ -32,7 +32,7 @@
- + {{m_addressType.address_type}} @@ -42,7 +42,7 @@
- +
@@ -83,6 +83,12 @@
+
+ + + +
+
@@ -95,7 +101,6 @@
- @@ -103,7 +108,8 @@
- + + {{"₹"}} {{rentAmtInwords}} Only
@@ -119,17 +125,36 @@
+ + +
+
+ + + Yes + No + + +
+
+ + + +
+
+ +
- - - + + + Yes No
-
+ @@ -209,7 +234,8 @@ - + + {{"₹"}} {{premisesRentAmtInwords[i]}} Only + { + 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); + } + } } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts index 40db78e79..858caabfa 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts @@ -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 = (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 = (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 = (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 = (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 = (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 = (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 = (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 = (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 = (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 = (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 = (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 = (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 = (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 = (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 = (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 = (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: { From b6525281aa76fba375e08c85d0e27ea9985b9728 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 4 Jan 2019 17:20:55 +0530 Subject: [PATCH 2/4] group of business form changes --- .../assets-info/assets-info.component.html | 37 +++--- .../assets-info/assets-info.component.ts | 25 ++-- .../business-info-group.component.html | 29 +++++ .../business-info-group.component.scss | 33 ++++++ .../business-info-group.component.spec.ts | 25 ++++ .../business-info-group.component.ts | 110 ++++++++++++++++++ .../business-info.component.html | 4 +- .../business-info/business-info.component.ts | 13 ++- .../client-info/client-info.component.ts | 14 ++- .../financial-info.component.ts | 47 +------- .../start-pd/forms/stock/stock.component.html | 2 +- .../start-pd/forms/stock/stock.component.ts | 14 +-- .../supplier-info/supplier-info.component.ts | 13 ++- .../list-pd/start-pd/start-pd.component.html | 2 +- .../list-pd/start-pd/start-pd.component.ts | 3 +- .../manage-pd/manage-pd.module.ts | 7 +- .../pd-service/pd-triger.service.ts | 5 +- 17 files changed, 286 insertions(+), 97 deletions(-) create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.html create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.scss create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.spec.ts create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.ts diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html index a70160469..35a61dc4e 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html @@ -28,7 +28,7 @@
- {{ asset.name }} + {{ asset.name | titlecase }}
@@ -43,7 +43,7 @@ - {{ prop.name }} + {{ prop.name | titlecase }} @@ -107,7 +107,7 @@ - {{ freqn.name }} + {{ freqn.name | titlecase }} @@ -138,7 +138,7 @@
- {{ ins_type.name }} + {{ ins_type.name | titlecase }} @@ -175,7 +175,7 @@ - {{data.viewValue}} + {{data.viewValue | titlecase}} @@ -219,8 +219,13 @@ - - + + + {{company.company_name | titlecase}} + + +
@@ -301,7 +306,7 @@
- {{ asset.name }} + {{ asset.name | titlecase }}
@@ -314,7 +319,7 @@
- {{ prop.name }} + {{ prop.name | titlecase }} @@ -386,7 +391,7 @@ - {{ freqn.name }} + {{ freqn.name | titlecase }} @@ -418,7 +423,7 @@ - {{ ins_type.name }} + {{ ins_type.name | titlecase }} @@ -457,7 +462,7 @@ - {{owner.applicant_name}} + {{owner.applicant_name | titlecase}} @@ -470,7 +475,7 @@ - {{relations.name}} + {{relations.name | titlecase}} @@ -487,7 +492,7 @@ - {{data.viewValue}} + {{data.viewValue | titlecase}} @@ -512,7 +517,7 @@ - {{owner.applicant_name}} + {{owner.applicant_name | titlecase}} @@ -525,7 +530,7 @@ - {{relations.name}} + {{relations.name | titlecase}} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts index 40db78e79..fd418e308 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts @@ -31,7 +31,7 @@ export class AssetsInfoComponent implements OnInit { pageTitle: string ="Assets Details"; //@Input() pdid: number; pdid:string; - businessProfessionName :string; + //businessProfessionName :string; public _assetsQuesFrom: FormGroup; public submitted = false; @@ -183,6 +183,7 @@ public m_investmentType = []; // ] private notifier: NotifierService; + existCompanyList: any =[]; constructor( notifier: NotifierService, private _formBuilder: FormBuilder, @@ -216,9 +217,14 @@ public m_investmentType = []; ngOnInit() { - this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => { - this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ; - }); + // this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid,'').subscribe(data => { + // this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ; + // }); + this.pdTrigerService.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{ + if(data.dataStatus){ + this.existCompanyList = data.records.filter(val =>val.is_active); + } + }) this.getPdSupplierFormDetails(); this.getM_Assets_Type(); @@ -348,7 +354,7 @@ public m_investmentType = []; this.initDetails(), ]), business_assets_details : this._formBuilder.array([ - this.initBusinessDetails(this.businessProfessionName), + this.initBusinessDetails(), ]), assets_form_remark:[''] }); @@ -382,12 +388,12 @@ public m_investmentType = []; }); } - initBusinessDetails(data) { + initBusinessDetails() { return this._formBuilder.group({ business_assets_mode: [''], business_details: this._formBuilder.array([]), business_approximate_market_value: [''], - business_name_of_the_owner: [data], + business_name_of_the_owner: [], //other_owner:[''], //relation:[''], //purchase_year: [''], @@ -402,9 +408,6 @@ public m_investmentType = []; show: boolean; selectedAssetsType(e: any, i: any,flag : any): void { - console.log(e); - console.log(i); - console.log(flag); let val = i; if(flag == 1){ const arr = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; @@ -878,7 +881,7 @@ public m_investmentType = []; control.push(this.initDetails()); }else if(flag == 2){ const control = this._assetsQuesFrom.controls['business_assets_details']; - control.push(this.initBusinessDetails(this.businessProfessionName)); + control.push(this.initBusinessDetails()); } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.html new file mode 100644 index 000000000..a5a1581a8 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.html @@ -0,0 +1,29 @@ +

+
{{pageTitle}}
+
+ + +
+

+ + + + + {{companyList.company_name | titlecase}} + + +
+ + + {{quesIndex+1}} +
+ {{ formButton.form_name }} +
+
+
+
+
+
+ +
+ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.scss new file mode 100644 index 000000000..eb88eeecc --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.scss @@ -0,0 +1,33 @@ +.paragraph_change { + color: #fff !important; + background-color: #e00201 !important; + } + + .p-text { + color:#e00201 !important; + font-weight: bold; + } + ::ng-deep .mat-card-header-text{ + margin:0px !important; +} +.mat-purple{ + background-color: gray !important; +} + .cdk-global-overlay-wrapper{ + justify-content: center !important; +} + + $base-card-box-shadow:1.5px 2.6px 24px 0 rgba(0, 35, 136, 0.08) !important; +mat-card .child_mat_card > mat-card { + border-radius: 0px 0px 0px 15px; + box-shadow: $base-card-box-shadow; + transform: scale(0.95); + transition: box-shadow 0.5s, transform 0.5s; + &:hover { + cursor: pointer; + // background-color: #e00201 !important; + transform: scale(1); + box-shadow: 5px 20px 30px rgba(0, 0, 0, 0.2); + } + + } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.spec.ts new file mode 100644 index 000000000..ee3eb698a --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BusinessInfoGroupComponent } from './business-info-group.component'; + +describe('BusinessInfoGroupComponent', () => { + let component: BusinessInfoGroupComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ BusinessInfoGroupComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(BusinessInfoGroupComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.ts new file mode 100644 index 000000000..8e3afd45b --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info-group/business-info-group.component.ts @@ -0,0 +1,110 @@ +import { Component,OnInit,Inject,Input} from '@angular/core'; +import { NotifierService } from 'angular-notifier'; +import {MatDialog,MatDialogRef,MAT_DIALOG_DATA, MatTableDataSource} from '@angular/material'; +/** Service */ +import { PdTrigerService } from './../../../../../pd-service/pd-triger.service'; +import {ActivatedRoute, Router} from "@angular/router"; +import {SupplierInfoComponent} from './../../forms/supplier-info/supplier-info.component'; +import {ClientInfoComponent} from './../../forms/client-info/client-info.component'; +import {StockComponent} from './../../forms/stock/stock.component'; +import {FinancialInfoComponent} from './../../forms/financial-info/financial-info.component'; +import {BusinessInfoComponent} from './../../forms/business-info/business-info.component'; + +@Component({ + selector: 'app-business-info-group', + templateUrl: './business-info-group.component.html', + styleUrls: ['./business-info-group.component.scss'] +}) +export class BusinessInfoGroupComponent implements OnInit { + pageTitle: string ="Business Informations"; + existCompanyList: any = []; + pdid: number; + form_id: number; + constructor(notifier: NotifierService, + private route: ActivatedRoute, + private router: Router, + private _pd: PdTrigerService, + @Inject(MAT_DIALOG_DATA) public pd_all_details: any, private dialog: MatDialog) { + this.pdid = this.pd_all_details.pdmaster_details.pd_id; + this.form_id = 13; + } + + ngOnInit() { + this.getCompanyListForBusiness(); + } + getCompanyListForBusiness(): void{ + this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{ + if(data.dataStatus){ + this.existCompanyList = data.records.filter(val =>val.is_active); + } + }) + } + + // direct form based questions + OnSelectBusinessGroupForms(details: any, company: any) { + this.pd_all_details.company_id =company.company_order_id; + this.pd_all_details.company_name =company.company_name; + if(details.form_id==1){ + const dialogRef = this.dialog.open(SupplierInfoComponent, { + data: this.pd_all_details, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + this.getCompanyListForBusiness(); + }); + } + else if(details.form_id==2){ + const dialogRef = this.dialog.open(ClientInfoComponent, { + data: this.pd_all_details, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + this.getCompanyListForBusiness(); + }); + } + else if(details.form_id==11){ + const dialogRef = this.dialog.open(StockComponent, { + data: this.pd_all_details, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + this.getCompanyListForBusiness(); + }); + } + else if(details.form_id==13){ + const dialogRef = this.dialog.open(BusinessInfoComponent, { + data: this.pd_all_details, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + this.getCompanyListForBusiness(); + }); + } + else if(details.form_id==14){ + const dialogRef = this.dialog.open(FinancialInfoComponent, { + data: this.pd_all_details, + position: { right: '0'}, + width:'80%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + this.getCompanyListForBusiness(); + }); + } + +} + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html index 5ce935af8..eb4f59014 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html @@ -26,8 +26,8 @@ - {{company | titlecase}} - Others + {{company.company_name | titlecase}} + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts index 3bb8344ef..c83451042 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts @@ -32,8 +32,10 @@ import {DatePipe } from '@angular/common'; export class BusinessInfoComponent implements OnInit { pipe = new DatePipe('en-US'); pdid: number; + company_id: String; + company_name: String; form_id: number; - pageTitle: string ="Business Details"; + pageTitle: string ="Business Information"; relationData: any = []; companyRelationShipList: any =[]; //industryData: any = []; @@ -60,6 +62,8 @@ export class BusinessInfoComponent implements OnInit { @Inject(MAT_DIALOG_DATA) public pd_all_details: any, private dialog: MatDialog) { //this.adapter.setLocale('fr'); this.pdid = this.pd_all_details.pdmaster_details.pd_id; + this.company_id = this.pd_all_details.company_id; + this.company_name = this.pd_all_details.company_name; this.applicants = this.pd_all_details.pdapplicants_detials; this.form_id = 13; this.notifier = notifier; @@ -101,6 +105,7 @@ export class BusinessInfoComponent implements OnInit { let params: any = {}; params.pd_id = this.pdid; params.pd_form_id = this.form_id; + params.company_id = this.company_id; this._pd.retriveForm(params).subscribe(data => { let businessVal = data.records; let constVal: any; @@ -163,6 +168,7 @@ export class BusinessInfoComponent implements OnInit { businessVal.pdid = this.pdid; businessVal.formid = this.form_id; + businessVal.company_id = this.company_id; businessVal.fk_createdby = this.pdid; //businessVal.designation = DesgnArray; businessVal.partners = PartnrArray; @@ -562,8 +568,9 @@ export class BusinessInfoComponent implements OnInit { this.businessForm = this.fb.group({ pdid: this.pdid, formid: this.form_id, + company_id: this.company_id, fk_createdby: this.pdid, - profession_name: ['', Validators.compose([Validators.required])], + profession_name: [this.company_name, Validators.compose([Validators.required])], business_entity_type: ['', Validators.compose([Validators.required])], business_years: ['', Validators.compose([Validators.required])], business_month: ['', Validators.compose([Validators.required])], @@ -1266,7 +1273,7 @@ export class BusinessInfoComponent implements OnInit { getCompanyListForBusiness(): void{ this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{ if(data.dataStatus){ - this.existCompanyList = data.records; + this.existCompanyList = data.records.filter(val =>val.is_active && val.company_order_id==this.company_id); } }) } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts index 913f9c583..e8fc68ee6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts @@ -35,7 +35,7 @@ export class ClientInfoComponent implements OnInit { //@Input() pdid: number; pdid: string; form_id: number; - + company_id: string; public _supplierQuesFrom: FormGroup; public submitted = false; @@ -78,6 +78,7 @@ export class ClientInfoComponent implements OnInit { @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { this.pdid = this.pd_all_details.pdmaster_details.pd_id; this.form_id = 2; + this.company_id = this.pd_all_details.company_id; this.notifier = notifier; } public viewerOptions: any = { @@ -103,8 +104,7 @@ export class ClientInfoComponent implements OnInit { noRecordsFound: Boolean = false; errorMessage: any = ''; ngOnInit() { - - this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => { + this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid,this.company_id).subscribe(data => { if(data.dataStatus){ // let datas = { // "profession_name": "Others", @@ -151,7 +151,11 @@ export class ClientInfoComponent implements OnInit { retaildTradingForm: Boolean = false; initFormLoadDetails(record) { - this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '2').subscribe( + let params: any = {}; + params.pd_id = this.pdid; + params.pd_form_id = this.form_id; + params.company_id = this.company_id; + this.pdTrigerService.retriveForm(params).subscribe( data => { if (data.dataStatus) { let dataForm = data.records; @@ -159,6 +163,7 @@ export class ClientInfoComponent implements OnInit { this._supplierQuesFrom = this._formBuilder.group({ pdid: [this.pdid], formid: ['2'], + company_id:[this.company_id], manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]), @@ -244,6 +249,7 @@ export class ClientInfoComponent implements OnInit { this._supplierQuesFrom = this._formBuilder.group({ pdid: [this.pdid], formid: ['2'], + company_id:[this.company_id], manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]), diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts index 11e24e847..8858a3f4f 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts @@ -33,6 +33,7 @@ export class FinancialInfoComponent implements OnInit { pageTitle: string ="Financial Information"; pdid: string; form_id: number; + company_id: string; public financialForm: FormGroup; private notifier: NotifierService; SalesStatement : any = []; @@ -57,6 +58,7 @@ export class FinancialInfoComponent implements OnInit { @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { this.pdid = this.pd_all_details.pdmaster_details.pd_id; this.form_id = 14; + this.company_id =this.pd_all_details.company_id; this.notifier = notifier; } public viewerOptions: any = { @@ -84,6 +86,7 @@ export class FinancialInfoComponent implements OnInit { let params: any = {}; params.pd_id = this.pdid; params.pd_form_id = this.form_id; + params.company_id = this.company_id; this._pd.retriveForm(params).subscribe(value => { const financial_date = this.financialForm.controls['date_per_financial']; const estimated_val = this.financialForm.controls['estimated_value']; @@ -110,7 +113,6 @@ export class FinancialInfoComponent implements OnInit { financial_date.push(this.createDate('')); } if (result_val.length > 0) { - console.log(result_val); result_val.forEach((val,index) => { //console.log('dedrf',val.estimate_annual_sale); this.AV_annualSalesInwords[index] = this._pd.convertNumberToWords(val.estimate_annual_sale); @@ -124,6 +126,7 @@ export class FinancialInfoComponent implements OnInit { } retriveData.pdid = this.pdid; retriveData.formid = this.form_id; + retriveData.company_id = this.company_id; retriveData.fk_createdby = this.pdid; this.financialForm.setValue(retriveData); } else { @@ -136,6 +139,7 @@ export class FinancialInfoComponent implements OnInit { this.financialForm = this.fb.group({ pdid: this.pdid, formid: this.form_id, + company_id: this.company_id, fk_createdby: this.pdid, financial_remarks: [''], staring_financial_year : ['',Validators.compose([Validators.minLength(4),Validators.maxLength(4)])], @@ -247,7 +251,6 @@ export class FinancialInfoComponent implements OnInit { } selectedType(e: any): void { - console.log(e); if(e.value == 'yes'){ let startingYear = this.financialForm.controls['staring_financial_year'].value; let totalFinYear = this.financialForm.controls['total_financial_year'].value; @@ -260,7 +263,6 @@ export class FinancialInfoComponent implements OnInit { } if(array.length > 0 ){ - console.log(array.length); array.value.forEach((val,index)=>{ let vals = { @@ -325,32 +327,23 @@ export class FinancialInfoComponent implements OnInit { // } // } calFinAnnualSale(index,detail){ - //alert('FIn Annual Sales Data'); - console.log(index); - console.log() let annual_sale = detail.value.financial_annual_sale; if (index != 0) { let array = this.financialForm.controls['date_per_financial']; let prev_annual_sale = array.value[index-1].financial_annual_sale; let annual_sale_variation = (( annual_sale - prev_annual_sale)/prev_annual_sale) * 100 ; detail.controls.financial_annualsales_variation.setValue(annual_sale_variation.toFixed(2)); - console.log('annual sales variation in %',annual_sale_variation); } } calculateEstimationAnnualSale(index,detail){ //alert('Function Inside'); - console.log(detail); let annual_sale = detail.value.estimate_annual_sale; - console.log(annual_sale); - console.log(index); - // console.log(annual_sale); if (index != 0) { let array = this.financialForm.controls['estimated_value']; let prev_annual_sale = array.value[index-1].estimate_annual_sale; let annual_sale_variation = (( annual_sale - prev_annual_sale)/prev_annual_sale) * 100 ; detail.controls.estimate_annualsales_variation.setValue(annual_sale_variation.toFixed(2)); - console.log('estimate annual sales variation in %',annual_sale_variation); } } @@ -362,25 +355,16 @@ export class FinancialInfoComponent implements OnInit { if ( (profit != '' || loss != '') && index != 0) { let array = this.financialForm.controls['date_per_financial']; - - console.log('Profit',profit); - console.log(Math.abs(profit)); + let prev_profit = array.value[index - 1].financial_net_profit != '' ? array.value[index - 1].financial_net_profit : 0; - console.log('Profitpre',prev_profit); let prev_loss = array.value[index - 1].financial_net_loss !='' ? array.value[index - 1].financial_net_loss : 0 ; let prev_year = array.value[index - 1].financial_year; let prev_annual_sale = array.value[index-1].financial_annual_sale; - console.log('loss',loss); loss = loss != 0 ? loss * (-1) : loss; - console.log('-1 loss',loss); - console.log('pre_loss',prev_loss); prev_loss = prev_loss != 0 ? prev_loss * (-1) : prev_loss ; - console.log('-1 pre loss',prev_loss); - console.log(Math.abs(profit)); //let variation2 = ((())) let variation = (((profit != '' ? profit : loss ) - (prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? Math.abs(prev_profit) : Math.abs(prev_loss))) * 100; //console.log('console.log(Math.abs(profit));',Math.abs(variation)); - console.log(variation); // let variation ; // if(profit != ''){ // variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 * (profit != '' ? (1) : (-1)) ; @@ -395,7 +379,6 @@ export class FinancialInfoComponent implements OnInit { detail.controls.financial_variation.setValue(variation.toFixed(2)); //Increase in Sales in FY 2017-18 over sales in FY 2016-17 is 11.11% - console.log('variation in %',variation); // this.SalesStatement[index] = ( variation <= 0 ? 'Decreases ' : 'Increases ' ) + 'in Sales in FY ' + curr_year + ' Over Sales in FY '+ prev_year + ' is ' + variation.toFixed(2) + '%'; // console.log('this.SlesStatement',this.SalesStatement); @@ -437,7 +420,6 @@ export class FinancialInfoComponent implements OnInit { // } calMargin(index, detail) { - console.log('detail', detail); // let array = this.financialForm.controls['date_per_financial']; let salary = detail.value.financial_annual_sale; // let prev_annual_sale = array.value[index-1].financial_annual_sale; @@ -499,7 +481,6 @@ export class FinancialInfoComponent implements OnInit { if ( (profit != '' || loss != '') && index != 0) { let array = this.financialForm.controls['estimated_value']; - console.log(array.value[index - 1].financial_net_profit); let prev_profit = array.value[index - 1].estimate_net_profit != '' ? array.value[index - 1].estimate_net_profit : 1; let prev_loss = array.value[index - 1].estimate_net_loss !='' ? array.value[index - 1].estimate_net_loss : 1; @@ -521,9 +502,7 @@ export class FinancialInfoComponent implements OnInit { } calMarginVal(index, detail) { - console.log('Margin Estimate VAR',detail); let salary = detail.value.estimate_annual_sale; - console.log('Margin Estimate Vsalary',salary); // if (salary != '' && profit != '') { // let margin = profit / salary * 100; @@ -534,23 +513,16 @@ export class FinancialInfoComponent implements OnInit { if(detail.value.estimate_profit_or_loss == 1){ let profit = detail.value.estimate_net_profit; - console.log('if Margin Profit',profit); if (salary != '' && profit != '') { - console.log('if if Margin Estimate salary',salary); - console.log('if if Margin Profit',profit); let margin = profit / salary * 100; - console.log('margin',margin); detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2)); } } else if (detail.value.estimate_profit_or_loss == 2){ let loss = detail.value.estimate_net_loss; - console.log('else if Margin loss',loss); if (salary != '' && loss != '') { - console.log('elseif if Margin Estimate salary',salary); - console.log('alseif if Margin loss',loss); let margin = (loss / salary) * 100 * (-1); detail.controls.estimate_margin_of_loss.setValue(margin.toFixed(2)); @@ -588,7 +560,6 @@ export class FinancialInfoComponent implements OnInit { // } calProfitAndLossVal( i, detail) { - console.log(detail); let salary = detail.value.estimate_annual_sale; if(detail.value.estimate_profit_or_loss == 1){ let margin_profit = detail.value.estimate_margin_of_profit; @@ -682,9 +653,7 @@ export class FinancialInfoComponent implements OnInit { // return; // } let records = this.financialForm.value; - console.log('data', records); this._pd.saveForm(records).subscribe(data => { - console.log('data', data); this.notifier.notify('success', 'Saved Successfully.'); //this.dialogRef.close(); }, error => { @@ -715,10 +684,6 @@ export class FinancialInfoComponent implements OnInit { /** To Convert Amount into Words */ inWords(e,i,flag:number){ - - // console.log(e); - // console.log(i); - // console.log(flag); switch(flag){ case 1 : diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html index 45d918e60..949f141f1 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html @@ -527,7 +527,7 @@
- + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts index e6660afc0..494ceaf1f 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts @@ -22,6 +22,7 @@ export class StockComponent implements OnInit { pageTitle: string ="Stock Details"; pdid: number; form_id: number; + company_id: string; public stockForms: FormGroup; private notifier: NotifierService; public uomData : any = []; @@ -50,6 +51,7 @@ export class StockComponent implements OnInit { private _pd: PdTrigerService,@Inject(MAT_DIALOG_DATA) public pd_all_details: any) { this.pdid = this.pd_all_details.pdmaster_details.pd_id; this.form_id = 11; + this.company_id = this.pd_all_details.company_id this.notifier = notifier; } public viewerOptions: any = { @@ -82,7 +84,7 @@ export class StockComponent implements OnInit { // }) //this._pd.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe( - this._pd.stockFormAccess({pd_id:this.pdid}).subscribe(data => { + this._pd.stockFormAccess({pd_id:this.pdid,company_id:this.company_id}).subscribe(data => { if(data.dataStatus == true){ let datas = data.records; @@ -109,21 +111,20 @@ export class StockComponent implements OnInit { } public initstockForms(record){ - console.log(record); let params: any = {}; params.pd_id = this.pdid; params.pd_form_id = this.form_id; - + params.company_id = this.company_id; this._pd.retriveForm(params).subscribe(value => { if (value.status == 200) { let dataForm = value.records; if(dataForm !== undefined) { - console.log(dataForm); this.stockForms = this.fb.group({ pdid: [this.pdid], formid: [this.form_id], + company_id: [this.company_id], stock_remarks: [''], manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]), retail_details : this.fb.array([this.retailFormCreation(record)]), @@ -131,7 +132,6 @@ export class StockComponent implements OnInit { }); let arr = record.filter(data => data.type_of_activity_id == 1); - console.log(133,arr.length); if(arr.length > 0) { // console.log(1,dataForm); // console.log(164,dataForm.manufacturing_details); @@ -257,6 +257,7 @@ export class StockComponent implements OnInit { this.stockForms = this.fb.group({ pdid: [this.pdid], formid: [this.form_id], + company_id: [this.company_id], stock_remarks: [''], manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]), retail_details : this.fb.array([this.retailFormCreation(record)]), @@ -320,11 +321,8 @@ export class StockComponent implements OnInit { manufacturingForm: Boolean = false; manufacturingFormCreation(record) { - console.log(record); let arr = record.filter(data => data.type_of_activity_id == 1); - console.log(arr); if (arr.length > 0) { - console.log(arr.length); this.manufacturingForm = true; return this.fb.group({ manufacturing_raw_materials: this.fb.array([]), diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts index 4b328836f..62520e33b 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts @@ -37,7 +37,7 @@ export class SupplierInfoComponent implements OnInit { //@Input() pdid: number; pdid: string; form_id: number; - + company_id: string; public _supplierQuesFrom: FormGroup; public submitted = false; @@ -51,6 +51,7 @@ export class SupplierInfoComponent implements OnInit { @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { this.pdid = this.pd_all_details.pdmaster_details.pd_id; this.form_id = 1; + this.company_id = this.pd_all_details.company_id this.notifier = notifier; } public viewerOptions: any = { @@ -76,7 +77,7 @@ export class SupplierInfoComponent implements OnInit { noRecordsFound: Boolean = false; errorMessage: any = ''; ngOnInit() { - this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => { + this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid, this.company_id).subscribe(data => { if(data.dataStatus){ // let datas = { // "profession_name": "Others", @@ -116,8 +117,12 @@ export class SupplierInfoComponent implements OnInit { serviceProviderForm: Boolean = false; initFormLoadDetails(record) { + let params: any = {}; + params.pd_id = this.pdid; + params.pd_form_id = this.form_id; + params.company_id = this.company_id; // alert(JSON.stringify(record)); - this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '1').subscribe( + this.pdTrigerService.retriveForm(params).subscribe( data => { if(data.dataStatus){ let dataForm = data.records; @@ -125,6 +130,7 @@ export class SupplierInfoComponent implements OnInit { this._supplierQuesFrom = this._formBuilder.group({ pdid: [this.pdid], formid: ['1'], + company_id: [this.company_id], manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), supplier_info_form_remark: [dataForm.supplier_info_form_remark || null] @@ -154,6 +160,7 @@ export class SupplierInfoComponent implements OnInit { this._supplierQuesFrom = this._formBuilder.group({ pdid: [this.pdid], formid: ['1'], + company_id: [this.company_id], manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), supplier_info_form_remark: [dataForm.supplier_info_form_remark || null] diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html index 17292f75b..5210ebc7e 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html @@ -26,7 +26,7 @@ {{quesIndex+1}} --> - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts index 70d19e4b3..4ae08c3ed 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts @@ -26,6 +26,7 @@ import {LoanDetailsComponent} from './forms/loan-details/loan-details.component' import {GeneralInfoComponent} from './forms/general-info/general-info.component'; import {NeighbourHoodComponent} from './forms/neighbour-hood/neighbour-hood.component'; import {FinalRemarksComponent} from './forms/final-remarks/final-remarks.component'; +import { BusinessInfoGroupComponent } from './forms/business-info-group/business-info-group.component'; @Component({ selector: 'app-start-pd', @@ -314,7 +315,7 @@ export class StartPdComponent implements OnInit, OnDestroy { }); }else if(this.selectedFormsCategory.form_id==13){ - const dialogRef = this.dialog.open(BusinessInfoComponent, { + const dialogRef = this.dialog.open(BusinessInfoGroupComponent, { data: this.pdFullDetails, position: { right: '0'}, width:'80%', diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts index 90d398715..eefb41512 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts @@ -89,6 +89,7 @@ import { FinalRemarksComponent } from './list-pd/start-pd/forms/final-remarks/fi import { BusinessOtherFamilyMemberComponent } from './list-pd/start-pd/forms/dialogue/business-other-family-member/business-other-family-member.component'; import { QcReviewComponent } from './list-pd/pd-report/qc-review/qc-review.component'; import { SharedModule } from "app/shared/shared.module"; +import { BusinessInfoGroupComponent } from './list-pd/start-pd/forms/business-info-group/business-info-group.component'; /** * Custom angular notifier options @@ -266,7 +267,7 @@ const pdCustomNotifierOptions: NotifierOptions = { // AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule, // OwlNativeDateTimeModule, // ], - declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent], + declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent], // exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent], // providers: [PdTrigerService, GetGeometricLocationService], @@ -304,13 +305,13 @@ const pdCustomNotifierOptions: NotifierOptions = { OwlNativeDateTimeModule, ], // declarations: [ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, AssetsInfoComponent], - exports: [PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, AllocationViewMoreComponent, GeneralInfoComponent, PdRequirementComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, BusinessOtherFamilyMemberComponent], + exports: [PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, AllocationViewMoreComponent, GeneralInfoComponent, PdRequirementComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, BusinessOtherFamilyMemberComponent, BusinessInfoGroupComponent], providers: [PdTrigerService, GetGeometricLocationService,{provide: MAT_DATE_LOCALE, useValue: 'en-GB'}, {provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]}, {provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS}], entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, AllocationViewMoreComponent, PersonalInfoComponent, - ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent], + ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent], }) export class ManagePdModule { diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index c7ced0d9d..42efd209c 100755 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -322,15 +322,14 @@ export class PdTrigerService { swapOlderPDReportToLatest(pdId: any): Observable { pdId.fk_createdby = this._aws.getlocale(); - alert(JSON.stringify(pdId)); return this._http.post(this.apiUrl + "swapOlderPDReportToLatest", { "records": pdId }) .pipe( catchError(this.handleError('operation', [])) ) } - getTypeofActivityForSuppliedInfoForm(pd_id: any): Observable { - return this._http.post(this.apiUrl + "getTypeOfActivetyFromBusinessForm", { "records": { "pd_id": pd_id } }) + getTypeofActivityForSuppliedInfoForm(pd_id: any,company_id:any): Observable { + return this._http.post(this.apiUrl + "getTypeOfActivetyFromBusinessForm", { "records": { "pd_id": pd_id,"company_id":company_id } }) .pipe( catchError(this.handleError('operation', [])) ) From 8b3d9f6e8d92aa4039f64c6953e30ea0983bde2c Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Sat, 5 Jan 2019 11:50:49 +0530 Subject: [PATCH 3/4] loan details changes --- .../loan-details/loan-details.component.html | 8 ++--- .../loan-details/loan-details.component.ts | 31 +++++-------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html index 6002270aa..be93ee4b2 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html @@ -139,7 +139,7 @@
-

Mortgage

+

Details of Property being Mortgaged

@@ -185,10 +185,10 @@ - + + + + + + Person Relationship + + + + + Name + + + {{details.value.applicant_name | titlecase}} + + + + Relation + + + + Select + {{member.name + ' of' | titlecase}} + Not Applicable + + + + + + Relationship To + + + + Select + {{appc.applicant_name | titlecase}} + Not Applicable + + + + + + + + + + + + + + + + + + Company/Firm Relationship + + + + + + + + + Applicant + + + + {{appc.applicant_name | titlecase}} + + + + + + Relation + + + Select + + {{comrelShip.name + ' of' | titlecase}} + + Not Applicable + + + + + + Company + + + + Select + + {{comp.company_name | titlecase}} + + Not Applicable + + + + + + + + + + + + + + + + + + -
+ + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.scss old mode 100755 new mode 100644 diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.spec.ts old mode 100755 new mode 100644 diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts old mode 100755 new mode 100644 index 4461cf6b4..59f119594 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts @@ -15,10 +15,16 @@ export class GeneralInfoComponent implements OnInit { pageTitle: string ="General Information"; pdid : string; form_id:number; + is_new : boolean; + count : number = 1; private notifier: NotifierService; public _generalForm: FormGroup; displayedColumns = ['applicant_name','is_person_met','is_applicant']; public individualsSource= new MatTableDataSource(); + public relationSource= new MatTableDataSource(); + public CompanySource = new MatTableDataSource(); + secondDisplayedColumns = ['applicant_name','relation','relation_to']; + thridDisplayedColumns = ['applicant_name','company_relationship','relation_to_company']; public pd_applicants_details: any; relationShipList:any=[]; companyRelationShipList:any=[]; @@ -51,6 +57,19 @@ export class GeneralInfoComponent implements OnInit { let control = this._generalForm.controls['companies']; this.companyList = control.value.filter(element =>element.company_name && element.is_active); }); + + this._generalForm.controls['persons_with_relationships'].valueChanges.subscribe(val=>{ + let control = this._generalForm.controls['persons_with_relationships']; + this.relationSource.data =control.controls; + //this.individualsList = control.value.filter(element =>element.is_applicant===true); + }); + + // change relation with businees update dat sorce table + this._generalForm.controls['company_with_relationships'].valueChanges.subscribe(val=>{ + let ComapnyControl = this._generalForm.controls['company_with_relationships']; + this.CompanySource .data =ComapnyControl.controls; + }); + } // init form @@ -58,11 +77,13 @@ export class GeneralInfoComponent implements OnInit { this._generalForm = this._fb.group({ pdid:this.pdid, formid:this.form_id, - applicant_relation: this._fb.array([]), + //applicant_relation: this._fb.array([]), individuals: this._fb.array([]), companies: this._fb.array([]), + persons_with_relationships: this._fb.array([]), + company_with_relationships: this._fb.array([]), general_remark:'' - }); + }) this.loadFormData(); } // get all master details @@ -72,10 +93,12 @@ export class GeneralInfoComponent implements OnInit { if (data.status == 200) { if(type==1){ this.relationShipList=data.records.filter(item => item.isactive == 1); - this.relationShipList.push({'relationship_id':"0",'name':'Others'}); + + //this.relationShipList.push({'relationship_id':"0",'name':'Not Applicable'}); } if(type==2){ this.companyRelationShipList=data.records.filter(item => item.isactive == 1); + this.companyRelationShipList=data.records.filter(item => item.name != 'Others'); } } @@ -89,13 +112,18 @@ export class GeneralInfoComponent implements OnInit { params.pd_form_id = '18'; let individualsControl = this._generalForm.controls['individuals']; let companyControl = this._generalForm.get('companies') as FormArray; - let relationControl = this._generalForm.controls['applicant_relation']; + //let relationControl = this._generalForm.controls['applicant_relation']; + let personsWithRelationshipsControl = this._generalForm.controls['persons_with_relationships']; + let companyWithRelationshipsControl = this._generalForm.controls['company_with_relationships']; individualsControl.controls = []; - relationControl.controls = []; + //relationControl.controls = []; companyControl.controls = []; + personsWithRelationshipsControl.controls = []; let exist_individuals:any; let exist_companies:any; let exist_relation:any; + let exist_personsWithRelationships:any; + let exist_companyWithRelationships:any; this._pd.retriveForm(params).subscribe(data => { if(data.dataStatus) { this._generalForm.controls['general_remark'].setValue(data.records.general_remark ? data.records.general_remark : ''); @@ -110,6 +138,30 @@ export class GeneralInfoComponent implements OnInit { individualsControl.push(this.createIndividulas(element)) }); } + + // create persons with relationships + exist_personsWithRelationships=Object.keys(data.records.persons_with_relationships).map(function(key) { + return data.records.persons_with_relationships[key]; + }); + + if(exist_personsWithRelationships.length>0){ + exist_personsWithRelationships.forEach(element => { + //individualsControl.push(this.createIndividulas(element)) + personsWithRelationshipsControl.push(this.createPersonsWithRelationships(element)); + }); + } + + exist_companyWithRelationships=Object.keys(data.records.company_with_relationships).map(function(key) { + return data.records.company_with_relationships[key]; + }); + + if(exist_companyWithRelationships.length>0){ + exist_companyWithRelationships.forEach(element => { + //individualsControl.push(this.createIndividulas(element)) + companyWithRelationshipsControl.push(this.createCompaniesRelationshipWithData(element)); + }); + } + // create companies exist_companies = Object.keys(data.records.companies).map(function(key) { return data.records.companies[key]; @@ -127,37 +179,39 @@ export class GeneralInfoComponent implements OnInit { } // create relations - exist_relation = Object.keys(data.records.applicant_relation).map(function(key) { - return data.records.applicant_relation[key]; - }); - if(exist_relation.length>0){ - exist_relation.forEach((element,index) => { - relationControl.push(this.createApplicantRelation(element)); - let innerrelControl:any = relationControl.controls[index].get('multiple_relation') as FormArray; - element.multiple_relation.forEach((innereElement) => { - innerrelControl.push(this.createMultipleRelation(innereElement)); - }); - let innercomrelControl:any = relationControl.controls[index].get('multiple_company_relation') as FormArray; - element.multiple_company_relation.forEach((innerecomElement) => { - innercomrelControl.push(this.createMultipleCompanyRelation(innerecomElement)); - }); - }); - } + // exist_relation = Object.keys(data.records.applicant_relation).map(function(key) { + // return data.records.applicant_relation[key]; + // }); + // if(exist_relation.length>0){ + // exist_relation.forEach((element,index) => { + // relationControl.push(this.createApplicantRelation(element)); + // let innerrelControl:any = relationControl.controls[index].get('multiple_relation') as FormArray; + // element.multiple_relation.forEach((innereElement) => { + // innerrelControl.push(this.createMultipleRelation(innereElement)); + // }); + // let innercomrelControl:any = relationControl.controls[index].get('multiple_company_relation') as FormArray; + // element.multiple_company_relation.forEach((innerecomElement) => { + // innercomrelControl.push(this.createMultipleCompanyRelation(innerecomElement)); + // }); + // }); + // } } else { this.pd_applicants_details.forEach((element,key) => { element.is_applicant=true; element.is_person_met=false; + element.is_new=false; element.individuals_order_id = key+1 individualsControl.push(this.createIndividulas(element)); - let relationControl = this._generalForm.controls['applicant_relation']; - let applicant_details: any= {'pd_co_applicant_id':element.pd_co_applicant_id,'applicant_name':element.applicant_name, 'individula_order_id':relationControl.controls.length+1}; - relationControl.push(this.createApplicantRelation(applicant_details)); - let mulRelationControl = relationControl.controls[relationControl.controls.length-1].get('multiple_relation'); - mulRelationControl.push(this.createMultipleRelation(applicant_details)) - let mulCmyRelationControl = relationControl.controls[relationControl.controls.length-1].get('multiple_company_relation'); - mulCmyRelationControl.push(this.createMultipleCompanyRelation(applicant_details)) + personsWithRelationshipsControl.push(this.createPersonsWithRelationships(element)); + //let relationControl = this._generalForm.controls['applicant_relation']; + // let applicant_details: any= {'pd_co_applicant_id':element.pd_co_applicant_id,'applicant_name':element.applicant_name, 'individula_order_id':relationControl.controls.length+1}; + // relationControl.push(this.createApplicantRelation(applicant_details)); + // let mulRelationControl = relationControl.controls[relationControl.controls.length-1].get('multiple_relation'); + // mulRelationControl.push(this.createMultipleRelation(applicant_details)) + // let mulCmyRelationControl = relationControl.controls[relationControl.controls.length-1].get('multiple_company_relation'); + // mulCmyRelationControl.push(this.createMultipleCompanyRelation(applicant_details)) // create companies if(element.company_name!='' && element.company_name!=null){ @@ -182,9 +236,17 @@ export class GeneralInfoComponent implements OnInit { applicant_name: [elementValue.applicant_name], is_applicant:[elementValue.is_applicant], is_person_met:[elementValue.is_person_met], + is_new:[elementValue.is_new], individuals_order_id: [elementValue.individuals_order_id], }); } + createPersonsWithRelationships(elementValue:any){ + return this._fb.group({ + applicant_name: [elementValue.applicant_name], + relationship:[elementValue.relationship], + relation_to:[elementValue.relation_to], + }); + } // create companies createCompanies(elementValue:any) { return this._fb.group({ @@ -194,6 +256,46 @@ export class GeneralInfoComponent implements OnInit { }); } + // createCompaniesRelationship(elementValue:any) { + // return this._fb.group({ + // applicant_name:[elementValue.applicant_name], + // company_relationship:[elementValue.company_relationship], + // relation_to_company:[elementValue.relation_to_company] + // }); + // } + + createCompaniesRelationship() { + return this._fb.group({ + applicant_name:[''], + company_relationship:[''], + relation_to_company:[''] + }); + } + + createCompaniesRelationshipWithData(elementValue:any) { + return this._fb.group({ + applicant_name:[elementValue.applicant_name], + company_relationship:[elementValue.company_relationship], + relation_to_company:[elementValue.relation_to_company] + }); + } + + // open other family family member details + addCompanyRelationshipDialogue() { + let control: any = this._generalForm.get('company_with_relationships') as FormArray; + //let setValues: any = { applicant_name:'', company_relationship:'',relation_to_company:''}; + control.push(this.createCompaniesRelationship()) + } + + // remove other famil membre + removeCompanyRelationship(indexValues){ + let control: any = this._generalForm.get('company_with_relationships') as FormArray; + control.removeAt(indexValues); + // control.controls[indexValues].controls.company_name.clearValidators(); + // control.controls[indexValues].controls.company_name.updateValueAndValidity(); + //control.removeAt(indexValues); + } + // add more companies addMoreCompanies() { let control: any = this._generalForm.get('companies') as FormArray; @@ -203,6 +305,8 @@ export class GeneralInfoComponent implements OnInit { // remove companies removeCompanies(indexValues) { + this.count = this.count-1; + console.log('removed Count',this.count); let control: any = this._generalForm.get('companies') as FormArray; control.controls[indexValues].controls.is_active.setValue(false); control.controls[indexValues].controls.company_name.clearValidators(); @@ -279,6 +383,7 @@ export class GeneralInfoComponent implements OnInit { // add more individuals details addMoreIndividuals() { + console.log('Initial Count',this.count); const dialogRef = this.dialog.open(OtherApplicantDetailsComponent, { data: '', width:'40%', @@ -287,17 +392,27 @@ export class GeneralInfoComponent implements OnInit { dialogRef.afterClosed() .subscribe(dataresult => { if(dataresult.data.length>0){ - dataresult.data.forEach(element => { + dataresult.data.forEach((element,index) => { + console.log('Foreach Entry Count',this.count); let individualsControl = this._generalForm.controls['individuals']; + element.pd_co_applicant_id = this.count; + this.count = this.count+1; element.individuals_order_id = individualsControl.controls.length+1; + element.is_new=true; individualsControl.push(this.createIndividulas(element)); - let relationControl = this._generalForm.controls['applicant_relation']; - let applicant_details: any= {'pd_co_applicant_id':element.pd_co_applicant_id,'applicant_name':element.applicant_name,'applicant_relation_to':'','relation':'','other_relation':'','company_name':'','company_relation':'','company_other_relation':'','individuals_order_id':element.individuals_order_id}; - relationControl.push(this.createApplicantRelation(applicant_details)); - let mulRelationControl = relationControl.controls[relationControl.controls.length-1].get('multiple_relation'); - mulRelationControl.push(this.createMultipleRelation(applicant_details)) - let mulCmyRelationControl = relationControl.controls[relationControl.controls.length-1].get('multiple_company_relation'); - mulCmyRelationControl.push(this.createMultipleCompanyRelation(applicant_details)) + console.log('Foreach Entry Count with Incremented',this.count); + console.log('Final Count',this.count); + let relationControl = this._generalForm.controls['persons_with_relationships']; + let applicant_details: any= {'applicant_name':element.applicant_name,'relationship':'','relation_to':''}; + relationControl.push(this.createPersonsWithRelationships(applicant_details)); + + // let relationControl2 = this._generalForm.controls['applicant_relation']; + // let applicant_details2: any= {'pd_co_applicant_id':element.pd_co_applicant_id,'applicant_name':element.applicant_name,'applicant_relation_to':'','relation':'','other_relation':'','company_name':'','company_relation':'','company_other_relation':'','individuals_order_id':element.individuals_order_id}; + // relationControl2.push(this.createApplicantRelation(applicant_details2)); + // let mulRelationControl = relationControl.controls[relationControl.controls.length-1].get('multiple_relation'); + // mulRelationControl.push(this.createMultipleRelation(applicant_details)) + // let mulCmyRelationControl = relationControl.controls[relationControl.controls.length-1].get('multiple_company_relation'); + // mulCmyRelationControl.push(this.createMultipleCompanyRelation(applicant_details)) }); } @@ -314,21 +429,26 @@ export class GeneralInfoComponent implements OnInit { // submit form details submitGeneralForm(formData:any) { if (this._generalForm.invalid) { + console.log('if',this._generalForm.value); this.validateAllFormFields(this._generalForm); return; } - else if(formData.applicant_relation.length==0){ - this.notifier.notify('warning', 'Please Choose Name of Person Met.!'); - - } + // else if(formData.applicant_relation.length==0){ + // console.log('else if',this._generalForm.value); + // this.notifier.notify('warning', 'Please Choose Name of Person Met.!'); + // } else{ + console.log('else',this._generalForm.value); let saveRecords:any = {} saveRecords.pdid=formData.pdid; saveRecords.formid=formData.formid; saveRecords.individuals=formData.individuals; saveRecords.companies=formData.companies; - saveRecords.applicant_relation=formData.applicant_relation; + saveRecords.persons_with_relationships=formData.persons_with_relationships; + saveRecords.company_with_relationships=formData.company_with_relationships; + //saveRecords.applicant_relation=formData.applicant_relation; saveRecords.general_remark=formData.general_remark; + //console.log(saveRecords); this._pd.savePDFormDetailsWithID(saveRecords).subscribe( dataresult => { if (dataresult.status == 200) { @@ -345,12 +465,7 @@ export class GeneralInfoComponent implements OnInit { }); } } - selectedApplicant(e,applicant_name){ - console.log(e); - console.log(e.value); - console.log(e.viewValue); - console.log(applicant_name); - } + // selectedfrequency(e,i){ // switch(+e){ // case 1: this.placeholderName[i] = 'Weekly Instalment Amount'; break;