From 1fff549130f6c87573a57fce3dfbe5efa53619ae Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Mon, 11 Mar 2019 19:54:15 +0530 Subject: [PATCH] forms : ps --- .../forms/address/address.component.html | 7 +- .../forms/address/address.component.ts | 258 +- .../assets-info/assets-info.component.html | 888 ++--- .../assets-info/assets-info.component.ts | 740 ++-- .../banking-details.component.html | 580 +-- .../banking-details.component.ts | 346 +- .../business-assets-info.component.html | 256 +- .../business-assets-info.component.ts | 349 +- .../business-banking-details.component.html | 515 +-- .../business-banking-details.component.ts | 376 +- .../business-info.component.html | 3140 +++++++++-------- .../business-info/business-info.component.ts | 1951 +++++----- .../client-info/client-info.component.html | 434 ++- .../client-info/client-info.component.ts | 346 +- .../current-loan/current-loan.component.html | 611 ++-- .../current-loan/current-loan.component.ts | 700 ++-- .../employment-info.component.html | 628 ++-- .../employment-info.component.ts | 182 +- .../family-details.component.html | 274 +- .../family-details.component.ts | 284 +- .../final-remarks.component.html | 184 +- .../final-remarks/final-remarks.component.ts | 464 ++- .../general-info/general-info.component.html | 33 +- .../general-info/general-info.component.ts | 224 +- .../lender-representative.component.html | 377 +- .../lender-representative.component.ts | 298 +- .../loan-details/loan-details.component.html | 29 +- .../loan-details/loan-details.component.ts | 101 +- .../other-income/other-income.component.html | 480 +-- .../other-income/other-income.component.ts | 316 +- .../rental-verification.component.ts | 2 +- .../start-pd/forms/stock/stock.component.html | 897 +++-- .../start-pd/forms/stock/stock.component.ts | 1143 +++--- .../supplier-info.component.html | 317 +- .../supplier-info/supplier-info.component.ts | 573 ++- 35 files changed, 9756 insertions(+), 8547 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 dda62f45a..c6599720c 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 @@ -3,7 +3,8 @@

- {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
+ {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - + {{subproduct_abbr}}
{{pageTitle}}
@@ -138,8 +139,8 @@
- + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts index 8c0141199..9815d902d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts @@ -28,7 +28,7 @@ export class AddressComponent implements OnInit { main_applicant: any; pageTitle: string = "PD Address Details"; - disableAfterSubmit : boolean = false; + disableAfterSubmit: boolean = false; /**Declaration of FormField Variables */ //@Input() pdid: number; pdid: number; @@ -54,7 +54,7 @@ export class AddressComponent implements OnInit { uomData: any = []; addressesList: any = []; - otherPincodeFlag:any = []; + otherPincodeFlag: any = []; /**Declaration of FormField Variables */ private notifier: NotifierService; @@ -92,13 +92,13 @@ export class AddressComponent implements OnInit { this.CustSegAbbr = this.pd_all_details.pdmaster_details.customer_segment_abbr.substr(0, CSAbbrSearch); this.notifier = notifier; - + } /**Init Fns of the class */ ngOnInit() { this.initAddressForm(); - + this.getMasterDetails('PDLOCATIONAPPROACH', 1); this.getMasterDetails('COMMENTSONLOCALITY', 2); this.getMasterDetails('UOM', 3); @@ -113,41 +113,41 @@ export class AddressComponent implements OnInit { this._pd.retriveForm(params).subscribe(data => { const control = this.addressForm.controls['addresses']; if (data.status == 200) { - // console.log('data.records',data.records); - // console.log('data.records.addresses',data.records.addresses); - if (data.records.addresses.length == 0) { - control.push(this.createAddresses(null)); - // this.loadPDAddressesDetails(); - } else { - data.records.addresses.forEach((datas,index) => { - let obj = { - 'address': datas.address, - 'address_type': datas.address_type, - 'address_type_others': datas.address_type_others, - 'state': datas.state, - 'city': datas.city, - 'pincode': datas.pincode, - 'pincode_others': datas.pincode_others, - 'locality': datas.locality, - 'locality_others': datas.locality_others, - 'locality_mixuse': datas.locality_mixuse, - 'pd_location': datas.pd_location, - 'comment_locality': datas.comment_locality, - 'estimated_area': datas.estimated_area, - 'uom': datas.uom, - 'uom_others': datas.uom_others - } - this.getCityAndPincodeDetails(datas.state,index); - this.getOtherPincode(datas.pincode,index); - let selectedAddressType = this.addressData.filter(element => element.address_type_id == datas.address_type)[0]; - this.selectedAddressType(selectedAddressType.address_type,index); - if (datas.address_type == 1) { - this.selectedAddressType(datas.address_type_others,index); - } - control.push(this.createAddresses(obj)); - }); + // console.log('data.records',data.records); + // console.log('data.records.addresses',data.records.addresses); + if (data.records.addresses.length == 0) { + control.push(this.createAddresses(null)); + // this.loadPDAddressesDetails(); + } else { + data.records.addresses.forEach((datas, index) => { + let obj = { + 'address': datas.address, + 'address_type': datas.address_type, + 'address_type_others': datas.address_type_others, + 'state': datas.state, + 'city': datas.city, + 'pincode': datas.pincode, + 'pincode_others': datas.pincode_others, + 'locality': datas.locality, + 'locality_others': datas.locality_others, + 'locality_mixuse': datas.locality_mixuse, + 'pd_location': datas.pd_location, + 'comment_locality': datas.comment_locality, + 'estimated_area': datas.estimated_area, + 'uom': datas.uom, + 'uom_others': datas.uom_others } - + this.getCityAndPincodeDetails(datas.state, index); + this.getOtherPincode(datas.pincode, index); + let selectedAddressType = this.addressData.filter(element => element.address_type_id == datas.address_type)[0]; + this.selectedAddressType(selectedAddressType.address_type, index); + if (datas.address_type == 1) { + this.selectedAddressType(datas.address_type_others, index); + } + control.push(this.createAddresses(obj)); + }); + } + // this.addressForm.controls.address.setValue(data.records.address); // this.addressForm.controls.state.setValue(data.records.state); @@ -201,8 +201,8 @@ export class AddressComponent implements OnInit { this.addressForm.controls.address_form_remark.setValue(data.records.address_form_remark); } - else{ - this.loadPDAddressesDetails(); + else { + this.loadPDAddressesDetails(); } // else { // control.push(this.createAddresses(null)); @@ -210,45 +210,45 @@ export class AddressComponent implements OnInit { }); } - loadPDAddressesDetails(){ + loadPDAddressesDetails() { const control = this.addressForm.controls['addresses']; this._pd.getAddressesDetails(this.pdid).subscribe( data => { - if (data.status == 200) { - this.addressesList = data.records.filter(item => item.isactive == 1); - // console.log('this.addressesList',this.addressesList); - - if (this.addressesList.length > 0) { - this.addressesList.forEach((val,index)=>{ - let obj = { - 'address': val.addressline1, - 'address_type': '', - 'address_type_others': '', - 'state': val.fk_state, - 'city': val.fk_city, - 'pincode': val.pincode_id, - 'pincode_others': val.other_pincode, - 'locality': '', - 'locality_others': '', - 'locality_mixuse': '', - 'pd_location': '', - 'comment_locality': '', - 'estimated_area': '', - 'uom': '', - 'uom_others': '' + if (data.status == 200) { + this.addressesList = data.records.filter(item => item.isactive == 1); + // console.log('this.addressesList',this.addressesList); + + if (this.addressesList.length > 0) { + this.addressesList.forEach((val, index) => { + let obj = { + 'address': val.addressline1, + 'address_type': '', + 'address_type_others': '', + 'state': val.fk_state, + 'city': val.fk_city, + 'pincode': val.pincode_id, + 'pincode_others': val.other_pincode, + 'locality': '', + 'locality_others': '', + 'locality_mixuse': '', + 'pd_location': '', + 'comment_locality': '', + 'estimated_area': '', + 'uom': '', + 'uom_others': '' + } + this.getCityAndPincodeDetails(val.fk_state, index); + this.getOtherPincode(val.pincode_id, index); + control.push(this.createAddresses(obj)); + }); } - this.getCityAndPincodeDetails(val.fk_state,index); - this.getOtherPincode(val.pincode_id,index); - control.push(this.createAddresses(obj)); - }); + // else{ + // control.push(this.createAddresses(null)); + // } } - // else{ - // control.push(this.createAddresses(null)); - // } - } - // else{ - // control.push(this.createAddresses(null)); - // } + // else{ + // control.push(this.createAddresses(null)); + // } }); } // getM_Address_Type() { @@ -282,58 +282,58 @@ export class AddressComponent implements OnInit { // this.uom = this.addressForm.controls['uom']; } -/** FOR Adress */ -createAddresses(AddressDetails): FormGroup { - if(AddressDetails != null){ - return this.fb.group({ - address: [AddressDetails.address, Validators.compose([Validators.required])], - address_type: [AddressDetails.address_type, Validators.compose([Validators.required])], - address_type_others: [AddressDetails.address_type_others], - state: [AddressDetails.state], - city: [AddressDetails.city], - pincode: [AddressDetails.pincode],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */ - pincode_others: [AddressDetails.pincode_others, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])], - locality: [AddressDetails.locality, Validators.compose([Validators.required])], - locality_others: [AddressDetails.locality_others], - locality_mixuse: [AddressDetails.locality_mixuse], - pd_location: [AddressDetails.pd_location, Validators.compose([Validators.required])], - comment_locality: [AddressDetails.comment_locality, Validators.compose([Validators.required])], - estimated_area: [AddressDetails.estimated_area], - uom: [AddressDetails.uom], - uom_others: [AddressDetails.uom_others] - }); + /** FOR Adress */ + createAddresses(AddressDetails): FormGroup { + if (AddressDetails != null) { + return this.fb.group({ + address: [AddressDetails.address, Validators.compose([Validators.required])], + address_type: [AddressDetails.address_type, Validators.compose([Validators.required])], + address_type_others: [AddressDetails.address_type_others], + state: [AddressDetails.state], + city: [AddressDetails.city], + pincode: [AddressDetails.pincode],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */ + pincode_others: [AddressDetails.pincode_others, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])], + locality: [AddressDetails.locality, Validators.compose([Validators.required])], + locality_others: [AddressDetails.locality_others], + locality_mixuse: [AddressDetails.locality_mixuse], + pd_location: [AddressDetails.pd_location, Validators.compose([Validators.required])], + comment_locality: [AddressDetails.comment_locality, Validators.compose([Validators.required])], + estimated_area: [AddressDetails.estimated_area], + uom: [AddressDetails.uom], + uom_others: [AddressDetails.uom_others] + }); + } + else { + return this.fb.group({ + address: ['', Validators.compose([Validators.required])], + address_type: ['', Validators.compose([Validators.required])], + address_type_others: [''], + state: [''], + city: [''], + pincode: [''], + pincode_others: ['', Validators.compose([Validators.minLength(6), Validators.maxLength(6)])], + locality: ['', Validators.compose([Validators.required])], + locality_others: [''], + locality_mixuse: [''], + pd_location: ['', Validators.compose([Validators.required])], + comment_locality: ['', Validators.compose([Validators.required])], + estimated_area: [''], + uom: [''], + uom_others: [''] + }); + } } - else{ - return this.fb.group({ - address: ['', Validators.compose([Validators.required])], - address_type: ['', Validators.compose([Validators.required])], - address_type_others: [''], - state: [''], - city: [''], - pincode: [''], - pincode_others: ['', Validators.compose([Validators.minLength(6), Validators.maxLength(6)])], - locality: ['', Validators.compose([Validators.required])], - locality_others: [''], - locality_mixuse: [''], - pd_location: ['', Validators.compose([Validators.required])], - comment_locality: ['', Validators.compose([Validators.required])], - estimated_area: [''], - uom: [''], - uom_others: [''] - }); - } -} -// addAddresses() { -// const address_control = this.addressForm.controls['addresses']; -// address_control.push(this.createAddresses(null)); -// } + // addAddresses() { + // const address_control = this.addressForm.controls['addresses']; + // address_control.push(this.createAddresses(null)); + // } -// removeAddresses(index: number) { -// const address_control = this.addressForm.controls['addresses']; -// address_control.removeAt(index); -// } + // removeAddresses(index: number) { + // const address_control = this.addressForm.controls['addresses']; + // address_control.removeAt(index); + // } /** To Get Dropdown Data For Address Form */ getMasterDetails(table: string, type: number) { @@ -364,7 +364,7 @@ createAddresses(AddressDetails): FormGroup { /** To Get City And Pincode Data For Address Form * Param 'stateID' -> selected StateId */ - getCityAndPincodeDetails(stateID: string,index) { + getCityAndPincodeDetails(stateID: string, index) { this._pd.getStateWiseCities(stateID).subscribe(data => { if (data.status == 200) { this.cityData[index] = data.records.cities; @@ -373,7 +373,7 @@ createAddresses(AddressDetails): FormGroup { }); } - getOtherPincode(e,i){ this.otherPincodeFlag[i] = e == 1 ? true : false;} + getOtherPincode(e, i) { this.otherPincodeFlag[i] = e == 1 ? true : false; } /** TO Save Address Forms Details*/ onSubmit() { // let addressesArrayValues = this.addressForm.controls.addresses.value; @@ -436,7 +436,7 @@ createAddresses(AddressDetails): FormGroup { return; } - if(this.addressForm.value.bussiness_activity_remark == ''){ + if (this.addressForm.value.bussiness_activity_remark == '') { this.notifier.notify('warning', 'Fill Remark!'); this.disableAfterSubmit = false; return; @@ -471,14 +471,14 @@ createAddresses(AddressDetails): FormGroup { // records.uom = this.uom.value; // records.uom_others = records.uom == 1 ? - // this.addressForm.controls.uom_others.value : ''; + // this.addressForm.controls.uom_others.value : ''; records.pdid = this.pdid; records.formid = '5'; // records.fk_createdby = '250'; // console.log(JSON.stringify(records)); - + this._pd.saveForm(records).subscribe(data => { if (data.status == 200) { @@ -500,8 +500,8 @@ createAddresses(AddressDetails): FormGroup { /** For PlaceHolder * selected AddressType is concate with label */ - selectedAddressType(e: any,i) { - + selectedAddressType(e: any, i) { + this.placeholderName[i] = 'Estimated area of the ' + e; } 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 86650db26..982eb07bd 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 @@ -1,132 +1,147 @@
-

-
- {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
- {{pageTitle}} -
-
- -
-

+

+
+ {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - + {{subproduct_abbr}}
+ {{pageTitle}} +
+
+ +
+

- + - - - -
-
+ + + +
+
- - -
-
-
- - -
-
- - - Select - {{ asset.name }} - - -
- -
- -
-
-
-
- - - Select - {{ prop.name }} - - - - - -
-
- - - - - - -
-
- - - - - - Select - {{ uom.name }} - - - - - -
-
-
-
- -
-
-
-
- - - Select - {{ vehicle.vehicle_type_name }} - - - - - - - +
+ +
+
+
+
+ + + Select + {{ + prop.name }} + + + + + +
+
+ + + + + + +
+
+ + + + + + Select + {{ uom.name + }} + + + + + +
+
+
+
+ +
+
+
+
+ + + Select + {{ + vehicle.vehicle_type_name }} + + + + + + + - - - - - - -
-
-
-
- - -
-
-
+ + + + + - + +
+
+
+ + -
- - +
+ + - -
-
-
-
- - + - - + - -
-
-
-
- - - {{"₹"}} {{OtherPremiumPaidInwords[s]}} Only - - - - - Select - {{ freqn.name }} - - - - - -
+ +
+
+
+
+ + + {{"₹"}} + {{OtherPremiumPaidInwords[s]}} Only + + + + + Select + {{ + freqn.name }} + + + + + +
-
- - - {{"₹"}} {{OtherSumAssuredInwords[s]}} Only - +
+ + + {{"₹"}} + {{OtherSumAssuredInwords[s]}} Only + - - - + + + -
-
-
-
- - -
-
-
-
-
- - - - Select - {{ ins_type.name }} - - - - - - +
+
+
+
- - - - - - + +
+
+
+
+
- + + + Select + {{ + ins_type.name }} + + - {{"₹"}} {{OtherAmtInvestInwords[i]}} Only - - -
-
- - - - -
-
-
-
-
+ + + - -
- -
-
-
- - - -
- + + {{"₹"}} + {{OtherAmtInvestInwords[i]}} Only + + +
+
+ + + + +
+
+
+
+
+ + +
+ +
+
+
+ + + +
+ - -
-
-
-
- -
- - - {{"₹"}} {{OtherAppxMarketAmtInwords[i]}} Only - - - - +
+ + + {{"₹"}} + {{OtherAppxMarketAmtInwords[i]}} Only + + + + + - - - - - {{val.name}} - - - - + + + + {{val.name}} + + + + - - - - - + -
- - +
- + - Age of Asset in Years - - + - - + Age of Asset in Years + + - Purchase Year - - + + - - + Purchase Year + + -
- - - - Select - Yes - No - - - -
-
- - - - -
- -
-
- -
- -
- -
-
-
- - - - + + - -
-
- - - - - - - - - - + +
+
+ + + + + + + + + +
- - Remarks - - -
-
- - -
-
+ + Remarks + + +
+
+ + +
+ - \ No newline at end of file + \ 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 cf2dbe496..e84d93773 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 @@ -35,26 +35,26 @@ export class AssetsInfoComponent implements OnInit { main_applicant: any; pageTitle: string = "Other Assets Details"; //@Input() pdid: number; - pdid:string; + pdid: string; //businessProfessionName :string; - + public _assetsQuesFrom: FormGroup; public submitted = false; public m_assets_type = []; public applicants: any; - otherEmiamtFlag : boolean = false; - businessEmiAmtFlag : boolean = false; - isOtherOwner:any = []; - disableAfterSubmit : boolean = false; + otherEmiamtFlag: boolean = false; + businessEmiAmtFlag: boolean = false; + isOtherOwner: any = []; + disableAfterSubmit: boolean = false; - public m_any_asset_loan_type = [{'value': "yes",'viewValue': "Yes"}, - {'value': "no",'viewValue': "No"}, - {'value': "nan",'viewValue': "NA"}] + public m_any_asset_loan_type = [{ 'value': "yes", 'viewValue': "Yes" }, + { 'value': "no", 'viewValue': "No" }, + { 'value': "nan", 'viewValue': "NA" }] // appxMarketAmtInwords : any = []; - OtherAppxMarketAmtInwords : any = []; + OtherAppxMarketAmtInwords: any = []; // emiAmtInwords : any = []; - OtherEmiAmtInwords : any = []; + OtherEmiAmtInwords: any = []; // PremiumPaidInwords : any = []; OtherPremiumPaidInwords: any = []; // SumAssuredInwords: any = []; @@ -65,9 +65,9 @@ export class AssetsInfoComponent implements OnInit { OtherAssetValueInwords: any = []; // B_emiAmtInwords: any = []; O_emiAmtInwords: any = []; - + public m_propertyType = []; - + public m_investmentType = []; public m_freqOfPurchase = []; @@ -75,97 +75,97 @@ export class AssetsInfoComponent implements OnInit { public m_vehicle_type = []; public m_uom_type = []; - + private notifier: NotifierService; - existCompanyList: any =[]; - mergeCompanyApplicant: any=[]; - currentYear:any=new Date().getFullYear(); + existCompanyList: any = []; + mergeCompanyApplicant: any = []; + currentYear: any = new Date().getFullYear(); constructor( notifier: NotifierService, private _formBuilder: FormBuilder, - private pdTrigerService: PdTrigerService, + private pdTrigerService: PdTrigerService, private dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { - this.pdid = this.pd_all_details.pdmaster_details.pd_id; - this.applicants = this.pd_all_details.pdapplicants_detials; - this.applicants = this.applicants.filter(val=>val.applicant_type==0 || val.applicant_type==1) - this.applicants.push({'pd_co_applicant_id':'0','applicant_name':'Others'}); - this.notifier = notifier; - this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; - this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; - this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; - this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; - } - + @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { + this.pdid = this.pd_all_details.pdmaster_details.pd_id; + this.applicants = this.pd_all_details.pdapplicants_detials; + this.applicants = this.applicants.filter(val => val.applicant_type == 0 || val.applicant_type == 1) + this.applicants.push({ 'pd_co_applicant_id': '0', 'applicant_name': 'Others' }); + this.notifier = notifier; + this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; + this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; + this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; + this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + } + public viewerOptions: any = { - navbar: false, - toolbar: { - zoomIn: 4, - zoomOut: 4, - oneToOne: 4, - reset: 4, - prev: 4, - play: { - show: 4, - size: 'large', - }, - next: 4, - rotateLeft: 4, - rotateRight: 4, - flipHorizontal: 4, - flipVertical: 4, - } + navbar: false, + toolbar: { + zoomIn: 4, + zoomOut: 4, + oneToOne: 4, + reset: 4, + prev: 4, + play: { + show: 4, + size: 'large', + }, + next: 4, + rotateLeft: 4, + rotateRight: 4, + flipHorizontal: 4, + flipVertical: 4, + } }; ngOnInit() { - - // 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 === true); - } - - // get company list - let modifyCompanyList: any = []; - if (this.existCompanyList.length > 0) { - modifyCompanyList = this.existCompanyList.map(element => { - return { id: element.company_order_id.toString(), name: element.company_name, group_id: 1 }; - }); - this.mergeCompanyApplicant.push({ groupName: 'COMPANIES', groupValues: modifyCompanyList }) - } - // get applicant list - let modifyApplicantList: any=[]; - if(this.applicants.length > 0){ - modifyApplicantList = this.applicants.map(element => { - return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2}; - }); - this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList}) + // this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid,'').subscribe(data => { + // this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ; + // }); - } - - }) - this.getPdSupplierFormDetails(); - this.getM_Assets_Type(); - this.getM_PropertyType(); - this.getM_InvestmentType(); - this.getM_FreqOfPurchase(); - //this.getM_Relation(); - //this.getM_InsuranceType(); - this.getM_Vehicle_Type(); - this.getM_UOM_Type(); + this.pdTrigerService.getCompaniesListsForBusiness(this.pdid).subscribe(data => { + if (data.dataStatus) { + this.existCompanyList = data.records.filter(val => val.is_active === true); + } + + // get company list + let modifyCompanyList: any = []; + if (this.existCompanyList.length > 0) { + modifyCompanyList = this.existCompanyList.map(element => { + return { id: element.company_order_id.toString(), name: element.company_name, group_id: 1 }; + }); + this.mergeCompanyApplicant.push({ groupName: 'COMPANIES', groupValues: modifyCompanyList }) + } + // get applicant list + let modifyApplicantList: any = []; + if (this.applicants.length > 0) { + modifyApplicantList = this.applicants.map(element => { + return { id: element.pd_co_applicant_id, name: element.applicant_name, group_id: 2 }; + }); + this.mergeCompanyApplicant.push({ groupName: 'APPLICANTS', groupValues: modifyApplicantList }) + + } + + }) + this.getPdSupplierFormDetails(); + this.getM_Assets_Type(); + this.getM_PropertyType(); + this.getM_InvestmentType(); + this.getM_FreqOfPurchase(); + //this.getM_Relation(); + //this.getM_InsuranceType(); + this.getM_Vehicle_Type(); + this.getM_UOM_Type(); } -// ====================== + // ====================== getM_Assets_Type() { this.pdTrigerService.getAllMasterDatas('ASSETTYPE').subscribe( data => { this.m_assets_type = data.records.filter(data => data.isactive == 1 && data.id != 5 - ); + ); }, error => { this.notifier.notify('warning', 'No Category Records Found.!'); @@ -174,7 +174,7 @@ export class AssetsInfoComponent implements OnInit { ) } - getM_PropertyType() { + getM_PropertyType() { this.pdTrigerService.getAllMasterDatas('PROPERTIES').subscribe( data => { this.m_propertyType = data.records.filter(data => data.isactive == 1); @@ -186,7 +186,7 @@ export class AssetsInfoComponent implements OnInit { ) } - getM_InvestmentType() { + getM_InvestmentType() { this.pdTrigerService.getAllMasterDatas('INVESTMENTTYPE').subscribe( data => { this.m_investmentType = data.records.filter(data => data.isactive == 1); @@ -221,7 +221,7 @@ export class AssetsInfoComponent implements OnInit { ) } - getM_Vehicle_Type(){ + getM_Vehicle_Type() { this.pdTrigerService.getAllMasterDatas('VEHICLETYPE').subscribe( data => { this.m_vehicle_type = data.records.filter(data => data.is_active == 1); @@ -231,25 +231,25 @@ export class AssetsInfoComponent implements OnInit { getM_UOM_Type() { this.pdTrigerService.getAllMasterDatas('UOM').subscribe( data => { - this.m_uom_type = data.records.filter(data => data.isactive == 1 && data. is_land_uom == 1 || data. is_land_uom == 2); - // console.log('this.m_uom_type',data.records,this.m_uom_type); - // + this.m_uom_type = data.records.filter(data => data.isactive == 1 && data.is_land_uom == 1 || data.is_land_uom == 2); + + }) } // getM_InsuranceType() { - // this.pdTrigerService.getAllMasterDatas('INSURANCETYPE').subscribe( - // data => { - // this.m_insuranceType = data.records.filter(data => data.isactive == 1); - // }, - // error => { - // this.notifier.notify('warning', 'No Category Records Found.!'); - // this.m_assets_type = "No Category Records Found."; - // } - // ) + // this.pdTrigerService.getAllMasterDatas('INSURANCETYPE').subscribe( + // data => { + // this.m_insuranceType = data.records.filter(data => data.isactive == 1); + // }, + // error => { + // this.notifier.notify('warning', 'No Category Records Found.!'); + // this.m_assets_type = "No Category Records Found."; + // } + // ) //} -// ============================= + // ============================= apiLoadFinish: boolean = false; getPdSupplierFormDetails() { @@ -279,7 +279,7 @@ export class AssetsInfoComponent implements OnInit { // this.initDetails(), ]), // business_assets_details : this._formBuilder.array([]), - assets_form_remark:[value.assets_form_remark] + assets_form_remark: [value.assets_form_remark] }); this.addAssetsDetailsWithData(value.assets_details); // this.addBusinessAssetsDetailsWithData(value.business_assets_details); @@ -293,7 +293,7 @@ export class AssetsInfoComponent implements OnInit { // business_assets_details : this._formBuilder.array([ // this.initBusinessDetails(), // ]), - assets_form_remark:[''] + assets_form_remark: [''] }); } this.loadDetails = true; @@ -313,19 +313,19 @@ export class AssetsInfoComponent implements OnInit { details: this._formBuilder.array([]), approximate_market_value: [''], name_of_the_owner: [''], - other_owner:[''], - // relation: [''], - vintage_personal : [''], - purchase_year: ['',Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], + other_owner: [''], + // relation: [''], + vintage_personal: [''], + purchase_year: ['', Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], //purchase_month: [''], emi: [''], }); } show: boolean; - selectedAssetsType(e: any, i: any,flag : any): void { + selectedAssetsType(e: any, i: any, flag: any): void { let val = i; - if(flag == 1){ + if (flag == 1) { const arr = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; arr.controls.splice(0); } @@ -333,13 +333,13 @@ export class AssetsInfoComponent implements OnInit { // const arr = ; // arr.controls.splice(0); // } - + switch (e.value) { case '1': { - const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray ; + const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; control.push(this.otherAssetsDescription()); - break; - } + break; + } case '2': { let val = i; const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; @@ -347,37 +347,37 @@ export class AssetsInfoComponent implements OnInit { break; } case '3': { - const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; - + const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; + control.push(this.load_Four_Weeler()); break; } case '4': { - const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; - + const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; + control.push(this.loadEquipmentManufacturingDescription()); break; } case '5': { - const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; - + const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; + //control.push(this.loadJwellDescription()); break; } - + case '6': { - const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; - + const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; + control.push(this.loadInsuranceDescription()); break; } case '7': { - const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; - + const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; + control.push(this.loadInvestDescription()); break; } - + default: { break; } @@ -389,11 +389,11 @@ export class AssetsInfoComponent implements OnInit { return this._formBuilder.group({ property_type: [''], other_property_type: [''], - address_of_the_property :[''], - describe_of_the_property_asset :[''], - area_covered_by_this_property :[''], - uom_of_the_property:[''], - other_uom:[''] + address_of_the_property: [''], + describe_of_the_property_asset: [''], + area_covered_by_this_property: [''], + uom_of_the_property: [''], + other_uom: [''] }); } @@ -423,7 +423,7 @@ export class AssetsInfoComponent implements OnInit { //relation:[''], // any_other_asset_value : [''], // any_other_asset_loan : [''], - + }); } @@ -440,7 +440,7 @@ export class AssetsInfoComponent implements OnInit { //insurance_type: [''], premium_paid: [''], frequency_mode: [''], - other_frequency_mode:[''], + other_frequency_mode: [''], sum_assured: [''], members_coverd: [''] }); @@ -449,36 +449,36 @@ export class AssetsInfoComponent implements OnInit { loadInvestDescription() { return this._formBuilder.group({ investments_type: [''], - other_investments_type:[''], + other_investments_type: [''], amount_of_invest: [''], bank_name: [''], - in_which_organisation:[''] + in_which_organisation: [''] }); } load_Four_Weeler() { return this._formBuilder.group({ manufacturer_model_vehicle: [''], - vehicle_type:[''], - other_vehicle_type:[''] + vehicle_type: [''], + other_vehicle_type: [''] }); } - load_Two_Weeler() { + load_Two_Weeler() { return this._formBuilder.group({ manufacturer_model_vehicle: [''] }); } - loadPropertyWithData(data) { + loadPropertyWithData(data) { return this._formBuilder.group({ property_type: [data.property_type], other_property_type: [data.other_property_type], - address_of_the_property :[data.address_of_the_property], - describe_of_the_property_asset :[data.describe_of_the_property_asset], - area_covered_by_this_property :[data.area_covered_by_this_property], - uom_of_the_property:[data.uom_of_the_property], - other_uom : [data.other_uom] + address_of_the_property: [data.address_of_the_property], + describe_of_the_property_asset: [data.describe_of_the_property_asset], + area_covered_by_this_property: [data.area_covered_by_this_property], + uom_of_the_property: [data.uom_of_the_property], + other_uom: [data.other_uom] //property_type:[''] }); } @@ -503,9 +503,9 @@ export class AssetsInfoComponent implements OnInit { otherAssetsDescriptionWithData(data) { return this._formBuilder.group({ any_other_assets: [data.any_other_assets], - // name_of_the_owner:[data.name_of_the_owner], - // other_owner:[data.other_owner], - // relation:[data.relation], + // name_of_the_owner:[data.name_of_the_owner], + // other_owner:[data.other_owner], + // relation:[data.relation], // any_other_asset_value : [data.any_other_asset_value], // any_other_asset_loan : [data.any_other_asset_loan], }); @@ -519,14 +519,14 @@ export class AssetsInfoComponent implements OnInit { }); } - - + + loadInsuranceDescriptionWithData(data) { return this._formBuilder.group({ //insurance_type: [data.insurance_type], premium_paid: [data.premium_paid], frequency_mode: [data.frequency_mode], - other_frequency_mode:[data.other_frequency_mode], + other_frequency_mode: [data.other_frequency_mode], sum_assured: [data.sum_assured], members_coverd: [data.members_coverd] }); @@ -535,9 +535,9 @@ export class AssetsInfoComponent implements OnInit { loadInvestDescriptionWithData(data) { return this._formBuilder.group({ investments_type: [data.investments_type], - other_investments_type : [data.other_investments_type], + other_investments_type: [data.other_investments_type], amount_of_invest: [data.amount_of_invest], - in_which_organisation:[data.in_which_organisation], + in_which_organisation: [data.in_which_organisation], bank_name: [data.bank_name] }); } @@ -545,12 +545,12 @@ export class AssetsInfoComponent implements OnInit { load_Four_WeelerWithData(data) { return this._formBuilder.group({ manufacturer_model_vehicle: [data.manufacturer_model_vehicle], - vehicle_type:[data.vehicle_type], - other_vehicle_type:[data.other_vehicle_type] + vehicle_type: [data.vehicle_type], + other_vehicle_type: [data.other_vehicle_type] }); } - load_Two_WeelerWithData(data) { + load_Two_WeelerWithData(data) { return this._formBuilder.group({ manufacturer_model_vehicle: [data.manufacturer_model_vehicle] }); @@ -564,10 +564,10 @@ export class AssetsInfoComponent implements OnInit { details: this._formBuilder.array([]), approximate_market_value: [data.approximate_market_value], name_of_the_owner: [data.name_of_the_owner], - other_owner:[data.other_owner || ''], + other_owner: [data.other_owner || ''], //relation: [data.relation || ''], - vintage_personal : [data. vintage_personal], - purchase_year: [data. purchase_year,Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], + vintage_personal: [data.vintage_personal], + purchase_year: [data.purchase_year, Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], // purchase_month: [data.purchase_month], emi: [data.emi || 0], }); @@ -595,27 +595,27 @@ export class AssetsInfoComponent implements OnInit { var result = Object.keys(supp_data).map(function (key) { return supp_data[key]; }); - + if (result.length > 0) { for (let val of result) { let vals = { assets_mode: val.assets_mode, approximate_market_value: val.approximate_market_value, name_of_the_owner: val.name_of_the_owner, - other_owner:val.other_owner, - // relation: val.relation, + other_owner: val.other_owner, + // relation: val.relation, vintage_personal: val.vintage_personal, purchase_year: val.purchase_year, // purchase_month: val.purchase_month, emi: val.emi, }; const control = this._assetsQuesFrom.controls['assets_details']; - - + + control.push(this.initDetailsWithdata(vals)); this.setAssetsDetailsWithData(vals.assets_mode, val.details, control.length - 1) } - result.forEach((datas,index) => { + result.forEach((datas, index) => { // let Avaliablity = 1; // if(datas.name_of_the_owner.length>0){ // datas.name_of_the_owner.forEach(option => { @@ -626,7 +626,7 @@ export class AssetsInfoComponent implements OnInit { // } // this.isOtherOwner[index] = Avaliablity == 0 ? true : false; this.OtherAppxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.approximate_market_value); - this.setRequiredValidation(datas.name_of_the_owner,index,'',4); + this.setRequiredValidation(datas.name_of_the_owner, index, '', 4); }); } this.loadDetails = true; @@ -639,21 +639,22 @@ export class AssetsInfoComponent implements OnInit { // }); //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 = { '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, - }; + let array_data: any; + data.forEach((datas, i) => { + array_data = { + 'any_other_assets': datas.any_other_assets, + // 'name_of_the_owner':datas.name_of_the_owner, + // 'other_owner':datas.other_owner, + //'relation':datas.relation, + // 'any_other_asset_value' : datas.any_other_asset_value, + // 'any_other_asset_loan' : datas.any_other_asset_loan, + }; this.OtherAssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.any_other_asset_value); }); const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; @@ -661,31 +662,35 @@ export class AssetsInfoComponent implements OnInit { break; } case '2': { - let array_data : any; - data.forEach((datas,i) => { - array_data = { 'property_type':datas.property_type,'other_property_type':datas.other_property_type, - 'address_of_the_property' :datas.address_of_the_property,'describe_of_the_property_asset' :datas.describe_of_the_property_asset, - 'uom_of_the_property':datas.uom_of_the_property, - 'area_covered_by_this_property' :datas.area_covered_by_this_property,'other_uom':datas.other_uom }; + let array_data: any; + data.forEach((datas, i) => { + array_data = { + 'property_type': datas.property_type, 'other_property_type': datas.other_property_type, + 'address_of_the_property': datas.address_of_the_property, 'describe_of_the_property_asset': datas.describe_of_the_property_asset, + 'uom_of_the_property': datas.uom_of_the_property, + 'area_covered_by_this_property': datas.area_covered_by_this_property, 'other_uom': datas.other_uom + }; }); const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; control.push(this.loadPropertyWithData(array_data)); break; } case '3': { - let array_data : any; - data.forEach((datas,i) => { - array_data = { 'manufacturer_model_vehicle': datas.manufacturer_model_vehicle, - 'vehicle_type':datas.vehicle_type, - 'other_vehicle_type':datas.other_vehicle_type}; + let array_data: any; + data.forEach((datas, i) => { + array_data = { + 'manufacturer_model_vehicle': datas.manufacturer_model_vehicle, + 'vehicle_type': datas.vehicle_type, + 'other_vehicle_type': datas.other_vehicle_type + }; }); const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; control.push(this.load_Four_WeelerWithData(array_data)); break; } case '4': { - let array_data : any; - data.forEach((datas,i) => { + let array_data: any; + data.forEach((datas, i) => { array_data = { 'equipment_manufacturing_description': datas.equipment_manufacturing_description }; }); const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; @@ -697,16 +702,16 @@ export class AssetsInfoComponent implements OnInit { //control.push(this.loadJwellDescriptionWithData(data)); break; } - + case '6': { - let array_data : any; - data.forEach((datas,i) => { + 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 = { + array_data = { 'premium_paid': datas.premium_paid, 'frequency_mode': datas.frequency_mode, - 'other_frequency_mode':datas.other_frequency_mode, + 'other_frequency_mode': datas.other_frequency_mode, 'sum_assured': datas.sum_assured, 'members_coverd': datas.members_coverd }; @@ -716,41 +721,43 @@ export class AssetsInfoComponent implements OnInit { 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, - 'in_which_organisation' : datas.in_which_organisation, + 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, + 'in_which_organisation': datas.in_which_organisation, 'amount_of_invest': datas.amount_of_invest, - 'bank_name': datas.bank_name }; + 'bank_name': datas.bank_name + }; }); const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; control.push(this.loadInvestDescriptionWithData(array_data)); break; } - + default: { break; } } } - + /** Add More Asset using Flag Both "Other Asset" And "Business Asset" */ - addAssetDetails(e,flag) { - if(flag == 1){ - const control = this._assetsQuesFrom.controls['assets_details']; - control.push(this.initDetails()); + addAssetDetails(e, flag) { + if (flag == 1) { + const control = this._assetsQuesFrom.controls['assets_details']; + control.push(this.initDetails()); } } /** To remove The Added Asset using Flag Both "Other Asset" And "Business Asset" */ - removeAssetsDetails(i: number,flag) { - if(flag == 1){ - const control = this._assetsQuesFrom.controls['assets_details']; - control.removeAt(i); - } + removeAssetsDetails(i: number, flag) { + if (flag == 1) { + const control = this._assetsQuesFrom.controls['assets_details']; + control.removeAt(i); + } } public paymentModeTextBox: number; @@ -765,34 +772,34 @@ export class AssetsInfoComponent implements OnInit { } // compare objects for merge two master table details compareObjects(o1: any, o2: any) { - if(o1.id == o2.id && o1.group_id == o2.group_id) - return true; + if (o1.id == o2.id && o1.group_id == o2.group_id) + return true; else return false } // check others - checkOthers(values){ - if(values!=null) { - return values.id==0 ? true : false; + checkOthers(values) { + if (values != null) { + return values.id == 0 ? true : false; } else { return false; } - + } // calculate vintage and purchase {} - calculateVintagePurchase(value: any, controlKey: any,type: number){ - if(type==1){} - else if(type==2) {} - else if(type==3){ + calculateVintagePurchase(value: any, controlKey: any, type: number) { + if (type == 1) { } + else if (type == 2) { } + else if (type == 3) { let control: any = this._assetsQuesFrom.controls['assets_details']; - control.controls[controlKey].controls['purchase_year'].setValue(value!='' ? parseInt(this.currentYear)-parseInt(value) : ''); + control.controls[controlKey].controls['purchase_year'].setValue(value != '' ? parseInt(this.currentYear) - parseInt(value) : ''); } - else if(type==4) { - let control: any = this._assetsQuesFrom.controls['assets_details']; - value!='' && value<=this.currentYear ? control.controls[controlKey].controls['purchase_year'].setValue(value) : control.controls[controlKey].controls['purchase_year'].setValue(''); - value!='' && value<=this.currentYear ? control.controls[controlKey].controls['vintage_personal'].setValue(parseInt(this.currentYear)-parseInt(value)) : control.controls[controlKey].controls['vintage_personal'].setValue('') + else if (type == 4) { + let control: any = this._assetsQuesFrom.controls['assets_details']; + value != '' && value <= this.currentYear ? control.controls[controlKey].controls['purchase_year'].setValue(value) : control.controls[controlKey].controls['purchase_year'].setValue(''); + value != '' && value <= this.currentYear ? control.controls[controlKey].controls['vintage_personal'].setValue(parseInt(this.currentYear) - parseInt(value)) : control.controls[controlKey].controls['vintage_personal'].setValue('') } } @@ -800,7 +807,7 @@ export class AssetsInfoComponent implements OnInit { /** To Save/Edited Popup Data */ onSubmit() { this.submitted = true; - + // stop here if form is invalid if (this._assetsQuesFrom.invalid) { this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); @@ -815,17 +822,17 @@ export class AssetsInfoComponent implements OnInit { // Save the data with help of Service this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe( dataresult => { - if(dataresult.status == 200) { + if (dataresult.status == 200) { this.notifier.notify('success', 'Saved Successfully.'); - setTimeout(() =>{ - this.dialogRef.close(); - this.disableAfterSubmit = false; - },3000); - } - else { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - this.disableAfterSubmit = false; - } + setTimeout(() => { + this.dialogRef.close(); + this.disableAfterSubmit = false; + }, 3000); + } + else { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.disableAfterSubmit = false; + } }, error => { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.disableAfterSubmit = false; @@ -842,152 +849,151 @@ export class AssetsInfoComponent implements OnInit { // arr.controls.splice(0); // this.getPdSupplierFormDetails(); // } - + /** To calculating Loan Elapsed Tenure both "Other Asset" And "Business Asset" using Flag */ - loanTenureCalc(details ,flag) - { - if(flag == 1){ - let ElapsedValues; - - if(details.value.original_loan_tenure != null && details.value.original_loan_tenure != '' && details.value.balance_tenure != null && details.value.balance_tenure != ''){ - ElapsedValues = details.value.original_loan_tenure - details.value.balance_tenure ; - details.controls['elapsed_tenure'].setValue(ElapsedValues); + loanTenureCalc(details, flag) { + if (flag == 1) { + let ElapsedValues; + + if (details.value.original_loan_tenure != null && details.value.original_loan_tenure != '' && details.value.balance_tenure != null && details.value.balance_tenure != '') { + ElapsedValues = details.value.original_loan_tenure - details.value.balance_tenure; + details.controls['elapsed_tenure'].setValue(ElapsedValues); + } } - } - // else if(flag == 2){ - // let BusinessElapsedValues; - - // if(details.value.business_original_loan_tenure != null && details.value.business_original_loan_tenure != '' && details.value.business_balance_tenure != null && details.value.business_balance_tenure != ''){ - // BusinessElapsedValues = details.value.business_original_loan_tenure - details.value.business_balance_tenure ; - // details.controls['business_elapsed_tenure'].setValue(BusinessElapsedValues); - // } - // } + // else if(flag == 2){ + // let BusinessElapsedValues; + + // if(details.value.business_original_loan_tenure != null && details.value.business_original_loan_tenure != '' && details.value.business_balance_tenure != null && details.value.business_balance_tenure != ''){ + // BusinessElapsedValues = details.value.business_original_loan_tenure - details.value.business_balance_tenure ; + // details.controls['business_elapsed_tenure'].setValue(BusinessElapsedValues); + // } + // } } - setRequiredValidation(value,ParInx,ChdInx,flag) { - console.log('value',value,'ParInx',ParInx,'ChdInx',ChdInx,'flag',flag); + setRequiredValidation(value, ParInx, ChdInx, flag) { + let ParCtrls = this._assetsQuesFrom.controls.assets_details; - // console.log('ParCtrls',ParCtrls); - let ChdCtrls:any = ParCtrls.controls[ParInx]; - // console.log('ChdCtrls',ChdCtrls); - if(flag == 1){ - value==1 - - // ? controls2[ChdInx].controls.other_property_type.setValidators([Validators.required]) - // : item.controls.other_property_type.clearValidators(); - // item.controls.other_property_type.updateValueAndValidity(); - } - // if(flag == 2){ - // value==1 - // ? item.controls.other_frequency_mode.setValidators([Validators.required]) - // : item.controls.other_frequency_mode.clearValidators(); - // item.controls.other_frequency_mode.updateValueAndValidity(); - // } - // if(flag == 3){ - // value==1 - // ? item.controls.other_investments_type.setValidators([Validators.required]) - // : item.controls.other_investments_type.clearValidators(); - // item.controls.other_investments_type.updateValueAndValidity(); - // } - // if(flag == 4){ - // value==0 - // ? item.controls.other_owner.setValidators([Validators.required]) - // : item.controls.other_owner.clearValidators(); - // item.controls.other_owner.updateValueAndValidity(); - // } - if (flag == 4) { - let Avaliablity = 1; - // console.log('val',value); - if(value.length>0){ + + let ChdCtrls: any = ParCtrls.controls[ParInx]; + + if (flag == 1) { + value == 1 + + // ? controls2[ChdInx].controls.other_property_type.setValidators([Validators.required]) + // : item.controls.other_property_type.clearValidators(); + // item.controls.other_property_type.updateValueAndValidity(); + } + // if(flag == 2){ + // value==1 + // ? item.controls.other_frequency_mode.setValidators([Validators.required]) + // : item.controls.other_frequency_mode.clearValidators(); + // item.controls.other_frequency_mode.updateValueAndValidity(); + // } + // if(flag == 3){ + // value==1 + // ? item.controls.other_investments_type.setValidators([Validators.required]) + // : item.controls.other_investments_type.clearValidators(); + // item.controls.other_investments_type.updateValueAndValidity(); + // } + // if(flag == 4){ + // value==0 + // ? item.controls.other_owner.setValidators([Validators.required]) + // : item.controls.other_owner.clearValidators(); + // item.controls.other_owner.updateValueAndValidity(); + // } + if (flag == 4) { + let Avaliablity = 1; + + if (value.length > 0) { value.forEach(option => { - if(option.id == 0 && option.group_id == 2){ + if (option.id == 0 && option.group_id == 2) { Avaliablity = option.id; } }); } - if(Avaliablity == 0){ - console.log('if Avaliablity',Avaliablity); - // console.log('if this.isOtherOwner[ParInx]',this.isOtherOwner[ParInx]); - ChdCtrls.controls.other_owner.setValidators([Validators.required]); - this.isOtherOwner[ParInx] = true; - // console.log('if this.isOtherOwner[ParInx]',this.isOtherOwner[ParInx]); - }else if(Avaliablity == 1){ - console.log('else Avaliablity',Avaliablity); - // console.log('esle this.isOtherOwner[ParInx]',this.isOtherOwner[ParInx]); - ChdCtrls.controls.other_owner.setValue(''); - ChdCtrls.controls.other_owner.clearValidators(); - this.isOtherOwner[ParInx] = false; - // console.log('else this.isOtherOwner[ParInx]',this.isOtherOwner[ParInx]); + if (Avaliablity == 0) { + + + ChdCtrls.controls.other_owner.setValidators([Validators.required]); + this.isOtherOwner[ParInx] = true; + + } else if (Avaliablity == 1) { + + + ChdCtrls.controls.other_owner.setValue(''); + ChdCtrls.controls.other_owner.clearValidators(); + this.isOtherOwner[ParInx] = false; + + } + + ChdCtrls.controls.other_owner.updateValueAndValidity(); + } - - ChdCtrls.controls.other_owner.updateValueAndValidity(); + // if(flag == 5){ + // value==1 + // ? item.controls.other_vehicle_type.setValidators([Validators.required]) + // : item.controls.other_vehicle_type.clearValidators(); + // item.controls.other_vehicle_type.updateValueAndValidity(); + // } + // if(flag == 6){ + // value==1 + // ? item.controls.other_uom.setValidators([Validators.required]) + // : item.controls.other_uom.clearValidators(); + // item.controls.other_uom.updateValueAndValidity(); + // } } -// if(flag == 5){ -// value==1 -// ? item.controls.other_vehicle_type.setValidators([Validators.required]) -// : item.controls.other_vehicle_type.clearValidators(); -// item.controls.other_vehicle_type.updateValueAndValidity(); -// } -// if(flag == 6){ -// value==1 -// ? item.controls.other_uom.setValidators([Validators.required]) -// : item.controls.other_uom.clearValidators(); -// item.controls.other_uom.updateValueAndValidity(); -// } - -} -/** Amount InWords */ -inWords(e,i,flag){ - switch(flag){ - case 1 : - // this.appxMarketAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); - break; - case 2 : - this.OtherAppxMarketAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); - break; - case 3 : - // this.emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); - break; - case 4 : - this.OtherEmiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); - break; - case 5 : - // this.PremiumPaidInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); - break; - case 6 : - this.OtherPremiumPaidInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); - break; - case 7 : - // this.SumAssuredInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); - break; - case 8 : - this.OtherSumAssuredInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); - break; - case 9 : - // this.AmtInvestInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); - break; - case 10 : - this.OtherAmtInvestInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); - break; - case 11 : - // this.AssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); - break; - case 12 : - this.OtherAssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); - break; - case 13: - // this.B_emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); - break; - case 14: - this.O_emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); - break; - default: - break; + /** Amount InWords */ + inWords(e, i, flag) { + switch (flag) { + case 1: + // this.appxMarketAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + break; + case 2: + this.OtherAppxMarketAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + break; + case 3: + // this.emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + break; + case 4: + this.OtherEmiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + break; + case 5: + // this.PremiumPaidInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + break; + case 6: + this.OtherPremiumPaidInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + break; + case 7: + // this.SumAssuredInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + break; + case 8: + this.OtherSumAssuredInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + break; + case 9: + // this.AmtInvestInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + break; + case 10: + this.OtherAmtInvestInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + break; + case 11: + // this.AssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + break; + case 12: + this.OtherAssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + break; + case 13: + // this.B_emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + break; + case 14: + this.O_emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + break; + default: + break; + } } } -} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html index 585038ad5..5f313ecb7 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html @@ -1,314 +1,378 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + +
-

-
- {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
- {{pageTitle}} -
-
- -
-

- - - - - - -
- +
+ {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - + {{subproduct_abbr}}
+ {{pageTitle}} +
+
+ +
+

+ + + + + + +
+ - - - -

Banking Details #{{i+1}} -

-
-
- - - - + + + +

Banking Details #{{i+1}} +

+
+
+ + + + {{val.name}} - - +
+
-
- - - + + + + - - + + Select - {{ btLen.lender_name }} - - - - - + {{ + btLen.lender_name }} + + + + + - - - - Select - {{ prop.name }} - - - - -
+ +
- + Select Yes No NA - + - - - - {{"₹"}} {{amtInwords[i]}} Only + + + + + {{"₹"}} + {{amtInwords[i]}} Only -
-
+
+

- + - +
-
- -
-
+ +
+ +
-
- -
- - - - -
- - + +
+ + - -
- - - - - - - - - +
+
-
-
- + + + + + +
+ +
+
+
+ + + +
- - Remarks - - -
-
-
+
+ -
-
+ +
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts index 1152b35b6..4ad73fbe7 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts @@ -21,7 +21,7 @@ import { } from '@angular/material'; /** Service */ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; -import {ActivatedRoute, Router} from "@angular/router"; +import { ActivatedRoute, Router } from "@angular/router"; @Component({ selector: 'app-banking-details', templateUrl: './banking-details.component.html', @@ -33,88 +33,88 @@ export class BankingDetailsComponent implements OnInit { lender_applicant_id: any; main_applicant: any; pdid: number; - pageTitle: string ="Banking Details of Individuals"; + pageTitle: string = "Banking Details of Individuals"; public bankingForm: FormGroup; step: number; private notifier: NotifierService; - public pd_cus_segment:string; + public pd_cus_segment: string; public applicants: any; public companies: any; - m_accountType= []; + m_accountType = []; m_btLenderList = []; - salaryField : boolean; - OtherFlag : any = []; - limitCaseFlag : any = []; - amtInwords : any = []; - emiAmtInwords : any = []; - - existCompanyList: any =[]; - mergeCompanyApplicant: any=[]; + salaryField: boolean; + OtherFlag: any = []; + limitCaseFlag: any = []; + amtInwords: any = []; + emiAmtInwords: any = []; + + existCompanyList: any = []; + mergeCompanyApplicant: any = []; constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, - private router: Router, - private _pd: PdTrigerService, - private dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { - this.pdid = this.pd_all_details.pdmaster_details.pd_id; - this.pd_cus_segment = this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase(); - this.pd_cus_segment = this.pd_cus_segment.substring(0,3); - this.applicants = this.pd_all_details.pdapplicants_detials; - this.applicants = this.applicants.filter(val=>val.applicant_type==0 || val.applicant_type==1) - this.applicants.push({'pd_co_applicant_id':'0','applicant_name':'Others'}); - this.companies = this.pd_all_details.pdapplicants_detials.filter(val=>val.applicant_type==2) - this.notifier = notifier; - this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; - this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; - this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; - this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; - - } + private router: Router, + private _pd: PdTrigerService, + private dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { + this.pdid = this.pd_all_details.pdmaster_details.pd_id; + this.pd_cus_segment = this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase(); + this.pd_cus_segment = this.pd_cus_segment.substring(0, 3); + this.applicants = this.pd_all_details.pdapplicants_detials; + this.applicants = this.applicants.filter(val => val.applicant_type == 0 || val.applicant_type == 1) + this.applicants.push({ 'pd_co_applicant_id': '0', 'applicant_name': 'Others' }); + this.companies = this.pd_all_details.pdapplicants_detials.filter(val => val.applicant_type == 2) + this.notifier = notifier; + this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; + this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; + this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; + this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + + } public viewerOptions: any = { - navbar: false, - toolbar: { - zoomIn: 4, - zoomOut: 4, - oneToOne: 4, - reset: 4, - prev: 4, - play: { - show: 4, - size: 'large', - }, - next: 4, - rotateLeft: 4, - rotateRight: 4, - flipHorizontal: 4, - flipVertical: 4, - } -}; + navbar: false, + toolbar: { + zoomIn: 4, + zoomOut: 4, + oneToOne: 4, + reset: 4, + prev: 4, + play: { + show: 4, + size: 'large', + }, + next: 4, + rotateLeft: 4, + rotateRight: 4, + flipHorizontal: 4, + flipVertical: 4, + } + }; - ngOnInit() { + ngOnInit() { this.step = 0; this.initBankingForm(); - this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{ - if(data.dataStatus){ - this.existCompanyList = data.records.filter(val =>val.is_active===true); - } + this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data => { + if (data.dataStatus) { + this.existCompanyList = data.records.filter(val => val.is_active === true); + } - // let modifyCompanyList : any=[]; - // if(this.existCompanyList.length>0){ - // modifyCompanyList = this.existCompanyList.map(element => { - // return {id:element.company_order_id.toString(),name:element.company_name,group_id:1}; - // }); - // this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList}) - // } - - }); - let modifyApplicantList: any=[]; - - if(this.applicants.length > 0){ - modifyApplicantList = this.applicants.map(element => { - return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2}; - }); - this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList}) + // let modifyCompanyList : any=[]; + // if(this.existCompanyList.length>0){ + // modifyCompanyList = this.existCompanyList.map(element => { + // return {id:element.company_order_id.toString(),name:element.company_name,group_id:1}; + // }); + // this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList}) + // } + + }); + let modifyApplicantList: any = []; + + if (this.applicants.length > 0) { + modifyApplicantList = this.applicants.map(element => { + return { id: element.pd_co_applicant_id, name: element.applicant_name, group_id: 2 }; + }); + this.mergeCompanyApplicant.push({ groupName: 'APPLICANTS', groupValues: modifyApplicantList }) } // let modifyCompanyList : any=[]; @@ -125,16 +125,16 @@ export class BankingDetailsComponent implements OnInit { // this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList}) // } - + this.getM_AccountType(); this.getM_BTLenderList(); - - this.salaryField = this.pd_cus_segment.substring(0,2) == 'SE' ? false : true ; + + this.salaryField = this.pd_cus_segment.substring(0, 2) == 'SE' ? false : true; // this.pd_cus_segment = this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase(); // // console.log("(0,3): " + this.pd_cus_segment.substring(0,3)); // this.pd_cus_segment = this.pd_cus_segment.substring(0,3); // this.applicants = this.pd_all_details.pdapplicants_detials; - + let params: any = {}; params.pd_id = this.pdid; params.pd_form_id = '7'; @@ -148,12 +148,12 @@ export class BankingDetailsComponent implements OnInit { if (result.length == 0) { control.push(this.createBankarray()); } else { - result.forEach((datas,index) => { - this.amtInwords[index] = this._pd.convertNumberToWords(+datas.limit); + result.forEach((datas, index) => { + this.amtInwords[index] = this._pd.convertNumberToWords(+datas.limit); // this.selectedBorrower(datas.applicant_name,index); - this.selectedAccTypeChanges(+datas.account_type,index) - - // this.emiAmtInwords[index] = this._pd.convertNumberToWords(val.emi); + this.selectedAccTypeChanges(+datas.account_type, index) + + // this.emiAmtInwords[index] = this._pd.convertNumberToWords(val.emi); control.push(this.createBankarray()); }); this.bankingForm.controls.itemRows.setValue(result); @@ -166,24 +166,24 @@ export class BankingDetailsComponent implements OnInit { // ====================== - getM_AccountType() { - this._pd.getAllMasterDatas('ACCOUNTTYPE').subscribe( - data => { - this.m_accountType = data.records.filter(data => data.isactive == 1); - }, - error => { - this.notifier.notify('warning', 'No Category Records Found.!'); - // this.m_assets_type = "No Category Records Found."; - } - ) - } + getM_AccountType() { + this._pd.getAllMasterDatas('ACCOUNTTYPE').subscribe( + data => { + this.m_accountType = data.records.filter(data => data.isactive == 1); + }, + error => { + this.notifier.notify('warning', 'No Category Records Found.!'); + // this.m_assets_type = "No Category Records Found."; + } + ) + } - getM_BTLenderList(){ - this._pd.getAllMasterDatas('BTLENDERLIST').subscribe( - data => { - this.m_btLenderList = data.records.filter(data => data.isactive == 1 && data.lender_type == 1); - }) - } + getM_BTLenderList() { + this._pd.getAllMasterDatas('BTLENDERLIST').subscribe( + data => { + this.m_btLenderList = data.records.filter(data => data.isactive == 1 && data.lender_type == 1); + }) + } public initBankingForm(): void { this.bankingForm = this.fb.group({ @@ -195,12 +195,12 @@ export class BankingDetailsComponent implements OnInit { createBankarray() { return this.fb.group({ applicant_name: [''], - other_applicant : [''], + other_applicant: [''], bank_name: [''], other_bank: [''], account_type: [''], //salary: [''], - salary: this.pd_cus_segment.substring(0,2) == 'SE' ? [''] : [''], + salary: this.pd_cus_segment.substring(0, 2) == 'SE' ? [''] : [''], limit: [''], //is_main: [''], //is_main: [this.pd_cus_segment == 'SAL' ? '' : ''], @@ -225,60 +225,60 @@ export class BankingDetailsComponent implements OnInit { } deleteBankdetails(index: number) { - + const control = this.bankingForm.controls['itemRows']; control.removeAt(index); } - setRequiredValidation(value,item,flag) { - - if(flag == 1){ - value==0 - ? item.controls.other_applicant.setValidators([Validators.required]) - : item.controls.other_applicant.clearValidators(); - item.controls.other_applicant.updateValueAndValidity(); - } - if(flag == 2){ - value==1 - ? item.controls.other_bank.setValidators([Validators.required]) - : item.controls.other_bank.clearValidators(); - item.controls.other_bank.updateValueAndValidity(); - } - + setRequiredValidation(value, item, flag) { + + if (flag == 1) { + value == 0 + ? item.controls.other_applicant.setValidators([Validators.required]) + : item.controls.other_applicant.clearValidators(); + item.controls.other_applicant.updateValueAndValidity(); + } + if (flag == 2) { + value == 1 + ? item.controls.other_bank.setValidators([Validators.required]) + : item.controls.other_bank.clearValidators(); + item.controls.other_bank.updateValueAndValidity(); + } + } - + setStep(index: number) { this.step = index; } bankSubmit() { - let records: any = {}; - records.pdid = this.pdid; - records.formid = '7'; - records.banking_form_remark = this.bankingForm.controls.banking_form_remark.value; - // records.fk_createdby = '252'; - records.banking_details = this.bankingForm.controls['itemRows'].value; - - this._pd.saveForm(records).subscribe(data => { - if(data.status == 200) { - this.notifier.notify('success', 'Saved Successfully.'); - // this.dialogRef.close(); - setTimeout(() =>{ - this.dialogRef.close(); - },3000); - } - else{ - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - } - }, error => { + let records: any = {}; + records.pdid = this.pdid; + records.formid = '7'; + records.banking_form_remark = this.bankingForm.controls.banking_form_remark.value; + // records.fk_createdby = '252'; + records.banking_details = this.bankingForm.controls['itemRows'].value; + + this._pd.saveForm(records).subscribe(data => { + if (data.status == 200) { + this.notifier.notify('success', 'Saved Successfully.'); + // this.dialogRef.close(); + setTimeout(() => { + this.dialogRef.close(); + }, 3000); + } + else { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - }); + } + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }); } validateAllFormFields(formGroup: FormGroup) { Object.keys(formGroup.controls).forEach(field => { const control = formGroup.get(field); if (control instanceof FormControl) { - control.markAsTouched({onlySelf: true}); + control.markAsTouched({ onlySelf: true }); } else if (control instanceof FormGroup) { this.validateAllFormFields(control); } @@ -296,65 +296,65 @@ export class BankingDetailsComponent implements OnInit { // compare objects for merge two master table details - compareObjects(o1: any, o2: any) { - if(o1.id == o2.id && o1.group_id == o2.group_id) - return true; - else return false - } + compareObjects(o1: any, o2: any) { + if (o1.id == o2.id && o1.group_id == o2.group_id) + return true; + else return false + } // check others - checkOthers(values){ - if(values!=null) { - return values.id==0 ? true : false; - } - else { - return false; - } - - } + checkOthers(values) { + if (values != null) { + return values.id == 0 ? true : false; + } + else { + return false; + } - selectedAccTypeChanges(event: any,i){ - - if(event == 2 || event == 1) { + } + + selectedAccTypeChanges(event: any, i) { + + if (event == 2 || event == 1) { this.limitCaseFlag[i] = false; - + // const control = this.bankingForm.controls['itemRows']; - + // control.controls[0].get('limit').clearValidators(); // control.controls[0].get('limit').updateValueAndValidity(); - + } - else{ + else { this.limitCaseFlag[i] = true; } } /** To Convert Month into Year */ - ConvertMonthintoYear(itemrow,e){ - + ConvertMonthintoYear(itemrow, e) { + let year = itemrow.controls.vintage_year.value; - - let converted_month : number = e%12; - let converted_year : number = e/12; + + let converted_month: number = e % 12; + let converted_year: number = e / 12; itemrow.controls.vintage_year.setValue(+year + +Math.floor(converted_year)); itemrow.controls.vintage_month.setValue(Math.floor(converted_month)); - + } /** Amount InWords */ - inWords(e,i,flag){ - switch(flag){ - case 1 : - this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value); - break; - case 2 : - this.emiAmtInwords[i] = this._pd.convertNumberToWords(e.target.value); - break; - default: - break; + inWords(e, i, flag) { + switch (flag) { + case 1: + this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value); + break; + case 2: + this.emiAmtInwords[i] = this._pd.convertNumberToWords(e.target.value); + break; + default: + break; } - } + } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.html index 0001c94c7..c38fd1f94 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.html @@ -1,7 +1,8 @@

- {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
+ {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - + {{subproduct_abbr}}
{{pageTitle}}
@@ -15,149 +16,150 @@ -
-
-
-
-
- - - -

Address Details {{ " : " + itemrow.get('address_label').value | titlecase}}

-
-
+
+
+
+
+
+ + + +

Address Details {{ " : " + itemrow.get('address_label').value | titlecase}}

+
+
-
- - - Select - Yes - No - - -
- -
-
- - - - {{yearErrorMessage[i]}} - - - - - {{monthErrorMessage[i]}} - +
+ + + Select + Yes + No +
+
+
+ + + + {{yearErrorMessage[i]}} + + + + + {{monthErrorMessage[i]}} + + +
- - - Yes - No - - - + - - - - + -
+
-
- - - +
+ + + + Select + Owned + Rented + + + + + + {{"₹"}} + {{RentAmtInwordsForAddress[i]}} Only + Monthly Rent Amount Required + + + +
+ + + + {{"₹"}} + {{appxMarketAmtInwordsForAddress[i]}} Only + + + + + + + {{val.name}} + + + + Asset Owned by Required + + + + + + + + Approx Vintage + + + + + + Purchase Year + + + +
+ + + +
+ + Select - Owned - Rented + Yes + No - - - - {{"₹"}} - {{RentAmtInwordsForAddress[i]}} Only - Monthly Rent Amount Required - - - -
- - - - {{"₹"}} - {{appxMarketAmtInwordsForAddress[i]}} Only - - - - - - - {{val.name}} - - - - Asset Owned by Required - - - - - - - - Approx Vintage - - - - - - Purchase Year - - - -
- - - -
- - - Select - Yes - No - - -
-
-
- - -
+ +
-
-
+ + +
+
+
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts index 15938b197..e805a57f3 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts @@ -16,7 +16,7 @@ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; }) export class BusinessAssetsInfoComponent implements OnInit { - + /**Declaration of Header Variables */ customer_segment_abbr: any; subproduct_abbr: any; @@ -24,7 +24,7 @@ export class BusinessAssetsInfoComponent implements OnInit { main_applicant: any; pageTitle: string = "Assets used for Business"; - + /**Declaration of Form Fields Variables */ pdid: string; company_id: any; @@ -33,8 +33,8 @@ export class BusinessAssetsInfoComponent implements OnInit { private notifier: NotifierService; public _businessAssetsQuesFrom: FormGroup; public submitted = false; - isOtherOwnerForAddress : any = []; - isOtherOwner : any = []; + isOtherOwnerForAddress: any = []; + isOtherOwner: any = []; loadDetails: boolean; CustSegAbbr: any; @@ -48,7 +48,7 @@ export class BusinessAssetsInfoComponent implements OnInit { /**Declaration of Dropdown And Array */ public applicants: any; public m_any_asset_loan_type = [{ 'value': "yes", 'viewValue': "Yes" }, - { 'value': "no", 'viewValue': "No" }] + { 'value': "no", 'viewValue': "No" }] public m_assets_type = []; public m_propertyType = []; public m_address_type = []; @@ -171,9 +171,9 @@ export class BusinessAssetsInfoComponent implements OnInit { this.pdTrigerService.getPDFormDetailsWithCompanyID(this.pdid, '22', this.company_id).subscribe( data => { if (data) { - + if (data.dataStatus) { - + this.formLoadData(data.records); } else { this.formLoadData(null); @@ -185,66 +185,64 @@ export class BusinessAssetsInfoComponent implements OnInit { } ); } - loadaddresses(){ - // console.log('function inside loaded'); - let params: any = {}; - params.pd_id = this.pdid; - params.pd_form_id = '5'; + loadaddresses() { + + let params: any = {}; + params.pd_id = this.pdid; + params.pd_form_id = '5'; this.pdTrigerService.retriveForm(params).subscribe(data => { - // console.log('response',data); + if (data.status == 200) { let dataOfAddress = data.records.addresses.filter(item => item.isactive == 1); - // console.log(data.records); - // console.log(data.records.addresses); - // console.log(dataOfAddress); + // // const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; - - if(data.records.addresses.length > 0){ - data.records.addresses.forEach((data,inx)=>{ - // console.log(data); + + if (data.records.addresses.length > 0) { + data.records.addresses.forEach((data, inx) => { + this.addressLabel[inx] = ''; let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == data.address_type)[0]; let address = data.address; let addressType = data.address_type != 1 ? selectedAddressType.address_type : data.address_type_others; - + this.placeholderName[inx] = 'Was any business activity seen at the ' + addressType + ' during PD visit?'; let addressLabel = address + ' / ' + addressType; - let vals = { - address_label:addressLabel, - business_years: '', - business_month: '', - business_address_availability: '', - business_is_pd_visited: '', - business_pd_visited_remark: '', - business_approximate_market_value: '', - business_ownership_type: '', - business_monthly_rented_amt: '', - business_name_of_the_owner: '', - business_name_of_the_other_owner: '', - business_vintage: '', - business_purchase_year: '', - business_emi: '' - } + let vals = { + address_label: addressLabel, + business_years: '', + business_month: '', + business_address_availability: '', + business_is_pd_visited: '', + business_pd_visited_remark: '', + business_approximate_market_value: '', + business_ownership_type: '', + business_monthly_rented_amt: '', + business_name_of_the_owner: '', + business_name_of_the_other_owner: '', + business_vintage: '', + business_purchase_year: '', + business_emi: '' + } - const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; - control.push(this.initBusinessAddressDetailsWithdata(vals)); + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + control.push(this.initBusinessAddressDetailsWithdata(vals)); }); } - else{ + else { const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; control.push(this.initBusinessAddressDetails()); - } + } } - else{ + else { const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; control.push(this.initBusinessAddressDetails()); } }); -} + } // business_years: [value.business_years], // business_month: [value.business_month], // business_address_availability: [value.business_address_availability], @@ -252,12 +250,12 @@ export class BusinessAssetsInfoComponent implements OnInit { // business_pd_visited_remark: [value.business_pd_visited_remark], // business_assets_for_address: this._formBuilder.array([]), - // business_years: [''], - // business_month: [''], - // business_address_availability: [''], - // business_is_pd_visited: [''], - // business_pd_visited_remark: [''], - // business_assets_for_address: this._formBuilder.array([ this.createBusinessAssetsForAddress() ]), + // business_years: [''], + // business_month: [''], + // business_address_availability: [''], + // business_is_pd_visited: [''], + // business_pd_visited_remark: [''], + // business_assets_for_address: this._formBuilder.array([ this.createBusinessAssetsForAddress() ]), /** load Form Data */ formLoadData(val) { @@ -273,7 +271,7 @@ export class BusinessAssetsInfoComponent implements OnInit { business_assets_form_remark: [value.business_assets_form_remark || null] }); // if (value.business_address_availability == 'yes') { - + // this.addBusinessAssetsForAddress(value.business_assets_for_address); // } // else { @@ -287,8 +285,8 @@ export class BusinessAssetsInfoComponent implements OnInit { pdid: [this.pdid], formid: ['22'], company_id: [this.company_id], - business_assets_for_address: this._formBuilder.array([]), - business_assets_details: this._formBuilder.array([ this.initBusinessDetails() ]), + business_assets_for_address: this._formBuilder.array([]), + business_assets_details: this._formBuilder.array([this.initBusinessDetails()]), business_assets_form_remark: [''] }); this.loadaddresses(); @@ -299,7 +297,7 @@ export class BusinessAssetsInfoComponent implements OnInit { // convenience getter for easy access to form fields get f() { return this._businessAssetsQuesFrom.controls; } - + // Dynamic Form field creation Functionality : START ===> initBusinessDetails() { return this._formBuilder.group({ @@ -319,25 +317,25 @@ export class BusinessAssetsInfoComponent implements OnInit { initBusinessAddressDetails() { return this._formBuilder.group({ - address_label:[''], - business_years: [''], - business_month: [''], - business_address_availability: [''], - business_is_pd_visited: [''], - business_pd_visited_remark: [''], - // this.createBusinessAssetsForAddress() - // business_details: this._formBuilder.array([]), - business_approximate_market_value: [''], - business_ownership_type: [''], - business_monthly_rented_amt: [''], - business_name_of_the_owner: [''], - business_name_of_the_other_owner: [''], - business_vintage: [''], - business_purchase_year: ['', Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], - business_emi: [''], + address_label: [''], + business_years: [''], + business_month: [''], + business_address_availability: [''], + business_is_pd_visited: [''], + business_pd_visited_remark: [''], + // this.createBusinessAssetsForAddress() + // business_details: this._formBuilder.array([]), + business_approximate_market_value: [''], + business_ownership_type: [''], + business_monthly_rented_amt: [''], + business_name_of_the_owner: [''], + business_name_of_the_other_owner: [''], + business_vintage: [''], + business_purchase_year: ['', Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], + business_emi: [''], }); } - + // createBusinessAssetsForAddress(): FormGroup { // return this._formBuilder.group({ // business_approximate_market_value: [''], @@ -427,7 +425,7 @@ export class BusinessAssetsInfoComponent implements OnInit { }); } - + loadPropertyWithData(data) { return this._formBuilder.group({ property_type: [data.property_type], @@ -489,25 +487,25 @@ export class BusinessAssetsInfoComponent implements OnInit { initBusinessAddressDetailsWithdata(data) { return this._formBuilder.group({ - address_label:[data.address_label], - business_years: [data.business_years], - business_month: [data.business_month], - business_address_availability: [data.business_address_availability], - business_is_pd_visited: [data.business_is_pd_visited], - business_pd_visited_remark: [data.business_pd_visited_remark], - business_approximate_market_value: [data.business_approximate_market_value], - business_ownership_type: [data.business_ownership_type], - business_monthly_rented_amt: [data.business_monthly_rented_amt], - business_name_of_the_owner: [data.business_name_of_the_owner], - business_name_of_the_other_owner: [data.business_name_of_the_other_owner || ''], - business_vintage: [data.business_vintage], - business_purchase_year: [data.business_purchase_year, Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], - business_emi: [data.business_emi || ''], + address_label: [data.address_label], + business_years: [data.business_years], + business_month: [data.business_month], + business_address_availability: [data.business_address_availability], + business_is_pd_visited: [data.business_is_pd_visited], + business_pd_visited_remark: [data.business_pd_visited_remark], + business_approximate_market_value: [data.business_approximate_market_value], + business_ownership_type: [data.business_ownership_type], + business_monthly_rented_amt: [data.business_monthly_rented_amt], + business_name_of_the_owner: [data.business_name_of_the_owner], + business_name_of_the_other_owner: [data.business_name_of_the_other_owner || ''], + business_vintage: [data.business_vintage], + business_purchase_year: [data.business_purchase_year, Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], + business_emi: [data.business_emi || ''], }); } // addBusinessAssetsForAddress(data) { - + // var result = Object.keys(data).map(function (key) { // return data[key]; // }); @@ -516,7 +514,7 @@ export class BusinessAssetsInfoComponent implements OnInit { // this.RentAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_monthly_rented_amt); // this.appxMarketAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_approximate_market_value); // let Avaliablity = 1; - + // if(datas.business_name_of_the_owner.length > 0){ // datas.business_name_of_the_owner.forEach(option => { // if(option.id == 0 && option.group_id == 2){ @@ -547,55 +545,55 @@ export class BusinessAssetsInfoComponent implements OnInit { // control.push(this.createBusinessAssetsForAddress()); // } // } - + addBusinessAddressAssetsDetailsWithData(data) { - - var result = Object.keys(data).map(function (key) { - return data[key]; - }); - if (result.length > 0) { - result.forEach((datas, index) => { - this.RentAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_monthly_rented_amt); - this.appxMarketAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_approximate_market_value); - let Avaliablity = 1; - - if(datas.business_name_of_the_owner.length > 0){ - datas.business_name_of_the_owner.forEach(option => { - if(option.id == 0 && option.group_id == 2){ - Avaliablity = option.id; - } - }); + + var result = Object.keys(data).map(function (key) { + return data[key]; + }); + if (result.length > 0) { + result.forEach((datas, index) => { + this.RentAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_monthly_rented_amt); + this.appxMarketAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_approximate_market_value); + let Avaliablity = 1; + + if (datas.business_name_of_the_owner.length > 0) { + datas.business_name_of_the_owner.forEach(option => { + if (option.id == 0 && option.group_id == 2) { + Avaliablity = option.id; } - this.isOtherOwnerForAddress[index] = Avaliablity == 0 ? true : false; - - }); - - for (let val of result) { - let vals = { - address_label:val.address_label, - business_years: val.business_years, - business_month: val.business_month, - business_address_availability: val.business_address_availability, - business_is_pd_visited: val.business_is_pd_visited, - business_pd_visited_remark: val.business_pd_visited_remark, - business_approximate_market_value: val.business_approximate_market_value, - business_ownership_type: val.business_ownership_type, - business_monthly_rented_amt: val.business_monthly_rented_amt, - business_name_of_the_owner: val.business_name_of_the_owner, - business_name_of_the_other_owner: val.business_name_of_the_other_owner, - business_vintage: val.business_vintage, - business_purchase_year: val.business_purchase_year, - business_emi: val.business_emi - }; - const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; - control.push(this.initBusinessAddressDetailsWithdata(vals)); - // this.initBusinessDetailsWithdata(vals) + }); } - } else { + this.isOtherOwnerForAddress[index] = Avaliablity == 0 ? true : false; + + }); + + for (let val of result) { + let vals = { + address_label: val.address_label, + business_years: val.business_years, + business_month: val.business_month, + business_address_availability: val.business_address_availability, + business_is_pd_visited: val.business_is_pd_visited, + business_pd_visited_remark: val.business_pd_visited_remark, + business_approximate_market_value: val.business_approximate_market_value, + business_ownership_type: val.business_ownership_type, + business_monthly_rented_amt: val.business_monthly_rented_amt, + business_name_of_the_owner: val.business_name_of_the_owner, + business_name_of_the_other_owner: val.business_name_of_the_other_owner, + business_vintage: val.business_vintage, + business_purchase_year: val.business_purchase_year, + business_emi: val.business_emi + }; const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; - control.push(this.initBusinessAddressDetails()); + control.push(this.initBusinessAddressDetailsWithdata(vals)); + // this.initBusinessDetailsWithdata(vals) } + } else { + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + control.push(this.initBusinessAddressDetails()); } + } addBusinessAssetsDetailsWithData(supp_data) { @@ -608,16 +606,16 @@ export class BusinessAssetsInfoComponent implements OnInit { this.appxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.business_approximate_market_value); this.RentAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.business_monthly_rented_amt); let Avaliablity = 1; - console.log('datas.business_name_of_the_owner.length',datas.business_name_of_the_owner.length); - if(datas.business_name_of_the_owner.length > 0){ - datas.business_name_of_the_owner.forEach(option => { - if(option.id == 0 && option.group_id == 2){ - Avaliablity = option.id; - } - }); + + if (datas.business_name_of_the_owner.length > 0) { + datas.business_name_of_the_owner.forEach(option => { + if (option.id == 0 && option.group_id == 2) { + Avaliablity = option.id; + } + }); } this.isOtherOwner[index] = Avaliablity == 0 ? true : false; - + }); for (let val of result) { @@ -780,18 +778,17 @@ export class BusinessAssetsInfoComponent implements OnInit { } /** To Convert Month into Year */ - ConvertMonthintoYear(e,i) { + ConvertMonthintoYear(e, i) { // const address_control = this._EditPDtriggerForm.controls['addresses']; - // console.log(e); - // console.log(i); + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; - + // control.controls[i]['controls'].isactive.setValue(0); // address_control.controls[index].disable(); - // console.log(by); + // return; - // console.log('address_control',address_control); + let business_year = control.controls[i]['controls'].business_years.value; @@ -827,7 +824,7 @@ export class BusinessAssetsInfoComponent implements OnInit { } } - checkWithExistBusinessYear(e,i) { + checkWithExistBusinessYear(e, i) { const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; if (+e > this.generalExistBusinessYear) { this.yearErrorMessage[i] = "Higher than Business Vintage"; @@ -838,62 +835,62 @@ export class BusinessAssetsInfoComponent implements OnInit { this.yearErrorMessage[i] = ''; } } - setRequiredValidation2(value, ParInx,ChdInx, flag) { + setRequiredValidation2(value, ParInx, ChdInx, flag) { if (flag == 4) { let ParCtrls = this._businessAssetsQuesFrom.controls.assets_details; - let ChdCtrls:any = ParCtrls.controls[ParInx]; + let ChdCtrls: any = ParCtrls.controls[ParInx]; let Avaliablity = 1; - value.forEach(option => { - if(option.id == 0 && option.group_id == 2){ - Avaliablity = option.id; - } - }); - if(Avaliablity == 0){ - + value.forEach(option => { + if (option.id == 0 && option.group_id == 2) { + Avaliablity = option.id; + } + }); + if (Avaliablity == 0) { + ChdCtrls.controls.business_name_of_the_other_owner.setValidators([Validators.required]); - this.isOtherOwner[ParInx] = true; - }else{ - + this.isOtherOwner[ParInx] = true; + } else { + ChdCtrls.controls.business_name_of_the_other_owner.setValue(''); ChdCtrls.controls.business_name_of_the_other_owner.clearValidators(); - this.isOtherOwner[ParInx] = false; + this.isOtherOwner[ParInx] = false; } - + ChdCtrls.controls.business_name_of_the_other_owner.updateValueAndValidity(); } - if(flag == 8){ + if (flag == 8) { let ParCtrls = this._businessAssetsQuesFrom.controls.business_assets_for_address; - let ChdCtrls:any = ParCtrls.controls[ParInx]; + let ChdCtrls: any = ParCtrls.controls[ParInx]; let Avaliablity = 1; - value.forEach(option => { - if(option.id == 0 && option.group_id == 2){ - Avaliablity = option.id; - } - }); + value.forEach(option => { + if (option.id == 0 && option.group_id == 2) { + Avaliablity = option.id; + } + }); - if(Avaliablity == 0){ + if (Avaliablity == 0) { ChdCtrls.controls.business_name_of_the_other_owner.setValidators([Validators.required]); - this.isOtherOwnerForAddress[ParInx] = true; - }else{ + this.isOtherOwnerForAddress[ParInx] = true; + } else { ChdCtrls.controls.business_name_of_the_other_owner.setValue(''); ChdCtrls.controls.business_name_of_the_other_owner.clearValidators(); - this.isOtherOwnerForAddress[ParInx] = false; + this.isOtherOwnerForAddress[ParInx] = false; } - + ChdCtrls.controls.business_name_of_the_other_owner.updateValueAndValidity(); - + } } setRequiredValidation(value, item, flag) { if (flag == 1) { if (value == 'yes') { - item.controls.business_years.setValidators([Validators.required]); + item.controls.business_years.setValidators([Validators.required]); item.controls.business_address_availability.setValidators([Validators.required]); item.controls.business_is_pd_visited.setValidators([Validators.required]); item.controls.business_pd_visited_remark.setValidators([Validators.required]); @@ -910,7 +907,7 @@ export class BusinessAssetsInfoComponent implements OnInit { item.controls.business_address_availability.updateValueAndValidity(); item.controls.business_is_pd_visited.updateValueAndValidity(); item.controls.business_pd_visited_remark.updateValueAndValidity(); - + } if (flag == 3) { if (value == 'owned') { @@ -924,7 +921,7 @@ export class BusinessAssetsInfoComponent implements OnInit { item.controls.business_monthly_rented_amt.updateValueAndValidity(); item.controls.business_name_of_the_owner.updateValueAndValidity(); } - + if (flag == 5) { value == 1 ? item.controls.other_vehicle_type.setValidators([Validators.required]) @@ -954,7 +951,7 @@ export class BusinessAssetsInfoComponent implements OnInit { item.controls.business_monthly_rented_amt.updateValueAndValidity(); item.controls.business_name_of_the_owner.updateValueAndValidity(); } - + } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.html index fce0202d3..186f95c51 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.html @@ -1,249 +1,310 @@ -

-
- {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
- {{pageTitle}} -
-
- -
-

- - - - - - -
- - - - -

Banking Details #{{i+1}} -

-
- -
- - - - - {{val.name}} - - - - - - - - - - + + + + + + {{val.name}} + + + + + + + + + + Select - {{ btLen.lender_name }} - - - - - - - - - - Select - {{ prop.name }} - - - - - - Select - Yes - No - - - -
- - - Select - Yes - No - NA - - - - - - {{"₹"}} {{amtInwords[i]}} Only - -
-
- -
-
- - - - - - -
-
- -
- -
- + + {{"₹"}} + {{amtInwords[i]}} Only +
+
+
+ +
+
+ + + + + + +
+
+ +
+ +
+ - - - - -
- -
- -
- - +
+ +
+ + + + - -
- - -
- - - -
-
-
-
-
-
-
Image 1
-
+ +
+ + + + + + +
+
+
+
+
+
+
Image 1
-
-
-
-
Image 2
-
+
+
+
+
+
Image 2
-
-
-
-
Image 3
-
-
-
- + + + + + + +
+ + Remarks + +
-
- - - +
+ +
+ + + + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.ts index 0be70f0f9..55b7d005b 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.ts @@ -1,32 +1,32 @@ import { - Component, - OnInit, - Inject, - Input + Component, + OnInit, + Inject, + Input } from '@angular/core'; import { - FormBuilder, - FormGroup, - Validators, - FormArray, FormControl, AbstractControl, + FormBuilder, + FormGroup, + Validators, + FormArray, FormControl, AbstractControl, } from '@angular/forms'; import { NotifierService } from 'angular-notifier'; import { - MatDialog, - MatDialogRef, - MAT_DIALOG_DATA + MatDialog, + MatDialogRef, + MAT_DIALOG_DATA } from '@angular/material'; /** Service */ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; -import {ActivatedRoute, Router} from "@angular/router"; +import { ActivatedRoute, Router } from "@angular/router"; @Component({ - selector: 'app-business-banking-details', - templateUrl: './business-banking-details.component.html', - styleUrls: ['./business-banking-details.component.scss'] + selector: 'app-business-banking-details', + templateUrl: './business-banking-details.component.html', + styleUrls: ['./business-banking-details.component.scss'] }) export class BusinessBankingDetailsComponent implements OnInit { customer_segment_abbr: any; @@ -34,99 +34,99 @@ export class BusinessBankingDetailsComponent implements OnInit { lender_applicant_id: any; main_applicant: any; - pdid: number; - pageTitle: string ="Banking Information"; + pdid: number; + pageTitle: string = "Banking Information"; public bankingForm: FormGroup; step: number; private notifier: NotifierService; - public pd_cus_segment:string; + public pd_cus_segment: string; public applicants: any; - m_accountType= []; + m_accountType = []; m_btLenderList = []; - salaryField : boolean; - OtherFlag : any = []; - limitCaseFlag : any = []; - amtInwords : any = []; - emiAmtInwords : any = []; - - existCompanyList: any =[]; - mergeCompanyApplicant: any=[]; + salaryField: boolean; + OtherFlag: any = []; + limitCaseFlag: any = []; + amtInwords: any = []; + emiAmtInwords: any = []; + + existCompanyList: any = []; + mergeCompanyApplicant: any = []; company_id: String; constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, - private router: Router, - private _pd: PdTrigerService, - private dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { - this.pdid = this.pd_all_details.pdmaster_details.pd_id; - this.pd_cus_segment = this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase(); - this.pd_cus_segment = this.pd_cus_segment.substring(0,3); - this.applicants = this.pd_all_details.pdapplicants_detials; - this.applicants = this.applicants.filter(appt=>appt.applicant_type != 2) - this.applicants.push({'pd_co_applicant_id':'0','applicant_name':'Others'}); - this.notifier = notifier; - this.company_id = this.pd_all_details.company_id; - this.pageTitle = this.pd_all_details.company_name + ' - ' +this.pageTitle ; - this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; - this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; - this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; - this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; - } + private router: Router, + private _pd: PdTrigerService, + private dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { + this.pdid = this.pd_all_details.pdmaster_details.pd_id; + this.pd_cus_segment = this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase(); + this.pd_cus_segment = this.pd_cus_segment.substring(0, 3); + this.applicants = this.pd_all_details.pdapplicants_detials; + this.applicants = this.applicants.filter(appt => appt.applicant_type != 2) + this.applicants.push({ 'pd_co_applicant_id': '0', 'applicant_name': 'Others' }); + this.notifier = notifier; + this.company_id = this.pd_all_details.company_id; + this.pageTitle = this.pd_all_details.company_name + ' - ' + this.pageTitle; + this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; + this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; + this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; + this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + } public viewerOptions: any = { - navbar: false, - toolbar: { - zoomIn: 4, - zoomOut: 4, - oneToOne: 4, - reset: 4, - prev: 4, - play: { - show: 4, - size: 'large', - }, - next: 4, - rotateLeft: 4, - rotateRight: 4, - flipHorizontal: 4, - flipVertical: 4, - } -}; + navbar: false, + toolbar: { + zoomIn: 4, + zoomOut: 4, + oneToOne: 4, + reset: 4, + prev: 4, + play: { + show: 4, + size: 'large', + }, + next: 4, + rotateLeft: 4, + rotateRight: 4, + flipHorizontal: 4, + flipVertical: 4, + } + }; - ngOnInit() { + ngOnInit() { this.step = 0; this.initBankingForm(); - this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{ - if(data.dataStatus){ - this.existCompanyList = data.records.filter(val =>val.is_active===true);/* && val.is_company_applicant===true && val.company_order_id==this.company_id */ + this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data => { + if (data.dataStatus) { + this.existCompanyList = data.records.filter(val => val.is_active === true);/* && val.is_company_applicant===true && val.company_order_id==this.company_id */ } - - let modifyCompanyList : any=[]; - if(this.existCompanyList.length>0){ - modifyCompanyList = this.existCompanyList.map(element => { - return {id:element.company_order_id.toString(),name:element.company_name,group_id:1}; - }); - this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList}) - + + let modifyCompanyList: any = []; + if (this.existCompanyList.length > 0) { + modifyCompanyList = this.existCompanyList.map(element => { + return { id: element.company_order_id.toString(), name: element.company_name, group_id: 1 }; + }); + this.mergeCompanyApplicant.push({ groupName: 'COMPANIES', groupValues: modifyCompanyList }) + + } + let modifyApplicantList: any = []; + if (this.applicants.length > 0) { + modifyApplicantList = this.applicants.map(element => { + return { id: element.pd_co_applicant_id, name: element.applicant_name, group_id: 2 }; + }); + this.mergeCompanyApplicant.push({ groupName: 'APPLICANTS', groupValues: modifyApplicantList }) } - let modifyApplicantList: any=[]; - if(this.applicants.length > 0){ - modifyApplicantList = this.applicants.map(element => { - return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2}; - }); - this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList}) - } }) - + this.getM_AccountType(); this.getM_BTLenderList(); - - this.salaryField = this.pd_cus_segment.substring(0,2) == 'SE' ? false : true ; + + this.salaryField = this.pd_cus_segment.substring(0, 2) == 'SE' ? false : true; let params: any = {}; params.pd_id = this.pdid; params.pd_form_id = '21'; params.company_id = this.company_id; this._pd.retriveForm(params).subscribe(data => { - + const control = this.bankingForm.controls['itemRows']; if (data.status == 200) { this.bankingForm.controls.banking_form_remark.setValue(data.records.banking_form_remark); @@ -136,12 +136,12 @@ export class BusinessBankingDetailsComponent implements OnInit { if (result.length == 0) { control.push(this.createBankarray()); } else { - result.forEach((datas,index) => { - this.amtInwords[index] = this._pd.convertNumberToWords(+datas.limit); + result.forEach((datas, index) => { + this.amtInwords[index] = this._pd.convertNumberToWords(+datas.limit); // this.selectedBorrower(datas.applicant_name,index); - this.selectedAccTypeChanges(+datas.account_type,index) - - // this.emiAmtInwords[index] = this._pd.convertNumberToWords(val.emi); + this.selectedAccTypeChanges(+datas.account_type, index) + + // this.emiAmtInwords[index] = this._pd.convertNumberToWords(val.emi); control.push(this.createBankarray()); }); this.bankingForm.controls.itemRows.setValue(result); @@ -154,24 +154,24 @@ export class BusinessBankingDetailsComponent implements OnInit { // ====================== - getM_AccountType() { - this._pd.getAllMasterDatas('ACCOUNTTYPE').subscribe( - data => { - this.m_accountType = data.records.filter(data => data.isactive == 1); - }, - error => { - this.notifier.notify('warning', 'No Category Records Found.!'); - // this.m_assets_type = "No Category Records Found."; - } - ) - } + getM_AccountType() { + this._pd.getAllMasterDatas('ACCOUNTTYPE').subscribe( + data => { + this.m_accountType = data.records.filter(data => data.isactive == 1); + }, + error => { + this.notifier.notify('warning', 'No Category Records Found.!'); + // this.m_assets_type = "No Category Records Found."; + } + ) + } - getM_BTLenderList(){ - this._pd.getAllMasterDatas('BTLENDERLIST').subscribe( - data => { - this.m_btLenderList = data.records.filter(data => data.isactive == 1 && data.lender_type == 1); - }) - } + getM_BTLenderList() { + this._pd.getAllMasterDatas('BTLENDERLIST').subscribe( + data => { + this.m_btLenderList = data.records.filter(data => data.isactive == 1 && data.lender_type == 1); + }) + } public initBankingForm(): void { this.bankingForm = this.fb.group({ @@ -183,12 +183,12 @@ export class BusinessBankingDetailsComponent implements OnInit { createBankarray() { return this.fb.group({ applicant_name: [''], - other_applicant : [''], + other_applicant: [''], bank_name: [''], other_bank: [''], account_type: [''], //salary: [''], - salary: this.pd_cus_segment.substring(0,2) == 'SE' ? [''] : [''], + salary: this.pd_cus_segment.substring(0, 2) == 'SE' ? [''] : [''], limit: [''], //is_main: [''], //is_main: [this.pd_cus_segment == 'SAL' ? '' : ''], @@ -213,7 +213,7 @@ export class BusinessBankingDetailsComponent implements OnInit { } deleteBankdetails(index: number) { - + const control = this.bankingForm.controls['itemRows']; control.removeAt(index); } @@ -223,34 +223,34 @@ export class BusinessBankingDetailsComponent implements OnInit { } bankSubmit() { - let records: any = {}; - records.pdid = this.pdid; - records.formid = '21'; - records.company_id = this.company_id; records.banking_form_remark = this.bankingForm.controls.banking_form_remark.value; - // records.fk_createdby = '252'; - records.banking_details = this.bankingForm.controls['itemRows'].value; - - this._pd.saveForm(records).subscribe(data => { - if(data.status == 200) { - this.notifier.notify('success', 'Saved Successfully.'); - // this.dialogRef.close(); - setTimeout(() =>{ - this.dialogRef.close(); - },3000); - } - else{ - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - } - }, error => { + let records: any = {}; + records.pdid = this.pdid; + records.formid = '21'; + records.company_id = this.company_id; records.banking_form_remark = this.bankingForm.controls.banking_form_remark.value; + // records.fk_createdby = '252'; + records.banking_details = this.bankingForm.controls['itemRows'].value; + + this._pd.saveForm(records).subscribe(data => { + if (data.status == 200) { + this.notifier.notify('success', 'Saved Successfully.'); + // this.dialogRef.close(); + setTimeout(() => { + this.dialogRef.close(); + }, 3000); + } + else { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - }); + } + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }); } validateAllFormFields(formGroup: FormGroup) { Object.keys(formGroup.controls).forEach(field => { const control = formGroup.get(field); if (control instanceof FormControl) { - control.markAsTouched({onlySelf: true}); + control.markAsTouched({ onlySelf: true }); } else if (control instanceof FormGroup) { this.validateAllFormFields(control); } @@ -268,84 +268,84 @@ export class BusinessBankingDetailsComponent implements OnInit { // compare objects for merge two master table details - compareObjects(o1: any, o2: any) { - if(o1.id == o2.id && o1.group_id == o2.group_id) - return true; - else return false - } + compareObjects(o1: any, o2: any) { + if (o1.id == o2.id && o1.group_id == o2.group_id) + return true; + else return false + } // check others - checkOthers(values){ - if(values!=null) { - return values.id==0 ? true : false; - } - else { - return false; - } - - } + checkOthers(values) { + if (values != null) { + return values.id == 0 ? true : false; + } + else { + return false; + } - selectedAccTypeChanges(event: any,i){ - - if(event == 2 || event == 1) { + } + + selectedAccTypeChanges(event: any, i) { + + if (event == 2 || event == 1) { this.limitCaseFlag[i] = false; - + // const control = this.bankingForm.controls['itemRows']; - + // control.controls[0].get('limit').clearValidators(); // control.controls[0].get('limit').updateValueAndValidity(); - + } - else{ + else { this.limitCaseFlag[i] = true; } } /** To Convert Month into Year */ - ConvertMonthintoYear(itemrow,e){ - - + ConvertMonthintoYear(itemrow, e) { + + let year = itemrow.controls.vintage_year.value; - - let converted_month : number = e%12; - let converted_year : number = e/12; + + let converted_month: number = e % 12; + let converted_year: number = e / 12; itemrow.controls.vintage_year.setValue(+year + +Math.floor(converted_year)); itemrow.controls.vintage_month.setValue(Math.floor(converted_month)); - + } /** Amount InWords */ - inWords(e,i,flag){ - switch(flag){ - case 1 : - this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value); - break; - case 2 : - this.emiAmtInwords[i] = this._pd.convertNumberToWords(e.target.value); - break; - default: - break; + inWords(e, i, flag) { + switch (flag) { + case 1: + this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value); + break; + case 2: + this.emiAmtInwords[i] = this._pd.convertNumberToWords(e.target.value); + break; + default: + break; } - } - - setRequiredValidation(value,item,flag) { - - if(flag == 1){ - value==0 - ? item.controls.other_applicant.setValidators([Validators.required]) - : item.controls.other_applicant.clearValidators(); - item.controls.other_applicant.updateValueAndValidity(); - } - if(flag == 2){ - value==1 - ? item.controls.other_bank.setValidators([Validators.required]) - : item.controls.other_bank.clearValidators(); - item.controls.other_bank.updateValueAndValidity(); - } - } - + + setRequiredValidation(value, item, flag) { + + if (flag == 1) { + value == 0 + ? item.controls.other_applicant.setValidators([Validators.required]) + : item.controls.other_applicant.clearValidators(); + item.controls.other_applicant.updateValueAndValidity(); + } + if (flag == 2) { + value == 1 + ? item.controls.other_bank.setValidators([Validators.required]) + : item.controls.other_bank.clearValidators(); + item.controls.other_bank.updateValueAndValidity(); + } + + } + } 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 a4d93c429..a99dcdcf6 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 @@ -3,1162 +3,1359 @@

{{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
- {{pageTitle}} + {{pageTitle}}
- - + +

- + - + - + - +
- - - {{businessEntityTypeList.section_label}} - - -
-
- - - - - {{app_par.applicant_name | titlecase}} - Others - - - - - - -
-
- - - - - - Select - Yes - No - - -
- -

No of Years in Current Business

- -
- - - - {{yearErrorMessage[i]}} - - - - {{monthErrorMessage[i]}} - - - - {{errorMessageForExistTotalWorkExperience[i]}} - -
-
- - - - -
- -
- -
- - - - -
- - - Add Other Family Members Involved In Business - - - - - - - - Title - - - + {{app_par.applicant_name + | titlecase}} + Others + + + + + + +
+
+ + + + + + Select + Yes + No + + +
+ +

No of Years in + Current Business

+ +
+ + + + {{yearErrorMessage[i]}} + + + + {{monthErrorMessage[i]}} + + + + {{errorMessageForExistTotalWorkExperience[i]}} + +
+
+ + + + +
+ +
+ + + + + + + + + + Add Other Family Members Involved In Business + + + + + + + + + Title + + + Select {{title.name}} - - - - - - Name - - - - - - - - - - Relation - - - - Select - {{member.name + ' of' | titlecase}} - - - - - - Relationship To - - - - Select - {{appc.applicant_name | titlecase}} - + + + + + + Name + - - - - - Relationship With Company - - - - Select - {{comrelShip.name}} - - - - - - - Started Business - - - - Select - Yes - No - - - - - - - - - - - - - - - - - - Type of Business Activity - - - + + + + + + + Relation + + + + Select + {{member.name + + ' of' | titlecase}} + + + + + + Relationship To + + + + Select + {{appc.applicant_name + | titlecase}} + + + + + + + Relationship With Company + + + + + Select + {{comrelShip.name}} + + + + + + + Started + Business + + + + Select + Yes + No + + + + + + + + + + + + + + + + + + Type of Business Activity + + + -
-
- {{entityType.controls.name.value | titlecase}} -
-
-
-
- - - Manufacturing Details - - - - - - +
+
+ {{entityType.controls.name.value + | titlecase}} +
+
+
+
+ + + Manufacturing Details + + + + + + + + + + Within India + Export + Both + + + + + + + Yes + No + + + +
+
+ +
+ + + + {{SL.state_name}} + + - - - Within India - Export - Both + + + {{CL.city_name}} + - - - - Yes - No - - - -
-
- -
- - - - {{SL.state_name}} - - - - - - {{CL.city_name}} - - - - - - -
-
-
-
- -
-
-
- -
-
- - States Where Max Sales Done for {{manufacturing.value.main_products}} - - - {{MSL.state_name}} - - - - - Cities Where Max Sales Done for {{manufacturing.value.main_products}} - - - {{MCL.city_name}} - - - -
-
-
- - -
-
- - - Countries Where The Export Is Being Done for {{manufacturing.value.main_products}} - - - Select - - {{CL.country_name}} - - - - - - - - - - - -
-
-
- -
-
-
-
- -

Within India

-
- - - Yes - No - - -
-
-
- - - - {{SL.state_name}} - - - - - - {{CL.city_name}} - - - - - -
-
-
- -
-
- -
-
-
- - States Where Max Sales Done for {{manufacturing.value.main_products}} - - - {{MSL.state_name}} - - - - - Cities Where Max Sales Done for {{manufacturing.value.main_products}} - - - {{MCL.city_name}} - - - -
-
-

Export

-
-
- - Countries Where The Export Is Being Done for {{manufacturing.value.main_products}} - - - {{CL.country_name}} - - - - - - - - - - -
-
-
-
- -
-
- -
+ +
+
+
+
+ +
+
+
-
- - - Description of {{manufacturing.value.main_products}} manufacturing process - +
+
+ + States Where Max Sales Done for + {{manufacturing.value.main_products}} + + + {{MSL.state_name}} + + -
- -
- - - + + Cities Where Max Sales Done for + {{manufacturing.value.main_products}} + + + {{MCL.city_name}} + + + +
+
+ + + +
+
+ + + Countries Where The Export Is Being Done for + {{manufacturing.value.main_products}} + + + Select + + {{CL.country_name}} + + + + + + + + + + + +
+
+
+ +
+
+
+
+ + +

Within India

+
+ + + Yes + No + + +
+
+
+ + + + {{SL.state_name}} + + + + + + {{CL.city_name}} + + + + + +
+
+
+ +
+
+ +
+
+
+ + States Where Max Sales Done for + {{manufacturing.value.main_products}} + + + {{MSL.state_name}} + + + + + Cities Where Max Sales Done for + {{manufacturing.value.main_products}} + + + {{MCL.city_name}} + + + +
+
+

Export

+
+
+ + Countries Where The Export Is Being Done for + {{manufacturing.value.main_products}} + + + {{CL.country_name}} + + + + + + + + + + +
+
+
+
+ +
+
+ +
+
- - + + + Description of {{manufacturing.value.main_products}} + manufacturing process + + +
+ +
- - - Retail Trading Details - - - - - - - - - - Within India - Export - Both - - - - - - Yes - No - - - -
-
- - - - {{SL.state_name}} - - - - - - {{CL.city_name}} - - - - - - - -
-
-
- -
-
-
-
-
- - States Where Max Sales Done for {{retail.value.main_products}} - - + + + + + + + + Retail Trading Details + + + + + + + + + + Within India + Export + Both + + + + + + Yes + No + + + +
+
+ + + + {{SL.state_name}} + + + + + + {{CL.city_name}} + + + + + + + +
+
+
+ +
+
+
+
+
+ + States Where Max Sales Done for + {{retail.value.main_products}} + + + {{MSL.state_name}} - + - Cities Where Max Sales Done for {{retail.value.main_products}} + Cities Where Max Sales Done for + {{retail.value.main_products}} - - - {{MCL.city_name}} - - - -
-
-
- - -
-
- - - Countries Where Export Is Being Done for {{retail.value.main_products}} - - - - - {{CL.country_name}} - - - - - - - - - -
-
-
- -
-
-
-
- - -

Within India

- -
- - - Yes - No - - -
-
-
- - - - {{SL.state_name}} - - - - - - {{CL.city_name}} - - - - - - -
-
-
- -
-
-
-
-
- - States Where Max Sales Done for {{retail.value.main_products}} - - - {{MSL.state_name}} - - - - - Cities Where Max Sales Done for {{retail.value.main_products}} - - - - {{MCL.city_name}} - - - -
-
-

Export

-
-
- - Countries Where The Export Is Being Done for {{retail.value.main_products}} - - - - {{CL.country_name}} - - - - - - - - - - -
-
-
-
- -
-
- - - -
- -
- - - Description of {{retail.value.main_products}} Retailing process - - -
- -
-
-
- -
- - - -
- - - Wholesale Trade Details - - - - - - - - - - Within India - Export - Both - - - - - - Yes - No - - - -
-
- - - - - {{SL.state_name}} - - - - - - {{CL.city_name}} - - - - - - -
-
-
- -
-
-
-
-
- - States Where Max Sales Done for {{wholesale.value.main_products}} - - - - {{MSL.state_name}} - - - - - Cities Where Max Sales Done for {{wholesale.value.main_products}} - - - - {{MCL.city_name}} - - - -
-
-
- - -
-
- - - Countries Where The Export Is Being Done for {{wholesale.value.main_products}} - - - {{CL.country_name}} - - - - - - - - - -
-
-
- -
-
-
-
- -

Within India

-
- - - Yes - No - - -
-
-
- - - - {{SL.state_name}} - - - - - - {{CL.city_name}} - - - - - - -
-
-
- -
-
- -
-
-
- - States Where Max Sales Done for {{wholesale.value.main_products}} - - - - {{MSL.state_name}} - - - - - Cities Where Max Sales Done for {{wholesale.value.main_products}} - - - - {{MCL.city_name}} - - - -
-
-

Export

-
-
- - Cities Where Max Sales Done for {{wholesale.value.main_products}} - - Countries Where The Export Is Being Done for {{wholesale.value.main_products}} - - - {{CL.country_name}} - - - - - - - - - - -
-
-
- -
-
-
- - -
- -
- - - Description of {{wholesale.value.main_products}} Wholesale process - + + + {{MCL.city_name}} + + -
- -
-
-
- -
- - - -
- - - Service Provider Details - - - - - - - - - - Within India - Export - Both - - - - - - Yes - No - - - -
-
+
+
+
- - - - {{SL.state_name}} - - - - - - {{CL.city_name}} - - - - -
-
-
- -
-
-
-
-
- - States Where Max Revenue From Services for {{serviceprovider.value.main_products}} + +
+
- - - {{MSL.state_name}} - - - - - Cities Where Max Revenue From Services for {{serviceprovider.value.main_products}} + + Countries Where Export Is Being Done for + {{retail.value.main_products}} - - - {{MCL.city_name}} - - - -
-
-
- - -
-
- - - Countries Where The Export Is Being Done for {{serviceprovider.value.main_products}} - - - {{CL.country_name}} - - - - - - - - -
-
-
- -
-
-
-
- - -

Within India

-
- - - Yes - No - - -
-
-
- - - - {{SL.state_name}} - - - - - - {{CL.city_name}} - - - - - -
-
-
- -
-
- -
-
-
- - States Where Max Revenue From Services for {{serviceprovider.value.main_products}} - - - - {{MSL.state_name}} - - - - - Cities Where Max Revenue From Services for {{serviceprovider.value.main_products}} - - - - {{MCL.city_name}} - - - -
-
-

Export

-
-
- - Countries Where The Export Is Being Done for {{serviceprovider.value.main_products}} - - - {{CL.country_name}} - - - - - - - - - -
-
-
- -
-
-
- - -
- - - - - Description of {{serviceprovider.value.main_products}} Service Process - + + + + {{CL.country_name}} + + -
- + + + + + + +
+
+
+
- - - +
+
+ + + +

Within India

+ +
+ + + Yes + No + + +
+
+
+ + + + {{SL.state_name}} + + + + + + {{CL.city_name}} + + + + + + +
+
+
+ +
+
+
+
+
+ + States Where Max Sales Done for + {{retail.value.main_products}} + + + {{MSL.state_name}} + + + + + Cities Where Max Sales Done for + {{retail.value.main_products}} + + + + {{MCL.city_name}} + + + +
+
+

Export

+
+
+ + Countries Where The Export Is Being Done for + {{retail.value.main_products}} + + + + {{CL.country_name}} + + + + + + + + + + +
+
+
+
+ +
+
+ + + +
+ - - + + + Description of {{retail.value.main_products}} Retailing + process + + +
+ +
- + + + Yes + No + + + +
+
+ + + + + {{SL.state_name}} + + + + + + {{CL.city_name}} + + + + + + +
+
+
+ +
+
+
+
+
+ + States Where Max Sales Done for + {{wholesale.value.main_products}} + + + + {{MSL.state_name}} + + + + + Cities Where Max Sales Done for + {{wholesale.value.main_products}} + + + + {{MCL.city_name}} + + + +
+
+
+ + +
+
+ + + Countries Where The Export Is Being Done for + {{wholesale.value.main_products}} + + + {{CL.country_name}} + + + + + + + + + +
+
+
+ +
+
+
+
+ +

Within India

+
+ + + Yes + No + + +
+
+
+ + + + {{SL.state_name}} + + + + + + {{CL.city_name}} + + + + + + +
+
+
+ +
+
+ +
+
+
+ + States Where Max Sales Done for + {{wholesale.value.main_products}} + + + + {{MSL.state_name}} + + + + + Cities Where Max Sales Done for + {{wholesale.value.main_products}} + + + + {{MCL.city_name}} + + + +
+
+

Export

+
+
+ + Cities Where Max Sales Done for + {{wholesale.value.main_products}} + + Countries Where The Export Is Being Done for + {{wholesale.value.main_products}} + + + {{CL.country_name}} + + + + + + + + + + +
+
+
+ +
+
+
+ + +
+ + + + + Description of {{wholesale.value.main_products}} Wholesale + process + + +
+ +
+
+ + + + + + + + + + Service Provider Details + + + + + + + + + + Within India + Export + Both + + + + + + Yes + No + + + +
+
+ + + + + {{SL.state_name}} + + + + + + {{CL.city_name}} + + + + +
+
+
+ +
+
+
+
+
+ + States Where Max Revenue From Services for + {{serviceprovider.value.main_products}} + + + + {{MSL.state_name}} + + + + + Cities Where Max Revenue From Services for + {{serviceprovider.value.main_products}} + + + + {{MCL.city_name}} + + + +
+
+
+ + +
+
+ + + Countries Where The Export Is Being Done for + {{serviceprovider.value.main_products}} + + + {{CL.country_name}} + + + + + + + + +
+
+
+ +
+
+
+
+ + +

Within India

+
+ + + Yes + No + + +
+
+
+ + + + {{SL.state_name}} + + + + + + {{CL.city_name}} + + + + + +
+
+
+ +
+
+ +
+
+
+ + States Where Max Revenue From Services for + {{serviceprovider.value.main_products}} + + + + {{MSL.state_name}} + + + + + Cities Where Max Revenue From Services for + {{serviceprovider.value.main_products}} + + + + {{MCL.city_name}} + + + +
+
+

Export

+
+
+ + Countries Where The Export Is Being Done for + {{serviceprovider.value.main_products}} + + + {{CL.country_name}} + + + + + + + + + +
+
+
+ +
+
+
+ + +
+ +
+ + + Description of {{serviceprovider.value.main_products}} + Service Process + + +
+ +
+
+
+ +
+ + + +
+ - - - Export Sale As a % Total Sales - - - - - - - + + + Export Sale As a % Total Sales + + + + + + + - - - Digital Payments - - - - - Yes - No + + + Digital Payments + + + + + Yes + No + + + + + Yes + No + + + + + + + +
+
+ + + Select + {{ + b.lender_name }} - - - - Yes - No - - - - - - - -
-
- - - Select - {{ b.lender_name }} - - - - - -
-
-
-
- - - - - Seasonality - -
- - - - Yes - No Major Changes In Sales - - - - - January - February - March - April - May - June - July - August - September - October - November - December - - - -
-
- - - - - + + Yes + No Major Changes In Sales + + + + + + January + February + March + April + May + June + July + August + September + October + November + December + + + +
+
+ + + + + -
- - -
-
- - - Employees As Per Applicant - - - -
+
+ + +
+
+ + + Employees As Per Applicant + + + +
- + - + - + -
- - - {{"₹"}} {{appxSalaryAmtInwords}} Only - - -
-
- - - No of Employees Sighted By PD Officer During His Visit - - - - - - - - - - Yes - No - - - - - - - - Documents Sighted - - - - - Yes - No - Not Applicable - - - - - Yes - No - Not Applicable - - - - - Yes - No - Not Applicable - - - - - Yes - No - Not Applicable - - - - - Yes - No - Not Applicable - - - - - Yes - No - Not Applicable - - - - - Yes - No - Not Applicable - - - - - - Yes - No - - - -
-
- - - - - - - -
-
-
- -
-
+ + + Yes + No + + + + + + + + Documents Sighted + + + + + Yes + No + Not Applicable + + + + + Yes + No + Not Applicable + + + + + Yes + No + Not Applicable + + + + + Yes + No + Not Applicable + + + + + Yes + No + Not Applicable + + + + + Yes + No + Not Applicable + + + + + Yes + No + Not Applicable + + + + + + Yes + No + + + +
+
+ + + + + + +
- - - +
+
+ +
+
+
+ +
+
- -
-
-
-
-
-
-
Image 1
-
-
-
-
-
-
-
Image 2
-
-
-
-
-
-
-
Image 3
-
-
-
-
-
-
-
Image 2
-
-
-
-
-
-
-
Image 3
-
-
-
-
-
-
-
Image 1
-
-
-
+ + + +
+
+ -
- - Remarks - - -
-
- -
+
+ + Remarks + + +
+
+ +
\ No newline at end of file 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 bebd66f50..8be3a6e6c 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 @@ -21,8 +21,8 @@ import { } from '@angular/material'; /** Service */ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; -import {ActivatedRoute, Router} from "@angular/router"; -import {DatePipe } from '@angular/common'; +import { ActivatedRoute, Router } from "@angular/router"; +import { DatePipe } from '@angular/common'; @Component({ selector: 'app-business-info', @@ -39,99 +39,99 @@ export class BusinessInfoComponent implements OnInit { company_id: String; company_name: String; form_id: number; - pageTitle: string ="About Business"; + pageTitle: string = "About Business"; relationData: any = []; titleData: any = []; personsList: any = []; - companyRelationShipList: any =[]; + companyRelationShipList: any = []; //industryData: any = []; activityData: any = []; stateList: any = []; - countryDataList : any = []; + countryDataList: any = []; bankList = []; relativeNames: any; applicants: any; - EntityTypeFlag : boolean = false; + EntityTypeFlag: boolean = false; public businessForm: FormGroup; private notifier: NotifierService; - // businessEntityTypeList: any=["Private Limited Company","Proprietorship","Partnership","Limited Liability Partnership (LLP)","One Person Company (OPC)","Hindu Undivided Family (HUF)","Society","Cooperative","Trust","Public Ltd Company","Others"] - businessEntityTypeList: any ={ - business_entity_type_id:String, - business_entity_type_name:String, - sourcsection_labeleName:String - }; - filterCityList : any = []; - // this is for automatic bind entitity name for display + // businessEntityTypeList: any=["Private Limited Company","Proprietorship","Partnership","Limited Liability Partnership (LLP)","One Person Company (OPC)","Hindu Undivided Family (HUF)","Society","Cooperative","Trust","Public Ltd Company","Others"] + businessEntityTypeList: any = { + business_entity_type_id: String, + business_entity_type_name: String, + sourcsection_labeleName: String + }; + filterCityList: any = []; + // this is for automatic bind entitity name for display //sourceNames: any = {"Private Limited Company": 'Director / Shareholder Details',"Proprietorship": 'Proprietor Details', "Sole Proprietorship": 'Proprietor Details',"Partnership": 'Partner Details',"Limited Liability Partnership (LLP)": 'Partner Details',"One Person Company (OPC)": 'Director Details',"Hindu Undivided Family (HUF)": 'Karta Details',"Society": 'Member Details',"Cooperative": 'Member Details',"Trust": 'Trustee Details',"Public Ltd Company": 'Director / Shareholder Details','Individual':'Self',"Others": 'Other Enitity Details'}; - sourceNames: {[k: string]: any} = {}; - maxDate:any; + sourceNames: { [k: string]: any } = {}; + maxDate: any; // InvestedAmountInWords:any; - public relationSource= new MatTableDataSource(); - displayedColumns = ['title','family_member_name','relation','relation_to','relationship_with_company','started_business']; - generalExistEntityType:string; - generalExistEntityType_other:string; - generalExistBusinessYear:Number; - generalExistBusinessMonth:Number; - + public relationSource = new MatTableDataSource(); + displayedColumns = ['title', 'family_member_name', 'relation', 'relation_to', 'relationship_with_company', 'started_business']; + generalExistEntityType: string; + generalExistEntityType_other: string; + generalExistBusinessYear: Number; + generalExistBusinessMonth: Number; + //Declaration FOr Validation yearErrorMessage: any = []; monthErrorMessage: any = []; - errorMessageForExistTotalWorkExperience:any = []; + errorMessageForExistTotalWorkExperience: any = []; ExportFlag: boolean = false; appxSalaryAmtInwords: any; - isreadonlyyear:any = []; - isreadonlymonth:any = []; + isreadonlyyear: any = []; + isreadonlymonth: any = []; ManufacturingUnChecked: boolean; RetailedUnChecked: boolean; WholeSalesUnChecked: boolean; ServiceUnChecked: boolean; - temp_noofposmachine : any; - temp_additiondetailofposmachine : any = []; + temp_noofposmachine: any; + temp_additiondetailofposmachine: any = []; constructor(notifier: NotifierService, - private fb: FormBuilder, - private route: ActivatedRoute, - private router: Router, - private _pd: PdTrigerService, - @Inject(MAT_DIALOG_DATA) public pd_all_details: any, private dialog: MatDialog, private dialogRef: MatDialogRef) { - //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.pageTitle = this.pd_all_details.company_name + ' - ' +this.pageTitle ; - this.applicants = this.pd_all_details.pdapplicants_detials; - this.form_id = 13; - this.notifier = notifier; - this.generalExistEntityType = this.pd_all_details.business_entity_type; - this.generalExistEntityType_other = this.pd_all_details.business_entity_type_other; - this.generalExistBusinessYear = this.pd_all_details.business_years; - this.generalExistBusinessMonth = this.pd_all_details.business_month; - this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; - this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; - this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; - this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; - } - public viewerOptions: any = { - navbar: false, - toolbar: { - zoomIn: 4, - zoomOut: 4, - oneToOne: 4, - reset: 4, - prev: 4, - play: { - show: 4, - size: 'large', - }, - next: 4, - rotateLeft: 4, - rotateRight: 4, - flipHorizontal: 4, - flipVertical: 4, - } -}; + private fb: FormBuilder, + private route: ActivatedRoute, + private router: Router, + private _pd: PdTrigerService, + @Inject(MAT_DIALOG_DATA) public pd_all_details: any, private dialog: MatDialog, private dialogRef: MatDialogRef) { + //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.pageTitle = this.pd_all_details.company_name + ' - ' + this.pageTitle; + this.applicants = this.pd_all_details.pdapplicants_detials; + this.form_id = 13; + this.notifier = notifier; + this.generalExistEntityType = this.pd_all_details.business_entity_type; + this.generalExistEntityType_other = this.pd_all_details.business_entity_type_other; + this.generalExistBusinessYear = this.pd_all_details.business_years; + this.generalExistBusinessMonth = this.pd_all_details.business_month; + this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; + this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; + this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; + this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + } + public viewerOptions: any = { + navbar: false, + toolbar: { + zoomIn: 4, + zoomOut: 4, + oneToOne: 4, + reset: 4, + prev: 4, + play: { + show: 4, + size: 'large', + }, + next: 4, + rotateLeft: 4, + rotateRight: 4, + flipHorizontal: 4, + flipVertical: 4, + } + }; ngOnInit() { let get_max_date = this.pd_all_details.pdmaster_details.pd_date_of_initiation.split('/').reverse().join("/"); this.maxDate = new Date(get_max_date); @@ -146,9 +146,9 @@ export class BusinessInfoComponent implements OnInit { this.getTitle(); this.getAllPersons(); this.getBank(); - // const Desgn = this.businessForm.controls['designation']; - // const Partnr = this.businessForm.controls['partners']; - // const otherDoc = this.businessForm.controls['documents']; + // const Desgn = this.businessForm.controls['designation']; + // const Partnr = this.businessForm.controls['partners']; + // const otherDoc = this.businessForm.controls['documents']; let params: any = {}; params.pd_id = this.pdid; params.pd_form_id = this.form_id; @@ -156,18 +156,18 @@ export class BusinessInfoComponent implements OnInit { this._pd.retriveForm(params).subscribe(data => { let businessVal = data.records; let constVal: any; - + //const Desgn = this.businessForm.controls['designation']; const Partnr: any = this.businessForm.controls['partners']; const otherDoc = this.businessForm.controls['documents']; const personRel = this.businessForm.controls['persons_with_relationships']; const businessActivityControl = this.businessForm.controls['select_business_activity_type']; - const manufacturingControl:any = this.businessForm.controls['manufacturing_activity_details']; + const manufacturingControl: any = this.businessForm.controls['manufacturing_activity_details']; const retailControl: any = this.businessForm.controls['retail_trading_activity_details']; const wholesaleControl: any = this.businessForm.controls['wholesale_trading_activity_details']; const serviceProviderControl: any = this.businessForm.controls['service_provider_activity_details']; // const othersControl: any = this.businessForm.controls['others_activity_details']; - + if (data.status == 200) { let DocArray: any; // let DesgnArray = Object.keys(data.records.designation).map(function (key) { @@ -183,17 +183,17 @@ export class BusinessInfoComponent implements OnInit { // DesgnArray.forEach(datas => { // Desgn.push(this.createDesignation()); // }); - + // } if (PartnrArray.length == 0) { Partnr.push(this.createPartners()); } else { - PartnrArray.forEach((datas,key) => { + PartnrArray.forEach((datas, key) => { Partnr.push(this.createPartners()); - if(datas.partner_name=='Others') { + if (datas.partner_name == 'Others') { Partnr.controls[key].addControl('partner_other_name', new FormControl('', Validators.required)) } - if(parseInt(datas.total_business_experiance) > parseInt(datas.current_business_experiance_year)) { + if (parseInt(datas.total_business_experiance) > parseInt(datas.current_business_experiance_year)) { Partnr.controls[key].addControl('total_business_previous_experience', new FormControl('', Validators.required)) } else { @@ -202,14 +202,14 @@ export class BusinessInfoComponent implements OnInit { }); } if (data.records.other_documents == 'yes') { - DocArray = Object.keys(data.records.documents).map(function (key) { + DocArray = Object.keys(data.records.documents).map(function (key) { return data.records.documents[key]; }); - DocArray.forEach(datas => { - otherDoc.push(this.createDocument()); - }); + DocArray.forEach(datas => { + otherDoc.push(this.createDocument()); + }); } else { - DocArray = [{document: ''}]; + DocArray = [{ document: '' }]; otherDoc.push(this.createDocument()); } // if (data.records.ownership_setup != 'others') { @@ -221,375 +221,374 @@ export class BusinessInfoComponent implements OnInit { // person with relation ship - businessVal.pdid = this.pdid; - businessVal.formid = this.form_id; - businessVal.company_id = this.company_id; - businessVal.fk_createdby = this.pdid; - if(businessVal.employees_appx_salary){ - this.appxSalaryAmtInwords = this._pd.convertNumberToWords(businessVal.employees_appx_salary); + businessVal.pdid = this.pdid; + businessVal.formid = this.form_id; + businessVal.company_id = this.company_id; + businessVal.fk_createdby = this.pdid; + if (businessVal.employees_appx_salary) { + this.appxSalaryAmtInwords = this._pd.convertNumberToWords(businessVal.employees_appx_salary); } //businessVal.designation = DesgnArray; - businessVal.partners = PartnrArray; - businessVal.documents = DocArray; - if(data.records.persons_with_relationships){ - let selectedFamilyMember = Object.keys(data.records.persons_with_relationships).map(function (key) { - return data.records.persons_with_relationships[key]; - }); - if(selectedFamilyMember.length > 0) { - selectedFamilyMember.forEach(val=>{ - personRel.push(this.createPersonRelationhip(val)); + businessVal.partners = PartnrArray; + businessVal.documents = DocArray; + if (data.records.persons_with_relationships) { + let selectedFamilyMember = Object.keys(data.records.persons_with_relationships).map(function (key) { + return data.records.persons_with_relationships[key]; }); - businessVal.persons_with_relationships=selectedFamilyMember; - - } - else{ - businessVal.persons_with_relationships=[]; - } - } - else { - businessVal.persons_with_relationships=[]; + if (selectedFamilyMember.length > 0) { + selectedFamilyMember.forEach(val => { + personRel.push(this.createPersonRelationhip(val)); + }); + businessVal.persons_with_relationships = selectedFamilyMember; + + } + else { + businessVal.persons_with_relationships = []; + } + } + else { + businessVal.persons_with_relationships = []; + + } - } - // find exist and non-exist businees activity type list - let activityData=this.activityData.map(item=>({name : item.name,type_of_activity_id : item.type_of_activity_id})) - let exist_activity_data: any=[]; - if(data.records.select_business_activity_type){ - exist_activity_data=Object.keys(data.records.select_business_activity_type).map(function(key) { + let activityData = this.activityData.map(item => ({ name: item.name, type_of_activity_id: item.type_of_activity_id })) + let exist_activity_data: any = []; + if (data.records.select_business_activity_type) { + exist_activity_data = Object.keys(data.records.select_business_activity_type).map(function (key) { return data.records.select_business_activity_type[key].type_of_activity_id; }); } - + let actual_businees_activity = activityData.map(item => item.type_of_activity_id); - let check_exist_businees_activity =actual_businees_activity.map((id, index) => { - if (exist_activity_data.indexOf(id) < 0) { - activityData[index].exist_status=0; - return activityData[index]; - } - else{ - activityData[index].exist_status=1; - return activityData[index]; - } + let check_exist_businees_activity = actual_businees_activity.map((id, index) => { + if (exist_activity_data.indexOf(id) < 0) { + activityData[index].exist_status = 0; + return activityData[index]; + } + else { + activityData[index].exist_status = 1; + return activityData[index]; + } }).filter(item => item != undefined); - if(check_exist_businees_activity.length > 0) - { + if (check_exist_businees_activity.length > 0) { check_exist_businees_activity.forEach(val => { businessActivityControl.push(this.createEntityType(val)); }); - businessVal.select_business_activity_type=check_exist_businees_activity; + businessVal.select_business_activity_type = check_exist_businees_activity; } - + // dynamically add form group control - if(data.dataStatus){ - - if(data.records.seasonality.toUpperCase()=='YES'){ + if (data.dataStatus) { + + if (data.records.seasonality.toUpperCase() == 'YES') { this.businessForm.addControl('peak_period_of_business', new FormControl('', Validators.required)); - this.businessForm.addControl('month_of_business_run', new FormControl('', Validators.required)); } + this.businessForm.addControl('month_of_business_run', new FormControl('', Validators.required)); + } } - if(data.records.manufacturing_activity_details){ - // update manufacturing details - let selectedManufacturing = Object.keys(data.records.manufacturing_activity_details).map(function (key) { - return data.records.manufacturing_activity_details[key]; - }); - if(selectedManufacturing.length > 0) { - // this is for auto generate fields - selectedManufacturing.length > 0 ? this.businessForm.addControl('export_import_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('export_import_cert'); - selectedManufacturing.length > 0 ? this.businessForm.addControl('factory_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('factory_cert'); - selectedManufacturing.forEach((element,index)=>{ - this.CheckExport(element.area_of_sale,'MActivity',index); - manufacturingControl.push(this.createActivity()); - if(element.area_of_sale=='Within India'){ - manufacturingControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); - manufacturingControl.controls[index].addControl('pan_india_options',new FormControl('', Validators.required)); - element.india_where_sale_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = manufacturingControl.controls[index].get('india_where_sale_done') as FormArray; - innercontrol.push(this.createStateSale()) - }); - manufacturingControl.controls[index].addControl('max_sale_state_name',this.fb.array([])); - element.max_sale_state_name.forEach((innerElement,innerIndex) => { - let innercontrol:any = manufacturingControl.controls[index].get('max_sale_state_name') as FormArray; - innercontrol.push(this.createMaxSaleState()) - }); - - } - else if(element.area_of_sale=='Export'){ - manufacturingControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); - element.countries_where_export_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = manufacturingControl.controls[index].get('countries_where_export_done') as FormArray; - innercontrol.push(this.createCountrySale()) - }); - } - else if(element.area_of_sale=='Both'){ - manufacturingControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); - manufacturingControl.controls[index].addControl('pan_india_options',new FormControl('', Validators.required)); - manufacturingControl.controls[index].addControl('max_sale_state_name',this.fb.array([])); - - element.india_where_sale_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = manufacturingControl.controls[index].get('india_where_sale_done') as FormArray; - innercontrol.push(this.createStateSale()) - }); - element.max_sale_state_name.forEach((innerElement,innerIndex) => { - let innercontrol:any = manufacturingControl.controls[index].get('max_sale_state_name') as FormArray; - innercontrol.push(this.createMaxSaleState()) - }); - - manufacturingControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); - element.countries_where_export_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = manufacturingControl.controls[index].get('countries_where_export_done') as FormArray; - innercontrol.push(this.createCountrySale()) - }); - - } + if (data.records.manufacturing_activity_details) { + // update manufacturing details + let selectedManufacturing = Object.keys(data.records.manufacturing_activity_details).map(function (key) { + return data.records.manufacturing_activity_details[key]; }); - businessVal.manufacturing_activity_details=selectedManufacturing; + if (selectedManufacturing.length > 0) { + // this is for auto generate fields + selectedManufacturing.length > 0 ? this.businessForm.addControl('export_import_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('export_import_cert'); + selectedManufacturing.length > 0 ? this.businessForm.addControl('factory_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('factory_cert'); + selectedManufacturing.forEach((element, index) => { + this.CheckExport(element.area_of_sale, 'MActivity', index); + manufacturingControl.push(this.createActivity()); + if (element.area_of_sale == 'Within India') { + manufacturingControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); + manufacturingControl.controls[index].addControl('pan_india_options', new FormControl('', Validators.required)); + element.india_where_sale_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = manufacturingControl.controls[index].get('india_where_sale_done') as FormArray; + innercontrol.push(this.createStateSale()) + }); + manufacturingControl.controls[index].addControl('max_sale_state_name', this.fb.array([])); + element.max_sale_state_name.forEach((innerElement, innerIndex) => { + let innercontrol: any = manufacturingControl.controls[index].get('max_sale_state_name') as FormArray; + innercontrol.push(this.createMaxSaleState()) + }); + + } + else if (element.area_of_sale == 'Export') { + manufacturingControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); + element.countries_where_export_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = manufacturingControl.controls[index].get('countries_where_export_done') as FormArray; + innercontrol.push(this.createCountrySale()) + }); + } + else if (element.area_of_sale == 'Both') { + manufacturingControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); + manufacturingControl.controls[index].addControl('pan_india_options', new FormControl('', Validators.required)); + manufacturingControl.controls[index].addControl('max_sale_state_name', this.fb.array([])); + + element.india_where_sale_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = manufacturingControl.controls[index].get('india_where_sale_done') as FormArray; + innercontrol.push(this.createStateSale()) + }); + element.max_sale_state_name.forEach((innerElement, innerIndex) => { + let innercontrol: any = manufacturingControl.controls[index].get('max_sale_state_name') as FormArray; + innercontrol.push(this.createMaxSaleState()) + }); + + manufacturingControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); + element.countries_where_export_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = manufacturingControl.controls[index].get('countries_where_export_done') as FormArray; + innercontrol.push(this.createCountrySale()) + }); + + } + }); + businessVal.manufacturing_activity_details = selectedManufacturing; + } + else { + businessVal.manufacturing_activity_details = []; + } } - else{ - businessVal.manufacturing_activity_details=[]; - } - } else { - businessVal.manufacturing_activity_details=[]; + businessVal.manufacturing_activity_details = []; } // update retail trading - if(data.records.retail_trading_activity_details){ + if (data.records.retail_trading_activity_details) { - let selectedRetail = Object.keys(data.records.retail_trading_activity_details).map(function (key) { - return data.records.retail_trading_activity_details[key]; - }); - if(selectedRetail.length > 0) { - selectedRetail.length > 0 ? this.businessForm.addControl('export_import_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('export_import_cert'); - selectedRetail.length > 0 ? this.businessForm.addControl('applicant_use_mobile_wallets', new FormControl('')) : this.businessForm.removeControl('applicant_use_mobile_wallets'); - selectedRetail.length > 0 ? this.businessForm.addControl('applicant_use_pos_machines', new FormControl('')) : this.businessForm.removeControl('applicant_use_pos_machines'); - selectedRetail.length > 0 && businessVal.applicant_use_pos_machines == 'yes' ? this.businessForm.addControl('no_of_pos_machines', new FormControl('')): this.businessForm.removeControl('no_of_pos_machines'); - selectedRetail.length > 0 && businessVal.applicant_use_pos_machines == 'yes' ? this.businessForm.addControl('pos_machines_details', this.fb.array([])) : this.businessForm.removeControl('pos_machines_details'); - - selectedRetail.forEach((element,index)=>{ - this.CheckExport(element.area_of_sale,'RActivity',index); - retailControl.push(this.createActivity()); - if(element.area_of_sale=='Within India'){ - retailControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); - retailControl.controls[index].addControl('pan_india_options',new FormControl('', Validators.required)); - element.india_where_sale_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = retailControl.controls[index].get('india_where_sale_done') as FormArray; - innercontrol.push(this.createStateSale()) - }); - - retailControl.controls[index].addControl('max_sale_state_name',this.fb.array([])); - element.max_sale_state_name.forEach((innerElement,innerIndex) => { - let innercontrol:any = retailControl.controls[index].get('max_sale_state_name') as FormArray; - innercontrol.push(this.createMaxSaleState()) - }); - } - else if(element.area_of_sale=='Export'){ - retailControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); - element.countries_where_export_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = retailControl.controls[index].get('countries_where_export_done') as FormArray; - innercontrol.push(this.createCountrySale()) - }); - } - else if(element.area_of_sale=='Both'){ - retailControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); - retailControl.controls[index].addControl('pan_india_options',new FormControl('', Validators.required)); - retailControl.controls[index].addControl('max_sale_state_name',this.fb.array([])); - element.india_where_sale_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = retailControl.controls[index].get('india_where_sale_done') as FormArray; - innercontrol.push(this.createStateSale()) - }); - element.max_sale_state_name.forEach((innerElement,innerIndex) => { - let innercontrol:any = retailControl.controls[index].get('max_sale_state_name') as FormArray; - innercontrol.push(this.createMaxSaleState()) - }); - retailControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); - element.countries_where_export_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = retailControl.controls[index].get('countries_where_export_done') as FormArray; - innercontrol.push(this.createCountrySale()) - }); - } + let selectedRetail = Object.keys(data.records.retail_trading_activity_details).map(function (key) { + return data.records.retail_trading_activity_details[key]; }); - businessVal.retail_trading_activity_details=selectedRetail; + if (selectedRetail.length > 0) { + selectedRetail.length > 0 ? this.businessForm.addControl('export_import_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('export_import_cert'); + selectedRetail.length > 0 ? this.businessForm.addControl('applicant_use_mobile_wallets', new FormControl('')) : this.businessForm.removeControl('applicant_use_mobile_wallets'); + selectedRetail.length > 0 ? this.businessForm.addControl('applicant_use_pos_machines', new FormControl('')) : this.businessForm.removeControl('applicant_use_pos_machines'); + selectedRetail.length > 0 && businessVal.applicant_use_pos_machines == 'yes' ? this.businessForm.addControl('no_of_pos_machines', new FormControl('')) : this.businessForm.removeControl('no_of_pos_machines'); + selectedRetail.length > 0 && businessVal.applicant_use_pos_machines == 'yes' ? this.businessForm.addControl('pos_machines_details', this.fb.array([])) : this.businessForm.removeControl('pos_machines_details'); + + selectedRetail.forEach((element, index) => { + this.CheckExport(element.area_of_sale, 'RActivity', index); + retailControl.push(this.createActivity()); + if (element.area_of_sale == 'Within India') { + retailControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); + retailControl.controls[index].addControl('pan_india_options', new FormControl('', Validators.required)); + element.india_where_sale_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = retailControl.controls[index].get('india_where_sale_done') as FormArray; + innercontrol.push(this.createStateSale()) + }); + + retailControl.controls[index].addControl('max_sale_state_name', this.fb.array([])); + element.max_sale_state_name.forEach((innerElement, innerIndex) => { + let innercontrol: any = retailControl.controls[index].get('max_sale_state_name') as FormArray; + innercontrol.push(this.createMaxSaleState()) + }); + } + else if (element.area_of_sale == 'Export') { + retailControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); + element.countries_where_export_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = retailControl.controls[index].get('countries_where_export_done') as FormArray; + innercontrol.push(this.createCountrySale()) + }); + } + else if (element.area_of_sale == 'Both') { + retailControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); + retailControl.controls[index].addControl('pan_india_options', new FormControl('', Validators.required)); + retailControl.controls[index].addControl('max_sale_state_name', this.fb.array([])); + element.india_where_sale_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = retailControl.controls[index].get('india_where_sale_done') as FormArray; + innercontrol.push(this.createStateSale()) + }); + element.max_sale_state_name.forEach((innerElement, innerIndex) => { + let innercontrol: any = retailControl.controls[index].get('max_sale_state_name') as FormArray; + innercontrol.push(this.createMaxSaleState()) + }); + retailControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); + element.countries_where_export_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = retailControl.controls[index].get('countries_where_export_done') as FormArray; + innercontrol.push(this.createCountrySale()) + }); + } + }); + businessVal.retail_trading_activity_details = selectedRetail; + } + else { + businessVal.retail_trading_activity_details = []; + } + } + else { + businessVal.retail_trading_activity_details = []; } - else{ - businessVal.retail_trading_activity_details=[]; - } - } - else { - businessVal.retail_trading_activity_details=[]; - } // update whole sale details - if(data.records.wholesale_trading_activity_details){ - let selectedWholesale = Object.keys(data.records.wholesale_trading_activity_details).map(function (key) { - return data.records.wholesale_trading_activity_details[key]; - }); - if(selectedWholesale.length > 0) { - selectedWholesale.length > 0 ? this.businessForm.addControl('export_import_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('export_import_cert'); - selectedWholesale.length > 0 ? this.businessForm.addControl('applicant_use_mobile_wallets', new FormControl('')) : this.businessForm.removeControl('applicant_use_mobile_wallets'); - selectedWholesale.length > 0 ? this.businessForm.addControl('applicant_use_pos_machines', new FormControl('')) : this.businessForm.removeControl('applicant_use_pos_machines'); - selectedWholesale.length > 0 && businessVal.applicant_use_pos_machines == 'yes' ? this.businessForm.addControl('no_of_pos_machines', new FormControl('')): this.businessForm.removeControl('no_of_pos_machines'); - selectedWholesale.length > 0 && businessVal.applicant_use_pos_machines == 'yes' ? this.businessForm.addControl('pos_machines_details', this.fb.array([])) : this.businessForm.removeControl('pos_machines_details'); - - selectedWholesale.forEach((element,index)=>{ - this.CheckExport(element.area_of_sale,'WActivity',index); - wholesaleControl.push(this.createActivity()); - if(element.area_of_sale=='Within India'){ - wholesaleControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); - wholesaleControl.controls[index].addControl('pan_india_options',new FormControl('', Validators.required)); - element.india_where_sale_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = wholesaleControl.controls[index].get('india_where_sale_done') as FormArray; - innercontrol.push(this.createStateSale()) - }); - - wholesaleControl.controls[index].addControl('max_sale_state_name',this.fb.array([])); - element.max_sale_state_name.forEach((innerElement,innerIndex) => { - let innercontrol:any = wholesaleControl.controls[index].get('max_sale_state_name') as FormArray; - innercontrol.push(this.createMaxSaleState()) - }); - } - else if(element.area_of_sale=='Export'){ - wholesaleControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); - element.countries_where_export_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = wholesaleControl.controls[index].get('countries_where_export_done') as FormArray; - innercontrol.push(this.createCountrySale()) - }); - } - else if(element.area_of_sale=='Both'){ - wholesaleControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); - wholesaleControl.controls[index].addControl('pan_india_options',new FormControl('', Validators.required)); - wholesaleControl.controls[index].addControl('max_sale_state_name',this.fb.array([])); - element.india_where_sale_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = wholesaleControl.controls[index].get('india_where_sale_done') as FormArray; - innercontrol.push(this.createStateSale()) - }); - element.max_sale_state_name.forEach((innerElement,innerIndex) => { - let innercontrol:any = wholesaleControl.controls[index].get('max_sale_state_name') as FormArray; - innercontrol.push(this.createMaxSaleState()) - }); - wholesaleControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); - element.countries_where_export_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = wholesaleControl.controls[index].get('countries_where_export_done') as FormArray; - innercontrol.push(this.createCountrySale()) - }); - } - + if (data.records.wholesale_trading_activity_details) { + let selectedWholesale = Object.keys(data.records.wholesale_trading_activity_details).map(function (key) { + return data.records.wholesale_trading_activity_details[key]; }); - businessVal.wholesale_trading_activity_details=selectedWholesale; - } - else{ - businessVal.wholesale_trading_activity_details=[]; - } - } - else { - businessVal.wholesale_trading_activity_details=[]; + if (selectedWholesale.length > 0) { + selectedWholesale.length > 0 ? this.businessForm.addControl('export_import_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('export_import_cert'); + selectedWholesale.length > 0 ? this.businessForm.addControl('applicant_use_mobile_wallets', new FormControl('')) : this.businessForm.removeControl('applicant_use_mobile_wallets'); + selectedWholesale.length > 0 ? this.businessForm.addControl('applicant_use_pos_machines', new FormControl('')) : this.businessForm.removeControl('applicant_use_pos_machines'); + selectedWholesale.length > 0 && businessVal.applicant_use_pos_machines == 'yes' ? this.businessForm.addControl('no_of_pos_machines', new FormControl('')) : this.businessForm.removeControl('no_of_pos_machines'); + selectedWholesale.length > 0 && businessVal.applicant_use_pos_machines == 'yes' ? this.businessForm.addControl('pos_machines_details', this.fb.array([])) : this.businessForm.removeControl('pos_machines_details'); - } + selectedWholesale.forEach((element, index) => { + this.CheckExport(element.area_of_sale, 'WActivity', index); + wholesaleControl.push(this.createActivity()); + if (element.area_of_sale == 'Within India') { + wholesaleControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); + wholesaleControl.controls[index].addControl('pan_india_options', new FormControl('', Validators.required)); + element.india_where_sale_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = wholesaleControl.controls[index].get('india_where_sale_done') as FormArray; + innercontrol.push(this.createStateSale()) + }); + + wholesaleControl.controls[index].addControl('max_sale_state_name', this.fb.array([])); + element.max_sale_state_name.forEach((innerElement, innerIndex) => { + let innercontrol: any = wholesaleControl.controls[index].get('max_sale_state_name') as FormArray; + innercontrol.push(this.createMaxSaleState()) + }); + } + else if (element.area_of_sale == 'Export') { + wholesaleControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); + element.countries_where_export_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = wholesaleControl.controls[index].get('countries_where_export_done') as FormArray; + innercontrol.push(this.createCountrySale()) + }); + } + else if (element.area_of_sale == 'Both') { + wholesaleControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); + wholesaleControl.controls[index].addControl('pan_india_options', new FormControl('', Validators.required)); + wholesaleControl.controls[index].addControl('max_sale_state_name', this.fb.array([])); + element.india_where_sale_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = wholesaleControl.controls[index].get('india_where_sale_done') as FormArray; + innercontrol.push(this.createStateSale()) + }); + element.max_sale_state_name.forEach((innerElement, innerIndex) => { + let innercontrol: any = wholesaleControl.controls[index].get('max_sale_state_name') as FormArray; + innercontrol.push(this.createMaxSaleState()) + }); + wholesaleControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); + element.countries_where_export_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = wholesaleControl.controls[index].get('countries_where_export_done') as FormArray; + innercontrol.push(this.createCountrySale()) + }); + } + + }); + businessVal.wholesale_trading_activity_details = selectedWholesale; + } + else { + businessVal.wholesale_trading_activity_details = []; + } + } + else { + businessVal.wholesale_trading_activity_details = []; + + } // update service provider details - if(data.records.service_provider_activity_details){ + if (data.records.service_provider_activity_details) { - let selectedService = Object.keys(data.records.service_provider_activity_details).map(function (key) { - return data.records.service_provider_activity_details[key]; - }); - if(selectedService.length > 0) { - selectedService.length > 0 ? this.businessForm.addControl('practice_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('practice_cert'); - selectedService.length > 0 ? this.businessForm.addControl('applicant_use_mobile_wallets', new FormControl('')) : this.businessForm.removeControl('applicant_use_mobile_wallets'); - selectedService.length > 0 ? this.businessForm.addControl('applicant_use_pos_machines', new FormControl('')) : this.businessForm.removeControl('applicant_use_pos_machines'); - selectedService.length > 0 && businessVal.applicant_use_pos_machines == 'yes' ? this.businessForm.addControl('no_of_pos_machines', new FormControl('')): this.businessForm.removeControl('no_of_pos_machines'); - selectedService.length > 0 && businessVal.applicant_use_pos_machines == 'yes' ? this.businessForm.addControl('pos_machines_details', this.fb.array([])) : this.businessForm.removeControl('pos_machines_details'); - - selectedService.forEach((element,index)=>{ - this.CheckExport(element.area_of_sale,'SPActivity',index); - serviceProviderControl.push(this.createServiceActivity()); - if(element.area_of_sale=='Within India'){ - serviceProviderControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); - serviceProviderControl.controls[index].addControl('pan_india_options',new FormControl('', Validators.required)); - element.india_where_sale_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = serviceProviderControl.controls[index].get('india_where_sale_done') as FormArray; - innercontrol.push(this.createStateSale()) - }); - - serviceProviderControl.controls[index].addControl('max_sale_state_name',this.fb.array([])); - element.max_sale_state_name.forEach((innerElement,innerIndex) => { - let innercontrol:any = serviceProviderControl.controls[index].get('max_sale_state_name') as FormArray; - innercontrol.push(this.createMaxSaleState()) - }); - } - else if(element.area_of_sale=='Export'){ - serviceProviderControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); - element.countries_where_export_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = serviceProviderControl.controls[index].get('countries_where_export_done') as FormArray; - innercontrol.push(this.createCountrySale()) - }); - } - else if(element.area_of_sale=='Both'){ - serviceProviderControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); - serviceProviderControl.controls[index].addControl('pan_india_options',new FormControl('', Validators.required)); - serviceProviderControl.controls[index].addControl('max_sale_state_name',this.fb.array([])); - element.india_where_sale_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = serviceProviderControl.controls[index].get('india_where_sale_done') as FormArray; - innercontrol.push(this.createStateSale()) - }); - - element.max_sale_state_name.forEach((innerElement,innerIndex) => { - let innercontrol:any = serviceProviderControl.controls[index].get('max_sale_state_name') as FormArray; - innercontrol.push(this.createMaxSaleState()) - }); - serviceProviderControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); - element.countries_where_export_done.forEach((innerElement,innerIndex) => { - let innercontrol:any = serviceProviderControl.controls[index].get('countries_where_export_done') as FormArray; - innercontrol.push(this.createCountrySale()) - }); - - - } + let selectedService = Object.keys(data.records.service_provider_activity_details).map(function (key) { + return data.records.service_provider_activity_details[key]; }); - businessVal.service_provider_activity_details=selectedService; - } - else{ - businessVal.service_provider_activity_details=[]; - } - } - else { - businessVal.service_provider_activity_details=[]; + if (selectedService.length > 0) { + selectedService.length > 0 ? this.businessForm.addControl('practice_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('practice_cert'); + selectedService.length > 0 ? this.businessForm.addControl('applicant_use_mobile_wallets', new FormControl('')) : this.businessForm.removeControl('applicant_use_mobile_wallets'); + selectedService.length > 0 ? this.businessForm.addControl('applicant_use_pos_machines', new FormControl('')) : this.businessForm.removeControl('applicant_use_pos_machines'); + selectedService.length > 0 && businessVal.applicant_use_pos_machines == 'yes' ? this.businessForm.addControl('no_of_pos_machines', new FormControl('')) : this.businessForm.removeControl('no_of_pos_machines'); + selectedService.length > 0 && businessVal.applicant_use_pos_machines == 'yes' ? this.businessForm.addControl('pos_machines_details', this.fb.array([])) : this.businessForm.removeControl('pos_machines_details'); - } - //others type of Activity_details comment - // if(data.records.others_activity_details){ + selectedService.forEach((element, index) => { + this.CheckExport(element.area_of_sale, 'SPActivity', index); + serviceProviderControl.push(this.createServiceActivity()); + if (element.area_of_sale == 'Within India') { + serviceProviderControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); + serviceProviderControl.controls[index].addControl('pan_india_options', new FormControl('', Validators.required)); + element.india_where_sale_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = serviceProviderControl.controls[index].get('india_where_sale_done') as FormArray; + innercontrol.push(this.createStateSale()) + }); - // // update others activity details - // let selectedOthers = Object.keys(data.records.others_activity_details).map(function (key) { - // return data.records.others_activity_details[key]; - // }); - // if(selectedOthers.length > 0) { - // selectedOthers.forEach((element,index)=>{ - // othersControl.push(this.createOthersActivity()); - // }); - // businessVal.others_activity_details=selectedOthers; - // } - // else{ - // businessVal.others_activity_details=[]; - // } - // } - // else { - // businessVal.others_activity_details=[]; - // } - if(businessVal.applicant_use_pos_machines == 'yes'){ - this.businessForm.controls.no_of_pos_machines.setValue(businessVal.no_of_pos_machines); - const posControl: any = this.businessForm.controls['pos_machines_details']; - for(let i = 1; i<= businessVal.no_of_pos_machines; i++ ){ - posControl.push(this.createPOSMachinesDetails(businessVal.pos_machines_details)); + serviceProviderControl.controls[index].addControl('max_sale_state_name', this.fb.array([])); + element.max_sale_state_name.forEach((innerElement, innerIndex) => { + let innercontrol: any = serviceProviderControl.controls[index].get('max_sale_state_name') as FormArray; + innercontrol.push(this.createMaxSaleState()) + }); + } + else if (element.area_of_sale == 'Export') { + serviceProviderControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); + element.countries_where_export_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = serviceProviderControl.controls[index].get('countries_where_export_done') as FormArray; + innercontrol.push(this.createCountrySale()) + }); + } + else if (element.area_of_sale == 'Both') { + serviceProviderControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); + serviceProviderControl.controls[index].addControl('pan_india_options', new FormControl('', Validators.required)); + serviceProviderControl.controls[index].addControl('max_sale_state_name', this.fb.array([])); + element.india_where_sale_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = serviceProviderControl.controls[index].get('india_where_sale_done') as FormArray; + innercontrol.push(this.createStateSale()) + }); + + element.max_sale_state_name.forEach((innerElement, innerIndex) => { + let innercontrol: any = serviceProviderControl.controls[index].get('max_sale_state_name') as FormArray; + innercontrol.push(this.createMaxSaleState()) + }); + serviceProviderControl.controls[index].addControl('countries_where_export_done', this.fb.array([])); + element.countries_where_export_done.forEach((innerElement, innerIndex) => { + let innercontrol: any = serviceProviderControl.controls[index].get('countries_where_export_done') as FormArray; + innercontrol.push(this.createCountrySale()) + }); + + + } + }); + businessVal.service_provider_activity_details = selectedService; + } + else { + businessVal.service_provider_activity_details = []; + } } - } - this.businessForm.setValue(businessVal); + else { + businessVal.service_provider_activity_details = []; + + } + //others type of Activity_details comment + // if(data.records.others_activity_details){ + + // // update others activity details + // let selectedOthers = Object.keys(data.records.others_activity_details).map(function (key) { + // return data.records.others_activity_details[key]; + // }); + // if(selectedOthers.length > 0) { + // selectedOthers.forEach((element,index)=>{ + // othersControl.push(this.createOthersActivity()); + // }); + // businessVal.others_activity_details=selectedOthers; + // } + // else{ + // businessVal.others_activity_details=[]; + // } + // } + // else { + // businessVal.others_activity_details=[]; + // } + if (businessVal.applicant_use_pos_machines == 'yes') { + this.businessForm.controls.no_of_pos_machines.setValue(businessVal.no_of_pos_machines); + const posControl: any = this.businessForm.controls['pos_machines_details']; + for (let i = 1; i <= businessVal.no_of_pos_machines; i++) { + posControl.push(this.createPOSMachinesDetails(businessVal.pos_machines_details)); + } + } + this.businessForm.setValue(businessVal); } else { //Desgn.push(this.createDesignation()); Partnr.push(this.createPartners()); otherDoc.push(this.createDocument()); // find business activity type businees activity type list - let activityData=this.activityData.map(item=>({name : item.name,type_of_activity_id : item.type_of_activity_id,exist_status:0})) - if(activityData.length > 0) - { + let activityData = this.activityData.map(item => ({ name: item.name, type_of_activity_id: item.type_of_activity_id, exist_status: 0 })) + if (activityData.length > 0) { activityData.forEach(val => { businessActivityControl.push(this.createEntityType(val)); }); @@ -597,28 +596,28 @@ export class BusinessInfoComponent implements OnInit { } }); - // Desgn.push(this.createDesignation()); - // Partnr.push(this.createPartners()); - // otherDoc.push(this.createDocument()); + // Desgn.push(this.createDesignation()); + // Partnr.push(this.createPartners()); + // otherDoc.push(this.createDocument()); - // load exist company list from master - // this.existCompanyList = this.pd_all_details.pdapplicants_detials.filter(item=>item.company_name!=null).map(mapItem=>mapItem.company_name); + // load exist company list from master + // this.existCompanyList = this.pd_all_details.pdapplicants_detials.filter(item=>item.company_name!=null).map(mapItem=>mapItem.company_name); - // change relation with businees update dat sorce table - this.businessForm.controls['persons_with_relationships'].valueChanges.subscribe(val=>{ - let relationControl = this.businessForm.controls['persons_with_relationships']; - this.relationSource.data =relationControl.controls; - }); + // change relation with businees update dat sorce table + this.businessForm.controls['persons_with_relationships'].valueChanges.subscribe(val => { + let relationControl = this.businessForm.controls['persons_with_relationships']; + this.relationSource.data = relationControl.controls; + }); + + // change business sessional + this.businessForm.controls['seasonality'].valueChanges.subscribe(val => { + val.toUpperCase() == 'YES' ? this.businessForm.addControl('peak_period_of_business', new FormControl('', Validators.required)) : this.businessForm.removeControl('peak_period_of_business'); + val.toUpperCase() == 'YES' ? this.businessForm.addControl('month_of_business_run', new FormControl('', Validators.required)) : this.businessForm.removeControl('month_of_business_run'); + }); - // change business sessional - this.businessForm.controls['seasonality'].valueChanges.subscribe(val => { - val.toUpperCase()=='YES' ? this.businessForm.addControl('peak_period_of_business', new FormControl('', Validators.required)) : this.businessForm.removeControl('peak_period_of_business'); - val.toUpperCase()=='YES' ? this.businessForm.addControl('month_of_business_run', new FormControl('', Validators.required)) : this.businessForm.removeControl('month_of_business_run'); - }); - } - public initBusinessForm(): void { + public initBusinessForm(): void { this.businessForm = this.fb.group({ pdid: this.pdid, formid: this.form_id, @@ -626,17 +625,17 @@ export class BusinessInfoComponent implements OnInit { fk_createdby: this.pdid, //industry: [''], seasonality: ['', Validators.compose([Validators.required])], - export_sale_of_total_sales:[''], + export_sale_of_total_sales: [''], //month_of_business_run : [''], - // peak_period_of_business : [''], + // peak_period_of_business : [''], //designation: this.fb.array([]), partners: this.fb.array([]), employees_total: [''], employees_permanent: ['', Validators.compose([Validators.required])], employees_temporary: ['', Validators.compose([Validators.required])], - employees_appx_salary:['', Validators.compose([Validators.required])], + employees_appx_salary: ['', Validators.compose([Validators.required])], officer_total: ['' || null, Validators.compose([Validators.required])], - was_the_company_name_board_sighted:['',Validators.compose([Validators.required])], + was_the_company_name_board_sighted: ['', Validators.compose([Validators.required])], // officer_permanent: ['', Validators.compose([Validators.required])], // officer_temporary: ['', Validators.compose([Validators.required])], //working_capital: ['', Validators.compose([Validators.required])], @@ -646,16 +645,16 @@ export class BusinessInfoComponent implements OnInit { // rent_paid: [''], shop_eat_act_cert: ['', Validators.compose([Validators.required])], gst_Regn_cert: ['', Validators.compose([Validators.required])], - // export_import_cert: ['', Validators.compose([Validators.required])], + // export_import_cert: ['', Validators.compose([Validators.required])], //factory_cert: ['', Validators.compose([Validators.required])], - // practice_cert: ['', Validators.compose([Validators.required])], + // practice_cert: ['', Validators.compose([Validators.required])], pf_regn: ['', Validators.compose([Validators.required])], esic_regn: ['', Validators.compose([Validators.required])], other_documents: ['', Validators.compose([Validators.required])], documents: this.fb.array([]), business_remarks: [''], //any_delays: ['', Validators.compose([Validators.required])], - persons_with_relationships:this.fb.array([]), + persons_with_relationships: this.fb.array([]), select_business_activity_type: this.fb.array([]), manufacturing_activity_details: this.fb.array([]), retail_trading_activity_details: this.fb.array([]), @@ -666,63 +665,63 @@ export class BusinessInfoComponent implements OnInit { } // businees activity type change event - changeBusinessActivity(event: any){ - - + changeBusinessActivity(event: any) { + + + + if (event.value.exist_status == true && event.value.type_of_activity_id == 2) { - if(event.value.exist_status==true && event.value.type_of_activity_id==2){ - this.ManufacturingUnChecked = event.value.exist_status; let manufacturingControl = this.businessForm.controls['manufacturing_activity_details']; manufacturingControl.controls = []; - manufacturingControl.setValue([]); + manufacturingControl.setValue([]); } - else if(event.value.exist_status==false && event.value.type_of_activity_id==2){ - + else if (event.value.exist_status == false && event.value.type_of_activity_id == 2) { + this.ManufacturingUnChecked = event.value.exist_status; - let manufacturingControl = this.businessForm.controls['manufacturing_activity_details']; - manufacturingControl.push(this.createActivity()); - - + let manufacturingControl = this.businessForm.controls['manufacturing_activity_details']; + manufacturingControl.push(this.createActivity()); + + } - if(event.value.exist_status==true && event.value.type_of_activity_id==3){ - + if (event.value.exist_status == true && event.value.type_of_activity_id == 3) { + this.RetailedUnChecked = event.value.exist_status; let retailControl = this.businessForm.controls['retail_trading_activity_details']; retailControl.controls = []; retailControl.setValue([]); } - else if(event.value.exist_status==false && event.value.type_of_activity_id==3){ - - this.RetailedUnChecked = event.value.exist_status; - let retailControl = this.businessForm.controls['retail_trading_activity_details']; - retailControl.push(this.createActivity()); + else if (event.value.exist_status == false && event.value.type_of_activity_id == 3) { + + this.RetailedUnChecked = event.value.exist_status; + let retailControl = this.businessForm.controls['retail_trading_activity_details']; + retailControl.push(this.createActivity()); } - if(event.value.exist_status==true && event.value.type_of_activity_id==4){ - + if (event.value.exist_status == true && event.value.type_of_activity_id == 4) { + this.WholeSalesUnChecked = event.value.exist_status; let wholesaleControl = this.businessForm.controls['wholesale_trading_activity_details']; wholesaleControl.controls = []; wholesaleControl.setValue([]); } - else if(event.value.exist_status==false && event.value.type_of_activity_id==4){ - - this.WholeSalesUnChecked = event.value.exist_status; - let wholesaleControl = this.businessForm.controls['wholesale_trading_activity_details']; - wholesaleControl.push(this.createActivity()); + else if (event.value.exist_status == false && event.value.type_of_activity_id == 4) { + + this.WholeSalesUnChecked = event.value.exist_status; + let wholesaleControl = this.businessForm.controls['wholesale_trading_activity_details']; + wholesaleControl.push(this.createActivity()); } - if(event.value.exist_status==true && event.value.type_of_activity_id==5){ - + if (event.value.exist_status == true && event.value.type_of_activity_id == 5) { + this.ServiceUnChecked = event.value.exist_status; let serviceControl = this.businessForm.controls['service_provider_activity_details']; serviceControl.controls = []; serviceControl.setValue([]); } - else if(event.value.exist_status==false && event.value.type_of_activity_id==5){ - - this.ServiceUnChecked = event.value.exist_status; - let serviceControl = this.businessForm.controls['service_provider_activity_details']; - serviceControl.push(this.createServiceActivity()); + else if (event.value.exist_status == false && event.value.type_of_activity_id == 5) { + + this.ServiceUnChecked = event.value.exist_status; + let serviceControl = this.businessForm.controls['service_provider_activity_details']; + serviceControl.push(this.createServiceActivity()); } // if(event.value.exist_status==true && event.value.type_of_activity_id==1){ @@ -739,64 +738,64 @@ export class BusinessInfoComponent implements OnInit { this.businessForm.value.manufacturing_activity_details.length > 0 ? this.businessForm.addControl('factory_cert', new FormControl(this.businessForm.value.factory_cert, Validators.required)) : this.businessForm.removeControl('factory_cert'); this.businessForm.value.service_provider_activity_details.length > 0 ? this.businessForm.addControl('practice_cert', new FormControl(this.businessForm.value.practice_cert, Validators.required)) : this.businessForm.removeControl('practice_cert'); // check activity for extra question make dynamic - + this.businessForm.value.service_provider_activity_details.length > 0 || this.businessForm.value.retail_trading_activity_details.length > 0 || this.businessForm.value.wholesale_trading_activity_details.length > 0 ? this.businessForm.addControl('applicant_use_mobile_wallets', new FormControl(this.businessForm.value.applicant_use_mobile_wallets)) : this.businessForm.removeControl('applicant_use_mobile_wallets'); this.businessForm.value.service_provider_activity_details.length > 0 || this.businessForm.value.retail_trading_activity_details.length > 0 || this.businessForm.value.wholesale_trading_activity_details.length > 0 ? this.businessForm.addControl('applicant_use_pos_machines', new FormControl(this.businessForm.value.applicant_use_pos_machines)) : this.businessForm.removeControl('applicant_use_pos_machines'); - if(this.businessForm.value.service_provider_activity_details.length > 0 || this.businessForm.value.retail_trading_activity_details.length > 0 || this.businessForm.value.wholesale_trading_activity_details.length > 0){ - this.changePOSMachinesAvailablity(this.businessForm.value.applicant_use_pos_machines,2); + if (this.businessForm.value.service_provider_activity_details.length > 0 || this.businessForm.value.retail_trading_activity_details.length > 0 || this.businessForm.value.wholesale_trading_activity_details.length > 0) { + this.changePOSMachinesAvailablity(this.businessForm.value.applicant_use_pos_machines, 2); } - if(this.ManufacturingUnChecked || this.ManufacturingUnChecked==undefined && this.RetailedUnChecked || this.RetailedUnChecked==undefined && this.WholeSalesUnChecked ||this.WholeSalesUnChecked==undefined && this.ServiceUnChecked || this.ServiceUnChecked==undefined){ + if (this.ManufacturingUnChecked || this.ManufacturingUnChecked == undefined && this.RetailedUnChecked || this.RetailedUnChecked == undefined && this.WholeSalesUnChecked || this.WholeSalesUnChecked == undefined && this.ServiceUnChecked || this.ServiceUnChecked == undefined) { this.ExportFlag = false; } } // change area of sale options in manufacturing - changeManufacturingAreaSale(getDetails: any, getIndex){ + changeManufacturingAreaSale(getDetails: any, getIndex) { let control: any = this.businessForm.get('manufacturing_activity_details') as FormArray; - if(getDetails.value.area_of_sale=="Within India"){ + if (getDetails.value.area_of_sale == "Within India") { control.controls[getIndex].removeControl('countries_where_export_done'); control.controls[getIndex].removeControl('india_where_sale_done'); control.controls[getIndex].removeControl('pan_india_options'); control.controls[getIndex].removeControl('max_sale_state_name'); - control.controls[getIndex].addControl('pan_india_options',new FormControl('', Validators.required)); + control.controls[getIndex].addControl('pan_india_options', new FormControl('', Validators.required)); control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([])); - control.controls[getIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); + control.controls[getIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); } - else if(getDetails.value.area_of_sale=="Export"){ + else if (getDetails.value.area_of_sale == "Export") { control.controls[getIndex].removeControl('countries_where_export_done'); control.controls[getIndex].removeControl('india_where_sale_done'); control.controls[getIndex].removeControl('pan_india_options'); control.controls[getIndex].removeControl('max_sale_state_name'); control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()])); } - else if(getDetails.value.area_of_sale=="Both") { + else if (getDetails.value.area_of_sale == "Both") { control.controls[getIndex].removeControl('india_where_sale_done'); control.controls[getIndex].removeControl('countries_where_export_done'); control.controls[getIndex].removeControl('pan_india_options'); control.controls[getIndex].removeControl('max_sale_state_name'); control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([])); - control.controls[getIndex].addControl('pan_india_options',new FormControl('', Validators.required)); - control.controls[getIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); + control.controls[getIndex].addControl('pan_india_options', new FormControl('', Validators.required)); + control.controls[getIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()])); } } // change retail options - changeRetailAreaSale(getDetails: any, getIndex){ + changeRetailAreaSale(getDetails: any, getIndex) { let control: any = this.businessForm.get('retail_trading_activity_details') as FormArray; - if(getDetails.value.area_of_sale=="Within India"){ + if (getDetails.value.area_of_sale == "Within India") { control.controls[getIndex].removeControl('countries_where_export_done'); control.controls[getIndex].removeControl('india_where_sale_done'); control.controls[getIndex].removeControl('pan_india_options'); control.controls[getIndex].removeControl('max_sale_state_name'); - control.controls[getIndex].addControl('pan_india_options',new FormControl('', Validators.required)); + control.controls[getIndex].addControl('pan_india_options', new FormControl('', Validators.required)); control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([])); - control.controls[getIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); + control.controls[getIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); } - else if(getDetails.value.area_of_sale=="Export"){ + else if (getDetails.value.area_of_sale == "Export") { control.controls[getIndex].removeControl('countries_where_export_done'); control.controls[getIndex].removeControl('india_where_sale_done'); control.controls[getIndex].removeControl('pan_india_options'); @@ -804,33 +803,33 @@ export class BusinessInfoComponent implements OnInit { control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()])); } - else if(getDetails.value.area_of_sale=="Both") { + else if (getDetails.value.area_of_sale == "Both") { control.controls[getIndex].removeControl('india_where_sale_done'); control.controls[getIndex].removeControl('countries_where_export_done'); control.controls[getIndex].removeControl('pan_india_options'); control.controls[getIndex].removeControl('max_sale_state_name'); control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([])); - control.controls[getIndex].addControl('pan_india_options',new FormControl('', Validators.required)); - control.controls[getIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); + control.controls[getIndex].addControl('pan_india_options', new FormControl('', Validators.required)); + control.controls[getIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()])); } } // change whole options - changeWholesaleAreaSale(getDetails: any, getIndex){ + changeWholesaleAreaSale(getDetails: any, getIndex) { let control: any = this.businessForm.get('wholesale_trading_activity_details') as FormArray; - if(getDetails.value.area_of_sale=="Within India"){ + if (getDetails.value.area_of_sale == "Within India") { control.controls[getIndex].removeControl('countries_where_export_done'); control.controls[getIndex].removeControl('india_where_sale_done'); control.controls[getIndex].removeControl('pan_india_options'); control.controls[getIndex].removeControl('max_sale_state_name'); - control.controls[getIndex].addControl('pan_india_options',new FormControl('', Validators.required)); + control.controls[getIndex].addControl('pan_india_options', new FormControl('', Validators.required)); control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([])); - control.controls[getIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); + control.controls[getIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); } - else if(getDetails.value.area_of_sale=="Export"){ + else if (getDetails.value.area_of_sale == "Export") { control.controls[getIndex].removeControl('countries_where_export_done'); control.controls[getIndex].removeControl('india_where_sale_done'); control.controls[getIndex].removeControl('pan_india_options'); @@ -838,14 +837,14 @@ export class BusinessInfoComponent implements OnInit { control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()])); } - else if(getDetails.value.area_of_sale=="Both") { + else if (getDetails.value.area_of_sale == "Both") { control.controls[getIndex].removeControl('india_where_sale_done'); control.controls[getIndex].removeControl('countries_where_export_done'); control.controls[getIndex].removeControl('pan_india_options'); control.controls[getIndex].removeControl('max_sale_state_name'); control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([])); - control.controls[getIndex].addControl('pan_india_options',new FormControl('', Validators.required)); - control.controls[getIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); + control.controls[getIndex].addControl('pan_india_options', new FormControl('', Validators.required)); + control.controls[getIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()])); } } @@ -853,16 +852,16 @@ export class BusinessInfoComponent implements OnInit { changeServiceArea(getDetails: any, getIndex) { let control: any = this.businessForm.get('service_provider_activity_details') as FormArray; - if(getDetails.value.area_of_sale=="Within India"){ + if (getDetails.value.area_of_sale == "Within India") { control.controls[getIndex].removeControl('countries_where_export_done'); control.controls[getIndex].removeControl('india_where_sale_done'); control.controls[getIndex].removeControl('pan_india_options'); control.controls[getIndex].removeControl('max_sale_state_name'); - control.controls[getIndex].addControl('pan_india_options',new FormControl('', Validators.required)); + control.controls[getIndex].addControl('pan_india_options', new FormControl('', Validators.required)); control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([])); - control.controls[getIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); + control.controls[getIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); } - else if(getDetails.value.area_of_sale=="Export"){ + else if (getDetails.value.area_of_sale == "Export") { control.controls[getIndex].removeControl('countries_where_export_done'); control.controls[getIndex].removeControl('india_where_sale_done'); control.controls[getIndex].removeControl('pan_india_options'); @@ -870,62 +869,70 @@ export class BusinessInfoComponent implements OnInit { control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()])); } - else if(getDetails.value.area_of_sale=="Both") { + else if (getDetails.value.area_of_sale == "Both") { control.controls[getIndex].removeControl('india_where_sale_done'); control.controls[getIndex].removeControl('countries_where_export_done'); control.controls[getIndex].removeControl('pan_india_options'); control.controls[getIndex].removeControl('max_sale_state_name'); control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([])); - control.controls[getIndex].addControl('pan_india_options',new FormControl('', Validators.required)); - control.controls[getIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); + control.controls[getIndex].addControl('pan_india_options', new FormControl('', Validators.required)); + control.controls[getIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()])); } } - // change pan india options - changePanIndiaOptions(type,selectedIndex,value) { - if(type==1){ + // change pan india options + changePanIndiaOptions(type, selectedIndex, value) { + if (type == 1) { let control: any = this.businessForm.get('manufacturing_activity_details') as FormArray; control.controls[selectedIndex].removeControl('india_where_sale_done'); control.controls[selectedIndex].removeControl('max_sale_state_name'); - if(value=='Yes') { + if (value == 'Yes') { control.controls[selectedIndex].addControl('india_where_sale_done', this.fb.array([])); - control.controls[selectedIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); } - else if(value=='No'){ + control.controls[selectedIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); + } + else if (value == 'No') { control.controls[selectedIndex].addControl('india_where_sale_done', this.fb.array([this.createStateSale()])); - control.controls[selectedIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); } + control.controls[selectedIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); + } } - else if(type==2){ + else if (type == 2) { let control: any = this.businessForm.get('retail_trading_activity_details') as FormArray; control.controls[selectedIndex].removeControl('india_where_sale_done'); control.controls[selectedIndex].removeControl('max_sale_state_name'); - if(value=='Yes') { + if (value == 'Yes') { control.controls[selectedIndex].addControl('india_where_sale_done', this.fb.array([])); - control.controls[selectedIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); } - else if(value=='No'){ + control.controls[selectedIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); + } + else if (value == 'No') { control.controls[selectedIndex].addControl('india_where_sale_done', this.fb.array([this.createStateSale()])); - control.controls[selectedIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); } + control.controls[selectedIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); + } } - else if(type==3){ + else if (type == 3) { let control: any = this.businessForm.get('wholesale_trading_activity_details') as FormArray; control.controls[selectedIndex].removeControl('india_where_sale_done'); control.controls[selectedIndex].removeControl('max_sale_state_name'); - if(value=='Yes') { + if (value == 'Yes') { control.controls[selectedIndex].addControl('india_where_sale_done', this.fb.array([])); - control.controls[selectedIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); } - else if(value=='No'){ + control.controls[selectedIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); + } + else if (value == 'No') { control.controls[selectedIndex].addControl('india_where_sale_done', this.fb.array([this.createStateSale()])); - control.controls[selectedIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); } + control.controls[selectedIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); + } } - else if(type==4){ + else if (type == 4) { let control: any = this.businessForm.get('service_provider_activity_details') as FormArray; control.controls[selectedIndex].removeControl('india_where_sale_done'); control.controls[selectedIndex].removeControl('max_sale_state_name'); - if(value=='Yes') { + if (value == 'Yes') { control.controls[selectedIndex].addControl('india_where_sale_done', this.fb.array([])); - control.controls[selectedIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); } - else if(value=='No'){ + control.controls[selectedIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); + } + else if (value == 'No') { control.controls[selectedIndex].addControl('india_where_sale_done', this.fb.array([this.createStateSale()])); - control.controls[selectedIndex].addControl('max_sale_state_name',this.fb.array([this.createMaxSaleState()])); } + control.controls[selectedIndex].addControl('max_sale_state_name', this.fb.array([this.createMaxSaleState()])); + } } } @@ -955,83 +962,83 @@ export class BusinessInfoComponent implements OnInit { return this.fb.group({ state_name: ['', Validators.compose([Validators.required])], city_name: ['', Validators.compose([Validators.required])], - }); + }); } // create max sale state createMaxSaleState() { return this.fb.group({ - state_name: [''], - city_name: [''], - }); + state_name: [''], + city_name: [''], + }); } createCountrySale() { return this.fb.group({ - country_name: ['',Validators.compose([Validators.required])], + country_name: ['', Validators.compose([Validators.required])], approx_sale: ['', Validators.compose([Validators.required])] - }); + }); } // add more dtate for manufacturing - addMoreState(mindex,type) { - if(type==1){ + addMoreState(mindex, type) { + if (type == 1) { let control: any = this.businessForm.get('manufacturing_activity_details') as FormArray; control = control.controls[mindex].get('india_where_sale_done') as FormArray; control.push(this.createStateSale()) } - else if(type==2){ + else if (type == 2) { let control: any = this.businessForm.get('manufacturing_activity_details') as FormArray; control = control.controls[mindex].get('countries_where_export_done') as FormArray; control.push(this.createCountrySale()) } - + } // remove state for manufacturing - removeState(mindex,sindex,type) { - if(type==1){ + removeState(mindex, sindex, type) { + if (type == 1) { let control: any = this.businessForm.get('manufacturing_activity_details') as FormArray; control = control.controls[mindex].get('india_where_sale_done') as FormArray; control.removeAt(sindex); } - else if(type==2){ + else if (type == 2) { let control: any = this.businessForm.get('manufacturing_activity_details') as FormArray; control = control.controls[mindex].get('countries_where_export_done') as FormArray; control.removeAt(sindex); } } // add more retail state - addRetailMoreState(rindex,type) { - if(type==1){ + addRetailMoreState(rindex, type) { + if (type == 1) { let control: any = this.businessForm.get('retail_trading_activity_details') as FormArray; control = control.controls[rindex].get('india_where_sale_done') as FormArray; control.push(this.createStateSale()) } - else if(type==2){ + else if (type == 2) { let control: any = this.businessForm.get('retail_trading_activity_details') as FormArray; control = control.controls[rindex].get('countries_where_export_done') as FormArray; control.push(this.createCountrySale()) } } // remove state for retail - removeRetailState(mindex,sindex,type) { - if(type==1){ + removeRetailState(mindex, sindex, type) { + if (type == 1) { let control: any = this.businessForm.get('retail_trading_activity_details') as FormArray; control = control.controls[mindex].get('india_where_sale_done') as FormArray; control.removeAt(sindex); } - else if(type==2){ + else if (type == 2) { let control: any = this.businessForm.get('retail_trading_activity_details') as FormArray; control = control.controls[mindex].get('countries_where_export_done') as FormArray; control.removeAt(sindex); } } - // add more whole sale state - addWholesaleMoreState(windex,type) { - if(type==1){ + // add more whole sale state + addWholesaleMoreState(windex, type) { + if (type == 1) { let control: any = this.businessForm.get('wholesale_trading_activity_details') as FormArray; control = control.controls[windex].get('india_where_sale_done') as FormArray; control.push(this.createStateSale()) } - else if(type==2){ + else if (type == 2) { let control: any = this.businessForm.get('wholesale_trading_activity_details') as FormArray; control = control.controls[windex].get('countries_where_export_done') as FormArray; control.push(this.createCountrySale()) @@ -1039,45 +1046,45 @@ export class BusinessInfoComponent implements OnInit { } // remove for whole sale - removeWholesaleState(mindex,sindex,type) { - if(type==1){ + removeWholesaleState(mindex, sindex, type) { + if (type == 1) { let control: any = this.businessForm.get('wholesale_trading_activity_details') as FormArray; control = control.controls[mindex].get('india_where_sale_done') as FormArray; control.removeAt(sindex); } - else if(type==2){ + else if (type == 2) { let control: any = this.businessForm.get('wholesale_trading_activity_details') as FormArray; control = control.controls[mindex].get('countries_where_export_done') as FormArray; control.removeAt(sindex); } } // add more service provider - addServiceMoreState(sindex,type) { - if(type==1){ + addServiceMoreState(sindex, type) { + if (type == 1) { let control: any = this.businessForm.get('service_provider_activity_details') as FormArray; control = control.controls[sindex].get('india_where_sale_done') as FormArray; control.push(this.createStateSale()) } - else if(type==2){ + else if (type == 2) { let control: any = this.businessForm.get('service_provider_activity_details') as FormArray; control = control.controls[sindex].get('countries_where_export_done') as FormArray; control.push(this.createCountrySale()) } } - // remove service provider - removeServiceState(mindex,sindex,type) { - if(type==1){ + // remove service provider + removeServiceState(mindex, sindex, type) { + if (type == 1) { let control: any = this.businessForm.get('service_provider_activity_details') as FormArray; control = control.controls[mindex].get('india_where_sale_done') as FormArray; control.removeAt(sindex); } - else if(type==2){ + else if (type == 2) { let control: any = this.businessForm.get('service_provider_activity_details') as FormArray; control = control.controls[mindex].get('countries_where_export_done') as FormArray; control.removeAt(sindex); } } - + // addDesignation() { // const control = this.businessForm.controls['designation']; // control.push(this.createDesignation()); @@ -1114,15 +1121,15 @@ export class BusinessInfoComponent implements OnInit { }); } - getBank(){ + getBank() { this._pd.getAllMasterDatas('BTLENDERLIST').subscribe( - data => { - this.bankList = data.records.filter(data => data.isactive == 1 && data.lender_type == 1); - }) - } + data => { + this.bankList = data.records.filter(data => data.isactive == 1 && data.lender_type == 1); + }) + } - // get title master - getTitle() { + // get title master + getTitle() { let master_name = 'TITLES'; this._pd.getAllMasterDatas(master_name).subscribe(data => { data.records.forEach(val => { @@ -1133,11 +1140,11 @@ export class BusinessInfoComponent implements OnInit { }); } - // get title master + // get title master getAllPersons() { - this._pd.getAllPersonsName(this.pdid).subscribe(data => { - if(data.dataStatus){ - this.personsList = data.record.filter(val=>val.applicant_type==1); + this._pd.getAllPersonsName(this.pdid).subscribe(data => { + if (data.dataStatus) { + this.personsList = data.record.filter(val => val.applicant_type == 1); // if(data.record.applicant_type == 1){ // this.personsList.push({groupName:'APPLICANTS',groupValues:{name:data.record.applicant_name,group_id:data.record.applicant_type}}); // } @@ -1148,10 +1155,10 @@ export class BusinessInfoComponent implements OnInit { // this.personsList.push({groupName:'OTHER FAMILY MEMBER',groupValues:{name:data.record.applicant_name,group_id:data.record.applicant_type}}); // } // this.personsList.push({groupName:'COMMON',groupValues:{name:'Others',group_id:4}}); - } - + } + }); - } + } getCompanyRelation() { let master_name = 'COMPANYRELATIONSHIPS'; @@ -1166,7 +1173,7 @@ export class BusinessInfoComponent implements OnInit { relationChanged(event) { this.relativeNames = []; event.value.forEach(option => { - this.relativeNames.push({member: option}); + this.relativeNames.push({ member: option }); }); } // getIndustry() { @@ -1184,16 +1191,16 @@ export class BusinessInfoComponent implements OnInit { getBusinessEntity() { let master_name = 'BUSINESSENTITYTYPE'; this._pd.getAllMasterDatas(master_name).subscribe(data => { - let filterList = data.records.filter(val=>val.business_entity_type_id==this.generalExistEntityType); - this.businessEntityTypeList.business_entity_type_id = filterList[0].business_entity_type_id==1; - this.businessEntityTypeList.business_entity_type_name = filterList[0].business_entity_type_id!=1 ? filterList[0].business_entity_type_name : this.generalExistEntityType_other; - this.businessEntityTypeList.section_label = filterList[0].business_entity_type_id!=1 ? filterList[0].section_label : this.generalExistEntityType_other; - - + let filterList = data.records.filter(val => val.business_entity_type_id == this.generalExistEntityType); + this.businessEntityTypeList.business_entity_type_id = filterList[0].business_entity_type_id == 1; + this.businessEntityTypeList.business_entity_type_name = filterList[0].business_entity_type_id != 1 ? filterList[0].business_entity_type_name : this.generalExistEntityType_other; + this.businessEntityTypeList.section_label = filterList[0].business_entity_type_id != 1 ? filterList[0].section_label : this.generalExistEntityType_other; + + // if(this.businessForm.controls.partners['controls'].length > 1) // {} - - if(this.businessEntityTypeList.business_entity_type_name == 'OPC (One Person Company)' || this.businessEntityTypeList.business_entity_type_name == 'Sole proprietorship'){ + + if (this.businessEntityTypeList.business_entity_type_name == 'OPC (One Person Company)' || this.businessEntityTypeList.business_entity_type_name == 'Sole proprietorship') { this.EntityTypeFlag = true; } // data.records.forEach(val => { @@ -1201,7 +1208,7 @@ export class BusinessInfoComponent implements OnInit { // this.sourceNames[val.business_entity_type_id] = val.section_label // }); }); - } + } getActivity() { let master_name = 'TYPEOFACTIVITY'; @@ -1216,34 +1223,34 @@ export class BusinessInfoComponent implements OnInit { } // get state and city list - getStateCityList(){ + getStateCityList() { this._pd.getStateCityDetails().subscribe( - data => { - if (data.status == 200) { - this.stateList=data.records - } - }); - } + data => { + if (data.status == 200) { + this.stateList = data.records + } + }); + } - getCountryDataList(){ - let master_name = 'COUNTRY'; - this._pd.getAllMasterDatas(master_name).subscribe(data => { - data.records.forEach(val => { - if (val.isactive == 1) { - this.countryDataList.push(val); - } - }) - }); - } + getCountryDataList() { + let master_name = 'COUNTRY'; + this._pd.getAllMasterDatas(master_name).subscribe(data => { + data.records.forEach(val => { + if (val.isactive == 1) { + this.countryDataList.push(val); + } + }) + }); + } // add and create person with relationship details - createPersonRelationhip(details: any):FormGroup { + createPersonRelationhip(details: any): FormGroup { return this.fb.group({ - other_family_relationship_id: [details.other_family_relationship_id,Validators.required], - family_member_salutation:[details.family_member_salutation], - family_member_name: [details.family_member_name,Validators.required], - relationship_with_company_id: [details.relationship_with_company_id,Validators.required], - relation_to_id: [details.relation_to_id,Validators.required], + other_family_relationship_id: [details.other_family_relationship_id, Validators.required], + family_member_salutation: [details.family_member_salutation], + family_member_name: [details.family_member_name, Validators.required], + relationship_with_company_id: [details.relationship_with_company_id, Validators.required], + relation_to_id: [details.relation_to_id, Validators.required], started_business: [details.started_business], }); } @@ -1253,9 +1260,9 @@ export class BusinessInfoComponent implements OnInit { return this.fb.group({ type_of_activity_id: [details.type_of_activity_id, Validators.compose([Validators.required])], name: [details.name, Validators.compose([Validators.required])], - exist_status:[details.exist_status==1 ? true : false] + exist_status: [details.exist_status == 1 ? true : false] }); - + } // create manufacturing ,retail and wholesale details @@ -1286,31 +1293,31 @@ export class BusinessInfoComponent implements OnInit { let manufacturingControl = this.businessForm.controls['manufacturing_activity_details']; manufacturingControl.push(this.createActivity()); } - deleteManufacturing(findex){ + deleteManufacturing(findex) { let manufacturingControl = this.businessForm.controls['manufacturing_activity_details']; manufacturingControl.removeAt(findex); } - // add more retail details - addMoreRetail() { + // add more retail details + addMoreRetail() { let retailControl = this.businessForm.controls['retail_trading_activity_details']; retailControl.push(this.createActivity()); - } + } - deleteRetail(index) { + deleteRetail(index) { let retailControl = this.businessForm.controls['retail_trading_activity_details']; retailControl.removeAt(index); - } + } - // add more retail details - addMoreWholesale() { + // add more retail details + addMoreWholesale() { let wholesaleControl = this.businessForm.controls['wholesale_trading_activity_details']; wholesaleControl.push(this.createActivity()); - } + } - deleteWholesale(index) { + deleteWholesale(index) { let wholesaleControl = this.businessForm.controls['wholesale_trading_activity_details']; wholesaleControl.removeAt(index); - } + } // add more service provider details @@ -1322,7 +1329,7 @@ export class BusinessInfoComponent implements OnInit { deleteServiceprovider(index) { let serviceControl = this.businessForm.controls['service_provider_activity_details']; serviceControl.removeAt(index); - } + } // add more others details // addMoreOthersActivity() { @@ -1336,31 +1343,31 @@ export class BusinessInfoComponent implements OnInit { // } // update partner group other form control - changePartnerGroup(value,key) { + changePartnerGroup(value, key) { let control: any = this.businessForm.get('partners') as FormArray; - value=='Others' ? control.controls[key].addControl('partner_other_name', new FormControl('', Validators.required)) : control.controls[key].removeControl('partner_other_name'); + value == 'Others' ? control.controls[key].addControl('partner_other_name', new FormControl('', Validators.required)) : control.controls[key].removeControl('partner_other_name'); } // Out of Total Export Sales what % of Sales is done in Albania? - getPlaceHolderName(id){ - let name = this.countryDataList.filter(value=>value.country_id == id); - - return 'Out of Total Export Sales what % of Sales is done in '+ name[0].country_name +' ?'; - // return name[0].country_name +'?'; + getPlaceHolderName(id) { + let name = this.countryDataList.filter(value => value.country_id == id); + + return 'Out of Total Export Sales what % of Sales is done in ' + name[0].country_name + ' ?'; + // return name[0].country_name +'?'; } // get work experience based on create form control getWorkExperience(event, key) { - let current_experience = event.current_business_experiance_year=='' ? 0 : parseInt(event.current_business_experiance_year); - let total_experience = event.total_business_experiance=='' ? 0 : parseInt(event.total_business_experiance); + let current_experience = event.current_business_experiance_year == '' ? 0 : parseInt(event.current_business_experiance_year); + let total_experience = event.total_business_experiance == '' ? 0 : parseInt(event.total_business_experiance); let control: any = this.businessForm.get('partners') as FormArray; - if(total_experience > current_experience) { + if (total_experience > current_experience) { control.controls[key].addControl('total_business_previous_experience', new FormControl('', Validators.required)) } - else if(total_experience < current_experience) { + else if (total_experience < current_experience) { //control.controls[key].controls['total_business_experiance'].setValue(current_experience); control.controls[key].removeControl('total_business_previous_experience') } - + else { control.controls[key].removeControl('total_business_previous_experience') } @@ -1373,29 +1380,28 @@ export class BusinessInfoComponent implements OnInit { } /** To Convert Month into Year */ - ConvertMonthintoYear(itemrow,e,i){ + ConvertMonthintoYear(itemrow, e, i) { let year = itemrow.controls.current_business_experiance_year.value; - - let converted_month : number = e%12; - let converted_year : number = e/12; + + let converted_month: number = e % 12; + let converted_year: number = e / 12; let Year = +year + +Math.floor(converted_year); - - if(Year > this.generalExistBusinessYear){ + + if (Year > this.generalExistBusinessYear) { this.yearErrorMessage[i] = "Higher than Business Vintage"; itemrow.controls.current_business_experiance_year.setValue(''); itemrow.controls.current_business_experiance_month.setValue(''); - + } - else{ - if(Year == this.generalExistBusinessYear && +converted_month > this.generalExistBusinessMonth) - { + else { + if (Year == this.generalExistBusinessYear && +converted_month > this.generalExistBusinessMonth) { this.monthErrorMessage[i] = "Higher than Business Vintage"; itemrow.controls.current_business_experiance_year.setValue(''); itemrow.controls.current_business_experiance_month.setValue(''); - }else{ + } else { this.monthErrorMessage[i] = ''; this.yearErrorMessage[i] = ''; itemrow.controls.current_business_experiance_year.setValue(Year); @@ -1405,7 +1411,7 @@ export class BusinessInfoComponent implements OnInit { // itemrow.controls.current_business_experiance_year.setValue(+year + +Math.floor(converted_year)); // itemrow.controls.current_business_experiance_month.setValue(Math.floor(converted_month)); - + } /** @@ -1414,54 +1420,54 @@ export class BusinessInfoComponent implements OnInit { // validateAppxSales(records){} submitDetails() { - - // let family: any = []; - if(this.EntityTypeFlag == true){ - let control: any = this.businessForm.controls['partners']; - let control2:any = control.controls[0]; - - control2.controls['shareholding'].clearValidators(); - control2.controls['shareholding'].updateValueAndValidity(); - control2.controls['shareholding'].setValue('100'); - - - // control.controls[0].removeControl('shareholding'); - // control.controls[0].removeControl('started_business'); - // control.controls[0].removeControl('current_business_experiance_year'); - // control.controls[0].removeControl('current_business_experiance_month'); - // control.controls[0].removeControl('total_business_experiance'); - - control2.controls['started_business'].setValue(''); + // let family: any = []; - control2.controls['current_business_experiance_year'].clearValidators(); - control2.controls['current_business_experiance_year'].updateValueAndValidity(); - control2.controls['current_business_experiance_year'].setValue(''); + if (this.EntityTypeFlag == true) { + let control: any = this.businessForm.controls['partners']; + let control2: any = control.controls[0]; - control2.controls['current_business_experiance_month'].setValue(''); + control2.controls['shareholding'].clearValidators(); + control2.controls['shareholding'].updateValueAndValidity(); + control2.controls['shareholding'].setValue('100'); - control2.controls['total_business_experiance'].clearValidators(); - control2.controls['total_business_experiance'].updateValueAndValidity(); - control2.controls['total_business_experiance'].setValue(''); - // if(control2.controls['total_business_previous_experience'].value !=undefined){ - // control2.controls['total_business_previous_experience'].clearValidators(); - // control2.controls['total_business_previous_experience'].updateValueAndValidity(); - // control2.controls['total_business_previous_experience'].setValue('0'); - // } - } - - if (!this.businessForm.valid) { - this.notifier.notify('warning',"Please Check All Manatory Fields.."); - return; + // control.controls[0].removeControl('shareholding'); + // control.controls[0].removeControl('started_business'); + // control.controls[0].removeControl('current_business_experiance_year'); + // control.controls[0].removeControl('current_business_experiance_month'); + // control.controls[0].removeControl('total_business_experiance'); + + control2.controls['started_business'].setValue(''); + + control2.controls['current_business_experiance_year'].clearValidators(); + control2.controls['current_business_experiance_year'].updateValueAndValidity(); + control2.controls['current_business_experiance_year'].setValue(''); + + control2.controls['current_business_experiance_month'].setValue(''); + + control2.controls['total_business_experiance'].clearValidators(); + control2.controls['total_business_experiance'].updateValueAndValidity(); + control2.controls['total_business_experiance'].setValue(''); + // if(control2.controls['total_business_previous_experience'].value !=undefined){ + // control2.controls['total_business_previous_experience'].clearValidators(); + // control2.controls['total_business_previous_experience'].updateValueAndValidity(); + // control2.controls['total_business_previous_experience'].setValue('0'); + // } + } - // let design: any; + + if (!this.businessForm.valid) { + this.notifier.notify('warning', "Please Check All Manatory Fields.."); + return; + } + // let design: any; let records = this.businessForm.value; - - + + //to check the Appx. sale validation. // this.validateAppxSales(records); - + if (records.other_documents == 'no') { delete records.documents; } @@ -1473,16 +1479,16 @@ export class BusinessInfoComponent implements OnInit { } - let validationFlag : number = 0; + let validationFlag: number = 0; // let shareHoldValidationFlag : number = 0; - - - - if(records.partners.length > 0){ + + + + if (records.partners.length > 0) { let total = records.partners.map(shares => shares.shareholding).reduce((a, b) => a + +b, 0); - if(total > 100){ - this.notifier.notify('warning',"Shareholding is greater than 100%"); - return; + if (total > 100) { + this.notifier.notify('warning', "Shareholding is greater than 100%"); + return; } } @@ -1490,88 +1496,88 @@ export class BusinessInfoComponent implements OnInit { // return; //type 1: Checking manufacturing_activity_details - if(records.manufacturing_activity_details.length > 0){ + if (records.manufacturing_activity_details.length > 0) { - records.manufacturing_activity_details.forEach((val,index) => { - if(val.area_of_sale!= "Within India"){ - let ManufacturingArray = Object.keys(val.countries_where_export_done).map(function (key) { - return val.countries_where_export_done[key]; - }); - let total = ManufacturingArray.reduce((sum, item) => sum + +item.approx_sale, 0); - if(total > 100 || total < 100){ - validationFlag++; + records.manufacturing_activity_details.forEach((val, index) => { + if (val.area_of_sale != "Within India") { + let ManufacturingArray = Object.keys(val.countries_where_export_done).map(function (key) { + return val.countries_where_export_done[key]; + }); + let total = ManufacturingArray.reduce((sum, item) => sum + +item.approx_sale, 0); + if (total > 100 || total < 100) { + validationFlag++; + } } - } }); - - + + } //type 3 checking wholesale_trading_activity_details - if(records.wholesale_trading_activity_details.length > 0){ + if (records.wholesale_trading_activity_details.length > 0) { - records.wholesale_trading_activity_details.forEach((val,index) => { - if(val.area_of_sale != "Within India"){ - let WholesaleTradingArray = Object.keys(val.countries_where_export_done).map(function (key) { - return val.countries_where_export_done[key]; - }); - let total = WholesaleTradingArray.reduce((sum, item) => sum + +item.approx_sale, 0); - if(total > 100 || total < 100){ - validationFlag++; + records.wholesale_trading_activity_details.forEach((val, index) => { + if (val.area_of_sale != "Within India") { + let WholesaleTradingArray = Object.keys(val.countries_where_export_done).map(function (key) { + return val.countries_where_export_done[key]; + }); + let total = WholesaleTradingArray.reduce((sum, item) => sum + +item.approx_sale, 0); + if (total > 100 || total < 100) { + validationFlag++; + } } - } }); - + } //type 2 checking retail_trading_activity_details - if(records.retail_trading_activity_details.length > 0){ + if (records.retail_trading_activity_details.length > 0) { - records.retail_trading_activity_details.forEach((val,index) => { - if(val.area_of_sale != "Within India"){ - let RetailTradingArray = Object.keys(val.countries_where_export_done).map(function (key) { - return val.countries_where_export_done[key]; - }); - let total = RetailTradingArray.reduce((sum, item) => sum + +item.approx_sale, 0); - if(total > 100 || total < 100){ - validationFlag++; + records.retail_trading_activity_details.forEach((val, index) => { + if (val.area_of_sale != "Within India") { + let RetailTradingArray = Object.keys(val.countries_where_export_done).map(function (key) { + return val.countries_where_export_done[key]; + }); + let total = RetailTradingArray.reduce((sum, item) => sum + +item.approx_sale, 0); + if (total > 100 || total < 100) { + validationFlag++; + } } - } }); - + } //type 4 checking service_provider_activity_details - if(records.service_provider_activity_details.length > 0){ + if (records.service_provider_activity_details.length > 0) { - records.service_provider_activity_details.forEach((val,index) => { - if(val.area_of_sale != "Within India"){ - - let ServiceProviderArray = Object.keys(val.countries_where_export_done).map(function (key) { - return val.countries_where_export_done[key]; - }); - let total = ServiceProviderArray.reduce((sum, item) => sum + +item.approx_sale, 0); - if(total > 100 || total < 100){ - validationFlag++; + records.service_provider_activity_details.forEach((val, index) => { + if (val.area_of_sale != "Within India") { + + let ServiceProviderArray = Object.keys(val.countries_where_export_done).map(function (key) { + return val.countries_where_export_done[key]; + }); + let total = ServiceProviderArray.reduce((sum, item) => sum + +item.approx_sale, 0); + if (total > 100 || total < 100) { + validationFlag++; + } } - } }); - + } //validationFlag is greater then 0 means its display the notifer as warning - if(validationFlag > 0){ - this.notifier.notify('warning',"Approximate sales doesn't add upto 100%"); + if (validationFlag > 0) { + this.notifier.notify('warning', "Approximate sales doesn't add upto 100%"); return; } - - records.select_business_activity_type = records.select_business_activity_type.filter(value=>value.exist_status==1); + + records.select_business_activity_type = records.select_business_activity_type.filter(value => value.exist_status == 1); this._pd.saveForm(records).subscribe(data => { this.notifier.notify('success', 'Saved Successfully.'); - setTimeout(() =>{ + setTimeout(() => { this.dialogRef.close(); - },3000); + }, 3000); }, error => { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); }); @@ -1581,313 +1587,312 @@ export class BusinessInfoComponent implements OnInit { otherFamilyMemberDialogue() { let relationControl = this.businessForm.controls['persons_with_relationships']; - let other_family_member: any= {'other_family_relationship_id':'','other_family_relationship_name':'','family_member_salutation':'','family_member_name':'','relationship_with_company_id':'','relationship_with_company':'','started_business':'','currently_active_status':''}; + let other_family_member: any = { 'other_family_relationship_id': '', 'other_family_relationship_name': '', 'family_member_salutation': '', 'family_member_name': '', 'relationship_with_company_id': '', 'relationship_with_company': '', 'started_business': '', 'currently_active_status': '' }; relationControl.push(this.createPersonRelationhip(other_family_member)); } // remove other famil membre - removeFamilyMember(findex){ + removeFamilyMember(findex) { let relationControl = this.businessForm.controls['persons_with_relationships']; relationControl.removeAt(findex); } - + validateAllFormFields(formGroup: FormGroup) { Object.keys(formGroup.controls).forEach(field => { const control = formGroup.get(field); if (control instanceof FormControl) { - control.markAsTouched({onlySelf: true}); + control.markAsTouched({ onlySelf: true }); } else if (control instanceof FormGroup) { this.validateAllFormFields(control); } }); } - - // filter cities for other than pan india - filterCity(datasource: any,filterid:number) { - if(filterid){ - let filter = datasource.filter(x=>x.state_id==filterid); - return filter.length > 0 ? filter[0].cities : []; - } - } + // filter cities for other than pan india - // filter max sale options - filterMaxSaleState(datasource: any,filterValues:any){ - this.filterCityList = filterValues; - if(filterValues){ - let getOriginalStateList = datasource.map(dval => dval.state_id); - let getStateValues = filterValues.filter(val =>val.state_name).map(mapVal => mapVal.state_name); - let setStateFilter: any=[]; - setStateFilter = getStateValues.map(x => { + filterCity(datasource: any, filterid: number) { + if (filterid) { + let filter = datasource.filter(x => x.state_id == filterid); + return filter.length > 0 ? filter[0].cities : []; + } + } + + // filter max sale options + filterMaxSaleState(datasource: any, filterValues: any) { + this.filterCityList = filterValues; + if (filterValues) { + let getOriginalStateList = datasource.map(dval => dval.state_id); + let getStateValues = filterValues.filter(val => val.state_name).map(mapVal => mapVal.state_name); + let setStateFilter: any = []; + setStateFilter = getStateValues.map(x => { let findIndex = getOriginalStateList.indexOf(x); return datasource[findIndex]; - }); - return setStateFilter.length > 0 ? setStateFilter : []; - } - } + }); + return setStateFilter.length > 0 ? setStateFilter : []; + } + } + + filterMaxSaleCities(datasource: any, filterValues: any, selectedCites: any) { + let existCities: any = selectedCites.filter(cfVal => cfVal.city_name != '').map(mcVal => mcVal.city_name); + existCities = [].concat.apply([], existCities); + if (filterValues) { + let getOriginalStateList = datasource.map(dval => dval.state_id); + + let setCityFilter = filterValues.map(x => { + let findIndex = getOriginalStateList.indexOf(x); + findIndex = datasource[findIndex].cities; + return findIndex; + }); + + let merged = [].concat.apply([], setCityFilter); + + if (merged.length > 0) { + let check: any = merged.filter(function (fVal) { + return existCities.some(function (sVal) { + return fVal.city_id == sVal; + }); + }) + return check; + } + else { + return []; + } + } + else { + return []; + } + } - filterMaxSaleCities(datasource: any,filterValues:any,selectedCites: any) { - let existCities: any = selectedCites.filter(cfVal=>cfVal.city_name!='').map(mcVal=>mcVal.city_name); - existCities = [].concat.apply([], existCities); - if(filterValues){ - let getOriginalStateList = datasource.map(dval => dval.state_id); - - let setCityFilter = filterValues.map(x => { - let findIndex = getOriginalStateList.indexOf(x); - findIndex = datasource[findIndex].cities; - return findIndex; - }); - - let merged = [].concat.apply([], setCityFilter); - - if(merged.length>0){ - let check: any = merged.filter(function(fVal){ - return existCities.some(function(sVal){ - return fVal.city_id==sVal; - }); - }) - return check; - } - else { - return []; - } - } - else { - return []; - } - } - /** To Convert Amount into Words */ - // inWords(e){ - // this.InvestedAmountInWords = this._pd.convertNumberToWords(e); - // } + // inWords(e){ + // this.InvestedAmountInWords = this._pd.convertNumberToWords(e); + // } - checkTotalEmployee(FormData){ - this.businessForm.controls['employees_total'].setValue((+FormData.value.employees_permanent ||0)+(+FormData.value.employees_temporary||0)); - } - - changeOfStartedBusiness(members,i,e){ - if(e == 'yes'){ - members.controls.current_business_experiance_year.setValue(this.generalExistBusinessYear); - this.isreadonlyyear[i] = this.generalExistBusinessYear != undefined ? true : false; - members.controls.current_business_experiance_month.setValue(this.generalExistBusinessMonth); - this.isreadonlymonth[i] = this.generalExistBusinessMonth != undefined ? true : false; + checkTotalEmployee(FormData) { + this.businessForm.controls['employees_total'].setValue((+FormData.value.employees_permanent || 0) + (+FormData.value.employees_temporary || 0)); } - else{ - this.isreadonlyyear[i] =false; - this.isreadonlymonth[i] = false; + + changeOfStartedBusiness(members, i, e) { + if (e == 'yes') { + members.controls.current_business_experiance_year.setValue(this.generalExistBusinessYear); + this.isreadonlyyear[i] = this.generalExistBusinessYear != undefined ? true : false; + members.controls.current_business_experiance_month.setValue(this.generalExistBusinessMonth); + this.isreadonlymonth[i] = this.generalExistBusinessMonth != undefined ? true : false; + } + else { + this.isreadonlyyear[i] = false; + this.isreadonlymonth[i] = false; + } } - } - - checkWithExistBusinessYear(e,i,members){ - - if(+e > this.generalExistBusinessYear){ - this.yearErrorMessage[i] = "Higher than Business Vintage"; - members.controls.current_business_experiance_year.setValue(''); + + checkWithExistBusinessYear(e, i, members) { + + if (+e > this.generalExistBusinessYear) { + this.yearErrorMessage[i] = "Higher than Business Vintage"; + members.controls.current_business_experiance_year.setValue(''); + } + else { + this.yearErrorMessage[i] = ''; + } } - else{ - this.yearErrorMessage[i] = ''; + + checkWithExistTotalWorkExperience(e, i, members) { + + if (+members.value.current_business_experiance_year > +e) { + this.errorMessageForExistTotalWorkExperience[i] = "Total Experience is Lower Than Experience in The Current Company"; + members.controls.total_business_experiance.setValue(''); + } + else { + this.errorMessageForExistTotalWorkExperience[i] = ''; + } } - } + // flag: number = 0; + // CheckExport(e,val){ - checkWithExistTotalWorkExperience(e,i,members){ - - if(+members.value.current_business_experiance_year > +e){ - this.errorMessageForExistTotalWorkExperience[i] = "Total Experience is Lower Than Experience in The Current Company"; - members.controls.total_business_experiance.setValue(''); - } - else{ - this.errorMessageForExistTotalWorkExperience[i] = ''; - } - } -// flag: number = 0; -// CheckExport(e,val){ + // if(val == 1){ + // e != "Within India" ? + // this.flag++ :this.flag--; + // } + // if(val == 2){ + // e != "Within India" ? + // this.flag++ :this.flag--; + // } + // if(val == 3){ + // e != "Within India" ? + // this.flag++ :this.flag--; + // } + // if(val == 4){ + // e != "Within India" ? + // this.flag++ :this.flag--; + // } + // if(this.flag > 0){ + // this.ExportFlag = true; + // } -// if(val == 1){ -// e != "Within India" ? -// this.flag++ :this.flag--; -// } -// if(val == 2){ -// e != "Within India" ? -// this.flag++ :this.flag--; -// } -// if(val == 3){ -// e != "Within India" ? -// this.flag++ :this.flag--; -// } -// if(val == 4){ -// e != "Within India" ? -// this.flag++ :this.flag--; -// } -// if(this.flag > 0){ -// this.ExportFlag = true; -// } - -// } + // } -// counterForExportCart : number = 0; -// domesticCounter : number = 0; -// foreignCounter : number = 0; + // counterForExportCart : number = 0; + // domesticCounter : number = 0; + // foreignCounter : number = 0; - -// CheckExport(value,flag,index){ -// if((flag == 1 || flag == 2 || flag == 3 || flag == 4 ) && value != "Within India"){ -// this.foreignCounter++; -// // index = index+1; -// // this.counterForExportCart++; -// // this.counter = this.counter+index; -// } -// else{ -// this.domesticCounter++; -// if(this.foreignCounter > 0){ -// this.foreignCounter--; -// } -// // index = index+1; -// // this.counter = this.counter-index; -// // this.counterForExportCart--; -// } -// // this.ExportFlag = this.counterForExportCart == 1 ? true : false ; + // CheckExport(value,flag,index){ -// if(this.domesticCounter == 0 && this.foreignCounter == 0){ -// this.ExportFlag = false; -// }else if(this.foreignCounter >= 0) { -// this.ExportFlag = true; -// } + // if((flag == 1 || flag == 2 || flag == 3 || flag == 4 ) && value != "Within India"){ + // this.foreignCounter++; + // // index = index+1; + // // this.counterForExportCart++; + // // this.counter = this.counter+index; + // } + // else{ + // this.domesticCounter++; + // if(this.foreignCounter > 0){ + // this.foreignCounter--; + // } + // // index = index+1; + // // this.counter = this.counter-index; + // // this.counterForExportCart--; + // } + // // this.ExportFlag = this.counterForExportCart == 1 ? true : false ; -// } + // if(this.domesticCounter == 0 && this.foreignCounter == 0){ + // this.ExportFlag = false; + // }else if(this.foreignCounter >= 0) { + // this.ExportFlag = true; + // } -ManufacturingCounterArray: any = []; -RetailCounterArray: any = []; -WholeSaleCounterArray: any = []; -ServiceCounterArray: any = []; + // } -CheckExport(value,stringFlag,index){ - - const parentControl = this.businessForm.controls['select_business_activity_type']; - const childControl = parentControl.controls[0]; - - if(!this.ManufacturingUnChecked){ - if(stringFlag == 'MActivity' && value == "Both"){ + ManufacturingCounterArray: any = []; + RetailCounterArray: any = []; + WholeSaleCounterArray: any = []; + ServiceCounterArray: any = []; + + CheckExport(value, stringFlag, index) { + + const parentControl = this.businessForm.controls['select_business_activity_type']; + const childControl = parentControl.controls[0]; + + if (!this.ManufacturingUnChecked) { + if (stringFlag == 'MActivity' && value == "Both") { this.ManufacturingCounterArray[index] = 1; } - else if(stringFlag == 'MActivity' && value != "Both"){ + else if (stringFlag == 'MActivity' && value != "Both") { this.ManufacturingCounterArray[index] = 0; } - }else if (this.ManufacturingUnChecked && stringFlag == 'MActivity'){ - this.ManufacturingCounterArray[index] = 0; - } - - if(!this.RetailedUnChecked){ - if(stringFlag == 'RActivity' && value == "Both"){ - this.RetailCounterArray[index] = 1; + } else if (this.ManufacturingUnChecked && stringFlag == 'MActivity') { + this.ManufacturingCounterArray[index] = 0; } - else if(stringFlag == 'RActivity' && value != "Both"){ + + if (!this.RetailedUnChecked) { + if (stringFlag == 'RActivity' && value == "Both") { + this.RetailCounterArray[index] = 1; + } + else if (stringFlag == 'RActivity' && value != "Both") { + this.RetailCounterArray[index] = 0; + } + } + else if (stringFlag == 'RActivity' && this.RetailedUnChecked) { this.RetailCounterArray[index] = 0; } - } - else if(stringFlag == 'RActivity' && this.RetailedUnChecked){ - this.RetailCounterArray[index] = 0; - } - - if(!this.WholeSalesUnChecked){ - if(stringFlag == 'WActivity' && value == "Both"){ - this.WholeSaleCounterArray[index] = 1; + + if (!this.WholeSalesUnChecked) { + if (stringFlag == 'WActivity' && value == "Both") { + this.WholeSaleCounterArray[index] = 1; + } + else if (stringFlag == 'WActivity' && value != "Both") { + this.WholeSaleCounterArray[index] = 0; + } } - else if(stringFlag == 'WActivity' && value != "Both"){ + else if (stringFlag == 'WActivity' && this.WholeSalesUnChecked) { this.WholeSaleCounterArray[index] = 0; } - } - else if(stringFlag == 'WActivity' && this.WholeSalesUnChecked){ - this.WholeSaleCounterArray[index] = 0; - } - - if(!this.ServiceUnChecked){ - - if(stringFlag == 'SPActivity' && value == "Both") - { + + if (!this.ServiceUnChecked) { + + if (stringFlag == 'SPActivity' && value == "Both") { this.ServiceCounterArray[index] = 1; } - else if(stringFlag == 'SPActivity' && value != "Both"){ + else if (stringFlag == 'SPActivity' && value != "Both") { this.ServiceCounterArray[index] = 0; } - }else if(stringFlag == 'SPActivity' && this.ServiceUnChecked){ - this.ServiceCounterArray[index] = 0; - } + } else if (stringFlag == 'SPActivity' && this.ServiceUnChecked) { + this.ServiceCounterArray[index] = 0; + } - let SumOfManufacturingCounter = this.ManufacturingCounterArray.reduce((sum, val) => sum + +val, 0); - - let SumOfRetailCounter = this.RetailCounterArray.reduce((sum, val) => sum + +val, 0); - - let SumOfWholeSaleCounter = this.WholeSaleCounterArray.reduce((sum, val) => sum + +val, 0); - - let SumOfServiceCounter = this.ServiceCounterArray.reduce((sum, val) => sum + +val, 0); - - let overallCounter = SumOfManufacturingCounter + SumOfRetailCounter + SumOfWholeSaleCounter + SumOfServiceCounter ; - - this.ExportFlag = overallCounter > 0 ? true : false ; - -} + let SumOfManufacturingCounter = this.ManufacturingCounterArray.reduce((sum, val) => sum + +val, 0); + + let SumOfRetailCounter = this.RetailCounterArray.reduce((sum, val) => sum + +val, 0); + + let SumOfWholeSaleCounter = this.WholeSaleCounterArray.reduce((sum, val) => sum + +val, 0); + + let SumOfServiceCounter = this.ServiceCounterArray.reduce((sum, val) => sum + +val, 0); + + let overallCounter = SumOfManufacturingCounter + SumOfRetailCounter + SumOfWholeSaleCounter + SumOfServiceCounter; + + this.ExportFlag = overallCounter > 0 ? true : false; - inWords(e,flag){ - switch(flag){ - case 1 : - this.appxSalaryAmtInwords = this._pd.convertNumberToWords(e.target.value); - break; } - } - - changePOSMachinesAvailablity(e,flag){ - - e == 'yes' - ? this.businessForm.addControl('no_of_pos_machines', new FormControl('')) - : this.businessForm.removeControl('no_of_pos_machines'); - - if(flag == 2){ - e == 'yes' - ? this.businessForm.controls.no_of_pos_machines.setValue(this.temp_noofposmachine) - : this.businessForm.removeControl('no_of_pos_machines'); - } - - } - toGetPOSMachinesDetails(e,flag){ + inWords(e, flag) { + switch (flag) { + case 1: + this.appxSalaryAmtInwords = this._pd.convertNumberToWords(e.target.value); + break; + } + } - if(flag == 1){ this.businessForm.addControl('pos_machines_details', this.fb.array([])); } - const control = this.businessForm.controls['pos_machines_details']; + changePOSMachinesAvailablity(e, flag) { + + e == 'yes' + ? this.businessForm.addControl('no_of_pos_machines', new FormControl('')) + : this.businessForm.removeControl('no_of_pos_machines'); + + if (flag == 2) { + e == 'yes' + ? this.businessForm.controls.no_of_pos_machines.setValue(this.temp_noofposmachine) + : this.businessForm.removeControl('no_of_pos_machines'); + } + + } + + toGetPOSMachinesDetails(e, flag) { + + if (flag == 1) { this.businessForm.addControl('pos_machines_details', this.fb.array([])); } + const control = this.businessForm.controls['pos_machines_details']; while (control.length !== 0) { control.removeAt(0); } - if(e > 0 ){ - if(flag == 1){ - for(let i = 1 ; i<= e ; i++ ){ - control.push(this.createPOSMachinesDetails(null)); - } + if (e > 0) { + if (flag == 1) { + for (let i = 1; i <= e; i++) { + control.push(this.createPOSMachinesDetails(null)); + } } - else if(flag == 2){ - for(let i = 1 ; i<= e ; i++ ){ + else if (flag == 2) { + for (let i = 1; i <= e; i++) { control.push(this.createPOSMachinesDetails(this.temp_additiondetailofposmachine)); } } } - } + } - createPOSMachinesDetails(data){ - if(data == null){ + createPOSMachinesDetails(data) { + if (data == null) { return this.fb.group({ pos_machines_financial_institution_name: [''], tid_no_of_pos_machine: [''], }); } - else if(data != null) { + else if (data != null) { return this.fb.group({ pos_machines_financial_institution_name: [data.pos_machines_financial_institution_name], tid_no_of_pos_machine: [data.tid_no_of_pos_machine], }); } - } + } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html index c2eb30ada..00618dea4 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html @@ -1,11 +1,13 @@

- {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
- {{pageTitle}} -
+ {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
+ {{pageTitle}} +

- +

@@ -14,19 +16,22 @@
Manufacturing Product Details
-
+
-
+
Product #{{l+1}}
- Select - {{ pm.name }} + Select + {{ + pm.name }} - + @@ -35,112 +40,128 @@
- - - Select - - {{tl.name}} - - - + + + Select + + {{tl.name}} + + + - - Select - + + Select + {{comrelShip.name}} - - - - - - + + + + + +
- - Enter Valid Mobile Number. + + Enter Valid Mobile Number. - - Enter Valid STD Code Number. + + Enter Valid STD Code Number.   -   - - Enter Valid LandLine Number. + + Enter Valid LandLine Number.
-
+
- - Select - {{ pm.name }} - - + + Select + {{ pm.name + }} + + - - Select - Payment received in Cash. - Payment received through Banking channels. - - - - + + Select + Payment received in Cash. + Payment + received through Banking channels. + + + +
No of days of Credit provided to Client for payment - - - - - - - + + + + + + +
- +
-
-
- -
-
-
+
+
+ +
+
+
- +
- -
+ +
Trading Product Details
-
+
-
+
Trading Product #{{l+1}}
- Select - {{ pm.name }} + Select + {{ + pm.name }} - - - - + + + + + +
- - Enter Valid Mobile Number. + + Enter Valid Mobile Number. - - Enter Valid STD Code Number. + + Enter Valid STD Code Number.   -   - - Enter Valid LandLine Number. + + Enter Valid LandLine Number. -
-
+
+
- - Select - {{ pm.name }} - - + + Select + {{ pm.name + }} + + - - Select - Payment received in Cash. - Payment received through Banking channels. - - + + Select + Payment received in Cash. + Payment + received through Banking channels. + +
-
+
-
+
Service Provided #{{l+1}}
- Select - {{ pm.name }} + Select + {{ + pm.name }} - - -
-
+ + +
+
- - Select - - {{tl.name}} - - - + + Select + + {{tl.name}} + + + - - Select - + + Select + {{comrelShip.name}} - - - - - - - + + + + + + +
- - Enter Valid Mobile Number. + + Enter Valid Mobile Number. - - Enter Valid STD Code Number. + + Enter Valid STD Code Number.   -   - - Enter Valid LandLine Number. + + Enter Valid LandLine Number. -
-
+
+
- - Select - {{ pm.name }} - - + + Select + {{ pm.name + }} + + - - Select - Payment received in Cash. - Payment received through Banking channels. - - - + + Select + Payment received in Cash. + Payment + received through Banking channels. + + +
No of days of Credit provided to Client for payment - - - - - - + + + + + +
- +
-
- -
+
+ +
- - - -
- + + +
+ +
- - - - Select - Yes - No - - +

+
+ {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
+ {{pageTitle}} +
+
+ - - -
-
- -

Loan Details {{details.get('label').value}}

-
- - - - - - Select - {{types.loan_type_name}} - - - - - - - - - {{"₹"}} {{amtInwords[i]}} Only - - - - Select - {{ btLen.lender_name }} - - - - - - - + + + + Select + Yes + No + + + + + +
+
+ + +

Loan Details {{details.get('label').value}}

+
+
+ + + + + + Select + {{types.loan_type_name}} + + + + + + + + + {{"₹"}} + {{amtInwords[i]}} Only + + + + Select + {{ + btLen.lender_name }} + + + + + + + - - - - {{val.name}} - - - - - - - - - - - - - Select - {{freq.name}} - - - - - - - - - {{"₹"}} {{emiAmtInwords[i]}} Only - - + + + + + + + + Select + {{freq.name}} + + + + + + + + + {{"₹"}} + {{emiAmtInwords[i]}} Only + + -
- - - - - - Invalid Balance Tenure. - - - - - -
- - + + + + +
+ + - - -
- -
-
- -
-
- -
-
- + + +
+ +
+
+ +
+
- - - - - - - -
+ + +
+
+

+ + + + + +
+
+
+
+
+
+
Image 1
+
+
- - - - - -
- - - - - - - - - -
- - Remarks - - -
-
- -
-
- +
+
+
+
Image 3
+
+
+
+
+
+
+
Image 2
+
+
+
+
+
+
+
Image 3
+
+
+
+
+
+
+
Image 1
+
+
+
+
+ +
+
+ + + + + + + + +
+ + Remarks + + +
+
+ +
+
+ - + - - - - - - - - + - - - + --> \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts index 42478ab5e..5d34740a4 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts @@ -35,8 +35,8 @@ export class CurrentLoanComponent implements OnInit { main_applicant: any; public currentLoanForm: FormGroup; private notifier: NotifierService; - pageTitle: string ="Existing Loan Obligations"; - pdid : number; + pageTitle: string = "Existing Loan Obligations"; + pdid: number; form_id: number; applicant_details: any; // @Input() pdid: number; @@ -49,99 +49,99 @@ export class CurrentLoanComponent implements OnInit { propertyTypeData: any = []; addressTypeData: any = []; applicants: any; - placeholderName : any = []; - IDXval : any; - OtherFlag : any = []; - amtInwords : any = []; - labelArr : any = []; - emiAmtInwords : any = []; - dataFromAssets : any = []; - existCompanyList: any =[]; - mergeCompanyApplicant: any=[]; + placeholderName: any = []; + IDXval: any; + OtherFlag: any = []; + amtInwords: any = []; + labelArr: any = []; + emiAmtInwords: any = []; + dataFromAssets: any = []; + existCompanyList: any = []; + mergeCompanyApplicant: any = []; constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, private router: Router, private _pd: PdTrigerService, private dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { - this.pdid = this.pd_all_details.pdmaster_details.pd_id; - this.form_id = 8; - this.notifier = notifier; - this.applicants = this.pd_all_details.pdapplicants_detials; - this.applicants.push({'pd_co_applicant_id':'0','applicant_name':'Others'}); - //this.OtherFlag[0] = false; - this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; - this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; - this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; - this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { + this.pdid = this.pd_all_details.pdmaster_details.pd_id; + this.form_id = 8; + this.notifier = notifier; + this.applicants = this.pd_all_details.pdapplicants_detials; + this.applicants.push({ 'pd_co_applicant_id': '0', 'applicant_name': 'Others' }); + //this.OtherFlag[0] = false; + this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; + this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; + this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; + this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; } public viewerOptions: any = { - navbar: false, - toolbar: { - zoomIn: 4, - zoomOut: 4, - oneToOne: 4, - reset: 4, - prev: 4, - play: { - show: 4, - size: 'large', - }, - next: 4, - rotateLeft: 4, - rotateRight: 4, - flipHorizontal: 4, - flipVertical: 4, - } -}; + navbar: false, + toolbar: { + zoomIn: 4, + zoomOut: 4, + oneToOne: 4, + reset: 4, + prev: 4, + play: { + show: 4, + size: 'large', + }, + next: 4, + rotateLeft: 4, + rotateRight: 4, + flipHorizontal: 4, + flipVertical: 4, + } + }; ngOnInit() { console.clear(); - this.getMasterDetails('BTLENDERLIST',1); - this.getMasterDetails('FREQUENCY',2); - this.getMasterDetails('EXISTINGLOANTYPES',3); - this.getMasterDetails('INVESTMENTTYPE',4); - this.getMasterDetails('PROPERTIES',5); - this.getMasterDetails('ADDRESSTYPE',6); - + this.getMasterDetails('BTLENDERLIST', 1); + this.getMasterDetails('FREQUENCY', 2); + this.getMasterDetails('EXISTINGLOANTYPES', 3); + this.getMasterDetails('INVESTMENTTYPE', 4); + this.getMasterDetails('PROPERTIES', 5); + this.getMasterDetails('ADDRESSTYPE', 6); + this.initCurrentloanForm(); - this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{ - if(data.dataStatus){ - this.existCompanyList = data.records.filter(val =>val.is_active===true); + this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data => { + if (data.dataStatus) { + this.existCompanyList = data.records.filter(val => val.is_active === true); } - - let modifyCompanyList : any=[]; - if(this.existCompanyList.length>0){ - modifyCompanyList = this.existCompanyList.map(element => { - return {id:element.company_order_id.toString(),name:element.company_name,group_id:1}; - }); - this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList}) - + + let modifyCompanyList: any = []; + if (this.existCompanyList.length > 0) { + modifyCompanyList = this.existCompanyList.map(element => { + return { id: element.company_order_id.toString(), name: element.company_name, group_id: 1 }; + }); + this.mergeCompanyApplicant.push({ groupName: 'COMPANIES', groupValues: modifyCompanyList }) + } - - let modifyApplicantList: any=[]; - if(this.applicants.length > 0){ - modifyApplicantList = this.applicants.map(element => { - return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2}; - }); - this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList}) - + + let modifyApplicantList: any = []; + if (this.applicants.length > 0) { + modifyApplicantList = this.applicants.map(element => { + return { id: element.pd_co_applicant_id, name: element.applicant_name, group_id: 2 }; + }); + this.mergeCompanyApplicant.push({ groupName: 'APPLICANTS', groupValues: modifyApplicantList }) + } }) - + let params: any = {}; params.pd_id = this.pdid; params.pd_form_id = this.form_id; - + this._pd.retriveForm(params).subscribe(value => { - + const control = this.currentLoanForm.controls['loan_details']; if (value.status == 200) { - + this.currentLoanForm.controls['existing_loan'].setValue(value.records.existing_loan); this.currentLoanForm.controls['currentloan_remarks'].setValue(value.records.currentloan_remarks); if (value.records.existing_loan == 'Yes') { - + let loandetails = value.records.loan_details var result = Object.keys(loandetails).map(function (key) { @@ -150,30 +150,30 @@ export class CurrentLoanComponent implements OnInit { const control = this.currentLoanForm.controls['loan_details']; if (result.length > 0) { - result.forEach((val,index) => { - this.amtInwords[index] = this._pd.convertNumberToWords(val.loan_amount); + result.forEach((val, index) => { + this.amtInwords[index] = this._pd.convertNumberToWords(val.loan_amount); this.emiAmtInwords[index] = this._pd.convertNumberToWords(val.emi); - this.selectedfrequency(val.frequency,index); + this.selectedfrequency(val.frequency, index); //this.selectedLoanTakenBy(val.loan_taken_by,index); - - let objs = { + + let objs = { 'label': val.label, 'loan_amount': val.loan_amount, - 'frequency':val.frequency, - 'other_frequency':val.other_frequency, + 'frequency': val.frequency, + 'other_frequency': val.other_frequency, 'emi': val.emi, 'loan_type': val.loan_type, 'others_loan_type': val.others_loan_type, - 'loan_taken_by':val.loan_taken_by, - 'others_loan_taken':val.others_loan_taken, + 'loan_taken_by': val.loan_taken_by, + 'others_loan_taken': val.others_loan_taken, 'lender': val.lender, - 'others_lender':val.others_lender, + 'others_lender': val.others_lender, 'original_tenure': val.original_tenure, 'current_balance_tenure': val.current_balance_tenure, - 'elapsed_tenure':val.elapsed_tenure + 'elapsed_tenure': val.elapsed_tenure } control.push(this.createLoanDetail(objs)); - + }); // this.currentLoanForm.controls['loan_details'].setValue(result_data); @@ -182,201 +182,204 @@ export class CurrentLoanComponent implements OnInit { } } } else { - - this._pd.getAssetsWithLoanFromBusiness(this.pdid).subscribe(data=>{ - // console.log('data',data); - - if(data.dataStatus == true){ - // console.log('data',data.record); - // return; - + + this._pd.getAssetsWithLoanFromBusiness(this.pdid).subscribe(data => { + + + if (data.dataStatus == true) { + let AssetData = data.record; - if(AssetData.business_address_asset.length>0){ + if (AssetData.business_address_asset.length > 0) { AssetData.business_address_asset.map(element => { - this.dataFromAssets.push({mode:0, - mode_name:element.address_label, - details:[], - owner_name:element.business_name_of_the_owner, - form_type:'Data From Bussiness Address'}) - }); - } - - if(AssetData.business_assets.length>0){ - AssetData.business_assets.map(element => { - this.dataFromAssets.push({mode:element.business_assets_mode, - mode_name:element.business_assets_mode_name, - details:element.business_details, - owner_name:element.business_name_of_the_owner, - form_type:'Data From Business Assets'}) - }); - } - - if(AssetData.other_assests.length > 0){ - AssetData.other_assests.map(element => { - this.dataFromAssets.push({mode:element.assets_mode, - mode_name:element.assets_mode_name, - details:element.details, - owner_name:element.name_of_the_owner, - form_type:'Data From Other Asset' + this.dataFromAssets.push({ + mode: 0, + mode_name: element.address_label, + details: [], + owner_name: element.business_name_of_the_owner, + form_type: 'Data From Bussiness Address' }) - }); - } - + }); + } + + if (AssetData.business_assets.length > 0) { + AssetData.business_assets.map(element => { + this.dataFromAssets.push({ + mode: element.business_assets_mode, + mode_name: element.business_assets_mode_name, + details: element.business_details, + owner_name: element.business_name_of_the_owner, + form_type: 'Data From Business Assets' + }) + }); + } + + if (AssetData.other_assests.length > 0) { + AssetData.other_assests.map(element => { + this.dataFromAssets.push({ + mode: element.assets_mode, + mode_name: element.assets_mode_name, + details: element.details, + owner_name: element.name_of_the_owner, + form_type: 'Data From Other Asset' + }) + }); + } + // id: "4", name: "Equipments and machinaries", isactive: "1", flag: "1", is_others: "0" // id: "7", name: "Investments", isactive: "1", flag: "0", is_others: "0" // id: "6", name: "Life Insurance Policy", isactive: "1", flag: "0", is_others: "0" // id: "2", name: "Property", isactive: "1", flag: "1", is_others: "0" // id: "3", name: "Vehicle", isactsive: "1", flag: "1", is_others: "0" // id: "1", name: "Others", isactive: "1", flag: "1", is_others: "1"} - - if(this.dataFromAssets.length > 0){ - let labelarray : any = []; - - this.dataFromAssets.forEach((val,index) => { - if(val.mode == 0){ - let owner = val.owner_name.map((e => { + + if (this.dataFromAssets.length > 0) { + let labelarray: any = []; + + this.dataFromAssets.forEach((val, index) => { + if (val.mode == 0) { + let owner = val.owner_name.map((e => { return e.name.split(',') - })); - // labelarray[index] = ' : '+owner +' - '+ val.mode_name.split("/")[0] + ' ( ' + val.mode_name.split("/")[1] + ' )'; - labelarray[index] = ' : '+owner +' - '+ val.mode_name; - } - - if(val.mode == 1){ - let data; - let owner : any = "Owner Not Mentioned"; - val.details.forEach((v,index) => { - data = v.any_other_assets; - }); - if(val.owner_name.length>0){ - owner = val.owner_name.map((e => { - return e.name.split(',') - })); - } - - let description = data != '' ? ' ( '+ data +' )' : ''; - labelarray[index] = ' : '+owner +' - '+ val.mode_name + description; - } - if(val.mode == 2){ - - let data; - let owner : any = "Owner Not Mentioned"; - val.details.forEach((v,index) => { - data = v.property_type; - if(v.property_type != 1){ - if(val.form_type == 'Data From Business Assets'){ + })); + // labelarray[index] = ' : '+owner +' - '+ val.mode_name.split("/")[0] + ' ( ' + val.mode_name.split("/")[1] + ' )'; + labelarray[index] = ' : ' + owner + ' - ' + val.mode_name; + } + + if (val.mode == 1) { + let data; + let owner: any = "Owner Not Mentioned"; + val.details.forEach((v, index) => { + data = v.any_other_assets; + }); + if (val.owner_name.length > 0) { + owner = val.owner_name.map((e => { + return e.name.split(',') + })); + } + + let description = data != '' ? ' ( ' + data + ' )' : ''; + labelarray[index] = ' : ' + owner + ' - ' + val.mode_name + description; + } + if (val.mode == 2) { + + let data; + let owner: any = "Owner Not Mentioned"; + val.details.forEach((v, index) => { + data = v.property_type; + if (v.property_type != 1) { + if (val.form_type == 'Data From Business Assets') { data = this.addressTypeData.filter(item => item.address_type_id == v.property_type)[0].address_type; } - else if(val.form_type == 'Data From Other Asset'){ + else if (val.form_type == 'Data From Other Asset') { data = this.propertyTypeData.filter(item => item.id == v.property_type)[0].name; } - else{ + else { data = ''; } - }else{ - data=v.other_property_type; - } - if(val.owner_name.length>0){ - owner = val.owner_name.map((e => { - return e.name.split(',') - })); - } - - }); - let description = data != '' ? ' ( '+ data +' )' : ''; - labelarray[index] = ' : '+owner +' - '+ val.mode_name + description; - } - if(val.mode == 3){ - let data;let owner : any = "Owner Not Mentioned"; - val.details.forEach((v,index) => { - data = v.manufacturer_model_vehicle; - }); - if(val.owner_name.length>0){ - owner = val.owner_name.map((e => { - return e.name.split(',') - })); - } - let description = data != '' ? ' ( '+ data +' )' : ''; - labelarray[index] = ' : '+owner +' - '+ val.mode_name + description; - } - if(val.mode == 4){ - let data;let owner : any = "Owner Not Mentioned"; - val.details.forEach((v,index) => { - data = v.equipment_manufacturing_description; - }); - if(val.owner_name.length>0){ - owner = val.owner_name.map((e => { - return e.name.split(',') - })); - } - let description = data != '' ? ' ( '+ data +' )' : ''; - labelarray[index] = ' : '+owner +' - '+ val.mode_name + description; - } - if(val.mode == 6){ - let owner : any = "Owner Not Mentioned"; - if(val.owner_name.length>0){ - owner = val.owner_name.map((e => { - return e.name.split(',') - })); - } - - labelarray[index] = ' : '+owner+' - '+ val.mode_name; - } - if(val.mode == 7){ - let data;let owner : any = "Owner Not Mentioned"; - val.details.forEach((v,index) => { - data = v.investments_type != 1 - ? this.investmentTypeData.filter(data => data.id == v.investments_type)[0].name - : v.other_investments_type ; + } else { + data = v.other_property_type; + } + if (val.owner_name.length > 0) { + owner = val.owner_name.map((e => { + return e.name.split(',') + })); + } - }); - if(val.owner_name.length>0){ - owner = val.owner_name.map((e => { - return e.name.split(',') - })); - } - let description = data != '' ? '( '+ data +' )' : ''; - labelarray[index] = ' : '+owner +' - '+ val.mode_name + description; - } - }); - const control = this.currentLoanForm.controls['loan_details']; - this.labelArr = labelarray; - let arr : any = []; - if(this.labelArr.length > 0){ - this.currentLoanForm.controls['existing_loan'].setValue('Yes'); - this.labelArr.forEach((v,index) => { - arr = { - 'label': v, - 'loan_amount': '', - 'frequency':'', - 'other_frequency':'', - 'emi': '', - 'loan_type': '', - 'others_loan_type': '', - 'loan_taken_by':'', - 'others_loan_taken':'', - 'lender': '', - 'others_lender':'', - 'original_tenure': '', - 'current_balance_tenure': '', - 'elapsed_tenure':'' - } - control.push(this.createLoanDetail(arr)); + }); + let description = data != '' ? ' ( ' + data + ' )' : ''; + labelarray[index] = ' : ' + owner + ' - ' + val.mode_name + description; + } + if (val.mode == 3) { + let data; let owner: any = "Owner Not Mentioned"; + val.details.forEach((v, index) => { + data = v.manufacturer_model_vehicle; + }); + if (val.owner_name.length > 0) { + owner = val.owner_name.map((e => { + return e.name.split(',') + })); + } + let description = data != '' ? ' ( ' + data + ' )' : ''; + labelarray[index] = ' : ' + owner + ' - ' + val.mode_name + description; + } + if (val.mode == 4) { + let data; let owner: any = "Owner Not Mentioned"; + val.details.forEach((v, index) => { + data = v.equipment_manufacturing_description; + }); + if (val.owner_name.length > 0) { + owner = val.owner_name.map((e => { + return e.name.split(',') + })); + } + let description = data != '' ? ' ( ' + data + ' )' : ''; + labelarray[index] = ' : ' + owner + ' - ' + val.mode_name + description; + } + if (val.mode == 6) { + let owner: any = "Owner Not Mentioned"; + if (val.owner_name.length > 0) { + owner = val.owner_name.map((e => { + return e.name.split(',') + })); + } + + labelarray[index] = ' : ' + owner + ' - ' + val.mode_name; + } + if (val.mode == 7) { + let data; let owner: any = "Owner Not Mentioned"; + val.details.forEach((v, index) => { + data = v.investments_type != 1 + ? this.investmentTypeData.filter(data => data.id == v.investments_type)[0].name + : v.other_investments_type; + + }); + if (val.owner_name.length > 0) { + owner = val.owner_name.map((e => { + return e.name.split(',') + })); + } + let description = data != '' ? '( ' + data + ' )' : ''; + labelarray[index] = ' : ' + owner + ' - ' + val.mode_name + description; + } }); - // this.currentLoanForm.controls['existing_loan'].setValue(arr); + const control = this.currentLoanForm.controls['loan_details']; + this.labelArr = labelarray; + let arr: any = []; + if (this.labelArr.length > 0) { + this.currentLoanForm.controls['existing_loan'].setValue('Yes'); + this.labelArr.forEach((v, index) => { + arr = { + 'label': v, + 'loan_amount': '', + 'frequency': '', + 'other_frequency': '', + 'emi': '', + 'loan_type': '', + 'others_loan_type': '', + 'loan_taken_by': '', + 'others_loan_taken': '', + 'lender': '', + 'others_lender': '', + 'original_tenure': '', + 'current_balance_tenure': '', + 'elapsed_tenure': '' + } + control.push(this.createLoanDetail(arr)); + }); + // this.currentLoanForm.controls['existing_loan'].setValue(arr); + } } + else { + + control.push(this.createLoanDetail(null)); + } + } - else{ - - control.push(this.createLoanDetail(null)); - } - - } - }); + }); } }) } - checkTenure(details){ + checkTenure(details) { let originalTenure = details.value.original_tenure; // alert(originalTenure); details.controls.current_balance_tenure.setValidators([Validators.required, Validators.max(+originalTenure)]); @@ -386,12 +389,12 @@ export class CurrentLoanComponent implements OnInit { // let BalanceTenure = details.value.current_balance_tenure; // if( originalTenure < BalanceTenure){ // alert('Greater'); - // details.controls.current_balance_tenure.setValue(''); - // alert('validation setted For'); - // details.controls.current_balance_tenure.setValidators([Validators.min(+originalTenure)]); - // details.controls.current_balance_tenure.updateValueAndValidity(); - - + // details.controls.current_balance_tenure.setValue(''); + // alert('validation setted For'); + // details.controls.current_balance_tenure.setValidators([Validators.min(+originalTenure)]); + // details.controls.current_balance_tenure.updateValueAndValidity(); + + // } } @@ -402,7 +405,7 @@ export class CurrentLoanComponent implements OnInit { // wordControl.updateValueAndValidity(); // } // } - + public initCurrentloanForm(): void { this.currentLoanForm = this.fb.group({ existing_loan: [''], @@ -412,14 +415,14 @@ export class CurrentLoanComponent implements OnInit { } selectedLoanChanges(e): void { - + if (e == 'Yes') { - + const control = this.currentLoanForm.controls['loan_details']; control.push(this.createLoanDetail(null)); - + } else if (e == 'No') { - + const arr = this.currentLoanForm.controls.loan_details; arr.removeAt(0); } @@ -433,14 +436,14 @@ export class CurrentLoanComponent implements OnInit { // } // } - selectedfrequency(e,i){ - - switch(+e){ + selectedfrequency(e, i) { + + switch (+e) { case 1: this.placeholderName[i] = 'Instalment Amount'; break; - case 2: this.placeholderName[i] = 'Annual Instalment Amount'; break; + case 2: this.placeholderName[i] = 'Annual Instalment Amount'; break; case 3: this.placeholderName[i] = 'Halfyearly Instalment Amount'; break; case 4: this.placeholderName[i] = 'Fortnightly Instalment Amount'; break; - case 5: this.placeholderName[i] = 'Daily Instalment Amount'; break; + case 5: this.placeholderName[i] = 'Daily Instalment Amount'; break; case 6: this.placeholderName[i] = 'Quarterly Instalment Amount'; break; case 7: this.placeholderName[i] = 'Monthly Instalment Amount'; break; default: this.placeholderName[i] = 'Instalment Amount'; break; @@ -451,39 +454,39 @@ export class CurrentLoanComponent implements OnInit { return this.fb.group({ label: data == null ? [''] : [data.label], loan_amount: null ? [''] : [data.loan_amount], - frequency:null ? [''] : [data.frequency], - other_frequency:null ? [''] : [data.other_frequency], + frequency: null ? [''] : [data.frequency], + other_frequency: null ? [''] : [data.other_frequency], emi: null ? [''] : [data.emi], loan_type: null ? [''] : [data.loan_type], others_loan_type: null ? [''] : [data.others_loan_type], - loan_taken_by:null ? [''] : [data.loan_taken_by], - others_loan_taken:null ? [''] : [data.others_loan_taken], + loan_taken_by: null ? [''] : [data.loan_taken_by], + others_loan_taken: null ? [''] : [data.others_loan_taken], lender: null ? [''] : [data.lender], - others_lender:null ? [''] : [data.others_lender], + others_lender: null ? [''] : [data.others_lender], original_tenure: null ? [''] : [data.original_tenure], current_balance_tenure: null ? [''] : [data.current_balance_tenure], - elapsed_tenure:null ? [''] : [data.elapsed_tenure] + elapsed_tenure: null ? [''] : [data.elapsed_tenure] }); } // compare objects for merge two master table details - compareObjects(o1: any, o2: any) { - if(o1.id == o2.id && o1.group_id == o2.group_id) - return true; - else return false - } + compareObjects(o1: any, o2: any) { + if (o1.id == o2.id && o1.group_id == o2.group_id) + return true; + else return false + } // check others - checkOthers(values){ - if(values!=null) { - return values.id==0 ? true : false; + checkOthers(values) { + if (values != null) { + return values.id == 0 ? true : false; + } + else { + return false; + } + } - else { - return false; - } - - } addLoanDetails() { const control = this.currentLoanForm.controls['loan_details']; @@ -494,16 +497,15 @@ export class CurrentLoanComponent implements OnInit { control.removeAt(index); } - calculateTenure(details) - { - let ElapsedValues; - - if(details.value.original_tenure != null && details.value.original_tenure != '' && details.value.current_balance_tenure != null && details.value.current_balance_tenure != ''){ - ElapsedValues = details.value.original_tenure - details.value.current_balance_tenure ; - details.controls['elapsed_tenure'].setValue(ElapsedValues); - } + calculateTenure(details) { + let ElapsedValues; - } + if (details.value.original_tenure != null && details.value.original_tenure != '' && details.value.current_balance_tenure != null && details.value.current_balance_tenure != '') { + ElapsedValues = details.value.original_tenure - details.value.current_balance_tenure; + details.controls['elapsed_tenure'].setValue(ElapsedValues); + } + + } submitCurrentloan() { if (!this.currentLoanForm.valid) { @@ -520,14 +522,14 @@ export class CurrentLoanComponent implements OnInit { records.loan_details = this.currentLoanForm.controls['loan_details'].value; } this._pd.saveForm(records).subscribe(data => { - if(data.status == 200) { + if (data.status == 200) { this.notifier.notify('success', 'Saved Successfully.'); - setTimeout(() =>{ + setTimeout(() => { this.dialogRef.close(); - },3000); + }, 3000); } else { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); } }, error => { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); @@ -543,71 +545,71 @@ export class CurrentLoanComponent implements OnInit { } }); } - getMasterDetails(table:string,type:number){ + getMasterDetails(table: string, type: number) { this._pd.getAllMasterDatas(table).subscribe(data => { data.records.forEach(val => { - if(type==1 && val.isactive == 1) { + if (type == 1 && val.isactive == 1) { this.lenderData.push(val); } - else if(type==2 && val.isactive == 1){ + else if (type == 2 && val.isactive == 1) { this.frequencyData.push(val); } - else if(type==3 && val.isactive == 1){ + else if (type == 3 && val.isactive == 1) { this.loanTypeData.push(val); } - else if(type==4 && val.isactive == 1){ + else if (type == 4 && val.isactive == 1) { this.investmentTypeData.push(val); } - else if(type==5 && val.isactive == 1){ + else if (type == 5 && val.isactive == 1) { this.propertyTypeData.push(val); } - else if(type==6 && val.isactive == 1){ + else if (type == 6 && val.isactive == 1) { this.addressTypeData.push(val); } }) }); } - /** Amount InWords */ - inWords(e,i,flag){ - switch(flag){ - case 1 : - this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value); - break; - case 2 : - this.emiAmtInwords[i] = this._pd.convertNumberToWords(e.target.value); - break; - default: - break; + /** Amount InWords */ + inWords(e, i, flag) { + switch (flag) { + case 1: + this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value); + break; + case 2: + this.emiAmtInwords[i] = this._pd.convertNumberToWords(e.target.value); + break; + default: + break; + } } - } - setRequiredValidation(value,item,flag) { - - if(flag == 1){ - value==1 - ? item.controls.others_loan_type.setValidators([Validators.required]) - : item.controls.others_loan_type.clearValidators(); - item.controls.others_loan_type.updateValueAndValidity(); - } - if(flag == 2){ - // value==1 - // ? item.controls.others_lender.setValidators([Validators.required]) - // : item.controls.others_lender.clearValidators(); - // item.controls.others_lender.updateValueAndValidity(); - } - if(flag == 3){ - value==0 - ? item.controls.others_loan_taken.setValidators([Validators.required]) - : item.controls.others_loan_taken.clearValidators(); - item.controls.others_loan_taken.updateValueAndValidity(); - } - if(flag == 4){ - value==1 - ? item.controls.other_frequency.setValidators([Validators.required]) - : item.controls.other_frequency.clearValidators(); - item.controls.other_frequency.updateValueAndValidity(); - } - - + setRequiredValidation(value, item, flag) { + + if (flag == 1) { + value == 1 + ? item.controls.others_loan_type.setValidators([Validators.required]) + : item.controls.others_loan_type.clearValidators(); + item.controls.others_loan_type.updateValueAndValidity(); + } + if (flag == 2) { + // value==1 + // ? item.controls.others_lender.setValidators([Validators.required]) + // : item.controls.others_lender.clearValidators(); + // item.controls.others_lender.updateValueAndValidity(); + } + if (flag == 3) { + value == 0 + ? item.controls.others_loan_taken.setValidators([Validators.required]) + : item.controls.others_loan_taken.clearValidators(); + item.controls.others_loan_taken.updateValueAndValidity(); + } + if (flag == 4) { + value == 1 + ? item.controls.other_frequency.setValidators([Validators.required]) + : item.controls.other_frequency.clearValidators(); + item.controls.other_frequency.updateValueAndValidity(); + } + + } } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html index a9fb6d8ea..13af86138 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html @@ -1,310 +1,370 @@
-

-
- {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
- {{pageTitle}} -
-
- -
-

- - - - - -
-
- - - - - - Select - {{ cl.company_name }} - - -
- -
-
- - - - - - -
-
- - - Select - Yes - No - - -
- - - - Select - - {{person.applicant_name | titlecase}} - +

+
+ {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
+ {{pageTitle}} +
+
+ +
+

+ + + + + +
+
+ + + + + + Select + {{ + cl.company_name }} + +
+ +
+
+ + - - - + + Select + + {{person.applicant_name | titlecase}} + + + + + + - -
- - - Select - Yes - No - -
- - - {{"₹"}} {{employmentForm.controls['confirm_salary_amount'].value | numberToWords}} Only - - - - - Higher - - - - - - -
- - - Select - Yes - No - +
+ + + Select + Yes + No + + +
+ + + {{"₹"}} + {{employmentForm.controls['confirm_salary_amount'].value | numberToWords}} + Only - - - Select - Yes - No - - - - -

Salary Details

- - -

-
- - - - - - - - - - - - + + + + +
+ + + Select + Yes + No + + + + + Select + Yes + No + + + + +

Salary Details

+ + +

+
+ + + + + + + + + + + + + - - - - + + + + - - - Select - Validated - Not Validated - - - - - - - - - - - - - - Select - {{ fd.name }} - - + + + Select + Validated + Not Validated + + + + + + + + + + + + + + Select + {{ + fd.name }} + + - - - Select + + + Select Fixed - Variable depending on performance + Variable + depending on performance Others - - + + - - - - Select - Yes - No - - - +
-
- -
+
+
+ +
+
+ + + + +
+ - - - - - - - - - - -
- - Remarks - - -
-
- - - - -
-
+
+
+
+ + + +
+ + Remarks + + +
+
+ + + + +
+
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts index 268ffdcfe..f410d58eb 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts @@ -21,7 +21,7 @@ import { } from '@angular/material'; /** Service */ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; -import {ActivatedRoute, Router} from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; @Component({ selector: 'app-employment-info', @@ -34,71 +34,71 @@ export class EmploymentInfoComponent implements OnInit { lender_applicant_id: any; main_applicant: any; - pageTitle: string ="Employement Information"; - pdid: number; - form_id: number; - //pd_all_details:any; + pageTitle: string = "Employement Information"; + pdid: number; + form_id: number; + //pd_all_details:any; public employmentForm: FormGroup; private notifier: NotifierService; - public pd_cus_segment:string; - public frequency_data:any[]; - public company_list:any[]; - public person_met_list:any[]; - public company_related_applicants_list:any[]; - public company_relationship_list:any[]; - public filtered_company_relationship_list:any[]; + public pd_cus_segment: string; + public frequency_data: any[]; + public company_list: any[]; + public person_met_list: any[]; + public company_related_applicants_list: any[]; + public company_relationship_list: any[]; + public filtered_company_relationship_list: any[]; constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, - private router: Router, - private _pd: PdTrigerService, - private dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { - this.pdid = this.pd_all_details.pdmaster_details.pd_id; - this.form_id = 12; - this.notifier = notifier; - this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; - this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; - this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; - this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; - - } - public viewerOptions: any = { - navbar: false, - toolbar: { - zoomIn: 4, - zoomOut: 4, - oneToOne: 4, - reset: 4, - prev: 4, - play: { - show: 4, - size: 'large', - }, - next: 4, - rotateLeft: 4, - rotateRight: 4, - flipHorizontal: 4, - flipVertical: 4, - } -}; + private router: Router, + private _pd: PdTrigerService, + private dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { + this.pdid = this.pd_all_details.pdmaster_details.pd_id; + this.form_id = 12; + this.notifier = notifier; + this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; + this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; + this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; + this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + + } + public viewerOptions: any = { + navbar: false, + toolbar: { + zoomIn: 4, + zoomOut: 4, + oneToOne: 4, + reset: 4, + prev: 4, + play: { + show: 4, + size: 'large', + }, + next: 4, + rotateLeft: 4, + rotateRight: 4, + flipHorizontal: 4, + flipVertical: 4, + } + }; ngOnInit() { - console.log('clear'); + console.clear(); - this.pd_cus_segment=this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase(); + this.pd_cus_segment = this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase(); this.initemploymentForm(); let params: any = {}; params.pd_id = this.pdid; params.pd_form_id = this.form_id; - console.log('abcd'); + let param: any = {}; param.pd_id = this.pdid; param.pd_form_id = '18'; this._pd.retriveForm(param).subscribe(data => { - if(data.dataStatus) { - console.log(data.records); - this.company_list = data.records.companies.filter(com=>com.is_active == true ); - this.person_met_list = data.records.individuals.filter(app=>app.is_person_met == true && app.is_active == true); + if (data.dataStatus) { + + this.company_list = data.records.companies.filter(com => com.is_active == true); + this.person_met_list = data.records.individuals.filter(app => app.is_person_met == true && app.is_active == true); this.company_related_applicants_list = data.records.company_with_relationships; } }); @@ -144,38 +144,38 @@ export class EmploymentInfoComponent implements OnInit { /** For Bonus Frequency Dropdown */ this._pd.getAllMasterDatas('FREQUENCY').subscribe( data => { - if (data.status == 200) { - this.frequency_data = data.records; - this.frequency_data = this.frequency_data.filter(freq=>freq.isactive == 1 ); - } - }); + if (data.status == 200) { + this.frequency_data = data.records; + this.frequency_data = this.frequency_data.filter(freq => freq.isactive == 1); + } + }); this._pd.getAllMasterDatas('COMPANYRELATIONSHIPS').subscribe( data => { - if (data.status == 200) { - this.company_relationship_list = data.records.filter(item => item.isactive == 1); - this.company_relationship_list = data.records.filter(item => item.name != 'Others'); - this.company_relationship_list.push({'company_relationship_id':0,'name':'Not Applicable'}); - } + if (data.status == 200) { + this.company_relationship_list = data.records.filter(item => item.isactive == 1); + this.company_relationship_list = data.records.filter(item => item.name != 'Others'); + this.company_relationship_list.push({ 'company_relationship_id': 0, 'name': 'Not Applicable' }); + } }); } - + public initemploymentForm(): void { this.employmentForm = this.fb.group({ employer_name: ['', Validators.compose([Validators.required])], how_long_year: ['', Validators.compose([Validators.required])], how_long_month: [''], - was_met: [this.pd_cus_segment=='SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], + was_met: [this.pd_cus_segment == 'SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], name_person_met: [''], designation_person_met: [''], - confirm_salary: [this.pd_cus_segment=='SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], + confirm_salary: [this.pd_cus_segment == 'SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], confirm_salary_amount: [''], - total_business_experience:[''], - total_business_previous_experience:[''], - attendance_seen: [this.pd_cus_segment=='SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], - sal_reg_seen: [this.pd_cus_segment=='SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], - from_date_the_salary_is_rcv:[''], - to_date_the_salary_is_rcv:[''], + total_business_experience: [''], + total_business_previous_experience: [''], + attendance_seen: [this.pd_cus_segment == 'SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], + sal_reg_seen: [this.pd_cus_segment == 'SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], + from_date_the_salary_is_rcv: [''], + to_date_the_salary_is_rcv: [''], gross_monthly_salary: ['', Validators.compose([Validators.required])], net_monthly_salary: ['', Validators.compose([Validators.required])], bonus_incentive: ['', Validators.compose([Validators.required])], @@ -192,28 +192,28 @@ export class EmploymentInfoComponent implements OnInit { }); } - filtercompanyrelationship(companyid,applicantid){ + filtercompanyrelationship(companyid, applicantid) { var array = companyid.split("-"); - let data = this.company_related_applicants_list.filter(cmpy=>cmpy.relation_to_company == array[0] && cmpy.applicant_name == applicantid); - if(data.length>0){ - this.filtered_company_relationship_list = this.company_relationship_list.filter(freq=>freq.company_relationship_id == data[0].company_relationship ); - this.employmentForm.controls['designation_person_met'].setValue(this.filtered_company_relationship_list[0]['name'] +' '+array[1]); + let data = this.company_related_applicants_list.filter(cmpy => cmpy.relation_to_company == array[0] && cmpy.applicant_name == applicantid); + if (data.length > 0) { + this.filtered_company_relationship_list = this.company_relationship_list.filter(freq => freq.company_relationship_id == data[0].company_relationship); + this.employmentForm.controls['designation_person_met'].setValue(this.filtered_company_relationship_list[0]['name'] + ' ' + array[1]); } - else{ + else { this.employmentForm.controls['designation_person_met'].setValue(''); } } - ConvertMonthintoYear(e){ - + ConvertMonthintoYear(e) { + let how_long_year = this.employmentForm.controls.how_long_year.value; - let converted_month : number = e%12; - let converted_year : number = e/12; + let converted_month: number = e % 12; + let converted_year: number = e / 12; this.employmentForm.controls.how_long_year.setValue(+how_long_year + +Math.floor(converted_year)); this.employmentForm.controls.how_long_month.setValue(Math.floor(converted_month)); - + } submitDetails() { @@ -255,19 +255,19 @@ export class EmploymentInfoComponent implements OnInit { records.bonus_type_other = this.employmentForm.controls['bonus_type_other'].value; records.any_delays = this.employmentForm.controls['any_delays'].value; records.employment_remarks = this.employmentForm.controls['employment_remarks'].value; - + this._pd.saveForm(records).subscribe(data => { - + // this.notifier.notify('success', 'Saved Successfully.'); - if(data.status == 200) { + if (data.status == 200) { this.notifier.notify('success', 'Saved Successfully.'); // this.dialogRef.close(); - setTimeout(() =>{ + setTimeout(() => { this.dialogRef.close(); - },3000); + }, 3000); } - else{ - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + else { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); } }, error => { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); @@ -276,11 +276,11 @@ export class EmploymentInfoComponent implements OnInit { /** On Key Press Event For Numbers */ keyPress(event: any) { const pattern = /[0-9]/; - + let inputChar = String.fromCharCode(event.charCode); if (event.keyCode != 8 && !pattern.test(inputChar)) { - event.preventDefault(); + event.preventDefault(); } - } + } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html index af3ae4b74..775a11f2c 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html @@ -1,28 +1,32 @@

{{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
- {{pageTitle}} + {{pageTitle}}
- +

- +
- - + +
- - Select + + Select {{person.applicant_name}} @@ -30,39 +34,43 @@
-
+
Residence Details of {{FamilyMemberAsLabel[ix]}}
- - Select + + Select {{s.name}} - - Select - + + Select + {{c.city_name}} - + - - Select - - {{p.pincode}} - - + + Select + + {{p.pincode}} + + - + - + - - - - Select + + + + Select {{ownerShip.name}} - + - - {{"₹"}} {{RentAmount[i]}} Only + + {{"₹"}} + {{RentAmount[i]}} Only
- +
-
@@ -197,25 +232,27 @@
+ matTooltip="Add More" matTooltipPosition="left" color="primary"> + + Add Family Members Of {{FamilyMemberAsLabel[ix]}} + + Add More Family Members Of + {{FamilyMemberAsLabel[ix]}} + +
- - - + + +
@@ -275,55 +312,91 @@
-
+
- picture_as_pdf version_111 + picture_as_pdf + version_111 +
-
+
- picture_as_pdf version_111 + picture_as_pdf + version_111 +
-
+
- picture_as_pdf version_111 + picture_as_pdf + version_111 +
-
+
- picture_as_pdf version_111 + picture_as_pdf + version_111 +
-
+
- picture_as_pdf version_111 + picture_as_pdf + version_111 +
-
+
- picture_as_pdf version_111 + picture_as_pdf + version_111 +
-
+
- picture_as_pdf version_111 + picture_as_pdf + version_111 +
-
+
- picture_as_pdf version_111 + picture_as_pdf + version_111 +
-
+
- picture_as_pdf version_111 + picture_as_pdf + version_111 +
-
+
- picture_as_pdf version_111 + picture_as_pdf + version_111 +
-
+
- picture_as_pdf version_111 + picture_as_pdf + version_111 +
-
+
- picture_as_pdf version_111 + picture_as_pdf + version_111 +
@@ -346,15 +419,18 @@
- +
-    - +    +
- + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts index 19f6a1319..fa0c9aae3 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts @@ -1,6 +1,6 @@ -import { Component,OnInit,Inject,Input, Output } from '@angular/core'; +import { Component, OnInit, Inject, Input, Output } from '@angular/core'; -import { FormBuilder,FormGroup,Validators,FormArray, FormControl, AbstractControl } from '@angular/forms'; +import { FormBuilder, FormGroup, Validators, FormArray, FormControl, AbstractControl } from '@angular/forms'; import { NotifierService } from 'angular-notifier'; @@ -27,19 +27,19 @@ export class FamilyDetailsComponent implements OnInit { main_applicant: any; pageTitle: string = "Family Details"; - + /** Variable Declaration */ private notifier: NotifierService; public familyForm: FormGroup; public selectPerson; - public apiFamilyMembers : any = []; + public apiFamilyMembers: any = []; pdid: string; form_id: number; count: number; IncomePerMonth: any = []; RentAmount: any = []; FamilyMemberAsLabel: any = []; - + //@Input() pdid: number; @@ -47,30 +47,30 @@ export class FamilyDetailsComponent implements OnInit { relationData: any = []; occupationData: any = []; ownerShipData: any = []; - earningData:any =[]; + earningData: any = []; stateData: any = []; - cityData: any =[]; - pincodeData:any=[]; - earningStatus = [{ id: 1,type: 'Earning' }, - { id: 2,type: 'Non Earning' }] - - /** constructor Of the class */ + cityData: any = []; + pincodeData: any = []; + earningStatus = [{ id: 1, type: 'Earning' }, + { id: 2, type: 'Non Earning' }] + + /** constructor Of the class */ constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, private router: Router, private _pd: PdTrigerService, private dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { - - this.form_id = 6; - this.notifier = notifier; - this.selectPerson = this.pd_all_details.pdapplicants_detials; - this.pdid = this.pd_all_details.pdmaster_details.pd_id; - this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; - this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; - this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; - this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; - - + + this.form_id = 6; + this.notifier = notifier; + this.selectPerson = this.pd_all_details.pdapplicants_detials; + this.pdid = this.pd_all_details.pdmaster_details.pd_id; + this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; + this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; + this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; + this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + + } ngOnInit() { @@ -80,48 +80,52 @@ export class FamilyDetailsComponent implements OnInit { this.getMasterDetails('EARNINGMEMBERSSTATUS', 5); this.getMasterDetails('STATE', 6); - this._pd.getFamilyDetails(this.pdid).subscribe(data=>{ + this._pd.getFamilyDetails(this.pdid).subscribe(data => { console.clear(); - - if(data.dataStatus == true){ - let Temparr : any = []; + if (data.dataStatus == true) { - if(data.record.from_general_form.length > 0){ + let Temparr: any = []; + + if (data.record.from_general_form.length > 0) { let familyMembersGeneralForm = Object.keys(data.record.from_general_form).map(function (key) { - return data.record.from_general_form[key]; + return data.record.from_general_form[key]; }); let datas = familyMembersGeneralForm.map(element => { - return {id:element.pd_co_applicant_id.toString(), - name:element.applicant_name, - relationship:element.relationship, - relation_to:element.relation_to, - age:element.age, - data_gets_from:'GeneralForm'}; + return { + id: element.pd_co_applicant_id.toString(), + name: element.applicant_name, + relationship: element.relationship, + relation_to: element.relation_to, + age: element.age, + data_gets_from: 'GeneralForm' + }; }); Temparr.push(datas); - - } - if(data.record.from_business_form.length > 0){ + } + + if (data.record.from_business_form.length > 0) { let familyMembersBusinessForm = Object.keys(data.record.from_business_form).map(function (key) { - return data.record.from_business_form[key]; + return data.record.from_business_form[key]; }); let datas = familyMembersBusinessForm.map(element => { - return {id:element.other_family_relationship_id.toString(), - name:element.family_member_name, - relationship:element.other_family_relationship_id, - relation_to:element.relation_to_id, - age:'', - data_gets_from:'BusinessForm'}; + return { + id: element.other_family_relationship_id.toString(), + name: element.family_member_name, + relationship: element.other_family_relationship_id, + relation_to: element.relation_to_id, + age: '', + data_gets_from: 'BusinessForm' + }; }); - + Temparr.push(datas); - } - this.apiFamilyMembers = [].concat.apply([],Temparr); - + } + this.apiFamilyMembers = [].concat.apply([], Temparr); + } }) @@ -164,7 +168,7 @@ export class FamilyDetailsComponent implements OnInit { earning_gross_income_per_month: [val.earning_gross_income_per_month, Validators.compose([])], earning_name_of_the_employer_or_business: [val.earning_name_of_the_employer_or_business, Validators.compose([])], earning_number_of_years_in_employment_or_business: [val.earning_number_of_years_in_employment_or_business, Validators.compose([])], - earning_if_others_segment:[val.earning_if_others_segment], + earning_if_others_segment: [val.earning_if_others_segment], non_earning_occupation: [val.non_earning_occupation, Validators.compose([])], non_earning_if_others: [val.non_earning_if_others, Validators.compose([])], non_earning_if_retired_from: [val.non_earning_if_retired_from, Validators.compose([])], @@ -187,7 +191,7 @@ export class FamilyDetailsComponent implements OnInit { onSearchChange(e): void { e.preventDefault(); } - + public initFamilyFormDetails(): void { this.familyForm = this.fb.group({ family_details: this.fb.array([]), @@ -275,7 +279,7 @@ export class FamilyDetailsComponent implements OnInit { residence_city: ['', Validators.compose([])], residence_state: ['', Validators.compose([])], residence_pin: ['', Validators.compose([])], - residence_other_pincode:[''], + residence_other_pincode: [''], residence_No_of_years: ['', Validators.compose([])], residence_ownership: ['', Validators.compose([])], ownershipOther: [''], @@ -286,22 +290,22 @@ export class FamilyDetailsComponent implements OnInit { const control = this.familyForm.controls['family_details']; control.push(formData); } else { - records.forEach((val,index) => { - - if(val.rent != null){ - - this.RentAmount[index] = this._pd.convertNumberToWords(val.rent); + records.forEach((val, index) => { + + if (val.rent != null) { + + this.RentAmount[index] = this._pd.convertNumberToWords(val.rent); } this.FamilyMemberAsLabel[index] = this.selectPerson.filter(item => item.pd_co_applicant_id == val.selected_person)[0].applicant_name; - //for (let val of records) - this.getCity(val.residence_state,index); + //for (let val of records) + this.getCity(val.residence_state, index); let formData: FormGroup = this.fb.group({ selected_person: [val.selected_person, Validators.compose([Validators.required])], residence_place: [val.residence_place, Validators.compose([])], residence_city: [val.residence_city, Validators.compose([])], residence_state: [val.residence_state, Validators.compose([])], residence_pin: [val.residence_pin, Validators.compose([])], - residence_other_pincode:[val.residence_other_pincode], + residence_other_pincode: [val.residence_other_pincode], residence_No_of_years: [val.residence_No_of_years, Validators.compose([])], residence_ownership: [val.residence_ownership, Validators.compose([])], ownershipOther: [val.ownershipOther || null], @@ -313,8 +317,8 @@ export class FamilyDetailsComponent implements OnInit { control.push(formData); let inx = control.length - 1; this.addFamilyMemberDetailsWithData(inx, val.family_members_details); - - }); + + }); } this.noRecordsFound = true; @@ -322,9 +326,9 @@ export class FamilyDetailsComponent implements OnInit { addFamilyMemberDetailsWithData(inx, val): void { const control = this.familyForm.controls['family_details']['controls'][inx].controls.family_members_details; - val.forEach((vals,index) => { - // for (let vals of val) { - if(vals.earning_gross_income_per_month != null){ + val.forEach((vals, index) => { + // for (let vals of val) { + if (vals.earning_gross_income_per_month != null) { this.IncomePerMonth[index] = this._pd.convertNumberToWords(vals.earning_gross_income_per_month); } let datas = this.fb.group({ @@ -336,7 +340,7 @@ export class FamilyDetailsComponent implements OnInit { earning_gross_income_per_month: [vals.earning_gross_income_per_month || null, Validators.compose([])], earning_name_of_the_employer_or_business: [vals.earning_name_of_the_employer_or_business || null, Validators.compose([])], earning_number_of_years_in_employment_or_business: [vals.earning_number_of_years_in_employment_or_business || null, Validators.compose([])], - earning_if_others_segment:[vals.earning_if_others_segment || null], + earning_if_others_segment: [vals.earning_if_others_segment || null], non_earning_occupation: [vals.non_earning_occupation || null, Validators.compose([])], non_earning_if_others: [vals.non_earning_if_others || null, Validators.compose([])], non_earning_if_retired_from: [vals.non_earning_if_retired_from || null, Validators.compose([])], @@ -355,42 +359,38 @@ export class FamilyDetailsComponent implements OnInit { this.initFamilyForm(null); } - removeOtherFamilyMembers(i): void { + removeOtherFamilyMembers(i): void { let control = this.familyForm.get('family_details') as FormArray; control.removeAt(i); } prevFamilyMembersCtrlLength: number = 0; currFamilyMembersCtrlLength: number = 0; - - selectedPerson(e,inx){ - console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength); + + selectedPerson(e, inx) { + this.FamilyMemberAsLabel[inx] = this.selectPerson.filter(item => item.pd_co_applicant_id == e)[0].applicant_name; - + const control = this.familyForm.controls['family_details']['controls'][inx].controls.family_members_details; - // console.log('current control length',control.length); + this.currFamilyMembersCtrlLength = control.length; - - let i : number = 0 ; - for(i ;i < this.prevFamilyMembersCtrlLength;i++){ - console.log(i,this.prevFamilyMembersCtrlLength); + + let i: number = 0; + for (i; i < this.prevFamilyMembersCtrlLength; i++) { control.removeAt(i); } - // while(index < this.prevFamilyMembersCtrlLength) - // { - // } + // while(index < this.prevFamilyMembersCtrlLength){} this.prevFamilyMembersCtrlLength = this.currFamilyMembersCtrlLength; - console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength); - if(this.apiFamilyMembers.length>0){ - let arraydata : any; + if (this.apiFamilyMembers.length > 0) { + + let arraydata: any; let data = this.apiFamilyMembers.filter(item => item.relation_to == e); - - if(data.length > 0){ + + if (data.length > 0) { this.prevFamilyMembersCtrlLength = data.length; - console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength); - data.forEach((val,inx) => { + data.forEach((val, inx) => { // if(val.age){ // // this.isReadOnly[inx] = true; @@ -398,47 +398,45 @@ export class FamilyDetailsComponent implements OnInit { // // this.isReadOnly[inx] = false; // } arraydata = { - 'family_member_name' : val.name, - 'family_member_relationship' : val.relationship, - 'family_member_age' : val.age, - 'family_member_earning_status': val.data_gets_from == 'BusinessForm' ? '1' :'', - 'earning_segment': '', - 'earning_gross_income_per_month': '', - 'earning_name_of_the_employer_or_business':'', - 'earning_number_of_years_in_employment_or_business': '', - 'earning_if_others_segment':'', - 'non_earning_occupation': '', - 'non_earning_if_others': '', - 'non_earning_if_retired_from': '', - 'non_earning_if_schoolorcollege': '' - } - control.push(this.initgenerateFamilyMembersDetailsGet(arraydata)); + 'family_member_name': val.name, + 'family_member_relationship': val.relationship, + 'family_member_age': val.age, + 'family_member_earning_status': val.data_gets_from == 'BusinessForm' ? '1' : '', + 'earning_segment': '', + 'earning_gross_income_per_month': '', + 'earning_name_of_the_employer_or_business': '', + 'earning_number_of_years_in_employment_or_business': '', + 'earning_if_others_segment': '', + 'non_earning_occupation': '', + 'non_earning_if_others': '', + 'non_earning_if_retired_from': '', + 'non_earning_if_schoolorcollege': '' + } + control.push(this.initgenerateFamilyMembersDetailsGet(arraydata)); }); } - else{ + else { this.prevFamilyMembersCtrlLength = 1; - console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength); - control.push(this.generateFamilyMembersDetailsGet()); + control.push(this.generateFamilyMembersDetailsGet()); } } - else{ + else { this.prevFamilyMembersCtrlLength = 1; - console.log('familyMembersControlLength',this. prevFamilyMembersCtrlLength,this.currFamilyMembersCtrlLength); control.push(this.generateFamilyMembersDetailsGet()); - } -} + } + } -addFamilyMembers(inx) { - let mainControl = this.familyForm.get('family_details') as FormArray; - let control = mainControl.controls[inx].get('family_members_details') as FormArray; + addFamilyMembers(inx) { + let mainControl = this.familyForm.get('family_details') as FormArray; + let control = mainControl.controls[inx].get('family_members_details') as FormArray; control.push(this.generateFamilyMembersDetailsGet()); -} + } -removeFamilyMembers(inx,i) { - let mainControl = this.familyForm.get('family_details') as FormArray; - let control = mainControl.controls[inx].get('family_members_details') as FormArray; - control.removeAt(i); -} + removeFamilyMembers(inx, i) { + let mainControl = this.familyForm.get('family_details') as FormArray; + let control = mainControl.controls[inx].get('family_members_details') as FormArray; + control.removeAt(i); + } // getNumberOfFamilyMemberDetails(inx) { @@ -476,7 +474,7 @@ removeFamilyMembers(inx,i) { earning_gross_income_per_month: ['', Validators.compose([])], earning_name_of_the_employer_or_business: ['', Validators.compose([])], earning_number_of_years_in_employment_or_business: ['', Validators.compose([])], - earning_if_others_segment:[''], + earning_if_others_segment: [''], non_earning_occupation: ['', Validators.compose([])], non_earning_if_others: ['', Validators.compose([])], non_earning_if_retired_from: ['', Validators.compose([])], @@ -508,15 +506,15 @@ removeFamilyMembers(inx,i) { }); } - getCity(e,i){ - this._pd.getStateWiseCities(e).subscribe(data=>{ - if (data.status == 200) { - - this.cityData[i] = data.records.cities; - this.pincodeData[i] = data.records.pincode; - - } - }); + getCity(e, i) { + this._pd.getStateWiseCities(e).subscribe(data => { + if (data.status == 200) { + + this.cityData[i] = data.records.cities; + this.pincodeData[i] = data.records.pincode; + + } + }); } submitFamily() { @@ -527,20 +525,20 @@ removeFamilyMembers(inx,i) { var records = this.familyForm.value; //To Remove The "Null" With Key also Object.keys(records).forEach((key) => (records[key] == null) && delete records[key]); - + records.pdid = this.pdid; records.formid = '6'; - + this._pd.saveForm(records).subscribe(data => { - - if(data.status == 200) { + + if (data.status == 200) { this.notifier.notify('success', 'Saved Successfully.'); - setTimeout(() =>{ + setTimeout(() => { this.dialogRef.close(); - },3000); + }, 3000); } else { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); } }, error => { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); @@ -558,19 +556,19 @@ removeFamilyMembers(inx,i) { // }); // } - /** To Convert Amount into Words */ - inWords(e,flag:number,i){ - switch(flag){ - case 1 : - this.RentAmount[i] = this._pd.convertNumberToWords(e.target.value); + /** To Convert Amount into Words */ + inWords(e, flag: number, i) { + switch (flag) { + case 1: + this.RentAmount[i] = this._pd.convertNumberToWords(e.target.value); break; - case 2 : - this.IncomePerMonth[i] = this._pd.convertNumberToWords(e.target.value); + case 2: + this.IncomePerMonth[i] = this._pd.convertNumberToWords(e.target.value); break; - + default: break; - } } + } } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html index 60a138bba..b94e775d8 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html @@ -1,11 +1,13 @@

- {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
- {{pageTitle}} -
+ {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
+ {{pageTitle}} +

- +
@@ -13,118 +15,105 @@ - - Select - {{ pm.description }} - + + Select + {{ + pm.description }} + - - + + Location - - - Select - Well Suited. - Fairly Suited - Not Suited - - + + + Select + Well Suited. + Fairly Suited + Not Suited + +
- - Select - {{ list.pdofficer_recommendation }} - + + Select + {{ + list.pdofficer_recommendation }} + + + + - - - - -
-
- - - - - +
-
- - -
-
- - - - - - - - + + +
+
+ + + + + +
-
- - + +
- - - - - - - - - - - - + + + + +
-
+ - Number of Years for which rental income is being received - - - Please Enter Correct Year - - - - + Number of Years for which rental income is being received + + + Please Enter Correct Year + + + + @@ -133,14 +134,15 @@ - +

Number of Years For Which The Business Has Been Running

- + Please Enter Correct Year @@ -183,8 +185,7 @@ Relationship Between Individuals - + Name 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 index cd1978452..91378b9e5 100755 --- 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 @@ -20,12 +20,12 @@ export class GeneralInfoComponent implements OnInit { /* Declaration for Header Variables */ pageTitle: string = "General Information"; - + subproduct_abbr: any; customer_segment_abbr: any; lender_applicant_id: any; main_applicant: any; - + /* Declaration for Common Variables */ pipe = new DatePipe('en-US'); @@ -35,12 +35,12 @@ export class GeneralInfoComponent implements OnInit { errorMessage: any; maxDate: any; - disableAfterSubmit : boolean; - + disableAfterSubmit: boolean; + public pd_applicants_details: any; public _generalForm: FormGroup; private notifier: NotifierService; - + /* Declaration for DataTables */ displayedColumns = ['applicant_name', 'is_person_met', 'is_applicant', 'age', 'qualification', 'course_name', 'actions']; @@ -50,7 +50,7 @@ export class GeneralInfoComponent implements OnInit { public individualsSource = new MatTableDataSource(); public relationSource = new MatTableDataSource(); public CompanySource = new MatTableDataSource(); - + /* Declaration for Dropdowns */ relationShipList: any = []; companyRelationShipList: any = []; @@ -61,7 +61,7 @@ export class GeneralInfoComponent implements OnInit { businessEntityTypeList: any = []; /********************** Declaration Section Ends Here *****************/ - + /** Constructor Section */ constructor(notifier: NotifierService, private _fb: FormBuilder, private _pd: PdTrigerService, private dialog: MatDialog, @Inject(MAT_DIALOG_DATA) public pd_all_details: any, private dialogRef: MatDialogRef) { this.pdid = this.pd_all_details.pdmaster_details.pd_id; @@ -183,16 +183,16 @@ export class GeneralInfoComponent implements OnInit { 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 : ''); // create individuals exist_individuals = Object.keys(data.records.individuals).map(function (key) { return data.records.individuals[key]; }); - + if (exist_individuals.length > 0) { exist_individuals.forEach(element => { individualsControl.push(this.createIndividulas(element)) @@ -215,47 +215,47 @@ export class GeneralInfoComponent implements OnInit { return data.records.company_with_relationships[key]; }); - if(this.customer_segment_abbr != 'SE-RI'){ - - if (exist_companyWithRelationships.length > 0) { - exist_companyWithRelationships.forEach(element => { - //individualsControl.push(this.createIndividulas(element)) - companyWithRelationshipsControl.push(this.createCompaniesRelationshipWithData(element)); - }); - } - else if(exist_companyWithRelationships.length == 0) { - companyWithRelationshipsControl.push(this.createCompaniesRelationship()); + if (this.customer_segment_abbr != 'SE-RI') { + + if (exist_companyWithRelationships.length > 0) { + exist_companyWithRelationships.forEach(element => { + //individualsControl.push(this.createIndividulas(element)) + companyWithRelationshipsControl.push(this.createCompaniesRelationshipWithData(element)); + }); + } + else if (exist_companyWithRelationships.length == 0) { + companyWithRelationshipsControl.push(this.createCompaniesRelationship()); + } + + // create companies + exist_companies = Object.keys(data.records.companies).map(function (key) { + return data.records.companies[key]; + }); + if (exist_companies.length > 0) { + exist_companies.forEach((element, cindex) => { + companyControl.push(this.createCompanies(element)); + let otherControl: any = this._generalForm.get('companies') as FormArray; + otherControl = otherControl.controls[cindex]; + element.business_entity_type == '1' ? otherControl.addControl('business_entity_type_other', new FormControl(element.business_entity_type_other, Validators.required)) : otherControl.removeControl('business_entity_type_other'); + if (element.is_active == false) { + let control: any = this._generalForm.get('companies') as FormArray; + control.controls[cindex].controls.company_name.clearValidators(); + control.controls[cindex].controls.company_name.updateValueAndValidity(); + control.controls[cindex].controls.business_years.clearValidators(); + control.controls[cindex].controls.business_years.updateValueAndValidity(); + control.controls[cindex].controls.business_entity_type.clearValidators(); + control.controls[cindex].controls.business_entity_type.updateValueAndValidity(); + element.business_entity_type == '1' ? control.controls[cindex].controls.business_entity_type_other.clearValidators() : ''; + element.business_entity_type == '1' ? control.controls[cindex].controls.business_entity_type_other.updateValueAndValidity() : ''; } - // create companies - exist_companies = Object.keys(data.records.companies).map(function (key) { - return data.records.companies[key]; - }); - if (exist_companies.length > 0) { - exist_companies.forEach((element, cindex) => { - companyControl.push(this.createCompanies(element)); - let otherControl: any = this._generalForm.get('companies') as FormArray; - otherControl = otherControl.controls[cindex]; - element.business_entity_type == '1' ? otherControl.addControl('business_entity_type_other', new FormControl(element.business_entity_type_other, Validators.required)) : otherControl.removeControl('business_entity_type_other'); - if (element.is_active == false) { - let control: any = this._generalForm.get('companies') as FormArray; - control.controls[cindex].controls.company_name.clearValidators(); - control.controls[cindex].controls.company_name.updateValueAndValidity(); - control.controls[cindex].controls.business_years.clearValidators(); - control.controls[cindex].controls.business_years.updateValueAndValidity(); - control.controls[cindex].controls.business_entity_type.clearValidators(); - control.controls[cindex].controls.business_entity_type.updateValueAndValidity(); - element.business_entity_type == '1' ? control.controls[cindex].controls.business_entity_type_other.clearValidators() : ''; - element.business_entity_type == '1' ? control.controls[cindex].controls.business_entity_type_other.updateValueAndValidity() : ''; - } - - }); - } + }); + } this._generalForm.controls['rental_income_rcv_in_years'].setValue(null); this._generalForm.controls['rental_income_rcv_in_month'].setValue(null); } - else if(this.customer_segment_abbr == 'SE-RI'){ + else if (this.customer_segment_abbr == 'SE-RI') { // companyWithRelationshipsControl.push(this.createCompaniesRelationship()); // companyControl.push(this.createCompanies('')); @@ -282,9 +282,9 @@ export class GeneralInfoComponent implements OnInit { } else { - + this.pd_applicants_details.forEach((element, key) => { - + element.is_applicant = true; element.is_person_met = false; element.is_new = false; @@ -292,11 +292,11 @@ export class GeneralInfoComponent implements OnInit { element.is_active = true; element.individuals_order_id = key + 1; element.age = '', - element.qualification = '', - element.course_name = '', + element.qualification = '', + element.course_name = '', individualsControl.push(this.createIndividulas(element)); - personsWithRelationshipsControl.push(this.createPersonsWithRelationships(element)); - + 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)); @@ -326,7 +326,7 @@ export class GeneralInfoComponent implements OnInit { // create individuals createIndividulas(elementValue: any) { - + return this._fb.group({ pd_co_applicant_id: [elementValue.pd_co_applicant_id], applicant_title_name: [elementValue.applicant_title_name], @@ -350,7 +350,7 @@ export class GeneralInfoComponent implements OnInit { relationship: [elementValue.relationship], relation_to: [elementValue.relation_to], individuals_order_id: [elementValue.individuals_order_id], - is_active:[elementValue.is_active] + is_active: [elementValue.is_active] }); } @@ -510,7 +510,7 @@ export class GeneralInfoComponent implements OnInit { .subscribe(dataresult => { if (dataresult.data.length > 0) { dataresult.data.forEach((element, index) => { - + let individualsControl = this._generalForm.controls['individuals']; element.pd_co_applicant_id = this.count; this.count = this.count + 1; @@ -520,7 +520,7 @@ export class GeneralInfoComponent implements OnInit { element.is_main_applicant = false; individualsControl.push(this.createIndividulas(element)); let relationControl = this._generalForm.controls['persons_with_relationships']; - let applicant_details: any = { 'pd_co_applicant_id': element.pd_co_applicant_id, 'applicant_name': element.applicant_name, 'relationship': '', 'relation_to': '', 'individuals_order_id': element.individuals_order_id,'is_active': element.is_active }; + let applicant_details: any = { 'pd_co_applicant_id': element.pd_co_applicant_id, 'applicant_name': element.applicant_name, 'relationship': '', 'relation_to': '', 'individuals_order_id': element.individuals_order_id, 'is_active': element.is_active }; relationControl.push(this.createPersonsWithRelationships(applicant_details)); }); @@ -530,15 +530,15 @@ export class GeneralInfoComponent implements OnInit { } - ApplicantName(event,coApplicantId){ - + ApplicantName(event, coApplicantId) { + let relationControl = this._generalForm.controls['persons_with_relationships']; let index1 = relationControl.value.map(data => data.pd_co_applicant_id).indexOf(coApplicantId); - + // details.value.applicant_name let control = relationControl.controls[index1] as FormArray; - + control.controls['applicant_name'].setValue(event.target.value); // event.target.value @@ -546,7 +546,7 @@ export class GeneralInfoComponent implements OnInit { // let personsWithRelationshipsControl : any = control.controls[index1]; // personsWithRelationshipsControl.controls.is_applicant.setValue(false); // control.markAsDirty({onlySelf:true}); - + // controls.removeAt(index1); // let index1 = controls.value.map(data => data.applicant_name).indexOf(name); } @@ -562,27 +562,27 @@ export class GeneralInfoComponent implements OnInit { removeIndividuals(findex, details) { let control = this._generalForm.controls['individuals']; - let individualsControl: any = control.controls[findex]; + let individualsControl: any = control.controls[findex]; individualsControl.controls.is_active.setValue(false); // individualsControl.disable(); // individualsControl.controls.is_applicant.setValue(false); - + // .controls.is_active.setValue(false); - + // control.markAsDirty({onlySelf:true}); - + control.removeAt(findex); let controls = this._generalForm.controls['persons_with_relationships']; - + let name = details.value.applicant_name; let index1 = controls.value.map(data => data.applicant_name).indexOf(name); // controls.controls[index1].disable(); // let personsWithRelationshipsControl : any = control.controls[index1]; // personsWithRelationshipsControl.controls.is_applicant.setValue(false); // control.markAsDirty({onlySelf:true}); - + controls.removeAt(index1); } @@ -601,36 +601,30 @@ export class GeneralInfoComponent implements OnInit { } // submit form details - temp : number = 0; + temp: number = 0; submitGeneralForm(formData: any) { - if(this.customer_segment_abbr != 'SE-RI'){ + if (this.customer_segment_abbr != 'SE-RI') { this._generalForm.controls['rental_income_rcv_in_years'].clearValidators(); this._generalForm.controls['rental_income_rcv_in_years'].updateValueAndValidity(); } - // 0th index of companies formArray only - required removed - // greater than zero means not applicable here - if(this.customer_segment_abbr == 'SE-RI'){ - let otherControl: any = this._generalForm.get('companies') as FormArray; - if(otherControl.controls.length > 0){ - otherControl = otherControl.controls[0]; - // otherControl.controls.business_entity_type_other.clearValidators(); - // otherControl.controls.business_entity_type_other.updateValueAndValidity(); + // 0th index of companies formArray only - required removed + // greater than zero means not applicable here + if (this.customer_segment_abbr == 'SE-RI') { + let otherControl: any = this._generalForm.get('companies') as FormArray; + if (otherControl.controls.length > 0) { + otherControl = otherControl.controls[0]; + // otherControl.controls.business_entity_type_other.clearValidators(); + // otherControl.controls.business_entity_type_other.updateValueAndValidity(); - otherControl.controls.business_years.clearValidators(); - otherControl.controls.business_years.updateValueAndValidity(); + otherControl.controls.business_years.clearValidators(); + otherControl.controls.business_years.updateValueAndValidity(); - otherControl.controls.business_entity_type.clearValidators(); - otherControl.controls.business_entity_type.updateValueAndValidity(); - - } - } - // console.log(formData.individuals.length); - // console.log(formData.individuals); + otherControl.controls.business_entity_type.clearValidators(); + otherControl.controls.business_entity_type.updateValueAndValidity(); - - - + } + } if (this._generalForm.invalid) { this.disableAfterSubmit = false; this.validateAllFormFields(this._generalForm); @@ -638,23 +632,23 @@ export class GeneralInfoComponent implements OnInit { return; } else { - if(formData.individuals.length > 0){ - - formData.individuals.forEach((val,index) => { - - if(val.is_person_met == false){ - + if (formData.individuals.length > 0) { + + formData.individuals.forEach((val, index) => { + + if (val.is_person_met == false) { + this.temp++; } - + }); - - if(this.temp == formData.individuals.length){ - this.notifier.notify('warning', 'Please Choose Name of Person Met.!'); - - this.temp = 0; - - return; + + if (this.temp == formData.individuals.length) { + this.notifier.notify('warning', 'Please Choose Name of Person Met.!'); + + this.temp = 0; + + return; } } this.disableAfterSubmit = true; @@ -663,14 +657,14 @@ export class GeneralInfoComponent implements OnInit { saveRecords.formid = formData.formid; saveRecords.individuals = formData.individuals; saveRecords.persons_with_relationships = formData.persons_with_relationships; - if(this.customer_segment_abbr != 'SE-RI'){ + if (this.customer_segment_abbr != 'SE-RI') { saveRecords.companies = formData.companies; saveRecords.company_with_relationships = formData.company_with_relationships; saveRecords.rental_income_rcv_in_years = null; saveRecords.rental_income_rcv_in_month = null; //saveRecords.applicant_relation=formData.applicant_relation; } - else if(this.customer_segment_abbr == 'SE-RI'){ + else if (this.customer_segment_abbr == 'SE-RI') { saveRecords.companies = []; saveRecords.company_with_relationships = []; saveRecords.rental_income_rcv_in_years = formData.rental_income_rcv_in_years; @@ -679,9 +673,7 @@ export class GeneralInfoComponent implements OnInit { } saveRecords.general_remark = formData.general_remark; - - // console.log('saveRecords',saveRecords); - // return; + this._pd.savePDFormDetailsWithID(saveRecords).subscribe( dataresult => { if (dataresult.status == 200) { @@ -706,12 +698,12 @@ export class GeneralInfoComponent implements OnInit { /**************************** submit form details Ends Here ***********************/ // convert month to year business has been running - ConvertMonthintoYearforBusiness(e, controlIndex,flag) { + ConvertMonthintoYearforBusiness(e, controlIndex, flag) { - let converted_month: number = e % 12; - let converted_year: number = e / 12; + let converted_month: number = e % 12; + let converted_year: number = e / 12; - if(flag == 1){ + if (flag == 1) { let control: any = this._generalForm.get('companies') as FormArray; control = control.controls[controlIndex]; let business_year = control.controls.business_years.value; @@ -719,10 +711,10 @@ export class GeneralInfoComponent implements OnInit { control.controls.business_month.setValue(Math.floor(converted_month)); } - if(flag == 2){ - let ri_year = this._generalForm.controls.rental_income_rcv_in_years.value; - this._generalForm.controls['rental_income_rcv_in_years'].setValue(+ri_year + +Math.floor(converted_year)); - this._generalForm.controls['rental_income_rcv_in_month'].setValue(Math.floor(converted_month)); + if (flag == 2) { + let ri_year = this._generalForm.controls.rental_income_rcv_in_years.value; + this._generalForm.controls['rental_income_rcv_in_years'].setValue(+ri_year + +Math.floor(converted_year)); + this._generalForm.controls['rental_income_rcv_in_month'].setValue(Math.floor(converted_month)); } } @@ -754,7 +746,7 @@ export class GeneralInfoComponent implements OnInit { } - + // validate all form group and form array fields validateAllFormFields(formGroup: any) { Object.keys(formGroup.controls).forEach(field => { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.html index 2d37dca4c..0bb69ef2d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.html @@ -1,172 +1,229 @@
-

-
- {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
- {{pageTitle}} -
-
- - - - -
-

+

+
+ {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
+ {{pageTitle}} +
+
+ + + + +
+

+ + - - - - -
-
- - - - - Select - Yes - No - - -
-
-
- - - - - - -
-
-
- - - - -
-
-
-
-
-
+ + +
+
+ + + + + Select + Yes + No + + +
+
+
+ + + + + + +
+
+
- - -
-
-
-
-
-
-
Image 1
-
-
-
-
-
-
-
Image 2
-
-
-
-
-
-
-
Image 3
-
-
-
-
-
-
-
Image 2
-
-
-
-
-
-
-
Image 3
-
-
-
-
-
-
-
Image 1
-
-
-
+ + + + + +
+
+ + + + + + + +
+
+ + - + - -
- - Remarks - - -
- - -
- + +
+ + Remarks + + +
+ + +
+
- + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.ts index ec0499193..84d76c942 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.ts @@ -1,5 +1,5 @@ -import {Component,OnInit,Inject,Input } from '@angular/core'; -import {FormBuilder,FormGroup,Validators,FormArray, FormControl,} from '@angular/forms'; +import { Component, OnInit, Inject, Input } from '@angular/core'; +import { FormBuilder, FormGroup, Validators, FormArray, FormControl, } from '@angular/forms'; import { NotifierService } from 'angular-notifier'; import { MatDialog, @@ -13,9 +13,9 @@ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import { ActivatedRoute, Router } from "@angular/router"; @Component({ - selector: 'app-lender-representative', - templateUrl: './lender-representative.component.html', - styleUrls: ['./lender-representative.component.scss'] + selector: 'app-lender-representative', + templateUrl: './lender-representative.component.html', + styleUrls: ['./lender-representative.component.scss'] }) export class LenderRepresentativeComponent implements OnInit { customer_segment_abbr: any; @@ -26,161 +26,161 @@ export class LenderRepresentativeComponent implements OnInit { // applicant_name: any; // snackBar: any; public representativeForm: FormGroup; - private notifier: NotifierService; - pageTitle: string ="Lender Representative Details"; - pdid: number; - form_id: number; - disableAfterSubmit : boolean = false; - //snack bar - + private notifier: NotifierService; + pageTitle: string = "Lender Representative Details"; + pdid: number; + form_id: number; + disableAfterSubmit: boolean = false; + //snack bar - constructor(notifier: NotifierService, - private fb: FormBuilder, - private route: ActivatedRoute, - private router: Router, - // private snackBar: MatSnackBar, - private _pd: PdTrigerService, - private dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { - this.pdid = this.pd_all_details.pdmaster_details.pd_id; - this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; - this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; - this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; - this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; - - this.form_id = 15; - this.notifier = notifier; - } + + constructor(notifier: NotifierService, + private fb: FormBuilder, + private route: ActivatedRoute, + private router: Router, + // private snackBar: MatSnackBar, + private _pd: PdTrigerService, + private dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { + this.pdid = this.pd_all_details.pdmaster_details.pd_id; + this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; + this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; + this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; + this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + + this.form_id = 15; + this.notifier = notifier; + } // message ='Snack Bar Opened.'; // actionButtonLabel = 'Close'; // action = true; // setAutohide = true; // autoHide = 1000000; // addExtraClass = false; - public viewerOptions: any = { - navbar: false, - toolbar: { - zoomIn: 4, - zoomOut: 4, - oneToOne: 4, - reset: 4, - prev: 4, - play: { - show: 4, - size: 'large', - }, - next: 4, - rotateLeft: 4, - rotateRight: 4, - flipHorizontal: 4, - flipVertical: 4, - } -}; + public viewerOptions: any = { + navbar: false, + toolbar: { + zoomIn: 4, + zoomOut: 4, + oneToOne: 4, + reset: 4, + prev: 4, + play: { + show: 4, + size: 'large', + }, + next: 4, + rotateLeft: 4, + rotateRight: 4, + flipHorizontal: 4, + flipVertical: 4, + } + }; -// open() { -// const config = new MatSnackBarConfig(); -// config.duration = this.autoHide; -// config.panelClass = this.addExtraClass ? ['party'] : null; -// this.snackBar.open(this.message, this.action && this.actionButtonLabel, config); -// } - ngOnInit() { - // this.message.main_applicant = this.main_applicant; - // this.message.lender_applicant_id = this.lender_applicant_id; - this.initRepresentative(); - let params: any = {}; - params.pd_id = this.pdid; - params.pd_form_id = this.form_id; - this._pd.retriveForm(params).subscribe(value => { - const control = this.representativeForm.controls['lender_representative_details']; - if (value.status == 200) { + // open() { + // const config = new MatSnackBarConfig(); + // config.duration = this.autoHide; + // config.panelClass = this.addExtraClass ? ['party'] : null; + // this.snackBar.open(this.message, this.action && this.actionButtonLabel, config); + // } + ngOnInit() { + // this.message.main_applicant = this.main_applicant; + // this.message.lender_applicant_id = this.lender_applicant_id; + this.initRepresentative(); + let params: any = {}; + params.pd_id = this.pdid; + params.pd_form_id = this.form_id; + this._pd.retriveForm(params).subscribe(value => { + const control = this.representativeForm.controls['lender_representative_details']; + if (value.status == 200) { - this.representativeForm.controls['lender_representative_accompany'].setValue(value.records.lender_representative_accompany); - this.representativeForm.controls['representative_remarks'].setValue(value.records.representative_remarks); + this.representativeForm.controls['lender_representative_accompany'].setValue(value.records.lender_representative_accompany); + this.representativeForm.controls['representative_remarks'].setValue(value.records.representative_remarks); - if (value.records.lender_representative_accompany == 'Yes') { - var result = Object.keys(value.records.lender_representative_details).map(function (key) { - return value.records.lender_representative_details[key]; - }); - if (result.length > 0) { - result.forEach(val => { - control.push(this.createLRDetail()); - }); - this.representativeForm.controls['lender_representative_details'].setValue(result); - } - } - } - // else { - // control.push(this.createLRDetail()); - // } - }) - } - public initRepresentative(): void { - this.representativeForm = this.fb.group({ - lender_representative_accompany: [''], - representative_remarks: [''], - lender_representative_details: this.fb.array([]), - }); - } + if (value.records.lender_representative_accompany == 'Yes') { + var result = Object.keys(value.records.lender_representative_details).map(function (key) { + return value.records.lender_representative_details[key]; + }); + if (result.length > 0) { + result.forEach(val => { + control.push(this.createLRDetail()); + }); + this.representativeForm.controls['lender_representative_details'].setValue(result); + } + } + } + // else { + // control.push(this.createLRDetail()); + // } + }) + } + public initRepresentative(): void { + this.representativeForm = this.fb.group({ + lender_representative_accompany: [''], + representative_remarks: [''], + lender_representative_details: this.fb.array([]), + }); + } - selectedLoanChanges(e): void { - if (e.value == 'Yes') { - const control = this.representativeForm.controls['lender_representative_details']; - control.push(this.createLRDetail()); - } else if (e.value == 'No') { - const arr = this.representativeForm.controls.lender_representative_details; - arr.removeAt(0); - } - } - createLRDetail() { - return this.fb.group({ - lender_representative_who_accompanies : [''], - lender_representative_carry_loan_files: [''], - }); - } - - submitLRForm() { - if (!this.representativeForm.valid) { - this.validateAllFormFields(this.representativeForm); - this.disableAfterSubmit = false; - this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); - return; - } - this.disableAfterSubmit = true; - let records: any = {}; - records.pdid = this.pdid; - records.formid = this.form_id; - records.fk_createdby = this.pdid; - records.lender_representative_accompany = this.representativeForm.controls['lender_representative_accompany'].value; - records.representative_remarks = this.representativeForm.controls['representative_remarks'].value; - if (records.lender_representative_accompany == 'Yes') { - records.lender_representative_details = this.representativeForm.controls['lender_representative_details'].value; - } - this._pd.saveForm(records).subscribe(data => { - if(data.status == 200) { - this.notifier.notify('success', 'Saved Successfully.'); - setTimeout(() =>{ - this.dialogRef.close(); + selectedLoanChanges(e): void { + if (e.value == 'Yes') { + const control = this.representativeForm.controls['lender_representative_details']; + control.push(this.createLRDetail()); + } else if (e.value == 'No') { + const arr = this.representativeForm.controls.lender_representative_details; + arr.removeAt(0); + } + } + createLRDetail() { + return this.fb.group({ + lender_representative_who_accompanies: [''], + lender_representative_carry_loan_files: [''], + }); + } + + submitLRForm() { + if (!this.representativeForm.valid) { + this.validateAllFormFields(this.representativeForm); + this.disableAfterSubmit = false; + this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); + return; + } + this.disableAfterSubmit = true; + let records: any = {}; + records.pdid = this.pdid; + records.formid = this.form_id; + records.fk_createdby = this.pdid; + records.lender_representative_accompany = this.representativeForm.controls['lender_representative_accompany'].value; + records.representative_remarks = this.representativeForm.controls['representative_remarks'].value; + if (records.lender_representative_accompany == 'Yes') { + records.lender_representative_details = this.representativeForm.controls['lender_representative_details'].value; + } + this._pd.saveForm(records).subscribe(data => { + if (data.status == 200) { + this.notifier.notify('success', 'Saved Successfully.'); + setTimeout(() => { + this.dialogRef.close(); + this.disableAfterSubmit = false; + }, 3000); + } + else { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.disableAfterSubmit = false; - },3000); - } - else { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - this.disableAfterSubmit = false; - } - }, error => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - this.disableAfterSubmit = false; - }) - } - validateAllFormFields(formGroup: FormGroup) { - Object.keys(formGroup.controls).forEach(field => { - const control = formGroup.get(field); - if (control instanceof FormControl) { - control.markAsTouched({ onlySelf: true }); - } else if (control instanceof FormGroup) { - this.validateAllFormFields(control); - } - }); - } + } + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.disableAfterSubmit = false; + }) + } + validateAllFormFields(formGroup: FormGroup) { + Object.keys(formGroup.controls).forEach(field => { + const control = formGroup.get(field); + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } + }); + } } 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 7ac25ccd8..8f6ac1460 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 @@ -30,18 +30,19 @@ {{loanAmtInWords}} Only - Loan Tenure applied for? - + Loan Tenure applied for? + - + Select - {{list.name }} ( {{list.abbr}} ) + + {{list.name }} ( {{list.abbr}} ) - + @@ -71,7 +72,7 @@ {{"₹"}} {{balTxrfAmtInWords}} Only - + @@ -105,16 +106,16 @@ - + + formControlName="own_contribution" OnlyNumber type="text" (keyup)="inWords($event,4)" + autocomplete="off"> {{"₹"}} {{ownContributionInWords}} Only @@ -211,8 +212,8 @@ + formControlName="emv_per_customer" OnlyNumber type="text" (keyup)="inWords($event,7)" + autocomplete="off"> {{"₹"}} {{emvAmtInWords}} Only diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts index db3edf305..4e3639c78 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts @@ -31,12 +31,12 @@ export class LoanDetailsComponent implements OnInit { lender_applicant_id: any; main_applicant: any; pageTitle: string = "Loan Details"; - disableAfterSubmit : boolean = false; + disableAfterSubmit: boolean = false; /**Declaration of formfields Variables */ private notifier: NotifierService; public loanDetailsForm: FormGroup; - + pdid: number; form_id: number; exist_loan_amt: any; @@ -101,7 +101,6 @@ export class LoanDetailsComponent implements OnInit { this.productAbbr = this.pd_all_details.pdmaster_details.product_abbr; this.productID = this.pd_all_details.pdmaster_details.fk_product_id; this.subProductName = this.pd_all_details.pdmaster_details.subproduct_name; - console.log('this.pd_all_details.pdmaster_details',this.pd_all_details.pdmaster_details); this.exist_loan_amt = this.pd_all_details.pdmaster_details.loan_amount != '' ? this.pd_all_details.pdmaster_details.loan_amount : ''; this.loanAmtInWords = this._pd.convertNumberToWords(this.exist_loan_amt); this.form_id = 10; @@ -122,7 +121,7 @@ export class LoanDetailsComponent implements OnInit { this.initloanDetailsForm(); this.getM_EndUseofLoad(); - this.getM_EndUseForLoan(this.pdid,this.pd_all_details.pdmaster_details.fk_subproduct_id); + this.getM_EndUseForLoan(this.pdid, this.pd_all_details.pdmaster_details.fk_subproduct_id); this.getM_sourceofamount(); this.getM_MortageTypeProperty(); this.getM_StatusofCunstruction(); @@ -194,10 +193,10 @@ export class LoanDetailsComponent implements OnInit { this.loanDetailsForm.controls['loan_amount'].setValue(value.records.loan_amount); if (value.records.loan_amount) { this.loanAmtInWords = this._pd.convertNumberToWords(value.records.loan_amount); } - + this.loanDetailsForm.controls['loan_tenure'].setValue(value.records.loan_tenure); this.loanDetailsForm.controls['sub_product'].setValue(value.records.sub_product || null); - + if (value.records.end_use_other != null) { this.loanDetailsForm.controls['end_use_other'].setValue(value.records.end_use_other); } @@ -283,8 +282,8 @@ export class LoanDetailsComponent implements OnInit { this.loanDetailsForm.controls['loandetails_remarks'].setValue(value.records.loandetails_remarks); } - else{ - if(this.pd_all_details.pdmaster_details.fk_subproduct_id){ + else { + if (this.pd_all_details.pdmaster_details.fk_subproduct_id) { this.loanDetailsForm.controls['sub_product'].setValue(this.pd_all_details.pdmaster_details.fk_subproduct_id); } } @@ -311,8 +310,8 @@ export class LoanDetailsComponent implements OnInit { }); } - getM_EndUseForLoan(pdid,subproductid) { - this._pd.getEndUseForLoan(pdid,subproductid).subscribe( + getM_EndUseForLoan(pdid, subproductid) { + this._pd.getEndUseForLoan(pdid, subproductid).subscribe( data => { this.m_endUseForLoan = data.records.filter(data => data.isactive == 1); }); @@ -393,8 +392,8 @@ export class LoanDetailsComponent implements OnInit { this.loanDetailsForm = this.fb.group({ loan_amount: [this.exist_loan_amt], - loan_tenure:[''], - sub_product:[''], + loan_tenure: [''], + sub_product: [''], end_use: [''], end_use_other: [''], is_transfer: [''], @@ -436,11 +435,11 @@ export class LoanDetailsComponent implements OnInit { } - onChangeSubProduct(e){ - this._pd.getEndUseForLoan(this.pdid,e).subscribe( + onChangeSubProduct(e) { + this._pd.getEndUseForLoan(this.pdid, e).subscribe( data => { this.m_endUseForLoan = data.records.filter(data => data.isactive == 1); - }); + }); } /** Enduse Changes And its Validation */ @@ -513,9 +512,9 @@ export class LoanDetailsComponent implements OnInit { this.loanDetailsForm.controls['own_contribution'].setValidators([Validators.required]); this.loanDetailsForm.controls['own_contribution'].updateValueAndValidity(); - + this.loanDetailsForm.controls['other_bt_lender'].setValue(''); - this.loanDetailsForm.controls['balance_transfer_amount'].setValue(''); + this.loanDetailsForm.controls['balance_transfer_amount'].setValue(''); this.loanDetailsForm.controls['lender'].setValue(''); this.loanDetailsForm.controls['topup_amount'].setValue(''); this.loanDetailsForm.controls['end_use_topup'].setValue(''); @@ -526,14 +525,14 @@ export class LoanDetailsComponent implements OnInit { this.loanDetailsForm.controls['source'].setValue(''); this.loanDetailsForm.controls['source'].clearValidators(); this.loanDetailsForm.controls['source'].updateValueAndValidity(); - + this.loanDetailsForm.controls['own_contribution'].setValue(''); this.loanDetailsForm.controls['own_contribution'].clearValidators(); this.loanDetailsForm.controls['own_contribution'].updateValueAndValidity(); - + this.isOtherSource = false; this.loanDetailsForm.controls['other_source'].setValue(''); - + } } @@ -620,40 +619,40 @@ export class LoanDetailsComponent implements OnInit { /** To save Loan FOrm Details */ submitLoanDetails() { - - if ((this.isContribution == true)){ - if(this.loanDetailsForm.controls['is_transfer'].value != 'yes') { - this.loanDetailsForm.controls['own_contribution'].setValue(''); - this.loanDetailsForm.controls['own_contribution'].clearValidators(); - this.loanDetailsForm.controls['own_contribution'].updateValueAndValidity(); - this.loanDetailsForm.controls['other_source'].setValue(''); - this.loanDetailsForm.controls['other_source'].clearValidators(); - this.loanDetailsForm.controls['other_source'].updateValueAndValidity(); - this.loanDetailsForm.controls['source'].setValue(''); - this.loanDetailsForm.controls['source'].clearValidators(); - this.loanDetailsForm.controls['source'].updateValueAndValidity(); + + if ((this.isContribution == true)) { + if (this.loanDetailsForm.controls['is_transfer'].value != 'yes') { + this.loanDetailsForm.controls['own_contribution'].setValue(''); + this.loanDetailsForm.controls['own_contribution'].clearValidators(); + this.loanDetailsForm.controls['own_contribution'].updateValueAndValidity(); + this.loanDetailsForm.controls['other_source'].setValue(''); + this.loanDetailsForm.controls['other_source'].clearValidators(); + this.loanDetailsForm.controls['other_source'].updateValueAndValidity(); + this.loanDetailsForm.controls['source'].setValue(''); + this.loanDetailsForm.controls['source'].clearValidators(); + this.loanDetailsForm.controls['source'].updateValueAndValidity(); } - else if(this.loanDetailsForm.controls['is_transfer'].value == 'yes'){ + else if (this.loanDetailsForm.controls['is_transfer'].value == 'yes') { - if (this.loanDetailsForm.controls['end_use_topup'].value == 1) { - this.loanDetailsForm.controls['other_end_use_topup'].setValidators([Validators.required]); - this.loanDetailsForm.controls['other_end_use_topup'].updateValueAndValidity(); - } - else { - this.loanDetailsForm.controls['other_end_use_topup'].setValue(''); - this.loanDetailsForm.controls['other_end_use_topup'].clearValidators(); - this.loanDetailsForm.controls['other_end_use_topup'].updateValueAndValidity(); - } + if (this.loanDetailsForm.controls['end_use_topup'].value == 1) { + this.loanDetailsForm.controls['other_end_use_topup'].setValidators([Validators.required]); + this.loanDetailsForm.controls['other_end_use_topup'].updateValueAndValidity(); + } + else { + this.loanDetailsForm.controls['other_end_use_topup'].setValue(''); + this.loanDetailsForm.controls['other_end_use_topup'].clearValidators(); + this.loanDetailsForm.controls['other_end_use_topup'].updateValueAndValidity(); + } - if (this.loanDetailsForm.controls['lender'].value == 1) { - this.loanDetailsForm.controls['other_bt_lender'].setValidators([Validators.required]); - this.loanDetailsForm.controls['other_bt_lender'].updateValueAndValidity(); - } - else { - this.loanDetailsForm.controls['other_bt_lender'].setValue(''); - this.loanDetailsForm.controls['other_bt_lender'].clearValidators(); - this.loanDetailsForm.controls['other_bt_lender'].updateValueAndValidity(); - } + if (this.loanDetailsForm.controls['lender'].value == 1) { + this.loanDetailsForm.controls['other_bt_lender'].setValidators([Validators.required]); + this.loanDetailsForm.controls['other_bt_lender'].updateValueAndValidity(); + } + else { + this.loanDetailsForm.controls['other_bt_lender'].setValue(''); + this.loanDetailsForm.controls['other_bt_lender'].clearValidators(); + this.loanDetailsForm.controls['other_bt_lender'].updateValueAndValidity(); + } } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html index 8319903d8..638309939 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html @@ -1,29 +1,33 @@

-
- {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
- {{pageTitle}} -
-
- -
+
+ {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - + {{subproduct_abbr}}
+ {{pageTitle}} +
+
+ +

- + - +
- + - + + formControlName="other_income"> Select Yes No @@ -33,14 +37,17 @@ -

Income Details

+ + +

Income Details

+
+
+ [formGroupName]="i"> - + Select {{src.name}} - - - - {{val.name}} - - - + + + + {{val.name}} + + + - - - - - {{"₹"}} {{amtInwords[i]}} Only + formControlName="others_income_earned_by"> - - Select - {{frq.name}} - + + {{"₹"}} + {{amtInwords[i]}} Only - + + + + Select + {{frq.name}} + + + - - - + + + -
+
-
-
-
+
+ -
- +
+
- - - + + +
- +
-
-
-
-
-
-
Image 1
-
-
-
-
-
-
-
Image 2
-
-
-
-
-
-
-
Image 3
-
-
-
-
-
-
-
Image 2
-
-
-
-
-
-
-
Image 3
-
-
-
-
-
-
-
Image 1
-
-
-
+ +
+
+
+
Image 2
+
+
+
+
+
+
+
Image 3
+
+
+
+
+
+
+
Image 2
+
+
+
+
+
+
+
Image 3
+
+
+
+
+
+
+
Image 1
+
+
+
+
+ +
+
- +
- +
-
- - Remarks - - -
-
- - -
+
+ + Remarks + + +
+
+ + +
- +
- + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + +--> \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts index fbea14562..f191ff155 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts @@ -22,7 +22,7 @@ import { /** Service */ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; -import {ActivatedRoute, Router} from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { RentalVerificationComponent } from './../rental-verification/rental-verification.component'; @@ -38,128 +38,127 @@ export class OtherIncomeComponent implements OnInit { lender_applicant_id: any; main_applicant: any; pageTitle: string = "Other Income Details"; - loadDataStatus: boolean=true; - + loadDataStatus: boolean = true; + // @Input() pdid: number; // @Input() form_id: number; - pdid : string; - form_id:number; + pdid: string; + form_id: number; public otherIncomeForm: FormGroup; private notifier: NotifierService; frequencyData: any = []; - sourceData : any = []; - amtInwords : any = []; - applicants : any = []; - incomeEarnedBy : any = []; - existCompanyList: any =[]; - mergeCompanyApplicant: any=[]; - isIncomeEarnedBy: any=[]; + sourceData: any = []; + amtInwords: any = []; + applicants: any = []; + incomeEarnedBy: any = []; + existCompanyList: any = []; + mergeCompanyApplicant: any = []; + isIncomeEarnedBy: any = []; // stringArr = []; - constructor(notifier: NotifierService, - private fb: FormBuilder, - private route: ActivatedRoute, - private router: Router, - private _pd: PdTrigerService, - private dialog: MatDialog, - private dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public pd_all_details: any) - { - this.pdid = this.pd_all_details.pdmaster_details.pd_id; - this.form_id = 9; - this.notifier = notifier; - this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; - this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; - this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; - this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; - this.applicants = this.pd_all_details.pdapplicants_detials; - this.applicants = this.applicants.filter(val=>val.applicant_type==0 || val.applicant_type==1); - this.applicants.push({'pd_co_applicant_id':'0','applicant_name':'Others'}); - } + constructor(notifier: NotifierService, + private fb: FormBuilder, + private route: ActivatedRoute, + private router: Router, + private _pd: PdTrigerService, + private dialog: MatDialog, + private dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { + this.pdid = this.pd_all_details.pdmaster_details.pd_id; + this.form_id = 9; + this.notifier = notifier; + this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; + this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; + this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; + this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + this.applicants = this.pd_all_details.pdapplicants_detials; + this.applicants = this.applicants.filter(val => val.applicant_type == 0 || val.applicant_type == 1); + this.applicants.push({ 'pd_co_applicant_id': '0', 'applicant_name': 'Others' }); + } -public viewerOptions: any = { - navbar: false, - toolbar: { - zoomIn: 4, - zoomOut: 4, - oneToOne: 4, - reset: 4, - prev: 4, - play: { - show: 4, - size: 'large', - }, - next: 4, - rotateLeft: 4, - rotateRight: 4, - flipHorizontal: 4, - flipVertical: 4, - } -}; + public viewerOptions: any = { + navbar: false, + toolbar: { + zoomIn: 4, + zoomOut: 4, + oneToOne: 4, + reset: 4, + prev: 4, + play: { + show: 4, + size: 'large', + }, + next: 4, + rotateLeft: 4, + rotateRight: 4, + flipHorizontal: 4, + flipVertical: 4, + } + }; ngOnInit() { - this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{ + this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data => { if (data.dataStatus) { - this.existCompanyList = data.records.filter(val => val.is_active === true); + this.existCompanyList = data.records.filter(val => val.is_active === true); } - + // get company list - let modifyCompanyList: any = []; - if (this.existCompanyList.length > 0) { + let modifyCompanyList: any = []; + if (this.existCompanyList.length > 0) { modifyCompanyList = this.existCompanyList.map(element => { - return { id: element.company_order_id.toString(), name: element.company_name, group_id: 1 }; + return { id: element.company_order_id.toString(), name: element.company_name, group_id: 1 }; }); this.mergeCompanyApplicant.push({ groupName: 'COMPANIES', groupValues: modifyCompanyList }) - } + } // get applicant list - let modifyApplicantList: any=[]; - if(this.applicants.length > 0){ + let modifyApplicantList: any = []; + if (this.applicants.length > 0) { modifyApplicantList = this.applicants.map(element => { - return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2}; + return { id: element.pd_co_applicant_id, name: element.applicant_name, group_id: 2 }; }); - this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList}) - - } - - }) + this.mergeCompanyApplicant.push({ groupName: 'APPLICANTS', groupValues: modifyApplicantList }) + + } + + }) this.getFrequency(); this.getSourceOtherIncome(); this.initOtherincomeForm(); this._pd.getAllPersonsName(this.pdid).subscribe(data => { - - - if(data.dataStatus == true){ - this.incomeEarnedBy = data.record; + + + if (data.dataStatus == true) { + this.incomeEarnedBy = data.record; } - + }); let params: any = {}; params.pd_id = this.pdid; params.pd_form_id = this.form_id; this._pd.retriveForm(params).subscribe(value => { - + const control = this.otherIncomeForm.controls['income_details']; if (value.status == 200) { - + this.otherIncomeForm.controls['other_income'].setValue(value.records.other_income); this.otherIncomeForm.controls['otherincome_remarks'].setValue(value.records.otherincome_remarks); if (value.records.other_income == 'Yes') { - var result = Object.keys(value.records.income_details).map(function(key) { - return value.records.income_details[key]; - }); - if (result.length > 0) { - result.forEach((val,index) => { - this.amtInwords[index] = this._pd.convertNumberToWords(val.amount); - // this.getOtherIncomeEarnedBy(val.income_earned_by,index); - control.push(this.createDetail()); - this.getOtherIncomeEarnedBy(val.income_earned_by,index); + var result = Object.keys(value.records.income_details).map(function (key) { + return value.records.income_details[key]; }); - this.otherIncomeForm.controls['income_details'].setValue(result); - } else { - // control.push(this.createDetail()); - } + if (result.length > 0) { + result.forEach((val, index) => { + this.amtInwords[index] = this._pd.convertNumberToWords(val.amount); + // this.getOtherIncomeEarnedBy(val.income_earned_by,index); + control.push(this.createDetail()); + this.getOtherIncomeEarnedBy(val.income_earned_by, index); + }); + this.otherIncomeForm.controls['income_details'].setValue(result); + } else { + // control.push(this.createDetail()); + } } } else { //control.push(this.createDetail()); @@ -186,20 +185,20 @@ public viewerOptions: any = { createDetail() { return this.fb.group({ source: [''], - others_source : [''], - address : [''], - income_earned_by:[''], - others_income_earned_by:[''], + others_source: [''], + address: [''], + income_earned_by: [''], + others_income_earned_by: [''], amount: [''], frequency: [''], - others_frequency : [''] + others_frequency: [''] }); } - + getFrequency() { let master_name = 'FREQUENCY'; this._pd.getAllMasterDatas(master_name).subscribe(data => { - + data.records.forEach(val => { if (val.isactive == 1) { this.frequencyData.push(val); @@ -210,21 +209,21 @@ public viewerOptions: any = { getSourceOtherIncome() { let master_name = 'SOURCEOFOTHERINCOME'; this._pd.getAllMasterDatas(master_name).subscribe(data => { - + data.records.forEach(val => { if (val.isactive == 1) { - this.sourceData.push(val); + this.sourceData.push(val); } - }) - if(this.customer_segment_abbr == 'SE-RI'){ + }) + if (this.customer_segment_abbr == 'SE-RI') { let inx = this.sourceData.map(data => data.name).indexOf("Rental Income") /** -X- Please NOTE THIS : * inx is '-1' -> this will remove the last item from array * so that If Condition is given. */ if (inx !== -1) { - this.sourceData.splice(this.sourceData.map(data => data.name).indexOf("Rental Income"), 1); + this.sourceData.splice(this.sourceData.map(data => data.name).indexOf("Rental Income"), 1); } - } + } }); } addIncomeDetails() { @@ -238,7 +237,7 @@ public viewerOptions: any = { submitCurrentDetails() { if (!this.otherIncomeForm.valid) { this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); - return; + return; } let records: any = {}; records.pdid = this.pdid; @@ -246,20 +245,20 @@ public viewerOptions: any = { records.fk_createdby = this.pdid; records.other_income = this.otherIncomeForm.controls['other_income'].value; records.otherincome_remarks = this.otherIncomeForm.controls['otherincome_remarks'].value; - + if (this.otherIncomeForm.controls['other_income'].value == 'Yes') { records.income_details = this.otherIncomeForm.controls['income_details'].value; } this._pd.saveForm(records).subscribe(data => { - if(data.status == 200) { + if (data.status == 200) { this.notifier.notify('success', 'Saved Successfully.'); - setTimeout(() =>{ + setTimeout(() => { this.dialogRef.close(); - },3000); + }, 3000); } else { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); } }, error => { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); @@ -269,19 +268,19 @@ public viewerOptions: any = { Object.keys(formGroup.controls).forEach(field => { const control = formGroup.get(field); if (control instanceof FormControl) { - control.markAsTouched({onlySelf: true}); + control.markAsTouched({ onlySelf: true }); } else if (control instanceof FormGroup) { this.validateAllFormFields(control); } }); } - /** Amount InWords */ - inWords(e,i){ - this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value); - } + /** Amount InWords */ + inWords(e, i) { + this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value); + } - Toview(){ + Toview() { // alert('Rental Info '); // const dialogRef = this.dialog.open(RentalInfoComponent, { // data: {} @@ -291,55 +290,54 @@ public viewerOptions: any = { // }); const dialogRef = this.dialog.open(RentalVerificationComponent, { data: this.pd_all_details, - maxWidth: '100vw', - maxHeight: '100vh', - height: '100%', - width: '100%', + maxWidth: '100vw', + maxHeight: '100vh', + height: '100%', + width: '100%', disableClose: true - }); - dialogRef.afterClosed() - .subscribe(dataresult => { - // this.getCompanyListForBusiness(); - }); - - } - - // compare objects for merge two master table details - compareObjects(o1: any, o2: any) { - if(o1.id == o2.id && o1.group_id == o2.group_id) - return true; - else return false - } - - getOtherIncomeEarnedBy(value,i) { - // console.log('value',value,'I',i); - let Ctrls = this.otherIncomeForm.controls['income_details']; - // console.log('ParCtrls',Ctrls); - let ChdCtrls:any = Ctrls.controls[i]; - // console.log('ChdCtrls',ChdCtrls); - - let Avaliablity = 1; - console.log('val',value); - if(value.length>0){ - value.forEach(option => { - if(option.id == 0 && option.group_id == 2){ - Avaliablity = option.id; - } }); - } - if(Avaliablity == 0){ - // console.log('if Avaliablity',Avaliablity); - ChdCtrls.controls.others_income_earned_by.setValidators([Validators.required]); - this.isIncomeEarnedBy[i] = true; - }else if(Avaliablity == 1){ - // console.log('else Avaliablity',Avaliablity); - // console.log('esle this.isIncomeEarnedBy[ParInx]',this.isIncomeEarnedBy[i]); - ChdCtrls.controls.others_income_earned_by.setValue(''); - ChdCtrls.controls.others_income_earned_by.clearValidators(); - this.isIncomeEarnedBy[i] = false; - // console.log('else this.isIncomeEarnedBy[ParInx]',this.isIncomeEarnedBy[i]); + dialogRef.afterClosed() + .subscribe(dataresult => { + // this.getCompanyListForBusiness(); + }); + + } + + // compare objects for merge two master table details + compareObjects(o1: any, o2: any) { + if (o1.id == o2.id && o1.group_id == o2.group_id) + return true; + else return false + } + + getOtherIncomeEarnedBy(value, i) { + + let Ctrls = this.otherIncomeForm.controls['income_details']; + + let ChdCtrls: any = Ctrls.controls[i]; + + + let Avaliablity = 1; + + if (value.length > 0) { + value.forEach(option => { + if (option.id == 0 && option.group_id == 2) { + Avaliablity = option.id; + } + }); + } + if (Avaliablity == 0) { + + ChdCtrls.controls.others_income_earned_by.setValidators([Validators.required]); + this.isIncomeEarnedBy[i] = true; + } else if (Avaliablity == 1) { + + ChdCtrls.controls.others_income_earned_by.setValue(''); + ChdCtrls.controls.others_income_earned_by.clearValidators(); + this.isIncomeEarnedBy[i] = false; + + } + + ChdCtrls.controls.others_income_earned_by.updateValueAndValidity(); } - - ChdCtrls.controls.others_income_earned_by.updateValueAndValidity(); -} } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts index 15a112c9f..c45c74b1b 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts @@ -60,7 +60,7 @@ export class RentalVerificationComponent implements OnInit { } }; constructor(notifier: NotifierService, private _pd: PdTrigerService ,private _fb: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: any,private dialogRef: MatDialogRef) { - console.log('data',data); + this.pdid = this.data.pdmaster_details.pd_id; this.notifier = notifier; this.form_id = 17; 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 f1ecb659f..a99a6439b 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 @@ -1,417 +1,544 @@

- {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
- {{pageTitle}} + {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
+ {{pageTitle}}
- +

-
- - - - -
-
- -
Manufacturing Stock Details
-
-
- -
- - Raw Material #{{a+1}} - - - - - - - Select - Add Stock Details - No Stock Observed - - - + + + + + +
+
+ +
Manufacturing Stock Details
+
+
+ +
+ + Raw Material #{{a+1}} + + - + - - Select - {{uom.name}} + + Select + Add Stock Details + No Stock Observed - - - - - - {{"₹"}} {{mrm.get('raw_value').value | numberToWords}} Only - - - - -
- -
-
- -
- -
-
-
-
- - - - Select - Yes - No - - - - Please comment on the stock level observed? - - - - - -
-
- - Finished Goods #{{b+1}} - - - - - - - Select - Add Stock Details - No Stock Observed - - - - - - - - - Select - {{uom.name}} - - - - - - - - {{"₹"}} {{mfg.get('goods_value').value | numberToWords}} Only - - - - -
- -
-
- -
-
-
-
-
-
-
-
- - -
Retail Trading Details
-
-
-
-
- - Traded Goods #{{e+1}} - - - - - - - Select - Add Stock Details - No Stock Observed - - - - - - - + + + + + - Select - {{uom.name}} + formControlName="raw_uom"> + Select + {{uom.name}} - - + + - - - {{"₹"}} {{item.get('estimated_traded_goods_value').value | numberToWords}} Only - - - - -
- -
-
- -
-
-
- -
-
-
-
-
- - -
Wholesale Trading Details
-
-
-
-
- - - Traded Goods #{{g+1}} - - - - - - - Select - Add Stock Details - No stock observed - - - - - - - - - Select - {{uom.name}} - - - - - - - - {{"₹"}} {{tradetg.get('estimated_traded_goods_value').value | numberToWords}} Only - - + + + {{"₹"}} + {{mrm.get('raw_value').value | numberToWords}} + Only + + -
- -
-
- -
-
-
+
+
+ +
+ + + +
+ + + + + Select + Yes + No + + + + Please comment on the stock level observed? + + + + + + +
+
+ + Finished Goods #{{b+1}} + + + + + + + + Select + Add Stock Details + No Stock Observed + + + + + + + + + Select + {{uom.name}} + + + + + + + + {{"₹"}} + {{mfg.get('goods_value').value | + numberToWords}} Only + + + + +
+ +
+
+ +
+
+
+
+
+
+
+
+ + +
Retail Trading Details
+
+
+
+
+ + Traded Goods #{{e+1}} + + + + + + + + Select + Add Stock Details + No Stock Observed + + + + + + + + + Select + {{uom.name}} + + + + + + + + {{"₹"}} + {{item.get('estimated_traded_goods_value').value + | numberToWords}} Only + + + + +
+ +
+
+ +
+
+
+ +
+
+
+
+
+ + +
Wholesale Trading Details
+
+
+
+
+ + + Traded Goods #{{g+1}} + + + + + + + + Select + Add Stock Details + No stock observed + + + + + + + + + Select + {{uom.name}} + + + + + + + + {{"₹"}} + {{tradetg.get('estimated_traded_goods_value').value + | numberToWords}} Only + + + + +
+ +
+
+ +
+
+
+
+
+
+
+ +
+ +
+
+ + + Select + Yes + No + + + + Please comment on the stock level observed? + + +
+ + + +
Service Provider
+
Service Provider Details Not + applicable here !!
+
+ + + +
+
+
+
+ + + + + + -
+ + -
-
- - - Select - Yes - No - - - - Please comment on the stock level observed? - - -
- - - -
Service Provider
-
Service Provider Details Not applicable here !!
-
- - - -
-
- - - - - - - - - - - - - -
- + +
+ Remarks - -
-
- -
-
+
+
+
+ +
+
- +
{{ errorMessage }} -
Fill Business Form First! / No Company Found at this ID {{company_id}}! ....
- \ No newline at end of file +
Fill Business Form First! / No Company Found at this ID + {{company_id}}! ....
+ \ No newline at end of file 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 0f49afc58..6d416d0ad 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 @@ -1,10 +1,10 @@ -import { Component,OnInit,Inject,Input } from '@angular/core'; +import { Component, OnInit, Inject, Input } from '@angular/core'; -import { FormBuilder,FormGroup,Validators,FormArray, FormControl } from '@angular/forms'; +import { FormBuilder, FormGroup, Validators, FormArray, FormControl } from '@angular/forms'; import { NotifierService } from 'angular-notifier'; -import { MatDialog,MatDialogRef,MAT_DIALOG_DATA } from '@angular/material'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; /** Service */ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; @@ -19,13 +19,13 @@ import { analyzeAndValidateNgModules } from '@angular/compiler'; export class StockComponent implements OnInit { - pageTitle: string ="Stock Details"; + pageTitle: string = "Stock Details"; private notifier: NotifierService; public stockForms: FormGroup; - - public uomData : any = []; + + public uomData: any = []; public submitted = false; @@ -43,451 +43,438 @@ export class StockComponent implements OnInit { RMCommentCard: boolean = false; TGCommentCard: boolean = false - + serviceProviderForm: Boolean = false; - suppliers_raw_materials : any = []; - suppliers_retail_trade_details : any = []; - suppliers_wholesale_trade_details : any = []; - suppliers_finished_goods : any =[]; + suppliers_raw_materials: any = []; + suppliers_retail_trade_details: any = []; + suppliers_wholesale_trade_details: any = []; + suppliers_finished_goods: any = []; // suppliers_service_product : any = []; /** Constructor */ - constructor(notifier: NotifierService, - private fb: FormBuilder, - private route: ActivatedRoute, - private router: Router, - private dialogRef: MatDialogRef, - 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; - this.pageTitle = this.pd_all_details.company_name + ' - ' +this.pageTitle ; - this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; - this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; - this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; - this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + constructor(notifier: NotifierService, + private fb: FormBuilder, + private route: ActivatedRoute, + private router: Router, + private dialogRef: MatDialogRef, + 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; + this.pageTitle = this.pd_all_details.company_name + ' - ' + this.pageTitle; + this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; + this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; + this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; + this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; } /** CSS For Docs Testing */ public viewerOptions: any = { - navbar: false, - toolbar: { - zoomIn: 4, - zoomOut: 4, - oneToOne: 4, - reset: 4, - prev: 4, - play: { - show: 4, - size: 'large', - }, - next: 4, - rotateLeft: 4, - rotateRight: 4, - flipHorizontal: 4, - flipVertical: 4, - } - }; + navbar: false, + toolbar: { + zoomIn: 4, + zoomOut: 4, + oneToOne: 4, + reset: 4, + prev: 4, + play: { + show: 4, + size: 'large', + }, + next: 4, + rotateLeft: 4, + rotateRight: 4, + flipHorizontal: 4, + flipVertical: 4, + } + }; ngOnInit() { - - this._pd.stockFormAccess(this.pdid,this.company_id).subscribe(data => { - - if(data.dataStatus == true){ - this.initstockForms(data.record); - } - else if(data.dataStatus == false) - { - this.notifier.notify('warning', 'Fill Business Form First! / No Company Found at this ID '+ this.company_id ); - this.noRecordsFound = false; - this.errorMessage = 'Fill Business Form First! / No Company Found at this ID' + this.company_id +'! ....'; - return; - } - else{ - this.notifier.notify('warning', 'Fill Business Form First! / No Company Found at this ID '+ this.company_id ); - this.noRecordsFound = false; - this.errorMessage = 'Fill Business Form First! / No Company Found at this ID' + this.company_id +'! ....'; - return; - } - }, err => { - this.notifier.notify('warning', 'Business Type Of Activity Not Available Please Check Business Information.!'); - this.noRecordsFound = false; - this.errorMessage = 'No Records Found , Something went Wrong!'; - }) - this.getUOM(); + this._pd.stockFormAccess(this.pdid, this.company_id).subscribe(data => { + + if (data.dataStatus == true) { + this.initstockForms(data.record); + } + else if (data.dataStatus == false) { + this.notifier.notify('warning', 'Fill Business Form First! / No Company Found at this ID ' + this.company_id); + this.noRecordsFound = false; + this.errorMessage = 'Fill Business Form First! / No Company Found at this ID' + this.company_id + '! ....'; + return; + } + else { + this.notifier.notify('warning', 'Fill Business Form First! / No Company Found at this ID ' + this.company_id); + this.noRecordsFound = false; + this.errorMessage = 'Fill Business Form First! / No Company Found at this ID' + this.company_id + '! ....'; + return; + } + }, err => { + this.notifier.notify('warning', 'Business Type Of Activity Not Available Please Check Business Information.!'); + this.noRecordsFound = false; + this.errorMessage = 'No Records Found , Something went Wrong!'; + }) + + this.getUOM(); } - public initstockForms(record){ - // console.log('record.from_business',record.from_business); + public initstockForms(record) { + let api = Object.keys(record.from_business).map(function (key) { return record.from_business[key]; }); - // console.log(api); + let type2 = record.from_business.filter(data => data.type_of_activity_id == 2); - // console.log('type2[0].hasOwnProperty("products")',type2[0].hasOwnProperty("products")); - // console.log('type2',type2); - // console.log('type2 0 index',type2[0]); - // console.log('type2 product',type2[0].product); - // console.log('type2 length',type2[0].product.length); - + let type2length = type2[0].hasOwnProperty("products") ? type2[0].products.length : 0; let type3 = record.from_business.filter(data => data.type_of_activity_id == 3); let type3length = type3[0].hasOwnProperty("products") ? type3[0].products.length : 0; let type4 = record.from_business.filter(data => data.type_of_activity_id == 4); let type4length = type4[0].hasOwnProperty("products") ? type4[0].products.length : 0; - // console.log(type2); - // console.log(type2length); - // console.log(type3); - // console.log(type3length); - // console.log(type4); - // console.log(type4length); - let rm_api = record.from_supplier; - - 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) { - this.stockForms = this.fb.group({ - pdid: [this.pdid], - formid: [this.form_id], - company_id: [this.company_id], - stock_remarks: [dataForm.stock_remarks], - manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]), - retail_details : this.fb.array([this.retailFormCreation(type3length)]), - trade_details: this.fb.array([this.tradingFormCreation(type4length)]), - is_sufficiant_finished_and_traded_goods:[dataForm.is_sufficiant_finished_and_traded_goods], - finished_and_traded_goods_remarks:[dataForm.finished_and_traded_goods_remarks] - }); - if(api.length > 0){ - api.forEach(val => { - if (val.type_of_activity_id == 2) { - if(val.products){ - - let manufacturing_temparr = []; - manufacturing_temparr['manufacturing_raw_materials'] = dataForm.manufacturing_details[0].manufacturing_raw_materials; - this.stockForms.controls['manufacturing_details']['controls'][0].controls['is_sufficiant_raw'].setValue(dataForm.manufacturing_details[0].is_sufficiant_raw), - // this.checkComments(dataForm.manufacturing_details[0].is_sufficiant_raw.value,1,''); - this.stockForms.controls['manufacturing_details']['controls'][0].controls['rawmaterial_remarks'].setValue(dataForm.manufacturing_details[0].rawmaterial_remarks); - manufacturing_temparr['manufacturing_finished_goods'] = dataForm.manufacturing_details[0].manufacturing_finished_goods; - this.initManufacturingDetails(manufacturing_temparr); - } - } - if (val.type_of_activity_id == 3) { - if(val.products){ - let retail_temparr = []; - retail_temparr['retail_traded_goods'] = dataForm.retail_details[0].retail_traded_goods; - this.initRetailDetails(retail_temparr); - } - } - if (val.type_of_activity_id == 4) { - if(val.products){ - let trading_temparr = []; - trading_temparr['trading_traded_goods'] = dataForm.trade_details[0].trading_traded_goods; - this.initTradingDetails(trading_temparr); - } - } - if (val.type_of_activity_id == 5) { - if(val.products){ - this.serviceProviderForm = true; - } - } - }); - this.noRecordsFound = true; - } - } - else{ + 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) { + this.stockForms = this.fb.group({ + pdid: [this.pdid], + formid: [this.form_id], + company_id: [this.company_id], + stock_remarks: [dataForm.stock_remarks], + manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]), + retail_details: this.fb.array([this.retailFormCreation(type3length)]), + trade_details: this.fb.array([this.tradingFormCreation(type4length)]), + is_sufficiant_finished_and_traded_goods: [dataForm.is_sufficiant_finished_and_traded_goods], + finished_and_traded_goods_remarks: [dataForm.finished_and_traded_goods_remarks] + }); + if (api.length > 0) { + api.forEach(val => { + if (val.type_of_activity_id == 2) { + if (val.products) { - 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(type3length)]), - trade_details: this.fb.array([this.tradingFormCreation(type4length)]), - is_sufficiant_finished_and_traded_goods:[''], - finished_and_traded_goods_remarks:[''] - }); - - if(api.length > 0){ - api.forEach(val => { - if (val.type_of_activity_id == 2) { - if(val.products){ - this.suppliers_raw_materials = rm_api; - this.suppliers_finished_goods = val.products; - this.initManufacturingDetails(null); - this.stockForms.controls['manufacturing_details']['controls'][0].controls['is_sufficiant_raw'].setValue(dataForm.manufacturing_details[0].is_sufficiant_raw.value || null), - this.stockForms.controls['manufacturing_details']['controls'][0].controls['rawmaterial_remarks'].setValue(dataForm.manufacturing_details[0].rawmaterial_remarks || null); - } - } - if (val.type_of_activity_id == 3) { - if(val.products){ - this.suppliers_retail_trade_details = val.products; - this.initRetailDetails(null); - } - } - if (val.type_of_activity_id == 4) { - if(val.products){ - this.suppliers_wholesale_trade_details =val.products; - this.initTradingDetails(null); - } - } - if (val.type_of_activity_id == 5) { - if(val.products){ - // this.suppliers_service_product = val.products; - this.serviceProviderForm = true; - } - - } - - }); - this.noRecordsFound = true; + let manufacturing_temparr = []; + manufacturing_temparr['manufacturing_raw_materials'] = dataForm.manufacturing_details[0].manufacturing_raw_materials; + this.stockForms.controls['manufacturing_details']['controls'][0].controls['is_sufficiant_raw'].setValue(dataForm.manufacturing_details[0].is_sufficiant_raw), + // this.checkComments(dataForm.manufacturing_details[0].is_sufficiant_raw.value,1,''); + this.stockForms.controls['manufacturing_details']['controls'][0].controls['rawmaterial_remarks'].setValue(dataForm.manufacturing_details[0].rawmaterial_remarks); + manufacturing_temparr['manufacturing_finished_goods'] = dataForm.manufacturing_details[0].manufacturing_finished_goods; + this.initManufacturingDetails(manufacturing_temparr); } } - } - else { - 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(type3length)]), - trade_details: this.fb.array([this.tradingFormCreation(type4length)]), - is_sufficiant_finished_and_traded_goods:[''], - finished_and_traded_goods_remarks:[''] - }); - if(api.length > 0){ - api.forEach(val => { - if (val.type_of_activity_id == 2) { - if(val.products){ - this.suppliers_finished_goods = val.products; - this.suppliers_raw_materials = rm_api; - this.initManufacturingDetails(null); - this.stockForms.controls['manufacturing_details']['controls'][0].controls['is_sufficiant_raw'].setValue(null); - this.stockForms.controls['manufacturing_details']['controls'][0].controls['rawmaterial_remarks'].setValue(null); - } - } - if (val.type_of_activity_id == 3) { - if(val.products){ - this.suppliers_retail_trade_details= val.products; - this.initRetailDetails(null); - } - } - if (val.type_of_activity_id == 4) { - if(val.products){ - this.suppliers_wholesale_trade_details = val.products; - this.initTradingDetails(null); - } - } - if (val.type_of_activity_id == 5) { - if(val.products){ - // this.suppliers_service_product = val.products; - this.serviceProviderForm = true; - } - } - }); - this.noRecordsFound = true; + if (val.type_of_activity_id == 3) { + if (val.products) { + let retail_temparr = []; + retail_temparr['retail_traded_goods'] = dataForm.retail_details[0].retail_traded_goods; + this.initRetailDetails(retail_temparr); } + } + if (val.type_of_activity_id == 4) { + if (val.products) { + let trading_temparr = []; + trading_temparr['trading_traded_goods'] = dataForm.trade_details[0].trading_traded_goods; + this.initTradingDetails(trading_temparr); + } + } + if (val.type_of_activity_id == 5) { + if (val.products) { + this.serviceProviderForm = true; + } + } + }); + this.noRecordsFound = true; } - }) + } + else { + + + 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(type3length)]), + trade_details: this.fb.array([this.tradingFormCreation(type4length)]), + is_sufficiant_finished_and_traded_goods: [''], + finished_and_traded_goods_remarks: [''] + }); + + if (api.length > 0) { + api.forEach(val => { + if (val.type_of_activity_id == 2) { + if (val.products) { + this.suppliers_raw_materials = rm_api; + this.suppliers_finished_goods = val.products; + this.initManufacturingDetails(null); + this.stockForms.controls['manufacturing_details']['controls'][0].controls['is_sufficiant_raw'].setValue(dataForm.manufacturing_details[0].is_sufficiant_raw.value || null), + this.stockForms.controls['manufacturing_details']['controls'][0].controls['rawmaterial_remarks'].setValue(dataForm.manufacturing_details[0].rawmaterial_remarks || null); + } + } + if (val.type_of_activity_id == 3) { + if (val.products) { + this.suppliers_retail_trade_details = val.products; + this.initRetailDetails(null); + } + } + if (val.type_of_activity_id == 4) { + if (val.products) { + this.suppliers_wholesale_trade_details = val.products; + this.initTradingDetails(null); + } + } + if (val.type_of_activity_id == 5) { + if (val.products) { + // this.suppliers_service_product = val.products; + this.serviceProviderForm = true; + } + + } + + }); + this.noRecordsFound = true; + } + } + } + else { + 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(type3length)]), + trade_details: this.fb.array([this.tradingFormCreation(type4length)]), + is_sufficiant_finished_and_traded_goods: [''], + finished_and_traded_goods_remarks: [''] + }); + if (api.length > 0) { + api.forEach(val => { + if (val.type_of_activity_id == 2) { + if (val.products) { + this.suppliers_finished_goods = val.products; + this.suppliers_raw_materials = rm_api; + this.initManufacturingDetails(null); + this.stockForms.controls['manufacturing_details']['controls'][0].controls['is_sufficiant_raw'].setValue(null); + this.stockForms.controls['manufacturing_details']['controls'][0].controls['rawmaterial_remarks'].setValue(null); + } + } + if (val.type_of_activity_id == 3) { + if (val.products) { + this.suppliers_retail_trade_details = val.products; + this.initRetailDetails(null); + } + } + if (val.type_of_activity_id == 4) { + if (val.products) { + this.suppliers_wholesale_trade_details = val.products; + this.initTradingDetails(null); + } + } + if (val.type_of_activity_id == 5) { + if (val.products) { + // this.suppliers_service_product = val.products; + this.serviceProviderForm = true; + } + } + }); + this.noRecordsFound = true; + } + } + }) } manufacturingForm: Boolean = false; manufacturingFormCreation(record) { - let arr = record.from_business.filter(data => data.type_of_activity_id == 2); - let arrlength = arr[0].hasOwnProperty("products") ? arr[0].products.length : 0; - let rm_arr = record.from_supplier; + let arr = record.from_business.filter(data => data.type_of_activity_id == 2); + let arrlength = arr[0].hasOwnProperty("products") ? arr[0].products.length : 0; + let rm_arr = record.from_supplier; - // console.log('manu arr',arr); - // console.log('rm_arr',rm_arr); - // let rm_arr = 0; - if(arrlength > 0){ - this.manufacturingForm = true; - return this.fb.group({ - manufacturing_raw_materials: this.fb.array([]), - is_sufficiant_raw: [], - rawmaterial_remarks:[], - manufacturing_finished_goods: this.fb.array([]), - }) + if (arrlength > 0) { + this.manufacturingForm = true; + return this.fb.group({ + manufacturing_raw_materials: this.fb.array([]), + is_sufficiant_raw: [], + rawmaterial_remarks: [], + manufacturing_finished_goods: this.fb.array([]), + }) } else { - return; + return; } -} + } -retailForm: Boolean = false; -retailFormCreation(val) { - // console.log(val); - // let arr = val.filter(data => data.type_of_activity_id == 3); - if (val > 0) { - this.retailForm = true; + retailForm: Boolean = false; + retailFormCreation(val) { + // let arr = val.filter(data => data.type_of_activity_id == 3); + if (val > 0) { + this.retailForm = true; return this.fb.group({ retail_traded_goods: this.fb.array([]) }) - // } - } else { - return; + // } + } else { + return; + } } -} -tradingForm: Boolean = false; -tradingFormCreation(val) { - // let arr = val.filter(data => data.type_of_activity_id == 4); - if (val > 0) { - this.tradingForm = true; - return this.fb.group({ - trading_traded_goods: this.fb.array([]) - }); - } else { - return; + tradingForm: Boolean = false; + tradingFormCreation(val) { + // let arr = val.filter(data => data.type_of_activity_id == 4); + if (val > 0) { + this.tradingForm = true; + return this.fb.group({ + trading_traded_goods: this.fb.array([]) + }); + } else { + return; + } } -} initManufacturingDetails(datas) { - const rawMaterial = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials']; - const finishedGoods = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods']; - const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['main_raw_materials']; - if(datas === null){ - - - if(this.suppliers_raw_materials.length > 0){ - this.suppliers_raw_materials.forEach(val => { - let Ref_RawMaterials : any = {'raw_name': val, - 'stock_observed':'', - 'raw_quantity': '', - 'raw_uom': '', - 'other_uom': '', - 'raw_value': ''}; - rawMaterial.push(this.createRawmaterial(Ref_RawMaterials)); - }); - } - else{ - rawMaterial.push(this.createRawmaterial(null)); - } + const rawMaterial = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials']; + const finishedGoods = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods']; + const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['main_raw_materials']; + if (datas === null) { - if(this.suppliers_finished_goods.length > 0){ - // for (let val of this.suppliers_finished_goods) { - this.suppliers_finished_goods.forEach(val => { - let Ref_Finished_Goods : any = {'goods_name': val, - 'goods_observed': '', - 'goods_quantity': '', - 'goods_uom': '', - 'goods_other_uom': '', - 'goods_value': '', - }; - finishedGoods.push(this.createGoods(Ref_Finished_Goods)); - // finishedGoods.push(this.createGoods(null)); - }); - } - else{ - finishedGoods.push(this.createGoods(null)); - } - } else { - - if(datas.manufacturing_raw_materials != undefined){ + if (this.suppliers_raw_materials.length > 0) { + this.suppliers_raw_materials.forEach(val => { + let Ref_RawMaterials: any = { + 'raw_name': val, + 'stock_observed': '', + 'raw_quantity': '', + 'raw_uom': '', + 'other_uom': '', + 'raw_value': '' + }; + rawMaterial.push(this.createRawmaterial(Ref_RawMaterials)); + }); + } + else { + rawMaterial.push(this.createRawmaterial(null)); + } + + if (this.suppliers_finished_goods.length > 0) { + // for (let val of this.suppliers_finished_goods) { + this.suppliers_finished_goods.forEach(val => { + let Ref_Finished_Goods: any = { + 'goods_name': val, + 'goods_observed': '', + 'goods_quantity': '', + 'goods_uom': '', + 'goods_other_uom': '', + 'goods_value': '', + }; + finishedGoods.push(this.createGoods(Ref_Finished_Goods)); + // finishedGoods.push(this.createGoods(null)); + }); + } + else { + finishedGoods.push(this.createGoods(null)); + } + + } else { + + if (datas.manufacturing_raw_materials != undefined) { // for (let val of datas.manufacturing_raw_materials) { - datas.manufacturing_raw_materials.forEach((val,index) => { - this.checkComments(val.stock_observed,1,index); + datas.manufacturing_raw_materials.forEach((val, index) => { + this.checkComments(val.stock_observed, 1, index); // this.checkComments(val.is_sufficiant_raw,1,index); - rawMaterial.push(this.createRawmaterial(val)); - }); - } - else{ - rawMaterial.push(this.createRawmaterial(null)); - } - if(datas.manufacturing_finished_goods != undefined){ + rawMaterial.push(this.createRawmaterial(val)); + }); + } + else { + rawMaterial.push(this.createRawmaterial(null)); + } + if (datas.manufacturing_finished_goods != undefined) { // for (let val of datas.manufacturing_finished_goods) { - datas.manufacturing_finished_goods.forEach((val,index) => { - this.checkComments(val.goods_observed,2,index); - finishedGoods.push(this.createGoods(val)); - }); - } - else{ - finishedGoods.push(this.createGoods(null)); - } - } + datas.manufacturing_finished_goods.forEach((val, index) => { + this.checkComments(val.goods_observed, 2, index); + finishedGoods.push(this.createGoods(val)); + }); + } + else { + finishedGoods.push(this.createGoods(null)); + } + } } createRawmaterial(records) { - - if(records === null) { - - return this.fb.group({ - raw_name: [''], - stock_observed:[''], - raw_quantity: [''], - raw_uom: [''], - other_uom : [''], - raw_value: [''], - // rawmaterial_value: [''], - }) - } else { - - return this.fb.group({ - // manufacturing_raw_material_name: [records.manufacturing_raw_material_name || null], - raw_name: [records.raw_name], - stock_observed:[records.stock_observed], - raw_quantity: [records.raw_quantity], - raw_uom: [records.raw_uom], - other_uom : [records.other_uom], - raw_value: [records.raw_value], - // rawmaterial_value: [records.rawmaterial_value], - }) - } + + if (records === null) { + + return this.fb.group({ + raw_name: [''], + stock_observed: [''], + raw_quantity: [''], + raw_uom: [''], + other_uom: [''], + raw_value: [''], + // rawmaterial_value: [''], + }) + } else { + + return this.fb.group({ + // manufacturing_raw_material_name: [records.manufacturing_raw_material_name || null], + raw_name: [records.raw_name], + stock_observed: [records.stock_observed], + raw_quantity: [records.raw_quantity], + raw_uom: [records.raw_uom], + other_uom: [records.other_uom], + raw_value: [records.raw_value], + // rawmaterial_value: [records.rawmaterial_value], + }) } + } initRetailDetails(datas) { - + const tradedGoods = this.stockForms.controls['retail_details']['controls'][0].controls['retail_traded_goods']; - - if(datas === null){ - if(this.suppliers_retail_trade_details.length > 0){ - // this.rawMaterialAccess = true; - - this.suppliers_retail_trade_details.forEach(val => { - let Ref_Trade_Goods : any = { - 'traded_goods_name': val, - 'traded_goods_observed': '', - 'traded_goods_quantity': '', - 'traded_goods_uom': '', - 'traded_goods_other_uom': '', - 'estimated_traded_goods_value': ''} - tradedGoods.push(this.createTradedGoods(Ref_Trade_Goods)); - }); - } - else{ - tradedGoods.push(this.createTradedGoods(null)); - } + if (datas === null) { - } else { - if(datas.retail_traded_goods !== undefined){ + if (this.suppliers_retail_trade_details.length > 0) { + // this.rawMaterialAccess = true; + + this.suppliers_retail_trade_details.forEach(val => { + let Ref_Trade_Goods: any = { + 'traded_goods_name': val, + 'traded_goods_observed': '', + 'traded_goods_quantity': '', + 'traded_goods_uom': '', + 'traded_goods_other_uom': '', + 'estimated_traded_goods_value': '' + } + tradedGoods.push(this.createTradedGoods(Ref_Trade_Goods)); + }); + } + else { + tradedGoods.push(this.createTradedGoods(null)); + } + + } else { + if (datas.retail_traded_goods !== undefined) { // for (let val of datas.retail_traded_goods) { - datas.retail_traded_goods.forEach((val,index) => { - this.checkComments(val.traded_goods_observed,3,index); - tradedGoods.push(this.createTradedGoods(val)); - }); - } - else{ - tradedGoods.push(this.createTradedGoods(null)); - } - } + datas.retail_traded_goods.forEach((val, index) => { + this.checkComments(val.traded_goods_observed, 3, index); + tradedGoods.push(this.createTradedGoods(val)); + }); + } + else { + tradedGoods.push(this.createTradedGoods(null)); + } + } } // createGoods2() { @@ -502,34 +489,34 @@ tradingFormCreation(val) { // }); // } - createGoods(records) { - if(records === null) { - return this.fb.group({ - goods_name: [''], - goods_observed: [''], - goods_quantity: [''], - goods_uom: [''], - goods_other_uom: [''], - goods_value: [''], - // finished_goods_value: [''], - + createGoods(records) { + if (records === null) { + return this.fb.group({ + goods_name: [''], + goods_observed: [''], + goods_quantity: [''], + goods_uom: [''], + goods_other_uom: [''], + goods_value: [''], + // finished_goods_value: [''], + }); } else { return this.fb.group({ - goods_name: [records.goods_name], - goods_observed: [records.goods_observed], - goods_quantity: [records.goods_quantity], - goods_uom: [records.goods_uom], - goods_other_uom: [records.goods_other_uom], - goods_value: [records.goods_value], - // finished_goods_value: [records.finished_goods_value], - - }) - } + goods_name: [records.goods_name], + goods_observed: [records.goods_observed], + goods_quantity: [records.goods_quantity], + goods_uom: [records.goods_uom], + goods_other_uom: [records.goods_other_uom], + goods_value: [records.goods_value], + // finished_goods_value: [records.finished_goods_value], + + }) + } } - + // createTradedGoods2() { // return this.fb.group({ // traded_goods_name: [''], @@ -543,82 +530,82 @@ tradingFormCreation(val) { // } initTradingDetails(datas) { - const tradedGoods = this.stockForms.controls['trade_details']['controls'][0].controls['trading_traded_goods']; - if(datas === null){ + const tradedGoods = this.stockForms.controls['trade_details']['controls'][0].controls['trading_traded_goods']; + if (datas === null) { - - if(this.suppliers_wholesale_trade_details.length > 0){ - // for (let val of this.suppliers_trade_details) { - this.suppliers_wholesale_trade_details.forEach(val => { - let Ref_Trade_Goods : any = { - 'traded_goods_name': val, - 'traded_goods_observed': '', - 'traded_goods_quantity': '', - 'traded_goods_uom': '', - 'traded_goods_other_uom': '', - 'estimated_traded_goods_value': ''} - - tradedGoods.push(this.createTradedGoods(Ref_Trade_Goods)); - }); - } - else{ - tradedGoods.push(this.createTradedGoods(null)); - } - } else { - if(datas.trading_traded_goods !==undefined) - { + if (this.suppliers_wholesale_trade_details.length > 0) { + // for (let val of this.suppliers_trade_details) { + this.suppliers_wholesale_trade_details.forEach(val => { + let Ref_Trade_Goods: any = { + 'traded_goods_name': val, + 'traded_goods_observed': '', + 'traded_goods_quantity': '', + 'traded_goods_uom': '', + 'traded_goods_other_uom': '', + 'estimated_traded_goods_value': '' + } + + tradedGoods.push(this.createTradedGoods(Ref_Trade_Goods)); + }); + } + else { + tradedGoods.push(this.createTradedGoods(null)); + } + + } else { + if (datas.trading_traded_goods !== undefined) { // for (let val of datas.trading_traded_goods) { - datas.trading_traded_goods.forEach((val,index) => { - this.checkComments(val.traded_goods_observed,4,index); - tradedGoods.push(this.createTradedGoods(val)); - }); - } - else{ - tradedGoods.push(this.createTradedGoods(null)); - } + datas.trading_traded_goods.forEach((val, index) => { + this.checkComments(val.traded_goods_observed, 4, index); + tradedGoods.push(this.createTradedGoods(val)); + }); + } + else { + tradedGoods.push(this.createTradedGoods(null)); + } - } + } } - + createTradedGoods(records) { - if(records === null) { - return this.fb.group({ - traded_goods_name: [''], - traded_goods_observed: [''], - traded_goods_quantity: [''], - traded_goods_uom: [''], - traded_goods_other_uom: [''], - estimated_traded_goods_value: [''], - // traded_goods_value: [''], + if (records === null) { + return this.fb.group({ + traded_goods_name: [''], + traded_goods_observed: [''], + traded_goods_quantity: [''], + traded_goods_uom: [''], + traded_goods_other_uom: [''], + estimated_traded_goods_value: [''], + // traded_goods_value: [''], }); } else { return this.fb.group({ - traded_goods_name: [records.traded_goods_name], - traded_goods_observed: [records.traded_goods_observed], - traded_goods_quantity: [records.traded_goods_quantity], - traded_goods_uom: [records.traded_goods_uom], - traded_goods_other_uom: [records.traded_goods_other_uom], - estimated_traded_goods_value: [records.estimated_traded_goods_value], - // traded_goods_value: [records.traded_goods_value], - - }) - } + traded_goods_name: [records.traded_goods_name], + traded_goods_observed: [records.traded_goods_observed], + traded_goods_quantity: [records.traded_goods_quantity], + traded_goods_uom: [records.traded_goods_uom], + traded_goods_other_uom: [records.traded_goods_other_uom], + estimated_traded_goods_value: [records.estimated_traded_goods_value], + // traded_goods_value: [records.traded_goods_value], + + }) + } } /** Manufacturing -> To Add More Raw Material Details */ addRawMaterials(flag) { - if(flag==1){ - const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials']; - control.push(this.createRawmaterial(null)); - } + if (flag == 1) { + const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials']; + control.push(this.createRawmaterial(null)); + } } /** Manufacturing -> To Remove Raw Material Details */ - deleteRawMaterials(index,flag) { - if(flag==1){ + deleteRawMaterials(index, flag) { + if (flag == 1) { const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials']; control.removeAt(index); } @@ -626,16 +613,16 @@ tradingFormCreation(val) { /** Manufacturing -> To Add More Finished Goods */ addGoods(flag) { - if(flag == 1){ - const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods']; - control.push(this.createGoods(null)); - } + if (flag == 1) { + const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods']; + control.push(this.createGoods(null)); + } } /** Manufacturing -> To Remove Finished Goods */ - deleteGoods(index,flag) { - if(flag == 1){ - const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods']; + deleteGoods(index, flag) { + if (flag == 1) { + const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods']; control.removeAt(index); } } @@ -645,30 +632,30 @@ tradingFormCreation(val) { * Case 2 wholesale Traded -> To Add More trade Goods */ addTradedGoods(flag) { - switch(flag){ - - case 1: { - const control = this.stockForms.controls['retail_details']['controls'][0].controls['retail_traded_goods']; - control.push(this.createTradedGoods(null)); - break; - } - case 2: { - const control = this.stockForms.controls['trade_details']['controls'][0].controls['trading_traded_goods']; - control.push(this.createTradedGoods(null)); - break; - } - default: { - break; - } - } + switch (flag) { + + case 1: { + const control = this.stockForms.controls['retail_details']['controls'][0].controls['retail_traded_goods']; + control.push(this.createTradedGoods(null)); + break; + } + case 2: { + const control = this.stockForms.controls['trade_details']['controls'][0].controls['trading_traded_goods']; + control.push(this.createTradedGoods(null)); + break; + } + default: { + break; + } + } } /** * Case 1 Retail Traded -> To remove trade Goods * Case 2 wholesale Traded -> To remove trade Goods */ - deleteTradedGoods(index,flag) { - switch(flag){ + deleteTradedGoods(index, flag) { + switch (flag) { case 1: { const control = this.stockForms.controls['retail_details']['controls'][0].controls['retail_traded_goods']; control.removeAt(index); @@ -683,43 +670,43 @@ tradingFormCreation(val) { break; } } - - //const control = this.stockForms.controls['traded_goods']; - + + //const control = this.stockForms.controls['traded_goods']; + } - + /** To Save/Edited Popup Data */ submitDetails(e) { this.submitted = true; - // stop here if form is invalid - if (this.stockForms.invalid) { - this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); - return; - } else { - var answerFormValues = this.stockForms.value; + // stop here if form is invalid + if (this.stockForms.invalid) { + this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); + return; + } else { + var answerFormValues = this.stockForms.value; - //To Remove The "Null" With Key also - Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]); - - this._pd.savePDFormDetailsWithID(answerFormValues).subscribe( - dataresult => { - if(dataresult.status == 200) { - this.notifier.notify('success', 'Saved Successfully.'); - // this.dialogRef.close(); - setTimeout(() =>{ + //To Remove The "Null" With Key also + Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]); + + this._pd.savePDFormDetailsWithID(answerFormValues).subscribe( + dataresult => { + if (dataresult.status == 200) { + this.notifier.notify('success', 'Saved Successfully.'); + // this.dialogRef.close(); + setTimeout(() => { this.dialogRef.close(); - },3000); - } - else{ - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - } - }, error => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - - }); - - } + }, 3000); + } + else { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + } + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + + }); + + } } // validateAllFormFields(formGroup: FormGroup) { @@ -734,78 +721,78 @@ tradingFormCreation(val) { // } getUOM() { - this._pd.getAllMasterDatas('UOM').subscribe(data => { - - data.records.forEach(val => { - if (val.isactive == 1 && val.is_land_uom == 0 || val.is_land_uom == 2) { - this.uomData.push(val); - } - }) - }); + this._pd.getAllMasterDatas('UOM').subscribe(data => { + + data.records.forEach(val => { + if (val.isactive == 1 && val.is_land_uom == 0 || val.is_land_uom == 2) { + this.uomData.push(val); + } + }) + }); } - + /** On Key Press Event For Numbers */ keyPress(event: any) { - const pattern = /[0-9]/; - - let inputChar = String.fromCharCode(event.charCode); - if (event.keyCode != 8 && !pattern.test(inputChar)) { - event.preventDefault(); - } - } + const pattern = /[0-9]/; -ManufacturingCounterArray: any = []; -FinishedCounterArray: any = []; -RetailCounterArray: any = []; -WholeSaleCounterArray: any = []; - -checkComments(value,flag,index){ - // console.log(value,flag,index); - if(flag == 1){ - this.ManufacturingCounterArray[index] = value == "yes" ? 1 : 0 - let RMOverallCount = this.ManufacturingCounterArray.reduce((sum, val) => sum + +val, 0); - this.RMCommentCard = RMOverallCount > 0 ? true : false ; + let inputChar = String.fromCharCode(event.charCode); + if (event.keyCode != 8 && !pattern.test(inputChar)) { + event.preventDefault(); } - if(flag == 2){ + } + + ManufacturingCounterArray: any = []; + FinishedCounterArray: any = []; + RetailCounterArray: any = []; + WholeSaleCounterArray: any = []; + + checkComments(value, flag, index) { + + if (flag == 1) { + this.ManufacturingCounterArray[index] = value == "yes" ? 1 : 0 + let RMOverallCount = this.ManufacturingCounterArray.reduce((sum, val) => sum + +val, 0); + this.RMCommentCard = RMOverallCount > 0 ? true : false; + } + if (flag == 2) { this.FinishedCounterArray[index] = value == "yes" ? 1 : 0 } - if(flag == 3){ + if (flag == 3) { this.RetailCounterArray[index] = value == "yes" ? 1 : 0 } - if(flag == 4){ - this.WholeSaleCounterArray[index] = value == "yes" ? 1 : 0 + if (flag == 4) { + this.WholeSaleCounterArray[index] = value == "yes" ? 1 : 0 } let FGOverallCount = this.FinishedCounterArray.reduce((sum, val) => sum + +val, 0); let RTGOverallCount = this.RetailCounterArray.reduce((sum, val) => sum + +val, 0); let WTGOverallCount = this.WholeSaleCounterArray.reduce((sum, val) => sum + +val, 0); let TGOverallCount = FGOverallCount + RTGOverallCount + WTGOverallCount; - this.TGCommentCard = TGOverallCount > 0 ? true : false ; -} + this.TGCommentCard = TGOverallCount > 0 ? true : false; + } - // checkComments(e,flag,index){ - // if(flag == 1 && e=='no'){ - // this.mrmCommentFlag = true; - // } - // else if(flag == 1 && e!='no'){ - // this.mrmCommentFlag = false; - // } - // if(flag == 2 && e=='no'){ - // this.mfgCommentFlag[index] = true; - // } - // else if(flag == 2 && e!='no'){ - // this.mfgCommentFlag[index] = false; - // } - // if(flag == 3 && e=='no'){ - // this.rtrdCommentFlag[index] = true; - // } - // else if(flag == 3 && e!='no'){ - // this.rtrdCommentFlag[index] = false; - // } - // if(flag == 4 && e=='no'){ - // this.wtrdCommentFlag[index] = true; - // } - // else if(flag == 4 && e!='no'){ - // this.wtrdCommentFlag[index] = false; - // } + // checkComments(e,flag,index){ + // if(flag == 1 && e=='no'){ + // this.mrmCommentFlag = true; + // } + // else if(flag == 1 && e!='no'){ + // this.mrmCommentFlag = false; + // } + // if(flag == 2 && e=='no'){ + // this.mfgCommentFlag[index] = true; + // } + // else if(flag == 2 && e!='no'){ + // this.mfgCommentFlag[index] = false; + // } + // if(flag == 3 && e=='no'){ + // this.rtrdCommentFlag[index] = true; + // } + // else if(flag == 3 && e!='no'){ + // this.rtrdCommentFlag[index] = false; + // } + // if(flag == 4 && e=='no'){ + // this.wtrdCommentFlag[index] = true; + // } + // else if(flag == 4 && e!='no'){ + // this.wtrdCommentFlag[index] = false; + // } // } } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html index b15d9e11c..2b67ea549 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html @@ -1,11 +1,13 @@

- {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
- {{pageTitle}} -
+ {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
+ {{pageTitle}} +

- +
@@ -14,9 +16,11 @@
Manufacturing Product Details
-
+
-
+
Raw Material #{{l+1}}
@@ -26,110 +30,127 @@ - +
- - - Select - - {{tl.name}} - - - - - - - - + + + Select + + {{tl.name}} + + + + + + + + Select - {{comrelShip.name}} + {{comrelShip.name}} - + -
-
- - - Enter Valid Mobile Number. - - - - Enter Valid STD Code Number. -   -   - - - Enter Valid LandLine Number. - -
-
- - - + - - Select - {{ pm.name }} - - - - - - Select - Payment made in Cash. - Payment made through Banking channels. - - - -
- -
- No.of days of Credit Provided by Supplier - - - - - - -
+ + Select + {{ pm.name + }} + + + + + + Select + Payment made in Cash. + Payment made + through Banking channels. + + + +
+ +
+ No.of days of Credit Provided by Supplier + + + + + + +
- +
-
-
- -
+
+
+
-
+
+
- +
- +
Trading Product Details
-
+
-
+
Trading Product #{{l+1}}
@@ -138,106 +159,123 @@ --> - {{ pm.name }} + {{ + pm.name }}
-
+
- + Select {{tl.name}} - + - - - - - Select - - {{comrelShip.name}} - - - - - + + + + + Select + + {{comrelShip.name}} + + + + + - +
- - Enter Valid Mobile Number. + + Enter Valid Mobile Number. - - Enter Valid STD Code Number. + + Enter Valid STD Code Number.   -   - - Enter Valid LandLine Number. + + Enter Valid LandLine Number.
-
+
- - Select - {{ pm.name }} - + + Select + {{ pm.name + }} + - - Select - Payment made in Cash. - Payment made through Banking channels. - - + + Select + Payment made in Cash. + Payment made + through Banking channels. + + -
- -
- No.of days of Credit Provided by Supplier - - - - - - -
- +
+ No.of days of Credit Provided by Supplier + + + + + + +
+
- - + +
-
-
- -
+
+
+
-
+
+
- +
- +
@@ -254,13 +292,16 @@
- +
-
{{ errorMessage }}
+
{{ errorMessage }}
\ No newline at end of file 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 842a1a255..02f22273b 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 @@ -1,25 +1,11 @@ /** Common Imports */ -import { - Component, - OnInit, - Inject, - Output, Input -} from '@angular/core'; +import { Component,OnInit,Inject,Output, Input } from '@angular/core'; -import { - FormBuilder, - FormGroup, - Validators, - FormArray, -} from '@angular/forms'; +import { FormBuilder,FormGroup,Validators,FormArray } from '@angular/forms'; import { NotifierService } from 'angular-notifier'; -import { - MatDialog, - MatDialogRef, - MAT_DIALOG_DATA -} from '@angular/material'; +import { MatDialog,MatDialogRef,MAT_DIALOG_DATA } from '@angular/material'; /** Service */ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; @@ -51,8 +37,8 @@ export class SupplierInfoComponent implements OnInit { public m_paymentType = []; private notifier: NotifierService; - titleList: any=[]; - companyRelationShipList: any=[]; + titleList: any = []; + companyRelationShipList: any = []; constructor( notifier: NotifierService, @@ -63,7 +49,7 @@ export class SupplierInfoComponent implements OnInit { this.form_id = 1; this.company_id = this.pd_all_details.company_id this.notifier = notifier; - this.pageTitle = this.pd_all_details.company_name + ' - ' +this.pageTitle ; + this.pageTitle = this.pd_all_details.company_name + ' - ' + this.pageTitle; this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; @@ -94,51 +80,51 @@ export class SupplierInfoComponent implements OnInit { errorMessage: any = ''; ngOnInit() { this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid, this.company_id).subscribe(data => { - - if(data.dataStatus){ - // let datas = { - // "profession_name": "Others", - // "type_of_activity": [ - // { - // "type_of_activity_id": 1, - // "name": "Manufacturing Details" - // }, - // { - // "type_of_activity_id": 2, - // "name": "Retail trading" - // }, - // { - // "type_of_activity_id": 4, - // "name": "Service Provider" - // } - // ] - // }; - let datas = data.records; - this.initFormLoadDetails(datas.type_of_activity); - this.m_manufacturingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 2 ){return data}}).map(data=> [...data.prodcuts]); - // this.m_tradingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 3){return data}}).map(data=> [...data.prodcuts]); - - let api = Object.keys(datas.type_of_activity).map(function (key) { - return datas.type_of_activity[key]; - }); - if(api.length > 0){ - api.forEach(val => { - if (val.type_of_activity_id == 3) { - if(val.prodcuts){ - this.m_tradingProducts.push(val.prodcuts); - } - } - if (val.type_of_activity_id == 4) { - if(val.prodcuts){ - this.m_tradingProducts.push(val.prodcuts); - } - } + if (data.dataStatus) { + // let datas = { + // "profession_name": "Others", + // "type_of_activity": [ + // { + // "type_of_activity_id": 1, + // "name": "Manufacturing Details" + // }, + // { + // "type_of_activity_id": 2, + // "name": "Retail trading" + // }, + // { + // "type_of_activity_id": 4, + // "name": "Service Provider" + // } + // ] + // }; + let datas = data.records; + this.initFormLoadDetails(datas.type_of_activity); + this.m_manufacturingProducts = datas.type_of_activity.filter(data => { if (data.type_of_activity_id == 2) { return data } }).map(data => [...data.prodcuts]); + // this.m_tradingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 3){return data}}).map(data=> [...data.prodcuts]); + + let api = Object.keys(datas.type_of_activity).map(function (key) { + return datas.type_of_activity[key]; }); - } - this.m_tradingProducts = [].concat.apply([], this.m_tradingProducts); - - }else { + if (api.length > 0) { + api.forEach(val => { + if (val.type_of_activity_id == 3) { + if (val.prodcuts) { + this.m_tradingProducts.push(val.prodcuts); + } + } + + if (val.type_of_activity_id == 4) { + if (val.prodcuts) { + this.m_tradingProducts.push(val.prodcuts); + } + } + }); + } + this.m_tradingProducts = [].concat.apply([], this.m_tradingProducts); + + } else { this.notifier.notify('warning', 'No Category Records Found.!'); this.noRecordsFound = false; this.errorMessage = data.msg; @@ -152,123 +138,123 @@ export class SupplierInfoComponent implements OnInit { // this.getM_FreqOfPurchase(); this.getM_PaymentModeType(); // this.getPdSupplierFormDetails(); - this.getMasterDetails('COMPANYRELATIONSHIPS',1); - this.getMasterDetails('TITLES',2); + this.getMasterDetails('COMPANYRELATIONSHIPS', 1); + this.getMasterDetails('TITLES', 2); } 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; + params.pd_id = this.pdid; + params.pd_form_id = this.form_id; + params.company_id = this.company_id; // alert(JSON.stringify(record)); - this.pdTrigerService.retriveForm(params).subscribe( + this.pdTrigerService.retriveForm(params).subscribe( data => { - if(data.dataStatus){ - let dataForm = data.records; - if(dataForm !== undefined) { - 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] - // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), - }); - let arr = record.filter(data => data.type_of_activity_id == 2); - if(arr.length > 0) { - // let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) { - // return dataForm.main_raw_materials[key]; - // }); - if(dataForm.manufacturing_details[0] !== null){ - let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials; - - this.initManufacturingProductsDetails(api_main_raw_materials); - this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null); - } - else{ - this.initManufacturingProductsDetails(null); - this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); - } - } - - let arr1 = record.filter(data => data.type_of_activity_id == 3 || data.type_of_activity_id ==4); - - if(arr1.length > 0) { - if(dataForm.trade_details[0] !== null){ - // let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) { - // return dataForm.trading_products[key]; - // }); - let api_trading_products = dataForm.trade_details[0].trading_products; - this.initTradingProductsDetails(api_trading_products); - this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null); - } - else{ - this.initTradingProductsDetails(null); - this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null); - } - } - this.noRecordsFound = true; - } else { - 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] - // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), - }); - let arr = record.filter(data => data.type_of_activity_id == 2); - if(arr.length > 0) { - this.initManufacturingProductsDetails(null); - this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); - } - let arr1 = record.filter(data => data.type_of_activity_id == 3 || 4); - if(arr1.length > 0) { - this.initTradingProductsDetails(null); - this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trading_products_total_payments_percent_on_credit || null); - } - this.noRecordsFound = true; - } - let arr2 = record.filter(data => data.type_of_activity_id == 5); - if(arr2.length > 0) { - this.serviceProviderForm = true; - } - } else { + if (data.dataStatus) { + let dataForm = data.records; + if (dataForm !== undefined) { 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: [] - // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), - }); - let arr = record.filter(data => data.type_of_activity_id == 2); - if(arr.length > 0) { - this.initManufacturingProductsDetails(null); - this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); - } - let arr1 = record.filter(data => data.type_of_activity_id == 3 || data.type_of_activity_id== 4); - if(arr1.length > 0) { - this.initTradingProductsDetails(null); - this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null); - } - let arr2 = record.filter(data => data.type_of_activity_id == 5); - if(arr2.length > 0) { - this.serviceProviderForm = true; - } + 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] + // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), + }); + let arr = record.filter(data => data.type_of_activity_id == 2); + if (arr.length > 0) { + // let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) { + // return dataForm.main_raw_materials[key]; + // }); + if (dataForm.manufacturing_details[0] !== null) { + let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials; + + this.initManufacturingProductsDetails(api_main_raw_materials); + this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null); + } + else { + this.initManufacturingProductsDetails(null); + this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); + } + } + + let arr1 = record.filter(data => data.type_of_activity_id == 3 || data.type_of_activity_id == 4); + + if (arr1.length > 0) { + if (dataForm.trade_details[0] !== null) { + // let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) { + // return dataForm.trading_products[key]; + // }); + let api_trading_products = dataForm.trade_details[0].trading_products; + this.initTradingProductsDetails(api_trading_products); + this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null); + } + else { + this.initTradingProductsDetails(null); + this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null); + } + } this.noRecordsFound = true; + } else { + 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] + // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), + }); + let arr = record.filter(data => data.type_of_activity_id == 2); + if (arr.length > 0) { + this.initManufacturingProductsDetails(null); + this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); + } + let arr1 = record.filter(data => data.type_of_activity_id == 3 || 4); + if (arr1.length > 0) { + this.initTradingProductsDetails(null); + this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trading_products_total_payments_percent_on_credit || null); + } + this.noRecordsFound = true; + } + let arr2 = record.filter(data => data.type_of_activity_id == 5); + if (arr2.length > 0) { + this.serviceProviderForm = true; + } + } else { + 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: [] + // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), + }); + let arr = record.filter(data => data.type_of_activity_id == 2); + if (arr.length > 0) { + this.initManufacturingProductsDetails(null); + this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); + } + let arr1 = record.filter(data => data.type_of_activity_id == 3 || data.type_of_activity_id == 4); + if (arr1.length > 0) { + this.initTradingProductsDetails(null); + this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null); + } + let arr2 = record.filter(data => data.type_of_activity_id == 5); + if (arr2.length > 0) { + this.serviceProviderForm = true; + } + this.noRecordsFound = true; } }, err => { } - ); - } + ); + } manufacturingForm: Boolean = false; @@ -276,10 +262,10 @@ export class SupplierInfoComponent implements OnInit { let arr = val.filter(data => data.type_of_activity_id == 2); if (arr.length > 0) { this.manufacturingForm = true; - return this._formBuilder.group({ - main_raw_materials: this._formBuilder.array([]), - main_raw_materials_total_payments_percent_on_credit: [] - }) + return this._formBuilder.group({ + main_raw_materials: this._formBuilder.array([]), + main_raw_materials_total_payments_percent_on_credit: [] + }) // } } else { return; @@ -301,111 +287,111 @@ export class SupplierInfoComponent implements OnInit { } initManufacturingProductsDetails(datas) { - const control = this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials']; - if(datas === null){ - control.push(this.initManufacturingProducts(null)); - } else { - datas.forEach((val,inx) => { - this.checkCard(val.manufacturing_payment_type,1,inx); - control.push(this.initManufacturingProducts(val)); - }); - } + const control = this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials']; + if (datas === null) { + control.push(this.initManufacturingProducts(null)); + } else { + datas.forEach((val, inx) => { + this.checkCard(val.manufacturing_payment_type, 1, inx); + control.push(this.initManufacturingProducts(val)); + }); + } } initManufacturingProducts(records) { - if(records === null) { + if (records === null) { return this._formBuilder.group({ manufacturing_raw_material_name: [''], manufacturing_supplier_name: [''], - person_title_name:[''], - person_designation:[''], - other_person_designation:[''], + person_title_name: [''], + person_designation: [''], + other_person_designation: [''], manufacturing_contact_person_name: [''], - manufacturing_contact_person_mobile_number: ['',Validators.compose([Validators.minLength(10),Validators.maxLength(10)])], + manufacturing_contact_person_mobile_number: ['', Validators.compose([Validators.minLength(10), Validators.maxLength(10)])], manufacturing_payment_type: [''], - manufacturing_payment_mode:[''], + manufacturing_payment_mode: [''], manufacturing_credit_days_from: [''], - manufacturing_credit_days_to:[''], + manufacturing_credit_days_to: [''], manufacturing_frequency_of_purchase: [''], - person_stdcode:['', Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])], - person_landline:['', Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])], + person_stdcode: ['', Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])], + person_landline: ['', Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])], }) } else { - return this._formBuilder.group({ + return this._formBuilder.group({ manufacturing_raw_material_name: [records.manufacturing_raw_material_name || null], manufacturing_supplier_name: [records.manufacturing_supplier_name || null], - person_title_name:[records.person_title_name || null], - person_designation:[records.person_title_name || null], - other_person_designation:[records.other_person_designation || null], + person_title_name: [records.person_title_name || null], + person_designation: [records.person_title_name || null], + other_person_designation: [records.other_person_designation || null], manufacturing_contact_person_name: [records.manufacturing_contact_person_name || null], - manufacturing_contact_person_mobile_number: [records.manufacturing_contact_person_mobile_number || null,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])], + manufacturing_contact_person_mobile_number: [records.manufacturing_contact_person_mobile_number || null, Validators.compose([Validators.minLength(10), Validators.maxLength(10)])], manufacturing_payment_type: [records.manufacturing_payment_type || null], - manufacturing_payment_mode:[records.manufacturing_payment_mode], + manufacturing_payment_mode: [records.manufacturing_payment_mode], manufacturing_credit_days_from: [records.manufacturing_credit_days_from || null], - manufacturing_credit_days_to:[records.manufacturing_credit_days_to || null], + manufacturing_credit_days_to: [records.manufacturing_credit_days_to || null], manufacturing_frequency_of_purchase: [records.manufacturing_frequency_of_purchase || null], - person_stdcode:[records.person_stdcode || null, Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])], - person_landline:[records.person_landline || null, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])], + person_stdcode: [records.person_stdcode || null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])], + person_landline: [records.person_landline || null, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])], }) } } initTradingProductsDetails(datas) { const control = this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products']; - - if(datas === null){ - control.push(this.initTradingProducts(null)); - } else { - datas.forEach((val,inx) => { - this.checkCard(val.trade_product_payment_type,2,inx); - control.push(this.initTradingProducts(val)); - }); - } + + if (datas === null) { + control.push(this.initTradingProducts(null)); + } else { + datas.forEach((val, inx) => { + this.checkCard(val.trade_product_payment_type, 2, inx); + control.push(this.initTradingProducts(val)); + }); + } } - initTradingProducts(records) { - if(records === null) { - return this._formBuilder.group({ - trade_product_name: [''], - trade_supplier_name: [''], - person_title_name:[''], - person_designation:[''], - other_person_designation:[''], - trade_product_contact_person_name: [''], - trade_product_contact_person_mobile_number: ['',Validators.compose([Validators.minLength(10),Validators.maxLength(10)])], - person_stdcode:[null, Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])], - person_landline:[null, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])], - trade_product_payment_type: [''], - trade_product_payment_mode: [''], - trade_product_frequency_of_purchase: [''], - trade_product_credit_days_from: [''], - trade_product_credit_days_to: [''], - }) - } else { - return this._formBuilder.group({ - trade_product_name: [records.trade_product_name], - person_title_name:[records.person_title_name], - person_designation:[records.person_designation], - other_person_designation:[records.other_person_designation], - trade_supplier_name: [records.trade_supplier_name], - trade_product_contact_person_name: [records.trade_product_contact_person_name], - trade_product_contact_person_mobile_number: [records.trade_product_contact_person_mobile_number, Validators.compose([Validators.minLength(10),Validators.maxLength(10)])], - person_stdcode:[records.person_stdcode, Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])], - person_landline:[records.person_landline, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])], - trade_product_payment_type: [records.trade_product_payment_type], - trade_product_payment_mode: [records.trade_product_payment_mode], - trade_product_frequency_of_purchase: [records.trade_product_frequency_of_purchase], - trade_product_credit_days_from: [records.trade_product_credit_days_from], - trade_product_credit_days_to: [records.trade_product_credit_days_to], - }) - } + initTradingProducts(records) { + if (records === null) { + return this._formBuilder.group({ + trade_product_name: [''], + trade_supplier_name: [''], + person_title_name: [''], + person_designation: [''], + other_person_designation: [''], + trade_product_contact_person_name: [''], + trade_product_contact_person_mobile_number: ['', Validators.compose([Validators.minLength(10), Validators.maxLength(10)])], + person_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])], + person_landline: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])], + trade_product_payment_type: [''], + trade_product_payment_mode: [''], + trade_product_frequency_of_purchase: [''], + trade_product_credit_days_from: [''], + trade_product_credit_days_to: [''], + }) + } else { + return this._formBuilder.group({ + trade_product_name: [records.trade_product_name], + person_title_name: [records.person_title_name], + person_designation: [records.person_designation], + other_person_designation: [records.other_person_designation], + trade_supplier_name: [records.trade_supplier_name], + trade_product_contact_person_name: [records.trade_product_contact_person_name], + trade_product_contact_person_mobile_number: [records.trade_product_contact_person_mobile_number, Validators.compose([Validators.minLength(10), Validators.maxLength(10)])], + person_stdcode: [records.person_stdcode, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])], + person_landline: [records.person_landline, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])], + trade_product_payment_type: [records.trade_product_payment_type], + trade_product_payment_mode: [records.trade_product_payment_mode], + trade_product_frequency_of_purchase: [records.trade_product_frequency_of_purchase], + trade_product_credit_days_from: [records.trade_product_credit_days_from], + trade_product_credit_days_to: [records.trade_product_credit_days_to], + }) } + } addMoreRawMaterials(e): void { // e.stropPropagation(); const control = this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials']; - + control.push(this.initManufacturingProducts(null)); } @@ -417,7 +403,7 @@ export class SupplierInfoComponent implements OnInit { addMoretradeProduct(e): void { // e.stropPropagation(); const control = this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products']; - + control.push(this.initTradingProducts(null)); } @@ -426,24 +412,24 @@ export class SupplierInfoComponent implements OnInit { control.removeAt(inx); } - // get all master details - getMasterDetails(table:string,type:number){ + // get all master details + getMasterDetails(table: string, type: number) { this.pdTrigerService.getAllMasterDatas(table).subscribe( data => { if (data.dataStatus) { - if(type==1){ - this.companyRelationShipList=data.records; + if (type == 1) { + this.companyRelationShipList = data.records; // .filter(item => item.name != 'Others'); } - if(type==2){ - this.titleList=data.records.filter(val=>val.isactive==1); - + if (type == 2) { + this.titleList = data.records.filter(val => val.isactive == 1); + } - - + + } - }, error => this.errorMessage = error); + }, error => this.errorMessage = error); } // ================== @@ -471,7 +457,7 @@ export class SupplierInfoComponent implements OnInit { } ) } - + // ================== /** To Save/Edited Popup Data */ @@ -491,13 +477,13 @@ export class SupplierInfoComponent implements OnInit { this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe( dataresult => { if (dataresult.status == 200) { - + this.notifier.notify('success', 'Saved Successfully.!'); // this.dialogRef.close(); // alert("sample alert for Saving"); - setTimeout(() =>{ + setTimeout(() => { this.dialogRef.close(); - },3000); + }, 3000); } else { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); @@ -516,72 +502,73 @@ export class SupplierInfoComponent implements OnInit { /** To Reset Popup Data */ onReset() { // this._addQuesFrom.reset(); - } - - selectedPersonDesignation(items,e,flag){ - if(flag == 1){ - e==1 ? items.controls['other_person_designation'].setValidators([Validators.required]) - : items.controls['other_person_designation'].clearValidators(),items.controls['other_person_designation'].setValue(''); - items.controls['other_person_designation'].updateValueAndValidity(); + } + + selectedPersonDesignation(items, e, flag) { + if (flag == 1) { + e == 1 ? items.controls['other_person_designation'].setValidators([Validators.required]) + : items.controls['other_person_designation'].clearValidators(), items.controls['other_person_designation'].setValue(''); + items.controls['other_person_designation'].updateValueAndValidity(); } - else if(flag == 2){ - e==1 ?items.controls['other_person_designation'].setValidators([Validators.required]) - :items.controls['other_person_designation'].clearValidators(),items.controls['other_person_designation'].setValue(''); - items.controls['other_person_designation'].updateValueAndValidity(); + else if (flag == 2) { + e == 1 ? items.controls['other_person_designation'].setValidators([Validators.required]) + : items.controls['other_person_designation'].clearValidators(), items.controls['other_person_designation'].setValue(''); + items.controls['other_person_designation'].updateValueAndValidity(); } } - mfgCreditCardFlag : boolean = false; - trdCreditCardFlag : boolean = false; + mfgCreditCardFlag: boolean = false; + trdCreditCardFlag: boolean = false; mfgCounter: any = []; trdCounter: any = []; - checkCard(e,flag,index){ - if(flag == 2 && e==3){ + checkCard(e, flag, index) { + if (flag == 2 && e == 3) { this.trdCounter[index] = 1; } - else if(flag == 2 && e!=3){ + else if (flag == 2 && e != 3) { this.trdCounter[index] = 0; } let TRD = this.trdCounter.reduce((sum, val) => sum + +val, 0); - this.trdCreditCardFlag = TRD > 0 ? true : false ; + this.trdCreditCardFlag = TRD > 0 ? true : false; - if(flag == 1 && e==3){ + if (flag == 1 && e == 3) { this.mfgCounter[index] = 1; } - else if(flag == 1 && e!=3){ + else if (flag == 1 && e != 3) { this.mfgCounter[index] = 0; } let MFG = this.mfgCounter.reduce((sum, val) => sum + +val, 0); - this.mfgCreditCardFlag = MFG > 0 ? true : false ; + this.mfgCreditCardFlag = MFG > 0 ? true : false; } - selectedPaymentTerms(items,e,flag){ - if(flag == 2){ - if(e==3){ - items.controls['trade_product_credit_days_from'].setValidators([Validators.required]); - items.controls['trade_product_credit_days_to'].setValidators([Validators.required]); + selectedPaymentTerms(items, e, flag) { + if (flag == 2) { + if (e == 3) { + items.controls['trade_product_credit_days_from'].setValidators([Validators.required]); + items.controls['trade_product_credit_days_to'].setValidators([Validators.required]); } - else{ + else { items.controls['trade_product_credit_days_from'].clearValidators(); items.controls['trade_product_credit_days_from'].setValue(''); items.controls['trade_product_credit_days_to'].clearValidators(); items.controls['trade_product_credit_days_to'].setValue(''); } - items.controls['trade_product_credit_days_from'].updateValueAndValidity(); - items.controls['trade_product_credit_days_to'].updateValueAndValidity(); + items.controls['trade_product_credit_days_from'].updateValueAndValidity(); + items.controls['trade_product_credit_days_to'].updateValueAndValidity(); } - else if(flag == 1){ - if(e==3){ items.controls['manufacturing_credit_days_from'].setValidators([Validators.required]); - items.controls['manufacturing_credit_days_to'].setValidators([Validators.required]); - } - else{ + else if (flag == 1) { + if (e == 3) { + items.controls['manufacturing_credit_days_from'].setValidators([Validators.required]); + items.controls['manufacturing_credit_days_to'].setValidators([Validators.required]); + } + else { items.controls['manufacturing_credit_days_from'].clearValidators(); items.controls['manufacturing_credit_days_from'].setValue(''); items.controls['manufacturing_credit_days_to'].clearValidators(); items.controls['manufacturing_credit_days_to'].setValue(''); } - items.controls['manufacturing_credit_days_from'].updateValueAndValidity(); - items.controls['manufacturing_credit_days_to'].updateValueAndValidity(); + items.controls['manufacturing_credit_days_from'].updateValueAndValidity(); + items.controls['manufacturing_credit_days_to'].updateValueAndValidity(); } }