This commit is contained in:
venbatechnologies@gmail.com 2018-10-06 19:06:01 +05:30
commit bf18fbd17f
32 changed files with 1874 additions and 508 deletions

View File

@ -11,7 +11,8 @@ import {
CognitoUserSession CognitoUserSession
} from "amazon-cognito-identity-js"; } from "amazon-cognito-identity-js";
import { environment } from '../../environments/environment'; import { environment } from '../../environments/environment';
import { BehaviorSubject } from 'rxjs';
import { BehaviorSubject,Observable,of } from 'rxjs';
const sineedge_poolData = { const sineedge_poolData = {
UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV
ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB
@ -122,7 +123,32 @@ isloggin:boolean = false;
// callback.callbackWithParam(null); // callback.callbackWithParam(null);
// } // }
// } // }
refresh() {
let tokenexp:boolean;
this.getCurrentUser().getSession(function (err, session) {
if (err) {
console.log("CognitoUtil: Can't set the credentials:" + err);
}
else {
if (session.isValid()) {
tokenexp = session.isValid();
of(tokenexp)
console.log("CognitoUtil: refreshed successfully");
} else {
tokenexp = session.isValid();
console.log("CognitoUtil: refreshed but session is still not valid");
}
}
return tokenexp;
});
}
getAccessToken(){ getAccessToken(){
this.refresh();
let jwttoken = ''; let jwttoken = '';
if (this.getCurrentUser() != null) { if (this.getCurrentUser() != null) {
//console.log(JSON.stringify(this.getCurrentUser())); //console.log(JSON.stringify(this.getCurrentUser()));

View File

@ -27,8 +27,10 @@ export class AuthGuard implements CanActivate, CanActivateChild {
return true; return true;
} else { } else {
// alert("else"); // alert("else");
this.router.navigate(['/login']); setTimeout(() => {
this.router.navigate(['authentication/login']);
return false; return false;
},1000);
} }
} }

View File

@ -6,25 +6,25 @@
<div class="branding text-center"> <div class="branding text-center">
<!-- <h2><i class="fa fa-superpowers" aria-hidden="true"></i> <span> OPTIMA</span> <!-- <h2><i class="fa fa-superpowers" aria-hidden="true"></i> <span> OPTIMA</span>
</h2> --> </h2> -->
<h2><i class="fa fa-superpowers" aria-hidden="true"></i> <span> {{userDep}} </span> <h2><img [src]="'https://download.zoho.com/webdownload?x-service=CLIQ&event-id=0e17e076835b478c3ae33ddb3d3408e239e7c1f79dd4c2a1b626222e2cc1f221a8d3a027733fc52e82bc85cc5b0111d594abef51a345b4a64531af51c8e8c5bd'" style="height: 50px;;"> <span> {{userDep}} </span>
</h2> </h2>
</div> </div>
<div class="main-nav"> <div class="main-nav">
<div class="user-pro-wrap"> <div class="user-pro-wrap">
<div class="user-profile-thumb text-center"> <div class="user-profile-thumb text-center">
<div class="user-i"> <div class="user-i">
<img src="assets/images/userpic.jpg" class="rad-full mb-1" width="100" height="100" alt=""> <img [src]="profileurl ||'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/No_image_available.svg/1024px-No_image_available.svg.png'" class="rad-full mb-1" width="100" height="100" alt="">
<div> <span>{{fullName}}</span></div> <div> <span>{{fullName}}</span></div>
</div> </div>
</div> </div>
<div class="most-used text-center"> <div class="most-used text-center">
<a class="most-link" color="primary"> <a class="most-link" color="primary" (click)="menunav('HOME')">
<mat-icon>home</mat-icon> <mat-icon>home</mat-icon>
</a> </a>
<a class="most-link" color="primary"> <a class="most-link" color="primary" (click)="menunav('USERS')">
<mat-icon>person</mat-icon> <mat-icon>person</mat-icon>
</a> </a>
<a class="most-link" color="primary"> <a class="most-link" color="primary" (click)="menunav('SETTINGS')">
<mat-icon>settings</mat-icon> <mat-icon>settings</mat-icon>
</a> </a>
</div> </div>
@ -61,6 +61,23 @@
<a [routerLink]="['/', menuitem.state, childitem.state ]" class="relative" mat-ripple>{{ childitem.name | translate }}</a> <a [routerLink]="['/', menuitem.state, childitem.state ]" class="relative" mat-ripple>{{ childitem.name | translate }}</a>
</mat-list-item> </mat-list-item>
</mat-nav-list> </mat-nav-list>
<!-- Multi-->
<a appAccordionToggle class="relative" mat-ripple href="javascript:;" *ngIf="menuitem.type === 'multi'">
<mat-icon>{{ menuitem.icon }}</mat-icon>
<span>{{ menuitem.name | translate }}</span>
<span fxFlex></span>
<span class="menu-badge mat-{{ badge.type }}" *ngFor="let badge of menuitem.badge">{{ badge.value }}</span>
<mat-icon class="menu-caret">arrow_drop_down</mat-icon>
</a>
<div *ngFor="let multichild of menuitem.multichild" >
<mat-nav-list class="sub-menu" *ngIf="multichild.type === 'sub'">
<mat-list-item *ngFor="let childitem of multichild.children" routerLinkActive="open">
<a [routerLink]="['/', multichild.state, childitem.state ]" class="relative" mat-ripple>{{ childitem.name | translate }}</a>
</mat-list-item>
</mat-nav-list>
</div>
<!--End-->
</mat-list-item> </mat-list-item>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<!-- <mat-list-item> <!-- <mat-list-item>
@ -124,11 +141,11 @@
Lorem ipsum dolor sit amet consectetur. Lorem ipsum dolor sit amet consectetur.
</button> </button>
</mat-menu> </mat-menu>
<button [mat-menu-trigger-for]="user1" mat-icon-button class="ml-xs overflow-visible"> <!-- <button [mat-menu-trigger-for]="user1" mat-icon-button class="ml-xs overflow-visible">
<mat-icon>reorder</mat-icon> <mat-icon>reorder</mat-icon>
<span class="notification-label">3</span> <span class="notification-label">3</span>
</button> </button> -->
<mat-menu #user1="matMenu" class="opt-menu" x-position="before"> <!-- <mat-menu #user1="matMenu" class="opt-menu" x-position="before">
<div mat-menu-item class="head-menu grad-blue"> <div mat-menu-item class="head-menu grad-blue">
User Menu User Menu
</div> </div>
@ -144,7 +161,7 @@
<mat-icon>web</mat-icon> <mat-icon>web</mat-icon>
Calendar Settings Calendar Settings
</button> </button>
</mat-menu> </mat-menu> -->
<button (click)="end.toggle()" mat-icon-button class="ml-xs overflow-visible"> <button (click)="end.toggle()" mat-icon-button class="ml-xs overflow-visible">
<mat-icon>notifications</mat-icon> <mat-icon>notifications</mat-icon>
<span class="notification-label">2</span> <span class="notification-label">2</span>
@ -214,7 +231,7 @@
Lorem ipsum dolor sit amet consectetur. Lorem ipsum dolor sit amet consectetur.
</button> </button>
</mat-menu> </mat-menu>
<button [mat-menu-trigger-for]="user1" mat-icon-button class="ml-xs overflow-visible"> <!-- <button [mat-menu-trigger-for]="user1" mat-icon-button class="ml-xs overflow-visible">
<mat-icon>reorder</mat-icon> <mat-icon>reorder</mat-icon>
<span class="notification-label">3</span> <span class="notification-label">3</span>
</button> </button>
@ -234,7 +251,7 @@
<mat-icon>web</mat-icon> <mat-icon>web</mat-icon>
Calendar Settings Calendar Settings
</button> </button>
</mat-menu> </mat-menu> -->
<button (click)="end.toggle()" mat-icon-button class="ml-xs overflow-visible"> <button (click)="end.toggle()" mat-icon-button class="ml-xs overflow-visible">
<mat-icon>notifications</mat-icon> <mat-icon>notifications</mat-icon>
<span class="notification-label">2</span> <span class="notification-label">2</span>
@ -287,6 +304,7 @@
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
</ul> </ul>
</nav> </nav>

View File

@ -19,6 +19,7 @@ import { AwsService } from '../../AwsService/aws.service';
}) })
export class AdminLayoutComponent implements OnInit, OnDestroy { export class AdminLayoutComponent implements OnInit, OnDestroy {
profileurl: any;;
userDep: string; userDep: string;
fullName: any; fullName: any;
currentUser: any; currentUser: any;
@ -49,17 +50,31 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
this.users.getroles().subscribe(res=>{ this.users.getroles().subscribe(res=>{
this.currentUser = res; this.currentUser = res;
if(this.currentUser.dataStatus == true){ if(this.currentUser.dataStatus == true){
this.currentUser = this.currentUser.records[0]; this.currentUser = this.currentUser.records[0];
this.fullName = this.currentUser.user_first_name +' '+this.currentUser.user_last_name; this.fullName = this.currentUser.user_first_name +' '+this.currentUser.user_last_name;
//console.log(this.currentUser); //console.log(this.currentUser);
if(this.currentUser.fk_entity_id == 1 ){ if(this.currentUser.fk_entity_id == 1 ){
this.userDep = "SINEEGDE"; this.userDep = "SineEdge";
}else if(this.currentUser.fk_entity_id ==2){ }else if(this.currentUser.fk_entity_id ==2){
this.userDep = "LENDOR"; this.userDep = "Lender";
}else{ }else{
this.userDep = "VENDOR"; this.userDep = "Vendor";
} }
let users= {
'userid':this.currentUser.userid,
'entityid':this.currentUser.fk_entity_id,
'profilepic':this.currentUser.profilepic
}
this.users.getprofilepic(users).subscribe(res=>{
this.profileurl = res;
if(this.profileurl.dataStatus == true){
this.profileurl = this.profileurl.records;
}
})
} }
}); });
@ -75,6 +90,7 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
}); });
} }
this._router = this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe((event: NavigationEnd) => { this._router = this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe((event: NavigationEnd) => {
this.url = event.url; this.url = event.url;
if (this.isOver()) { if (this.isOver()) {
@ -232,4 +248,16 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
this.router.navigate(['/authentication/login']); this.router.navigate(['/authentication/login']);
}) })
} }
menunav(active){
switch(active){
case 'HOME':
this.router.navigate(['/home']);
break;
case 'USERS':
this.router.navigate(['/setting/users/userprofile']);
break;
case 'SETTING':
break;
}
}
} }

View File

