diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html index a318ff1b6..98a62fead 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html @@ -209,7 +209,7 @@ - + Enter Valid Mobile Number. @@ -252,7 +252,7 @@ --> - + Enter Valid Mobile Number. diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts index 0c2c9cc38..0356cf288 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts @@ -89,8 +89,8 @@ export class AddPdComponent implements OnInit, OnDestroy { fk_customer_segment: [null], loan_amount: [null, Validators.compose([Validators.pattern('^[0-9]*$')])], applicant_title_name: [''], - applicant_name: [null], - mobile_no: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(10)])], + applicant_name: [null,Validators.compose([Validators.required])], + mobile_no: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(10),Validators.required])], // landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])], // email: [null], applicant_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])], @@ -251,7 +251,7 @@ export class AddPdComponent implements OnInit, OnDestroy { label: ['Applicant'], applicant_title_name:[null], coapplicant_name: [null, Validators.compose([Validators.required])], - coapplicant_mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10),Validators.required])], + coapplicant_mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])], coapplicant_stdcode:[null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])], coapplicant_landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])], company_name:[null], diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html index 3499dfe83..267f274f1 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html @@ -133,13 +133,15 @@ - - - Address Details - - -
- + + +
+ + + Address Details #{{i+1}} Deactivited + + + @@ -181,28 +183,27 @@ -
- -
+
+ - + + + + +
- + - - - -
- + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts index 7d5ce2e2a..b8c2025d6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts @@ -24,7 +24,8 @@ export class EditPdMasterComponent implements OnInit { billingList:any; lenderBranchList: any; pincodeList: any = []; - addressesList : any = [] + addressesList : any = []; + addressesDeactivited : any = []; applicantLength:number; // draftStatus: string; // PDTriggerStatus: string; @@ -188,18 +189,19 @@ export class EditPdMasterComponent implements OnInit { this._pd.getAddressesDetails(this.pdid).subscribe( data => { if (data.status == 200) { - this.addressesList = data.records; + this.addressesList = data.records.filter(item => item.isactive == 1); if (this.addressesList.length > 0) { this.addressesList.forEach((val,index)=>{ - + this.addressesDeactivited[index] = true; let obj = { pd_address_id:val.pd_address_id, addressline: val.addressline.toUpperCase(), fk_city: val.fk_city, fk_state: val.fk_state,   pincode: val.pincode, - other_pincode:val.other_pincode + other_pincode:val.other_pincode, + isactive:1, } this.getCityList(val.fk_state,index); this.getPincode(val.pincode,index); @@ -253,6 +255,7 @@ export class EditPdMasterComponent implements OnInit { fk_state: [null], pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */ other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])], + isactive:[1], }); } else{ @@ -264,6 +267,7 @@ export class EditPdMasterComponent implements OnInit { fk_state: [data.fk_state],   pincode : [data.pincode], other_pincode:[data.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])], + isactive:[data.isactive], }); } }; @@ -274,7 +278,26 @@ export class EditPdMasterComponent implements OnInit { removeAddresses(index: number) { const address_control = this._EditPDtriggerForm.controls['addresses']; - address_control.removeAt(index); + address_control.controls[index]['controls'].isactive.setValue(0); + this.addressesDeactivited[index] = false; + console.log('address_control',address_control); + console.log('address_control.controls[index]',address_control.controls[index]); + console.log('address_control.controls[index][controls]',address_control.controls[index]['controls']); + + // address_control.controls[index]['controls'].showHide(); + // isactive.setValue(0); + // this.showHide = true; + // var div = document.getElementById('newpost'); + // if (div.style.display !== 'none') { + // div.style.display = 'none'; + // } + // else { + // div.style.display = 'block'; + // } + + // address_control.controls[index].disable(); + // console.log('address_control',address_control); + // address_control.removeAt(index); } getPincode(e,i){ this.pincodeflag[i] = e == 1 ? true : false;} @@ -394,7 +417,8 @@ export class EditPdMasterComponent implements OnInit { return; } else{ - + console.log('my_array.addresses',my_array.addresses); + let filteredAddressesdata = my_array.addresses.filter(item => item.isactive == 1); let lenderMasterArray = { "pd_id": my_array.pd_id, "fk_lender_id": my_array.fk_lender_id, @@ -408,11 +432,11 @@ export class EditPdMasterComponent implements OnInit { "fk_pd_type": my_array.fk_pd_type, "fk_customer_segment": my_array.fk_customer_segment, "loan_amount": my_array.loan_amount, -   "addressline1": my_array.addresses[0].addressline.toUpperCase(), - "fk_city": my_array.addresses[0].fk_city, - "fk_state": my_array.addresses[0].fk_state, -   "pincode": my_array.addresses[0].pincode, - "other_pincode":my_array.addresses[0].other_pincode, +   "addressline1": filteredAddressesdata[0].addressline.toUpperCase(), + "fk_city": filteredAddressesdata[0].fk_city, + "fk_state": filteredAddressesdata[0].fk_state, +   "pincode": filteredAddressesdata[0].pincode, + "other_pincode":filteredAddressesdata[0].other_pincode, "remarks": my_array.remarks, } 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 09fa21f6f..fdc64932a 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 @@ -113,7 +113,8 @@ 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(); @@ -214,7 +215,8 @@ export class AddressComponent implements OnInit { this._pd.getAddressesDetails(this.pdid).subscribe( data => { if (data.status == 200) { - this.addressesList = data.records; + this.addressesList = data.records.filter(item => item.isactive == 1); + if (this.addressesList.length > 0) { this.addressesList.forEach((val,index)=>{ let obj = { 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 fcfd379ac..46415f365 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 @@ -15,147 +15,149 @@ -
-
- - - -

Address Details {{addressLabel | titlecase}}

-
-
+
+
+
+
+
+ + + +

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

+
+
-
- - - Select - Yes - No - - -
+
+ + + Select + Yes + No + + +
-
-
- - - - {{yearErrorMessage}} - Year's - Required - - - - {{monthErrorMessage}} - - -
- - - - - Yes - No - - Field - Required - - - - - - Remarks - Required - - -
- -
-
-
-
- - - - Select - Owned - Rented - +
+
+ + + + {{yearErrorMessage[i]}} + - - - - {{"₹"}} - {{RentAmtInwordsForAddress[i]}} Only - Monthly Rent Amount Required + + + {{monthErrorMessage[i]}} + +
-
- - - - {{"₹"}} - {{appxMarketAmtInwordsForAddress[i]}} Only - - - - - - - {{val.name}} - - - - Asset Owned by Required - - - - - - - - Approx Vintage - - - - - - Purchase Year - - - -
+ + + Yes + No + + + - -
- - + + + + + +
+ +
+ + + Select - Yes - No + Owned + Rented + + + + {{"₹"}} + {{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 823967f62..e07e65061 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 @@ -28,7 +28,8 @@ export class BusinessAssetsInfoComponent implements OnInit { /**Declaration of Form Fields Variables */ pdid: string; company_id: any; - placeholderName: any = 'Was any business activity seen at the Address Type during PD visit?'; + placeholderName: any = []; + // 'Was any business activity seen at the Address Type during PD visit?'; private notifier: NotifierService; public _businessAssetsQuesFrom: FormGroup; public submitted = false; @@ -39,10 +40,10 @@ export class BusinessAssetsInfoComponent implements OnInit { CustSegAbbr: any; generalExistBusinessYear: Number; generalExistBusinessMonth: Number; - yearErrorMessage: any; - monthErrorMessage: any; + yearErrorMessage: any = []; + monthErrorMessage: any = []; currentYear: any = new Date().getFullYear(); - addressLabel: any; + addressLabel: any = []; /**Declaration of Dropdown And Array */ public applicants: any; @@ -120,25 +121,6 @@ export class BusinessAssetsInfoComponent implements OnInit { this.getM_PropertyType(); this.getM_Address_Type(); this.getM_Vehicle_Type(); - - let params: any = {}; - params.pd_id = this.pdid; - params.pd_form_id = '5'; - - this.pdTrigerService.retriveForm(params).subscribe(data => { - if (data.status == 200) { - - this.addressLabel = ''; - - let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == data.records.address_type)[0]; - let address = data.records.address; - let addressType = data.records.address_type != 1 ? selectedAddressType.address_type : data.records.address_type_others; - - this.placeholderName = 'Was any business activity seen at the ' + addressType + ' during PD visit?'; - this.addressLabel = " : " + address + ' / ' + addressType; - - } - }); } /** Assets Type For Dropdown List */ @@ -203,6 +185,79 @@ export class BusinessAssetsInfoComponent implements OnInit { } ); } + loadaddresses(){ + console.log('function inside loaded'); + 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); + + 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: '' + } + + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + control.push(this.initBusinessAddressDetailsWithdata(vals)); + }); + } + else{ + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + control.push(this.initBusinessAddressDetails()); + } + } + 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], + // business_is_pd_visited: [value.business_is_pd_visited], + // 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() ]), /** load Form Data */ formLoadData(val) { @@ -212,38 +267,31 @@ export class BusinessAssetsInfoComponent implements OnInit { pdid: [this.pdid], formid: ['22'], company_id: [this.company_id], - business_years: [value.business_years], - business_month: [value.business_month], - business_address_availability: [value.business_address_availability], - business_is_pd_visited: [value.business_is_pd_visited], - business_pd_visited_remark: [value.business_pd_visited_remark], + // business_address_details: this._formBuilder.array([]), business_assets_for_address: this._formBuilder.array([]), business_assets_details: this._formBuilder.array([]), business_assets_form_remark: [value.business_assets_form_remark || null] }); - if (value.business_address_availability == 'yes') { + // if (value.business_address_availability == 'yes') { - this.addBusinessAssetsForAddress(value.business_assets_for_address); - } - else { - const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; - control.push(this.createBusinessAssetsForAddress()); - } + // this.addBusinessAssetsForAddress(value.business_assets_for_address); + // } + // else { + // const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + // control.push(this.createBusinessAssetsForAddress()); + // } + this.addBusinessAddressAssetsDetailsWithData(value.business_assets_for_address); this.addBusinessAssetsDetailsWithData(value.business_assets_details); } else { this._businessAssetsQuesFrom = this._formBuilder.group({ 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_years: [''], - business_month: [''], - business_address_availability: [''], - business_is_pd_visited: [''], - business_pd_visited_remark: [''], - business_assets_for_address: this._formBuilder.array([ this.createBusinessAssetsForAddress() ]), business_assets_form_remark: [''] }); + this.loadaddresses(); } this.loadDetails = true; } @@ -267,19 +315,41 @@ export class BusinessAssetsInfoComponent implements OnInit { business_emi: [''], }); } - - createBusinessAssetsForAddress(): FormGroup { + + + initBusinessAddressDetails() { return this._formBuilder.group({ - 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: [''], + // 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: [''] + // }); + // } selectedPropertyOwnedType(e, s, i) { @@ -387,18 +457,18 @@ export class BusinessAssetsInfoComponent implements OnInit { } - createBusinessAssetsForAddressWithData(data): FormGroup { - return this._formBuilder.group({ - 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] - }); - } + // createBusinessAssetsForAddressWithData(data): FormGroup { + // return this._formBuilder.group({ + // 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] + // }); + // } initBusinessDetailsWithdata(data) { @@ -417,49 +487,117 @@ export class BusinessAssetsInfoComponent implements OnInit { return formGroup; } - - addBusinessAssetsForAddress(data) { - - var result = Object.keys(data).map(function (key) { - return data[key]; + 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 || ''], }); - 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 = Avaliablity == 0 ? true : false; + } + // addBusinessAssetsForAddress(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; + // } + // }); + // } + // this.isOtherOwnerForAddress = Avaliablity == 0 ? true : false; + + // }); + + // for (let val of result) { + // let vals = { + // 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.createBusinessAssetsForAddressWithData(vals)); + // } + // } else { + // const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + // control.push(this.createBusinessAssetsForAddress()); + // } + // } + + addBusinessAddressAssetsDetailsWithData(data) { + + var result = Object.keys(data).map(function (key) { + return data[key]; }); - for (let val of result) { - let vals = { - 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.createBusinessAssetsForAddressWithData(vals)); - } - } else { - const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; - control.push(this.createBusinessAssetsForAddress()); - } - } + 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 = 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 { + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + control.push(this.initBusinessAddressDetails()); + } + } + addBusinessAssetsDetailsWithData(supp_data) { var result = Object.keys(supp_data).map(function (key) { @@ -647,9 +785,20 @@ export class BusinessAssetsInfoComponent implements OnInit { /** To Convert Month into Year */ - ConvertMonthintoYear(e) { + 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; - let business_year = this._businessAssetsQuesFrom.controls.business_years.value; + // console.log('address_control',address_control); + + let business_year = control.controls[i]['controls'].business_years.value; let converted_month: number = e % 12; let converted_year: number = e / 12; @@ -657,35 +806,41 @@ export class BusinessAssetsInfoComponent implements OnInit { let Year = +business_year + +Math.floor(converted_year); if (Year > this.generalExistBusinessYear) { - this.yearErrorMessage = "Higher than Business Vintage"; - this._businessAssetsQuesFrom.controls.business_years.setValue(''); - this._businessAssetsQuesFrom.controls.business_month.setValue(''); + this.yearErrorMessage[i] = "Higher than Business Vintage"; + // this._businessAssetsQuesFrom.controls.business_years.setValue(''); + control.controls[i]['controls'].business_years.setValue(''); + // this._businessAssetsQuesFrom.controls.business_month.setValue(''); + control.controls[i]['controls'].business_month.setValue(''); } else { if (Year == this.generalExistBusinessYear && +converted_month > this.generalExistBusinessMonth) { - this.monthErrorMessage = "Higher than Business Vintage"; - this._businessAssetsQuesFrom.controls.business_years.setValue(''); - this._businessAssetsQuesFrom.controls.business_month.setValue(''); + this.monthErrorMessage[i] = "Higher than Business Vintage"; + // this._businessAssetsQuesFrom.controls.business_years.setValue(''); + control.controls[i]['controls'].business_years.setValue(''); + control.controls[i]['controls'].business_month.setValue(''); + // this._businessAssetsQuesFrom.controls.business_month.setValue(''); } else { - this.monthErrorMessage = ''; - this.yearErrorMessage = ''; - this._businessAssetsQuesFrom.controls.business_years.setValue(+business_year + +Math.floor(converted_year)); - this._businessAssetsQuesFrom.controls.business_month.setValue(Math.floor(converted_month)); + this.monthErrorMessage[i] = ''; + this.yearErrorMessage[i] = ''; + // this._businessAssetsQuesFrom.controls.business_years.setValue(+business_year + +Math.floor(converted_year)); + control.controls[i]['controls'].business_years.setValue(+business_year + +Math.floor(converted_year)); + control.controls[i]['controls'].business_month.setValue(Math.floor(converted_month)); + // this._businessAssetsQuesFrom.controls.business_month.setValue(Math.floor(converted_month)); } } } - checkWithExistBusinessYear(e) { - + checkWithExistBusinessYear(e,i) { + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; if (+e > this.generalExistBusinessYear) { - this.yearErrorMessage = "Higher than Business Vintage"; - this._businessAssetsQuesFrom.controls.business_years.setValue(''); - + this.yearErrorMessage[i] = "Higher than Business Vintage"; + // this._businessAssetsQuesFrom.controls.business_years.setValue(''); + control.controls[i]['controls'].business_years.setValue(''); } else { - this.yearErrorMessage = ''; + this.yearErrorMessage[i] = ''; } } @@ -693,23 +848,23 @@ export class BusinessAssetsInfoComponent implements OnInit { if (flag == 1) { if (value == 'yes') { - this._businessAssetsQuesFrom.controls.business_years.setValidators([Validators.required]); - this._businessAssetsQuesFrom.controls.business_address_availability.setValidators([Validators.required]); - this._businessAssetsQuesFrom.controls.business_is_pd_visited.setValidators([Validators.required]); - this._businessAssetsQuesFrom.controls.business_pd_visited_remark.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]); } else { - this._businessAssetsQuesFrom.controls.business_years.clearValidators(); - this._businessAssetsQuesFrom.controls.business_address_availability.clearValidators(); - this._businessAssetsQuesFrom.controls.business_is_pd_visited.clearValidators(); - this._businessAssetsQuesFrom.controls.business_pd_visited_remark.clearValidators(); + item.controls.business_years.clearValidators(); + item.controls.business_address_availability.clearValidators(); + item.controls.business_is_pd_visited.clearValidators(); + item.controls.business_pd_visited_remark.clearValidators(); } - this._businessAssetsQuesFrom.controls.business_years.updateValueAndValidity(); - this._businessAssetsQuesFrom.controls.business_address_availability.updateValueAndValidity(); - this._businessAssetsQuesFrom.controls.business_is_pd_visited.updateValueAndValidity(); - this._businessAssetsQuesFrom.controls.business_pd_visited_remark.updateValueAndValidity(); + item.controls.business_years.updateValueAndValidity(); + item.controls.business_address_availability.updateValueAndValidity(); + item.controls.business_is_pd_visited.updateValueAndValidity(); + item.controls.business_pd_visited_remark.updateValueAndValidity(); } if (flag == 3) { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts index 00a27ad3f..ece128c1e 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts @@ -189,6 +189,7 @@ export class ClientInfoComponent implements OnInit { data => { if (data.dataStatus) { let dataForm = data.records; + console.log(dataForm); if (dataForm !== undefined) { this._supplierQuesFrom = this._formBuilder.group({ pdid: [this.pdid], @@ -206,10 +207,26 @@ export class ClientInfoComponent implements OnInit { // let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) { // return dataForm.main_raw_materials[key]; // }); - let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials; + // 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); + // 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); + if(dataForm.manufacturing_details[0] !== null){ + alert('not null manu'); + let api_main_raw_materials = Object.keys(dataForm.manufacturing_details).map(function (key) { + return dataForm.manufacturing_details[key]; + }); + + this.initManufacturingProductsDetails(api_main_raw_materials[0]['main_raw_materials']); + this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(api_main_raw_materials[0]['main_raw_materials_total_payments_percent_on_credit'] || null); + + } + else{ + alert('null manu'); + this.initManufacturingProductsDetails(null); + this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); + + } } // Load form details for the wholeshale trading details @@ -218,10 +235,26 @@ export class ClientInfoComponent implements OnInit { // 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; + // 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); + // 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); + if(dataForm.trade_details[0] !== null){ + // alert('not null manu'); + let api_trading_products = Object.keys(dataForm.trade_details).map(function (key) { + return dataForm.trade_details[key]; + }); + + this.initTradingProductsDetails(api_trading_products[0]['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{ + // alert('null manu'); + this.initTradingProductsDetails(null);- + this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null); + + } } // Load form details for the service provider prduct details @@ -230,9 +263,28 @@ export class ClientInfoComponent implements OnInit { // let api_service_provider_products = Object.keys(dataForm.service_products).map(function (key) { // return dataForm.service_products[key]; // }); - let api_service_provider_products = dataForm.service_provider_details[0].service_products; - this.initServiceProviderProductsDetails(api_service_provider_products); - this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_provider_details[0].service_products_total_payments_percent_on_credit || null); + // let api_service_provider_products = dataForm.service_provider_details[0].service_products; + // this.initServiceProviderProductsDetails(api_service_provider_products); + // this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_provider_details[0].service_products_total_payments_percent_on_credit || null); + if(dataForm.service_provider_details[0] !== null){ + // alert('not null manu'); + let api_service_provider_products = Object.keys(dataForm.manufacturing_details).map(function (key) { + return dataForm.manufacturing_details[key]; + }); + + this.initServiceProviderProductsDetails(api_service_provider_products[0]['service_products']); + // this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_provider_details[0].service_products_total_payments_percent_on_credit || null); + this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(api_service_provider_products[0]['service_products_total_payments_percent_on_credit'] || null); + + } + else{ + // alert('null manu'); + + this.initServiceProviderProductsDetails(null); + // this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_provider_details[0].service_products_total_payments_percent_on_credit || null); + this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); + + } } // Load form details for the retail trading details let arr3 = record.filter(data => data.type_of_activity_id == 3); 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 0e4ecf5fc..c9bbb1644 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 @@ -184,14 +184,24 @@ 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; let AssetData = data.record; + 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, @@ -224,7 +234,14 @@ export class CurrentLoanComponent implements OnInit { 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] = val.mode_name +' - '+owner ; + } + if(val.mode == 1){ let data; let owner diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html index 555a7e7d0..066c7a06d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html @@ -425,7 +425,7 @@ - diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts index d33f1119e..3fe463f71 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 @@ -138,16 +138,30 @@ export class StockComponent implements OnInit { } public initstockForms(record){ - + console.log('record.from_business',record.from_business); 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); - let type2length = type2[0].products ? type2[0].products.length : 0; + 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].products ? type2[0].products.length : 0; + 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].products ? type2[0].products.length : 0; + 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; 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 b886b1229..b28db9ad2 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 @@ -183,19 +183,53 @@ export class SupplierInfoComponent implements OnInit { // let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) { // return dataForm.main_raw_materials[key]; // }); - let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials; + // 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); - } + // 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); + if(dataForm.manufacturing_details[0] !== null){ + // alert('not null manu'); + let api_main_raw_materials = Object.keys(dataForm.manufacturing_details).map(function (key) { + return dataForm.manufacturing_details[key]; + }); + + this.initManufacturingProductsDetails(api_main_raw_materials[0]['main_raw_materials']); + this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(api_main_raw_materials[0]['main_raw_materials_total_payments_percent_on_credit'] || null); + + } + else{ + // alert('null manu'); + 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) { + console.log('saas'); // 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); + // 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); + if(dataForm.trade_details[0] !== null){ + alert('not null trade'); + let api_trading_products = Object.keys(dataForm.trade_details).map(function (key) { + return dataForm.trade_details[key]; + }); + console.log(api_trading_products[0]['trading_products']); + this.initTradingProductsDetails(api_trading_products[0]['trading_products']); + // this.initTradingProductsDetails(api_trading_products['trading_products']); + this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(api_trading_products[0]['trading_products_total_payments_percent_on_credit'] || null); + } + else{ + alert('null trade'); + this.initTradingProductsDetails(null); + this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null); + + } + } } this.noRecordsFound = true; } else { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html index b8d292d2f..570a1eac6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html @@ -92,17 +92,32 @@
-
-
-
- - -
-
- {{master.addressline1}},
{{master.city_name}},
{{master.state_name}}-{{master.pincode_id == 1 ? master.other_pincode : master.pincode }}
-
-
-
+ + + +
+
+
+
+ + +
+
+ {{addresses.addressline}},
{{addresses.city_name}},
{{addresses.state_name}}-{{addresses.pincode == 1 ? addresses.other_pincode : addresses.pincode_display }}
+
+
+
+
+