add total count from mohemm page to show it in worklist home page

enad-pre-live
enadhilal 4 years ago
parent 5609d85853
commit 8587ba279f

@ -1569,4 +1569,120 @@ export class CommonService {
return this.activeType; return this.activeType;
} }
public totalCounter = 0;
getTotalNumberOfWorklistRequest() {
this.totalCounter = parseInt(this.sharedService.getSharedData('total-count'));
return this.totalCounter;
}
setTotalNumberOfWorklistRequest() {
this.totalCounter -= 1;
this.sharedService.setSharedData(this.totalCounter, 'total-count');
}
public filters = [
{
value: 0,
name: 'HR',
active: false,
color: '#18a169',
key: 'HRSSA',
disable: false
},
{
value: 0,
name: 'MR',
active: false,
color: '#3cb9d5',
key: 'INVMOA',
disable: false
},
{
value: 0,
name: 'PR',
active: false,
color: '#114475',
key: 'REQAPPRV',
disable: false
},
{
value: 0,
name: 'PO',
active: false,
color: '#38c9b3',
key: 'POAPPRV',
disable: false
},
{
value: 0,
name: 'ITG',
active: false,
color: '#cc3232',
key: 'ITG',
disable: false
},
{
value: 0,
name: 'IC',
active: false,
color: '#9e7e97',
key: 'INVITEM',
disable: false
},
{
value: 0,
name: 'STAMP',
active: false,
color: '#ff9800',
key: 'STAMP',
disable: false
}
];
public data = {
datasets: [
{
data: [0, 0, 0, 0, 0, 0, 0],
backgroundColor: [
'#18a169',
'#3cb9d5',
'#114475',
'#38c9b3',
'#cc3232',
'#9e7e97',
'#ff9800'
],
borderWidth: 6
}]
};
assignDataToFilters(result) {
const openNotificationsArray = result;
for (const notification of openNotificationsArray) {
if (notification.ITEM_TYPE === 'HRSSA') {
this.filters[0].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[0] = notification.OPEN_NTF_NUMBER;
} else if (notification.ITEM_TYPE === 'INVMOA') {
this.filters[1].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[1] = notification.OPEN_NTF_NUMBER;
} else if (notification.ITEM_TYPE === 'REQAPPRV') {
this.filters[2].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[2] = notification.OPEN_NTF_NUMBER;
} else if (notification.ITEM_TYPE === 'POAPPRV') {
this.filters[3].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[3] = notification.OPEN_NTF_NUMBER;
} else if (notification.ITEM_TYPE === 'INVITEM') {
this.filters[5].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[5] = notification.OPEN_NTF_NUMBER;
} else if (notification.ITEM_TYPE === 'STAMP') {
this.filters[6].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[6] = notification.OPEN_NTF_NUMBER;
}
}
let val = {'filters': [], 'data': {}};
val.filters = this.filters;
val.data = this.data;
return val;
}
} }

