edit pd master changes : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-02-28 13:33:54 +05:30
parent 6e33ad94d2
commit 027d607414
5 changed files with 343 additions and 197 deletions

Binary file not shown.

View File

@ -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');

View File

@ -5,7 +5,10 @@
{{pageTitle}}
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="right" mat-dialog-close><mat-icon>close</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close"
matTooltipPosition="right" mat-dialog-close>
<mat-icon>close</mat-icon>
</button>
</div>
</h2>
@ -17,145 +20,186 @@
<mat-card-title>PD Details</mat-card-title>
</mat-card-header> -->
<mat-card-content>
<mat-form-field style="width: 29%">
<mat-select placeholder="Lender Name" formControlName="fk_lender_id">
<mat-option>
Select
</mat-option>
<!-- <mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" > -->
<mat-option (click)="selectedLender(LL)" *ngFor="let LL of lenderList" [value]="LL.entity_id" >
{{LL.full_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_lender_id.hasError('required')" class="mat-text-warn">Lender Name Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder=" Loan Application ID" formControlName="lender_applicant_id" type="text" required>
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder="Lender Contact Person" formControlName="pd_contact_person" type="text" required>
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder="Lender Mobile Number" formControlName="pd_contact_mobileno" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.pd_contact_mobileno.hasError('pattern') || pdMain.pd_contact_mobileno.hasError('maxlength') || pdMain.pd_contact_mobileno.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 10%">
<input matInput placeholder="STD Code" formControlName="lender_stdcode" type="text" (keypress)="keyPress($event)">
<!-- <span matPrefix>+91</span> -->
<mat-error *ngIf="pdMain.lender_stdcode.hasError('maxlength') || pdMain.lender_stdcode.hasError('minlength')">Enter Valid STD Code. </mat-error>
</mat-form-field> &nbsp;-&nbsp;
<mat-form-field style="width: 20%">
<input matInput placeholder="LandLine Number" formControlName="lender_landline" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.lender_landline.hasError('maxlength') || pdMain.lender_landline.hasError('minlength')">Enter Valid Landline Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 21.5%">
<mat-select placeholder="Branch" formControlName="pd_branch_id">
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let LB of lenderBranchList" [value]="LB.entity_lender_branch_id" >
{{LB.branch_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="Product Name" formControlName="fk_product_id" (selectionChange)="getSubproductList(pdMain.fk_product_id.value)">
<mat-option>
<mat-form-field style="width: 29%">
<mat-select placeholder="Lender Name" formControlName="fk_lender_id">
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let PL of productList" [value]="PL.product_id" >
</mat-option>
<!-- <mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" > -->
<mat-option (click)="selectedLender(LL)" *ngFor="let LL of lenderList"
[value]="LL.entity_id">
{{LL.full_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_lender_id.hasError('required')" class="mat-text-warn">Lender Name Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder=" Loan Application ID" formControlName="lender_applicant_id"
type="text" required>
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder="Lender Contact Person" formControlName="pd_contact_person"
type="text" required>
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder="Lender Mobile Number" formControlName="pd_contact_mobileno"
type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.pd_contact_mobileno.hasError('pattern') || pdMain.pd_contact_mobileno.hasError('maxlength') || pdMain.pd_contact_mobileno.hasError('minlength')">Enter
Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 10%">
<input matInput placeholder="STD Code" formControlName="lender_stdcode" type="text"
(keypress)="keyPress($event)">
<!-- <span matPrefix>+91</span> -->
<mat-error *ngIf="pdMain.lender_stdcode.hasError('maxlength') || pdMain.lender_stdcode.hasError('minlength')">Enter
Valid STD Code. </mat-error>
</mat-form-field> &nbsp;-&nbsp;
<mat-form-field style="width: 20%">
<input matInput placeholder="LandLine Number" formControlName="lender_landline"
type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.lender_landline.hasError('maxlength') || pdMain.lender_landline.hasError('minlength')">Enter
Valid Landline Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 21.5%">
<mat-select placeholder="Branch" formControlName="pd_branch_id">
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let LB of lenderBranchList" [value]="LB.entity_lender_branch_id">
{{LB.branch_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="Product Name" formControlName="fk_product_id"
(selectionChange)="getSubproductList(pdMain.fk_product_id.value)">
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let PL of productList" [value]="PL.product_id">
{{PL.product_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_product_id.hasError('required')">Product Required.</mat-error> -->
</mat-form-field>
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_product_id.hasError('required')">Product Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-form-field style="width: 29%">
<mat-select placeholder="Sub product Name" formControlName="fk_subproduct_id">
<mat-option>Select</mat-option>
<mat-select placeholder="Sub product Name" formControlName="fk_subproduct_id">
<mat-option>Select</mat-option>
<mat-option *ngFor="let SPL of subProductList" [value]="SPL.subproduct_id" >
{{SPL.subproduct_name}}
</mat-option>
<mat-option *ngFor="let SPL of subProductList" [value]="SPL.subproduct_id">
{{SPL.subproduct_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_subproduct_id.hasError('required')">Sub Product Required.</mat-error> -->
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_subproduct_id.hasError('required')">Sub Product Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="Customer Segment" formControlName="fk_customer_segment">
<mat-option>Select</mat-option>
<mat-option *ngFor="let CSL of customerSegmentList" [value]="CSL.customer_segment_id">
<!-- {{CSL.customer_segment}} -->{{CSL.abbr}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer Segment Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type">
<mat-option>Select</mat-option>
<mat-option *ngFor="let PDL of pdTypeList" [value]="PDL.pd_type_id">
{{PDL.type_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD Type Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 62%">
<!-- <input matInput placeholder="Loan Amount" formControlName="loan_amount"> -->
<input matInput placeholder="Loan Amount" formControlName="loan_amount"
(keypress)="keyPress($event)" (keyup)="inWords($event,1)" required
autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="pdMain.loan_amount.value != ''">{{"&#8377;"}}
{{loanAmtInWords}} Only</mat-hint>
<!-- <mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount Required.</mat-error> -->
<mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount.
</mat-error>
</mat-form-field>
</mat-card-content>
</mat-card>
<mat-card>
<mat-card-header>
<mat-card-title>Address Details</mat-card-title>
</mat-card-header>
<mat-card-content>
<div formArrayName="addresses" *ngFor="let addresses of pdAddresses.controls; let i = index;">
<mat-card-content [formGroupName]="i">
<mat-form-field style="width: 96%">
<textarea matInput autocomplete="off" placeholder="Address at which PD is to be done"
formControlName="addressline" style="text-transform: uppercase"></textarea>
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="Customer Segment" formControlName="fk_customer_segment">
<mat-option>Select</mat-option>
<mat-option *ngFor="let CSL of customerSegmentList" [value]="CSL.customer_segment_id" >
<!-- {{CSL.customer_segment}} -->{{CSL.abbr}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer Segment Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type">
<mat-option>Select</mat-option>
<mat-option *ngFor="let PDL of pdTypeList" [value]="PDL.pd_type_id" >
{{PDL.type_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD Type Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 62%">
<!-- <input matInput placeholder="Loan Amount" formControlName="loan_amount"> -->
<input matInput placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" (keyup)="inWords($event,1)" required autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="pdMain.loan_amount.value != ''">{{"&#8377;"}} {{loanAmtInWords}} Only</mat-hint>
<!-- <mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount Required.</mat-error> -->
<mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount. </mat-error>
</mat-form-field>
<mat-form-field style="width: 96%">
<textarea matInput placeholder="Address at which PD is to be done" formControlName="addressline1" style="text-transform: uppercase"></textarea>
<!-- <mat-error *ngIf="pdMain.addressline1.hasError('required')">Address1 required.</mat-error> -->
<!-- oninput="this.value = this.value.toUpperCase()" -->
</mat-form-field>
<mat-form-field style="width: 29%;">
<mat-select placeholder="State" formControlName="fk_state" (selectionChange)="getCityList(pdMain.fk_state.value)">
<mat-option>Select</mat-option>
<mat-form-field style="width: 32%">
<mat-select placeholder="State" formControlName="fk_state"
(selectionChange)="getCityList($event.value,i)">
<mat-option> Select </mat-option>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.name}}
{{SL.name}}
</mat-option>
</mat-select>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_state.hasError('required')">State Required.</mat-error> -->
</mat-form-field>
</mat-form-field>
<mat-form-field style="width: 29%;">
<mat-select placeholder="City" formControlName="fk_city">
<mat-option>Select</mat-option>
<mat-option *ngFor="let CL of cityList" [value]="CL.city_id">
<mat-form-field style="width: 32%">
<mat-select placeholder="City" formControlName="fk_city">
<mat-option> Select </mat-option>
<mat-option *ngFor="let CL of cityList[i]" [value]="CL.city_id">
{{CL.city_name}}
</mat-option>
</mat-option>
</mat-select>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_city.hasError('required')">City Required.</mat-error> -->
</mat-form-field>
</mat-form-field>
<mat-form-field style="width: 24%">
<mat-select placeholder="Pincode" formControlName="pincode"
(selectionChange)="getPincode($event.value,i)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let PL of pincodeList[i]" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 24%;">
<!-- <input matInput placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.pincode.hasError('pattern') || pdMain.pincode.hasError('maxlength') || pdMain.pincode.hasError('minlength')">Enter Valid Pincode. </mat-error> -->
<mat-select placeholder="Pincode" formControlName="pincode" >
<mat-option>Select</mat-option>
<mat-option *ngFor="let PL of pincodeList" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 24%" *ngIf="pincodeflag[i]">
<!-- *ngIf="pdAddresses.pincode.value == 1" -->
<input matInput autocomplete="off" placeholder="Specify Pincode"
formControlName="other_pincode" (keypress)="keyPress($event)">
<!-- <mat-error *ngIf="pdAddresses.other_pincode.hasError('maxlength') || pdMain.other_pincode.hasError('minlength')">Enter Valid Pincode. </mat-error> -->
</mat-form-field>
<mat-form-field style="width: 24%" *ngIf="pdMain.pincode.value == 1" >
<input matInput autocomplete="off" placeholder="Specify Pincode" formControlName="other_pincode" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.other_pincode.hasError('pattern') || pdMain.other_pincode.hasError('maxlength') || pdMain.other_pincode.hasError('minlength')">Enter Valid Pincode. </mat-error>
</mat-form-field>
<div align="end" *ngIf="pdAddresses.controls.length > 1">
<button mat-raised-button mat-icon-button matTooltip="Delete"
matTooltipPosition="above" (click)="removeAddresses(i)"
type="button">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-card-content>
</div>
<mat-card-actions align="end">
<button type="button" mat-raised-button mat-icon-button (click)="addAddresses()"
matTooltip="Add More Additional Addresses" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" color="primary" type="button">
<mat-icon>add</mat-icon>
</button>
</mat-card-actions>
</mat-card-content>
</mat-card>
@ -165,27 +209,19 @@
<mat-dialog-actions>
<div fxFlex="70" class="pb-0 text-sm-left" align="left">
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="remarks"></textarea>
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="remarks"></textarea>
</mat-form-field>
</div>
<div fxFlex="30" align="end">
<!-- <button *ngIf="currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" (click)="saveDraftPD(this._EditPDtriggerForm.value,pdStatusCheck.DRAFT)" type="button" matTooltip="Save As Draft" matTooltipPosition="above"><mat-icon>insert_drive_file</mat-icon></button> -->
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Trigger PD" matTooltipPosition="above" type="button" (click)="triggerPD(_EditPDtriggerForm.value, pdStatusCheck.TRIGGERED)"><mat-icon>save</mat-icon></button> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save PD" matTooltipPosition="above" type="button" (click)="triggerPD(_EditPDtriggerForm.value,'')"><mat-icon>save</mat-icon></button>
</div>
</div>
<div fxFlex="30" align="end">
<!-- <button *ngIf="currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" (click)="saveDraftPD(this._EditPDtriggerForm.value,pdStatusCheck.DRAFT)" type="button" matTooltip="Save As Draft" matTooltipPosition="above"><mat-icon>insert_drive_file</mat-icon></button> -->
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Trigger PD" matTooltipPosition="above" type="button" (click)="triggerPD(_EditPDtriggerForm.value, pdStatusCheck.TRIGGERED)"><mat-icon>save</mat-icon></button> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save PD"
matTooltipPosition="above" type="button" (click)="triggerPD(_EditPDtriggerForm.value,'')">
<mat-icon>save</mat-icon>
</button>
</div>
</mat-dialog-actions>
</form>
</form>
<notifier-container></notifier-container>

View File

@ -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<EditPdMasterComponent>,
@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 => {
@ -149,7 +163,7 @@ export class EditPdMasterComponent implements OnInit {
}
}
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 = <FormArray>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.');

View File

@ -64,8 +64,25 @@ export class PdTrigerService {
)
}
//get product and subproduct master details
getProductsDetails(): Observable<any> {
/* To get addresses From T_PD_ADDRESS table.,
* Used In 1) edit pd trigger component
* 2)
*/
getAddressesDetails(pdID): Observable<any> {
return this._http.post<any>(this.apiUrl + 'getPDAddress', { "pd_id": pdID })
.pipe(
catchError(this.handleError('role', []))
)
}
updatePDAddress(editData: any): Observable<any> {
return this._http.post<any>(this.apiUrl + "updatePDAddress", { "records": editData })
.pipe(
catchError(this.handleError('operation', []))
)
}
getProductsDetails():Observable<any> {
return this._http.get<any>(this.apiUrl + 'getListOfProducts')
.pipe(
catchError(this.handleError('role', []))