tele pd changes

This commit is contained in:
gandhimathi 2018-11-12 14:31:08 +05:30
parent db04280b94
commit d1ff5dcb83
9 changed files with 192 additions and 43 deletions

View File

@ -10,7 +10,7 @@ import { PdTrigerService } from '../../../pd-service/pd-triger.service';
styleUrls: ['./pd-allocation.component.scss']
})
export class PdAllocationComponent implements OnInit {
public pageTitle: string = "PD Allocation To";
public pageTitle: string = "Allocation To PD Officer";
public _pdAllocationForm: FormGroup;
public pdOfficerList: any = [];
errorMessage: any;
@ -43,9 +43,8 @@ export class PdAllocationComponent implements OnInit {
this._pd.getPdOfficerList(pdID).subscribe(
data => {
if (data.status == 200) {
this.pdOfficerList= data.records.filter(item => item.fk_pd_type_id != 2);
this.pdOfficerList= data.records.pdofficers.filter(item => item.fk_pd_type_id == 1);
}
}, error => this.errorMessage = <any> error);

View File

@ -11,9 +11,9 @@
<mat-card-content>
<!-- <form [formGroup]="_pdAllocationForm" (submit)="onSubmit()"> -->
<div *ngIf="pdOfficerList.length > 0" >
<div *ngIf="pdExcutiveList.length > 0" >
<div fxLayout="row wrap" fxFlex="100%">
<div fxLayout="row wrap" fxFlex="33.33%" *ngFor="let officer of pdOfficerList; ">
<div fxLayout="row wrap" fxFlex="33.33%" *ngFor="let officer of pdExcutiveList; ">
<!-- <p><mat-radio-button [value]="officer" (change)="selectPdOfficer(officer)"></mat-radio-button>
{{officer.first_name}}
</p>
@ -41,7 +41,7 @@
</div>
</div>
</div>
<mat-list *ngIf="pdOfficerList.length == 0">
<mat-list *ngIf="pdExcutiveList.length == 0">
<mat-list-item>
<p>No executive available.</p>
</mat-list-item>
@ -62,9 +62,9 @@
</mat-card-header>
<mat-card-content>
<div *ngIf="pdExcutiveList.length > 0" >
<div *ngIf="pdCentralOfficerList.length > 0" >
<div fxLayout="row wrap" fxFlex="100%">
<div fxLayout="row wrap" fxFlex="33.33%" *ngFor="let excutive of pdExcutiveList">
<div fxLayout="row wrap" fxFlex="33.33%" *ngFor="let excutive of pdCentralOfficerList">
<mat-card fxFlex="100%">
<mat-card-content style="text-align:center">
<mat-radio-button [value]="excutive" (change)="selectExcutiveOfficer(excutive)"></mat-radio-button>
@ -97,7 +97,7 @@
</mat-list-item>
</mat-radio-group>
</mat-list> -->
<mat-list *ngIf="pdExcutiveList.length == 0">
<mat-list *ngIf="pdCentralOfficerList.length == 0">
<mat-list-item>
<p>No central officer available.</p>
</mat-list-item>

View File

@ -14,7 +14,8 @@ export class SmartPdAllocationComponent implements OnInit {
public pageTitle: string = "Allocate To Executive";
public pageTitle2: string = "Allocate To Central Officer";
public _pdAllocationForm: FormGroup;
public pdOfficerList: any = [];
//public pdOfficerList: any = [];
public pdCentralOfficerList: any = [];
public pdExcutiveList: any = [];
errorMessage: any;
notifier : NotifierService;
@ -34,34 +35,6 @@ export class SmartPdAllocationComponent implements OnInit {
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);
}
@ -71,8 +44,8 @@ export class SmartPdAllocationComponent implements OnInit {
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);
this.pdCentralOfficerList= data.records.centralpdofficers;
this.pdExcutiveList= data.records.pdofficers.filter(item => item.fk_pd_type_id == 2);
}
}, error => this.errorMessage = <any> error);

View File

