|
|
|
|
@ -32,7 +32,7 @@ import {GetSubordinatesLeavesRequest} from '../hmg-common/services/dashbored/mod
|
|
|
|
|
import {GetOpenNotificationsResponse} from '../hmg-common/services/dashbored/models/GetOpenNotificationsResponse'
|
|
|
|
|
import {GetSubordinatesAttdStatusResponse} from '../hmg-common/services/dashbored/models/GetSubordinatesAttdStatusResponse'
|
|
|
|
|
import {GetSubordinatesLeavesResponse} from '../hmg-common/services/dashbored/models/GetSubordinatesLeavesResponse'
|
|
|
|
|
|
|
|
|
|
import { AccrualService } from '../accrual-balances/services/accrual.service';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-home',
|
|
|
|
|
@ -56,27 +56,27 @@ export class HomePage implements OnInit {
|
|
|
|
|
public statsButtons = [
|
|
|
|
|
{
|
|
|
|
|
title: 'Work List',
|
|
|
|
|
statsValue: '79',
|
|
|
|
|
statsValue: 0,
|
|
|
|
|
icon: 'assets/icon/new-design/work_list.png'
|
|
|
|
|
},
|
|
|
|
|
// {
|
|
|
|
|
// title: 'Pending Request',
|
|
|
|
|
// statsValue: '13',
|
|
|
|
|
// icon: 'assets/icon/new-design/pending_request.png'
|
|
|
|
|
// },
|
|
|
|
|
{
|
|
|
|
|
title: 'Pending Request',
|
|
|
|
|
statsValue: 13,
|
|
|
|
|
icon: 'assets/icon/new-design/pending_request.png'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Missing Swipes',
|
|
|
|
|
statsValue: '99',
|
|
|
|
|
statsValue: 0,
|
|
|
|
|
icon: 'assets/icon/new-design/missing_swipe.png'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Leave Balance', // getAccrualBalance ticket balance
|
|
|
|
|
statsValue: '02',
|
|
|
|
|
statsValue: 0,
|
|
|
|
|
icon: 'assets/icon/new-design/leave_balance.png'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Ticket Balance',
|
|
|
|
|
statsValue: '01',
|
|
|
|
|
statsValue: 0,
|
|
|
|
|
icon: 'assets/icon/new-design/ticket_balance.png'
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
@ -137,8 +137,8 @@ export class HomePage implements OnInit {
|
|
|
|
|
private sanitizer: DomSanitizer,
|
|
|
|
|
private file: File,
|
|
|
|
|
private permissions: DevicePermissionsService,
|
|
|
|
|
public DS: DashboredService
|
|
|
|
|
|
|
|
|
|
public DS: DashboredService,
|
|
|
|
|
public accrualService: AccrualService
|
|
|
|
|
) {
|
|
|
|
|
this.events.subscribe('img-change', displayImg => {
|
|
|
|
|
this.userImage = this.sanitizer.bypassSecurityTrustUrl('data:Image/*;base64,' + displayImg);
|
|
|
|
|
@ -146,11 +146,18 @@ export class HomePage implements OnInit {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ionViewWillEnter() {
|
|
|
|
|
this.getAccrualBalance();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.getUserDetails();
|
|
|
|
|
this.getMenu();
|
|
|
|
|
this.setServicesPrivilage();
|
|
|
|
|
this.initTimer();
|
|
|
|
|
this.openNotificationsDashbored();
|
|
|
|
|
this.showOpenMissingSwipes();
|
|
|
|
|
this.showAttendanceTracking();
|
|
|
|
|
|
|
|
|
|
// this.getCount();
|
|
|
|
|
// this.events.subscribe('getNotCount', badge => {
|
|
|
|
|
@ -255,7 +262,7 @@ export class HomePage implements OnInit {
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
ionViewDidLoad() {
|
|
|
|
|
this.getUserDetails();
|
|
|
|
|
// this.getUserDetails();
|
|
|
|
|
this.geolocation
|
|
|
|
|
.getCurrentPosition()
|
|
|
|
|
.then(resp => {
|
|
|
|
|
@ -456,6 +463,10 @@ export class HomePage implements OnInit {
|
|
|
|
|
|
|
|
|
|
showOpenMissingSwipes() {
|
|
|
|
|
this.DS.getOpenMissingSwipes() .subscribe((result: OpenMissingSwipesResponse) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
const key = 'GetOpenMissingSwipesList';
|
|
|
|
|
this.statsButtons[2].statsValue = result[key].P_OPEN_MISSING_SWIPES;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -466,6 +477,9 @@ export class HomePage implements OnInit {
|
|
|
|
|
|
|
|
|
|
showAttendanceTracking() { // spent hours left hours
|
|
|
|
|
this.DS.getAttendanceTracking() .subscribe((result: AttendanceTrackingResponse) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
console.log(result);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -478,15 +492,15 @@ export class HomePage implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openNotificationsDashbored() { // work list
|
|
|
|
|
this.DS.getOpenNotifications( () => {console.log('Error '); } ).subscribe((result: GetOpenNotificationsResponse) => {
|
|
|
|
|
this.DS.getOpenNotifications( () => { console.log('Error '); }).subscribe((result: GetOpenNotificationsResponse) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
console.log('response');
|
|
|
|
|
console.log(result);
|
|
|
|
|
const key = 'P_OPEN_NTF_NUMBER';
|
|
|
|
|
this.statsButtons[0].statsValue = result[key];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getSubordinatesLeaves(){
|
|
|
|
|
getSubordinatesLeaves() {
|
|
|
|
|
const request: GetSubordinatesLeavesRequest = new GetSubordinatesLeavesRequest();
|
|
|
|
|
request.P_DATE_FROM = '/Date(1578603600000+0300)/'; // test
|
|
|
|
|
request.P_DATE_TO = '/Date(1576011600000+0300)/'; // test
|
|
|
|
|
@ -521,10 +535,38 @@ export class HomePage implements OnInit {
|
|
|
|
|
} else if (subMenu.REQUEST_TYPE === 'EIT') {
|
|
|
|
|
this.common.openEitListPage();
|
|
|
|
|
}
|
|
|
|
|
if (subMenu.REQUEST_TYPE === 'PAYSLIP'){
|
|
|
|
|
if (subMenu.REQUEST_TYPE === 'PAYSLIP') {
|
|
|
|
|
this.common.openPayslipPage();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getAccrualBalance() {
|
|
|
|
|
const today = new Date();
|
|
|
|
|
const day = today.getDate();
|
|
|
|
|
const month = today.getMonth() + 1;
|
|
|
|
|
const year = today.getFullYear();
|
|
|
|
|
const todayDate = month + '/' + day + '/' + year;
|
|
|
|
|
const effectiveDate = todayDate;
|
|
|
|
|
const request = {
|
|
|
|
|
P_SELECTED_EMPLOYEE_NUMBER: this.userData.EMPLOYEE_NUMBER,
|
|
|
|
|
P_EFFECTIVE_DATE: effectiveDate
|
|
|
|
|
};
|
|
|
|
|
this.accrualService
|
|
|
|
|
.getAccrualBalances(request)
|
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
let totalTicketsLeft = 0;
|
|
|
|
|
for (const accrualBalance of result.GetAccrualBalancesList) {
|
|
|
|
|
if (accrualBalance.ACCURAL_PLAN_NAME === 'HMG Annual Vacation Accrual Plan') {
|
|
|
|
|
this.statsButtons[3].statsValue = accrualBalance.ACCRUAL_NET_ENTITLEMENT;
|
|
|
|
|
} else {
|
|
|
|
|
totalTicketsLeft = totalTicketsLeft + accrualBalance.ACCRUAL_NET_ENTITLEMENT;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.statsButtons[4].statsValue = totalTicketsLeft;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|