|
|
|
|
@ -70,7 +70,7 @@ export class HomePage implements OnInit {
|
|
|
|
|
icon: 'assets/icon/new-design/missing_swipe.png'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Leave Balance', // getAccrualBalance ticket balance
|
|
|
|
|
title: 'Leave Balance',
|
|
|
|
|
statsValue: 0,
|
|
|
|
|
icon: 'assets/icon/new-design/leave_balance.png'
|
|
|
|
|
},
|
|
|
|
|
@ -108,15 +108,15 @@ export class HomePage implements OnInit {
|
|
|
|
|
slidesPerView: 3.2,
|
|
|
|
|
spaceBetween: 10
|
|
|
|
|
};
|
|
|
|
|
public timeInSeconds: any = 0.15 * 60 * 60;
|
|
|
|
|
public time: any;
|
|
|
|
|
public runTimer = false;
|
|
|
|
|
public hasStarted = false;
|
|
|
|
|
public hasFinished = false;
|
|
|
|
|
public remainingTime: any;
|
|
|
|
|
public scheduledTime: any;
|
|
|
|
|
public isCheckedIn: any;
|
|
|
|
|
public displayTime: any;
|
|
|
|
|
public menuEntries: any;
|
|
|
|
|
public percent: any = 100 - ((this.timeInSeconds / 32400) * 100);
|
|
|
|
|
public percent: any;
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
public ts: TranslatorService,
|
|
|
|
|
@ -146,18 +146,8 @@ 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 => {
|
|
|
|
|
@ -166,11 +156,10 @@ export class HomePage implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initTimer() {
|
|
|
|
|
this.time = this.timeInSeconds;
|
|
|
|
|
this.runTimer = false;
|
|
|
|
|
this.hasStarted = false;
|
|
|
|
|
this.hasFinished = false;
|
|
|
|
|
this.remainingTime = this.timeInSeconds;
|
|
|
|
|
this.percent = 100 - ((this.remainingTime / this.scheduledTime) * 100);
|
|
|
|
|
this.displayTime = this.getSecondsAsDigitalClock(this.remainingTime);
|
|
|
|
|
this.startTimer();
|
|
|
|
|
}
|
|
|
|
|
@ -187,7 +176,7 @@ export class HomePage implements OnInit {
|
|
|
|
|
this.remainingTime--;
|
|
|
|
|
this.displayTime = this.getSecondsAsDigitalClock(this.remainingTime);
|
|
|
|
|
if (this.remainingTime > 0) {
|
|
|
|
|
const newPercent: any = ((this.remainingTime / 32400) * 100).toFixed(2);
|
|
|
|
|
const newPercent: any = ((this.remainingTime / this.scheduledTime) * 100).toFixed(2);
|
|
|
|
|
this.percent = 100 - newPercent;
|
|
|
|
|
this.timerTick();
|
|
|
|
|
} else {
|
|
|
|
|
@ -262,7 +251,6 @@ export class HomePage implements OnInit {
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
ionViewDidLoad() {
|
|
|
|
|
// this.getUserDetails();
|
|
|
|
|
this.geolocation
|
|
|
|
|
.getCurrentPosition()
|
|
|
|
|
.then(resp => {
|
|
|
|
|
@ -279,24 +267,31 @@ export class HomePage implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private getUserDetails() {
|
|
|
|
|
|
|
|
|
|
this.authService
|
|
|
|
|
.loadAuthenticatedUser()
|
|
|
|
|
.subscribe((user: AuthenticatedUser) => {
|
|
|
|
|
if (user) {
|
|
|
|
|
this.events.publish('setMenu');
|
|
|
|
|
this.userData = user;
|
|
|
|
|
// set User Info
|
|
|
|
|
this.sharedData.setSharedData(this.userData, AuthenticatedUser.SHARED_DATA);
|
|
|
|
|
this.userImage = user.EMPLOYEE_IMAGE
|
|
|
|
|
? 'data:image/png;base64,' + user.EMPLOYEE_IMAGE
|
|
|
|
|
: this.userImage;
|
|
|
|
|
console.log(user);
|
|
|
|
|
this.userImage = user.EMPLOYEE_IMAGE ? 'data:image/png;base64,' + user.EMPLOYEE_IMAGE : this.userImage;
|
|
|
|
|
this.callDashboardServices();
|
|
|
|
|
} else {
|
|
|
|
|
console.log(user);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
callDashboardServices() {
|
|
|
|
|
this.getMenu();
|
|
|
|
|
this.setServicesPrivilage();
|
|
|
|
|
this.openNotificationsDashbored();
|
|
|
|
|
this.showOpenMissingSwipes();
|
|
|
|
|
this.showAttendanceTracking();
|
|
|
|
|
this.getAccrualBalance();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Vacation_Rule() {
|
|
|
|
|
this.common.navigateForward('/vacation-rule/home');
|
|
|
|
|
}
|
|
|
|
|
@ -475,10 +470,29 @@ export class HomePage implements OnInit {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
convertInSeconds(time: any) {
|
|
|
|
|
const hours = parseInt(time[0], 10);
|
|
|
|
|
const minutes = parseInt(time[1], 10);
|
|
|
|
|
const seconds = (hours * 60 * 60) + (minutes * 60);
|
|
|
|
|
return seconds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
convertAndAssignTime(data) {
|
|
|
|
|
console.log(data);
|
|
|
|
|
this.remainingTime = this.convertInSeconds(data.P_REMAINING_HOURS.split(':'));
|
|
|
|
|
this.scheduledTime = this.convertInSeconds(data.P_SCHEDULED_HOURS.split(':'));
|
|
|
|
|
this.isCheckedIn = this.remainingTime === this.scheduledTime ? true : false;
|
|
|
|
|
this.initTimer();
|
|
|
|
|
console.log('remainingTime: ' + this.remainingTime);
|
|
|
|
|
console.log('scheduledTime: ' + this.scheduledTime);
|
|
|
|
|
console.log('isCheckedIn: ' + this.isCheckedIn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showAttendanceTracking() { // spent hours left hours
|
|
|
|
|
this.DS.getAttendanceTracking() .subscribe((result: AttendanceTrackingResponse) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
console.log(result);
|
|
|
|
|
const key = 'GetAttendanceTrackingList';
|
|
|
|
|
this.convertAndAssignTime(result[key]);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -567,6 +581,10 @@ export class HomePage implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openProfilePage() {
|
|
|
|
|
this.common.openProfile();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|