@ -1,5 +1,5 @@
<mat-card class="p-1"> <mat-card class="p-1">
<form [formGroup]="PDtriggerForm" (submit)="submitPdDetails(PDtriggerForm.value)"> <form [formGroup]="_PDtriggerForm" (submit)="submitPdDetails(_PDtriggerForm.value)">
<mat-card-content> <mat-card-content>
<div class="mb-2"></div> <div class="mb-2"></div>
<div fxLayout="row" fxLayoutWrap="wrap"> <div fxLayout="row" fxLayoutWrap="wrap">
@ -13,186 +13,218 @@
</mat-form-field> --> </mat-form-field> -->
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">
<mat-select placeholder="Lender Name" [formControl]="PDtriggerForm.controls['fk_lender_id']" required> <mat-select placeholder="Lender Name" formControlName="fk_lender_id" required>
<mat-option *ngFor="let LL of LenderList" [value]="LL.lender_hierarchy_id" > <mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" >
{{LL.lender_hierarchy}} {{LL.full_name}}
</mat-option> </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-select> <mat-error *ngIf="pdMain.fk_lender_id.hasError('required')" class="mat-text-warn">Lender name is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Lender Applicant ID" formControlName="lender_applicant_id" type="text" required>
<mat-error *ngIf="pdMain.lender_applicant_id.hasError('required')">Applicant id is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Product Name" formControlName="fk_product_id" (selectionChange)="getSubproductList(pdMain.fk_product_id.value)" required>
<mat-option *ngFor="let PL of productList" [value]="PL.product_id" >
{{PL.product_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_product_id.hasError('required')">Product is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Sub product Name" formControlName="fk_subproduct_id" required>
<mat-option *ngFor="let SPL of subProductList" [value]="SPL.subproduct_id" >
{{SPL.subproduct_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_subproduct_id.hasError('required')">Sub product is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Customer Segment" formControlName="fk_customer_segment" required>
<mat-option *ngFor="let CSL of customerSegmentList" [value]="CSL.customer_segment_id" >
{{CSL.customer_segment}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer segment is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type" required>
<mat-option *ngFor="let PDL of pdTypeList" [value]="PDL.pd_type_id" >
{{PDL.type_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD type is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Loan Amount" formControlName="loan_amount" required>
<mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<textarea matInput placeholder="Address 1" formControlName="addressline1" required></textarea>
<mat-error *ngIf="pdMain.addressline1.hasError('required')">Address1 required.</mat-error>
</mat-form-field> </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-form-field style="width: 100%">
<mat-select placeholder="Product Name" [formControl]="PDtriggerForm.controls['fk_product_id']"> <textarea matInput placeholder="Address 2" formControlName="addressline2"></textarea>
<mat-option *ngFor="let PL of ProductList" [value]="PL" > </mat-form-field>
{{PL.name}}
</mat-option> <mat-form-field style="width: 100%">
<textarea matInput placeholder="Address 3" formControlName="addressline3"></textarea>
</mat-form-field>
<mat-form-field style="width: 100%;">
<mat-select placeholder="Select State" formControlName="fk_state" (selectionChange)="getCityList(pdMain.fk_state.value)" required>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.state_name}}
</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="pdMain.fk_state.hasError('required')">State is required.</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 100%;">
<mat-select placeholder="Select City" formControlName="fk_city" required>
` <mat-option *ngFor="let CL of cityList" [value]="CL.city_id">
{{CL.city_name}}
</mat-option>
<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-select>
<mat-error *ngIf="pdMain.fk_city.hasError('required')">City is required.</mat-error>
</mat-form-field> </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-form-field style="width: 100%;">
<mat-select placeholder="Pickup the State" [formControl]="PDtriggerForm.controls['fk_state']" > <input matInput placeholder="Pincode" formControlName="pincode" required>
<mat-option *ngFor="let SL of StateList" [value]="SL"> <mat-error *ngIf="pdMain.pincode.hasError('required')">Pincode is required.</mat-error>
{{SL.name}} </mat-form-field>
</mat-option> <mat-slide-toggle formControlName="allocation_type"
</mat-select> class="example-margin" id="type"
</mat-form-field> [(ngModel)]="allocationTypeCheck" (change)="changeAllocationType(allocationTypeCheck)"
checked="allocationTypeModel==1 ? false:allocationTypeModel==2 ? false:allocationTypeModel==3 ? true"> {{allocationLabel}}
</mat-slide-toggle>
<mat-slide-toggle *ngIf="allocationTypeModel==1 || allocationTypeModel==2" formControlName="sub_allocation_type"
class="example-margin" id="subType"
[(ngModel)]="subAllocationTypeCheck" (change)="changeSubAllocationType(subAllocationTypeCheck)"
checked="allocationTypeModel==1 ? false:allocationTypeModel==2 ? true"> {{subAllocationLabel}}
</mat-slide-toggle>
<mat-form-field style="width: 100%;">
<input matInput placeholder="Pincode" [formControl]="PDtriggerForm.controls['pincode']">
</mat-form-field>
</div> </div>
</mat-card> </mat-card>
</div> </div>
</div> </div>
<div fxLayout="row" fxLayoutWrap="wrap"> <div fxLayout="row" fxLayoutWrap="wrap">
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100"> <div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-card class="p-2"> <mat-card class="p-2">
<h5>Main Applicant Details</h5> <h5>Main Applicant</h5>
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">
<input matInput placeholder="Name" [formControl]="PDtriggerForm.controls['applicant_name']"> <input matInput placeholder="Name" formControlName="applicant_name" required>
<mat-error *ngIf="pdMain.applicant_name.hasError('required')">Name is required.</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">
<input matInput placeholder="Email" [formControl]="PDtriggerForm.controls['email']" type="email"> <input matInput placeholder="Email" formControlName="email" type="email" required>
<!-- <small *ngIf="PDtriggerForm.controls['email'].hasError('required') && PDtriggerForm.controls['email'].touched" class="mat-text-warn">You must include an email address.</small> <mat-error *ngIf="pdMain.email.hasError('required')">Email is required.</mat-error>
<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>
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">
<input matInput placeholder="Phone" [formControl]="PDtriggerForm.controls['mobile_no']" type="text"> <input matInput placeholder="Phone" formControlName="mobile_no" type="text" required>
<!-- <small *ngIf="PDtriggerForm.controls['mobile_no'].hasError('required') && PDtriggerForm.controls['mobile_no'].touched" class="mat-text-warn">You must include phone number.</small> <mat-error *ngIf="pdMain.mobile_no.hasError('required')">Mobile number is required.</mat-error>
<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-form-field>
</mat-card> </mat-card>
</div> </div>
</div> </div>
<div fxLayout="row" fxLayoutWrap="wrap" formArrayName="items" *ngFor="let coDetails of PDtriggerForm.get('items')['controls']; let i = index;"> <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"> <div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-card class="p-2"> <mat-card class="p-2">
<h5>{{PDtriggerForm.controls.items.controls[i].controls.label.value}} {{i+1}}</h5> <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">
</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"> <div [formGroupName]="i">
<mat-card class="p-2" style="opacity: 0.5;"> <mat-form-field style="width: 100%">
<!-- <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> --> <input matInput placeholder="Name" formControlName="coapplicantName" type="text" required>
<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> </mat-form-field>
<!-- <button mat-raised-button mat-button-sm color="primary" (click)="addCoApplicant()" type="button">Add More Co-Applicant</button> --> <mat-form-field style="width: 100%">
<input matInput placeholder="Phone" formControlName="coapplicant_mobile_no" type="text">
</mat-card> </mat-form-field>
</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-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">
<mat-card class="p-2" formArrayName="documents"> <div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-list> <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="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-list-item>
<!-- <button mat-raised-button mat-button-sm color="primary" type="button">Add Document</button> --> <mat-form-field style="width: 100%">
<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> <input matInput placeholder="Document Name" formControlName="doc_name" type="text">
</mat-form-field>
</mat-list-item> </mat-list-item>
</mat-list> <mat-list-item>
<mat-list *ngFor="let docList of documents.controls; let d = index;" [formGroupName]="d"> <input type="file" title="Browse Document" (change)="fileSelectionEvent($event,d)" formControlName="documentFile">
<!-- <h3 mat-subheader>Upload Documents</h3> --> </mat-list-item>
<mat-list-item> <mat-list-item>
<mat-form-field style="width: 100%"> <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="removeItem(d)"
<input matInput placeholder="Document Name" formControlName="doc_name" type="text"> (click)="loadPdListCompoent()"><mat-icon>delete</mat-icon></button>
</mat-form-field> <!-- <button mat-button color="accent" (click)="removeItem(d)" type="button">Remove</button> -->
</mat-list-item>
</mat-list-item> </mat-list>
<mat-list-item> </mat-card>
<input type="file" title="Browse Document" (change)="fileSelectionEvent($event,d)" formControlName="documentFile"> </div>
</mat-list-item> </div>
<mat-list-item>
<button mat-button color="accent" (click)="removeItem(d)" type="button">Remove</button>
</mat-list-item>
</mat-list>
</mat-card>
</div>
</div>
</mat-card-content> </mat-card-content>
<hr> <!-- <mat-card-actions style="text-align: right">
<mat-card-actions style="text-align: right">
<button mat-button color="accent" type="button" (click)="loadPdListCompoent()">Cancel</button> <button mat-button color="accent" type="button" (click)="loadPdListCompoent()">Cancel</button>
<button mat-button color="primary" type="submit" [disabled]="!PDtriggerForm.valid">Submit</button> <button mat-button color="primary" type="submit" [disabled]="!PDtriggerForm.valid">Submit</button>
</mat-card-actions> </mat-card-actions> -->
<mat-card-actions style="text-align: right">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button"
(click)="loadPdListCompoent()"><mat-icon>close</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="submit"><mat-icon>save</mat-icon></button>
</mat-card-actions>
</form> </form>
</mat-card> </mat-card>
<notifier-container></notifier-container>

View File

@ -1,9 +1,9 @@
import { Component, OnInit, ViewEncapsulation, Output, EventEmitter } from '@angular/core'; import { Component, OnInit, ViewEncapsulation, Output, EventEmitter } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { CustomValidators } from 'ng2-validation'; import { CustomValidators } from 'ng2-validation';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../pd-service/pd-triger.service'; import { PdTrigerService } from '../pd-service/pd-triger.service';
import { AwsService } from '../../AwsService/aws.service'; import { AwsService } from '../../AwsService/aws.service';
@Component({ @Component({
selector: 'app-add-pd', selector: 'app-add-pd',
templateUrl: './add-pd.component.html', templateUrl: './add-pd.component.html',
@ -12,31 +12,39 @@ import { AwsService } from '../../AwsService/aws.service';
}) })
export class AddPdComponent implements OnInit { export class AddPdComponent implements OnInit {
@Output() loadParent = new EventEmitter<string>(); @Output() loadParent = new EventEmitter<string>();
public notifier: NotifierService;
public PDtriggerForm: FormGroup; public _PDtriggerForm: FormGroup;
items: FormArray; items: FormArray;
CityList: any; productList:any;
StateList: any; subProductList:any;
LenderList: any; lenderList:any;
customerSegmentList:any;
ProductList: any; stateList:any;
SubProductList: any; cityList:any;
CustomerSegmentList: any; pdTypeList:any;
PDTypeList: any;
ApplicantTypeList: any;
errorMessage: any; errorMessage: any;
// Dynamic co applicant // Dynamic co applicant
createWithLongContent = false; createWithLongContent = false;
dynamicCoApplicant = []; dynamicCoApplicant = [];
allocationTypeModel: number;
allocationTypeCheck: boolean;
subAllocationTypeCheck: boolean;
allocationLabel: string;
subAllocationLabel: string;
constructor(private _fb: FormBuilder, constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, private _aws:AwsService) { } private _pd: PdTrigerService, private _aws:AwsService, notifier: NotifierService) {
this.notifier = notifier;
}
public totalfiles: Array<File> =[]; public totalfiles: Array<File> =[];
public totalFileName = []; public totalFileName = [];
public lengthCheckToaddMore =0; public lengthCheckToaddMore =0;
ngOnInit() { ngOnInit() {
this.getLenderList();
this.PDtriggerForm = this._fb.group({ this.getProductsList();
this.getCustomerSegmentList();
this.getStateCityList();
this.getPDTypeList();
this._PDtriggerForm = this._fb.group({
fk_lender_id: [null, Validators.compose([Validators.required])], fk_lender_id: [null, Validators.compose([Validators.required])],
lender_applicant_id: [null, Validators.compose([Validators.required])], lender_applicant_id: [null, Validators.compose([Validators.required])],
fk_product_id: [null, Validators.compose([Validators.required])], fk_product_id: [null, Validators.compose([Validators.required])],
@ -53,100 +61,102 @@ export class AddPdComponent implements OnInit {
fk_city: [null, Validators.compose([Validators.required])], fk_city: [null, Validators.compose([Validators.required])],
fk_state: [null, Validators.compose([Validators.required])], fk_state: [null, Validators.compose([Validators.required])],
  pincode : [null, Validators.compose([Validators.required])],   pincode : [null, Validators.compose([Validators.required])],
  allocation_type: [null],
  sub_allocation_type: [null],
items: this._fb.array([]), items: this._fb.array([]),
documents: this._fb.array([]) documents: this._fb.array([])
}); });
this._pd.getAllMasterDatas('CITY')
.subscribe(
data => {
if (data.status == 200) {
this.CityList = data.records;
this.CityList = this.CityList.filter(city=>city.isactive == 1 );
}
}, error => this.errorMessage = <any> error);
this._pd.getAllMasterDatas('STATE')
.subscribe(
data => {
if (data.status == 200) {
this.StateList = data.records;
this.StateList = this.StateList.filter(city=>city.isactive == 1 );
}
}, error => this.errorMessage = <any> error);
this._pd.getAllMasterDatas('LENDERHIERARCHY')
.subscribe(
data => {
if (data.status == 200) {
this.LenderList = data.records;
this.LenderList = this.LenderList.filter(city=>city.isactive == 1 );
}
}, error => this.errorMessage = <any> error);
this._pd.getAllMasterDatas('PRODUCTS')
.subscribe(
data => {
if (data.status == 200) {
this.ProductList = data.records;
this.ProductList = this.ProductList.filter(city=>city.isactive == 1 );
}
}, error => this.errorMessage = <any> error);
this._pd.getAllMasterDatas('SUBPRODUCTS')
.subscribe(
data => {
if (data.status == 200) {
this.SubProductList = data.records;
this.SubProductList = this.SubProductList.filter(city=>city.isactive == 1 );
}
}, error => this.errorMessage = <any> error);
this._pd.getAllMasterDatas('CUSTOMERSEGMENT')
.subscribe(
data => {
if (data.status == 200) {
this.CustomerSegmentList = data.records;
this.CustomerSegmentList = this.CustomerSegmentList.filter(city=>city.isactive == 1 );
}
}, error => this.errorMessage = <any> error);
this._pd.getAllMasterDatas('PDTYPE')
.subscribe(
data => {
if (data.status == 200) {
this.PDTypeList = data.records;
this.PDTypeList = this.PDTypeList.filter(city=>city.isactive == 1 );
}
}, error => this.errorMessage = <any> error);
} }
getLenderList(){
this._pd.getLenderDetails().subscribe(
data => {
if (data.status == 200) {
this.lenderList=data.records
}
}, error => this.errorMessage = <any> error);
}
getProductsList(){
this._pd.getProductsDetails().subscribe(
data => {
if (data.status == 200) {
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);
}
getStateCityList(){
this._pd.getStateCityDetails().subscribe(
data => {
if (data.status == 200) {
this.stateList=data.records
}
}, error => this.errorMessage = <any> error);
}
getPDTypeList(){
this._pd.getPDTypeDetails().subscribe(
data => {
if (data.status == 200) {
this.pdTypeList=data.records.pd_type;
if(data.records.pd_allocation_type){
let getDefaultAllocation= data.records.pd_allocation_type.filter(item => item.default == 1);
if(getDefaultAllocation[0].pd_allocation_type_id==1){
this.allocationTypeModel=1;
this.allocationTypeCheck=false;
this.subAllocationTypeCheck=false;
this.allocationLabel="Auto";
this.subAllocationLabel="Load Balance";
}
else if(this.allocationTypeModel[0].pd_allocation_type_id==2){
this.allocationTypeModel=2;
this.allocationTypeCheck=false;
this.subAllocationTypeCheck=true;
this.allocationLabel="Auto";
this.subAllocationLabel="Nearest";
}
else if(this.allocationTypeModel[0].pd_allocation_type_id==3){
this.allocationTypeModel=3;
this.allocationTypeCheck=true;
this.allocationLabel="Manual";
}
}
}
}, 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;
}
//get city list details based on state id
getCityList(stateID:string){
this.cityList= this.stateList.filter(item => item.state_id == stateID);
this.cityList=this.cityList[0].cities;
}
createItem(): FormGroup { createItem(): FormGroup {
return this._fb.group({ return this._fb.group({
label: ['Co Applicant Details'], label: ['Co Applicant'],
coapplicantName: [null, Validators.compose([Validators.required])], coapplicantName: [null, Validators.compose([Validators.required])],
coapplicant_mobile_no: [],
relationship: [null], relationship: [null],
}); });
}; };
addCoApplicant() { addCoApplicant() {
if(this.PDtriggerForm.valid){ if(this._PDtriggerForm.valid){
this.items = this.PDtriggerForm.get('items') as FormArray; this.items = this._PDtriggerForm.get('items') as FormArray;
this.items.push(this.createItem()); this.items.push(this.createItem());
} }
} }
@ -174,8 +184,11 @@ this._pd.getAllMasterDatas('PDTYPE')
} }
get documents(): FormArray { get documents(): FormArray {
return this.PDtriggerForm.get('documents') as FormArray; return this._PDtriggerForm.get('documents') as FormArray;
}; };
get pdMain() { return this._PDtriggerForm.controls; }
get pdCoApplicant() { return this._PDtriggerForm.get('items') as FormArray; }
removeItem(index: number) { removeItem(index: number) {
this.totalfiles.splice(index,1); this.totalfiles.splice(index,1);
@ -212,23 +225,24 @@ this._pd.getAllMasterDatas('PDTYPE')
} }
} }
submitPdDetails(formValue: any) { submitPdDetails(formValue: any) {
if(this.PDtriggerForm.valid){ if(this._PDtriggerForm.valid){
// let my_array = this.PDtriggerForm.value; // let my_array = this.PDtriggerForm.value;
// Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]); // Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
let pd_details:any={ let pd_details:any={
"fk_lender_id":formValue.fk_lender_id, "fk_lender_id":formValue.fk_lender_id,
"lender_applicant_id":formValue.lender_applicant_id, "lender_applicant_id":formValue.lender_applicant_id,
"fk_product_id":formValue.fk_product_id.product_id, "fk_product_id":formValue.fk_product_id,
"fk_subproduct_id":formValue.fk_subproduct_id.subproduct_id, "fk_subproduct_id":formValue.fk_subproduct_id,
"fk_pd_type":formValue.fk_pd_type, "fk_pd_type":formValue.fk_pd_type,
"fk_customer_segment":formValue.fk_customer_segment, "fk_customer_segment":formValue.fk_customer_segment,
"loan_amount":formValue.loan_amount, "loan_amount":formValue.loan_amount,
"addressline1":formValue.addressline1, "addressline1":formValue.addressline1,
"addressline2":formValue.addressline2, "addressline2":formValue.addressline2,
"addressline3":formValue.addressline3, "addressline3":formValue.addressline3,
"fk_city":formValue.fk_city.city_id, "fk_city":formValue.fk_city,
"fk_state":formValue.fk_state.state_id, "fk_state":formValue.fk_state,
"pincode ":formValue.pincode , "pincode":formValue.pincode ,
"fk_pd_allocation_type":this.allocationTypeModel ,
"fk_createdby" : this._aws.getlocale(), "fk_createdby" : this._aws.getlocale(),
"createdon": new Date().toJSON().slice(0,19).replace('T',' ') "createdon": new Date().toJSON().slice(0,19).replace('T',' ')
}; };
@ -237,14 +251,14 @@ this._pd.getAllMasterDatas('PDTYPE')
"email":formValue.email, "email":formValue.email,
"mobile_no":formValue.mobile_no, "mobile_no":formValue.mobile_no,
"applicant_type":1, "applicant_type":1,
"relationship":"", "relation":"",
}]; }];
formValue.items.forEach((itemElement, itemIndex) => { formValue.items.forEach((itemElement, itemIndex) => {
let obj1 = { let obj1 = {
"applicant_name":itemElement.coapplicantName, "applicant_name":itemElement.coapplicantName,
"relationship":itemElement.relationship, "relation":itemElement.relationship,
"email":"", "email":"",
"mobile_no":"", "mobile_no":itemElement.coapplicant_mobile_no,
"applicant_type":0, "applicant_type":0,
} }
pd_applicant_details.push(obj1) pd_applicant_details.push(obj1)
@ -255,8 +269,7 @@ this._pd.getAllMasterDatas('PDTYPE')
for(let j=0;j<this.totalfiles.length; j++) for(let j=0;j<this.totalfiles.length; j++)
{ {
pd_form.append('pddocuments[]',<File>this.totalfiles[j])
pd_form.append(this.totalFileName[j],<File>this.totalfiles[j])
} }
//reverseFileNames=this.totalFileName.reverse(); //reverseFileNames=this.totalFileName.reverse();
@ -275,7 +288,40 @@ this._pd.getAllMasterDatas('PDTYPE')
pd_form.append("pd_applicant_details",JSON.stringify(pd_applicant_details)) pd_form.append("pd_applicant_details",JSON.stringify(pd_applicant_details))
pd_form.append("pd_document_titles",JSON.stringify(AllFilesObj)) pd_form.append("pd_document_titles",JSON.stringify(AllFilesObj))
this._pd.addPdDetails(pd_form).subscribe(); this._pd.addPdDetails(pd_form).subscribe(result => {
if (result.status == 200) {
this.notifier.notify('success', 'PD Saved Successfully.!');
this.loadPdListCompoent();
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
}
changeAllocationType(status: boolean) {
if(status){
this.allocationTypeModel=3;
this.allocationLabel="Manual";
}
else{
this.allocationTypeModel=1;
this.allocationLabel="Auto";
this.subAllocationLabel="Load Balance";
}
}
changeSubAllocationType(status: boolean){
if(status){
this.allocationTypeModel=2;
this.allocationLabel="Auto";
this.subAllocationLabel="Nearest";
}
else{
this.allocationTypeModel=1;
this.allocationLabel="Auto";
this.subAllocationLabel="Load Balance";
} }
} }
loadPdListCompoent() { loadPdListCompoent() {

View File

@ -0,0 +1,74 @@
<mat-card class="p-1">
<form [formGroup]="_EditApplicantForm" (submit)="updatePdApplicant(_EditApplicantForm.value)">
<mat-card-content>
<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" required>
<mat-error *ngIf="pdMainApplicant.applicant_name.hasError('required')">Name is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Email" formControlName="email" type="email" required>
<mat-error *ngIf="pdMainApplicant.email.hasError('required')">Email number is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Phone" formControlName="mobile_no" type="text" required>
<mat-error *ngIf="pdMainApplicant.mobile_no.hasError('required')">Mobile number is required.</mat-error>
</mat-form-field>
</mat-card>
</div>
</div>
<div fxLayout="row" fxLayoutWrap="wrap" formArrayName="coApplicantItems" *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-error *ngIf="pdCoApplicant.coapplicantName.hasError('required')">Name is required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Phone" formControlName="coapplicant_mobile_no" 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-c39="" class="mr-1 mb-1 mat-button" type="button"><span style="opacity: 0.5;" (click)="addCoApplicant(emptyData)" 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 style="text-align: right">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button"
(click)="loadPdMasterCompoent()"><mat-icon>close</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="submit"><mat-icon>save</mat-icon></button>
</mat-card-actions>
</form>
</mat-card>
<notifier-container></notifier-container>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EditPdApplicantComponent } from './edit-pd-applicant.component';
describe('EditPdApplicantComponent', () => {
let component: EditPdApplicantComponent;
let fixture: ComponentFixture<EditPdApplicantComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditPdApplicantComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EditPdApplicantComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,122 @@
import { Component, OnInit,ViewEncapsulation, EventEmitter, Input, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { CustomValidators } from 'ng2-validation';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../pd-service/pd-triger.service';
@Component({
selector: 'app-edit-pd-applicant',
templateUrl: './edit-pd-applicant.component.html',
styleUrls: ['./edit-pd-applicant.component.scss'],
encapsulation: ViewEncapsulation.None,
})
export class EditPdApplicantComponent implements OnInit {
errorMessage: any;
@Input() applicantChild: any;
@Output() loadPdView = new EventEmitter<string>();
public _EditApplicantForm:FormGroup;
public notifier: NotifierService;
mainApplicantData: any[];
coApplicantData: any[];
coApplicantItems:FormArray;
emptyData:any;
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier: NotifierService,) {
this.notifier=notifier
}
ngOnInit() {
this.mainApplicantData= this.applicantChild.filter(item => item.applicant_type == 1);
this.coApplicantData= this.applicantChild.filter(item => item.applicant_type == 0);
this.loadApplicantFormData();
}
loadApplicantFormData() {
this._EditApplicantForm = this._fb.group({
fk_applicant_primary_id: [this.mainApplicantData[0].pd_co_applicant_id],
applicant_name: [this.mainApplicantData[0].applicant_name, Validators.compose([Validators.required])],
mobile_no: [this.mainApplicantData[0].mobile_no, Validators.compose([Validators.required])],
email: [this.mainApplicantData[0].email, Validators.compose([Validators.required, CustomValidators.email])],
applicant_type: [this.mainApplicantData[0].applicant_type, Validators.compose([Validators.required])],
coApplicantItems: this._fb.array([]),
});
// bind dynamic co applicant data
if(this.coApplicantData.length > 0){
for(let value of this.coApplicantData){
this.addCoApplicant(value);
}
}
}
createItem(listData): FormGroup {
if(listData){
return this._fb.group({
label: ['Co Applicant'],
fk_applicant_primary_id: [listData.pd_co_applicant_id],
coapplicantName: [listData.applicant_name, Validators.compose([Validators.required])],
coapplicant_mobile_no: [listData.mobile_no],
relationship: [listData.relation],
applicant_type: [listData.applicant_type, Validators.compose([Validators.required])],
});
}
else{
return this._fb.group({
label: ['Co Applicant'],
fk_applicant_primary_id: [null],
coapplicantName: [null, Validators.compose([Validators.required])],
coapplicant_mobile_no: [],
relationship: [null],
applicant_type: [0],
});
}
};
addCoApplicant(listData) {
if(this._EditApplicantForm.valid){
this.coApplicantItems = this._EditApplicantForm.get('coApplicantItems') as FormArray;
this.coApplicantItems.push(this.createItem(listData));
}
}
get pdMainApplicant() { return this._EditApplicantForm.controls; }
get pdCoApplicant() { return this._EditApplicantForm.get('coApplicantItems') as FormArray; }
updatePdApplicant(formValue: any) {
if(this._EditApplicantForm.valid){
let pd_applicant_details : any=[{
"fk_pd_id": this.mainApplicantData[0].fk_pd_id,
"pd_co_applicant_id": formValue.fk_applicant_primary_id,
"applicant_name":formValue.applicant_name,
"email":formValue.email,
"mobile_no":formValue.mobile_no,
"applicant_type":formValue.applicant_type,
"relation":formValue.relationship,
"isactive":1
}];
formValue.coApplicantItems.forEach((itemElement, itemIndex) => {
let obj1 = {
"fk_pd_id": this.mainApplicantData[0].fk_pd_id,
"pd_co_applicant_id": itemElement.fk_applicant_primary_id,
"applicant_name":itemElement.coapplicantName,
"relation":itemElement.relationship,
"email":"",
"mobile_no":itemElement.coapplicant_mobile_no,
"applicant_type":itemElement.applicant_type,
"isactive":1
}
pd_applicant_details.push(obj1)
});
this._pd.updatePdApplicant(pd_applicant_details).subscribe(result => {
if (result.status == 200) {
this.notifier.notify('success', 'PD Saved Successfully.!');
this.loadPdMasterCompoent();
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
}
loadPdMasterCompoent() {
this.loadPdView.emit('2')
}
}

View File

@ -0,0 +1,118 @@
<mat-card>
<form [formGroup]="_EditPDtriggerForm" (submit)="submitPdDetails(_EditPDtriggerForm.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">
<div fxLayout="column" fxLayoutAlign="start stretch">
<mat-form-field style="width: 100%">
<mat-select placeholder="Lender Name" formControlName="fk_lender_id" required>
<mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" >
{{LL.full_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_lender_id.hasError('required')" class="mat-text-warn">Lender name is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Lender Applicant ID" formControlName="lender_applicant_id" type="text" required>
<mat-error *ngIf="pdMain.lender_applicant_id.hasError('required')">Applicant id is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Product Name" formControlName="fk_product_id" (selectionChange)="getSubproductList(pdMain.fk_product_id.value)" required>
<mat-option *ngFor="let PL of productList" [value]="PL.product_id" >
{{PL.product_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_product_id.hasError('required')">Product is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Sub product Name" formControlName="fk_subproduct_id" required>
<mat-option *ngFor="let SPL of subProductList" [value]="SPL.subproduct_id" >
{{SPL.subproduct_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_subproduct_id.hasError('required')">Sub product is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Customer Segment" formControlName="fk_customer_segment" required>
<mat-option *ngFor="let CSL of customerSegmentList" [value]="CSL.customer_segment_id" >
{{CSL.customer_segment}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer segment is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type" required>
<mat-option *ngFor="let PDL of pdTypeList" [value]="PDL.pd_type_id" >
{{PDL.type_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD type is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Loan Amount" formControlName="loan_amount" required>
<mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<textarea matInput placeholder="Address 1" formControlName="addressline1" required></textarea>
<mat-error *ngIf="pdMain.addressline1.hasError('required')">Address1 required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<textarea matInput placeholder="Address 2" formControlName="addressline2"></textarea>
</mat-form-field>
<mat-form-field style="width: 100%">
<textarea matInput placeholder="Address 3" formControlName="addressline3"></textarea>
</mat-form-field>
<mat-form-field style="width: 100%;">
<mat-select placeholder="Select State" formControlName="fk_state" (selectionChange)="getCityList(pdMain.fk_state.value)" required>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.state_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_state.hasError('required')">State is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%;">
<mat-select placeholder="Select City" formControlName="fk_city" required>
` <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 is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%;">
<input matInput placeholder="Pincode" formControlName="pincode" required>
<mat-error *ngIf="pdMain.pincode.hasError('required')">Pincode is required.</mat-error>
</mat-form-field>
</div>
</div>
</div>
</mat-card-content>
<mat-card-actions style="text-align: right">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button"
(click)="loadPdMasterCompoent()"><mat-icon>close</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
</mat-card-actions>
</form>
</mat-card>
<notifier-container></notifier-container>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EditPdMasterComponent } from './edit-pd-master.component';
describe('EditPdMasterComponent', () => {
let component: EditPdMasterComponent;
let fixture: ComponentFixture<EditPdMasterComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditPdMasterComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EditPdMasterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,130 @@
import { Component, OnInit,ViewEncapsulation, EventEmitter, Input, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { CustomValidators } from 'ng2-validation';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../pd-service/pd-triger.service';
@Component({
selector: 'app-edit-pd-master',
templateUrl: './edit-pd-master.component.html',
styleUrls: ['./edit-pd-master.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class EditPdMasterComponent implements OnInit {
errorMessage: any;
productList:any;
subProductList:any;
lenderList:any;
customerSegmentList:any;
stateList:any;
cityList:any;
pdTypeList:any;
@Input() masterChild: any;
@Output() loadPdView = new EventEmitter<string>();
public _EditPDtriggerForm:FormGroup;
private notifier: NotifierService;
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier: NotifierService,) {
this.notifier=notifier
}
ngOnInit() {
this.getLenderList();
this.getProductsList();
this.getCustomerSegmentList();
this.getStateCityList();
this.getPDTypeList();
this.loadFormData();
}
getLenderList(){
this._pd.getLenderDetails().subscribe(
data => {
if (data.status == 200) {
this.lenderList=data.records
}
}, error => this.errorMessage = <any> error);
}
getProductsList(){
this._pd.getProductsDetails().subscribe(
data => {
if (data.status == 200) {
this.productList=data.records
this.getSubproductList(this.masterChild.fk_product_id);
}
}, 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
this.getCityList(this.masterChild.fk_state);
}
}, error => this.errorMessage = <any> error);
}
getPDTypeList(){
this._pd.getPDTypeDetails().subscribe(
data => {
if (data.status == 200) {
this.pdTypeList=data.records.pd_type;
}
}, error => this.errorMessage = <any> error);
}
loadFormData() {
this._EditPDtriggerForm = this._fb.group({
fk_primary_id: [this.masterChild.pd_id],
fk_lender_id: [this.masterChild.fk_lender_id, Validators.compose([Validators.required])],
lender_applicant_id: [this.masterChild.lender_applicant_id, Validators.compose([Validators.required])],
fk_product_id: [this.masterChild.fk_product_id, Validators.compose([Validators.required])],
fk_subproduct_id: [this.masterChild.fk_subproduct_id, Validators.compose([Validators.required])],
fk_pd_type: [this.masterChild.fk_pd_type, Validators.compose([Validators.required])],
fk_customer_segment: [this.masterChild.fk_customer_segment, Validators.compose([Validators.required])],
loan_amount: [this.masterChild.loan_amount, Validators.compose([Validators.required])],
  addressline1: [this.masterChild.addressline1, Validators.compose([Validators.required])],
addressline2: [this.masterChild.addressline2],
addressline3: [this.masterChild.addressline3],
fk_city: [this.masterChild.fk_city, Validators.compose([Validators.required])],
fk_state: [this.masterChild.fk_state, Validators.compose([Validators.required])],
  pincode : [this.masterChild.pincode, Validators.compose([Validators.required])],
});
}
get pdMain() { return this._EditPDtriggerForm.controls; }
//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;
}
//get city list details based on state id
getCityList(stateID:string){
this.cityList= this.stateList.filter(item => item.state_id == stateID);
this.cityList=this.cityList[0].cities;
}
submitPdDetails(formValue: any) {
if(this._EditPDtriggerForm.valid){
let my_array = this._EditPDtriggerForm.value;
Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
this._pd.editPdMasterDetails(my_array).subscribe();
}
}
loadPdMasterCompoent() {
this.notifier.notify('success', 'Your Changes Updated.!');
this.loadPdView.emit('1')
}
}

View File

@ -1,11 +1,123 @@
<mat-card class="p-1"> <mat-card class="p-1">
<form [formGroup]="_EditPDtriggerForm" (submit)="submitPdDetails(_EditPDtriggerForm.value)">
<mat-card-content> <mat-card-content>
{{ childData }} <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%">
<mat-select placeholder="Lender Name" formControlName="fk_lender_id" required>
<mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" >
{{LL.full_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_lender_id.hasError('required')" class="mat-text-warn">Lender name is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Lender Applicant ID" formControlName="lender_applicant_id" type="text">
<mat-error *ngIf="pdMain.lender_applicant_id.hasError('required')">Applicant id is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Product Name" formControlName="fk_product_id" (selectionChange)="getSubproductList(pdMain.fk_product_id.value.product_id)">
<mat-option *ngFor="let PL of productList" [value]="PL" >
{{PL.product_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_product_id.hasError('required')">Product is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Sub product Name" formControlName="fk_subproduct_id">
<mat-option *ngFor="let SPL of subProductList" [value]="SPL" >
{{SPL.subproduct_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_subproduct_id.hasError('required')">Sub product is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Customer Segment" formControlName="fk_customer_segment">
<mat-option *ngFor="let CSL of customerSegmentList" [value]="CSL.customer_segment_id" >
{{CSL.customer_segment}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer segment is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type">
<mat-option *ngFor="let PDL of pdTypeList" [value]="PDL.pd_type_id" >
{{PDL.type_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD type is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Loan Amount" formControlName="loan_amount">
<mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<textarea matInput placeholder="Address 1" formControlName="addressline1"></textarea>
<mat-error *ngIf="pdMain.addressline1.hasError('required')">Address1 required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<textarea matInput placeholder="Address 2" formControlName="addressline2"></textarea>
</mat-form-field>
<mat-form-field style="width: 100%">
<textarea matInput placeholder="Address 3" formControlName="addressline3"></textarea>
</mat-form-field>
<mat-form-field style="width: 100%;">
<mat-select placeholder="Select State" formControlName="fk_state" >
<mat-option *ngFor="let SL of stateList" [value]="SL">
{{SL.state_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_state.hasError('required')">State is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%;">
<mat-select placeholder="Select City" (selectionChange)="getCityList(pdMain.fk_state.value.state_id)" formControlName="fk_city" >
` <mat-option *ngFor="let CL of cityList" [value]="CL">
{{CL.name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_city.hasError('required')">City is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%;">
<input matInput placeholder="Pincode" formControlName="pincode">
<mat-error *ngIf="pdMain.pincode.hasError('required')">Pincode is required.</mat-error>
</mat-form-field>
</div>
</mat-card>
</div>
</div>
</mat-card-content> </mat-card-content>
<hr> <hr>
<mat-card-actions> <!-- <mat-card-actions style="text-align: right">
<button mat-button color="accent" type="button" (click)="loadPdListCompoent()">Cancel</button> <button mat-button color="accent" type="button" (click)="loadPdListCompoent()">Cancel</button>
</mat-card-actions>
<button mat-button color="primary" type="submit" [disabled]="!PDtriggerForm.valid">Submit</button>
</mat-card-actions> -->
</form>
</mat-card> </mat-card>

View File

@ -1,6 +1,8 @@
import { Component, OnInit,ViewEncapsulation, EventEmitter, Input, Output } from '@angular/core'; import { Component, OnInit,ViewEncapsulation, EventEmitter, Input, Output } from '@angular/core';
import { ListPdComponent } from '../list-pd/list-pd.component'; 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({ @Component({
selector: 'app-edit-pd', selector: 'app-edit-pd',
templateUrl: './edit-pd.component.html', templateUrl: './edit-pd.component.html',
@ -8,16 +10,147 @@ import { ListPdComponent } from '../list-pd/list-pd.component';
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })
export class EditPdComponent implements OnInit { export class EditPdComponent implements OnInit {
errorMessage: any;
public editData: any;
public productList:any;
subProductList:any;
lenderList:any;
customerSegmentList:any;
public stateList:any;
cityList:any;
pdTypeList:any;
@Input() childData: string; @Input() childData: string;
@Output() loadParent = new EventEmitter<string>(); @Output() loadParent = new EventEmitter<string>();
constructor() { public _EditPDtriggerForm:FormGroup;
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, private _aws:AwsService) {
} }
ngOnInit() { ngOnInit() {
this.getLenderList();
this.getProductsList();
this.getCustomerSegmentList();
this.getStateCityList();
this.getPDTypeList();
this.editPdDetails(this.childData);
this.beforeLoadFormData();
} }
editPdDetails(editID:string){
this._pd.editPdDetails(editID).subscribe(
data => {
if (data.status == 200) {
this.editData=data.records
this.afterLoadFormData();
}
}, error => this.errorMessage = <any> error);
}
loadPdListCompoent() { loadPdListCompoent() {
this.loadParent.emit('2') this.loadParent.emit('2')
} }
getLenderList(){
this._pd.getLenderDetails().subscribe(
data => {
if (data.status == 200) {
this.lenderList=data.records
}
}, error => this.errorMessage = <any> error);
}
getProductsList(){
this._pd.getProductsDetails().subscribe(
data => {
if (data.status == 200) {
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);
}
getStateCityList(){
this._pd.getStateCityDetails().subscribe(
data => {
if (data.status == 200) {
this.stateList=data.records
}
}, error => this.errorMessage = <any> error);
}
getPDTypeList(){
this._pd.getPDTypeDetails().subscribe(
data => {
if (data.status == 200) {
this.pdTypeList=data.records.pd_type;
}
}, error => this.errorMessage = <any> error);
}
beforeLoadFormData(){
this._EditPDtriggerForm = this._fb.group({
fk_lender_id: [null, Validators.compose([Validators.required])],
lender_applicant_id: [null, Validators.compose([Validators.required])],
fk_product_id: [null, Validators.compose([Validators.required])],
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, 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])],
  addressline1: [null, Validators.compose([Validators.required])],
addressline2: [null],
addressline3: [null],
fk_city: [null, Validators.compose([Validators.required])],
fk_state: [null, Validators.compose([Validators.required])],
  pincode : [null, Validators.compose([Validators.required])],
items: this._fb.array([]),
documents: this._fb.array([])
});
}
afterLoadFormData() {
this._EditPDtriggerForm = this._fb.group({
fk_lender_id: [null, Validators.compose([Validators.required])],
lender_applicant_id: [null, Validators.compose([Validators.required])],
fk_product_id: [null, Validators.compose([Validators.required])],
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, 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])],
  addressline1: [null, Validators.compose([Validators.required])],
addressline2: [null],
addressline3: [null],
fk_city: [null, Validators.compose([Validators.required])],
fk_state: [null, Validators.compose([Validators.required])],
  pincode : [null, Validators.compose([Validators.required])],
items: this._fb.array([]),
documents: this._fb.array([])
});
}
get pdMain() { return this._EditPDtriggerForm.controls; }
//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;
}
//get city list details based on state id
getCityList(stateID:string){
this.cityList= this.stateList.filter(item => item.state_id == stateID);
this.cityList=this.cityList[0].city;
}
submitPdDetails(formValue: any) {
if(this._EditPDtriggerForm.valid){
}
}
} }

View File

@ -5,104 +5,49 @@
<mat-tab-group> <mat-tab-group>
<mat-tab> <mat-tab>
<ng-template mat-tab-label>All PD Details</ng-template> <ng-template mat-tab-label>All PD Details</ng-template>
<mat-card-content>
<div class="card-comment-widget"> <div class="card-comment-widget">
<mat-list> <mat-list *ngIf="pdList.length > 0">
<mat-list-item *ngFor="let details of pdList"> <mat-list-item *ngFor="let details of dataSource.connect() | async">
<img mat-list-avatar src="assets/images/face3.jpg" alt=""> <img mat-list-avatar src="assets/images/face3.jpg" alt="">
<!-- {{details.applicat_details[0].applicant_name}} -->
<p mat-line>{{details.applicat_details[0].applicant_name}} </p> <p mat-line>{{details.applicat_details[0].applicant_name}} </p>
<p mat-line>{{details.lender_applicant_id}} &nbsp;&nbsp;{{details.pd_date_of_initiation}}</p> <p mat-line>{{details.lender_full_name}} &nbsp;&nbsp;&nbsp;{{details.lender_applicant_id}} &nbsp;&nbsp;{{details.pd_date_of_initiation}}</p>
<p mat-line>{{details.product_abbr}}/{{details.subproduct_abbr}}/{{details.customer_segment_abbr}}&nbsp;&nbsp;<i class="fa-1x fa fa-dollar">&nbsp;</i>{{details.loan_amount}}&nbsp;&nbsp;<i class="fa-1x fa fa-map-marker"> </i> &nbsp;{{details.state_name}}/{{details.city_name}}</p> <p mat-line>{{details.product_abbr}}/{{details.subproduct_abbr}}/{{details.customer_segment_abbr}}&nbsp;&nbsp;<span class="hover-icon"><i class="fa-1x fa fa-rupee">&nbsp;</i>{{details.loan_amount}}</span>&nbsp;&nbsp;<span class="hover-icon"><i class="fa-1x fa fa-map-marker"> </i> &nbsp;{{details.city_name}}/{{details.state_name}}-{{details.pincode}}</span></p>
<!-- <span class="text-mat mat-text-muted">Chennai</span> --> <!-- <span class="text-mat mat-text-muted">Chennai</span> -->
<div class="comment-time"> <!-- <div class="comment-time">
<!-- <a> <i class="fa ic-change fa-edit fa-lg"></i></a> --> <button mat-raised-button mat-icon-button mat-button-sm class="mr-1 mb-1" type="button" color="primary" (click)="editPdDetails(details.pd_id)"><mat-icon>edit</mat-icon></button>
<button mat-raised-button mat-icon-button mat-button-sm class="mr-1 mb-1" color="primary" (click)="editPdDetails(details.pd_id)"><mat-icon>edit</mat-icon></button>
</div> </div> -->
<div class="comment-time"> <div class="comment-time">
<!-- <a> <i class="fa ic-change fa-eye fa-lg"></i></a> --> <!-- <button mat-raised-button mat-icon-button mat-button-sm class="mr-1 mb-1" color="accent" type="button" (click)="viewPdDetails(details.pd_id)"><mat-icon>visibility</mat-icon></button> -->
<button mat-raised-button mat-icon-button mat-button-sm class="mr-1 mb-1" color="accent"><mat-icon>visibility</mat-icon></button> <button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="viewPdDetails(details.pd_id)"><mat-icon>visibility</mat-icon></button>
</div> </div>
<mat-divider></mat-divider>
</mat-list-item> </mat-list-item>
<hr>
<mat-list-item *ngFor="let details of pdList">
<img mat-list-avatar src="assets/images/face3.jpg" alt="">
<p mat-line>{{details.applicat_details[0].applicant_name}} </p>
<p mat-line>{{details.lender_applicant_id}} &nbsp;&nbsp;{{details.pd_date_of_initiation}}</p> </mat-list>
<p mat-line>{{details.product_abbr}}/{{details.subproduct_abbr}}/{{details.customer_segment_abbr}}&nbsp;&nbsp;<i class="fa-1x fa fa-dollar">&nbsp;</i>{{details.loan_amount}}&nbsp;&nbsp;<i class="fa-1x fa fa-map-marker"> </i> &nbsp;{{details.state_name}}/{{details.city_name}}</p> <mat-list *ngIf="recordStatus">
<!-- <span class="text-mat mat-text-muted">Chennai</span> --> <mat-list-item>
<p mat-line>No Record Found ...</p>
<div class="comment-time"> </mat-list-item>
<!-- <a> <i class="fa ic-change fa-edit fa-lg"></i></a> -->
<button mat-raised-button mat-icon-button mat-button-sm class="mr-1 mb-1" color="primary"><mat-icon>edit</mat-icon></button>
</div>
<div class="comment-time">
<!-- <a> <i class="fa ic-change fa-eye fa-lg"></i></a> -->
<button mat-raised-button mat-icon-button mat-button-sm class="mr-1 mb-1" color="accent"><mat-icon>visibility</mat-icon></button>
</div>
</mat-list-item>
<hr>
<mat-list-item *ngFor="let details of pdList">
<img mat-list-avatar src="assets/images/face3.jpg" alt="">
<p mat-line>{{details.applicat_details[0].applicant_name}} </p>
<p mat-line>{{details.lender_applicant_id}} &nbsp;&nbsp;{{details.pd_date_of_initiation}}</p>
<p mat-line>{{details.product_abbr}}/{{details.subproduct_abbr}}/{{details.customer_segment_abbr}}&nbsp;&nbsp;<i class="fa-1x fa fa-dollar">&nbsp;</i>{{details.loan_amount}}&nbsp;&nbsp;<i class="fa-1x fa fa-map-marker"> </i> &nbsp;{{details.state_name}}/{{details.city_name}}</p>
<!-- <span class="text-mat mat-text-muted">Chennai</span> -->
<div class="comment-time">
<!-- <a> <i class="fa ic-change fa-edit fa-lg"></i></a> -->
<button mat-raised-button mat-icon-button mat-button-sm class="mr-1 mb-1" color="primary"><mat-icon>edit</mat-icon></button>
</div>
<div class="comment-time">
<!-- <a> <i class="fa ic-change fa-eye fa-lg"></i></a> -->
<button mat-raised-button mat-icon-button mat-button-sm class="mr-1 mb-1" color="accent"><mat-icon>visibility</mat-icon></button>
</div>
</mat-list-item>
<hr>
<mat-list-item *ngFor="let details of pdList">
<img mat-list-avatar src="assets/images/face3.jpg" alt="">
<p mat-line>{{details.applicat_details[0].applicant_name}} </p>
<p mat-line>{{details.lender_applicant_id}} &nbsp;&nbsp;{{details.pd_date_of_initiation}}</p>
<p mat-line>{{details.product_abbr}}/{{details.subproduct_abbr}}/{{details.customer_segment_abbr}}&nbsp;&nbsp;<i class="fa-1x fa fa-dollar">&nbsp;</i>{{details.loan_amount}}&nbsp;&nbsp;<i class="fa-1x fa fa-map-marker"> </i> &nbsp;{{details.state_name}}/{{details.city_name}}</p>
<!-- <span class="text-mat mat-text-muted">Chennai</span> -->
<div class="comment-time">
<!-- <a> <i class="fa ic-change fa-edit fa-lg"></i></a> -->
<button mat-raised-button mat-icon-button mat-button-sm class="mr-1 mb-1" color="primary"><mat-icon>edit</mat-icon></button>
</div>
<div class="comment-time">
<!-- <a> <i class="fa ic-change fa-eye fa-lg"></i></a> -->
<button mat-raised-button mat-icon-button mat-button-sm class="mr-1 mb-1" color="accent"><mat-icon>visibility</mat-icon></button>
</div>
</mat-list-item>
<hr>
</mat-list>
</mat-list>
</div> </div>
</mat-card-content>
<mat-card-actions> <mat-card-actions *ngIf="!recordStatus">
<button mat-button (click)="addTileCols()" color="primary">ADD COLSPAN (THREE)</button> <mat-paginator #paginator [length]="pdList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
</mat-card-actions> [pageSizeOptions]="[5, 10, 25, 100]" (page)="pageEvent = $event; pageChange($event)">
</mat-paginator>
</mat-card-actions>
</mat-tab> </mat-tab>
<mat-tab> <!-- <mat-tab>
<ng-template mat-tab-label>Confirmed PD Details</ng-template> <ng-template mat-tab-label>Confirmed PD Details</ng-template>
<mat-card-content> <mat-card-content>
<mat-grid-list cols="2" [rowHeight]="ratio" gutterSize="4px"> <mat-grid-list cols="2" [rowHeight]="ratio" gutterSize="4px">
@ -135,37 +80,11 @@
</mat-form-field> </mat-form-field>
</div> </div>
</mat-card-content> </mat-card-content>
</mat-tab>
<!-- <mat-tab>
<ng-template mat-tab-label>Headers</ng-template>
<mat-card-content class="pa-0">
<mat-grid-list cols="3" rowHeight="200px">
<mat-grid-tile *ngFor="let dog of dogs" style="background:gray">
<mat-grid-tile-header>
<mat-icon mat-grid-avatar>info_outline</mat-icon>
{{dog.name}}
</mat-grid-tile-header>
</mat-grid-tile>
</mat-grid-list>
</mat-card-content>
</mat-tab>
<mat-tab>
<ng-template mat-tab-label>Footers</ng-template>
<mat-card-content class="pa-0">
<mat-grid-list cols="3" rowHeight="200px">
<mat-grid-tile *ngFor="let dog of dogs">
<img [alt]="dog.name" src="https://material.angularjs.org/material2_assets/ngconf/{{dog.name}}.png">
<mat-grid-tile-footer>
<h3 mat-line>{{dog.name}}</h3>
<span mat-line>Human: {{dog.human}}</span>
<mat-icon>star_border</mat-icon>
</mat-grid-tile-footer>
</mat-grid-tile>
</mat-grid-list>
</mat-card-content>
</mat-tab> --> </mat-tab> -->
</mat-tab-group> </mat-tab-group>
</mat-card> </mat-card>
<app-edit-pd *ngIf="showEditComponent" [childData]="parentEditData" (loadParent)="updateParentComponent($event)"></app-edit-pd> <app-edit-pd *ngIf="showEditComponent" [childData]="parentEditData" (loadParent)="updateParentComponent($event)"></app-edit-pd>
<app-add-pd *ngIf="showAddComponent" (loadParent)="updateParentComponent($event)"></app-add-pd> <app-add-pd *ngIf="showAddComponent" (loadParent)="updateParentComponent($event)"></app-add-pd>
<app-view-pd *ngIf="showViewComponent" [childData]="parentViewData" (loadParent)="updateParentComponent($event)"></app-view-pd>

View File

@ -1,4 +1,5 @@
import { Component, OnInit, ViewEncapsulation, EventEmitter, Output } from '@angular/core'; import { Component, ViewChild, OnInit, ViewEncapsulation, EventEmitter, Output } from '@angular/core';
import { MatPaginator, MatSort, MatTableDataSource, PageEvent } from '@angular/material';
import { PdTrigerService } from '../pd-service/pd-triger.service'; import { PdTrigerService } from '../pd-service/pd-triger.service';
@Component({ @Component({
@ -8,12 +9,28 @@ import { PdTrigerService } from '../pd-service/pd-triger.service';
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })
export class ListPdComponent implements OnInit { export class ListPdComponent implements OnInit {
recordStatus: boolean;
parentEditData :string; parentEditData :string;
parentViewData :string;
showParentComponent:boolean; showParentComponent:boolean;
showAddComponent:boolean; showAddComponent:boolean;
showEditComponent:boolean; showEditComponent:boolean;
showViewComponent:boolean;
errorMessage: any; errorMessage: any;
pdList:any[]; public paginationList: any[] = [];
// pagination variable details
length = 50;
pageIndex = 0;
pageSize = 10;
pageEvent: PageEvent;
// data source variable details
pdListData = null;
public dataLength: number;
public dataSource = new MatTableDataSource();
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
pdList:any[] = [];
tiles: any[] = [{ tiles: any[] = [{
text: 'One', text: 'One',
cols: 3, cols: 3,
@ -70,31 +87,52 @@ export class ListPdComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.recordStatus=false
this.showParentComponent=true this.showParentComponent=true
this.showAddComponent=false this.showAddComponent=false
this.showEditComponent=false this.showEditComponent=false
this.showViewComponent=false
this._pd.getPdDetails() this._pd.getPdDetails()
.subscribe( .subscribe(
data => { data => {
if (data.status == 200) { if (data.status == 200) {
this.pdList = data.records; this.pdList = data.records;
this.pdListData = data.records;
this.dataLength = data.records.length;
this.dataSource.data = this.pdListData;
}
else{
this.pdList=[];
this.dataLength = null;
this.recordStatus=true;
} }
}, error => this.errorMessage = <any> error); }, error => this.errorMessage = <any> error);
} }
ngAfterViewInit() {
this.dataSource.paginator = this.paginator;
}
addPdDetails(){ addPdDetails(){
this.showParentComponent=false this.showParentComponent=false
this.showEditComponent=false this.showEditComponent=false
this.showViewComponent=false
this.showAddComponent=!this.showAddComponent this.showAddComponent=!this.showAddComponent
} }
editPdDetails(editID:string){ editPdDetails(editID:string){
this.showParentComponent=false this.showParentComponent=false
this.showAddComponent=false this.showAddComponent=false
this.showViewComponent=false
this.showEditComponent=!this.showEditComponent this.showEditComponent=!this.showEditComponent
this.parentEditData=editID this.parentEditData=editID
} }
viewPdDetails(editID:string){
this.showParentComponent=false
this.showAddComponent=false
this.showEditComponent=false
this.showViewComponent=!this.showViewComponent
this.parentViewData=editID
}
updateParentComponent(event:string) { updateParentComponent(event:string) {
this.showParentComponent=!this.showParentComponent this.showParentComponent=!this.showParentComponent
if(event=='1'){ if(event=='1'){
@ -102,14 +140,30 @@ export class ListPdComponent implements OnInit {
} }
else if(event=='2'){ else if(event=='2'){
this.showEditComponent=!this.showEditComponent this.showEditComponent=!this.showEditComponent
}
else if(event=='3'){
this.showViewComponent=!this.showViewComponent
} }
this._pd.getPdDetails() this._pd.getPdDetails()
.subscribe( .subscribe(
data => { data => {
if (data.status == 200) { if (data.status == 200) {
this.pdList = data.records; this.pdList = data.records;
this.pdListData = data.records;
this.dataLength = data.records.length;
this.dataSource.data = this.pdListData;
this.recordStatus=false;
}
else{
this.pdList=[];
this.dataLength = null;
this.recordStatus=true;
} }
}, error => this.errorMessage = <any> error); }, error => this.errorMessage = <any> error);
} }
pageChange(e) {
console.log(e);
}
} }

View File

@ -0,0 +1,27 @@
<mat-card>
<mat-card-header>
<mat-card-title>{{pageTitle}}</mat-card-title>
</mat-card-header>
<mat-card-content>
<form [formGroup]="_pdAllocationForm" (submit)="onSubmit()">
<!--<div class="form-group">-->
<div fxLayout="row" fxLayoutAlign="start none">
<mat-form-field class="ml-xs example-full-width">
<mat-select placeholder="Select Name" formControlName="allocation_id">
<mat-option *ngFor="let ct of pdOfficerList" [value]="ct">{{ ct.categroy_name }}</mat-option>
</mat-select>
<mat-error *ngIf="readForm.allocation_id.hasError('required')" class="mat-text-warn">Select name.</mat-error>
</mat-form-field>
</div>
<div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button"
(click)="closeAllocationComponent()"><mat-icon>close</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="submit"><mat-icon>save</mat-icon></button>
</div>
<!--</div>-->
</form>
</mat-card-content>
</mat-card>
<notifier-container></notifier-container>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PdAllocationComponent } from './pd-allocation.component';
describe('PdAllocationComponent', () => {
let component: PdAllocationComponent;
let fixture: ComponentFixture<PdAllocationComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PdAllocationComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PdAllocationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,85 @@
import { Component, OnInit, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../pd-service/pd-triger.service';
@Component({
selector: 'app-pd-allocation',
templateUrl: './pd-allocation.component.html',
styleUrls: ['./pd-allocation.component.scss']
})
export class PdAllocationComponent implements OnInit {
public pageTitle: string = "PD Allocation To";
public _pdAllocationForm: FormGroup;
public pdOfficerList: any = [];
errorMessage: any;
notifier : NotifierService;
constructor( notifier: NotifierService,
private _fb: FormBuilder,
private dialogRef: MatDialogRef<PdAllocationComponent>,
private _pd: PdTrigerService,
@Inject(MAT_DIALOG_DATA) public data: any) {
this.notifier=notifier;
console.log(this.data)
this.getPDOfficerList();
}
ngOnInit() {
this._pdAllocationForm = this._fb.group({
pd_primary_id: [null],
allocation_id: [null, Validators.compose([Validators.required])],
});
}
// convenience getter for easy access to form fields
get readForm() { return this._pdAllocationForm.controls; }
// pd officer list
getPDOfficerList(){
this._pd.getPdOfficerList().subscribe(
data => {
if (data.status == 200) {
this.pdOfficerList=data.records.pd_master_details;
}
}, error => this.errorMessage = <any> error);
}
/** To Save/Edited Popup Data */
onSubmit() {
// stop here if form is invalid
if (this._pdAllocationForm.invalid) {
this.errorMessage = "Please Fill All Mandate Fields.";
return;
} else {
var updateData = this._pdAllocationForm.value;
//To Remove The "Null" With Key also
Object.keys(updateData).forEach((key) => (updateData[key] == null) && delete updateData[key]);
//Add BRANCH data with help Service File
this._pd.updatePdOfficer(updateData).subscribe(
result => {
if (result.status == 200) {
this.notifier.notify('success', 'Your Changes Updated.!');
this.dialogRef.close();
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
this.errorMessage = "Something Wents Wrong Try Again.!";
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
this.errorMessage = "Some Thing Wents Wrong Try Again.!";
this.dialogRef.close();
});
//After Saving the BRANCH data then popup close
// this.dialogRef.close();
}
}
/** For Popup Close Button */
closeAllocationComponent(): void {
this.dialogRef.close();
}
}

View File

@ -1,7 +1,7 @@
/** Common Import Section */ /** Common Import Section */
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';//for Datatables import { Observable } from 'rxjs';//for Datatables
import { HttpClient } from '@angular/common/http'; import { HttpClient,HttpParams } from '@angular/common/http';
import { catchError } from 'rxjs/operators'; import { catchError } from 'rxjs/operators';
import { of } from 'rxjs'; import { of } from 'rxjs';
@ -21,6 +21,8 @@ export interface Master {
export class PdTrigerService { export class PdTrigerService {
private apiUrl = "http://ssa.sineedge.com/sparqapi/api/"; private apiUrl = "http://ssa.sineedge.com/sparqapi/api/";
//private apiUrl = "http://192.168.15.5:9999/AWSEC2/sparqapi/api/";
constructor(private _http: HttpClient, constructor(private _http: HttpClient,
@ -32,12 +34,56 @@ export class PdTrigerService {
catchError(this.handleError('role', [])) catchError(this.handleError('role', []))
) )
} }
//get product and subproduct master details
getProductsDetails(): Observable<any> {
return this._http.get<any>(this.apiUrl+'getListOfProducts')
.pipe(
catchError(this.handleError('role', []))
)
}
// get lenders list
getLenderDetails(): Observable<any> {
return this._http.get<any>(this.apiUrl+'getListOfLenders')
.pipe(
catchError(this.handleError('role', []))
)
}
// get customers list
getCustomersDetails(): Observable<any> {
return this._http.get<any>(this.apiUrl+'getListOfCustomerSegments')
.pipe(
catchError(this.handleError('role', []))
)
}
// get Pd Allocation type details list
getPDAllocationDetails(): Observable<any> {
return this._http.get<any>(this.apiUrl+'getListOfPDAllocationTypes')
.pipe(
catchError(this.handleError('role', []))
)
}
// get state and city details
getStateCityDetails(): Observable<any> {
return this._http.get<any>(this.apiUrl+'getListOfStatesAndCities')
.pipe(
catchError(this.handleError('role', []))
)
}
// get pd type and allocation type details
getPDTypeDetails():Observable<any> {
return this._http.get<any>(this.apiUrl+'getListOfPDAllocationTypes')
.pipe(
catchError(this.handleError('role', []))
)
}
// add pd details
addPdDetails(pdForm: any): Observable<any> { addPdDetails(pdForm: any): Observable<any> {
return this._http.post<any>(this.apiUrl+"triggerNewPD", pdForm) return this._http.post<any>(this.apiUrl+"triggerNewPD", pdForm)
.pipe( .pipe(
catchError(this.handleError('operation', [])) catchError(this.handleError('operation', []))
) )
} }
// get pd details
getPdDetails(): Observable<any> { getPdDetails(): Observable<any> {
return this._http.get<any>(this.apiUrl+"listLessPDDetails/get") return this._http.get<any>(this.apiUrl+"listLessPDDetails/get")
.pipe( .pipe(
@ -45,9 +91,53 @@ export class PdTrigerService {
) )
} }
private handleError<T>(operation = 'operation', result?: T) { // get edit row pd details
return (error: any): Observable<T> => { editPdDetails(editId:string):Observable<any>{
return of(result as T); let httpParams = new HttpParams().set('pdid', editId);
}; return this._http.post<any>(this.apiUrl+"getFullPDDetails",httpParams)
} .pipe(
catchError(this.handleError('operation', []))
)
}
// update pd master details
editPdMasterDetails(editData:any):Observable<any>{
editData.fk_updatedby = this._aws.getlocale();
editData.updatedon = currentdate;
return this._http.post<any>(this.apiUrl+"triggerNewPD",{records:editData})
.pipe(
catchError(this.handleError('operation', []))
)
}
// update pd applicant
updatePdApplicant(editData:any):Observable<any>{
// editData.fk_updatedby = this._aws.getlocale();
// editData.updatedon = currentdate;
return this._http.post<any>(this.apiUrl+"updatePDApplicants",{"pd_applicant_details":editData})
.pipe(
catchError(this.handleError('operation', []))
)
}
// get pd allocation to details
getPdOfficerList(): Observable<any> {
return this._http.get<any>(this.apiUrl+"getListPDOfficers")
.pipe(
catchError(this.handleError('operation', []))
)
}
// update pd officer
updatePdOfficer(updateData: any): Observable<any> {
return this._http.post<any>(this.apiUrl+"updatePDApplicants",{"pd_applicant_details":updateData})
.pipe(
catchError(this.handleError('operation', []))
)
}
private handleError<T>(operation = 'operation', result?: T) {
return (error: any): Observable<T> => {
return of(result as T);
};
}
} }

View File

@ -15,8 +15,12 @@ import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload';
import { TreeModule } from 'angular-tree-component'; import { TreeModule } from 'angular-tree-component';
import { NgxDatatableModule } from '@swimlane/ngx-datatable'; import { NgxDatatableModule } from '@swimlane/ngx-datatable';
import { FlexLayoutModule } from '@angular/flex-layout'; import { FlexLayoutModule } from '@angular/flex-layout';
import { MatTooltipModule } from '@angular/material/tooltip';
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search'; import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
import { NotifierModule, NotifierOptions } from 'angular-notifier';
import {MatDatepickerModule} from '@angular/material/datepicker';
import 'hammerjs'; import 'hammerjs';
import { PdTrigerRoutes } from './pd-triger-routing.module'; import { PdTrigerRoutes } from './pd-triger-routing.module';
@ -24,11 +28,58 @@ import { AddPdComponent } from './add-pd/add-pd.component';
import { PdTrigerService } from './pd-service/pd-triger.service'; import { PdTrigerService } from './pd-service/pd-triger.service';
import { ListPdComponent } from './list-pd/list-pd.component'; import { ListPdComponent } from './list-pd/list-pd.component';
import { EditPdComponent } from './edit-pd/edit-pd.component'; import { EditPdComponent } from './edit-pd/edit-pd.component';
import { ViewPdComponent } from './view-pd/view-pd.component';
import { EditPdMasterComponent } from './edit-pd-master/edit-pd-master.component';
import { EditPdApplicantComponent } from './edit-pd-applicant/edit-pd-applicant.component';
import { PdAllocationComponent } from './pd-allocation/pd-allocation.component';
/**
* Custom angular notifier options
*/
const customNotifierOptions: NotifierOptions = {
position: {
horizontal: {
position: 'right',
distance: 12
},
vertical: {
position: 'top',
distance: 32,
gap: 10
}
},
theme: 'material',
behaviour: {
autoHide: 5000,
onClick: 'hide',
onMouseover: 'pauseAutoHide',
showDismissButton: true,
stacking: 4
},
animations: {
enabled: true,
show: {
preset: 'slide',
speed: 300,
easing: 'ease'
},
hide: {
preset: 'fade',
speed: 300,
easing: 'ease',
offset: 50
},
shift: {
speed: 300,
easing: 'ease'
},
overlap: 150
}
};
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
RouterModule.forChild(PdTrigerRoutes), RouterModule.forChild(PdTrigerRoutes),
NotifierModule.withConfig(customNotifierOptions),
MatCardModule, MatCardModule,
MatIconModule, MatIconModule,
MatInputModule, MatInputModule,
@ -45,10 +96,11 @@ import { EditPdComponent } from './edit-pd/edit-pd.component';
ReactiveFormsModule, ReactiveFormsModule,
FileUploadModule, FileUploadModule,
TreeModule, TreeModule,
MatDialogModule, MatDialogModule,MatSortModule,
NgxMatSelectSearchModule NgxMatSelectSearchModule,MatTooltipModule, MatDatepickerModule,
], ],
declarations: [AddPdComponent, ListPdComponent, EditPdComponent], declarations: [AddPdComponent, ListPdComponent, EditPdComponent, ViewPdComponent, EditPdMasterComponent, EditPdApplicantComponent, PdAllocationComponent],
entryComponents: [PdAllocationComponent],
providers: [PdTrigerService] providers: [PdTrigerService]
}) })
export class PdTrigerModule { } export class PdTrigerModule { }

View File

@ -0,0 +1,96 @@
<div class="row" style="text-align:left;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="loadPdListCompoent()"><mat-icon>close</mat-icon></button>
</div>
<div *ngIf="!showEditMasterComponent">
<mat-card *ngFor="let master of pdMasterData">
<div class="cardEdit">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="pdAllocationTo(master)"><mat-icon>directions_run</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button"><mat-icon>schedule</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdMaster(master)"><mat-icon>edit</mat-icon></button>
</div>
<mat-card-header>
<img mat-card-avatar src="assets/images/avatar.jpg">
<mat-card-title>{{master.lender_full_name}} - {{master.lender_applicant_id}}
</mat-card-title>
<mat-card-subtitle class="hover-icon"><i class="fa-1x fa fa-map-marker"> </i> &nbsp;<span>{{master.city_name}} / {{master.state_name}}-{{master.pincode}}</span></mat-card-subtitle>
</mat-card-header>
<mat-divider></mat-divider>
<mat-card-content>
<p>{{master.product_name}} / {{master.subproduct_name}}</p>
<p><span>{{master.pd_type_name}}&nbsp;&nbsp;&nbsp;{{master.pd_allocation_type_name}} &nbsp;&nbsp;&nbsp;{{master.pd_allocated_to}}</span></p>
<p><span>{{master.addressline1}}</span></p>
<p><span>{{master.addressline2}}</span></p>
<p><span>{{master.addressline3}}</span></p>
<p><span class="hover-icon"><i class="fa-1x fa fa-rupee">&nbsp;</i>{{master.loan_amount}}</span> &nbsp;&nbsp;&nbsp;<span>{{master.pd_status_name}}</span>&nbsp;&nbsp;&nbsp;<span>{{master.pd_date_of_initiation}}</span></p>
</mat-card-content>
</mat-card>
</div>
<app-edit-pd-master *ngIf="showEditMasterComponent" [masterChild]="editMasterData" (loadPdView)="updateViewComponent($event)"></app-edit-pd-master>
<!-- applicant card -->
<mat-card *ngIf="!showEditApplicantComponent">
<div class="cardEdit">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdApplicant(pdApplicantData)"><mat-icon>edit</mat-icon></button>
</div>
<mat-card-header>
<mat-card-title>Applicants</mat-card-title>
</mat-card-header>
<mat-divider></mat-divider>
<mat-list *ngFor="let applicant of pdApplicantData">
<mat-list-item>
<p><span *ngIf="applicant.applicant_name!=null" class="mb-2 text-center hover-icon">
<i class="fa-1x fa fa-user-o"></i>
&nbsp;{{applicant.applicant_name}} </span> &nbsp;&nbsp;&nbsp;<span *ngIf="applicant.mobile_no!=null" class="mb-2 text-center hover-icon">
<i class="fa-1x fa fa-phone"></i>
&nbsp;{{applicant.mobile_no}} </span> &nbsp;&nbsp;&nbsp;<span *ngIf="applicant.applicant_type=='1';else codetails"> Main Applicant</span>
<ng-template #codetails>&nbsp;&nbsp;&nbsp;<span>{{applicant.relation}}</span></ng-template>
</p>
</mat-list-item>
</mat-list>
</mat-card>
<app-edit-pd-applicant *ngIf="showEditApplicantComponent" [applicantChild]="editApplicantData" (loadPdView)="updateViewComponent($event)"></app-edit-pd-applicant>
<!-- pd documents details -->
<mat-card>
<!-- <div class="cardEdit">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon"><mat-icon>edit</mat-icon></button>
</div> -->
<mat-card-header>
<mat-card-title>Documents</mat-card-title>
<!-- <mat-card-subtitle><i class="fa-1x fa fa-map-marker"> </i> &nbsp;{{master.city_name}} / {{master.state_name}}-{{master.pincode}}</mat-card-subtitle> -->
</mat-card-header>
<mat-divider></mat-divider>
<mat-list *ngFor="let documents of pdDocumentsData">
<mat-list-item>
<p><span>
{{documents.pd_document_title}} </span> &nbsp;&nbsp;&nbsp;<span class="mb-2 text-center hover-icon">
<i class="fa-1x fa fa-file"></i>
&nbsp;{{documents.pd_document_name}} </span>
</p>
</mat-list-item>
</mat-list>
</mat-card>
<!-- pd logs card -->
<mat-card>
<mat-card-header>
<mat-card-title>PD History</mat-card-title>
</mat-card-header>
<mat-card-content>
</mat-card-content>
</mat-card>
<!-- <mat-form-field>
<input matInput [matDatepicker]="picker" placeholder="Choose a date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field> -->

View File

@ -0,0 +1,3 @@
.cardEdit {
display: inline;float:right;
}

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ViewPdComponent } from './view-pd.component';
describe('ViewPdComponent', () => {
let component: ViewPdComponent;
let fixture: ComponentFixture<ViewPdComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewPdComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ViewPdComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,90 @@
import { Component, OnInit,ViewEncapsulation, EventEmitter, Input, Output } from '@angular/core';
import { MatDialog } from '@angular/material';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../pd-service/pd-triger.service';
import { PdAllocationComponent } from '../pd-allocation/pd-allocation.component';
@Component({
selector: 'app-view-pd',
templateUrl: './view-pd.component.html',
styleUrls: ['./view-pd.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class ViewPdComponent implements OnInit {
public notifier:NotifierService;
errorMessage: any;
pdMasterData: any;
pdApplicantData: any;
pdDocumentsData: any;
pdLogsData: any;
editMasterData: any[];
editApplicantData: any[];
showEditMasterComponent: boolean;
showEditApplicantComponent: boolean;
showEditDocumentComponent: boolean;
@Input() childData: string;
@Output() loadParent = new EventEmitter<string>();
public _EditPDtriggerForm:FormGroup;
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier:NotifierService, private dialog: MatDialog,) {
this.notifier=notifier
}
ngOnInit() {
this.viewPdDetails(this.childData);
this.showEditMasterComponent=false;
this.showEditApplicantComponent=false;
this.showEditDocumentComponent=false;
}
viewPdDetails(editID:string){
this._pd.editPdDetails(editID).subscribe(
data => {
if (data.status == 200) {
this.pdMasterData=data.records.pd_master_details;
this.pdApplicantData= data.records.applicants_details;
this.pdDocumentsData=data.records.pd_documnets;
this.pdLogsData=data.records.pd_logs;
}
}, error => this.errorMessage = <any> error);
}
loadPdListCompoent() {
this.loadParent.emit('3')
}
editPdMaster(masterData:any){
this.editMasterData=masterData;
this.showEditMasterComponent=!this.showEditMasterComponent;
}
editPdApplicant(applicantData:any){
this.editApplicantData=applicantData;
this.showEditApplicantComponent=!this.showEditApplicantComponent;
}
// pd allocation to
// edit questions master details popup model
pdAllocationTo(pdID:any) {
const dialogRef = this.dialog.open(PdAllocationComponent, {
data: pdID,
disableClose: true
});
dialogRef.afterClosed()
.subscribe(dataresult => {
//this.getQuestionsMasters();
});
}
updateViewComponent(editBack:string) {
if(editBack=='1'){
this.showEditMasterComponent=!this.showEditMasterComponent
}
else if(editBack=='2'){
this.showEditApplicantComponent=!this.showEditApplicantComponent
}
else if(editBack=='3'){
this.showEditMasterComponent=!this.showEditMasterComponent
}
this.viewPdDetails(this.childData);
}
}

View File

@ -1,61 +1,21 @@
<!-- <div *ngIf="loader">
<mat-progress-bar mode="indeterminate" color="accent" class="mb-1"></mat-progress-bar>
</div>
<div style="text-align: right;">
<button mat-raised-button color="primary" (click)="add()">Add Register</button>
</div>
<mat-card>
<div datatable>
<table style="border-collapse: collapse">
<thead>
<th style="text-align: center;">No</th>
<th style="text-align: center;">FirstName</th>
<th style="text-align: center;">Email</th>
<th style="text-align: center;">Mobile No</th>
<th style="text-align: center;">Action</th>
<th style="text-align: center;">Isactive</th>
</thead>
<tbody>
<tr *ngFor="let us of userdata; let i=index;" >
<td style="text-align: center;">{{i+1}}</td>
<td style="text-align: center;">{{us.user_first_name}} {{us.user_last_name}}</td>
<td style="text-align: center;">{{us.email}}</td>
<td style="text-align: center;">{{us.mobile_no}}</td>
<td style="text-align: center;font-size: 20px"><a (click)="editUserDetails(us.userid,us.aws_name)"><mat-icon>edit</mat-icon></a></td>
<td *ngIf="us.isactive ==1" style="text-align: center;"><a class="active" (click)="isactive(us.userid,us.aws_name)"><mat-icon>done</mat-icon></a></td>
<td *ngIf="us.isactive ==0" style="text-align: center;"><a class="deactive" (click)="isactive(us.userid,us.aws_name)"><mat-icon>close</mat-icon></a></td>
</tr>
</tbody>
</table>
</div>
</mat-card> -->
<mat-card-content> <mat-card-content>
<div style="text-align: right;"> <div class="example-container mat-elevation-z8" style="margin-top:26px;">
<button mat-raised-button color="primary" (click)="add()"> + Add Register</button>
</div>
<br>
<div *ngIf="loader"> <div *ngIf="loader">
<mat-progress-bar mode="indeterminate" color="accent" class="mb-1"></mat-progress-bar> <mat-progress-bar mode="indeterminate" color="accent" class="mb-1"></mat-progress-bar>
</div> </div>
<div class="example-header">
<div class="example-header"> <div style="font-size: 26px;">Users</div><hr/>
<mat-form-field> <div fxLayout="row" fxLayoutAlign="start center" class="mb-2" >
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter"> <mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
</mat-form-field> <input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
</div> </mat-form-field>
<label style="text-align: right;margin-left:50%;" fxLayoutAlign="start center" fxFlexOffset="50px">
<div class="example-container mat-elevation-z8"> <button mat-fab class="mr-1 mb-1" style="margin-top: 7px;"color="primary" (click)="add()"><mat-icon>add</mat-icon></button>
</label>
</div>
</div>
<mat-table [dataSource]="dataSource" matSort > <mat-table [dataSource]="dataSource" matSort >
<ng-container matColumnDef="SerialNo"> <ng-container matColumnDef="SerialNo">
@ -101,6 +61,6 @@
<!-- <div *ngIf="dataSource.length === 0">No records found</div> --> <!-- <div *ngIf="dataSource.length === 0">No records found</div> -->
<mat-paginator [pageSizeOptions]="[5, 10, 25, 50, 100]"></mat-paginator> <mat-paginator [pageSizeOptions]="[5, 10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
</div> </div>
</mat-card-content> </mat-card-content>

View File

@ -33,6 +33,7 @@ table {
.example-header { .example-header {
min-height: 64px; min-height: 64px;
padding: 8px 24px 0; padding: 8px 24px 0;
background: #fff;
} }
.mat-form-field { .mat-form-field {
@ -44,3 +45,47 @@ table {
overflow: auto; overflow: auto;
max-height: 500px; max-height: 500px;
} }
.mat-table {
display: table;
width: 100%;
overflow: auto;
max-height: 500px;
> .mat-header-row, > .mat-row {
display: table-row;
padding: 0;
border: none;
> .mat-header-cell, > .mat-cell {
display: table-cell;
height: 48px;
vertical-align: middle;
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}
}
}
/** Table CSS -nocontent */
.nocontent {
color: red;
font-size: 16px;
text-align: center;
}
/** Table CSS - Search(or)Filter Field */
.mat-form-field {
font-size: 14px;
width: 100%;
}
.filter-container {
display: flex;
flex-direction: column;
min-width: 300px;
}
.filter-header {
min-height: 64px;
padding: 8px 24px 0;
}

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { state } from '@angular/animations';
export interface BadgeItem { export interface BadgeItem {
type: string; type: string;
@ -11,8 +12,8 @@ export interface ChildrenItems {
type?: string; type?: string;
} }
export interface Menu { export interface Multichild {
state: string; state: any;
name: string; name: string;
type: string; type: string;
icon: string; icon: string;
@ -20,62 +21,65 @@ export interface Menu {
children?: ChildrenItems[]; children?: ChildrenItems[];
} }
export interface Menu {
state: any;
name: string;
type: string;
icon: string;
badge?: BadgeItem[];
children?: ChildrenItems[];
multichild?:Multichild[];
}
const MENUITEMS : Menu[] = [ const MENUITEMS : Menu[] = [
// {
// state: 'home',
// name: 'HOME',
// type: 'link',
// icon: 'explore'
// },
{ {
state: 'home', state: '',
name: 'HOME', name: 'Manage',
type: 'link', type: 'multi',
icon: 'explore' icon: 'settings',
},{ multichild: [
state:'setting', {
state:'setting',
name:'Settings', name:'Settings',
type:'sub', type:'sub',
icon:'settings', icon:'settings',
children:[ children:[
{state:'users',name:'User List'}, {state:'users',name:'Users'},
{state:'mastermodule',name:'Master Details'}, {state:'mastermodule',name:'Master Details'},
{state:'entity',name:'Entity Details'} {state:'entity',name:'Entities'},
]
},
{ ],
state:'pdtrigger', },
name:'PD Trigger', {
type:'link', state: 'template',
icon:'bubble_chart',
// children:[
// {state:'pdtriggerlist',name:'Pd Trigger Listing'}
// ]
},{
state: 'template',
name: 'Template', name: 'Template',
type: 'sub', type: 'sub',
icon: 'art_track', icon: 'art_track',
children: [ children: [
{state: 'questions', name: 'Questions'} {state: 'questions', name: 'Questions'}
] ]
}, }
{
state: 'authentication',
name: 'AUTHENTICATION',
type: 'sub',
icon: 'security',
children: [
{state: 'login', name: 'LOGIN'},
{state: 'register', name: 'REGISTER'},
{state: 'forgot-password', name: 'FORGOT'},
{state: 'lockscreen', name: 'LOCKSCREEN'}
] ]
}, },
{ {
state: 'error', state:'pdtrigger',
name: 'ERROR', name:'Personal Discussion',
type: 'sub', type:'link',
icon: 'error_outline', icon:'forum',
children: [ // children:[
{state: '404', name: '404'}, // {state:'pdtriggerlist',name:'Pd Trigger Listing'}
{state: '503', name: '503'} // ]
]
} }
]; ];
@Injectable() @Injectable()