Merge branch 'master' of https://bitbucket.org/sriramv18/sparqsineedge
This commit is contained in:
commit
b94704597a
@ -10,17 +10,13 @@
|
||||
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<mat-card-title>
|
||||
PD Details
|
||||
</mat-card-title>
|
||||
<mat-card-title> PD Details </mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<mat-form-field style="width: 28%">
|
||||
<mat-select placeholder="Lender Name" formControlName="fk_lender_id">
|
||||
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->
|
||||
<mat-option>
|
||||
Select
|
||||
</mat-option>
|
||||
<mat-option> Select </mat-option>
|
||||
<mat-option (click)="selectedLender(LL)" *ngFor="let LL of lenderList" [value]="LL.entity_id" >
|
||||
{{LL.full_name}}
|
||||
</mat-option>
|
||||
@ -126,62 +122,56 @@
|
||||
<mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount. </mat-error>
|
||||
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 96%">
|
||||
<textarea matInput autocomplete="off" placeholder="Address at which PD is to be done" formControlName="addressline1" style="text-transform: uppercase"></textarea>
|
||||
<!-- oninput="this.value = this.value.toUpperCase()" -->
|
||||
<!-- <mat-error *ngIf="pdMain.addressline1.hasError('required')">Address1 required.</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>
|
||||
|
||||
<!-- <mat-form-field style="width: 28%">
|
||||
<textarea matInput autocomplete="off" placeholder="Address 2" formControlName="addressline2" oninput="this.value = this.value.toUpperCase()"></textarea>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 96%">
|
||||
<textarea matInput autocomplete="off" placeholder="Address at which PD is to be done" formControlName="addressline1" style="text-transform: uppercase"></textarea>
|
||||
<!-- oninput="this.value = this.value.toUpperCase()" -->
|
||||
<!-- <mat-error *ngIf="pdMain.addressline1.hasError('required')">Address1 required.</mat-error> -->
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 28%">
|
||||
<textarea matInput autocomplete="off" placeholder="Address 3" formControlName="addressline3" oninput="this.value = this.value.toUpperCase()"></textarea>
|
||||
</mat-form-field>-->
|
||||
<mat-form-field style="width: 32%">
|
||||
<mat-select placeholder="State" formControlName="fk_state" (selectionChange)="getCityList(pdMain.fk_state.value)">
|
||||
<mat-option>
|
||||
Select
|
||||
</mat-option>
|
||||
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
|
||||
{{SL.name}}
|
||||
</mat-option>
|
||||
<mat-form-field style="width: 32%">
|
||||
<mat-select placeholder="State" formControlName="fk_state" (selectionChange)="getCityList(pdMain.fk_state.value)">
|
||||
<mat-option>
|
||||
Select
|
||||
</mat-option>
|
||||
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
|
||||
{{SL.name}}
|
||||
</mat-option>
|
||||
|
||||
|
||||
</mat-select>
|
||||
<!-- <mat-error *ngIf="pdMain.fk_state.hasError('required')">State Required.</mat-error> -->
|
||||
</mat-select>
|
||||
<!-- <mat-error *ngIf="pdMain.fk_state.hasError('required')">State Required.</mat-error> -->
|
||||
|
||||
</mat-form-field>
|
||||
<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" [value]="CL.city_id">
|
||||
{{CL.city_name}}
|
||||
</mat-option>
|
||||
</mat-form-field>
|
||||
<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" [value]="CL.city_id">
|
||||
{{CL.city_name}}
|
||||
</mat-option>
|
||||
|
||||
</mat-select>
|
||||
<!-- <mat-error *ngIf="pdMain.fk_city.hasError('required')">City Required.</mat-error> -->
|
||||
</mat-form-field>
|
||||
|
||||
</mat-select>
|
||||
<!-- <mat-error *ngIf="pdMain.fk_city.hasError('required')">City Required.</mat-error> -->
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 24%">
|
||||
<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%">
|
||||
<!-- <input matInput autocomplete="off" placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)"> -->
|
||||
<!-- <mat-error *ngIf="pdMain.pincode.hasError('required')">Pincode Required.</mat-error> -->
|
||||
<!-- <mat-error *ngIf="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="pdMain.pincode.value == 1" >
|
||||
<input matInput autocomplete="off" placeholder="Specify Pincode" formControlName="other_pincode" (keypress)="keyPress($event)">
|
||||
<mat-error *ngIf="pdMain.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('maxlength') || pdMain.other_pincode.hasError('minlength')">Enter Valid Pincode. </mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
@ -223,9 +213,69 @@
|
||||
<mat-error *ngIf="pdMain.applicant_landline.hasError('maxlength') || pdMain.applicant_landline.hasError('minlength')">Enter Valid LandLine Number. </mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<!-- <mat-card formArrayName="items">
|
||||
<mat-card-content>
|
||||
<mat-list *ngFor="let coappList of items.controls; let ca = index;" [formGroupName]="ca">
|
||||
<h3>Co App</h3>
|
||||
<mat-list-item>
|
||||
<mat-form-field style="width: 70%">
|
||||
<input matInput autocomplete="off" placeholder="coapp Name" formControlName="coapplicantName" type="text">
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
<div style="width:50%">
|
||||
|
||||
<!-- <span (click)="removeItem(d)">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" type="button"><mat-icon>delete</mat-icon></button>
|
||||
</span> --
|
||||
</div>
|
||||
</mat-list-item>
|
||||
</mat-list>
|
||||
</mat-card-content>
|
||||
|
||||
<mat-card-actions align="end">
|
||||
|
||||
|
||||
</mat-card-actions>
|
||||
|
||||
</mat-card> -->
|
||||
<!-- Phone field to be split into 2 parts. Mobile Number mandatory and optional land line number with std code. -->
|
||||
</mat-card-content>
|
||||
<mat-dialog-actions align="end">
|
||||
<!-- <button mat-raised-button mat-icon-button matTooltip="Add Document" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" (click)="addCoApplicant()" type="button"><mat-icon>attach_file</mat-icon></button> -->
|
||||
</mat-dialog-actions>
|
||||
</mat-card>
|
||||
|
||||
|
||||
<!---- <div fxLayout="row" fxLayoutGap="5%" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width: 50%">
|
||||
<input matInput placeholder="Mobile" formControlName="coapplicant_mobile_no" type="text" (keypress)="keyPress($event)" required>
|
||||
<!-- <mat-error *ngIf="coDetails['controls'].coapplicant_mobile_no.hasError('maxlength') || coDetails['controls'].coapplicant_mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error> --
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 50%">
|
||||
<input matInput placeholder="LandLine" formControlName="coapplicant_landline" type="text" (keypress)="keyPress($event)">
|
||||
<!-- <mat-error *ngIf="coDetails['controls'].coapplicant_landline.hasError('maxlength') || coDetails['controls'].coapplicant_landline.hasError('minlength')">Enter Valid Phone Number. </mat-error> --
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<mat-form-field style="width: 100%">
|
||||
|
||||
<mat-select placeholder="Relationship" formControlName="relationship">
|
||||
<mat-option *ngFor="let rel of relationShipList" [value]="rel.relationship_id" >
|
||||
{{rel.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<div style="width:20%">
|
||||
<span (click)="removeCoApplicant(i)">
|
||||
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>-->
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<mat-card-title>Additional Requirements</mat-card-title>
|
||||
@ -306,4 +356,86 @@
|
||||
|
||||
|
||||
|
||||
<!-- <div fxLayout="row" fxLayoutWrap="wrap">
|
||||
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
|
||||
<mat-card class="p-2">
|
||||
<h5>Main Applicant</h5>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Name" formControlName="applicant_name">
|
||||
<mat-error *ngIf="pdMain.applicant_name.hasError('required')">Name is Required.</mat-error>
|
||||
</mat-form-field>
|
||||
<div fxLayout="row" fxLayoutGap="5%" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width: 50%">
|
||||
<input matInput placeholder="Mobile" formControlName="mobile_no" type="text" (keypress)="keyPress($event)" required>
|
||||
<mat-error *ngIf="pdMain.mobile_no.hasError('maxlength') || pdMain.mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 50%">
|
||||
<input matInput placeholder="LandLine" formControlName="landline" type="text" (keypress)="keyPress($event)">
|
||||
<mat-error *ngIf="pdMain.landline.hasError('maxlength') || pdMain.landline.hasError('minlength')">Enter Valid Phone Number. </mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Email" formControlName="email" type="email">
|
||||
<!-- <mat-error *ngIf="pdMain.email.hasError('required')">Email Required.</mat-error> ----
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutWrap="wrap" formArrayName="items" *ngFor="let coDetails of pdCoApplicant.controls; let i = index;">
|
||||
|
||||
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
|
||||
|
||||
<mat-card class="p-2">
|
||||
<h5>{{coDetails.controls.label.value}} {{i+1}}</h5>
|
||||
|
||||
<div [formGroupName]="i">
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Name" formControlName="coapplicantName" type="text" required>
|
||||
</mat-form-field>
|
||||
|
||||
<div fxLayout="row" fxLayoutGap="5%" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width: 50%">
|
||||
<input matInput placeholder="Mobile" formControlName="coapplicant_mobile_no" type="text" (keypress)="keyPress($event)" required>
|
||||
<mat-error *ngIf="coDetails['controls'].coapplicant_mobile_no.hasError('maxlength') || coDetails['controls'].coapplicant_mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 50%">
|
||||
<input matInput placeholder="LandLine" formControlName="coapplicant_landline" type="text" (keypress)="keyPress($event)">
|
||||
<mat-error *ngIf="coDetails['controls'].coapplicant_landline.hasError('maxlength') || coDetails['controls'].coapplicant_landline.hasError('minlength')">Enter Valid Phone Number. </mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<mat-form-field style="width: 100%">
|
||||
|
||||
<mat-select placeholder="Relationship" formControlName="relationship">
|
||||
<mat-option *ngFor="let rel of relationShipList" [value]="rel.relationship_id" >
|
||||
{{rel.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<div style="width:20%">
|
||||
<span (click)="removeCoApplicant(i)">
|
||||
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- <div fxLayout="row" fxLayoutWrap="wrap">
|
||||
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
|
||||
<mat-card class="p-2">
|
||||
<h5>Co-Applicant</h5>
|
||||
|
||||
<button mat-fab class="mr-1 mb-1" color="primary" matTooltip="Add Co-Applicant" matTooltipPosition="above" style="opacity: 0.8;border:2px;border-radius: 50%;" (click)="addCoApplicant()"><mat-icon>group_add</mat-icon><div class="mat-button-ripple mat-ripple" matripple=""></div><div class="mat-button-focus-overlay"></div></button>
|
||||
<button mat-raised-button mat-button-sm color="primary" (click)="addCoApplicant()" type="button">Add More Co-Applicant</button>
|
||||
|
||||
</mat-card>
|
||||
</div>
|
||||
</div> -->
|
||||
@ -18,94 +18,95 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
||||
//@Output() loadParent = new EventEmitter<string>();
|
||||
cancelStatus: boolean;
|
||||
enablePDButton: boolean;
|
||||
coapplicantFlag: boolean = false;
|
||||
draftStatus: string;
|
||||
PDTriggerStatus: string;
|
||||
private notifier: NotifierService;
|
||||
public _PDtriggerForm: FormGroup;
|
||||
items: FormArray;
|
||||
addtional_requirements: FormArray;
|
||||
productList:any;
|
||||
subProductList:any;
|
||||
lenderList:any;
|
||||
productList: any;
|
||||
subProductList: any;
|
||||
lenderList: any;
|
||||
lenderBranchList: any;
|
||||
customerSegmentList:any;
|
||||
stateList:any;
|
||||
cityList:any;
|
||||
pdTypeList:any;
|
||||
customerSegmentList: any;
|
||||
stateList: any;
|
||||
cityList: any;
|
||||
pdTypeList: any;
|
||||
billingList: any;
|
||||
relationShipList: any;
|
||||
pincodeList: any = [];
|
||||
errorMessage: any;
|
||||
loanAmtInWords : any;
|
||||
loanAmtInWords: any;
|
||||
titleList: any;
|
||||
// Dynamic co applicant
|
||||
createWithLongContent = false;
|
||||
dynamicCoApplicant = [];
|
||||
disableAfterSubmit: boolean;
|
||||
constructor(notifier: NotifierService,private _fb: FormBuilder,private route: ActivatedRoute,
|
||||
private router: Router,private _pd: PdTrigerService, private _aws:AwsService, private ListPdComponent: ListPdComponent) {
|
||||
this.notifier = notifier;
|
||||
this.disableAfterSubmit = false;
|
||||
}
|
||||
public totalfiles: Array<File> =[];
|
||||
public totalFileName = [];
|
||||
public lengthCheckToaddMore =0;
|
||||
ngOnInit() {
|
||||
this.draftStatus="DRAFT";
|
||||
this.PDTriggerStatus="TRIGGERED";
|
||||
this.enablePDButton=false;
|
||||
this.cancelStatus = false;
|
||||
this.ListPdComponent.showListView(false);
|
||||
this.getLenderList();
|
||||
this.getProductsList();
|
||||
this.getCustomerSegmentList();
|
||||
this.getStateCityList();
|
||||
this.getPDTypeList();
|
||||
this.getRelationMaster();
|
||||
this.getTitleMaster();
|
||||
this.loadFormData();
|
||||
// Dynamic co applicant
|
||||
createWithLongContent = false;
|
||||
dynamicCoApplicant = [];
|
||||
disableAfterSubmit: boolean;
|
||||
constructor(notifier: NotifierService, private _fb: FormBuilder, private route: ActivatedRoute,
|
||||
private router: Router, private _pd: PdTrigerService, private _aws: AwsService, private ListPdComponent: ListPdComponent) {
|
||||
this.notifier = notifier;
|
||||
this.disableAfterSubmit = false;
|
||||
}
|
||||
public totalfiles: Array<File> = [];
|
||||
public totalFileName = [];
|
||||
public lengthCheckToaddMore = 0;
|
||||
ngOnInit() {
|
||||
this.draftStatus = "DRAFT";
|
||||
this.PDTriggerStatus = "TRIGGERED";
|
||||
this.enablePDButton = false;
|
||||
this.cancelStatus = false;
|
||||
this.ListPdComponent.showListView(false);
|
||||
this.getLenderList();
|
||||
this.getProductsList();
|
||||
this.getCustomerSegmentList();
|
||||
this.getStateCityList();
|
||||
this.getPDTypeList();
|
||||
this.getRelationMaster();
|
||||
this.getTitleMaster();
|
||||
this.loadFormData();
|
||||
|
||||
}
|
||||
|
||||
// load form data
|
||||
loadFormData(){
|
||||
loadFormData() {
|
||||
this._PDtriggerForm = this._fb.group({
|
||||
fk_lender_id: [null],
|
||||
pd_branch_id: [null],
|
||||
lender_applicant_id: [null, Validators.compose([Validators.required])],
|
||||
lender_contact_person: [null, Validators.compose([Validators.required])],
|
||||
lender_contact_mobile: [null, Validators.compose([Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])],
|
||||
lender_stdcode:[null, Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])],
|
||||
lender_landline:[null, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
|
||||
lender_contact_mobile: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(12), Validators.pattern('^[0-9]*$')])],
|
||||
lender_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
|
||||
lender_landline: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])],
|
||||
//lender_billing: [null],
|
||||
fk_product_id: [null],
|
||||
fk_subproduct_id: [null],
|
||||
fk_pd_type: [null],
|
||||
fk_customer_segment: [null],
|
||||
loan_amount: [null,Validators.compose([Validators.pattern('^[0-9]*$')])],
|
||||
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)])],
|
||||
mobile_no: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(10)])],
|
||||
// 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]*$')])],
|
||||
applicant_landline:[null, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
|
||||
applicant_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
|
||||
applicant_landline: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])],
|
||||
company_name: [null],
|
||||
addressline1: [null],
|
||||
addressline1: [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)])],
|
||||
remarks:[null],
|
||||
// allocation_type: [null],
|
||||
// sub_allocation_type: [null],
|
||||
//items: this._fb.array([]),
|
||||
pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
|
||||
other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
|
||||
remarks: [null],
|
||||
// allocation_type: [null],
|
||||
// sub_allocation_type: [null],
|
||||
items: this._fb.array([]),
|
||||
documents: this._fb.array([]),
|
||||
addtional_requirements: this._fb.array([this.createRequiremnt()])
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
selectedLender(lender){
|
||||
selectedLender(lender) {
|
||||
// console.log(JSON.stringify(lender));
|
||||
// alert(JSON.stringify(lender['branches ']));
|
||||
this.lenderBranchList = lender['branches'];
|
||||
@ -113,456 +114,453 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
||||
|
||||
}
|
||||
|
||||
getLenderList(){
|
||||
getLenderList() {
|
||||
this._pd.getLenderDetails().subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.lenderList=data.records
|
||||
this.lenderList = data.records
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
}
|
||||
getProductsList(){
|
||||
}, error => this.errorMessage = <any>error);
|
||||
}
|
||||
getProductsList() {
|
||||
this._pd.getProductsDetails().subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.productList=data.records
|
||||
this.productList = data.records
|
||||
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
}
|
||||
getCustomerSegmentList(){
|
||||
this._pd.getCustomersDetails().subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.customerSegmentList=data.records
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
}, error => this.errorMessage = <any>error);
|
||||
}
|
||||
getCustomerSegmentList() {
|
||||
this._pd.getCustomersDetails().subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.customerSegmentList = data.records
|
||||
}
|
||||
}, error => this.errorMessage = <any>error);
|
||||
}
|
||||
// getStateCityList(){
|
||||
// this._pd.getStateCityDetails().subscribe(
|
||||
// data => {
|
||||
// if (data.status == 200) {
|
||||
// this.stateList=data.records
|
||||
// }
|
||||
// }, error => this.errorMessage = <any> error);
|
||||
// }
|
||||
getStateCityList() {
|
||||
this._pd.getAllMasterDatas('STATE').subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.stateList = data.records.filter(item => item.isactive == 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
getPDTypeList() {
|
||||
this._pd.getPDTypeDetails().subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.pdTypeList = data.records.pd_type;
|
||||
|
||||
}
|
||||
}, error => this.errorMessage = <any>error);
|
||||
}
|
||||
//get sub product list based on prokduct id
|
||||
getSubproductList(productID: string) {
|
||||
|
||||
this.subProductList = this.productList.filter(item => item.product_id == productID);
|
||||
this.subProductList = this.subProductList[0].subproducts;
|
||||
this.subProductList = this.subProductList.filter(item => item.is_others == 0);
|
||||
}
|
||||
|
||||
// get city list details based on state id
|
||||
// getCityList(stateID:string){
|
||||
// console.log(this.cityList);
|
||||
// this.cityList= this.stateList.filter(item => item.state_id == stateID);
|
||||
// console.log(this.cityList);
|
||||
// this.cityList=this.cityList[0].cities;
|
||||
// console.log(this.cityList);
|
||||
// }
|
||||
|
||||
//get city list details based on state id
|
||||
getCityList(stateID: string) {
|
||||
// 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;
|
||||
}
|
||||
// getStateCityList(){
|
||||
// this._pd.getStateCityDetails().subscribe(
|
||||
// data => {
|
||||
// if (data.status == 200) {
|
||||
// this.stateList=data.records
|
||||
// }
|
||||
// }, error => this.errorMessage = <any> error);
|
||||
// }
|
||||
getStateCityList(){
|
||||
this._pd.getAllMasterDatas('STATE').subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.stateList = data.records.filter(item => item.isactive == 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
getPDTypeList(){
|
||||
this._pd.getPDTypeDetails().subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.pdTypeList=data.records.pd_type;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
}
|
||||
//get sub product list based on prokduct id
|
||||
getSubproductList(productID:string){
|
||||
|
||||
this.subProductList= this.productList.filter(item => item.product_id == productID);
|
||||
this.subProductList=this.subProductList[0].subproducts;
|
||||
this.subProductList = this.subProductList.filter(item => item.is_others == 0);
|
||||
}
|
||||
|
||||
// get city list details based on state id
|
||||
// getCityList(stateID:string){
|
||||
// console.log(this.cityList);
|
||||
// this.cityList= this.stateList.filter(item => item.state_id == stateID);
|
||||
// console.log(this.cityList);
|
||||
// this.cityList=this.cityList[0].cities;
|
||||
// console.log(this.cityList);
|
||||
// }
|
||||
|
||||
//get city list details based on state id
|
||||
getCityList(stateID:string){
|
||||
// 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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// get relation master details
|
||||
getRelationMaster(){
|
||||
let relation ="RELATIONSHIPS";
|
||||
this._pd.getAllMasterDatas(relation).subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.relationShipList=data.records;
|
||||
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
}
|
||||
// get title master
|
||||
getTitleMaster() {
|
||||
let relation ="TITLES";
|
||||
this._pd.getAllMasterDatas(relation).subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.titleList=data.records.filter(val=>val.isactive==1);
|
||||
// console.log(this.titleList);
|
||||
// let index1 = this.titleList.map(data => data.name).indexOf("Master");
|
||||
// this.titleList.splice(index1, 1);
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
// get relation master details
|
||||
getRelationMaster() {
|
||||
let relation = "RELATIONSHIPS";
|
||||
this._pd.getAllMasterDatas(relation).subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.relationShipList = data.records;
|
||||
|
||||
}
|
||||
}, error => this.errorMessage = <any>error);
|
||||
}
|
||||
// get title master
|
||||
getTitleMaster() {
|
||||
let relation = "TITLES";
|
||||
this._pd.getAllMasterDatas(relation).subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.titleList = data.records.filter(val => val.isactive == 1);
|
||||
// console.log(this.titleList);
|
||||
// let index1 = this.titleList.map(data => data.name).indexOf("Master");
|
||||
// this.titleList.splice(index1, 1);
|
||||
}
|
||||
}, error => this.errorMessage = <any>error);
|
||||
|
||||
}
|
||||
createItem(): FormGroup {
|
||||
return this._fb.group({
|
||||
label: ['Co Applicant'],
|
||||
|
||||
coapplicantName: [null, Validators.compose([Validators.required])],
|
||||
coapplicant_mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10),Validators.required])],
|
||||
coapplicant_landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])],
|
||||
relationship: [null],
|
||||
// coapplicantTitleName: [null],
|
||||
// companyName: [null],
|
||||
// applicantType: 0,
|
||||
// coapplicant_mobile_no: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(10), Validators.required])],
|
||||
// coapplicant_landline: [null, Validators.compose([Validators.minLength(12), Validators.maxLength(13)])],
|
||||
// relationship: [null],
|
||||
});
|
||||
};
|
||||
|
||||
addCoApplicant() {
|
||||
if(this._PDtriggerForm.valid){
|
||||
this.items = this._PDtriggerForm.get('items') as FormArray;
|
||||
this.items.push(this.createItem());
|
||||
}
|
||||
}
|
||||
this.items = this._PDtriggerForm.get('items') as FormArray;
|
||||
this.items.push(this.createItem());
|
||||
}
|
||||
|
||||
addMoreDocs() {
|
||||
if(this.totalfiles.length!=0){
|
||||
|
||||
|
||||
if( this.documents.value[0].doc_name != "" && ((this.lengthCheckToaddMore) === (this.totalfiles.length)) )
|
||||
{
|
||||
this.documents.insert(0, this.generateDocuments())
|
||||
this.lengthCheckToaddMore=this.lengthCheckToaddMore+1;
|
||||
addMoreDocs() {
|
||||
if (this.totalfiles.length != 0) {
|
||||
if (this.documents.value[0].doc_name != "" && ((this.lengthCheckToaddMore) === (this.totalfiles.length))) {
|
||||
this.documents.insert(0, this.generateDocuments())
|
||||
this.lengthCheckToaddMore = this.lengthCheckToaddMore + 1;
|
||||
}
|
||||
}
|
||||
else if(this.totalfiles.length===0 && this.lengthCheckToaddMore===0){
|
||||
else if (this.totalfiles.length === 0 && this.lengthCheckToaddMore === 0) {
|
||||
this.documents.insert(0, this.generateDocuments())
|
||||
this.lengthCheckToaddMore=this.lengthCheckToaddMore+1;
|
||||
}
|
||||
}
|
||||
generateDocuments(): FormGroup {
|
||||
return this._fb.group({
|
||||
doc_name: [null],//Validators.compose([Validators.required])
|
||||
documentFile : [null],//, Validators.compose([Validators.required])
|
||||
});
|
||||
this.lengthCheckToaddMore = this.lengthCheckToaddMore + 1;
|
||||
}
|
||||
}
|
||||
|
||||
get documents(): FormArray {
|
||||
return this._PDtriggerForm.get('documents') as FormArray;
|
||||
};
|
||||
get pdMain() {
|
||||
return this._PDtriggerForm.controls; }
|
||||
// get pdCoApplicant() { return this._PDtriggerForm.get('items') as FormArray; }
|
||||
generateDocuments(): FormGroup {
|
||||
return this._fb.group({
|
||||
doc_name: [null],//Validators.compose([Validators.required])
|
||||
documentFile: [null],//, Validators.compose([Validators.required])
|
||||
});
|
||||
}
|
||||
|
||||
removeCoApplicant(i: number) {
|
||||
const control = <FormArray>this._PDtriggerForm.controls['items'];
|
||||
control.removeAt(i);
|
||||
}
|
||||
removeItem(index: number) {
|
||||
this.totalfiles.splice(index,1);
|
||||
this.totalFileName.splice(index,1);
|
||||
this.documents.removeAt(index);
|
||||
this.lengthCheckToaddMore=this.lengthCheckToaddMore-1;
|
||||
}
|
||||
get documents(): FormArray {
|
||||
return this._PDtriggerForm.get('documents') as FormArray;
|
||||
};
|
||||
get pdMain() {
|
||||
return this._PDtriggerForm.controls;
|
||||
}
|
||||
// get pdCoApplicant() { return this._PDtriggerForm.get('items') as FormArray; }
|
||||
|
||||
get pdRequirements() { return this._PDtriggerForm.get('addtional_requirements') as FormArray; }
|
||||
createRequiremnt(): FormGroup {
|
||||
return this._fb.group({
|
||||
add_req_id:[null],
|
||||
add_requirement: [null],
|
||||
isactive: [1],
|
||||
});
|
||||
};
|
||||
addRequiremnts() {
|
||||
this.addtional_requirements = this._PDtriggerForm.get('addtional_requirements') as FormArray;
|
||||
this.addtional_requirements.push(this.createRequiremnt());
|
||||
removeCoApplicant(i: number) {
|
||||
const control = <FormArray>this._PDtriggerForm.controls['items'];
|
||||
control.removeAt(i);
|
||||
}
|
||||
removeItem(index: number) {
|
||||
this.totalfiles.splice(index, 1);
|
||||
this.totalFileName.splice(index, 1);
|
||||
this.documents.removeAt(index);
|
||||
this.lengthCheckToaddMore = this.lengthCheckToaddMore - 1;
|
||||
}
|
||||
|
||||
get pdRequirements() { return this._PDtriggerForm.get('addtional_requirements') as FormArray; }
|
||||
createRequiremnt(): FormGroup {
|
||||
return this._fb.group({
|
||||
add_req_id: [null],
|
||||
add_requirement: [null],
|
||||
isactive: [1],
|
||||
});
|
||||
};
|
||||
addRequiremnts() {
|
||||
this.addtional_requirements = this._PDtriggerForm.get('addtional_requirements') as FormArray;
|
||||
this.addtional_requirements.push(this.createRequiremnt());
|
||||
}
|
||||
|
||||
removeRequirements(index: number) {
|
||||
const requirement_control = <FormArray>this._PDtriggerForm.controls['addtional_requirements'];
|
||||
requirement_control.removeAt(index);
|
||||
}
|
||||
|
||||
public fileSelectionEvent(fileInput: any, oldIndex: number) {
|
||||
|
||||
|
||||
if (fileInput.target.files && fileInput.target.files[0]) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = (event: any) => {
|
||||
}
|
||||
|
||||
removeRequirements(index: number) {
|
||||
const requirement_control = <FormArray>this._PDtriggerForm.controls['addtional_requirements'];
|
||||
requirement_control.removeAt(index);
|
||||
}
|
||||
|
||||
public fileSelectionEvent(fileInput: any,oldIndex:number) {
|
||||
|
||||
|
||||
if (fileInput.target.files && fileInput.target.files[0]) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = (event: any) => {
|
||||
}
|
||||
|
||||
if(oldIndex==0)
|
||||
{
|
||||
if (oldIndex == 0) {
|
||||
this.totalfiles.unshift((fileInput.target.files[0]))
|
||||
this.totalFileName.unshift(fileInput.target.files[0].name)
|
||||
}
|
||||
else
|
||||
{
|
||||
this.totalfiles[oldIndex]=(fileInput.target.files[0]);
|
||||
this.totalFileName[oldIndex]=fileInput.target.files[0].name
|
||||
else {
|
||||
this.totalfiles[oldIndex] = (fileInput.target.files[0]);
|
||||
this.totalFileName[oldIndex] = fileInput.target.files[0].name
|
||||
}
|
||||
|
||||
reader.readAsDataURL(fileInput.target.files[0]);
|
||||
}
|
||||
|
||||
if(this.totalfiles.length == 1)
|
||||
{
|
||||
this.lengthCheckToaddMore=1;
|
||||
}
|
||||
reader.readAsDataURL(fileInput.target.files[0]);
|
||||
}
|
||||
|
||||
// save pd in draft
|
||||
saveDraftPD(formValue: any, status:string){
|
||||
//alert('Inside The Draft PD');
|
||||
this.submitPdDetails(formValue, status);
|
||||
if (this.totalfiles.length == 1) {
|
||||
this.lengthCheckToaddMore = 1;
|
||||
}
|
||||
//trigger pd
|
||||
triggerPD(formValue: any, status:string){
|
||||
this._PDtriggerForm.controls['fk_lender_id'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['fk_lender_id'].updateValueAndValidity();
|
||||
}
|
||||
|
||||
this._PDtriggerForm.controls['fk_product_id'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['fk_product_id'].updateValueAndValidity();
|
||||
// save pd in draft
|
||||
saveDraftPD(formValue: any, status: string) {
|
||||
//alert('Inside The Draft PD');
|
||||
this.submitPdDetails(formValue, status);
|
||||
}
|
||||
//trigger pd
|
||||
triggerPD(formValue: any, status: string) {
|
||||
this._PDtriggerForm.controls['fk_lender_id'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['fk_lender_id'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['fk_subproduct_id'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['fk_product_id'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['fk_product_id'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['fk_pd_type'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['fk_subproduct_id'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['fk_customer_segment'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['fk_pd_type'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['loan_amount'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['loan_amount'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['fk_customer_segment'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['applicant_name'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['applicant_title_name'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['applicant_title_name'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['loan_amount'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['loan_amount'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['mobile_no'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['applicant_name'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['applicant_title_name'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['applicant_title_name'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['addressline1'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['addressline1'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['mobile_no'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['fk_city'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['fk_city'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['addressline1'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['addressline1'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['fk_state'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['fk_state'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['fk_city'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['fk_city'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['pincode'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['pincode'].updateValueAndValidity();
|
||||
setTimeout(() => {
|
||||
this.clearCustomValidatorFields();
|
||||
this._PDtriggerForm.controls['fk_state'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['fk_state'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['pincode'].setValidators([Validators.required]);
|
||||
this._PDtriggerForm.controls['pincode'].updateValueAndValidity();
|
||||
setTimeout(() => {
|
||||
this.clearCustomValidatorFields();
|
||||
}, 10000);
|
||||
this.submitPdDetails(formValue, status);
|
||||
}
|
||||
this.submitPdDetails(formValue, status);
|
||||
}
|
||||
|
||||
// this is for clear custom validator required fields
|
||||
clearCustomValidatorFields(){
|
||||
this._PDtriggerForm.controls['fk_lender_id'].clearValidators();
|
||||
this._PDtriggerForm.controls['fk_lender_id'].updateValueAndValidity();
|
||||
// this is for clear custom validator required fields
|
||||
clearCustomValidatorFields() {
|
||||
this._PDtriggerForm.controls['fk_lender_id'].clearValidators();
|
||||
this._PDtriggerForm.controls['fk_lender_id'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['fk_product_id'].clearValidators();
|
||||
this._PDtriggerForm.controls['fk_product_id'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['fk_product_id'].clearValidators();
|
||||
this._PDtriggerForm.controls['fk_product_id'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['fk_subproduct_id'].clearValidators();
|
||||
this._PDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['fk_subproduct_id'].clearValidators();
|
||||
this._PDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['fk_pd_type'].clearValidators();
|
||||
this._PDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['fk_pd_type'].clearValidators();
|
||||
this._PDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['fk_customer_segment'].clearValidators();
|
||||
this._PDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['fk_customer_segment'].clearValidators();
|
||||
this._PDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['loan_amount'].clearValidators();
|
||||
this._PDtriggerForm.controls['loan_amount'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['loan_amount'].clearValidators();
|
||||
this._PDtriggerForm.controls['loan_amount'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['applicant_name'].clearValidators();
|
||||
this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['applicant_name'].clearValidators();
|
||||
this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['applicant_title_name'].clearValidators();
|
||||
this._PDtriggerForm.controls['applicant_title_name'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['applicant_title_name'].clearValidators();
|
||||
this._PDtriggerForm.controls['applicant_title_name'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['mobile_no'].clearValidators();
|
||||
this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['mobile_no'].clearValidators();
|
||||
this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['addressline1'].clearValidators();
|
||||
this._PDtriggerForm.controls['addressline1'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['addressline1'].clearValidators();
|
||||
this._PDtriggerForm.controls['addressline1'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['fk_city'].clearValidators();
|
||||
this._PDtriggerForm.controls['fk_city'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['fk_city'].clearValidators();
|
||||
this._PDtriggerForm.controls['fk_city'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['fk_state'].clearValidators();
|
||||
this._PDtriggerForm.controls['fk_state'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['fk_state'].clearValidators();
|
||||
this._PDtriggerForm.controls['fk_state'].updateValueAndValidity();
|
||||
|
||||
this._PDtriggerForm.controls['pincode'].clearValidators();
|
||||
this._PDtriggerForm.controls['pincode'].updateValueAndValidity();
|
||||
this._PDtriggerForm.controls['pincode'].clearValidators();
|
||||
this._PDtriggerForm.controls['pincode'].updateValueAndValidity();
|
||||
|
||||
this.validateAllFormFields(this._PDtriggerForm);
|
||||
}
|
||||
|
||||
// common function for both draft and process pd
|
||||
submitPdDetails(formValue: any, status: string) {
|
||||
if (this._PDtriggerForm.invalid) {
|
||||
this.validateAllFormFields(this._PDtriggerForm);
|
||||
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||
return;
|
||||
}
|
||||
|
||||
// common function for both draft and process pd
|
||||
submitPdDetails(formValue: any, status:string) {
|
||||
if(this._PDtriggerForm.invalid) {
|
||||
this.validateAllFormFields(this._PDtriggerForm);
|
||||
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||
else {
|
||||
if ((formValue.lender_contact_mobile == '' || formValue.lender_contact_mobile == null) && (formValue.lender_stdcode == '' || formValue.lender_stdcode == null && formValue.lender_landline == '' || formValue.lender_landline == null)) {
|
||||
this.notifier.notify('warning', 'Either Mobile or Landline Need.!');
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if((formValue.lender_contact_mobile == '' || formValue.lender_contact_mobile == null) && (formValue.lender_stdcode == '' || formValue.lender_stdcode == null && formValue.lender_landline == '' || formValue.lender_landline == null )){
|
||||
this.notifier.notify('warning', 'Either Mobile or Landline Need.!');
|
||||
return;
|
||||
}
|
||||
else{
|
||||
this.disableAfterSubmit=true;
|
||||
this.disableAfterSubmit = true;
|
||||
let concat_landline
|
||||
let concat_landline1
|
||||
if(formValue.lender_stdcode != null || formValue.lender_landline != null){
|
||||
if(formValue.lender_stdcode != '' && formValue.lender_landline != ''){
|
||||
concat_landline = formValue.lender_stdcode +'-'+formValue.lender_landline;
|
||||
if (formValue.lender_stdcode != null || formValue.lender_landline != null) {
|
||||
if (formValue.lender_stdcode != '' && formValue.lender_landline != '') {
|
||||
concat_landline = formValue.lender_stdcode + '-' + formValue.lender_landline;
|
||||
}
|
||||
else {
|
||||
concat_landline = null;
|
||||
concat_landline = null;
|
||||
}
|
||||
}
|
||||
else{
|
||||
concat_landline = null;
|
||||
else {
|
||||
concat_landline = null;
|
||||
}
|
||||
|
||||
if(formValue.applicant_stdcode != null || formValue.applicant_landline != null){
|
||||
if(formValue.applicant_stdcode != '' && formValue.applicant_landline != ''){
|
||||
concat_landline1 = formValue.applicant_stdcode +'-'+formValue.applicant_landline;
|
||||
if (formValue.applicant_stdcode != null || formValue.applicant_landline != null) {
|
||||
if (formValue.applicant_stdcode != '' && formValue.applicant_landline != '') {
|
||||
concat_landline1 = formValue.applicant_stdcode + '-' + formValue.applicant_landline;
|
||||
}
|
||||
else{
|
||||
concat_landline1 = null;
|
||||
else {
|
||||
concat_landline1 = null;
|
||||
}
|
||||
}
|
||||
else{
|
||||
concat_landline1 = null;
|
||||
else {
|
||||
concat_landline1 = null;
|
||||
}
|
||||
|
||||
let pd_details:any={
|
||||
"fk_lender_id":formValue.fk_lender_id,
|
||||
"lender_applicant_id":formValue.lender_applicant_id,
|
||||
"pd_branch_id":formValue.pd_branch_id,
|
||||
"pd_contact_person":formValue.lender_contact_person,
|
||||
"pd_contact_mobileno":formValue.lender_contact_mobile,
|
||||
"pd_contact_landline":concat_landline,
|
||||
"fk_product_id":formValue.fk_product_id,
|
||||
"fk_subproduct_id":formValue.fk_subproduct_id,
|
||||
"fk_pd_type":formValue.fk_pd_type,
|
||||
"fk_customer_segment":formValue.fk_customer_segment,
|
||||
"loan_amount":formValue.loan_amount,
|
||||
"addressline1":formValue.addressline1.toUpperCase(),
|
||||
"fk_city":formValue.fk_city,
|
||||
"fk_state":formValue.fk_state,
|
||||
"pincode":formValue.pincode,
|
||||
"other_pincode":formValue.other_pincode ,
|
||||
"remarks":formValue.remarks,
|
||||
let pd_details: any = {
|
||||
"fk_lender_id": formValue.fk_lender_id,
|
||||
"lender_applicant_id": formValue.lender_applicant_id,
|
||||
"pd_branch_id": formValue.pd_branch_id,
|
||||
"pd_contact_person": formValue.lender_contact_person,
|
||||
"pd_contact_mobileno": formValue.lender_contact_mobile,
|
||||
"pd_contact_landline": concat_landline,
|
||||
"fk_product_id": formValue.fk_product_id,
|
||||
"fk_subproduct_id": formValue.fk_subproduct_id,
|
||||
"fk_pd_type": formValue.fk_pd_type,
|
||||
"fk_customer_segment": formValue.fk_customer_segment,
|
||||
"loan_amount": formValue.loan_amount,
|
||||
"addressline1": formValue.addressline1.toUpperCase(),
|
||||
"fk_city": formValue.fk_city,
|
||||
"fk_state": formValue.fk_state,
|
||||
"pincode": formValue.pincode,
|
||||
"other_pincode": formValue.other_pincode,
|
||||
"remarks": formValue.remarks,
|
||||
"pd_status": status,
|
||||
"fk_createdby" : this._aws.getlocale(),
|
||||
"fk_createdby": this._aws.getlocale(),
|
||||
};
|
||||
var pd_applicant_details: any=[];
|
||||
if(formValue.applicant_name){
|
||||
var pd_applicant_details: any = [];
|
||||
if (formValue.applicant_name) {
|
||||
pd_applicant_details.push({
|
||||
"applicant_name":formValue.applicant_name,
|
||||
"applicant_title_name":formValue.applicant_title_name,
|
||||
"company_name":formValue.company_name,
|
||||
"mobile_no":formValue.mobile_no,
|
||||
"landline":concat_landline1 ,
|
||||
"applicant_type":1,
|
||||
"relation":"",
|
||||
"applicant_name": formValue.applicant_name,
|
||||
"applicant_title_name": formValue.applicant_title_name,
|
||||
"company_name": formValue.company_name,
|
||||
"mobile_no": formValue.mobile_no,
|
||||
"landline": concat_landline1,
|
||||
"applicant_type": 1,
|
||||
"relation": "",
|
||||
});
|
||||
}
|
||||
|
||||
formValue.items.forEach((itemElement, itemIndex) => {
|
||||
let obj1 = {
|
||||
"applicant_name": itemElement.coapplicantName,
|
||||
"applicant_title_name": itemElement.applicant_title_name,
|
||||
"company_name": itemElement.company_name,
|
||||
"mobile_no": itemElement.coapplicant_mobile_no,
|
||||
"landline": itemElement.coapplicant_landline,
|
||||
"applicant_type": 0,
|
||||
"relation": "",
|
||||
}
|
||||
pd_applicant_details.push(obj1)
|
||||
});
|
||||
|
||||
// formValue.items.forEach((itemElement, itemIndex) => {
|
||||
// let obj1 = {
|
||||
// "applicant_name":itemElement.coapplicantName,
|
||||
// "relation":itemElement.relationship,
|
||||
// "email":"",
|
||||
// "mobile_no":itemElement.coapplicant_mobile_no,
|
||||
// "landline":itemElement.coapplicant_landline,
|
||||
// "applicant_type":0,
|
||||
// }
|
||||
// pd_applicant_details.push(obj1)
|
||||
// });
|
||||
// docs details
|
||||
let pd_form: FormData = new FormData();
|
||||
|
||||
// docs details
|
||||
let pd_form: FormData = new FormData();
|
||||
for (let j = 0; j < this.totalfiles.length; j++) {
|
||||
pd_form.append('pddocuments[]', <File>this.totalfiles[j])
|
||||
}
|
||||
|
||||
for(let j=0;j<this.totalfiles.length; j++)
|
||||
{
|
||||
pd_form.append('pddocuments[]',<File>this.totalfiles[j])
|
||||
}
|
||||
//reverseFileNames=this.totalFileName.reverse();
|
||||
|
||||
//reverseFileNames=this.totalFileName.reverse();
|
||||
let AllFilesObj = []
|
||||
|
||||
let AllFilesObj= []
|
||||
formValue.documents.forEach((element, index) => {
|
||||
AllFilesObj.push(element.doc_name);
|
||||
});
|
||||
pd_form.append("pd_details", JSON.stringify(pd_details))
|
||||
if (pd_applicant_details.length > 0) {
|
||||
pd_form.append("pd_applicant_details", JSON.stringify(pd_applicant_details))
|
||||
}
|
||||
|
||||
formValue.documents.forEach((element, index) => {
|
||||
AllFilesObj.push(element.doc_name);
|
||||
});
|
||||
pd_form.append("pd_details",JSON.stringify(pd_details))
|
||||
if(pd_applicant_details.length>0){
|
||||
pd_form.append("pd_applicant_details",JSON.stringify(pd_applicant_details))
|
||||
}
|
||||
pd_form.append("pd_document_titles", JSON.stringify(AllFilesObj))
|
||||
if (formValue.addtional_requirements.length > 0) {
|
||||
pd_form.append("addtional_requirements", JSON.stringify(formValue.addtional_requirements))
|
||||
|
||||
pd_form.append("pd_document_titles",JSON.stringify(AllFilesObj))
|
||||
if(formValue.addtional_requirements.length > 0){
|
||||
pd_form.append("addtional_requirements",JSON.stringify(formValue.addtional_requirements))
|
||||
|
||||
}
|
||||
// console.log('pd_form',pd_form);
|
||||
// console.log('pd_details',pd_details);
|
||||
this._pd.addPdDetails(pd_form).subscribe(result => {
|
||||
if (result.status == 200) {
|
||||
}
|
||||
// console.log('pd_form',pd_form);
|
||||
// console.log('pd_details',pd_details);
|
||||
this._pd.addPdDetails(pd_form).subscribe(result => {
|
||||
if (result.status == 200) {
|
||||
this.disableAfterSubmit = false;
|
||||
this.notifier.notify('success', 'PD Saved.');
|
||||
this.loadPdListCompoent(true);
|
||||
}
|
||||
else {
|
||||
this.disableAfterSubmit = false;
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
}
|
||||
}, error => {
|
||||
this.disableAfterSubmit = false;
|
||||
this.notifier.notify('success', 'PD Saved.');
|
||||
this.loadPdListCompoent(true);
|
||||
}
|
||||
else {
|
||||
this.disableAfterSubmit = false;
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
}
|
||||
}, error => {
|
||||
this.disableAfterSubmit = false;
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
loadPdListCompoent(from: boolean) {
|
||||
//alert(from);
|
||||
if (from) {
|
||||
// alert('if'+from);
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
this.ListPdComponent.pdListLoad(true);
|
||||
}
|
||||
loadPdListCompoent(from:boolean) {
|
||||
//alert(from);
|
||||
if(from){
|
||||
// alert('if'+from);
|
||||
this.router.navigate([ '../../' ], { relativeTo: this.route });
|
||||
this.ListPdComponent.pdListLoad(true);
|
||||
}
|
||||
else{
|
||||
// alert(from);
|
||||
this.router.navigate([ '../../' ], { relativeTo: this.route });
|
||||
this.ListPdComponent.showListView(true);
|
||||
}
|
||||
|
||||
}
|
||||
ngOnDestroy(): void {
|
||||
else {
|
||||
// alert(from);
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
this.ListPdComponent.showListView(true);
|
||||
}
|
||||
/** To Reset Popup Data */
|
||||
onReset() {
|
||||
|
||||
}
|
||||
ngOnDestroy(): void {
|
||||
this.ListPdComponent.showListView(true);
|
||||
}
|
||||
/** To Reset Popup Data */
|
||||
onReset() {
|
||||
this.loadFormData();
|
||||
this.disableAfterSubmit = false;
|
||||
}
|
||||
@ -577,30 +575,29 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
// validate all form group and form array fields
|
||||
validateAllFormFields(formGroup: any) {
|
||||
Object.keys(formGroup.controls).forEach(field => {
|
||||
validateAllFormFields(formGroup: any) {
|
||||
Object.keys(formGroup.controls).forEach(field => {
|
||||
const control = formGroup.get(field);
|
||||
|
||||
if (control instanceof FormControl) {
|
||||
control.markAsTouched({ onlySelf: true });
|
||||
control.markAsTouched({ onlySelf: true });
|
||||
} else if (control instanceof FormGroup) {
|
||||
this.validateAllFormFields(control);
|
||||
this.validateAllFormFields(control);
|
||||
} else if (control instanceof FormArray) {
|
||||
this.validateAllFormFields(control);
|
||||
this.validateAllFormFields(control);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** To Convert Amount into Words */
|
||||
inWords(e,flag:number){
|
||||
switch(flag){
|
||||
case 1 :
|
||||
this.loanAmtInWords = this._pd.convertNumberToWords(e.target.value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** To Convert Amount into Words */
|
||||
inWords(e, flag: number) {
|
||||
switch (flag) {
|
||||
case 1:
|
||||
this.loanAmtInWords = this._pd.convertNumberToWords(e.target.value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user