fixed worklist flow

master
umasoodch 6 years ago
parent 717323b9ed
commit 68357f35b2

@ -67,19 +67,19 @@
<ion-row class="rowBorder">
<ion-col [size]="6" class="colBorder">
<ion-label class="shift-title"> {{ts.trPK('attendance-tracking','check-in')}}</ion-label>
<ion-label class="shift-text shift-title">08:00</ion-label>
<ion-label class="shift-text shift-title">{{attendanceTrackingList.P_SWIPE_IN | slice:0:-3}}</ion-label>
</ion-col>
<ion-col [size]="6" class="colBorder">
<ion-col [size]="6" class="colBorder" style="border-right: none;">
<ion-label class="shift-title"> {{ts.trPK('attendance-tracking','check-out')}}</ion-label>
<ion-label class="shift-text shift-title">08:00 </ion-label>
<ion-label class="shift-text shift-title">{{attendanceTrackingList.P_SWIPE_OUT | slice:0:-3}}</ion-label>
</ion-col>
</ion-row>
<ion-row style="text-align: center">
<ion-col [size]="6" class="colBorder">
<ion-label class="shift-title"> {{ts.trPK('attendance-tracking','late-in')}}</ion-label>
<ion-label class="shift-text shift-title">08:00 </ion-label>
<ion-label class="shift-text shift-title">{{attendanceTrackingList.P_LATE_IN_HOURS | slice:0:-3}}</ion-label>
</ion-col>
<ion-col [size]="6" class="colBorder">
<ion-col [size]="6" class="colBorder" style="border-right: none;">
<ion-label class="shift-title"> {{ts.trPK('attendance-tracking','regular')}}</ion-label>
<ion-label class="shift-text shift-title">{{attendanceTrackingList.P_SCHEDULED_HOURS | slice:0:-3}} </ion-label>
</ion-col>

@ -1,5 +1,5 @@
<div class="main-container" [ngStyle]="active === true ? {'background': color} : {}">
<div class="main-container-radius" [ngStyle]="active === true ? {'background-color': '#ffffff'} : {'background-color': color}"></div>
<span class="number-span" [ngStyle]="active === true ? {'color': '#ffffff'} : {}">{{value}}</span>
<span *ngIf="text != 'All'" class="number-span" [ngStyle]="active === true ? {'color': '#ffffff'} : {}">{{value}}</span>
<span class="text-span" [ngStyle]="active === true ? {'color': '#ffffff'} : {}">{{text}}</span>
</div>

@ -14,11 +14,16 @@
<div class="request-heading">
<span>Open Request Analysis</span>
</div>
<div class="result-text-container">
<h2>{{totalRequestCount}}</h2>
<div class="result-text-container" [ngStyle]="showChart === false ? {'visibility': 'hidden'} : {}">
<span *ngIf="selectedFilter === 'ALL'">{{newWorkListResponse.length + ITGCount}} of </span>
<span *ngIf="showSearchButton && newWorkListResponse.length > 0 && selectedFilter !== 'ALL' && itemType !== ''">{{newWorkListResponse.length}} of </span>
<h2 *ngIf="!showSearchButton">{{totalRequestCount}}</h2>
<h2 *ngIf="showSearchButton && newWorkListResponse.length > 0 && itemType === ''">{{newWorkListResponse[0].NO_OF_ROWS + ITGCount}}</h2>
<h2 *ngIf="showSearchButton && newWorkListResponse.length > 0 && selectedFilter !== 'ALL' && itemType !== ''">{{newWorkListResponse[0].NO_OF_ROWS}}</h2>
<span>TOTAL <br> OPEN REQUEST</span>
</div>
<p-chart class="today-graph" type="doughnut" [data]="data" [options]="options"></p-chart>
<p-chart *ngIf="!showChart" class="today-graph" type="doughnut" [data]="data" [options]="options"></p-chart>
<p-chart *ngIf="showChart" class="today-graph" type="doughnut" [data]="data" [options]="options"></p-chart>
</div>
<ion-row class="filters-row">
@ -61,32 +66,35 @@
</ion-col>
</ion-row>
<div [ngClass]="isEmptyObject() ? 'work-list-container' : ''" *ngIf='selectedFilter != "ITG"'>
<div *ngFor="let data of showFormattedData | keyvalue; let i = index">
<span class="date-span">{{data.key}}</span>
<div (click)="openNotificationDetail(data.value)" class="date-data" *ngFor="let workList of data.value; let j = index">
<div style="position: relative;">
<div [ngClass]="showFormattedData.length > 0 ? 'work-list-container' : ''" *ngIf='selectedFilter != "ITG"'>
<div *ngFor="let formattedData of showFormattedData; let i = index">
<span class="date-span">{{formattedData.date}}</span>
<div (click)="openNotificationDetail(data.value)" class="date-data" *ngFor="let workList of formattedData.data; let j = index">
<p>{{workList.SUBJECT}}</p>
</div>
</div>
</div>
</div>
<div [ngClass]="isEmptyObject() ? 'work-list-container' : ''" *ngIf="selectedFilter == 'ITG'" >
<div *ngFor='let segmentInfo of ITGItem[0]; let i= index' (click)='openITG(segmentInfo)'>
<span class="date-span">{{segmentInfo.ModifiedDate |date}}</span>
<div class="date-data">
<p>{{segmentInfo.Title}}</p>
<div [ngClass]="showFormattedData.length > 0 ? 'work-list-container' : ''" *ngIf="selectedFilter == 'ITG'" >
<div *ngFor='let segmentInfo of ITGItem[0]; let i= index' (click)='openITG(segmentInfo)'>
<span class="date-span">{{segmentInfo.ModifiedDate |date}}</span>
<div class="date-data">
<p>{{segmentInfo.Title}}</p>
</div>
</div>
</div>
</div>
<div class="no-data-available" *ngIf="showFormattedData.length === 0">
<span>No Data Available</span>
</div>
</div>
<div class="no-data-available" *ngIf="!isEmptyObject()">
<span>No Data Available</span>
</div>
</div>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll (ionInfinite)="doInfinite($event)" *ngIf="selectedFilter === 'ALL' || itemType !== ''">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>

