diff --git a/ng6-seed/package-lock.json b/ng6-seed/package-lock.json index 78ab38287..31f7995ee 100644 --- a/ng6-seed/package-lock.json +++ b/ng6-seed/package-lock.json @@ -4273,7 +4273,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -4688,7 +4689,8 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -4744,6 +4746,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4787,12 +4790,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -11372,4 +11377,4 @@ "integrity": "sha512-W9Nj+UmBJG251wkCacIkETgra4QgBo/vgoEkb4a2uoLzpQG7qF9nzwoLXWU5xj3Fg2mxGvEDh47mg24vXccYjA==" } } -} +} \ No newline at end of file diff --git a/ng6-seed/src/app/pd-triger/add-pd/add-pd.component.html b/ng6-seed/src/app/pd-triger/add-pd/add-pd.component.html index a30235d64..8607f5530 100644 --- a/ng6-seed/src/app/pd-triger/add-pd/add-pd.component.html +++ b/ng6-seed/src/app/pd-triger/add-pd/add-pd.component.html @@ -1,5 +1,5 @@ -
+
@@ -13,186 +13,218 @@ --> - - - {{LL.lender_hierarchy}} - - You must include a Pick up Lender Name. - - + + + {{LL.full_name}} + + + Lender name is required. + + + + + Applicant id is required. + + + + + {{PL.product_name}} + + + Product is required. + + + + + + + {{SPL.subproduct_name}} + + + + Sub product is required. + + + + + + {{CSL.customer_segment}} + + + Customer segment is required. + + + + + {{PDL.type_name}} + + + + PD type is required. + + + + + Amount is required. + + + + + Address1 required. + - - - - - You must include Lender Applicant Id. - - + - - - {{PL.name}} - + + + + + + + + + + {{SL.state_name}} + + + State is required. + - - - - - - {{SPL.name}} - - - - - - - {{CSL.name}} - + + +` + {{CL.city_name}} + + - - - - - {{PDL.type_name}} - - - - - - - - - - - - - - - - - - - - - ` - {{CL.name}} - - - - + City is required. + + + - - - {{SL.name}} - - - - - - - + + Pincode is required. + + {{allocationLabel}} + + {{subAllocationLabel}} + +
- -
+
-
Main Applicant Details
+
Main Applicant
- + + Name is required. + - - + + Email is required. + - - + + Mobile number is required. + - - - - +
-
-
- - -
{{PDtriggerForm.controls.items.controls[i].controls.label.value}} {{i+1}}
-
- - - - - - -
-
-
-
-
- -
- - - - - - -
-
-
+
+
+ + +
{{coDetails.controls.label.value}} {{i+1}}
+ +
+ + + + + + + -
- - - + + + +
+ +
+
+
+ +
+ + + + + + +
+
+
+ +
+ + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - -
-
+ + + + + + + + + + + + + + +
+
-
- + + + + + + - \ 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 @@ + +
+ + +
+
+ +
Main Applicant
+ + + + + Name is required. + + + + + Email number is required. + + + + + + Mobile number is required. + + + +
+
+
+
+
+ + +
{{coDetails.controls.label.value}} {{i+1}}
+ +
+ + + + + + + + + + + + + +
+
+
+
+
+ +
+ + + + +
+
+ +
+ + + + +
+
+ + \ 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 @@ + +
+ +
+
+
+
+ + + + {{LL.full_name}} + + + Lender name is required. + + + + + Applicant id is required. + + + + + {{PL.product_name}} + + + Product is required. + + + + + + + {{SPL.subproduct_name}} + + + + Sub product is required. + + + + + + {{CSL.customer_segment}} + + + Customer segment is required. + + + + + {{PDL.type_name}} + + + + PD type is required. + + + + + Amount is required. + + + + + Address1 required. + + + + + + + + + + + + + + {{SL.state_name}} + + + + State is required. + + + + + ` + {{CL.city_name}} + + + + City is required. + + + + + + Pincode is required. + + + +
+ +
+
+ + +
+ + + + +
+
+ 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 @@ - +
- {{ childData }} +
+
+
+ +
PD Details
+ +
+ + + + {{LL.full_name}} + + + Lender name is required. + + + + + Applicant id is required. + + + + + {{PL.product_name}} + + + Product is required. + + + + + + + {{SPL.subproduct_name}} + + + + Sub product is required. + + + + + + {{CSL.customer_segment}} + + + Customer segment is required. + + + + + {{PDL.type_name}} + + + + PD type is required. + + + + + Amount is required. + + + + + Address1 required. + + + + + + + + + + + + + + {{SL.state_name}} + + + + State is required. + + + + + ` + {{CL.name}} + + + + City is required. + + + + + + Pincode is required. + + + +
+ +
+
+
+ +

