pd triger changes

This commit is contained in:
gandhimathi 2018-09-25 10:12:01 +05:30
parent 7892db4e68
commit d9963f3777
12 changed files with 2296 additions and 1819 deletions

File diff suppressed because it is too large Load Diff

View File

@ -18,10 +18,10 @@ export const AppRoutes: Routes = [{
path:'setting',
loadChildren:'./settings/settings.module#SettingsModule'
}
// ,{
// path:'pdtrigger',
// loadChildren:'./pd-trigger/pd-trigger.module#PdTriggerModule'
// }
,{
path:'pdtrigger',
loadChildren:'./pd-triger/pd-triger.module#PdTrigerModule'
}
]
}, {
path: '',

View File

@ -0,0 +1,164 @@
<mat-card class="p-1">
<form [formGroup]="PDtriggerForm" (submit)="submitPdDetails()">
<mat-card-content>
<div class="mb-2"></div>
<div fxLayout="row" fxLayoutWrap="wrap">
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-card class="p-2">
<h5>PD Details</h5>
<div fxLayout="column" fxLayoutAlign="start stretch">
<!-- <mat-form-field style="width: 100%">
<input matInput placeholder="First Name" type="text" name="name" required>
</mat-form-field> -->
<mat-form-field style="width: 100%">
<mat-select placeholder="Lender Name" [formControl]="PDtriggerForm.controls['fk_lender_id']" required>
<mat-option *ngFor="let LL of LenderList" [value]="LL.lender_hierarchy_id" >
{{LL.lender_hierarchy}}
</mat-option>
<mat-error *ngIf="!PDtriggerForm.controls['fk_lender_id'].valid && PDtriggerForm.controls['fk_lender_id'].touched" class="mat-text-warn">You must include a Pick up Lender Name.</mat-error>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Lender Applicant ID" required [formControl]="PDtriggerForm.controls['lender_applicant_id']" type="text">
<mat-error *ngIf="!PDtriggerForm.controls['lender_applicant_id'].valid && PDtriggerForm.controls['lender_applicant_id'].touched" class="mat-text-warn">You must include Lender Applicant Id.</mat-error>
</mat-form-field>
<!-- <mat-form-field style="width: 100%">
<input matInput placeholder="PD Date of Initiation" [formControl]="PDtriggerForm.controls['pd_date_of_initiation']" type="date">
</mat-form-field>-->
<mat-form-field style="width: 100%">
<mat-select placeholder="Product Name" [formControl]="PDtriggerForm.controls['fk_product_id']">
<mat-option *ngFor="let PL of ProductList" [value]="PL" >
{{PL.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Sub product Name" [formControl]="PDtriggerForm.controls['fk_subproduct_id']">
<mat-option *ngFor="let SPL of SubProductList" [value]="SPL" >
{{SPL.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Customer Segment" [formControl]="PDtriggerForm.controls['fk_customer_segment']">
<mat-option *ngFor="let CSL of CustomerSegmentList" [value]="CSL.customer_segment_id" >
{{CSL.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="PD Type" [formControl]="PDtriggerForm.controls['fk_pd_type']">
<mat-option *ngFor="let PDL of PDTypeList" [value]="PDL.pd_type_id" >
{{PDL.type_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Loan Amount" [formControl]="PDtriggerForm.controls['loan_amount']">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Address 1" [formControl]="PDtriggerForm.controls['addressline1']">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Address 2" [formControl]="PDtriggerForm.controls['addressline2']">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Address 3" [formControl]="PDtriggerForm.controls['addressline3']">
</mat-form-field>
<mat-form-field style="width: 100%;">
<mat-select placeholder="Select City" [formControl]="PDtriggerForm.controls['fk_city']" >
` <mat-option *ngFor="let CL of CityList" [value]="CL">
{{CL.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%;">
<mat-select placeholder="Pickup the State" [formControl]="PDtriggerForm.controls['fk_state']" >
<mat-option *ngFor="let SL of StateList" [value]="SL">
{{SL.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%;">
<input matInput placeholder="Pincode" [formControl]="PDtriggerForm.controls['pincode']">
</mat-form-field>
</div>
</mat-card>
</div>
</div>
<div fxLayout="row" fxLayoutWrap="wrap">
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-card class="p-2">
<h5>Main Applicant Details</h5>
<mat-form-field style="width: 100%">
<input matInput placeholder="Name" [formControl]="PDtriggerForm.controls['applicant_name']">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Email" [formControl]="PDtriggerForm.controls['email']" type="email">
<!-- <small *ngIf="PDtriggerForm.controls['email'].hasError('required') && PDtriggerForm.controls['email'].touched" class="mat-text-warn">You must include an email address.</small>
<small *ngIf="PDtriggerForm.controls['email'].errors?.email && PDtriggerForm.controls['email'].touched" class="mat-text-warn">You must include a valid email address.</small> -->
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Phone" [formControl]="PDtriggerForm.controls['mobile_no']" type="text">
<!-- <small *ngIf="PDtriggerForm.controls['mobile_no'].hasError('required') && PDtriggerForm.controls['mobile_no'].touched" class="mat-text-warn">You must include phone number.</small>
<small *ngIf="PDtriggerForm.controls['mobile_no'].errors?.phone && PDtriggerForm.controls['mobile_no'].touched" class="mat-text-warn">You must include a valid phone number.</small> -->
</mat-form-field>
</mat-card>
</div>
</div>
<div fxLayout="row" fxLayoutWrap="wrap" formArrayName="items" *ngFor="let coDetails of PDtriggerForm.get('items')['controls']; let i = index;">
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-card class="p-2">
<h5>{{PDtriggerForm.controls.items.controls[i].controls.label.value}} {{i+1}}</h5>
<div [formGroupName]="i">
<mat-form-field style="width: 100%">
<input matInput placeholder="Name" formControlName="coapplicantName" type="text">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Relation" formControlName="relationship" type="text">
</mat-form-field>
</div>
</mat-card>
</div>
</div>
<div fxLayout="row" fxLayoutWrap="wrap">
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="30" fxFlex.lg="50" fxFlex.xl="30">
<mat-card class="p-2" style="opacity: 0.5;">
<!-- <button _ngcontent-c29="" class="mr-1 mb-2 mat-fab1 mat-accent" mat-fab="" (click)="addCoApplicant(createWithLongContent)"><span class="mat-button-wrapper"><mat-icon _ngcontent-c29="" class="mat-icon material-icons" role="img" aria-hidden="true">add</mat-icon></span><div class="mat-button-ripple mat-ripple mat-button-ripple-round" matripple=""></div><div class="mat-button-focus-overlay"></div></button> -->
<button _ngcontent-c39="" class="mr-1 mb-1 mat-button" mat-button=""><span style="opacity: 0.5;" (click)="addCoApplicant()" class="mat-button-wrapper">Add More Co-Applicant</span><div class="mat-button-ripple mat-ripple" matripple=""></div><div class="mat-button-focus-overlay"></div></button>
</mat-card>
</div>
</div>
</mat-card-content>
<mat-card-actions>
<button mat-raised-button color="primary" type="submit" [disabled]="!PDtriggerForm.valid">Submit</button>
</mat-card-actions>
</form>
</mat-card>

View File

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

View File

@ -0,0 +1,152 @@
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { CustomValidators } from 'ng2-validation';
import { PdTrigerService } from '../pd-service/pd-triger.service';
@Component({
selector: 'app-add-pd',
templateUrl: './add-pd.component.html',
styleUrls: ['./add-pd.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class AddPdComponent implements OnInit {
public PDtriggerForm: FormGroup;
items: FormArray;
CityList: any;
StateList: any;
LenderList: any;
ProductList: any;
SubProductList: any;
CustomerSegmentList: any;
PDTypeList: any;
ApplicantTypeList: any;
errorMessage: any;
// Dynamic co applicant
createWithLongContent = false;
dynamicCoApplicant = [];
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService) { }
ngOnInit() {
this.PDtriggerForm = 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],
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],
items: 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);
}
createItem(): FormGroup {
return this._fb.group({
label: ['Co Applicant Details'],
coapplicantName: [null, Validators.compose([Validators.required])],
relationship: [null],
});
};
addCoApplicant() {
if(this.PDtriggerForm.valid){
this.items = this.PDtriggerForm.get('items') as FormArray;
this.items.push(this.createItem());
}
}
submitPdDetails() {
if(this.PDtriggerForm.valid){
var my_array = this.PDtriggerForm.value;
Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
}
}
}

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { PdTrigerService } from './pd-triger.service';
describe('PdTrigerService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: PdTrigerService = TestBed.get(PdTrigerService);
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,41 @@
/** Common Import Section */
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';//for Datatables
import { HttpClient } from '@angular/common/http';
import { catchError } from 'rxjs/operators';
import { of } from 'rxjs';
/** Imported Service Files Are., */
import { AwsService } from '../../AwsService/aws.service';
const currentdate = new Date().toJSON().slice(0,19).replace('T',' ');
/** Master Interface */
export interface Master {
master_id:number;
master_name:string;
constant_name:string;
}
@Injectable()
export class PdTrigerService {
private apiUrl = "http://ssa.sineedge.com/sparqapi/api/";
constructor(private _http: HttpClient,
private _aws:AwsService) { }
// get add pd master details
getAllMasterDatas(TableName:string): Observable<any> {
return this._http.post<any>(this.apiUrl+'getListOfMaster', { "master_name":TableName })
.pipe(
catchError(this.handleError('role', []))
)
}
private handleError<T>(operation = 'operation', result?: T) {
return (error: any): Observable<T> => {
return of(result as T);
};
}
}

View File

@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AddPdComponent } from './add-pd/add-pd.component';
export const PdTrigerRoutes: Routes = [
{
path: '',
component: AddPdComponent
// children:
// [{
// path: 'pdtriggerlist',
// component: AddPdComponent
// }]
}
];

View File

@ -0,0 +1,13 @@
import { PdTrigerModule } from './pd-triger.module';
describe('PdTrigerModule', () => {
let pdTrigerModule: PdTrigerModule;
beforeEach(() => {
pdTrigerModule = new PdTrigerModule();
});
it('should create an instance', () => {
expect(pdTrigerModule).toBeTruthy();
});
});

View File

@ -0,0 +1,52 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import {
MatCardModule,
MatIconModule,
MatInputModule,
MatRadioModule,
MatButtonModule,MatTableModule,MatPaginatorModule,
MatProgressBarModule,MatDialogModule, MatSortModule,
MatToolbarModule,MatSelectModule } from '@angular/material';
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload';
import { TreeModule } from 'angular-tree-component';
import { NgxDatatableModule } from '@swimlane/ngx-datatable';
import { FlexLayoutModule } from '@angular/flex-layout';
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
import 'hammerjs';
import { PdTrigerRoutes } from './pd-triger-routing.module';
import { AddPdComponent } from './add-pd/add-pd.component';
import { PdTrigerService } from './pd-service/pd-triger.service';
@NgModule({
imports: [
CommonModule,
RouterModule.forChild(PdTrigerRoutes),
MatCardModule,
MatIconModule,
MatInputModule,
MatRadioModule,
MatTableModule,
MatPaginatorModule,
MatButtonModule,
MatProgressBarModule,
MatToolbarModule,
FlexLayoutModule,
NgxDatatableModule,
FormsModule,MatSlideToggleModule,
MatSelectModule,
ReactiveFormsModule,
FileUploadModule,
TreeModule,
MatDialogModule,
NgxMatSelectSearchModule
],
declarations: [AddPdComponent],
providers: [PdTrigerService]
})
export class PdTrigerModule { }

View File

@ -36,15 +36,15 @@ const MENUITEMS : Menu[] = [
{state:'mastermodule',name:'Master Details'}
]
},
// {
// state:'pdtrigger',
// name:'PD Trigger',
// type:'sub',
// icon:'bubble_chart',
// children:[
// {state:'pdtriggerlist',name:'Pd Trigger Listing'}
// ]
// },
{
state:'pdtrigger',
name:'PD Trigger',
type:'link',
icon:'bubble_chart',
// children:[
// {state:'pdtriggerlist',name:'Pd Trigger Listing'}
// ]
},
{
state: 'authentication',
name: 'AUTHENTICATION',