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 @@ +
+
+ +
+
+ +
+
+ +
Main Applicant
+ + + + + Name is required. + + + + + Email number is required. + + + + + + Mobile number is required. + + + +
+
+
+
+
+ + +
{{coDetails.controls.label.value}} {{i+1}}
+ +
+ + + + + + + + + + + + + {{rel.name}} + + + +
+
+
+
+
+ +
+ + + + +
+
+ +
+
+ + + +
+
+ + + \ 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 @@ +
+
+ +
+ +
+ +
+
+
+ + + + {{LL.full_name}} + + + + + + + + + Applicant ID Required + + + + + {{billL.billing_name}} + + + + + + + Contact Person Required + + + + Contact Number Required + + + + + {{PL.product_name}} + + + + + + + + + + {{SPL.subproduct_name}} + + + + + + + + + + {{CSL.customer_segment}} + + + + + + + + {{PDL.type_name}} + + + + + + + + + + + + + + + + + + + + + + + + + + {{SL.state_name}} + + + + + + + + + ` + {{CL.city_name}} + + + + + + + + + + + + +
+ +
+
+ + +
+ + + + +
+
+
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 @@ -
+
@@ -20,10 +20,10 @@ -

{{details.applicat_details[0].applicant_name}}

+

{{details.applicat_details[0].applicant_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.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.city_name}}/{{details.state_name}}-{{details.pincode}}

+ {{details.applicat_details[0].applicant_name}} +

 {{details.city_name}}/{{details.state_name}}-{{details.pincode}}

{{details.lender_full_name}}({{details.lender_applicant_id}})

-

{{details.product_abbr}}/{{details.subproduct_abbr}}/{{details.customer_segment_abbr}}

-

{{details.pd_date_of_initiation}}  {{details.loan_amount}}

+

{{details.product_abbr}}/{{details.subproduct_abbr}}/{{details.customer_segment_abbr}}

+

{{details.pd_date_of_initiation}}  {{details.loan_amount}}

+ + +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.ts index bbcdc91a3..4e3e91ee4 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.ts @@ -8,6 +8,8 @@ import { GetGeometricLocationService } from '../../../location-service/get-geome import { ListPdComponent } from '../list-pd.component'; import { PdAllocationComponent } from '../pd-allocation/pd-allocation.component'; import { SmartPdAllocationComponent } from '../smart-pd-allocation/smart-pd-allocation.component'; +import { SchedulePdComponent } from '../schedule-pd/schedule-pd.component'; + @Component({ selector: 'app-map-pd-view', templateUrl: './map-pd-view.component.html', @@ -66,7 +68,8 @@ pdList:any[] = []; getMapViewLocations(getData:any){ getData.forEach(element => { - this._geolocation.findLocations(element.addressline1,element.pincode,element.state_name,element.city_name) + if(element.addressline1 && element.pincode && element.state_name && element.city_name){ + this._geolocation.findLocations(element.addressline1,element.pincode,element.state_name,element.city_name) .subscribe(response => { if (response.status == 'OK') { this.lat = response.results[0].geometry.location.lat; @@ -79,6 +82,8 @@ pdList:any[] = []; // console.log('geocodingAPIService', 'Other error', response.status); // } }); + } + }); } @@ -120,6 +125,20 @@ pdList:any[] = []; } + + // pd schedule details + scheduleDetails(pdData:any){ + + const dialogSchedule = this.dialog.open(SchedulePdComponent, { + data: pdData, + disableClose: true + }); + dialogSchedule.afterClosed() + .subscribe(dataresult => { + // this.notifier.notify('success', 'Successfully allocated.!'); + this.loadPdDetails(); + }); +} ngOnDestroy(): void { this.ListPdComponent.showListView(true); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.html new file mode 100644 index 000000000..06e1137aa --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.html @@ -0,0 +1,53 @@ + +
+ +
+ +
+
+ + + + + + + {{times.name}} + + + Please Choose Time + + + + + + + + + +
+ + + + +
+ + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.spec.ts new file mode 100644 index 000000000..82d0cdbe7 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SchedulePdComponent } from './schedule-pd.component'; + +describe('SchedulePdComponent', () => { + let component: SchedulePdComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SchedulePdComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SchedulePdComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.ts new file mode 100644 index 000000000..17d0b8174 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.ts @@ -0,0 +1,102 @@ +import { Component, OnInit, Inject, Pipe, PipeTransform } 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'; +import { DatePipe } from '@angular/common'; +export interface Timeslot { + id: string; + name: string; + objectValue: string +} + +@Component({ + selector: 'app-schedule-pd', + templateUrl: './schedule-pd.component.html', + styleUrls: ['./schedule-pd.component.scss'] +}) +export class SchedulePdComponent implements OnInit { + public pageTitle: string = "PD Schedule"; + pipe = new DatePipe('en-US'); + public selectedMoment = new Date(); + errorMessage: any; + notifier : NotifierService; + scheduleControl = new FormControl('', [Validators.required]); + timeDetails: Timeslot[] = [ + {id: '1', name: '06:00 AM', objectValue:'06:00:00'}, + {id: '2', name: '06:30 AM', objectValue:'06:30:00'}, + {id: '3', name: '07:00 AM', objectValue:'07:00:00'}, + {id: '4', name: '07:30 AM', objectValue:'07:30:00'}, + {id: '5', name: '08:00 AM', objectValue:'08:00:00'}, + {id: '6', name: '08:30 AM', objectValue:'08:30:00'}, + {id: '7', name: '09:00 AM', objectValue:'09:00:00'}, + {id: '8', name: '09:30 AM', objectValue:'09:30:00'}, + {id: '9', name: '10:00 AM', objectValue:'10:00:00'}, + {id: '10', name: '10:30 AM', objectValue:'10:30:00'}, + {id: '11', name: '11:00 AM', objectValue:'11:00:00'}, + {id: '12', name: '11:30 AM', objectValue:'11:30:00'}, + {id: '13', name: '12:00 PM', objectValue:'12:00:00'}, + {id: '14', name: '12:30 PM', objectValue:'12:30:00'}, + {id: '15', name: '01:00 PM', objectValue:'13:00:00'}, + {id: '16', name: '01:30 PM', objectValue:'13:30:00'}, + {id: '17', name: '02:00 PM', objectValue:'14:00:00'}, + {id: '18', name: '02:30 PM', objectValue:'14:30:00'}, + {id: '19', name: '03:00 PM', objectValue:'15:00:00'}, + {id: '20', name: '03:30 PM', objectValue:'15:30:00'}, + {id: '21', name: '04:00 PM', objectValue:'16:00:00'}, + {id: '22', name: '04:30 PM', objectValue:'16:30:00'}, + {id: '23', name: '05.00 PM', objectValue:'17:00:00'}, + {id: '24', name: '05:30 PM', objectValue:'17:30:00'}, + {id: '25', name: '06:00 PM', objectValue:'18:00:00'}, + {id: '26', name: '06:30 PM', objectValue:'18:30:00'}, + {id: '27', name: '07:00 PM', objectValue:'19:00:00'}, + {id: '28', name: '07:30 PM', objectValue:'19:30:00'}, + {id: '29', name: '08:00 PM', objectValue:'20:00:00'}, + + ]; + public min = new Date(); + constructor(notifier: NotifierService, private dialogRef: MatDialogRef, + private _pd: PdTrigerService, + @Inject(MAT_DIALOG_DATA) public data: any) { + this.notifier=notifier; + } + + ngOnInit() { + + } + + // close pd schedule pop up + closeScheduleComponent(): void { + this.dialogRef.close(); + } + // update pd schedule + + upatePDSchedule(date:any,time:string){ + let myFormattedDate = this.pipe.transform(date, 'yyyy-MM-dd'); + if(!this.scheduleControl.valid){ + this.notifier.notify('warning', 'Please Choose Schedule Date/Time.!'); + } + else { + let updateData = { + "fk_pd_id":this.data.pd_id, + "schedule_time":myFormattedDate +' '+ time, + } + this._pd.updateSchedule(updateData).subscribe( + result => { + if (result.status == 200) { + this.notifier.notify('success', 'PD Scheduled.!'); + 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(); + }); + } + } + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html index 1e0c22956..ae3ea2041 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html @@ -11,25 +11,25 @@
- - + +
{{master.lender_full_name}} - {{master.lender_applicant_id}} -  {{master.city_name}} / {{master.state_name}}-{{master.pincode}} +  {{master.city_name}} / {{master.state_name}}-{{master.pincode}} -

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

-

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

+

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

+

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

{{master.addressline1}}

{{master.addressline2}}

{{master.addressline3}}

-

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

+

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

@@ -45,27 +45,30 @@ Applicants - - + + +

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

- +
+ +

No Applicants

+
-
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts index 57080f137..fefd67712 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts @@ -7,6 +7,10 @@ import { PdTrigerService } from '../../../pd-service/pd-triger.service'; import { PdAllocationComponent } from '../pd-allocation/pd-allocation.component'; import { SmartPdAllocationComponent } from '../smart-pd-allocation/smart-pd-allocation.component'; import { ListPdComponent } from '../list-pd.component'; +import { SchedulePdComponent } from '../schedule-pd/schedule-pd.component'; +import { EditPdApplicantComponent } from '../edit-pd-applicant/edit-pd-applicant.component'; +import { EditPdMasterComponent } from '../edit-pd-master/edit-pd-master.component'; + @Component({ selector: 'app-view-pd', templateUrl: './view-pd.component.html', @@ -14,13 +18,13 @@ import { ListPdComponent } from '../list-pd.component'; encapsulation: ViewEncapsulation.None }) export class ViewPdComponent implements OnInit, OnDestroy { - + public selectedMoment = new Date(); private notifier:NotifierService; errorMessage: any; - pdMasterData: any; - pdApplicantData: any; - pdDocumentsData: any; - pdLogsData: any; + pdMasterData: any=[]; + pdApplicantData: any=[]; + pdDocumentsData: any=[]; + pdLogsData: any=[]; viewID:string; viewParams:any; // @Input() childData: string; @@ -57,10 +61,31 @@ export class ViewPdComponent implements OnInit, OnDestroy { } editPdMaster(masterData:any){ - + + const dialogPDMaster = this.dialog.open(EditPdMasterComponent, { + data: masterData, + disableClose: true + }); + dialogPDMaster.afterClosed() + .subscribe(dataresult => { + // this.notifier.notify('success', 'Successfully allocated.!'); + this.viewPdDetails(this.viewID) + }); } editPdApplicant(applicantData:any){ - + let setPdDetails = { + "pdID":this.viewID, + "records":applicantData + } + const dialogApplicant = this.dialog.open(EditPdApplicantComponent, { + data: setPdDetails, + disableClose: true + }); + dialogApplicant.afterClosed() + .subscribe(dataresult => { + // this.notifier.notify('success', 'Successfully allocated.!'); + this.viewPdDetails(this.viewID) + }); } // pd allocation to pdAllocationTo(pdData:any) { @@ -76,7 +101,7 @@ export class ViewPdComponent implements OnInit, OnDestroy { }); } else if(pdData.fk_pd_type == 2){ - const dialogRef = this.dialog.open(SmartPdAllocationComponent, { + const dialogRef = this.dialog.open(PdAllocationComponent, { data: pdData, disableClose: true }); @@ -91,6 +116,20 @@ export class ViewPdComponent implements OnInit, OnDestroy { } + // pd schedule details + scheduleDetails(pdData:any){ + + const dialogSchedule = this.dialog.open(SchedulePdComponent, { + data: pdData, + disableClose: true + }); + dialogSchedule.afterClosed() + .subscribe(dataresult => { + // this.notifier.notify('success', 'Successfully allocated.!'); + this.viewPdDetails(this.viewID) + }); + } + // updateViewComponent(editBack:string) { // if(editBack=='1'){ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts index 391b2d3c2..0000aaaec 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts @@ -30,7 +30,10 @@ import { PdAllocationComponent } from '../manage-pd/list-pd/pd-allocation/pd-all import { SmartPdAllocationComponent } from './list-pd/smart-pd-allocation/smart-pd-allocation.component'; import { PdTrigerService } from '../pd-service/pd-triger.service'; import { GetGeometricLocationService } from '../location-service/get-geometric-location.service'; - +import { OwlDateTimeModule, OwlNativeDateTimeModule } from 'ng-pick-datetime'; +import { SchedulePdComponent } from './list-pd/schedule-pd/schedule-pd.component'; +import { EditPdApplicantComponent } from './list-pd/edit-pd-applicant/edit-pd-applicant.component'; +import { EditPdMasterComponent } from './list-pd/edit-pd-master/edit-pd-master.component'; /** * Custom angular notifier options */ @@ -97,10 +100,11 @@ const pdCustomNotifierOptions: NotifierOptions = { TreeModule, MatDialogModule,MatSortModule, NgxMatSelectSearchModule,MatTooltipModule, MatExpansionModule, - AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), + AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}),OwlDateTimeModule, + OwlNativeDateTimeModule, ], - declarations: [ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent], + declarations: [ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent], providers: [PdTrigerService, GetGeometricLocationService], - entryComponents: [PdAllocationComponent, SmartPdAllocationComponent] + entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent] }) export class ManagePdModule { } diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index 76901ebb7..72e857142 100644 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -141,6 +141,15 @@ export class PdTrigerService { ) } + // update pd schedule + updateSchedule(updateData: any): Observable { + updateData.fk_scheduled_by = this._aws.getlocale(); + updateData.createdon = currentdate; + return this._http.post(this.apiUrl+"schdulePD",{"records":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/assets/styles/app.scss b/ng6-seed/src/assets/styles/app.scss index a5b6d83cc..b8044770c 100644 --- a/ng6-seed/src/assets/styles/app.scss +++ b/ng6-seed/src/assets/styles/app.scss @@ -47,4 +47,7 @@ Author: TrendSetter Themes /* Add application styles & imports to this file! */ -@import "~angular-notifier/styles"; \ No newline at end of file +@import "~angular-notifier/styles"; + +// import date time picker styles +@import "~ng-pick-datetime/assets/style/picker.min.css"; \ No newline at end of file