diff --git a/ng6-seed/package-lock.json b/ng6-seed/package-lock.json
index 6caf2406c..31f7995ee 100644
--- a/ng6-seed/package-lock.json
+++ b/ng6-seed/package-lock.json
@@ -11377,4 +11377,4 @@
"integrity": "sha512-W9Nj+UmBJG251wkCacIkETgra4QgBo/vgoEkb4a2uoLzpQG7qF9nzwoLXWU5xj3Fg2mxGvEDh47mg24vXccYjA=="
}
}
-}
+}
\ No newline at end of file
diff --git a/ng6-seed/src/app/AwsService/cognito.service.ts b/ng6-seed/src/app/AwsService/cognito.service.ts
index 2290dbc52..a568b7c1f 100644
--- a/ng6-seed/src/app/AwsService/cognito.service.ts
+++ b/ng6-seed/src/app/AwsService/cognito.service.ts
@@ -11,7 +11,8 @@ import {
CognitoUserSession
} from "amazon-cognito-identity-js";
import { environment } from '../../environments/environment';
-import { BehaviorSubject } from 'rxjs';
+
+import { BehaviorSubject,Observable,of } from 'rxjs';
const sineedge_poolData = {
UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV
ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB
@@ -122,7 +123,32 @@ isloggin:boolean = false;
// 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(){
+ this.refresh();
let jwttoken = '';
if (this.getCurrentUser() != null) {
//console.log(JSON.stringify(this.getCurrentUser()));
diff --git a/ng6-seed/src/app/_guard/auth.guard.ts b/ng6-seed/src/app/_guard/auth.guard.ts
index 8d8db8cac..8b7e970b3 100644
--- a/ng6-seed/src/app/_guard/auth.guard.ts
+++ b/ng6-seed/src/app/_guard/auth.guard.ts
@@ -27,8 +27,10 @@ export class AuthGuard implements CanActivate, CanActivateChild {
return true;
} else {
// alert("else");
- this.router.navigate(['/login']);
+ setTimeout(() => {
+ this.router.navigate(['authentication/login']);
return false;
+ },1000);
}
}
diff --git a/ng6-seed/src/app/layouts/admin/admin-layout.component.html b/ng6-seed/src/app/layouts/admin/admin-layout.component.html
index b52f6dd0f..d604ccc09 100644
--- a/ng6-seed/src/app/layouts/admin/admin-layout.component.html
+++ b/ng6-seed/src/app/layouts/admin/admin-layout.component.html
@@ -6,25 +6,25 @@
-
{{userDep}}
+
{{userDep}}
-

+
{{fullName}}
@@ -61,6 +61,23 @@
{{ childitem.name | translate }}
+
+
+ {{ menuitem.icon }}
+ {{ menuitem.name | translate }}
+
+
+
+
+
+
+
+
+
+
-
-
+
-
-
-
-
-
-
- Add More Co-Applicant
-
-
-
-
-
-
+
+
+
+
+ {{coDetails.controls.label.value}} {{i+1}}
+
+
+
+
+
+
+
+
+ Add More Co-Applicant
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Add Document
+
+
+
+
+
-
- Add Document
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Remove
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ delete
+
+
+
+
+
+
-
-
+
+
+
+ close
+ save
+
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/ng6-seed/src/app/pd-triger/add-pd/add-pd.component.ts b/ng6-seed/src/app/pd-triger/add-pd/add-pd.component.ts
index cabd1804f..2880b9299 100644
--- a/ng6-seed/src/app/pd-triger/add-pd/add-pd.component.ts
+++ b/ng6-seed/src/app/pd-triger/add-pd/add-pd.component.ts
@@ -1,9 +1,9 @@
import { Component, OnInit, ViewEncapsulation, Output, EventEmitter } 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';
import { AwsService } from '../../AwsService/aws.service';
-
@Component({
selector: 'app-add-pd',
templateUrl: './add-pd.component.html',
@@ -12,31 +12,39 @@ import { AwsService } from '../../AwsService/aws.service';
})
export class AddPdComponent implements OnInit {
@Output() loadParent = new EventEmitter();
-
- public PDtriggerForm: FormGroup;
+ public notifier: NotifierService;
+ public _PDtriggerForm: FormGroup;
items: FormArray;
- CityList: any;
- StateList: any;
- LenderList: any;
-
- ProductList: any;
- SubProductList: any;
- CustomerSegmentList: any;
- PDTypeList: any;
- ApplicantTypeList: any;
+ productList:any;
+ subProductList:any;
+ lenderList:any;
+ customerSegmentList:any;
+ stateList:any;
+ cityList:any;
+ pdTypeList:any;
errorMessage: any;
// Dynamic co applicant
createWithLongContent = false;
dynamicCoApplicant = [];
-
+ allocationTypeModel: number;
+ allocationTypeCheck: boolean;
+ subAllocationTypeCheck: boolean;
+ allocationLabel: string;
+ subAllocationLabel: string;
constructor(private _fb: FormBuilder,
- private _pd: PdTrigerService, private _aws:AwsService) { }
+ private _pd: PdTrigerService, private _aws:AwsService, notifier: NotifierService) {
+ this.notifier = notifier;
+ }
public totalfiles: Array =[];
public totalFileName = [];
public lengthCheckToaddMore =0;
- ngOnInit() {
-
- this.PDtriggerForm = this._fb.group({
+ ngOnInit() {
+ this.getLenderList();
+ this.getProductsList();
+ this.getCustomerSegmentList();
+ this.getStateCityList();
+ this.getPDTypeList();
+ 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])],
@@ -53,100 +61,102 @@ export class AddPdComponent implements OnInit {
fk_city: [null, Validators.compose([Validators.required])],
fk_state: [null, Validators.compose([Validators.required])],
pincode : [null, Validators.compose([Validators.required])],
+ allocation_type: [null],
+ sub_allocation_type: [null],
items: 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 = 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 = 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 = 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 = 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 = 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 = 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 = error);
}
+ getLenderList(){
+ this._pd.getLenderDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.lenderList=data.records
+ }
+ }, error => this.errorMessage = error);
+ }
+ getProductsList(){
+ this._pd.getProductsDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.productList=data.records
+
+ }
+ }, error => this.errorMessage = error);
+ }
+ getCustomerSegmentList(){
+ this._pd.getCustomersDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.customerSegmentList=data.records
+ }
+ }, error => this.errorMessage = error);
+ }
+ getStateCityList(){
+ this._pd.getStateCityDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.stateList=data.records
+ }
+ }, error => this.errorMessage = 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 = 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 {
return this._fb.group({
- label: ['Co Applicant Details'],
+ label: ['Co Applicant'],
coapplicantName: [null, Validators.compose([Validators.required])],
+ coapplicant_mobile_no: [],
relationship: [null],
});
};
addCoApplicant() {
- if(this.PDtriggerForm.valid){
- this.items = this.PDtriggerForm.get('items') as FormArray;
+ if(this._PDtriggerForm.valid){
+ this.items = this._PDtriggerForm.get('items') as FormArray;
this.items.push(this.createItem());
}
}
@@ -174,8 +184,11 @@ this._pd.getAllMasterDatas('PDTYPE')
}
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) {
this.totalfiles.splice(index,1);
@@ -212,23 +225,24 @@ this._pd.getAllMasterDatas('PDTYPE')
}
}
submitPdDetails(formValue: any) {
- if(this.PDtriggerForm.valid){
+ if(this._PDtriggerForm.valid){
// let my_array = this.PDtriggerForm.value;
// Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
let pd_details:any={
"fk_lender_id":formValue.fk_lender_id,
"lender_applicant_id":formValue.lender_applicant_id,
- "fk_product_id":formValue.fk_product_id.product_id,
- "fk_subproduct_id":formValue.fk_subproduct_id.subproduct_id,
+ "fk_product_id":formValue.fk_product_id,
+ "fk_subproduct_id":formValue.fk_subproduct_id,
"fk_pd_type":formValue.fk_pd_type,
"fk_customer_segment":formValue.fk_customer_segment,
"loan_amount":formValue.loan_amount,
"addressline1":formValue.addressline1,
"addressline2":formValue.addressline2,
"addressline3":formValue.addressline3,
- "fk_city":formValue.fk_city.city_id,
- "fk_state":formValue.fk_state.state_id,
- "pincode ":formValue.pincode ,
+ "fk_city":formValue.fk_city,
+ "fk_state":formValue.fk_state,
+ "pincode":formValue.pincode ,
+ "fk_pd_allocation_type":this.allocationTypeModel ,
"fk_createdby" : this._aws.getlocale(),
"createdon": new Date().toJSON().slice(0,19).replace('T',' ')
};
@@ -237,14 +251,14 @@ this._pd.getAllMasterDatas('PDTYPE')
"email":formValue.email,
"mobile_no":formValue.mobile_no,
"applicant_type":1,
- "relationship":"",
+ "relation":"",
}];
formValue.items.forEach((itemElement, itemIndex) => {
let obj1 = {
"applicant_name":itemElement.coapplicantName,
- "relationship":itemElement.relationship,
+ "relation":itemElement.relationship,
"email":"",
- "mobile_no":"",
+ "mobile_no":itemElement.coapplicant_mobile_no,
"applicant_type":0,
}
pd_applicant_details.push(obj1)
@@ -252,11 +266,10 @@ this._pd.getAllMasterDatas('PDTYPE')
// docs details
let pd_form: FormData = new FormData();
-
+
for(let j=0;jthis.totalfiles[j])
+ pd_form.append('pddocuments[]',this.totalfiles[j])
}
//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_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() {
diff --git a/ng6-seed/src/app/pd-triger/edit-pd-applicant/edit-pd-applicant.component.html b/ng6-seed/src/app/pd-triger/edit-pd-applicant/edit-pd-applicant.component.html
new file mode 100644
index 000000000..92e007b0b
--- /dev/null
+++ b/ng6-seed/src/app/pd-triger/edit-pd-applicant/edit-pd-applicant.component.html
@@ -0,0 +1,74 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/ng6-seed/src/app/pd-triger/edit-pd-applicant/edit-pd-applicant.component.scss b/ng6-seed/src/app/pd-triger/edit-pd-applicant/edit-pd-applicant.component.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/ng6-seed/src/app/pd-triger/edit-pd-applicant/edit-pd-applicant.component.spec.ts b/ng6-seed/src/app/pd-triger/edit-pd-applicant/edit-pd-applicant.component.spec.ts
new file mode 100644
index 000000000..73b41f696
--- /dev/null
+++ b/ng6-seed/src/app/pd-triger/edit-pd-applicant/edit-pd-applicant.component.spec.ts
@@ -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;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ EditPdApplicantComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(EditPdApplicantComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/ng6-seed/src/app/pd-triger/edit-pd-applicant/edit-pd-applicant.component.ts b/ng6-seed/src/app/pd-triger/edit-pd-applicant/edit-pd-applicant.component.ts
new file mode 100644
index 000000000..b0c20d303
--- /dev/null
+++ b/ng6-seed/src/app/pd-triger/edit-pd-applicant/edit-pd-applicant.component.ts
@@ -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();
+ 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')
+ }
+}
diff --git a/ng6-seed/src/app/pd-triger/edit-pd-master/edit-pd-master.component.html b/ng6-seed/src/app/pd-triger/edit-pd-master/edit-pd-master.component.html
new file mode 100644
index 000000000..cec20aecb
--- /dev/null
+++ b/ng6-seed/src/app/pd-triger/edit-pd-master/edit-pd-master.component.html
@@ -0,0 +1,118 @@
+
+
+
+
diff --git a/ng6-seed/src/app/pd-triger/edit-pd-master/edit-pd-master.component.scss b/ng6-seed/src/app/pd-triger/edit-pd-master/edit-pd-master.component.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/ng6-seed/src/app/pd-triger/edit-pd-master/edit-pd-master.component.spec.ts b/ng6-seed/src/app/pd-triger/edit-pd-master/edit-pd-master.component.spec.ts
new file mode 100644
index 000000000..c2b08e200
--- /dev/null
+++ b/ng6-seed/src/app/pd-triger/edit-pd-master/edit-pd-master.component.spec.ts
@@ -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;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ EditPdMasterComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(EditPdMasterComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/ng6-seed/src/app/pd-triger/edit-pd-master/edit-pd-master.component.ts b/ng6-seed/src/app/pd-triger/edit-pd-master/edit-pd-master.component.ts
new file mode 100644
index 000000000..37558080b
--- /dev/null
+++ b/ng6-seed/src/app/pd-triger/edit-pd-master/edit-pd-master.component.ts
@@ -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();
+ 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 = 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 = error);
+ }
+ getCustomerSegmentList(){
+ this._pd.getCustomersDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.customerSegmentList=data.records
+ }
+ }, error => this.errorMessage = error);
+ }
+ getStateCityList(){
+ this._pd.getStateCityDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.stateList=data.records
+ this.getCityList(this.masterChild.fk_state);
+ }
+ }, error => this.errorMessage = error);
+ }
+ getPDTypeList(){
+ this._pd.getPDTypeDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.pdTypeList=data.records.pd_type;
+
+ }
+ }, error => this.errorMessage = 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')
+ }
+
+
+}
diff --git a/ng6-seed/src/app/pd-triger/edit-pd/edit-pd.component.html b/ng6-seed/src/app/pd-triger/edit-pd/edit-pd.component.html
index cb6987e03..2089d0ef3 100644
--- a/ng6-seed/src/app/pd-triger/edit-pd/edit-pd.component.html
+++ b/ng6-seed/src/app/pd-triger/edit-pd/edit-pd.component.html
@@ -1,11 +1,123 @@
-
+
-
+
\ No newline at end of file
diff --git a/ng6-seed/src/app/pd-triger/edit-pd/edit-pd.component.ts b/ng6-seed/src/app/pd-triger/edit-pd/edit-pd.component.ts
index b9c660080..99ab0e723 100644
--- a/ng6-seed/src/app/pd-triger/edit-pd/edit-pd.component.ts
+++ b/ng6-seed/src/app/pd-triger/edit-pd/edit-pd.component.ts
@@ -1,6 +1,8 @@
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({
selector: 'app-edit-pd',
templateUrl: './edit-pd.component.html',
@@ -8,16 +10,147 @@ import { ListPdComponent } from '../list-pd/list-pd.component';
encapsulation: ViewEncapsulation.None
})
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;
@Output() loadParent = new EventEmitter();
- constructor() {
+ public _EditPDtriggerForm:FormGroup;
+ constructor(private _fb: FormBuilder,
+ private _pd: PdTrigerService, private _aws:AwsService) {
}
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 = error);
+ }
+
loadPdListCompoent() {
this.loadParent.emit('2')
}
+ getLenderList(){
+ this._pd.getLenderDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.lenderList=data.records
+ }
+ }, error => this.errorMessage = error);
+ }
+ getProductsList(){
+ this._pd.getProductsDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.productList=data.records
+ }
+ }, error => this.errorMessage = error);
+ }
+ getCustomerSegmentList(){
+ this._pd.getCustomersDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.customerSegmentList=data.records
+ }
+ }, error => this.errorMessage = error);
+ }
+ getStateCityList(){
+ this._pd.getStateCityDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.stateList=data.records
+ }
+ }, error => this.errorMessage = error);
+ }
+ getPDTypeList(){
+ this._pd.getPDTypeDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.pdTypeList=data.records.pd_type;
+
+ }
+ }, error => this.errorMessage = 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){
+ }
+ }
}
diff --git a/ng6-seed/src/app/pd-triger/list-pd/list-pd.component.html b/ng6-seed/src/app/pd-triger/list-pd/list-pd.component.html
index ee96ba06a..ec2759fa7 100644
--- a/ng6-seed/src/app/pd-triger/list-pd/list-pd.component.html
+++ b/ng6-seed/src/app/pd-triger/list-pd/list-pd.component.html
@@ -5,104 +5,49 @@
All PD Details
-
-
{{details.applicat_details[0].applicant_name}}
- -{{details.lender_applicant_id}} {{details.pd_date_of_initiation}}
-{{details.product_abbr}}/{{details.subproduct_abbr}}/{{details.customer_segment_abbr}} {{details.loan_amount}} {{details.state_name}}/{{details.city_name}}
- + +-
{{details.applicat_details[0].applicant_name}}
- -{{details.lender_applicant_id}} {{details.pd_date_of_initiation}}
-{{details.product_abbr}}/{{details.subproduct_abbr}}/{{details.customer_segment_abbr}} {{details.loan_amount}} {{details.state_name}}/{{details.city_name}}
- - --
{{details.applicat_details[0].applicant_name}}
- -{{details.lender_applicant_id}} {{details.pd_date_of_initiation}}
-{{details.product_abbr}}/{{details.subproduct_abbr}}/{{details.customer_segment_abbr}} {{details.loan_amount}} {{details.state_name}}/{{details.city_name}}
- - -- - - + +
No Record Found ...
+ +