pd allocation changes

This commit is contained in:
gandhimathi 2018-10-13 18:39:15 +05:30
parent a1de92bcd0
commit 5b56faeb1d
12 changed files with 451 additions and 108 deletions

View File

@ -40,7 +40,7 @@
<p>{{details.pd_date_of_initiation}} <span style="padding-left: 4%;" class="hover-icon"><i class="fa-1x fa fa-rupee">&nbsp;</i>{{details.loan_amount}}</span></p>
</mat-card-subtitle>
<mat-card-actions>
<button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="pdAllocationTo(master)"><mat-icon>directions_run</mat-icon></button>
<button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="pdAllocationTo(details)"><mat-icon>directions_run</mat-icon></button>
<!-- <button mat-button>Cancel</button> -->
</mat-card-actions>
</mat-card>

View File

@ -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);

View File

@ -1,4 +1,8 @@
<div style="max-height: 480px;">
<div style="text-align: right">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="closeAllocationComponent()"><mat-icon>close</mat-icon></button>
</div>
<mat-card style="width: 580px; padding: 2px;">
<mat-card-header>
<mat-card-title>{{pageTitle}}</mat-card-title>
@ -28,13 +32,14 @@
<p>PD officer not available..</p>
</mat-list-item>
</mat-list>
<div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button"
(click)="closeAllocationComponent()"><mat-icon>close</mat-icon></button>
<button mat-raised-button mat-icon-button (click)="updatePdOfficer(selectedItem)" class="mr-1 mb-1 hover-icon" type="button"><mat-icon>save</mat-icon></button>
</div>
<!-- </form> -->
</mat-card-content>
<mat-card-actions>
<div style="text-align:right;">
<button mat-raised-button mat-icon-button (click)="updatePdOfficer(selectedItem)" class="mr-1 mb-1 hover-icon" type="button"><mat-icon>save</mat-icon></button>
</div>
</mat-card-actions>
</mat-card>
</div>
<notifier-container></notifier-container>

View File

@ -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 = <any> error);

View File

@ -0,0 +1,95 @@
<div style="max-height: 480px;">
<div style="text-align: right">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="closeAllocationComponent()"><mat-icon>close</mat-icon></button>
</div>
<mat-card style="width: 580px; padding: 2px;" [style.display]="showFirstCard ? 'block' : 'none'">
<mat-card-header>
<mat-card-title>{{pageTitle}}</mat-card-title>
</mat-card-header>
<mat-card-content>
<!-- <form [formGroup]="_pdAllocationForm" (submit)="onSubmit()"> -->
<mat-list *ngIf="pdOfficerList.length > 0" >
<mat-radio-group>
<mat-list-item *ngFor="let officer of pdOfficerList; ">
<p><mat-radio-button [value]="officer" (change)="selectPdOfficer(officer)"></mat-radio-button>
{{officer.first_name}}
</p>
<p style="padding-left: 8%;">
<span matBadge="{{officer.allocated}}" matBadgeOverlap="false" matBadgeColor="accent">Allocated</span>
</p>
<p style="padding-left: 8%;">
<span matBadge="{{officer.scheduled}}" matBadgeOverlap="false" >Scheduled</span>
</p>
<p style="padding-left: 8%;">
<span matBadge="{{officer.inprogress}}" matBadgeOverlap="false" matBadgeColor="warn">Inprogress</span>
</p>
</mat-list-item>
</mat-radio-group>
</mat-list>
<mat-list *ngIf="pdOfficerList.length == 0">
<mat-list-item>
<p>PD officer not available..</p>
</mat-list-item>
</mat-list>
<!-- </form> -->
</mat-card-content>
<mat-card-actions>
<div style="text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" [disabled]="selectedItem.length==0" (click)="getSecondCard()"><mat-icon>arrow_forward</mat-icon></button>
</div>
</mat-card-actions>
</mat-card>
<mat-card style="width: 580px; padding: 2px;" [style.display]="showSecondCard ? 'block' : 'none'">
<mat-card-header>
<mat-card-title>{{pageTitle2}}</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-list *ngIf="pdExcutiveList.length > 0">
<mat-radio-group>
<mat-list-item *ngFor="let excutive of pdExcutiveList">
<p><mat-radio-button [value]="excutive" (change)="selectExcutiveOfficer(excutive)"></mat-radio-button>
{{excutive.first_name}}
</p>
<p style="padding-left: 8%;">
<span matBadge="{{excutive.allocated}}" matBadgeOverlap="false" matBadgeColor="accent">Allocated</span>
</p>
<p style="padding-left: 8%;">
<span matBadge="{{excutive.scheduled}}" matBadgeOverlap="false" >Scheduled</span>
</p>
<p style="padding-left: 8%;">
<span matBadge="{{excutive.inprogress}}" matBadgeOverlap="false" matBadgeColor="warn">Inprogress</span>
</p>
</mat-list-item>
</mat-radio-group>
</mat-list>
<mat-list *ngIf="pdExcutiveList.length == 0">
<mat-list-item>
<p>Excutive officer not available..</p>
</mat-list-item>
</mat-list>
<!-- </form> -->
</mat-card-content>
<mat-card-actions>
<div style="text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" [disabled]="selectedItem.length==0" (click)="getFirstCard()"><mat-icon>arrow_back</mat-icon></button>
<button mat-raised-button mat-icon-button (click)="updateAllocation(selectedItem,selectedItem1)" [disabled]="selectedItem.length==0 || selectedItem1.length==0" class="mr-1 mb-1 hover-icon" type="button"><mat-icon>save</mat-icon></button>
</div>
</mat-card-actions>
</mat-card>
</div>
<notifier-container></notifier-container>

