pd changes
This commit is contained in:
parent
0b093503a3
commit
beb703e938
@ -1,164 +1,196 @@
|
||||
<mat-card class="p-1">
|
||||
<form [formGroup]="PDtriggerForm" (submit)="submitPdDetails()">
|
||||
<mat-card-content>
|
||||
<div class="mb-2"></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>PD Details</h5>
|
||||
|
||||
<div fxLayout="column" fxLayoutAlign="start stretch">
|
||||
<!-- <mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="First Name" type="text" name="name" required>
|
||||
</mat-form-field> -->
|
||||
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-select placeholder="Lender Name" [formControl]="PDtriggerForm.controls['fk_lender_id']" required>
|
||||
<mat-option *ngFor="let LL of LenderList" [value]="LL.lender_hierarchy_id" >
|
||||
{{LL.lender_hierarchy}}
|
||||
</mat-option>
|
||||
<mat-error *ngIf="!PDtriggerForm.controls['fk_lender_id'].valid && PDtriggerForm.controls['fk_lender_id'].touched" class="mat-text-warn">You must include a Pick up Lender Name.</mat-error>
|
||||
</mat-select>
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Lender Applicant ID" required [formControl]="PDtriggerForm.controls['lender_applicant_id']" type="text">
|
||||
<mat-error *ngIf="!PDtriggerForm.controls['lender_applicant_id'].valid && PDtriggerForm.controls['lender_applicant_id'].touched" class="mat-text-warn">You must include Lender Applicant Id.</mat-error>
|
||||
</mat-form-field>
|
||||
<!-- <mat-form-field style="width: 100%">
|
||||
|
||||
<input matInput placeholder="PD Date of Initiation" [formControl]="PDtriggerForm.controls['pd_date_of_initiation']" type="date">
|
||||
|
||||
</mat-form-field>-->
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-select placeholder="Product Name" [formControl]="PDtriggerForm.controls['fk_product_id']">
|
||||
<mat-option *ngFor="let PL of ProductList" [value]="PL" >
|
||||
{{PL.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 100%">
|
||||
|
||||
<mat-select placeholder="Sub product Name" [formControl]="PDtriggerForm.controls['fk_subproduct_id']">
|
||||
<mat-option *ngFor="let SPL of SubProductList" [value]="SPL" >
|
||||
{{SPL.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-select placeholder="Customer Segment" [formControl]="PDtriggerForm.controls['fk_customer_segment']">
|
||||
<mat-option *ngFor="let CSL of CustomerSegmentList" [value]="CSL.customer_segment_id" >
|
||||
{{CSL.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-select placeholder="PD Type" [formControl]="PDtriggerForm.controls['fk_pd_type']">
|
||||
<mat-option *ngFor="let PDL of PDTypeList" [value]="PDL.pd_type_id" >
|
||||
{{PDL.type_name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Loan Amount" [formControl]="PDtriggerForm.controls['loan_amount']">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Address 1" [formControl]="PDtriggerForm.controls['addressline1']">
|
||||
|
||||
</mat-form-field>
|
||||
<form [formGroup]="PDtriggerForm" (submit)="submitPdDetails(PDtriggerForm.value)">
|
||||
<mat-card-content>
|
||||
<div class="mb-2"></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>PD Details</h5>
|
||||
|
||||
<div fxLayout="column" fxLayoutAlign="start stretch">
|
||||
<!-- <mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="First Name" type="text" name="name" required>
|
||||
</mat-form-field> -->
|
||||
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Address 2" [formControl]="PDtriggerForm.controls['addressline2']">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-select placeholder="Lender Name" [formControl]="PDtriggerForm.controls['fk_lender_id']" required>
|
||||
<mat-option *ngFor="let LL of LenderList" [value]="LL.lender_hierarchy_id" >
|
||||
{{LL.lender_hierarchy}}
|
||||
</mat-option>
|
||||
<mat-error *ngIf="!PDtriggerForm.controls['fk_lender_id'].valid && PDtriggerForm.controls['fk_lender_id'].touched" class="mat-text-warn">You must include a Pick up Lender Name.</mat-error>
|
||||
</mat-select>
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Lender Applicant ID" required [formControl]="PDtriggerForm.controls['lender_applicant_id']" type="text">
|
||||
<mat-error *ngIf="!PDtriggerForm.controls['lender_applicant_id'].valid && PDtriggerForm.controls['lender_applicant_id'].touched" class="mat-text-warn">You must include Lender Applicant Id.</mat-error>
|
||||
</mat-form-field>
|
||||
<!-- <mat-form-field style="width: 100%">
|
||||
|
||||
<input matInput placeholder="PD Date of Initiation" [formControl]="PDtriggerForm.controls['pd_date_of_initiation']" type="date">
|
||||
|
||||
</mat-form-field>-->
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-select placeholder="Product Name" [formControl]="PDtriggerForm.controls['fk_product_id']">
|
||||
<mat-option *ngFor="let PL of ProductList" [value]="PL" >
|
||||
{{PL.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Address 3" [formControl]="PDtriggerForm.controls['addressline3']">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%;">
|
||||
<mat-select placeholder="Select City" [formControl]="PDtriggerForm.controls['fk_city']" >
|
||||
` <mat-option *ngFor="let CL of CityList" [value]="CL">
|
||||
{{CL.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%;">
|
||||
<mat-select placeholder="Pickup the State" [formControl]="PDtriggerForm.controls['fk_state']" >
|
||||
<mat-option *ngFor="let SL of StateList" [value]="SL">
|
||||
{{SL.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 100%;">
|
||||
<input matInput placeholder="Pincode" [formControl]="PDtriggerForm.controls['pincode']">
|
||||
</mat-form-field>
|
||||
</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>Main Applicant Details</h5>
|
||||
|
||||
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Name" [formControl]="PDtriggerForm.controls['applicant_name']">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Email" [formControl]="PDtriggerForm.controls['email']" type="email">
|
||||
<!-- <small *ngIf="PDtriggerForm.controls['email'].hasError('required') && PDtriggerForm.controls['email'].touched" class="mat-text-warn">You must include an email address.</small>
|
||||
<small *ngIf="PDtriggerForm.controls['email'].errors?.email && PDtriggerForm.controls['email'].touched" class="mat-text-warn">You must include a valid email address.</small> -->
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Phone" [formControl]="PDtriggerForm.controls['mobile_no']" type="text">
|
||||
<!-- <small *ngIf="PDtriggerForm.controls['mobile_no'].hasError('required') && PDtriggerForm.controls['mobile_no'].touched" class="mat-text-warn">You must include phone number.</small>
|
||||
<small *ngIf="PDtriggerForm.controls['mobile_no'].errors?.phone && PDtriggerForm.controls['mobile_no'].touched" class="mat-text-warn">You must include a valid phone number.</small> -->
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
|
||||
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutWrap="wrap" formArrayName="items" *ngFor="let coDetails of PDtriggerForm.get('items')['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>{{PDtriggerForm.controls.items.controls[i].controls.label.value}} {{i+1}}</h5>
|
||||
<div [formGroupName]="i">
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Name" formControlName="coapplicantName" type="text">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Relation" formControlName="relationship" type="text">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
|
||||
<mat-select placeholder="Sub product Name" [formControl]="PDtriggerForm.controls['fk_subproduct_id']">
|
||||
<mat-option *ngFor="let SPL of SubProductList" [value]="SPL" >
|
||||
{{SPL.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-select placeholder="Customer Segment" [formControl]="PDtriggerForm.controls['fk_customer_segment']">
|
||||
<mat-option *ngFor="let CSL of CustomerSegmentList" [value]="CSL.customer_segment_id" >
|
||||
{{CSL.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-select placeholder="PD Type" [formControl]="PDtriggerForm.controls['fk_pd_type']">
|
||||
<mat-option *ngFor="let PDL of PDTypeList" [value]="PDL.pd_type_id" >
|
||||
{{PDL.type_name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Loan Amount" [formControl]="PDtriggerForm.controls['loan_amount']">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<textarea matInput placeholder="Address 1" [formControl]="PDtriggerForm.controls['addressline1']"></textarea>
|
||||
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 100%">
|
||||
<textarea matInput placeholder="Address 2" [formControl]="PDtriggerForm.controls['addressline2']"></textarea>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 100%">
|
||||
<textarea matInput placeholder="Address 3" [formControl]="PDtriggerForm.controls['addressline3']"></textarea>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%;">
|
||||
<mat-select placeholder="Select City" [formControl]="PDtriggerForm.controls['fk_city']" >
|
||||
` <mat-option *ngFor="let CL of CityList" [value]="CL">
|
||||
{{CL.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%;">
|
||||
<mat-select placeholder="Pickup the State" [formControl]="PDtriggerForm.controls['fk_state']" >
|
||||
<mat-option *ngFor="let SL of StateList" [value]="SL">
|
||||
{{SL.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 100%;">
|
||||
<input matInput placeholder="Pincode" [formControl]="PDtriggerForm.controls['pincode']">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</mat-card>
|
||||
</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>Main Applicant Details</h5>
|
||||
|
||||
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Name" [formControl]="PDtriggerForm.controls['applicant_name']">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Email" [formControl]="PDtriggerForm.controls['email']" type="email">
|
||||
<!-- <small *ngIf="PDtriggerForm.controls['email'].hasError('required') && PDtriggerForm.controls['email'].touched" class="mat-text-warn">You must include an email address.</small>
|
||||
<small *ngIf="PDtriggerForm.controls['email'].errors?.email && PDtriggerForm.controls['email'].touched" class="mat-text-warn">You must include a valid email address.</small> -->
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Phone" [formControl]="PDtriggerForm.controls['mobile_no']" type="text">
|
||||
<!-- <small *ngIf="PDtriggerForm.controls['mobile_no'].hasError('required') && PDtriggerForm.controls['mobile_no'].touched" class="mat-text-warn">You must include phone number.</small>
|
||||
<small *ngIf="PDtriggerForm.controls['mobile_no'].errors?.phone && PDtriggerForm.controls['mobile_no'].touched" class="mat-text-warn">You must include a valid phone number.</small> -->
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
|
||||
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutWrap="wrap" formArrayName="items" *ngFor="let coDetails of PDtriggerForm.get('items')['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>{{PDtriggerForm.controls.items.controls[i].controls.label.value}} {{i+1}}</h5>
|
||||
<div [formGroupName]="i">
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Name" formControlName="coapplicantName" type="text">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Relation" formControlName="relationship" type="text">
|
||||
</mat-form-field>
|
||||
</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" style="opacity: 0.5;">
|
||||
<!-- <button _ngcontent-c29="" class="mr-1 mb-2 mat-fab1 mat-accent" mat-fab="" (click)="addCoApplicant(createWithLongContent)"><span class="mat-button-wrapper"><mat-icon _ngcontent-c29="" class="mat-icon material-icons" role="img" aria-hidden="true">add</mat-icon></span><div class="mat-button-ripple mat-ripple mat-button-ripple-round" matripple=""></div><div class="mat-button-focus-overlay"></div></button> -->
|
||||
<button _ngcontent-c39="" class="mr-1 mb-1 mat-button" type="button"><span style="opacity: 0.5;" (click)="addCoApplicant()" class="mat-button-wrapper">Add More Co-Applicant</span><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>
|
||||
<div fxLayout="row" fxLayoutWrap="wrap">
|
||||
|
||||
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="30" fxFlex.lg="50" fxFlex.xl="30">
|
||||
<mat-card class="p-2" style="opacity: 0.5;">
|
||||
<!-- <button _ngcontent-c29="" class="mr-1 mb-2 mat-fab1 mat-accent" mat-fab="" (click)="addCoApplicant(createWithLongContent)"><span class="mat-button-wrapper"><mat-icon _ngcontent-c29="" class="mat-icon material-icons" role="img" aria-hidden="true">add</mat-icon></span><div class="mat-button-ripple mat-ripple mat-button-ripple-round" matripple=""></div><div class="mat-button-focus-overlay"></div></button> -->
|
||||
<button _ngcontent-c39="" class="mr-1 mb-1 mat-button" mat-button=""><span style="opacity: 0.5;" (click)="addCoApplicant()" class="mat-button-wrapper">Add More Co-Applicant</span><div class="mat-button-ripple mat-ripple" matripple=""></div><div class="mat-button-focus-overlay"></div></button>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<button mat-raised-button color="primary" type="submit" [disabled]="!PDtriggerForm.valid">Submit</button>
|
||||
</mat-card-actions>
|
||||
</form>
|
||||
</mat-card>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
|
||||
|
||||
<mat-card class="p-2" formArrayName="documents">
|
||||
<mat-list>
|
||||
<mat-list-item>
|
||||
<!-- <button mat-raised-button mat-button-sm color="primary" type="button">Add Document</button> -->
|
||||
<button _ngcontent-c39="" class="mr-1 mb-1 mat-button" type="button"><span style="opacity: 0.5;" (click)="addMoreDocs()" class="mat-button-wrapper">Add Document</span><div class="mat-button-ripple mat-ripple" matripple=""></div><div class="mat-button-focus-overlay"></div></button>
|
||||
|
||||
</mat-list-item>
|
||||
</mat-list>
|
||||
<mat-list *ngFor="let docList of documents.controls; let d = index;" [formGroupName]="d">
|
||||
<!-- <h3 mat-subheader>Upload Documents</h3> -->
|
||||
<mat-list-item>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Document Name" formControlName="doc_name" type="text">
|
||||
</mat-form-field>
|
||||
|
||||
</mat-list-item>
|
||||
<mat-list-item>
|
||||
<input type="file" title="Browse Document" (change)="fileSelectionEvent($event,d)" formControlName="documentFile">
|
||||
</mat-list-item>
|
||||
<mat-list-item>
|
||||
<button mat-raised-button mat-button-sm color="accent" (click)="removeItem(d)" type="button">Remove</button>
|
||||
</mat-list-item>
|
||||
</mat-list>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
<mat-card-actions>
|
||||
<button mat-raised-button color="primary" type="submit" [disabled]="!PDtriggerForm.valid">Submit</button>
|
||||
</mat-card-actions>
|
||||
</form>
|
||||
</mat-card>
|
||||
|
||||
@ -2,6 +2,7 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||
import { CustomValidators } from 'ng2-validation';
|
||||
import { PdTrigerService } from '../pd-service/pd-triger.service';
|
||||
import { AwsService } from '../../AwsService/aws.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-add-pd',
|
||||
@ -25,10 +26,14 @@ export class AddPdComponent implements OnInit {
|
||||
// Dynamic co applicant
|
||||
createWithLongContent = false;
|
||||
dynamicCoApplicant = [];
|
||||
constructor(private _fb: FormBuilder,
|
||||
private _pd: PdTrigerService) { }
|
||||
|
||||
constructor(private _fb: FormBuilder,
|
||||
private _pd: PdTrigerService, private _aws:AwsService) { }
|
||||
public totalfiles: Array<File> =[];
|
||||
public totalFileName = [];
|
||||
public lengthCheckToaddMore =0;
|
||||
ngOnInit() {
|
||||
|
||||
this.PDtriggerForm = this._fb.group({
|
||||
fk_lender_id: [null, Validators.compose([Validators.required])],
|
||||
lender_applicant_id: [null, Validators.compose([Validators.required])],
|
||||
@ -36,7 +41,7 @@ export class AddPdComponent implements OnInit {
|
||||
fk_subproduct_id: [null, Validators.compose([Validators.required])],
|
||||
fk_pd_type: [null, Validators.compose([Validators.required])],
|
||||
fk_customer_segment: [null, Validators.compose([Validators.required])],
|
||||
loan_amount: [null],
|
||||
loan_amount: [null, Validators.compose([Validators.required])],
|
||||
applicant_name: [null, Validators.compose([Validators.required])],
|
||||
mobile_no: [null, Validators.compose([Validators.required])],
|
||||
email: [null, Validators.compose([Validators.required, CustomValidators.email])],
|
||||
@ -45,8 +50,9 @@ export class AddPdComponent implements OnInit {
|
||||
addressline3: [null],
|
||||
fk_city: [null, Validators.compose([Validators.required])],
|
||||
fk_state: [null, Validators.compose([Validators.required])],
|
||||
pincode : [null],
|
||||
items: this._fb.array([])
|
||||
pincode : [null, Validators.compose([Validators.required])],
|
||||
items: this._fb.array([]),
|
||||
documents: this._fb.array([])
|
||||
});
|
||||
|
||||
this._pd.getAllMasterDatas('CITY')
|
||||
@ -142,11 +148,132 @@ this._pd.getAllMasterDatas('PDTYPE')
|
||||
this.items.push(this.createItem());
|
||||
}
|
||||
}
|
||||
submitPdDetails() {
|
||||
if(this.PDtriggerForm.valid){
|
||||
var my_array = this.PDtriggerForm.value;
|
||||
Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
|
||||
|
||||
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){
|
||||
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])],
|
||||
});
|
||||
}
|
||||
|
||||
get documents(): FormArray {
|
||||
return this.PDtriggerForm.get('documents') as FormArray;
|
||||
};
|
||||
|
||||
removeItem(index: number) {
|
||||
this.totalfiles.splice(index,1);
|
||||
this.totalFileName.splice(index,1);
|
||||
this.documents.removeAt(index);
|
||||
this.lengthCheckToaddMore=this.lengthCheckToaddMore-1;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
reader.readAsDataURL(fileInput.target.files[0]);
|
||||
}
|
||||
|
||||
if(this.totalfiles.length == 1)
|
||||
{
|
||||
this.lengthCheckToaddMore=1;
|
||||
}
|
||||
}
|
||||
submitPdDetails(formValue: any) {
|
||||
if(this.PDtriggerForm.valid){
|
||||
// let my_array = this.PDtriggerForm.value;
|
||||
// Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
|
||||
let pd_details:any={
|
||||
"fk_lender_id":formValue.fk_lender_id,
|
||||
"lender_applicant_id":formValue.lender_applicant_id,
|
||||
"fk_product_id":formValue.fk_product_id.product_id,
|
||||
"fk_subproduct_id":formValue.fk_subproduct_id.subproduct_id,
|
||||
"fk_pd_type":formValue.fk_pd_type,
|
||||
"fk_customer_segment":formValue.fk_customer_segment,
|
||||
"loan_amount":formValue.loan_amount,
|
||||
"addressline1":formValue.addressline1,
|
||||
"addressline2":formValue.addressline2,
|
||||
"addressline3":formValue.addressline3,
|
||||
"fk_city":formValue.fk_city.city_id,
|
||||
"fk_state":formValue.fk_state.state_id,
|
||||
"pincode ":formValue.pincode ,
|
||||
"fk_createdby" : this._aws.getlocale(),
|
||||
"createdon": new Date().toJSON().slice(0,19).replace('T',' ')
|
||||
};
|
||||
let pd_applicant_details : any=[{
|
||||
"applicant_name":formValue.applicant_name,
|
||||
"email":formValue.email,
|
||||
"mobile_no":formValue.mobile_no,
|
||||
"applicant_type":1,
|
||||
"relationship":"",
|
||||
}];
|
||||
formValue.items.forEach((itemElement, itemIndex) => {
|
||||
let obj1 = {
|
||||
"applicant_name":itemElement.coapplicantName,
|
||||
"relationship":itemElement.relationship,
|
||||
"email":"",
|
||||
"mobile_no":"",
|
||||
"applicant_type":0,
|
||||
}
|
||||
pd_applicant_details.push(obj1)
|
||||
});
|
||||
|
||||
// docs details
|
||||
let pd_form: FormData = new FormData();
|
||||
|
||||
for(let j=0;j<this.totalfiles.length; j++)
|
||||
{
|
||||
|
||||
pd_form.append(this.totalFileName[j],<File>this.totalfiles[j])
|
||||
}
|
||||
|
||||
//reverseFileNames=this.totalFileName.reverse();
|
||||
|
||||
let AllFilesObj= []
|
||||
|
||||
formValue.documents.forEach((element, index) => {
|
||||
// let eachObj=
|
||||
// {
|
||||
// 'doc_name' : element.doc_name,
|
||||
// 'file_name' : this.totalFileName[index]
|
||||
// }
|
||||
AllFilesObj.push(element.doc_name);
|
||||
});
|
||||
pd_form.append("pd_details",JSON.stringify(pd_details))
|
||||
pd_form.append("pd_applicant_details",JSON.stringify(pd_applicant_details))
|
||||
pd_form.append("pd_document_titles",JSON.stringify(AllFilesObj))
|
||||
|
||||
this._pd.addPdDetails(pd_form).subscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,6 +32,12 @@ export class PdTrigerService {
|
||||
catchError(this.handleError('role', []))
|
||||
)
|
||||
}
|
||||
addPdDetails(pdForm: any): Observable<any> {
|
||||
return this._http.post<any>(this.apiUrl+"triggerNewPD", pdForm)
|
||||
.pipe(
|
||||
catchError(this.handleError('operation', []))
|
||||
)
|
||||
}
|
||||
|
||||
private handleError<T>(operation = 'operation', result?: T) {
|
||||
return (error: any): Observable<T> => {
|
||||
|
||||
@ -8,7 +8,7 @@ import {
|
||||
MatRadioModule,
|
||||
MatButtonModule,MatTableModule,MatPaginatorModule,
|
||||
MatProgressBarModule,MatDialogModule, MatSortModule,
|
||||
MatToolbarModule,MatSelectModule } from '@angular/material';
|
||||
MatToolbarModule,MatSelectModule, MatListModule } from '@angular/material';
|
||||
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload';
|
||||
@ -39,7 +39,7 @@ import { PdTrigerService } from './pd-service/pd-triger.service';
|
||||
FlexLayoutModule,
|
||||
NgxDatatableModule,
|
||||
FormsModule,MatSlideToggleModule,
|
||||
MatSelectModule,
|
||||
MatSelectModule, MatListModule,
|
||||
ReactiveFormsModule,
|
||||
FileUploadModule,
|
||||
TreeModule,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user