added logic for attendance

missing-swipe
umasoodch 6 years ago
parent a8f9640f68
commit d1fbd34330

@ -1,9 +1,10 @@
export class AttendanceTrackingList{
public SCHEDULED_HOURS :string;
public SPENT_HOURS : string;
public REMAINING_HOURS : string;
public RETURN_STATUS : string;
public RETURN_MSG : string;
}
export class AttendanceTrackingList {
public P_REMAINING_HOURS: string;
public P_RETURN_MSG: string;
public P_RETURN_STATUS: string;
public P_SCHEDULED_HOURS: 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';
export class AttendanceTrackingResponse extends Response{
public GetGetAttendanceTrackingList : AttendanceTrackingList[];
}
export class AttendanceTrackingResponse extends Response {
public GetGetAttendanceTrackingList: AttendanceTrackingList[];
}

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

@ -2,7 +2,9 @@
<ion-toolbar class="header-toolbar-new">
<nav-buttons [enableMenu]="true" [enableBack]="false" [navigate]="false"></nav-buttons>
<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-header>
@ -139,7 +141,7 @@
</ion-row> -->
</ion-grid>
<!-- {{displayTime}} -->
<div class="fixed-shift-timer">
<div class="fixed-shift-timer" *ngIf="isCheckedIn">
<span class="subTitle">Time Left Today</span>
<circle-progress
[backgroundColor]= "'#094875'"
@ -162,10 +164,12 @@
[clockwise]="false"
[renderOnClick]="false">
</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>
</ion-content>
<!-- <ion-fab>
<ion-fab-button>Button</ion-fab-button>
</ion-fab> -->

@ -6,6 +6,18 @@ ion-row {
.header-toolbar-new{
--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{
color: white;
position: absolute;
@ -98,6 +110,36 @@ ion-label{
width: 80%;
text-align: center;
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'
},
{
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();
}
}

Loading…
Cancel
Save