From 5b56faeb1d9f5b05fe4b55c9df7e511885d0c9dc Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Sat, 13 Oct 2018 18:39:15 +0530 Subject: [PATCH] pd allocation changes --- .../map-pd-view/map-pd-view.component.html | 2 +- .../map-pd-view/map-pd-view.component.ts | 44 +++- .../pd-allocation.component.html | 15 +- .../pd-allocation/pd-allocation.component.ts | 3 +- .../smart-pd-allocation.component.html | 95 +++++++++ .../smart-pd-allocation.component.scss | 0 .../smart-pd-allocation.component.spec.ts | 25 +++ .../smart-pd-allocation.component.ts | 136 ++++++++++++ .../list-pd/view-pd/view-pd.component.html | 196 ++++++++++-------- .../list-pd/view-pd/view-pd.component.ts | 32 ++- .../manage-pd/manage-pd.module.ts | 10 +- .../pd-service/pd-triger.service.ts | 1 + 12 files changed, 451 insertions(+), 108 deletions(-) create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.html create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.scss create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.spec.ts create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.ts diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.html index 9996d99eb..db82928e8 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.html @@ -40,7 +40,7 @@

{{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 73532956b..bbcdc91a3 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 @@ -2,17 +2,19 @@ import { Component, ViewChild, OnInit, OnDestroy } from '@angular/core'; import { MatPaginator, MatSort, MatTableDataSource, PageEvent } from '@angular/material'; import { ActivatedRoute, Router } from '@angular/router'; import { NotifierService } from 'angular-notifier'; +import { MatDialog } from '@angular/material'; import { PdTrigerService } from '../../../pd-service/pd-triger.service'; import { GetGeometricLocationService } from '../../../location-service/get-geometric-location.service'; import { ListPdComponent } from '../list-pd.component'; - +import { PdAllocationComponent } from '../pd-allocation/pd-allocation.component'; +import { SmartPdAllocationComponent } from '../smart-pd-allocation/smart-pd-allocation.component'; @Component({ selector: 'app-map-pd-view', templateUrl: './map-pd-view.component.html', styleUrls: ['./map-pd-view.component.scss'] }) export class MapPdViewComponent implements OnInit, OnDestroy { - + private notifier:NotifierService; lat:string lng:string mapDetails:any[] = []; @@ -30,14 +32,18 @@ public dataSource = new MatTableDataSource(); @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; pdList:any[] = []; - constructor(private route: ActivatedRoute, - private router: Router,private _pd: PdTrigerService,private _geolocation: GetGeometricLocationService, private ListPdComponent : ListPdComponent) { - + constructor(notifier:NotifierService,private route: ActivatedRoute, + private router: Router,private _pd: PdTrigerService,private dialog: MatDialog,private _geolocation: GetGeometricLocationService, private ListPdComponent : ListPdComponent) { + this.notifier=notifier } ngOnInit() { this.ListPdComponent.showListView(false); this.recordStatus=false + this.loadPdDetails(); + } + + loadPdDetails(){ this._pd.getPdDetails() .subscribe( data => { @@ -85,6 +91,34 @@ pdList:any[] = []; this.ListPdComponent.showListView(true); this.router.navigate([ '../../' ], { relativeTo: this.route }); + } + + // pd allocation to + pdAllocationTo(pdData:any) { + if(pdData.fk_pd_type != 2){ + const dialogRef = this.dialog.open(PdAllocationComponent, { + data: pdData, + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + // this.notifier.notify('success', 'Successfully allocated.!'); + this.loadPdDetails(); + }); + } + else if(pdData.fk_pd_type == 2){ + const dialogRef = this.dialog.open(SmartPdAllocationComponent, { + data: pdData, + disableClose: true + }); + dialogRef.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/pd-allocation/pd-allocation.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.html index d677abc20..303360460 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.html @@ -1,4 +1,8 @@
+
+ + +
{{pageTitle}} @@ -28,13 +32,14 @@

PD officer not available..

-
- - -
+ + +
+ +
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.ts index 842a1884f..648ef999c 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.ts @@ -43,7 +43,8 @@ export class PdAllocationComponent implements OnInit { this._pd.getPdOfficerList(pdID).subscribe( data => { if (data.status == 200) { - this.pdOfficerList=data.records; + this.pdOfficerList= data.records.filter(item => item.fk_pd_type_id != 2); + } }, error => this.errorMessage = error); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.html new file mode 100644 index 000000000..d02642ac5 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.html @@ -0,0 +1,95 @@ +
+
+ + +
+ + + + {{pageTitle}} + + + + + + + +

+ {{officer.first_name}} +

+

+ Allocated +

+

+ Scheduled +

+

+ Inprogress +

+ +
+
+
+ + +

PD officer not available..

+
+
+ + +
+ +
+ + +
+
+
+ + + {{pageTitle2}} + + + + + + +

+ {{excutive.first_name}} +

+

+ Allocated +

+

+ Scheduled +

+

+ Inprogress +

+ +
+
+
+ + +

Excutive officer not available..

+
+
+ + + +
+ +
+ + + +
+
+
+
+ + + + + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.spec.ts new file mode 100644 index 000000000..785442760 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SmartPdAllocationComponent } from './smart-pd-allocation.component'; + +describe('SmartPdAllocationComponent', () => { + let component: SmartPdAllocationComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SmartPdAllocationComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SmartPdAllocationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.ts new file mode 100644 index 000000000..42e465e4b --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.ts @@ -0,0 +1,136 @@ +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-smart-pd-allocation', + templateUrl: './smart-pd-allocation.component.html', + styleUrls: ['./smart-pd-allocation.component.scss'] +}) +export class SmartPdAllocationComponent implements OnInit { + + public pageTitle: string = "Allocate To PD Officer"; + public pageTitle2: string = "Allocate To Excutive Officer"; + public _pdAllocationForm: FormGroup; + public pdOfficerList: any = []; + public pdExcutiveList: any = []; + errorMessage: any; + notifier : NotifierService; + selectedItem:any=[]; + selectedItem1:any=[]; + isDisabled: boolean; + showFirstCard: boolean; + showSecondCard: boolean; + + constructor( notifier: NotifierService, + private _fb: FormBuilder, + private dialogRef: MatDialogRef, + private _pd: PdTrigerService, + @Inject(MAT_DIALOG_DATA) public data: any) { + this.notifier=notifier; + } + + ngOnInit() { + this.showFirstCard=true; +// this.pdExcutiveList=[ +// { +// "first_name": "Ramya", +// "allocated": "4", +// "scheduled":"2", +// "inprogress":"0", +// }, +// { +// "first_name": "Sri Vidhya", +// "allocated": "5", +// "scheduled":"3", +// "inprogress":"2", +// }, +// ] +// this.pdOfficerList=[ +// { +// "first_name": "Moorthy", +// "allocated": "4", +// "scheduled":"2", +// "inprogress":"0", +// }, +// { +// "first_name": "Priya", +// "allocated": "5", +// "scheduled":"3", +// "inprogress":"2", +// }, +// ] + this.isDisabled=true; + this.getPDOfficerList(this.data.pd_id); + } + +// pd officer list + getPDOfficerList(pdID:string){ + this._pd.getPdOfficerList(pdID).subscribe( + data => { + if (data.status == 200) { + this.pdOfficerList= data.records.filter(item => item.fk_pd_type_id != 2); + this.pdExcutiveList= data.records.filter(item => item.fk_pd_type_id == 2); + } + }, error => this.errorMessage = error); + + } + // select pd officer list + selectPdOfficer(selected:any){ + + this.selectedItem=selected; + // this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + + } + // select excutive officer + selectExcutiveOfficer(selected:any){ + this.isDisabled=false; + this.selectedItem1=selected; + } + /** To update pd officer*/ + updateAllocation(pdOfficer:any,excutiveOfficer:any) { + if(this.isDisabled){ + this.notifier.notify('warning', 'Please Choose Allocate To Whom.!'); + } + else { + let updateData = { + "pd_id":this.data.pd_id, + "fk_pd_allocated_to":pdOfficer.fk_user_id, + "excutive_id":excutiveOfficer.fk_user_id, + } + this._pd.updatePdOfficer(updateData).subscribe( + result => { + if (result.status == 200) { + this.notifier.notify('success', 'PD Allocated.!'); + 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(); + }); + } + } + getFirstCard() { + this.showSecondCard=false; + this.showFirstCard=true; + + } + getSecondCard(){ + this.showFirstCard=false; + this.showSecondCard=true; + + + } +/** For Popup Close Button */ + closeAllocationComponent(): void { + 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 ecb9de82e..1e0c22956 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 @@ -1,87 +1,115 @@ -
- -
- -
- - - -
- - - {{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 - - - - - +
+ + +
+ + + +
+ + + {{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_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/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 ee8a7e8cc..57080f137 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 @@ -5,6 +5,7 @@ import { MatDialog } from '@angular/material'; import { NotifierService } from 'angular-notifier'; 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'; @Component({ selector: 'app-view-pd', @@ -62,17 +63,32 @@ export class ViewPdComponent implements OnInit, OnDestroy { } // pd allocation to - // edit questions master details popup model - pdAllocationTo(pdID:any) { - const dialogRef = this.dialog.open(PdAllocationComponent, { - data: pdID, - disableClose: true - }); - dialogRef.afterClosed() + pdAllocationTo(pdData:any) { + if(pdData.fk_pd_type != 2){ + const dialogRef = this.dialog.open(PdAllocationComponent, { + data: pdData, + disableClose: true + }); + dialogRef.afterClosed() .subscribe(dataresult => { // this.notifier.notify('success', 'Successfully allocated.!'); - // this.viewPdDetails(this.childData) + this.viewPdDetails(this.viewID) }); + } + else if(pdData.fk_pd_type == 2){ + const dialogRef = this.dialog.open(SmartPdAllocationComponent, { + data: pdData, + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + // this.notifier.notify('success', 'Successfully allocated.!'); + + this.viewPdDetails(this.viewID) + }); + } + + } // updateViewComponent(editBack:string) { 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 59e77c3fd..391b2d3c2 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 @@ -7,7 +7,7 @@ import { MatRadioModule, MatButtonModule,MatTableModule,MatPaginatorModule, MatProgressBarModule,MatDialogModule, MatSortModule, - MatToolbarModule,MatSelectModule, MatListModule, MatGridListModule, MatTabsModule, MatCheckboxModule, MatBadgeModule, MatExpansionModule } from '@angular/material'; + MatToolbarModule,MatSelectModule, MatListModule, MatGridListModule, MatTabsModule, MatCheckboxModule, MatBadgeModule, MatExpansionModule, MatStepperModule } from '@angular/material'; import {MatSlideToggleModule} from '@angular/material/slide-toggle'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload'; @@ -27,6 +27,7 @@ import { MapPdViewComponent } from './list-pd/map-pd-view/map-pd-view.component' import { AddPdComponent } from '../manage-pd/list-pd/add-pd/add-pd.component'; import { ViewPdComponent } from '../manage-pd/list-pd/view-pd/view-pd.component'; import { PdAllocationComponent } from '../manage-pd/list-pd/pd-allocation/pd-allocation.component'; +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'; @@ -90,7 +91,7 @@ const pdCustomNotifierOptions: NotifierOptions = { FlexLayoutModule, NgxDatatableModule, FormsModule,MatSlideToggleModule, - MatSelectModule, MatListModule,MatGridListModule, MatTabsModule, MatBadgeModule, MatCheckboxModule, + MatSelectModule, MatListModule,MatGridListModule, MatTabsModule, MatBadgeModule, MatCheckboxModule,MatStepperModule, ReactiveFormsModule, FileUploadModule, TreeModule, @@ -98,7 +99,8 @@ const pdCustomNotifierOptions: NotifierOptions = { NgxMatSelectSearchModule,MatTooltipModule, MatExpansionModule, AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), ], - declarations: [ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent], - providers: [PdTrigerService, GetGeometricLocationService] + declarations: [ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent], + providers: [PdTrigerService, GetGeometricLocationService], + entryComponents: [PdAllocationComponent, SmartPdAllocationComponent] }) 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 808767907..76901ebb7 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 @@ -132,6 +132,7 @@ export class PdTrigerService { } // update pd officer updatePdOfficer(updateData: any): Observable { + console.log(updateData) updateData.fk_updatedby = this._aws.getlocale(); updateData.updatedon = currentdate; return this._http.post(this.apiUrl+"allocatePD",{"records":updateData})