diff --git a/ng6-seed/package.json b/ng6-seed/package.json
index 06740755f..661d62af8 100644
--- a/ng6-seed/package.json
+++ b/ng6-seed/package.json
@@ -45,6 +45,7 @@
"karma-jasmine": "^1.1.1",
"leaflet": "^1.0.2",
"moment": "^2.15.0",
+ "ng-pick-datetime": "^5.2.6",
"ng2-charts": "1.6.0",
"ng2-dragula": "1.3.1",
"ng2-file-upload": "1.2.1",
@@ -88,4 +89,3 @@
"typescript": "^2.7.2"
}
}
-
\ No newline at end of file
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts
index 0ed9a60ae..58b91a531 100644
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts
@@ -285,9 +285,9 @@ export class AddPdComponent implements OnInit, OnDestroy {
let pd_details:any={
"fk_lender_id":formValue.fk_lender_id,
"lender_applicant_id":formValue.lender_applicant_id,
- "lender_billing_id":formValue.lender_billing,
- "lender_contact_person":formValue.lender_contact_person,
- "lender_contact_mobile":formValue.lender_contact_mobile,
+ "fk_entity_billing_id":formValue.lender_billing,
+ "pd_contact_person":formValue.lender_contact_person,
+ "pd_contact_mobileno":formValue.lender_contact_mobile,
"fk_product_id":formValue.fk_product_id,
"fk_subproduct_id":formValue.fk_subproduct_id,
"fk_pd_type":formValue.fk_pd_type,
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html
new file mode 100644
index 000000000..3defab285
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.spec.ts
new file mode 100644
index 000000000..73b41f696
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/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/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts
new file mode 100644
index 000000000..c40b7d2cf
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts
@@ -0,0 +1,166 @@
+import { Component, OnInit,ViewEncapsulation, Inject } from '@angular/core';
+import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
+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 {
+ public pageTitle: string = "Edit Applicant";
+ errorMessage: any;
+ public _EditApplicantForm:FormGroup;
+ public notifier: NotifierService;
+ mainApplicantData: any[];
+ coApplicantData: any[];
+ coApplicantItems:FormArray;
+ emptyData:any;
+ relationShipList:any;
+ constructor(private _fb: FormBuilder,
+ private _pd: PdTrigerService, notifier: NotifierService, private dialogRef: MatDialogRef,
+ @Inject(MAT_DIALOG_DATA) public data: any) {
+ this.notifier=notifier
+ }
+
+ ngOnInit() {
+ if(this.data.records.length>0){
+ this.mainApplicantData= this.data.records.filter(item => item.applicant_type == 1);
+ this.coApplicantData= this.data.records.filter(item => item.applicant_type == 0);
+ this.loadApplicantFormData();
+ }
+ else{
+ this.loadEmptyFormData()
+ }
+ this.getRelationMaster();
+
+ }
+ loadEmptyFormData() {
+ this._EditApplicantForm = this._fb.group({
+ fk_applicant_primary_id: [null],
+ applicant_name: [null, Validators.compose([Validators.required])],
+ mobile_no: [null, Validators.compose([Validators.required])],
+ email: [null, Validators.compose([Validators.required, CustomValidators.email])],
+ applicant_type: [1],
+ coApplicantItems: this._fb.array([]),
+});
+
+ }
+
+ 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.data.pdID,
+ "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.data.pdID,
+ "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', 'Applicants updated..');
+ this.dialogRef.close();
+ }
+ else {
+ this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
+ }
+ }, error => {
+ this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
+ });
+ }
+ }
+
+ // get relation master details
+ getRelationMaster(){
+ let relation ="RELATIONSHIPS";
+ this._pd.getAllMasterDatas(relation).subscribe(
+ data => {
+ if (data.status == 200) {
+ this.relationShipList=data.records;
+
+ }
+ }, error => this.errorMessage = error);
+ }
+ /** To Reset Popup Data */
+ onReset() {
+ if(this.data.records.length>0){
+ this.loadApplicantFormData();
+ }
+ else{
+ this.loadEmptyFormData();
+ }
+ }
+ /** For Popup Close Button */
+ closeEditComponent(): void {
+ this.dialogRef.close();
+ }
+}
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html
new file mode 100644
index 000000000..5d2f67588
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html
@@ -0,0 +1,136 @@
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.spec.ts
new file mode 100644
index 000000000..c2b08e200
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/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/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts
new file mode 100644
index 000000000..499191446
--- /dev/null
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts
@@ -0,0 +1,153 @@
+import { Component, OnInit,ViewEncapsulation, Inject } from '@angular/core';
+import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
+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 {
+ public pageTitle: string = "Edit PD Master";
+ errorMessage: any;
+ productList:any;
+ subProductList:any;
+ lenderList:any;
+ customerSegmentList:any;
+ stateList:any;
+ cityList:any;
+ pdTypeList:any;
+ billingList:any;
+ public _EditPDtriggerForm:FormGroup;
+ public notifier: NotifierService;
+ constructor(private _fb: FormBuilder,
+ private _pd: PdTrigerService, notifier: NotifierService,private dialogRef: MatDialogRef,
+ @Inject(MAT_DIALOG_DATA) public data: any) {
+ this.notifier=notifier
+ }
+
+ ngOnInit() {
+ console.log(this.data)
+ 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
+ if(this.data.fk_lender_id){
+ this.getBillingDetails(this.data.fk_lender_id);
+ }
+ }
+ }, error => this.errorMessage = error);
+ }
+ getProductsList(){
+ this._pd.getProductsDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.productList=data.records
+ if(this.data.fk_product_id){
+ this.getSubproductList(this.data.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
+ if(this.data.fk_state){
+ this.getCityList(this.data.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.data.pd_id],
+ fk_lender_id: [this.data.fk_lender_id, Validators.compose([Validators.required])],
+ lender_applicant_id: [this.data.lender_applicant_id, Validators.compose([Validators.required])],
+ pd_contact_person: [this.data.pd_contact_person, Validators.compose([Validators.required])],
+ pd_contact_mobileno: [this.data.pd_contact_mobileno, Validators.compose([Validators.required])],
+ fk_enitity_billing_id: [this.data.fk_enitity_billing_id],
+ fk_product_id: [this.data.fk_product_id],
+ fk_subproduct_id: [this.data.fk_subproduct_id],
+ fk_pd_type: [this.data.fk_pd_type],
+ fk_customer_segment: [this.data.fk_customer_segment],
+ loan_amount: [this.data.loan_amount],
+ addressline1: [this.data.addressline1],
+ addressline2: [this.data.addressline2],
+ addressline3: [this.data.addressline3],
+ fk_city: [this.data.fk_city],
+ fk_state: [this.data.fk_state],
+ pincode : [this.data.pincode],
+ });
+ }
+ 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;
+ }
+ // lendor billing address
+ getBillingDetails(lendorID:string){
+ console.log(lendorID)
+ // this.billingList= this.lenderList.filter(item => item.fk_entity_id == lendorID);
+ // this.billingList=this.billingList[0].billing_address;
+ }
+ 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();
+ }
+ }
+ /** To Reset Popup Data */
+ onReset() {
+ this.loadFormData();
+ }
+ /** For Popup Close Button */
+ closeEditMasterComponent(): void {
+ this.dialogRef.close();
+ }
+
+
+}
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.html
index fa3855b93..a8567c7cf 100644
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.html
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.html
@@ -1,4 +1,4 @@
-