@ -773,6 +773,7 @@ export class HomePage implements OnInit {
this.showAttendanceOptions(); this.showAttendanceOptions();
// tslint:disable-next-line: triple-equals // tslint:disable-next-line: triple-equals
} else if (link == '1') { } else if (link == '1') {
this.common.sharedService.setSharedData(this.statsButtons[1].statsValue, 'total-count');
this.common.startLoading(); this.common.startLoading();
this.common.openNotificationPage(); this.common.openNotificationPage();
// tslint:disable-next-line: triple-equals // tslint:disable-next-line: triple-equals

@ -11,15 +11,15 @@
<div class="request-heading"> <div class="request-heading">
<span>{{ts.trPK('work-list','open-analysis')}}</span> <span>{{ts.trPK('work-list','open-analysis')}}</span>
</div> </div>
<div class="result-text-container" [ngStyle]="showChart === false || receivedITGCount === false ? {'visibility': 'hidden'} : {}"> <div class="result-text-container" >
<h2>{{totalRequestCount}}</h2> <h2>{{totalRequestCount}}</h2>
<!-- <h2 *ngIf="showSearchButton && newWorkListResponse.length > 0 && itemType === ''">{{newWorkListResponse[0].NO_OF_ROWS + ITGCount}}</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> --> <!-- <h2 *ngIf="showSearchButton && newWorkListResponse.length > 0 && selectedFilter !== 'ALL' && itemType !== ''">{{newWorkListResponse[0].NO_OF_ROWS}}</h2> -->
<span>{{ts.trPK('work-list','total')}} <br> {{ts.trPK('work-list','open-reqest')}}</span> <span>{{ts.trPK('work-list','total')}} <br> {{ts.trPK('work-list','open-reqest')}}</span>
</div> </div>
<div *ngIf="!showChart || !receivedITGCount" class="spinner-custom-class"> <!-- <div *ngIf="!showChart || !receivedITGCount" class="spinner-custom-class">
<ion-spinner class="spinner" name="lines"></ion-spinner> <ion-spinner class="spinner" name="lines"></ion-spinner>
</div> </div> -->
<p-chart *ngIf="!showChart || !receivedITGCount" class="today-graph" type="doughnut" [data]="data" [options]="options"></p-chart> <p-chart *ngIf="!showChart || !receivedITGCount" class="today-graph" type="doughnut" [data]="data" [options]="options"></p-chart>
<p-chart *ngIf="showChart && receivedITGCount" class="today-graph" type="doughnut" [data]="data" [options]="options"></p-chart> <p-chart *ngIf="showChart && receivedITGCount" class="today-graph" type="doughnut" [data]="data" [options]="options"></p-chart>
</div> </div>

@ -86,22 +86,23 @@ export class HomeComponent implements OnInit {
tooltips: { enabled: false }, tooltips: { enabled: false },
legend: { display: false } legend: { display: false }
}; };
public data = { // public data = {
datasets: [ // datasets: [
{ // {
data: [0, 0, 0, 0, 0, 0, 0], // data: [0, 0, 0, 0, 0, 0, 0],
backgroundColor: [ // backgroundColor: [
'#18a169', // '#18a169',
'#3cb9d5', // '#3cb9d5',
'#114475', // '#114475',
'#38c9b3', // '#38c9b3',
'#cc3232', // '#cc3232',
'#9e7e97', // '#9e7e97',
'#ff9800' // '#ff9800'
], // ],
borderWidth: 6 // borderWidth: 6
}] // }]
}; // };
public data: any;
public filters = [ public filters = [
{ {
value: 0, value: 0,
@ -197,6 +198,13 @@ export class HomeComponent implements OnInit {
ionViewWillEnter() { ionViewWillEnter() {
this.totalRequestCount = this.common.getTotalNumberOfWorklistRequest();
const values = this.common.assignDataToFilters(this.common.sharedService.getSharedData('worklistNotifications', false));
this.data = values.data;
this.filters = values.filters;
console.log(this.filters);
console.log(this.data);
console.log(this.totalRequestCount);
const loadWorkList = this.common.sharedService.getSharedData('loadWorkList', false); const loadWorkList = this.common.sharedService.getSharedData('loadWorkList', false);
if (loadWorkList) { if (loadWorkList) {
this.receivedITGCount = false; this.receivedITGCount = false;

@ -560,6 +560,7 @@ export class WorklistMainComponent implements OnInit {
// } // }
// this.messageSuccess = true; // this.messageSuccess = true;
this.common.greenToastPK('worklist', 'done-successfully'); this.common.greenToastPK('worklist', 'done-successfully');
this.common.setTotalNumberOfWorklistRequest();
setTimeout(() => { setTimeout(() => {
// this.messageSuccess = false; // this.messageSuccess = false;
// this.openNotificationsDashboard(); // this.openNotificationsDashboard();
@ -1143,6 +1144,7 @@ export class WorklistMainComponent implements OnInit {
} else if (data.data.data == "Success") { } else if (data.data.data == "Success") {
// this.messageSuccess = true; // this.messageSuccess = true;
this.common.greenToastPK('worklist', 'done-successfully'); this.common.greenToastPK('worklist', 'done-successfully');
this.common.setTotalNumberOfWorklistRequest();
setTimeout(() => { setTimeout(() => {
// this.messageSuccess = false; // this.messageSuccess = false;
this.nextNotfification(); this.nextNotfification();

Loading…
Cancel
Save