smar and tele pd view more officres list change

This commit is contained in:
gandhimathi 2018-11-28 13:45:04 +05:30
parent 88288bd815
commit f339d46ebe
9 changed files with 258 additions and 198 deletions

View File

@ -47,7 +47,7 @@
<mat-dialog-actions >
<div fxFlex="50" align="left">
<p *ngIf="selectedItem">Currently Selected: {{selectedItem.first_name}}</p>
<p *ngIf="selectedItem">PD Officer: {{selectedItem.first_name}}</p>
</div>
<div fxFlex="50" align="right">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="closeAllocationComponent()" matTooltip="Close" matTooltipPosition="below"><mat-icon>close</mat-icon></button>

View File

@ -1,121 +1,102 @@
<div style="max-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; 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()"> -->
<div *ngIf="pdCentralOfficerList.length > 0" >
<div fxLayout="row wrap" fxFlex="100%">
<div fxLayout="row wrap" fxFlex="22%" *ngFor="let officer of pdCentralOfficerList; ">
<!-- <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-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:100px;height:100px;"><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 executive available.</p>
</mat-list-item>
</mat-list>
<h2 mat-dialog-title>
<div fxFlex="70">
{{pageTitle}}
</div>
<div fxFlex="30" align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="closeAllocationComponent()" matTooltip="Close" matTooltipPosition="below"><mat-icon>close</mat-icon></button>
<!-- </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>
</h2>
<mat-dialog-content class="mat-typography">
<!-- <form [formGroup]="_pdAllocationForm" (submit)="onSubmit()"> -->
<!-- This Container for central pd officer -->
<div *ngIf="showFirstCard">
<mat-list role="list" *ngIf="pdCentralOfficerList.length > 0">
<mat-list-item role="listitem" *ngFor="let officer of pdCentralOfficerList; let i = index">
<div fxFlex="100">
<div fxLayout="row wrap">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="30" fxFlex.lg="30" fxFlex.xl="30">
<mat-radio-button color="primary" [checked]="checkFirstItem==officer.fk_user_id" [value]="officer" (change)="selectedCentralItem = $event.value">
{{officer.first_name}}
</mat-radio-button>
</div>
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="30" fxFlex.lg="30" fxFlex.xl="30">
<span>{{officer.mobile_no}}</span>
</div>
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="40" fxFlex.lg="40" fxFlex.xl="40">
<span class="view_more" (click)="viewMoreDetails(officer)" matTooltip="View More" matTooltipPosition="right">PD in hand - {{officer.count}}</span>
</div>
</div>
</div>
</mat-list-item>
</mat-list>
<mat-list *ngIf="pdCentralOfficerList.length == 0">
<mat-list-item>
<p>No central officer available.</p>
</mat-list-item>
</mat-list>
</div>
<!-- end -->
<!-- this container for executive pd officer -->
<div *ngIf="showSecondCard">
<mat-list role="list" *ngIf="pdExcutiveList.length > 0">
<mat-list-item role="listitem" *ngFor="let excutive of pdExcutiveList; let e = index">
<div fxFlex="100">
<div fxLayout="row wrap">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="30" fxFlex.lg="30" fxFlex.xl="30">
<mat-radio-button color="primary" [checked]="checkSecondItem==excutive.fk_user_id" [value]="excutive" (change)="selectedExcutiveItem = $event.value">
{{excutive.first_name}}
</mat-radio-button>
</div>
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="30" fxFlex.lg="30" fxFlex.xl="30">
<span>{{excutive.mobile_no}}</span>
</div>
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="40" fxFlex.lg="40" fxFlex.xl="40">
<span class="view_more" (click)="viewMoreDetails(excutive)" matTooltip="View More" matTooltipPosition="right">PD in hand - {{excutive.count}}</span>
</div>
</div>
</div>
</mat-list-item>
</mat-list>
<mat-list *ngIf="pdExcutiveList.length == 0">
<mat-list-item>
<p>No executive available.</p>
</mat-list-item>
</mat-list>
</div>
<!-- end -->
</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>
<div *ngIf="pdExcutiveList.length > 0" >
<div fxLayout="row wrap" fxFlex="100%">
<div fxLayout="row wrap" fxFlex="22%" *ngFor="let excutive of pdExcutiveList">
<mat-card fxFlex="100%">
<mat-card-content style="text-align:center">
<mat-radio-button [value]="excutive" (change)="selectExcutiveOfficer(excutive)"></mat-radio-button>
<img [src]="excutive.profile_url ||'https://image.ibb.co/mGjZB9/usernew.png'" alt="No Image" style="border-radius:50%;width:100px;height:100px;"><br>
<span>{{excutive.first_name}}</span>
<br>
<span>{{excutive.mobile_no}}</span> <br>
<span>PD in hand - {{excutive.count}}</span>
</mat-card-content>
</mat-card>
</div>
</div>
</div>
<!----<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>No central 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 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>
<!-- </form> -->
</mat-dialog-content>
<mat-dialog-actions >
<div fxFlex="50" align="left">
<p *ngIf="selectedCentralItem">Central Officer: {{selectedCentralItem.first_name}}</p>
<p *ngIf="selectedExcutiveItem">Executive: {{selectedExcutiveItem.first_name}}</p>
</div>
<div fxFlex="50" align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="getSecondCard()" matTooltip="Next" matTooltipPosition="below" *ngIf="showFirstCard"><mat-icon>arrow_forward</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="getFirstCard()" *ngIf="showSecondCard" matTooltip="Back" matTooltipPosition="below"><mat-icon>arrow_back</mat-icon></button>
<button mat-raised-button mat-icon-button (click)="updateAllocation(selectedCentralItem,selectedExcutiveItem)" class="mr-1 mb-1 hover-icon" type="button" matTooltip="Allocate" matTooltipPosition="below" *ngIf="showSecondCard"><mat-icon>save</mat-icon></button>
</div>
</mat-dialog-actions>
<notifier-container></notifier-container>

