diff --git a/ng6-seed/sineedge_prod_270219.zip b/ng6-seed/sineedge_prod_270219.zip deleted file mode 100644 index 689fbac9d..000000000 Binary files a/ng6-seed/sineedge_prod_270219.zip and /dev/null differ 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 679d7d3a7..0c2c9cc38 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 @@ -327,8 +327,7 @@ export class AddPdComponent implements OnInit, OnDestroy { this.lengthCheckToaddMore = 1; } } - getPincode(e,i){ this.pincodeflag[i] = e == 1 ? true : false; - } + getPincode(e,i){ this.pincodeflag[i] = e == 1 ? true : false;} // save pd in draft saveDraftPD(formValue: any, status: string) { //alert('Inside The Draft PD'); 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 4cdb391c7..3499dfe83 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 @@ -5,187 +5,223 @@ {{pageTitle}}
- - + +
- + - + - - - - Select - - - - {{LL.full_name}} - - - - - - - - - - - - - - - Enter Valid Mobile Number. - - - - - Enter Valid STD Code. -  -  - - - Enter Valid Landline Number. - - - - - - Select - - - {{LB.branch_name}} - - - - - - + + + Select - - - {{PL.product_name}} - - - - - - - - - Select - - - {{SPL.subproduct_name}} - - - - - - - - - Select - - {{CSL.abbr}} - - - - - - - Select - - {{PDL.type_name}} - - - - - - - - - - {{"₹"}} {{loanAmtInWords}} Only - - Enter valid amount. - - - - - - - - - - - Select - - {{SL.name}} - - - - - - - - - Select - - {{CL.city_name}} - - - - - - - - - - - Select - {{PL.pincode}} - - + + + + {{LL.full_name}} + + + - - - Enter Valid Pincode. - - + + + + + + + + + + + Enter + Valid Mobile Number. + + + + + Enter + Valid STD Code. +  -  + + + Enter + Valid Landline Number. + + + + + + Select + + + {{LB.branch_name}} + + + + + + + Select + + + {{PL.product_name}} + + + + + + + + + Select + + + {{SPL.subproduct_name}} + + + + + + + + + Select + + {{CSL.abbr}} + + + + + + + Select + + {{PDL.type_name}} + + + + + + + + + + {{"₹"}} + {{loanAmtInWords}} Only + + Enter valid amount. + + + - - + + + Address Details + + +
+ + + + + + + + Select + + {{SL.name}} + + + + + + + + Select + + {{CL.city_name}} + + + + + + + + Select + {{PL.pincode}} + + + + + + + + + +
+ +
+ +
+ +
+ + + + + +
+
+ +
- Remarks - + Remarks + -
-
- - - -
+ +
+ + + +
- - - - - - - - - - - - - + + \ No newline at end of file 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 0636bcf42..4e8f4c1fb 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 @@ -12,25 +12,30 @@ import { PdTrigerService } from '../../../pd-service/pd-triger.service'; }) export class EditPdMasterComponent implements OnInit { public pageTitle: string = "PD Details"; + pdid: any; errorMessage: any; productList:any; subProductList:any; lenderList:any; customerSegmentList:any; stateList:any; - cityList:any; + cityList:any = []; pdTypeList:any; billingList:any; lenderBranchList: any; pincodeList: any = []; + addressesList : any = [] applicantLength:number; // draftStatus: string; // PDTriggerStatus: string; enablePDButton: boolean; currentPDStatus: string; loanAmtInWords : any; + pincodeflag : any = []; public _EditPDtriggerForm:FormGroup; public notifier: NotifierService; + addresses: FormArray; + // create values for status check pdStatusCheck :any={ "DRAFT" :'DRAFT', @@ -44,8 +49,11 @@ export class EditPdMasterComponent implements OnInit { constructor(private _fb: FormBuilder, private _pd: PdTrigerService, notifier: NotifierService,private dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: any) { + console.log(data); this.notifier=notifier this.currentPDStatus = data.records.pd_status; + this.pdid = data.records.pd_id; + console.log(this.pdid); if(this.data.records.loan_amount){ this.loanAmtInWords = this._pd.convertNumberToWords(this.data.records.loan_amount); } } @@ -57,6 +65,7 @@ export class EditPdMasterComponent implements OnInit { this.getCustomerSegmentList(); this.getStateCityList(); this.getPDTypeList(); + this.getAddresses(); this.loadFormData(); this.applicantLength=this.data.applicantLength; } @@ -81,6 +90,11 @@ export class EditPdMasterComponent implements OnInit { this._EditPDtriggerForm.controls.pd_branch_id.setValue(null); } + getAddresses(){ + + } + + getProductsList(){ this._pd.getProductsDetails().subscribe( data => { @@ -148,8 +162,8 @@ export class EditPdMasterComponent implements OnInit { landline = ''; } } - - this.getCityList(this.data.records.fk_state); + + console.log(this.addressesList); // let getpincodeid = this.data.records.pincode != '' ? this.data.records.pincode != null ? (this.pincodeList.filter(data => data.pincode == this.data.records.pincode).pincode_id) // : this.data.records.pincode // : this.data.records.pincode; @@ -168,14 +182,45 @@ export class EditPdMasterComponent implements OnInit { fk_pd_type: [this.data.records.fk_pd_type], fk_customer_segment: [this.data.records.fk_customer_segment], loan_amount: [this.data.records.loan_amount,Validators.compose([Validators.pattern('^[0-9]*$')])], -   addressline1: [this.data.records.addressline1.toUpperCase()], - fk_city: [this.data.records.fk_city], - fk_state: [this.data.records.fk_state], -   pincode : [this.data.records.pincode_id], - other_pincode:[this.data.records.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])], + addresses: this._fb.array([]), + //   addressline1: [this.data.records.addressline1.toUpperCase()], + // fk_city: [this.data.records.fk_city], + // fk_state: [this.data.records.fk_state], + //   pincode : [this.data.records.pincode_id], + // other_pincode:[this.data.records.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])], remarks: [this.data.records.remarks], - }); - } + }); + const addressesArray = this._EditPDtriggerForm.get('addresses') as FormArray; + this._pd.getAddressesDetails(this.pdid).subscribe( + data => { + if (data.status == 200) { + this.addressesList = data.records; + if (this.addressesList.length > 0) { + console.log(this.addressesList); + this.addressesList.forEach((val,index)=>{ + console.log('val',val); + 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 + } + this.getCityList(val.fk_state,index); + this.getPincode(val.pincode,index); + addressesArray.push(this.createAddresses(obj)); + }); + } + else{ + addressesArray.push(this.createAddresses(null)); + } + } + else{ + addressesArray.push(this.createAddresses(null)); + } + }); + } get pdMain() { return this._EditPDtriggerForm.controls; } @@ -192,17 +237,53 @@ export class EditPdMasterComponent implements OnInit { // this.cityList=this.cityList[0].cities; // } //get city list details based on state id - getCityList(stateID:string){ + getCityList(stateID:string,i){ // console.log('getCityList',stateID); this._pd.getStateWiseCities(stateID).subscribe(data=>{ if (data.status == 200) { // console.log(data); - this.cityList = data.records.cities; - this.pincodeList = data.records.pincode; + this.cityList[i] = data.records.cities; + this.pincodeList[i] = data.records.pincode; } }); } + get pdAddresses() { return this._EditPDtriggerForm.get('addresses') as FormArray; } + createAddresses(data): FormGroup { + if(data == null){ + return this._fb.group({ + fk_pd_id:[this.pdid], + pd_address_id:[null], + addressline: [null], + fk_city: [null], + fk_state: [null], + pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */ + other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])], + }); + } + else{ + return this._fb.group({ + fk_pd_id:[this.pdid], + pd_address_id:[data.pd_address_id], +   addressline: [data.addressline.toUpperCase()], + fk_city: [data.fk_city], + 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]*$')])], + }); + } + }; + addAddresses() { + this.addresses = this._EditPDtriggerForm.get('addresses') as FormArray; + this.addresses.push(this.createAddresses(null)); + } + + removeAddresses(index: number) { + const address_control = this._EditPDtriggerForm.controls['addresses']; + address_control.removeAt(index); + } + + getPincode(e,i){ this.pincodeflag[i] = e == 1 ? true : false;} // save pd in draft saveDraftPD(formValue: any, status:string){ @@ -272,17 +353,17 @@ export class EditPdMasterComponent implements OnInit { this._EditPDtriggerForm.controls['loan_amount'].clearValidators(); this._EditPDtriggerForm.controls['loan_amount'].updateValueAndValidity(); - this._EditPDtriggerForm.controls['addressline1'].clearValidators(); - this._EditPDtriggerForm.controls['addressline1'].updateValueAndValidity(); + // this._EditPDtriggerForm.controls['addressline1'].clearValidators(); + // this._EditPDtriggerForm.controls['addressline1'].updateValueAndValidity(); - this._EditPDtriggerForm.controls['fk_city'].clearValidators(); - this._EditPDtriggerForm.controls['fk_city'].updateValueAndValidity(); + // this._EditPDtriggerForm.controls['fk_city'].clearValidators(); + // this._EditPDtriggerForm.controls['fk_city'].updateValueAndValidity(); - this._EditPDtriggerForm.controls['fk_state'].clearValidators(); - this._EditPDtriggerForm.controls['fk_state'].updateValueAndValidity(); + // this._EditPDtriggerForm.controls['fk_state'].clearValidators(); + // this._EditPDtriggerForm.controls['fk_state'].updateValueAndValidity(); - this._EditPDtriggerForm.controls['pincode'].clearValidators(); - this._EditPDtriggerForm.controls['pincode'].updateValueAndValidity(); + // this._EditPDtriggerForm.controls['pincode'].clearValidators(); + // this._EditPDtriggerForm.controls['pincode'].updateValueAndValidity(); this.validateAllFormFields(this._EditPDtriggerForm); } @@ -320,7 +401,6 @@ export class EditPdMasterComponent implements OnInit { } else{ - let lenderMasterArray = { "pd_id": my_array.pd_id, "fk_lender_id": my_array.fk_lender_id, @@ -334,15 +414,29 @@ 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.addressline1.toUpperCase(), - "fk_city": my_array.fk_city, - "fk_state": my_array.fk_state, -   "pincode": my_array.pincode, - "other_pincode":my_array.other_pincode, +   "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, "remarks": my_array.remarks, } - // console.log(lenderMasterArray); + console.log('my_array.addresses',my_array.addresses); + // return; + + this._pd.updatePDAddress(my_array.addresses).subscribe(result => { + if (result.status == 200) { + this.notifier.notify('success', 'Address Updated.'); + } + else { + this.notifier.notify('warning', 'Something Wents Wrong in Address Try Again.!'); + }//else + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong in Address Try Again.!'); + }); + + console.log(lenderMasterArray); this._pd.editPdMasterDetails(lenderMasterArray, updateStatus).subscribe(result => { if (result.status == 200) { this.notifier.notify('success', 'PD Details Updated.'); diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index 7d3525aee..7add4215b 100755 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -64,8 +64,25 @@ export class PdTrigerService { ) } - //get product and subproduct master details - getProductsDetails(): Observable { + /* To get addresses From T_PD_ADDRESS table., + * Used In 1) edit pd trigger component + * 2) + */ + getAddressesDetails(pdID): Observable { + return this._http.post(this.apiUrl + 'getPDAddress', { "pd_id": pdID }) + .pipe( + catchError(this.handleError('role', [])) + ) + } + + updatePDAddress(editData: any): Observable { + return this._http.post(this.apiUrl + "updatePDAddress", { "records": editData }) + .pipe( + catchError(this.handleError('operation', [])) + ) + } + + getProductsDetails():Observable { return this._http.get(this.apiUrl + 'getListOfProducts') .pipe( catchError(this.handleError('role', []))