@ -0,0 +1,51 @@
<div style="height: 550px;">
<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: 1000px;">
<mat-card-header>
<mat-card-title>{{pageTitle}}</mat-card-title>
</mat-card-header>
<mat-card-content>
<!-- <form [formGroup]="_pdAllocationForm" (submit)="onSubmit()"> -->
<div *ngIf="pdCentralOfficerList.length > 0" >
<div fxLayout="row wrap" fxFlex="100%">
<div fxLayout="row wrap" fxFlex="33.33%" *ngFor="let officer of pdCentralOfficerList; ">
<mat-card fxFlex="100%">
<mat-card-content style="text-align:center">
<mat-radio-button [value]="officer" (change)="selectPdOfficer(officer)"></mat-radio-button>
<img [src]="officer.profile_url ||'https://image.ibb.co/mGjZB9/usernew.png'" alt="No Image" style="border-radius:50%;width:50%"><br>
<span>{{officer.first_name}}</span>
<br>
<span>{{officer.mobile_no}}</span><br>
<span>PD in hand - {{officer.count}}</span>
</mat-card-content>
</mat-card>
</div>
</div>
</div>
<mat-list *ngIf="pdCentralOfficerList.length == 0">
<mat-list-item>
<p>No central pd officer 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 (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

@ -0,0 +1,3 @@
.example-full-width{
width: 100%;
}

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TelePdAllocationComponent } from './tele-pd-allocation.component';
describe('TelePdAllocationComponent', () => {
let component: TelePdAllocationComponent;
let fixture: ComponentFixture<TelePdAllocationComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TelePdAllocationComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TelePdAllocationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,84 @@
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-tele-pd-allocation',
templateUrl: './tele-pd-allocation.component.html',
styleUrls: ['./tele-pd-allocation.component.scss']
})
export class TelePdAllocationComponent implements OnInit {
public pageTitle: string = "Allocate To Central Officer";
public _pdAllocationForm: FormGroup;
public pdCentralOfficerList: any = [];
errorMessage: any;
notifier : NotifierService;
selectedItem:any;
isDisabled: boolean;
constructor( notifier: NotifierService,
private _fb: FormBuilder,
private dialogRef: MatDialogRef<TelePdAllocationComponent>,
private _pd: PdTrigerService,
@Inject(MAT_DIALOG_DATA) public data: any) {
this.notifier=notifier;
}
ngOnInit() {
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.pdCentralOfficerList= data.records.centralpdofficers;
}
}, error => this.errorMessage = <any> error);
}
// select pd officer list
selectPdOfficer(selected:any){
this.isDisabled=false;
this.selectedItem=selected;
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
/** To update pd officer*/
updatePdOfficer(allocateDate:any) {
if(this.isDisabled){
this.notifier.notify('warning', 'Please Choose PD Officer.!');
}
else {
let updateData = {
"pd_id":this.data.pd_id,
"fk_pd_allocated_to":allocateDate.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();
});
}
}
/** For Popup Close Button */
closeAllocationComponent(): void {
this.dialogRef.close();
}
}

View File

@ -6,6 +6,7 @@ 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 { TelePdAllocationComponent } from './../tele-pd-allocation/tele-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';
@ -110,7 +111,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
}
// pd allocation to
pdAllocationTo(pdData:any) {
if(pdData.fk_pd_type != 2){
if(pdData.fk_pd_type == 1){
const dialogRef = this.dialog.open(PdAllocationComponent, {
data: pdData,
disableClose: true
@ -133,6 +134,18 @@ export class ViewPdComponent implements OnInit, OnDestroy {
this.viewPdDetails(this.viewID)
});
}
else if(pdData.fk_pd_type == 3){
const dialogRef = this.dialog.open(TelePdAllocationComponent, {
data: pdData,
disableClose: true,
});
dialogRef.afterClosed()
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
this.viewPdDetails(this.viewID)
});
}
}

View File

@ -55,6 +55,7 @@ import { AssetsInfoComponent } from './list-pd/start-pd/forms/assets-info/assets
import {AddressComponent} from "./list-pd/start-pd/forms/address/address.component";
import {FamilyDetailsComponent} from "./list-pd/start-pd/forms/family-details/family-details.component";
import {BankingDetailsComponent} from "./list-pd/start-pd/forms/banking-details/banking-details.component";
import { TelePdAllocationComponent } from './list-pd/tele-pd-allocation/tele-pd-allocation.component';
/**
* Custom angular notifier options
@ -128,7 +129,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
// AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule,
// OwlNativeDateTimeModule,
// ],
declarations: [BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent],
declarations: [BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, TelePdAllocationComponent],
// exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent],
// providers: [PdTrigerService, GetGeometricLocationService],
// entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent],
@ -160,7 +161,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
// declarations: [ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, AssetsInfoComponent],
exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent],
providers: [PdTrigerService, GetGeometricLocationService],
entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent]
entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent]
})
export class ManagePdModule {
}