- - - + +
- + \ 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.lender_full_name}}    {{details.lender_applicant_id}}   {{details.pd_date_of_initiation}}

+

{{details.product_abbr}}/{{details.subproduct_abbr}}/{{details.customer_segment_abbr}}   {{details.loan_amount}}    {{details.city_name}}/{{details.state_name}}-{{details.pincode}}

-
- - +
- - - -
- -
- - -

{{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 ...

+ +
+ +
- - - - + + + + + - + + + diff --git a/ng6-seed/src/app/pd-triger/list-pd/list-pd.component.ts b/ng6-seed/src/app/pd-triger/list-pd/list-pd.component.ts index e64b9d67e..5d6597f80 100644 --- a/ng6-seed/src/app/pd-triger/list-pd/list-pd.component.ts +++ b/ng6-seed/src/app/pd-triger/list-pd/list-pd.component.ts @@ -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'; @Component({ @@ -8,12 +9,28 @@ import { PdTrigerService } from '../pd-service/pd-triger.service'; encapsulation: ViewEncapsulation.None }) export class ListPdComponent implements OnInit { + recordStatus: boolean; parentEditData :string; + parentViewData :string; showParentComponent:boolean; showAddComponent:boolean; showEditComponent:boolean; + showViewComponent:boolean; 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[] = [{ text: 'One', cols: 3, @@ -70,31 +87,52 @@ export class ListPdComponent implements OnInit { } ngOnInit() { + this.recordStatus=false this.showParentComponent=true this.showAddComponent=false this.showEditComponent=false + this.showViewComponent=false this._pd.getPdDetails() .subscribe( data => { if (data.status == 200) { 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 = error); } + ngAfterViewInit() { + this.dataSource.paginator = this.paginator; + } addPdDetails(){ this.showParentComponent=false this.showEditComponent=false + this.showViewComponent=false this.showAddComponent=!this.showAddComponent - - } editPdDetails(editID:string){ this.showParentComponent=false this.showAddComponent=false + this.showViewComponent=false this.showEditComponent=!this.showEditComponent 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) { this.showParentComponent=!this.showParentComponent if(event=='1'){ @@ -102,14 +140,30 @@ export class ListPdComponent implements OnInit { } else if(event=='2'){ this.showEditComponent=!this.showEditComponent + } + else if(event=='3'){ + this.showViewComponent=!this.showViewComponent } this._pd.getPdDetails() .subscribe( data => { if (data.status == 200) { 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 = error); } +pageChange(e) { + console.log(e); +} } diff --git a/ng6-seed/src/app/pd-triger/pd-allocation/pd-allocation.component.html b/ng6-seed/src/app/pd-triger/pd-allocation/pd-allocation.component.html new file mode 100644 index 000000000..15ad414a8 --- /dev/null +++ b/ng6-seed/src/app/pd-triger/pd-allocation/pd-allocation.component.html @@ -0,0 +1,27 @@ + + + {{pageTitle}} + + + +
+ +
+ + + {{ ct.categroy_name }} + + Select name. + +
+
+ + +
+ +
+
+
+ + \ No newline at end of file diff --git a/ng6-seed/src/app/pd-triger/pd-allocation/pd-allocation.component.scss b/ng6-seed/src/app/pd-triger/pd-allocation/pd-allocation.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/ng6-seed/src/app/pd-triger/pd-allocation/pd-allocation.component.spec.ts b/ng6-seed/src/app/pd-triger/pd-allocation/pd-allocation.component.spec.ts new file mode 100644 index 000000000..c2547603e --- /dev/null +++ b/ng6-seed/src/app/pd-triger/pd-allocation/pd-allocation.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PdAllocationComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PdAllocationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/pd-triger/pd-allocation/pd-allocation.component.ts b/ng6-seed/src/app/pd-triger/pd-allocation/pd-allocation.component.ts new file mode 100644 index 000000000..e146a8df3 --- /dev/null +++ b/ng6-seed/src/app/pd-triger/pd-allocation/pd-allocation.component.ts @@ -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, + 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 = 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(); +} +} diff --git a/ng6-seed/src/app/pd-triger/pd-service/pd-triger.service.ts b/ng6-seed/src/app/pd-triger/pd-service/pd-triger.service.ts index 1babea421..c77b0d72a 100644 --- a/ng6-seed/src/app/pd-triger/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/pd-triger/pd-service/pd-triger.service.ts @@ -1,7 +1,7 @@ /** Common Import Section */ import { Injectable } from '@angular/core'; 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 { of } from 'rxjs'; @@ -21,6 +21,8 @@ export interface Master { export class PdTrigerService { private apiUrl = "http://ssa.sineedge.com/sparqapi/api/"; + //private apiUrl = "http://192.168.15.5:9999/AWSEC2/sparqapi/api/"; + constructor(private _http: HttpClient, @@ -32,22 +34,110 @@ export class PdTrigerService { catchError(this.handleError('role', [])) ) } + //get product and subproduct master details + getProductsDetails(): Observable { + return this._http.get(this.apiUrl+'getListOfProducts') + .pipe( + catchError(this.handleError('role', [])) + ) + } + // get lenders list + getLenderDetails(): Observable { + return this._http.get(this.apiUrl+'getListOfLenders') + .pipe( + catchError(this.handleError('role', [])) + ) + } + // get customers list + getCustomersDetails(): Observable { + return this._http.get(this.apiUrl+'getListOfCustomerSegments') + .pipe( + catchError(this.handleError('role', [])) + ) + } + // get Pd Allocation type details list + getPDAllocationDetails(): Observable { + return this._http.get(this.apiUrl+'getListOfPDAllocationTypes') + .pipe( + catchError(this.handleError('role', [])) + ) + } + // get state and city details + getStateCityDetails(): Observable { + return this._http.get(this.apiUrl+'getListOfStatesAndCities') + .pipe( + catchError(this.handleError('role', [])) + ) + } + // get pd type and allocation type details + getPDTypeDetails():Observable { + return this._http.get(this.apiUrl+'getListOfPDAllocationTypes') + .pipe( + catchError(this.handleError('role', [])) + ) + } + // add pd details addPdDetails(pdForm: any): Observable { return this._http.post(this.apiUrl+"triggerNewPD", pdForm) .pipe( catchError(this.handleError('operation', [])) ) } + // get pd details getPdDetails(): Observable { return this._http.get(this.apiUrl+"listLessPDDetails/get") .pipe( catchError(this.handleError('operation', [])) ) } - - private handleError(operation = 'operation', result?: T) { - return (error: any): Observable => { - return of(result as T); - }; - } + + // get edit row pd details + editPdDetails(editId:string):Observable{ + let httpParams = new HttpParams().set('pdid', editId); + return this._http.post(this.apiUrl+"getFullPDDetails",httpParams) + .pipe( + catchError(this.handleError('operation', [])) + ) + } + // update pd master details + editPdMasterDetails(editData:any):Observable{ + editData.fk_updatedby = this._aws.getlocale(); + editData.updatedon = currentdate; + return this._http.post(this.apiUrl+"triggerNewPD",{records:editData}) + + .pipe( + catchError(this.handleError('operation', [])) + ) + } + // update pd applicant + updatePdApplicant(editData:any):Observable{ + // editData.fk_updatedby = this._aws.getlocale(); + // editData.updatedon = currentdate; + return this._http.post(this.apiUrl+"updatePDApplicants",{"pd_applicant_details":editData}) + + .pipe( + catchError(this.handleError('operation', [])) + ) + } + + // get pd allocation to details + getPdOfficerList(): Observable { + return this._http.get(this.apiUrl+"getListPDOfficers") + .pipe( + catchError(this.handleError('operation', [])) + ) + } + // update pd officer + updatePdOfficer(updateData: any): Observable { + return this._http.post(this.apiUrl+"updatePDApplicants",{"pd_applicant_details":updateData}) + .pipe( + catchError(this.handleError('operation', [])) + ) + } + + private handleError(operation = 'operation', result?: T) { + return (error: any): Observable => { + return of(result as T); + }; + } } diff --git a/ng6-seed/src/app/pd-triger/pd-triger.module.ts b/ng6-seed/src/app/pd-triger/pd-triger.module.ts index 0dab02906..fa393eedf 100644 --- a/ng6-seed/src/app/pd-triger/pd-triger.module.ts +++ b/ng6-seed/src/app/pd-triger/pd-triger.module.ts @@ -15,8 +15,12 @@ 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 { MatTooltipModule } from '@angular/material/tooltip'; import { NgxMatSelectSearchModule } from 'ngx-mat-select-search'; +import { NotifierModule, NotifierOptions } from 'angular-notifier'; +import {MatDatepickerModule} from '@angular/material/datepicker'; + import 'hammerjs'; 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 { ListPdComponent } from './list-pd/list-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({ imports: [ CommonModule, RouterModule.forChild(PdTrigerRoutes), + NotifierModule.withConfig(customNotifierOptions), MatCardModule, MatIconModule, MatInputModule, @@ -45,10 +96,11 @@ import { EditPdComponent } from './edit-pd/edit-pd.component'; ReactiveFormsModule, FileUploadModule, TreeModule, - MatDialogModule, - NgxMatSelectSearchModule + MatDialogModule,MatSortModule, + NgxMatSelectSearchModule,MatTooltipModule, MatDatepickerModule, ], - declarations: [AddPdComponent, ListPdComponent, EditPdComponent], + declarations: [AddPdComponent, ListPdComponent, EditPdComponent, ViewPdComponent, EditPdMasterComponent, EditPdApplicantComponent, PdAllocationComponent], + entryComponents: [PdAllocationComponent], providers: [PdTrigerService] }) export class PdTrigerModule { } diff --git a/ng6-seed/src/app/pd-triger/view-pd/view-pd.component.html b/ng6-seed/src/app/pd-triger/view-pd/view-pd.component.html new file mode 100644 index 000000000..7e0b016bd --- /dev/null +++ b/ng6-seed/src/app/pd-triger/view-pd/view-pd.component.html @@ -0,0 +1,96 @@ +
+ + +
+
+ +
+ + + + +
+ + + {{master.lender_full_name}} - {{master.lender_applicant_id}} + +  {{master.city_name}} / {{master.state_name}}-{{master.pincode}} + + + + +

{{master.product_name}} / {{master.subproduct_name}}

+

{{master.pd_type_name}}   {{master.pd_allocation_type_name}}    {{master.pd_allocated_to}}

+

{{master.addressline1}}

+

{{master.addressline2}}

+

{{master.addressline3}}

+ +

 {{master.loan_amount}}    {{master.pd_status_name}}   {{master.pd_date_of_initiation}}

+ +
+
+
+ + + + +
+ +
+ + Applicants + + + + +

+ +  {{applicant.applicant_name}}     + +  {{applicant.mobile_no}}     Main Applicant +    {{applicant.relation}} +

+ + +
+
+ + +
+ + + + + + Documents + + + + + +

+ {{documents.pd_document_title}}     + +  {{documents.pd_document_name}} +

+
+
+
+ + + + PD History + + + + + + + + diff --git a/ng6-seed/src/app/pd-triger/view-pd/view-pd.component.scss b/ng6-seed/src/app/pd-triger/view-pd/view-pd.component.scss new file mode 100644 index 000000000..542c06744 --- /dev/null +++ b/ng6-seed/src/app/pd-triger/view-pd/view-pd.component.scss @@ -0,0 +1,3 @@ +.cardEdit { + display: inline;float:right; +} \ No newline at end of file diff --git a/ng6-seed/src/app/pd-triger/view-pd/view-pd.component.spec.ts b/ng6-seed/src/app/pd-triger/view-pd/view-pd.component.spec.ts new file mode 100644 index 000000000..51de6afa9 --- /dev/null +++ b/ng6-seed/src/app/pd-triger/view-pd/view-pd.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ViewPdComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ViewPdComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/pd-triger/view-pd/view-pd.component.ts b/ng6-seed/src/app/pd-triger/view-pd/view-pd.component.ts new file mode 100644 index 000000000..29e3ba07a --- /dev/null +++ b/ng6-seed/src/app/pd-triger/view-pd/view-pd.component.ts @@ -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(); + 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 = 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); + } + +} diff --git a/ng6-seed/src/app/settings/masters/component/branch/branch-list/branch-list.component.html b/ng6-seed/src/app/settings/masters/component/branch/branch-list/branch-list.component.html index 4c7d9286b..f3e00b871 100644 --- a/ng6-seed/src/app/settings/masters/component/branch/branch-list/branch-list.component.html +++ b/ng6-seed/src/app/settings/masters/component/branch/branch-list/branch-list.component.html @@ -1,6 +1,6 @@
- +