View File

@ -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<SmartPdAllocationComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SmartPdAllocationComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SmartPdAllocationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -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<SmartPdAllocationComponent>,
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 = <any> 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();
}
}

View File

@ -1,11 +1,19 @@
<div class="row" style="text-align:right;">
<mat-card class="mb-2" >
<mat-card-header>
<div style="width:100%;text-align: right;padding-top: 1%;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="loadPdListCompoent()"><mat-icon>close</mat-icon></button>
</div>
</mat-card-header>
<mat-card-content>
<div fxLayout="row">
<div class="column" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50">
<!--pd master -->
<mat-card *ngFor="let master of pdMasterData">
<div class="cardEdit">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="pdAllocationTo(master)"><mat-icon>directions_run</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button"><mat-icon>schedule</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdMaster(master)"><mat-icon>edit</mat-icon></button>
<button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="pdAllocationTo(master)"><mat-icon>directions_run</mat-icon></button>
<button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button"><mat-icon>schedule</mat-icon></button>
<button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdMaster(master)"><mat-icon>edit</mat-icon></button>
</div>
<mat-card-header>
<img mat-card-avatar src="assets/images/avatar.jpg">
@ -16,7 +24,7 @@
</mat-card-header>
<mat-card-content>
<p>{{master.product_name}} / {{master.subproduct_name}}</p>
<p><span>{{master.pd_type_name}}&nbsp;&nbsp;&nbsp;{{master.pd_allocation_type_name}} &nbsp;&nbsp;&nbsp;{{master.pd_allocated_to}}</span></p>
<p><span>{{master.pd_type_name}}&nbsp;&nbsp;&nbsp;{{master.pd_allocated_to}}</span></p>
<p><span>{{master.addressline1}}</span></p>
<p><span>{{master.addressline2}}</span></p>
<p><span>{{master.addressline3}}</span></p>
@ -26,10 +34,13 @@
</mat-card-content>
</mat-card>
</div>
<div class="column" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50">
<!-- applicant card -->
<mat-card>
<div class="cardEdit">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdApplicant(pdApplicantData)"><mat-icon>edit</mat-icon></button>
<button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdApplicant(pdApplicantData)"><mat-icon>edit</mat-icon></button>
</div>
<mat-card-header>
<mat-card-title>Applicants</mat-card-title>
@ -53,7 +64,14 @@
</mat-card-content>
</mat-card>
<!-- pd documents details -->
</div>
</div>
<div fxLayout="row">
<div class="column" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50">
<!-- pd documents card -->
<mat-card>
<!-- <div class="cardEdit">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon"><mat-icon>edit</mat-icon></button>
@ -74,6 +92,10 @@
</mat-list>
</mat-card>
</div>
<div class="column" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50">
<!--pd logs card -->
<mat-card>
<mat-card-header>
@ -83,5 +105,11 @@
</mat-card-content>
</mat-card>
</div>
</div>
</mat-card-content>
</mat-card>
<!-- <notifier-container></notifier-container> -->

View File

@ -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,18 +63,33 @@ export class ViewPdComponent implements OnInit, OnDestroy {
}
// pd allocation to
// edit questions master details popup model
pdAllocationTo(pdID:any) {
pdAllocationTo(pdData:any) {
if(pdData.fk_pd_type != 2){
const dialogRef = this.dialog.open(PdAllocationComponent, {
data: pdID,
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) {

View File

@ -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 { }

View File

@ -132,6 +132,7 @@ export class PdTrigerService {
}
// update pd officer
updatePdOfficer(updateData: any): Observable<any> {
console.log(updateData)
updateData.fk_updatedby = this._aws.getlocale();
updateData.updatedon = currentdate;
return this._http.post<any>(this.apiUrl+"allocatePD",{"records":updateData})