edit pd master changes : ps
This commit is contained in:
parent
6e33ad94d2
commit
027d607414
Binary file not shown.
@ -327,8 +327,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
|||||||
this.lengthCheckToaddMore = 1;
|
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
|
// save pd in draft
|
||||||
saveDraftPD(formValue: any, status: string) {
|
saveDraftPD(formValue: any, status: string) {
|
||||||
//alert('Inside The Draft PD');
|
//alert('Inside The Draft PD');
|
||||||
|
|||||||
@ -5,7 +5,10 @@
|
|||||||
{{pageTitle}}
|
{{pageTitle}}
|
||||||
</div>
|
</div>
|
||||||
<div fxFlex="30" align="end" style="padding: 10px !important;">
|
<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>
|
</div>
|
||||||
</h2>
|
</h2>
|
||||||
@ -23,7 +26,8 @@
|
|||||||
Select
|
Select
|
||||||
</mat-option>
|
</mat-option>
|
||||||
<!-- <mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" > -->
|
<!-- <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" >
|
<mat-option (click)="selectedLender(LL)" *ngFor="let LL of lenderList"
|
||||||
|
[value]="LL.entity_id">
|
||||||
{{LL.full_name}}
|
{{LL.full_name}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
@ -32,23 +36,31 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field style="width: 29%">
|
<mat-form-field style="width: 29%">
|
||||||
<input matInput placeholder=" Loan Application ID" formControlName="lender_applicant_id" type="text" required>
|
<input matInput placeholder=" Loan Application ID" formControlName="lender_applicant_id"
|
||||||
|
type="text" required>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 29%">
|
<mat-form-field style="width: 29%">
|
||||||
<input matInput placeholder="Lender Contact Person" formControlName="pd_contact_person" type="text" required>
|
<input matInput placeholder="Lender Contact Person" formControlName="pd_contact_person"
|
||||||
|
type="text" required>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 29%">
|
<mat-form-field style="width: 29%">
|
||||||
<input matInput placeholder="Lender Mobile Number" formControlName="pd_contact_mobileno" type="text" (keypress)="keyPress($event)">
|
<input matInput placeholder="Lender Mobile Number" formControlName="pd_contact_mobileno"
|
||||||
<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>
|
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>
|
||||||
<mat-form-field style="width: 10%">
|
<mat-form-field style="width: 10%">
|
||||||
<input matInput placeholder="STD Code" formControlName="lender_stdcode" type="text" (keypress)="keyPress($event)">
|
<input matInput placeholder="STD Code" formControlName="lender_stdcode" type="text"
|
||||||
|
(keypress)="keyPress($event)">
|
||||||
<!-- <span matPrefix>+91</span> -->
|
<!-- <span matPrefix>+91</span> -->
|
||||||
<mat-error *ngIf="pdMain.lender_stdcode.hasError('maxlength') || pdMain.lender_stdcode.hasError('minlength')">Enter Valid STD Code. </mat-error>
|
<mat-error *ngIf="pdMain.lender_stdcode.hasError('maxlength') || pdMain.lender_stdcode.hasError('minlength')">Enter
|
||||||
|
Valid STD Code. </mat-error>
|
||||||
</mat-form-field> -
|
</mat-form-field> -
|
||||||
<mat-form-field style="width: 20%">
|
<mat-form-field style="width: 20%">
|
||||||
<input matInput placeholder="LandLine Number" formControlName="lender_landline" type="text" (keypress)="keyPress($event)">
|
<input matInput placeholder="LandLine Number" formControlName="lender_landline"
|
||||||
<mat-error *ngIf="pdMain.lender_landline.hasError('maxlength') || pdMain.lender_landline.hasError('minlength')">Enter Valid Landline Number. </mat-error>
|
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>
|
||||||
<mat-form-field style="width: 21.5%">
|
<mat-form-field style="width: 21.5%">
|
||||||
<mat-select placeholder="Branch" formControlName="pd_branch_id">
|
<mat-select placeholder="Branch" formControlName="pd_branch_id">
|
||||||
@ -62,7 +74,8 @@
|
|||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 29%">
|
<mat-form-field style="width: 29%">
|
||||||
<mat-select placeholder="Product Name" formControlName="fk_product_id" (selectionChange)="getSubproductList(pdMain.fk_product_id.value)">
|
<mat-select placeholder="Product Name" formControlName="fk_product_id"
|
||||||
|
(selectionChange)="getSubproductList(pdMain.fk_product_id.value)">
|
||||||
<mat-option>
|
<mat-option>
|
||||||
Select
|
Select
|
||||||
</mat-option>
|
</mat-option>
|
||||||
@ -108,55 +121,86 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 62%">
|
<mat-form-field style="width: 62%">
|
||||||
<!-- <input matInput placeholder="Loan Amount" formControlName="loan_amount"> -->
|
<!-- <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">
|
<input matInput placeholder="Loan Amount" formControlName="loan_amount"
|
||||||
<mat-hint align="start" style="font-size:90%" *ngIf="pdMain.loan_amount.value != ''">{{"₹"}} {{loanAmtInWords}} Only</mat-hint>
|
(keypress)="keyPress($event)" (keyup)="inWords($event,1)" required
|
||||||
|
autocomplete="off">
|
||||||
|
<mat-hint align="start" style="font-size:90%" *ngIf="pdMain.loan_amount.value != ''">{{"₹"}}
|
||||||
|
{{loanAmtInWords}} Only</mat-hint>
|
||||||
<!-- <mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount Required.</mat-error> -->
|
<!-- <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-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount.
|
||||||
|
</mat-error>
|
||||||
|
|
||||||
</mat-form-field>
|
</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%">
|
<mat-form-field style="width: 96%">
|
||||||
<textarea matInput placeholder="Address at which PD is to be done" formControlName="addressline1" style="text-transform: uppercase"></textarea>
|
<textarea matInput autocomplete="off" placeholder="Address at which PD is to be done"
|
||||||
<!-- <mat-error *ngIf="pdMain.addressline1.hasError('required')">Address1 required.</mat-error> -->
|
formControlName="addressline" style="text-transform: uppercase"></textarea>
|
||||||
<!-- oninput="this.value = this.value.toUpperCase()" -->
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 29%;">
|
|
||||||
|
|
||||||
<mat-select placeholder="State" formControlName="fk_state" (selectionChange)="getCityList(pdMain.fk_state.value)">
|
<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> Select </mat-option>
|
||||||
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
|
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
|
||||||
{{SL.name}}
|
{{SL.name}}
|
||||||
</mat-option>
|
</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-form-field style="width: 32%">
|
||||||
<mat-select placeholder="City" formControlName="fk_city">
|
<mat-select placeholder="City" formControlName="fk_city">
|
||||||
<mat-option> Select </mat-option>
|
<mat-option> Select </mat-option>
|
||||||
<mat-option *ngFor="let CL of cityList" [value]="CL.city_id">
|
<mat-option *ngFor="let CL of cityList[i]" [value]="CL.city_id">
|
||||||
{{CL.city_name}}
|
{{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-form-field style="width: 24%;">
|
<mat-select placeholder="Pincode" formControlName="pincode"
|
||||||
<!-- <input matInput placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)">
|
(selectionChange)="getPincode($event.value,i)">
|
||||||
<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>Select</mat-option>
|
||||||
<mat-option *ngFor="let PL of pincodeList" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
|
<mat-option *ngFor="let PL of pincodeList[i]" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field style="width: 24%" *ngIf="pdMain.pincode.value == 1" >
|
<mat-form-field style="width: 24%" *ngIf="pincodeflag[i]">
|
||||||
<input matInput autocomplete="off" placeholder="Specify Pincode" formControlName="other_pincode" (keypress)="keyPress($event)">
|
<!-- *ngIf="pdAddresses.pincode.value == 1" -->
|
||||||
<mat-error *ngIf="pdMain.other_pincode.hasError('pattern') || pdMain.other_pincode.hasError('maxlength') || pdMain.other_pincode.hasError('minlength')">Enter Valid Pincode. </mat-error>
|
<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>
|
||||||
|
|
||||||
|
<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-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|
||||||
@ -172,20 +216,12 @@
|
|||||||
<div fxFlex="30" align="end">
|
<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 *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="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>
|
<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>
|
||||||
</mat-dialog-actions>
|
</mat-dialog-actions>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
<notifier-container></notifier-container>
|
<notifier-container></notifier-container>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -12,25 +12,30 @@ import { PdTrigerService } from '../../../pd-service/pd-triger.service';
|
|||||||
})
|
})
|
||||||
export class EditPdMasterComponent implements OnInit {
|
export class EditPdMasterComponent implements OnInit {
|
||||||
public pageTitle: string = "PD Details";
|
public pageTitle: string = "PD Details";
|
||||||
|
pdid: any;
|
||||||
errorMessage: any;
|
errorMessage: any;
|
||||||
productList:any;
|
productList:any;
|
||||||
subProductList:any;
|
subProductList:any;
|
||||||
lenderList:any;
|
lenderList:any;
|
||||||
customerSegmentList:any;
|
customerSegmentList:any;
|
||||||
stateList:any;
|
stateList:any;
|
||||||
cityList:any;
|
cityList:any = [];
|
||||||
pdTypeList:any;
|
pdTypeList:any;
|
||||||
billingList:any;
|
billingList:any;
|
||||||
lenderBranchList: any;
|
lenderBranchList: any;
|
||||||
pincodeList: any = [];
|
pincodeList: any = [];
|
||||||
|
addressesList : any = []
|
||||||
applicantLength:number;
|
applicantLength:number;
|
||||||
// draftStatus: string;
|
// draftStatus: string;
|
||||||
// PDTriggerStatus: string;
|
// PDTriggerStatus: string;
|
||||||
enablePDButton: boolean;
|
enablePDButton: boolean;
|
||||||
currentPDStatus: string;
|
currentPDStatus: string;
|
||||||
loanAmtInWords : any;
|
loanAmtInWords : any;
|
||||||
|
pincodeflag : any = [];
|
||||||
public _EditPDtriggerForm:FormGroup;
|
public _EditPDtriggerForm:FormGroup;
|
||||||
public notifier: NotifierService;
|
public notifier: NotifierService;
|
||||||
|
addresses: FormArray;
|
||||||
|
|
||||||
// create values for status check
|
// create values for status check
|
||||||
pdStatusCheck :any={
|
pdStatusCheck :any={
|
||||||
"DRAFT" :'DRAFT',
|
"DRAFT" :'DRAFT',
|
||||||
@ -44,8 +49,11 @@ export class EditPdMasterComponent implements OnInit {
|
|||||||
constructor(private _fb: FormBuilder,
|
constructor(private _fb: FormBuilder,
|
||||||
private _pd: PdTrigerService, notifier: NotifierService,private dialogRef: MatDialogRef<EditPdMasterComponent>,
|
private _pd: PdTrigerService, notifier: NotifierService,private dialogRef: MatDialogRef<EditPdMasterComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||||
|
console.log(data);
|
||||||
this.notifier=notifier
|
this.notifier=notifier
|
||||||
this.currentPDStatus = data.records.pd_status;
|
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); }
|
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.getCustomerSegmentList();
|
||||||
this.getStateCityList();
|
this.getStateCityList();
|
||||||
this.getPDTypeList();
|
this.getPDTypeList();
|
||||||
|
this.getAddresses();
|
||||||
this.loadFormData();
|
this.loadFormData();
|
||||||
this.applicantLength=this.data.applicantLength;
|
this.applicantLength=this.data.applicantLength;
|
||||||
}
|
}
|
||||||
@ -81,6 +90,11 @@ export class EditPdMasterComponent implements OnInit {
|
|||||||
this._EditPDtriggerForm.controls.pd_branch_id.setValue(null);
|
this._EditPDtriggerForm.controls.pd_branch_id.setValue(null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
getAddresses(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
getProductsList(){
|
getProductsList(){
|
||||||
this._pd.getProductsDetails().subscribe(
|
this._pd.getProductsDetails().subscribe(
|
||||||
data => {
|
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)
|
// 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
|
||||||
// : this.data.records.pincode;
|
// : this.data.records.pincode;
|
||||||
@ -168,13 +182,44 @@ export class EditPdMasterComponent implements OnInit {
|
|||||||
fk_pd_type: [this.data.records.fk_pd_type],
|
fk_pd_type: [this.data.records.fk_pd_type],
|
||||||
fk_customer_segment: [this.data.records.fk_customer_segment],
|
fk_customer_segment: [this.data.records.fk_customer_segment],
|
||||||
loan_amount: [this.data.records.loan_amount,Validators.compose([Validators.pattern('^[0-9]*$')])],
|
loan_amount: [this.data.records.loan_amount,Validators.compose([Validators.pattern('^[0-9]*$')])],
|
||||||
addressline1: [this.data.records.addressline1.toUpperCase()],
|
addresses: this._fb.array([]),
|
||||||
fk_city: [this.data.records.fk_city],
|
// addressline1: [this.data.records.addressline1.toUpperCase()],
|
||||||
fk_state: [this.data.records.fk_state],
|
// fk_city: [this.data.records.fk_city],
|
||||||
pincode : [this.data.records.pincode_id],
|
// fk_state: [this.data.records.fk_state],
|
||||||
other_pincode:[this.data.records.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])],
|
// 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],
|
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; }
|
get pdMain() { return this._EditPDtriggerForm.controls; }
|
||||||
@ -192,17 +237,53 @@ export class EditPdMasterComponent implements OnInit {
|
|||||||
// this.cityList=this.cityList[0].cities;
|
// this.cityList=this.cityList[0].cities;
|
||||||
// }
|
// }
|
||||||
//get city list details based on state id
|
//get city list details based on state id
|
||||||
getCityList(stateID:string){
|
getCityList(stateID:string,i){
|
||||||
// console.log('getCityList',stateID);
|
// console.log('getCityList',stateID);
|
||||||
this._pd.getStateWiseCities(stateID).subscribe(data=>{
|
this._pd.getStateWiseCities(stateID).subscribe(data=>{
|
||||||
if (data.status == 200) {
|
if (data.status == 200) {
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
this.cityList = data.records.cities;
|
this.cityList[i] = data.records.cities;
|
||||||
this.pincodeList = data.records.pincode;
|
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
|
// save pd in draft
|
||||||
saveDraftPD(formValue: any, status:string){
|
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'].clearValidators();
|
||||||
this._EditPDtriggerForm.controls['loan_amount'].updateValueAndValidity();
|
this._EditPDtriggerForm.controls['loan_amount'].updateValueAndValidity();
|
||||||
|
|
||||||
this._EditPDtriggerForm.controls['addressline1'].clearValidators();
|
// this._EditPDtriggerForm.controls['addressline1'].clearValidators();
|
||||||
this._EditPDtriggerForm.controls['addressline1'].updateValueAndValidity();
|
// this._EditPDtriggerForm.controls['addressline1'].updateValueAndValidity();
|
||||||
|
|
||||||
this._EditPDtriggerForm.controls['fk_city'].clearValidators();
|
// this._EditPDtriggerForm.controls['fk_city'].clearValidators();
|
||||||
this._EditPDtriggerForm.controls['fk_city'].updateValueAndValidity();
|
// this._EditPDtriggerForm.controls['fk_city'].updateValueAndValidity();
|
||||||
|
|
||||||
this._EditPDtriggerForm.controls['fk_state'].clearValidators();
|
// this._EditPDtriggerForm.controls['fk_state'].clearValidators();
|
||||||
this._EditPDtriggerForm.controls['fk_state'].updateValueAndValidity();
|
// this._EditPDtriggerForm.controls['fk_state'].updateValueAndValidity();
|
||||||
|
|
||||||
this._EditPDtriggerForm.controls['pincode'].clearValidators();
|
// this._EditPDtriggerForm.controls['pincode'].clearValidators();
|
||||||
this._EditPDtriggerForm.controls['pincode'].updateValueAndValidity();
|
// this._EditPDtriggerForm.controls['pincode'].updateValueAndValidity();
|
||||||
|
|
||||||
this.validateAllFormFields(this._EditPDtriggerForm);
|
this.validateAllFormFields(this._EditPDtriggerForm);
|
||||||
}
|
}
|
||||||
@ -320,7 +401,6 @@ export class EditPdMasterComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
|
|
||||||
let lenderMasterArray = {
|
let lenderMasterArray = {
|
||||||
"pd_id": my_array.pd_id,
|
"pd_id": my_array.pd_id,
|
||||||
"fk_lender_id": my_array.fk_lender_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_pd_type": my_array.fk_pd_type,
|
||||||
"fk_customer_segment": my_array.fk_customer_segment,
|
"fk_customer_segment": my_array.fk_customer_segment,
|
||||||
"loan_amount": my_array.loan_amount,
|
"loan_amount": my_array.loan_amount,
|
||||||
"addressline1": my_array.addressline1.toUpperCase(),
|
"addressline1": my_array.addresses[0].addressline.toUpperCase(),
|
||||||
"fk_city": my_array.fk_city,
|
"fk_city": my_array.addresses[0].fk_city,
|
||||||
"fk_state": my_array.fk_state,
|
"fk_state": my_array.addresses[0].fk_state,
|
||||||
"pincode": my_array.pincode,
|
"pincode": my_array.addresses[0].pincode,
|
||||||
"other_pincode":my_array.other_pincode,
|
"other_pincode":my_array.addresses[0].other_pincode,
|
||||||
"remarks": my_array.remarks,
|
"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 => {
|
this._pd.editPdMasterDetails(lenderMasterArray, updateStatus).subscribe(result => {
|
||||||
if (result.status == 200) {
|
if (result.status == 200) {
|
||||||
this.notifier.notify('success', 'PD Details Updated.');
|
this.notifier.notify('success', 'PD Details Updated.');
|
||||||
|
|||||||
@ -64,7 +64,24 @@ export class PdTrigerService {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
//get product and subproduct master details
|
/* 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> {
|
getProductsDetails():Observable<any> {
|
||||||
return this._http.get<any>(this.apiUrl + 'getListOfProducts')
|
return this._http.get<any>(this.apiUrl + 'getListOfProducts')
|
||||||
.pipe(
|
.pipe(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user