View File

@ -0,0 +1,14 @@
.example-full-width{
width: 100%;
}
.view_more {
cursor: pointer;
color: #e00201 !important;
// text-decoration-line: underline;
// text-decoration-style: dotted;
// font-weight: bold;
}
.text_change {
color: #e00201 !important;
}

View File

@ -1,8 +1,9 @@
import { Component, OnInit, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { MatDialog, 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 { AllocationViewMoreComponent } from './../allocation-view-more/allocation-view-more.component';
@Component({
selector: 'app-smart-pd-allocation',
@ -11,22 +12,22 @@ import { PdTrigerService } from '../../../pd-service/pd-triger.service';
})
export class SmartPdAllocationComponent implements OnInit {
public pageTitle2: string = "Allocate To Executive";
public pageTitle: string = "Allocate To Central Officer";
public _pdAllocationForm: FormGroup;
//public pdOfficerList: any = [];
public pdCentralOfficerList: any = [];
public pdExcutiveList: any = [];
errorMessage: any;
notifier : NotifierService;
selectedItem:any=[];
selectedItem1:any=[];
isDisabled: boolean;
// isDisabled: boolean;
showFirstCard: boolean;
showSecondCard: boolean;
selectedCentralItem: any;
selectedExcutiveItem: any;
checkFirstItem:string ='';
checkSecondItem:string ='';
constructor( notifier: NotifierService,
private _fb: FormBuilder,
private _fb: FormBuilder, private dialog: MatDialog,
private dialogRef: MatDialogRef<SmartPdAllocationComponent>,
private _pd: PdTrigerService,
@Inject(MAT_DIALOG_DATA) public data: any) {
@ -35,7 +36,7 @@ export class SmartPdAllocationComponent implements OnInit {
ngOnInit() {
this.showFirstCard=true;
this.isDisabled=true;
// this.isDisabled=true;
this.getPDOfficerList(this.data.pd_id);
}
@ -50,27 +51,19 @@ export class SmartPdAllocationComponent implements OnInit {
}, 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.!');
updateAllocation(centralOfficer:any,excutiveOfficer:any) {
if(!centralOfficer){
this.notifier.notify('warning', 'Please Choose Central Officer.!');
}
else if(!excutiveOfficer){
this.notifier.notify('warning', 'Please Choose Executive.!');
}
else {
let updateData = {
"pd_id":this.data.pd_id,
"central_pd_officer_id":pdOfficer.fk_user_id,
"central_pd_officer_id":centralOfficer.fk_user_id,
"executive_id":excutiveOfficer.fk_user_id,
}
this._pd.updatePdOfficer(updateData).subscribe(
@ -93,12 +86,16 @@ export class SmartPdAllocationComponent implements OnInit {
getFirstCard() {
this.showSecondCard=false;
this.showFirstCard=true;
this.pageTitle = "Allocate To Central Officer";
this.checkFirstItem = this.selectedCentralItem ? this.selectedCentralItem.fk_user_id : '';
}
getSecondCard(){
this.showFirstCard=false;
this.showSecondCard=true;
this.pageTitle = "Allocate To Executive";
this.checkSecondItem = this.selectedExcutiveItem ? this.selectedExcutiveItem.fk_user_id : '';
}
/** For Popup Close Button */
@ -106,4 +103,24 @@ export class SmartPdAllocationComponent implements OnInit {
this.dialogRef.close();
}
// officer view more
viewMoreDetails(details:any){
if(Number(details.count) > 0) {
const dialogSchedule = this.dialog.open(AllocationViewMoreComponent, {
data: details,
disableClose: true,
position: { right: '0'},
// hasBackdrop:false
});
// dialogSchedule.afterClosed()
// .subscribe(dataresult => {
// });
}
else {
this.notifier.notify('warning', 'No PD In Hand');
}
}
}

View File

@ -1,50 +1,66 @@
<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="22%" *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:100px;height:100px;"><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>
<h2 mat-dialog-title>
<div fxFlex="70">
{{pageTitle}}
</div>
</mat-card-actions>
</mat-card>
</div>
<notifier-container></notifier-container>
<div fxFlex="30" align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="closeAllocationComponent()" matTooltip="Close" matTooltipPosition="below"><mat-icon>close</mat-icon></button>
</div>
</h2>
<mat-dialog-content class="mat-typography">
<!-- <form [formGroup]="_pdAllocationForm" (submit)="onSubmit()"> -->
<mat-list role="list" *ngIf="pdCentralOfficerList.length > 0">
<mat-list-item role="listitem" *ngFor="let officer of pdCentralOfficerList; let i = index">
<div fxFlex="100">
<div fxLayout="row wrap">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="30" fxFlex.lg="30" fxFlex.xl="30">
<mat-radio-button color="primary" [value]="officer" (change)="selectedItem = $event.value">
{{officer.first_name}}
</mat-radio-button>
</div>
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="30" fxFlex.lg="30" fxFlex.xl="30">
<span>{{officer.mobile_no}}</span>
</div>
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="40" fxFlex.lg="40" fxFlex.xl="40">
<span class="view_more" (click)="viewMoreDetails(officer)" matTooltip="View More" matTooltipPosition="right">PD in hand - {{officer.count}}</span>
</div>
</div>
</div>
</mat-list-item>
</mat-list>
<mat-list *ngIf="pdCentralOfficerList.length == 0">
<mat-list-item>
<p>No central officer available.</p>
</mat-list-item>
</mat-list>
<!-- </form> -->
</mat-dialog-content>
<mat-dialog-actions >
<div fxFlex="50" align="left">
<p *ngIf="selectedItem">Central Officer: {{selectedItem.first_name}}</p>
</div>
<div fxFlex="50" align="right">
<button mat-raised-button mat-icon-button (click)="updatePdOfficer(selectedItem)" class="mr-1 mb-1 hover-icon" type="button" matTooltip="Allocate" matTooltipPosition="below"><mat-icon>save</mat-icon></button>
</div>
</mat-dialog-actions>
<notifier-container></notifier-container>

View File

@ -1,3 +1,14 @@
.example-full-width{
width: 100%;
}
.view_more {
cursor: pointer;
color: #e00201 !important;
// text-decoration-line: underline;
// text-decoration-style: dotted;
// font-weight: bold;
}
.text_change {
color: #e00201 !important;
}

View File

@ -1,8 +1,9 @@
import { Component, OnInit, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { MatDialog, 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 { AllocationViewMoreComponent } from './../allocation-view-more/allocation-view-more.component';
@Component({
selector: 'app-tele-pd-allocation',
@ -18,7 +19,7 @@ export class TelePdAllocationComponent implements OnInit {
selectedItem:any;
isDisabled: boolean;
constructor( notifier: NotifierService,
private _fb: FormBuilder,
private _fb: FormBuilder, private dialog: MatDialog,
private dialogRef: MatDialogRef<TelePdAllocationComponent>,
private _pd: PdTrigerService,
@Inject(MAT_DIALOG_DATA) public data: any) {
@ -42,22 +43,16 @@ export class TelePdAllocationComponent implements OnInit {
}, 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.!');
updatePdOfficer(allocateDetails:any) {
if(!allocateDetails){
this.notifier.notify('warning', 'Please Choose Central Officer.!');
}
else {
let updateData = {
"pd_id":this.data.pd_id,
"central_pd_officer_id":allocateDate.fk_user_id,
"central_pd_officer_id":allocateDetails.fk_user_id,
}
this._pd.updatePdOfficer(updateData).subscribe(
result => {
@ -80,5 +75,23 @@ export class TelePdAllocationComponent implements OnInit {
closeAllocationComponent(): void {
this.dialogRef.close();
}
// officer view more
viewMoreDetails(details:any){
if(Number(details.count) > 0) {
const dialogSchedule = this.dialog.open(AllocationViewMoreComponent, {
data: details,
disableClose: true,
position: { right: '0'},
// hasBackdrop:false
});
// dialogSchedule.afterClosed()
// .subscribe(dataresult => {
// });
}
else {
this.notifier.notify('warning', 'No PD In Hand');
}
}
}

View File

@ -127,6 +127,8 @@ export class ViewPdComponent implements OnInit, OnDestroy {
else if(pdData.fk_pd_type == 2){
const dialogRef = this.dialog.open(SmartPdAllocationComponent, {
data: pdData,
width: '60%',
maxHeight: '60%',
disableClose: true
});
dialogRef.afterClosed()
@ -139,6 +141,8 @@ export class ViewPdComponent implements OnInit, OnDestroy {
else if(pdData.fk_pd_type == 3){
const dialogRef = this.dialog.open(TelePdAllocationComponent, {
data: pdData,
width: '60%',
maxHeight: '60%',
disableClose: true,
});
dialogRef.afterClosed()

View File

@ -125,6 +125,8 @@ export class QcViewComponent implements OnInit, OnDestroy {
else if(pdData.fk_pd_type == 2){
const dialogRef = this.dialog.open(SmartPdAllocationComponent, {
data: pdData,
width: '60%',
maxHeight: '60%',
disableClose: true
});
dialogRef.afterClosed()
@ -137,6 +139,8 @@ export class QcViewComponent implements OnInit, OnDestroy {
else if(pdData.fk_pd_type == 3){
const dialogRef = this.dialog.open(TelePdAllocationComponent, {
data: pdData,
width: '60%',
maxHeight: '60%',
disableClose: true,
});
dialogRef.afterClosed()