@ -333,6 +333,8 @@ ion-content {
margin-top: 15px;
display: block;
padding: 0 20px;
position: relative;
z-index: 99;
ion-col{
background: white;
border-radius: 12px;
@ -382,9 +384,8 @@ ion-content {
font-family: WorkSans-Regular;
padding: 30px;
position: absolute;
left: 50%;
margin-left: -100px;
margin-top: 100px;
left: 85px;
top: 50px;
}
.disable-filter {
pointer-events: none;

@ -58,10 +58,18 @@ export class HomeComponent implements OnInit {
public worklistNotifications: any;
public totalRequestCount = 0;
public newWorkListResponse = [];
public showFormattedData = {};
public showFormattedData = [];
public allFormattedData = [];
public selectedFilter = 'ALL';
public showSearchButton = false;
public itemType = '';
public totalHR = 0;
public totalPO = 0;
public totalPR = 0;
public totalMR = 0;
public showChart = false;
public options = {
cutoutPercentage: 80,
tooltips: { enabled: false },
@ -153,11 +161,9 @@ export class HomeComponent implements OnInit {
}
ngOnInit() {
// this.direction = TranslatorService.getCurrentDirection();
this.worklistNotifications = this.common.sharedService.getSharedData('worklistNotifications', false);
this.Details();
this.Count();
this.assignDataToFilters();
this.getAllPushNotificationFun();
this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER;
}
@ -165,42 +171,38 @@ export class HomeComponent implements OnInit {
assignDataToFilters() {
this.filters[0].value = this.worklistNotifications.P_OPEN_NTF_NUMBER;
const openNotificationsArray = this.worklistNotifications.GetOpenNotificationsList;
for (const notification of openNotificationsArray) {
if (notification.ITEM_TYPE === 'HRSSA') {
this.filters[1].value = notification.OPEN_NTF_NUMBER;
this.filters[1].value = this.totalHR;
this.data.datasets[0].data[0] = notification.OPEN_NTF_NUMBER;
} else if (notification.ITEM_TYPE === 'POAPPRV') {
this.filters[2].value = notification.OPEN_NTF_NUMBER;
this.filters[2].value = this.totalPO;
this.data.datasets[0].data[1] = notification.OPEN_NTF_NUMBER;
} else if (notification.ITEM_TYPE === 'REQAPPRV') {
this.filters[3].value = notification.OPEN_NTF_NUMBER;
this.filters[3].value = this.totalPR;
this.data.datasets[0].data[2] = notification.OPEN_NTF_NUMBER;
} else if (notification.ITEM_TYPE === 'INVMOA') {
this.filters[4].value = notification.OPEN_NTF_NUMBER;
this.filters[4].value = this.totalMR;
this.data.datasets[0].data[3] = notification.OPEN_NTF_NUMBER;
} else if (notification.ITEM_TYPE === 'ITG') {
this.filters[5].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[4] = notification.OPEN_NTF_NUMBER;
}
}
}
this.showChart = true;
}
activeFilter(index: number) {
if (this.currentActiveIndex !== index) {
this.showFormattedData = {};
this.previousActiveIndex = this.currentActiveIndex;
this.currentActiveIndex = index;
this.filters[this.previousActiveIndex].active = false;
this.filters[this.currentActiveIndex].active = true;
if (this.filters[this.currentActiveIndex].value !== 0) {
const selectedKey = this.filters[this.currentActiveIndex].key;
this.resetData();
this.itemType = (selectedKey !== 'ITG' && selectedKey !== 'ALL') ? this.filters[this.currentActiveIndex].key : '';
this.getAllPushNotificationFun();
}
this.selectedFilter = this.filters[this.currentActiveIndex].key;
if (this.selectedFilter !== 'ITG') {
this.getFilteredData(this.selectedFilter);
}
}
}
@ -230,13 +232,13 @@ export class HomeComponent implements OnInit {
async openSearchModal() {
const modal = await this.modalController.create({
component: WorklistAdvancedSearchComponent,
cssClass: 'advanced-search-modal',
cssClass: 'advanced-search-modal-custom',
backdropDismiss: false,
componentProps: {}
});
modal.onDidDismiss().then(result => {
if (result.data) {
if (result.data.notificationType !== '' || result.data.selectedValue !== '' || result.data.itemType !== '') {
if (result.data.notificationType !== '' || result.data.selectedValue !== '' || result.data.itemType !== '') {
this.showSearchButton = true;
this.itemType = result.data.itemType;
this.notificationType = result.data.notificationType;
@ -245,7 +247,7 @@ export class HomeComponent implements OnInit {
this.inputSearch = result.data.inputSearch;
this.WorkListObj.P_PAGE_NUM = 1;
this.newWorkListResponse = [];
this.showFormattedData = {};
this.showFormattedData = [];
this.selectedFilter = 'ALL';
this.filters[this.currentActiveIndex].active = false;
this.currentActiveIndex = 0;
@ -268,7 +270,7 @@ export class HomeComponent implements OnInit {
this.WorkListObj.P_SEARCH_SUBJECT = this.selectedValue === '2' ? this.inputSearch : '';
this.WorkListObj.P_SEARCH_SENT_DATE = (this.inputDate && this.selectedValue === '3')
? moment(this.inputDate).format('DD-MMM-YYYY') : '';
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = this.selectedValue === '4' ? this.inputSearch : ''; ;
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = this.selectedValue === '4' ? this.inputSearch : '';
this.WorkListObj.P_ITEM_TYPE = this.itemType !== '' ? this.itemType : '';
this.WorkListObj.P_NOTIFICATION_TYPE = this.notificationType !== '' ? this.notificationType : '1';
if (this.selectedValue === '5') {
@ -277,7 +279,6 @@ export class HomeComponent implements OnInit {
this.WorkListObj.P_SEARCH_SENT_DATE = '';
this.WorkListObj.P_SEARCH_SUBJECT = '';
}
this.WorklistService.getWorkList(this.WorkListObj).subscribe((result) => {
if (this.common.validResponse(result)) {
this.handleWorkListResult(result.GetWorkList);
@ -286,24 +287,82 @@ export class HomeComponent implements OnInit {
);
}
categorizeData(arrayToCategorize: any) {
const datePipe = new DatePipe('en-US');
const formattedData = {};
for (const workList of arrayToCategorize) {
workList.FORMATTED_DATE = datePipe.transform(new Date(workList.BEGIN_DATE), 'MMMM dd, y');
if (!(workList.FORMATTED_DATE in formattedData)) {
formattedData[workList.FORMATTED_DATE] = new Array();
formattedData[workList.FORMATTED_DATE].push(workList);
} else {
formattedData[workList.FORMATTED_DATE].push(workList);
getFilteredData(filter: string) {
if (filter === 'ALL') {
this.showFormattedData = this.allFormattedData;
} else {
let arrayToFilter;
arrayToFilter = this.newWorkListResponse.filter((workList) => {
return workList.ITEM_TYPE === filter;
});
this.showFormattedData = this.categorizeData(arrayToFilter);
}
}
checkDateExistance(currentDate: any, formattedData: any) {
let existsBefore = false;
let index = 0;
for (let i = 0; i < formattedData.length; i++) {
if (formattedData[i].date === currentDate) {
existsBefore = true;
index = i;
break;
}
}
return {
exists: existsBefore,
indexNumber: index
};
}
addCountInFilters(workList: any) {
if (workList.ITEM_TYPE === 'HRSSA') {
this.totalHR = this.totalHR + 1;
} else if (workList.ITEM_TYPE === 'POAPPRV') {
this.totalPO = this.totalPO + 1;
} else if (workList.ITEM_TYPE === 'REQAPPRV') {
this.totalPR = this.totalPR + 1;
} else if (workList.ITEM_TYPE === 'INVMOA') {
this.totalMR = this.totalMR + 1;
}
}
categorizeData(arrayToCategorize: any) {
this.totalHR = 0;
this.totalPO = 0;
this.totalPR = 0;
this.totalMR = 0;
const datePipe = new DatePipe('en-US');
const formattedData = [];
for (const workList of arrayToCategorize) {
this.addCountInFilters(workList);
const currentDate = datePipe.transform(new Date(workList.BEGIN_DATE), 'MMMM dd, y');
const currentObject = {
date: '',
data: []
};
if (formattedData.length === 0) {
currentObject.date = currentDate;
currentObject.data.push(workList);
formattedData.push(currentObject);
} else {
const existsBefore = this.checkDateExistance(currentDate, formattedData);
if (existsBefore.exists) {
formattedData[existsBefore.indexNumber].data.push(workList);
} else {
currentObject.date = currentDate;
currentObject.data.push(workList);
formattedData.push(currentObject);
}
}
}
return formattedData;
return formattedData;
}
sortArray(arrayToSort: any) {
return arrayToSort.sort((a: any, b: any) =>
new Date(b.BEGIN_DATE).getTime() - new Date(a.BEGIN_DATE).getTime()
new Date(b.date).getTime() - new Date(a.date).getTime()
);
}
@ -330,9 +389,10 @@ export class HomeComponent implements OnInit {
} else {
this.newWorkListResponse = this.newWorkListResponse.concat(result);
}
this.newWorkListResponse = this.sortArray(this.newWorkListResponse);
console.log(this.newWorkListResponse);
this.showFormattedData = this.categorizeData(this.newWorkListResponse);
const categorizedWorkListResponse = this.categorizeData(this.newWorkListResponse);
this.assignDataToFilters();
this.showFormattedData = this.sortArray(categorizedWorkListResponse);
this.allFormattedData = this.showFormattedData;
this.common.sharedService.setSharedData(this.newWorkListResponse, HomeComponent.NOTIFICATION_ARR);
} else {
this.newWorkListResponse = [];
@ -352,10 +412,6 @@ export class HomeComponent implements OnInit {
}
}
isEmptyObject() {
return (this.showFormattedData && (Object.keys(this.showFormattedData).length > 0) || this.ITGItem.length > 0);
}
resetData() {
if (this.infiniteScroll) {
this.infiniteScroll.complete();
@ -366,7 +422,8 @@ export class HomeComponent implements OnInit {
this.inputDate = '';
this.inputSearch = '';
this.newWorkListResponse = [];
this.showFormattedData = {};
this.showFormattedData = [];
this.allFormattedData = [];
this.WorkListObj.P_SEARCH_FROM_USER = '';
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
this.WorkListObj.P_SEARCH_SENT_DATE = '';
@ -413,13 +470,13 @@ export class HomeComponent implements OnInit {
Details() {
this.workListService.getITGDetails()
.subscribe((result: any) => {
this.ITGCount = result.TotalCount;
this.totalRequestCount = this.totalRequestCount + result.TotalCount;
this.filters[5].value = result.TotalCount;
});
}
ITGNotification() {
// this.Details();
this.isAll = false;
this.isPR = false;
this.isPO = false;

@ -1191,7 +1191,7 @@ border:0px
// }
.advanced-search-modal {
--height: 9cm !important;
--height: 12cm !important;
--width: 88% !important;
--border-radius: 0.6cm;
}
@ -1277,8 +1277,8 @@ border:0px
}
.advanced-search-modal {
--height: 12cm !important;
.advanced-search-modal-custom {
--height: 9cm !important;
--width: 80% !important;
--border-radius: 0.4cm;
}

Loading…
Cancel
Save