added logic for attendance

missing-swipe
umasoodch 6 years ago
parent a8f9640f68
commit d1fbd34330

@ -1,9 +1,10 @@
export class AttendanceTrackingList{ export class AttendanceTrackingList {
public SCHEDULED_HOURS :string; public P_REMAINING_HOURS: string;
public SPENT_HOURS : string; public P_RETURN_MSG: string;
public REMAINING_HOURS : string; public P_RETURN_STATUS: string;
public RETURN_STATUS : string; public P_SCHEDULED_HOURS: string;
public RETURN_MSG : string; public P_SHT_NAME: string;
} public P_SPENT_HOURS: string;
}

@ -1,8 +1,8 @@
import { Response } from "src/app/hmg-common/services/models/response"; import { Response } from 'src/app/hmg-common/services/models/response';
import { AttendanceTrackingList } from './AttensanceTrackingList'; import { AttendanceTrackingList } from './AttensanceTrackingList';
export class AttendanceTrackingResponse extends Response{ export class AttendanceTrackingResponse extends Response {
public GetGetAttendanceTrackingList : AttendanceTrackingList[]; public GetGetAttendanceTrackingList: AttendanceTrackingList[];
} }

@ -24,7 +24,7 @@
.titleBox { .titleBox {
display: block; display: block;
span { span {
font-size: 35px; font-size: 30px;
font-weight: bold; font-weight: bold;
color: black; color: black;
text-align: left; text-align: left;

@ -2,7 +2,9 @@
<ion-toolbar class="header-toolbar-new"> <ion-toolbar class="header-toolbar-new">
<nav-buttons [enableMenu]="true" [enableBack]="false" [navigate]="false"></nav-buttons> <nav-buttons [enableMenu]="true" [enableBack]="false" [navigate]="false"></nav-buttons>
<ion-title>DASHBOARD</ion-title> <ion-title>DASHBOARD</ion-title>
<!-- <ion-icon class="login-icon" name="log-in" slot="end" *ngIf="!logIn" (click)="login()"></ion-icon> --> <div class="profile-image-container" (click)="openProfilePage()">
<img [src]="userImage"/>
</div>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
@ -139,7 +141,7 @@
</ion-row> --> </ion-row> -->
</ion-grid> </ion-grid>
<!-- {{displayTime}} --> <!-- {{displayTime}} -->
<div class="fixed-shift-timer"> <div class="fixed-shift-timer" *ngIf="isCheckedIn">
<span class="subTitle">Time Left Today</span> <span class="subTitle">Time Left Today</span>
<circle-progress <circle-progress
[backgroundColor]= "'#094875'" [backgroundColor]= "'#094875'"
@ -162,10 +164,12 @@
[clockwise]="false" [clockwise]="false"
[renderOnClick]="false"> [renderOnClick]="false">
</circle-progress> </circle-progress>
</div>
<div class="attendance-timer" *ngIf="!isCheckedIn">
<img src="assets/icon/new-design/missing_swipe.png"/>
<span class="subTitle">Monthly Attendance</span>
</div> </div>
</ion-content> </ion-content>
<!-- <ion-fab> <!-- <ion-fab>
<ion-fab-button>Button</ion-fab-button> <ion-fab-button>Button</ion-fab-button>
</ion-fab> --> </ion-fab> -->

@ -6,6 +6,18 @@ ion-row {
.header-toolbar-new{ .header-toolbar-new{
--background: #22c6b3; --background: #22c6b3;
} }
.profile-image-container{
position: relative;
z-index: 999;
img {
width: 32px;
float: right;
margin-top: -42px;
border-radius: 20px;
height: 32px;
margin-right: 4px;
}
}
ion-title{ ion-title{
color: white; color: white;
position: absolute; position: absolute;
@ -98,6 +110,36 @@ ion-label{
width: 80%; width: 80%;
text-align: center; text-align: center;
font-size: 11px; font-size: 11px;
text-transform: uppercase;; text-transform: uppercase;
}
}
.attendance-timer {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 2;
height: 112px;
width: 112px;
background-color: #094875;
border-radius: 50%;
display: inline-block;
img {
position: absolute;
left: 33%;
top: 8%;
width: 35%;
}
span {
position: absolute;
left: 50%;
top: 70%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
color: white;
width: 80%;
text-align: center;
font-size: 11px;
text-transform: uppercase;
} }
} }

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

Loading…
Cancel
Save