add click to status button & add icon to service buttons & fix issues

accural-balance
Mohamed Mekawy 6 years ago
parent 08c8ea71b1
commit a694396f82

@ -1,6 +1,6 @@
<div feedback class="custom-button"> <div feedback class="custom-button">
<div class="iconBox"> <div class="iconBox">
<img [src]="icon" class="icon"> <img [src]="'data:image/png;base64,'+icon" class="icon">
</div> </div>
<div class="titleBox"> <div class="titleBox">
<p class="pClass">{{title}}</p> <p class="pClass">{{title}}</p>

@ -46,7 +46,7 @@
<app-services-button <app-services-button
(click)="openPage(subMenu)" (click)="openPage(subMenu)"
[title]="subMenu.PROMPT" [title]="subMenu.PROMPT"
icon="assets/icon/new-design/leave_balance.png"> [icon]="subMenu.ICON">
</app-services-button> </app-services-button>
</ion-slide> </ion-slide>
</ion-slides> </ion-slides>

@ -1,48 +1,48 @@
import { EitService } from './../eit/services/eit.service'; import { EitService } from "./../eit/services/eit.service";
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service";
import { MenuController, Events, ActionSheetController } from '@ionic/angular'; import { MenuController, Events, ActionSheetController } from "@ionic/angular";
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user'; import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/models/authenticated-user";
import { MenuService } from 'src/app/hmg-common/services/menu/menuservice.service'; import { MenuService } from "src/app/hmg-common/services/menu/menuservice.service";
import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response";
import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { CommonService } from "src/app/hmg-common/services/common/common.service";
import { Geolocation } from '@ionic-native/geolocation/ngx'; import { Geolocation } from "@ionic-native/geolocation/ngx";
import { ZBar, ZBarOptions } from '@ionic-native/zbar/ngx'; import { ZBar, ZBarOptions } from "@ionic-native/zbar/ngx";
import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx'; import { BarcodeScanner } from "@ionic-native/barcode-scanner/ngx";
import { Device } from '@ionic-native/device/ngx'; import { Device } from "@ionic-native/device/ngx";
import { attendanceSwipeScannerRequest } from './models/attendanceSwipe.Request'; import { attendanceSwipeScannerRequest } from "./models/attendanceSwipe.Request";
import { Response } from 'src/app/hmg-common/services/models/response'; import { Response } from "src/app/hmg-common/services/models/response";
import { AttendanceService } from './services/attendance.services'; import { AttendanceService } from "./services/attendance.services";
import { LoginRequest } from '../hmg-common/services/authentication/models/login.request'; import { LoginRequest } from "../hmg-common/services/authentication/models/login.request";
import {FileUploaderComponent} from '../hmg-common/ui/file-uploader/file-uploader.component' import { FileUploaderComponent } from "../hmg-common/ui/file-uploader/file-uploader.component";
import { Camera} from '@ionic-native/Camera/ngx'; import { Camera } from "@ionic-native/Camera/ngx";
import { File } from '@ionic-native/file/ngx'; import { File } from "@ionic-native/file/ngx";
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from "@angular/platform-browser";
import { SharedDataService } from '../hmg-common/services/shared-data-service/shared-data.service'; import { SharedDataService } from "../hmg-common/services/shared-data-service/shared-data.service";
import { DevicePermissionsService } from '../hmg-common/services/device-permissions/device-permissions.service'; import { DevicePermissionsService } from "../hmg-common/services/device-permissions/device-permissions.service";
import { DashboredService } from '../hmg-common/services/dashbored/dashbored.service'; import { DashboredService } from "../hmg-common/services/dashbored/dashbored.service";
import { OrganizationSalariesResponse } from '../hmg-common/services/dashbored/organization-salaries.response'; import { OrganizationSalariesResponse } from "../hmg-common/services/dashbored/organization-salaries.response";
import { OpenMissingSwipesResponse} from '../hmg-common/services/dashbored/open-missing-swipes.response'; import { OpenMissingSwipesResponse } from "../hmg-common/services/dashbored/open-missing-swipes.response";
import {PerformanceAppraisalResponse} from '../hmg-common/services/dashbored/performance-appraisal.response'; import { PerformanceAppraisalResponse } from "../hmg-common/services/dashbored/performance-appraisal.response";
import { AttendanceTrackingResponse } from '../hmg-common/services/dashbored/attendance-tracking.response'; import { AttendanceTrackingResponse } from "../hmg-common/services/dashbored/attendance-tracking.response";
import { OpenPeriodDatesResponse } from '../hmg-common/services/dashbored/models/openPeriodDatesResponse'; import { OpenPeriodDatesResponse } from "../hmg-common/services/dashbored/models/openPeriodDatesResponse";
import {GetSubordinatesAttdStatusRequest} from '../hmg-common/services/dashbored/models/GetSubordinatesAttdStatusRequest'; import { GetSubordinatesAttdStatusRequest } from "../hmg-common/services/dashbored/models/GetSubordinatesAttdStatusRequest";
import {GetSubordinatesLeavesRequest} from '../hmg-common/services/dashbored/models/GetSubordinatesLeavesRequest' import { GetSubordinatesLeavesRequest } from "../hmg-common/services/dashbored/models/GetSubordinatesLeavesRequest";
import {GetOpenNotificationsResponse} from '../hmg-common/services/dashbored/models/GetOpenNotificationsResponse' import { GetOpenNotificationsResponse } from "../hmg-common/services/dashbored/models/GetOpenNotificationsResponse";
import {GetSubordinatesAttdStatusResponse} from '../hmg-common/services/dashbored/models/GetSubordinatesAttdStatusResponse' import { GetSubordinatesAttdStatusResponse } from "../hmg-common/services/dashbored/models/GetSubordinatesAttdStatusResponse";
import {GetSubordinatesLeavesResponse} from '../hmg-common/services/dashbored/models/GetSubordinatesLeavesResponse' import { GetSubordinatesLeavesResponse } from "../hmg-common/services/dashbored/models/GetSubordinatesLeavesResponse";
import { AccrualService } from '../accrual-balances/services/accrual.service'; import { AccrualService } from "../accrual-balances/services/accrual.service";
import { WorklistMainService } from '../notification/service/work-list.main.service'; import { WorklistMainService } from "../notification/service/work-list.main.service";
@Component({ @Component({
selector: 'app-home', selector: "app-home",
templateUrl: './home.page.html', templateUrl: "./home.page.html",
styleUrls: ['./home.page.scss'] styleUrls: ["./home.page.scss"]
}) })
export class HomePage implements OnInit { export class HomePage implements OnInit {
userData: any = {}; userData: any = {};
userImage: any = '../assets/imgs/profile.png'; userImage: any = "../assets/imgs/profile.png";
menuList: any = []; menuList: any = [];
zbarOptions: any; zbarOptions: any;
scannedResult: any; scannedResult: any;
@ -54,36 +54,39 @@ export class HomePage implements OnInit {
public fileUploder: FileUploaderComponent; public fileUploder: FileUploaderComponent;
location: boolean; location: boolean;
camera: boolean; camera: boolean;
ticketRequestObject : any;
leaveRequestObject : any;
missingSwipeRequestObject : any;
public statsButtons = [ public statsButtons = [
{ {
title: 'Work List', title: "Work List",
statsValue: 0, statsValue: 0,
icon: 'assets/icon/new-design/work_list.png', icon: "assets/icon/new-design/work_list.png",
link: '/notification/homepage' link: "1"
}, },
// {
// title: 'Pending Request',
// statsValue: 13,
// icon: 'assets/icon/new-design/pending_request.png',
// link: ''
// },
{ {
title: 'Pending Request', title: "Missing Swipes",
statsValue: 13,
icon: 'assets/icon/new-design/pending_request.png',
link: ''
},
{
title: 'Missing Swipes',
statsValue: 0, statsValue: 0,
icon: 'assets/icon/new-design/missing_swipe.png', icon: "assets/icon/new-design/missing_swipe.png",
link: '' link: "2"
}, },
{ {
title: 'Leave Balance', title: "Leave Balance",
statsValue: 0, statsValue: 0,
icon: 'assets/icon/new-design/leave_balance.png', icon: "assets/icon/new-design/leave_balance.png",
link: '' link: "3"
}, },
{ {
title: 'Ticket Balance', title: "Ticket Balance",
statsValue: 0, statsValue: 0,
icon: 'assets/icon/new-design/ticket_balance.png', icon: "assets/icon/new-design/ticket_balance.png",
link: '' link: "4"
} }
]; ];
@ -107,8 +110,8 @@ export class HomePage implements OnInit {
// ]; // ];
public slideOptsOne = { public slideOptsOne = {
slidesPerView: 3.5, slidesPerView: 3.5,
spaceBetween: 10 spaceBetween: 10
}; };
public slideOptsTwo = { public slideOptsTwo = {
slidesPerView: 3.2, slidesPerView: 3.2,
@ -124,7 +127,7 @@ export class HomePage implements OnInit {
public menuEntries: any; public menuEntries: any;
public percent: any; public percent: any;
accrualBalancesList: any; accrualBalancesList: any;
public countAllNotification: number =0; public countAllNotification: number = 0;
constructor( constructor(
public ts: TranslatorService, public ts: TranslatorService,
@ -147,17 +150,18 @@ export class HomePage implements OnInit {
private permissions: DevicePermissionsService, private permissions: DevicePermissionsService,
public DS: DashboredService, public DS: DashboredService,
public accrualService: AccrualService, public accrualService: AccrualService,
public workListService: WorklistMainService, public workListService: WorklistMainService
) { ) {
this.events.subscribe('img-change', displayImg => { this.events.subscribe("img-change", displayImg => {
this.userImage = this.sanitizer.bypassSecurityTrustUrl('data:Image/*;base64,' + displayImg); this.userImage = this.sanitizer.bypassSecurityTrustUrl(
console.log('html saved img: ' + this.userImage); "data:Image/*;base64," + displayImg
);
console.log("html saved img: " + this.userImage);
}); });
} }
ngOnInit() { ngOnInit() {
// this.getUserDetails(); // this.getUserDetails();
// this.getCount(); // this.getCount();
// this.events.subscribe('getNotCount', badge => { // this.events.subscribe('getNotCount', badge => {
// this.notBadge = badge; // this.notBadge = badge;
@ -165,20 +169,20 @@ export class HomePage implements OnInit {
} }
ionViewWillEnter() { ionViewWillEnter() {
this.remainingTime = 0; this.remainingTime = 0;
this.displayTime = '00:00:00'; this.displayTime = "00:00:00";
this.runTimer = false; this.runTimer = false;
this.getUserDetails(); this.getUserDetails();
} }
initTimer() { initTimer() {
this.runTimer = false; this.runTimer = false;
this.hasStarted = false; this.hasStarted = false;
this.hasFinished = false; this.hasFinished = false;
this.percent = 100 - ((this.remainingTime / this.scheduledTime) * 100); this.percent = 100 - (this.remainingTime / this.scheduledTime) * 100;
this.displayTime = this.getSecondsAsDigitalClock(this.remainingTime); this.displayTime = this.getSecondsAsDigitalClock(this.remainingTime);
this.startTimer(); this.startTimer();
} }
startTimer() { startTimer() {
this.runTimer = true; this.runTimer = true;
@ -188,11 +192,16 @@ export class HomePage implements OnInit {
timerTick() { timerTick() {
setTimeout(() => { setTimeout(() => {
if (!this.runTimer) { return; } if (!this.runTimer) {
return;
}
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 / this.scheduledTime) * 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 {
@ -204,66 +213,71 @@ export class HomePage implements OnInit {
getSecondsAsDigitalClock(inputSeconds: number) { getSecondsAsDigitalClock(inputSeconds: number) {
const secNum = parseInt(inputSeconds.toString(), 10); // don't forget the second param const secNum = parseInt(inputSeconds.toString(), 10); // don't forget the second param
const hours = Math.floor(secNum / 3600); const hours = Math.floor(secNum / 3600);
const minutes = Math.floor((secNum - (hours * 3600)) / 60); const minutes = Math.floor((secNum - hours * 3600) / 60);
const seconds = secNum - (hours * 3600) - (minutes * 60); const seconds = secNum - hours * 3600 - minutes * 60;
let hoursString = ''; let hoursString = "";
let minutesString = ''; let minutesString = "";
let secondsString = ''; let secondsString = "";
hoursString = (hours < 10) ? '0' + hours : hours.toString(); hoursString = hours < 10 ? "0" + hours : hours.toString();
minutesString = (minutes < 10) ? '0' + minutes : minutes.toString(); minutesString = minutes < 10 ? "0" + minutes : minutes.toString();
secondsString = (seconds < 10) ? '0' + seconds : seconds.toString(); secondsString = seconds < 10 ? "0" + seconds : seconds.toString();
return hoursString + ':' + minutesString + ':' + secondsString; return hoursString + ":" + minutesString + ":" + secondsString;
} }
getDeviceLocation() { getDeviceLocation() {
const isVirtual = this.device.isVirtual; const isVirtual = this.device.isVirtual;
if (isVirtual === true){ if (isVirtual === true) {
alert('emulater>>>>>>>' + isVirtual); alert("emulater>>>>>>>" + isVirtual);
alert('You are using virtual device'); alert("You are using virtual device");
return false; return false;
} }
this.permissions.requestLocationAutherization().then(granted => { this.permissions.requestLocationAutherization().then(granted => {
this.location = granted as boolean; this.location = granted as boolean;
if (this.location) { if (this.location) {
this.geolocation this.geolocation
.getCurrentPosition({ maximumAge: 3000, timeout: 10000, enableHighAccuracy: true }) .getCurrentPosition({
maximumAge: 3000,
timeout: 10000,
enableHighAccuracy: true
})
.then(resp => { .then(resp => {
this.lat = resp.coords.latitude; this.lat = resp.coords.latitude;
this.longt = resp.coords.longitude; this.longt = resp.coords.longitude;
this.attendance(); this.attendance();
}) })
.catch(error => { .catch(error => {
console.log('Error getting location', error); console.log("Error getting location", error);
}); });
} else { } else {
return false; return false;
} }
}); });
} }
setServicesPrivilage() { setServicesPrivilage() {
for (const servicePrivilage of AuthenticationService.servicePrivilage) { for (const servicePrivilage of AuthenticationService.servicePrivilage) {
if (servicePrivilage.Previlege === false) { if (servicePrivilage.Previlege === false) {
document.getElementById(servicePrivilage.ServiceName).setAttribute('disabled', 'disabled'); document
document.getElementById(servicePrivilage.ServiceName).style.filter = 'grayscale(1)'; .getElementById(servicePrivilage.ServiceName)
.setAttribute("disabled", "disabled");
document.getElementById(servicePrivilage.ServiceName).style.filter =
"grayscale(1)";
} }
} }
} }
// getCount() { // getCount() {
// const req: any = {}; // const req: any = {};
// this.menuService.getNotificationCount(req).subscribe((result: any) => { // this.menuService.getNotificationCount(req).subscribe((result: any) => {
// if (this.common.validResponse(result)) { // if (this.common.validResponse(result)) {
// this.notBadge = // this.notBadge =
// result.GetOpenNotificationsNumList.P_OPEN_NOTIFICATIONS_NUM; // result.GetOpenNotificationsNumList.P_OPEN_NOTIFICATIONS_NUM;
// if (this.notBadge <= 0) { // if (this.notBadge <= 0) {
// this.notBadge = null; // this.notBadge = null;
// } // }
// this.events.publish("getNotCount", this.notBadge); // this.events.publish("getNotCount", this.notBadge);
// } // }
// }); // });
// } // }
ionViewDidEnter() { ionViewDidEnter() {
@ -274,7 +288,7 @@ export class HomePage implements OnInit {
this.longt = resp.coords.longitude; this.longt = resp.coords.longitude;
}) })
.catch(error => { .catch(error => {
console.log('Error getting location', error); console.log("Error getting location", error);
}); });
} }
@ -283,286 +297,323 @@ 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;
this.sharedData.setSharedData(this.userData, AuthenticatedUser.SHARED_DATA); this.sharedData.setSharedData(
this.userImage = user.EMPLOYEE_IMAGE ? 'data:image/png;base64,' + user.EMPLOYEE_IMAGE : this.userImage; this.userData,
AuthenticatedUser.SHARED_DATA
);
this.userImage = user.EMPLOYEE_IMAGE
? "data:image/png;base64," + user.EMPLOYEE_IMAGE
: this.userImage;
this.callDashboardServices(); this.callDashboardServices();
} else { } else {
console.log(user); console.log(user);
} }
}); });
} }
callDashboardServices() { callDashboardServices() {
this.getMenu(); this.getMenu();
this.setServicesPrivilage(); this.setServicesPrivilage();
this.openNotificationsDashbored(); this.openNotificationsDashbored();
this.showOpenMissingSwipes(); this.showOpenMissingSwipes();
this.showAttendanceTracking(); this.showAttendanceTracking();
this.getAccrualBalance(); this.getAccrualBalance();
} }
public Vacation_Rule() { public Vacation_Rule() {
this.common.navigateForward('/vacation-rule/home'); this.common.navigateForward("/vacation-rule/home");
} }
private getMenu() { private getMenu() {
this.menuService.getMenu().subscribe((result: MenuResponse) => { this.menuService.getMenu().subscribe((result: MenuResponse) => {
this.handleMenuResult(result); this.handleMenuResult(result);
}); });
} }
private handleMenuResult(result) { private handleMenuResult(result) {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
if (this.common.hasData(result.List_Menu)) { if (this.common.hasData(result.List_Menu)) {
console.log('list menu'); console.log("list menu");
this.menuList = result.List_Menu; this.menuList = result.List_Menu;
this.getMenuDetails(); this.getMenuDetails();
}
} }
} }
}
private accrualBalance() { private accrualBalance() {
this.common.openAccuralPage(); this.common.openAccuralPage();
} }
private changeImage() { private changeImage() {
this.common.openChangeImagePage(); this.common.openChangeImagePage();
} }
public getMenuDetails() { public getMenuDetails() {
const item = this.menuList[0]; const item = this.menuList[0];
const selMenu: MenuResponse = new MenuResponse(); const selMenu: MenuResponse = new MenuResponse();
selMenu.List_Menu = item; selMenu.List_Menu = item;
selMenu.userid = this.userData.EMPLOYEE_NUMBER; selMenu.userid = this.userData.EMPLOYEE_NUMBER;
console.log('menu: ' + selMenu.List_Menu); console.log("menu: " + selMenu.List_Menu);
this.common.sharedService.setSharedData(selMenu, MenuResponse.SHARED_DATA); this.common.sharedService.setSharedData(selMenu, MenuResponse.SHARED_DATA);
this.getMenuEntries(item); this.getMenuEntries(item);
// if (item.MENU_TYPE === 'M') { // if (item.MENU_TYPE === 'M') {
// this.common.openMyTeamPage(); // this.common.openMyTeamPage();
// // this.navCtrl.push("MySubordinatePage"); // // this.navCtrl.push("MySubordinatePage");
// } else if (item.MENU_TYPE === 'S') { // } else if (item.MENU_TYPE === 'S') {
// this.common.sharedService.setSharedData(item, 'mySpecList'); // this.common.sharedService.setSharedData(item, 'mySpecList');
// this.common.openMySpecialistPage(); // this.common.openMySpecialistPage();
// // this.navCtrl.push('MySpecialistPage',{"mySpecList":item}); // // this.navCtrl.push('MySpecialistPage',{"mySpecList":item});
// } else { // } else {
// this.getMenuEntries(item); // this.getMenuEntries(item);
// } // }
} }
getMenuEntries(item) { getMenuEntries(item) {
const request: any = {}; const request: any = {};
let selEmpNo: string = null; let selEmpNo: string = null;
let nationality: string = null; let nationality: string = null;
request.P_SELECTED_RESP_ID = -999; request.P_SELECTED_RESP_ID = -999;
if (item.MENU_TYPE === 'S') { if (item.MENU_TYPE === "S") {
request.P_SELECTED_RESP_ID = item.RESP_ID; request.P_SELECTED_RESP_ID = item.RESP_ID;
} else { } else {
selEmpNo = this.common.sharedService.getSharedData( selEmpNo = this.common.sharedService.getSharedData(
LoginRequest.SHARED_DATA, LoginRequest.SHARED_DATA,
false
);
}
nationality = this.common.sharedService.getSharedData(
LoginRequest.NATIONALITY_CODE,
false false
); );
request.P_SELECTED_EMPLOYEE_NUMBER = selEmpNo;
request.P_MENU_TYPE = item.MENU_TYPE;
request.NationalityCode = nationality;
// set emp and resp id
console.log('set data');
this.common.sharedService.setSharedData(
selEmpNo,
MenuResponse.SHARED_SEL_EMP
);
this.common.sharedService.setSharedData(
request.P_SELECTED_RESP_ID,
MenuResponse.SHARED_SEL_RESP_ID
);
this.eitService
.getMenuEntries(request)
.subscribe((result: MenuResponse) => {
this.handleMenuEntiresResult(result);
});
} }
nationality = this.common.sharedService.getSharedData(
LoginRequest.NATIONALITY_CODE,
false
);
request.P_SELECTED_EMPLOYEE_NUMBER = selEmpNo;
request.P_MENU_TYPE = item.MENU_TYPE;
request.NationalityCode = nationality;
// set emp and resp id
console.log("set data");
this.common.sharedService.setSharedData(
selEmpNo,
MenuResponse.SHARED_SEL_EMP
);
this.common.sharedService.setSharedData(
request.P_SELECTED_RESP_ID,
MenuResponse.SHARED_SEL_RESP_ID
);
this.eitService
.getMenuEntries(request)
.subscribe((result: MenuResponse) => {
this.handleMenuEntiresResult(result);
});
}
sortMenuEntires(list) { sortMenuEntires(list) {
const tree = this.common.list_to_tree(list); const tree = this.common.list_to_tree(list);
this.menuEntries = tree; this.menuEntries = tree;
console.log(this.menuEntries); console.log(this.menuEntries);
this.common.sharedService.setSharedData(tree, 'menuEntries'); this.common.sharedService.setSharedData(tree, "menuEntries");
// this.common.navigateForward("/eit/homepage"); // this.common.navigateForward("/eit/homepage");
// this.common.openEITPage(); // this.common.openEITPage();
} }
private handleMenuEntiresResult(result) { private handleMenuEntiresResult(result) {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
if (this.common.hasData(result.GetMenuEntriesList)) { if (this.common.hasData(result.GetMenuEntriesList)) {
this.sortMenuEntires(result.GetMenuEntriesList); for(let i=0;i<result.GetMenuEntriesList.length;i++){
if(result.GetMenuEntriesList[i].FUNCTION_NAME=="HMG_TKT_NEW_EIT_SS"){
this.ticketRequestObject=result.GetMenuEntriesList[i];
}else if(result.GetMenuEntriesList[i].FUNCTION_NAME=="HR_LOA_SS"){
this.leaveRequestObject=result.GetMenuEntriesList[i];
} else if(result.GetMenuEntriesList[i].FUNCTION_NAME=="HMG_OTL_MISSING_SWIPE_EIT_SS"){
this.missingSwipeRequestObject=result.GetMenuEntriesList[i];
}
} }
this.sortMenuEntires(result.GetMenuEntriesList);
} }
} }
}
parentFn($event: string) { parentFn($event: string) {
console.log($event); // this will output 'hello from child' console.log($event); // this will output 'hello from child'
} }
private Change_password() { private Change_password() {
this.common.openChangePassword(); this.common.openChangePassword();
} }
private openPayslip() { private openPayslip() {
this.common.openPayslipPage(); this.common.openPayslipPage();
} }
private attendance() { private attendance() {
this.permissions.requestCameraAutherization().then(granted => { this.permissions.requestCameraAutherization().then(granted => {
this.camera = granted as boolean; this.camera = granted as boolean;
if (this.camera) { if (this.camera) {
this.scanCode(); this.scanCode();
} }
} });
); }
}
scanCode() { scanCode() {
this.barcodeScanner.scan().then(barcodeData => { this.barcodeScanner
.scan()
.then(barcodeData => {
this.scannedResult = barcodeData; this.scannedResult = barcodeData;
this.deviceID = this.device.uuid; this.deviceID = this.device.uuid;
this.swipeAttendance(); this.swipeAttendance();
}).catch(err => { })
console.log('Error', err); .catch(err => {
console.log("Error", err);
}); });
} }
swipeAttendance() {
const request: attendanceSwipeScannerRequest = new attendanceSwipeScannerRequest();
request.Latitude = this.lat;
request.Longitude = this.longt;
request.QRValue = this.scannedResult.text;
request.UID = this.deviceID;
request.UserName = this.userData.EMPLOYEE_NUMBER;
console.log(JSON.stringify(request));
this.attendanceService
.attendanceSwipeScanner(request, () => {
console.log('Error inside in swipe attendance');
})
.subscribe((result: Response) => {
if (this.common.validResponse(result)) {
this.common.presentAlert(this.ts.trPK('home', 'swipeAlertSuccess'));
this.showAttendanceTracking();
}
// else {
// this.common.presentAlert(this.ts.trPK('home', 'swipeAlertFailed'));
// }
});
}
openPersonalInfo() { swipeAttendance() {
this.common.openProfile(); const request: attendanceSwipeScannerRequest = new attendanceSwipeScannerRequest();
} request.Latitude = this.lat;
request.Longitude = this.longt;
request.QRValue = this.scannedResult.text;
request.UID = this.deviceID;
request.UserName = this.userData.EMPLOYEE_NUMBER;
console.log(JSON.stringify(request));
this.attendanceService
.attendanceSwipeScanner(request, () => {
console.log("Error inside in swipe attendance");
})
.subscribe((result: Response) => {
if (this.common.validResponse(result)) {
this.common.presentAlert(this.ts.trPK("home", "swipeAlertSuccess"));
this.showAttendanceTracking();
}
// else {
// this.common.presentAlert(this.ts.trPK('home', 'swipeAlertFailed'));
// }
});
}
openPersonalInfo() {
this.common.openProfile();
}
/*************************************Dashboards Services**********************************************************8 */ /*************************************Dashboards Services**********************************************************8 */
showOrganizationSalaries() { showOrganizationSalaries() {
this.DS.getOrganizationSalaries() .subscribe((result: OrganizationSalariesResponse ) => { this.DS.getOrganizationSalaries().subscribe(
}); (result: OrganizationSalariesResponse) => {}
);
} }
showOpenMissingSwipes() { showOpenMissingSwipes() {
this.DS.getOpenMissingSwipes() .subscribe((result: OpenMissingSwipesResponse) => { this.DS.getOpenMissingSwipes().subscribe(
if (this.common.validResponse(result)) { (result: OpenMissingSwipesResponse) => {
const key = 'GetOpenMissingSwipesList'; if (this.common.validResponse(result)) {
this.statsButtons[2].statsValue = result[key].P_OPEN_MISSING_SWIPES; const key = "GetOpenMissingSwipesList";
this.statsButtons[1].statsValue = result[key].P_OPEN_MISSING_SWIPES;
}
} }
}); );
} }
showPerformanceAppraisal() { showPerformanceAppraisal() {
this.DS.getPerformanceAppraisal() .subscribe((result: PerformanceAppraisalResponse) => { this.DS.getPerformanceAppraisal().subscribe(
}); (result: PerformanceAppraisalResponse) => {}
);
} }
convertInSeconds(time: any) { convertInSeconds(time: any) {
const hours = parseInt(time[0], 10); const hours = parseInt(time[0], 10);
const minutes = parseInt(time[1], 10); const minutes = parseInt(time[1], 10);
let seconds = parseInt(time[2], 10); let seconds = parseInt(time[2], 10);
seconds = seconds + (hours * 60 * 60) + (minutes * 60); seconds = seconds + hours * 60 * 60 + minutes * 60;
return seconds; return seconds;
} }
convertAndAssignTime(data) { convertAndAssignTime(data) {
console.log(data); console.log(data);
this.remainingTime = this.convertInSeconds(data.P_REMAINING_HOURS.split(':')); this.remainingTime = this.convertInSeconds(
this.scheduledTime = this.convertInSeconds(data.P_SCHEDULED_HOURS.split(':')); data.P_REMAINING_HOURS.split(":")
);
this.scheduledTime = this.convertInSeconds(
data.P_SCHEDULED_HOURS.split(":")
);
this.isCheckedIn = this.remainingTime === this.scheduledTime ? false : true; this.isCheckedIn = this.remainingTime === this.scheduledTime ? false : true;
this.initTimer(); this.initTimer();
} }
showAttendanceTracking() { showAttendanceTracking() {
this.DS.getAttendanceTracking() .subscribe((result: AttendanceTrackingResponse) => { this.DS.getAttendanceTracking().subscribe(
if (this.common.validResponse(result)) { (result: AttendanceTrackingResponse) => {
const key = 'GetAttendanceTrackingList'; if (this.common.validResponse(result)) {
this.convertAndAssignTime(result[key]); const key = "GetAttendanceTrackingList";
this.convertAndAssignTime(result[key]);
}
} }
}); );
} }
openPeriodDateDashbored() { openPeriodDateDashbored() {
this.DS.getOpenPeriodDates( () => {console.log('Error '); } ).subscribe((result: OpenPeriodDatesResponse) => { this.DS.getOpenPeriodDates(() => {
console.log("Error ");
}).subscribe((result: OpenPeriodDatesResponse) => {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
console.log('response'); console.log("response");
} }
}); });
} }
openNotificationsDashbored() { // work list openNotificationsDashbored() {
this.DS.getOpenNotifications( () => { console.log('Error '); }).subscribe((result: GetOpenNotificationsResponse) => { // work list
this.DS.getOpenNotifications(() => {
console.log("Error ");
}).subscribe((result: GetOpenNotificationsResponse) => {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
const key = 'P_OPEN_NTF_NUMBER'; const key = "P_OPEN_NTF_NUMBER";
this.countAllNotification = result[key]; this.countAllNotification = result[key];
this.ITGCountAllNotification(); this.ITGCountAllNotification();
this.common.sharedService.setSharedData(result, 'worklistNotifications'); this.common.sharedService.setSharedData(
result,
"worklistNotifications"
);
} }
}); });
} }
ITGCountAllNotification(){ ITGCountAllNotification() {
this.workListService.getITGDetails() this.workListService.getITGDetails().subscribe((result: any) => {
.subscribe((result: any) => { this.statsButtons[0].statsValue =
this.statsButtons[0].statsValue = this.countAllNotification + result.TotalCount; this.countAllNotification + result.TotalCount;
}); });
} }
getSubordinatesLeaves() { getSubordinatesLeaves() {
const request: GetSubordinatesLeavesRequest = new GetSubordinatesLeavesRequest(); const request: GetSubordinatesLeavesRequest = new GetSubordinatesLeavesRequest();
request.P_DATE_FROM = '/Date(1578603600000+0300)/'; // test request.P_DATE_FROM = "/Date(1578603600000+0300)/"; // test
request.P_DATE_TO = '/Date(1576011600000+0300)/'; // test request.P_DATE_TO = "/Date(1576011600000+0300)/"; // test
this.DS.getSubordinatesLeaves( request, () => {console.log('Error '); } ).subscribe((result: GetSubordinatesLeavesResponse) => { this.DS.getSubordinatesLeaves(request, () => {
console.log("Error ");
}).subscribe((result: GetSubordinatesLeavesResponse) => {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
console.log('response'); console.log("response");
console.log(result); console.log(result);
} }
}); });
} }
getSubordinatesAttStatus() { getSubordinatesAttStatus() {
const request: GetSubordinatesAttdStatusRequest = new GetSubordinatesAttdStatusRequest(); const request: GetSubordinatesAttdStatusRequest = new GetSubordinatesAttdStatusRequest();
request.P_SCHEDULE_DATE_FROM = '/Date(1578603600000+0300)/'; // test request.P_SCHEDULE_DATE_FROM = "/Date(1578603600000+0300)/"; // test
request.P_SCHEDULE_DATE_TO = '/Date(1576011600000+0300)/'; // test request.P_SCHEDULE_DATE_TO = "/Date(1576011600000+0300)/"; // test
this.DS.getSubordinatesAttStatus( request, () => {console.log('Error '); }).subscribe((result: GetSubordinatesAttdStatusResponse) => { this.DS.getSubordinatesAttStatus(request, () => {
console.log("Error ");
}).subscribe((result: GetSubordinatesAttdStatusResponse) => {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
console.log('response'); console.log("response");
console.log(result); console.log(result);
} }
}); });
@ -571,53 +622,69 @@ export class HomePage implements OnInit {
openPage(subMenu) { openPage(subMenu) {
console.log("openPage"); console.log("openPage");
let selMenu: MenuResponse = new MenuResponse(); let selMenu: MenuResponse = new MenuResponse();
selMenu = this.common.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); selMenu = this.common.sharedService.getSharedData(
MenuResponse.SHARED_DATA,
false
);
selMenu.GetMenuEntriesList = subMenu; selMenu.GetMenuEntriesList = subMenu;
this.common.sharedService.setSharedData(selMenu, MenuResponse.SHARED_DATA); this.common.sharedService.setSharedData(selMenu, MenuResponse.SHARED_DATA);
if (subMenu.REQUEST_TYPE === 'ABSENCE') { if (subMenu.REQUEST_TYPE === "ABSENCE") {
this.common.openAbsencePage(); this.common.openAbsencePage();
} else if (subMenu.REQUEST_TYPE === 'EIT') { } else if (subMenu.REQUEST_TYPE === "EIT") {
this.common.openEitListPage(); this.common.openEitListPage();
} else if (subMenu.REQUEST_TYPE === 'PAYSLIP') { } else if (subMenu.REQUEST_TYPE === "PAYSLIP") {
this.common.openPayslipPage(); this.common.openPayslipPage();
} else if (subMenu.MENU_ENTRY_TYPE === 'MENU') { } else if (subMenu.MENU_ENTRY_TYPE === "MENU") {
this.common.sharedService.setSharedData(selMenu.GetMenuEntriesList, "menuEntries"); this.common.sharedService.setSharedData(
selMenu.GetMenuEntriesList,
"menuEntries"
);
this.common.openEITPage(); this.common.openEITPage();
} }
} }
getAccrualBalance() { getAccrualBalance() {
const today = new Date(); const today = new Date();
const day = today.getDate(); const day = today.getDate();
const month = today.getMonth() + 1; const month = today.getMonth() + 1;
const year = today.getFullYear(); const year = today.getFullYear();
const todayDate = month + '/' + day + '/' + year; const todayDate = month + "/" + day + "/" + year;
const effectiveDate = todayDate; const effectiveDate = todayDate;
const request = { const request = {
P_SELECTED_EMPLOYEE_NUMBER: this.userData.EMPLOYEE_NUMBER, P_SELECTED_EMPLOYEE_NUMBER: this.userData.EMPLOYEE_NUMBER,
P_EFFECTIVE_DATE: effectiveDate P_EFFECTIVE_DATE: effectiveDate
}; };
this.accrualService this.accrualService.getAccrualBalances(request).subscribe((result: any) => {
.getAccrualBalances(request) if (this.common.validResponse(result)) {
.subscribe((result: any) => { let totalTicketsLeft = 0;
if (this.common.validResponse(result)) { this.accrualBalancesList = result.GetAccrualBalancesList;
let totalTicketsLeft = 0; for (const accrualBalance of result.GetAccrualBalancesList) {
this.accrualBalancesList = result.GetAccrualBalancesList; if (
for (const accrualBalance of result.GetAccrualBalancesList) { accrualBalance.ACCURAL_PLAN_NAME ===
"HMG Annual Vacation Accrual Plan"
if (accrualBalance.ACCURAL_PLAN_NAME === 'HMG Annual Vacation Accrual Plan') { ) {
this.statsButtons[3].statsValue = accrualBalance.ACCRUAL_NET_ENTITLEMENT; this.statsButtons[2].statsValue =
this.common.sharedService.setSharedData( accrualBalance, 'leaveAccrualBalance'); accrualBalance.ACCRUAL_NET_ENTITLEMENT;
this.common.sharedService.setSharedData( request, 'leaveAccrualBalanceDate'); this.common.sharedService.setSharedData(
this.common.sharedService.setSharedData( this.accrualBalancesList, 'tickitsbalance') accrualBalance,
} else { "leaveAccrualBalance"
totalTicketsLeft = totalTicketsLeft + accrualBalance.ACCRUAL_NET_ENTITLEMENT; );
} this.common.sharedService.setSharedData(
} request,
this.statsButtons[4].statsValue = totalTicketsLeft; "leaveAccrualBalanceDate"
);
this.common.sharedService.setSharedData(
this.accrualBalancesList,
"tickitsbalance"
);
} else {
totalTicketsLeft =
totalTicketsLeft + accrualBalance.ACCRUAL_NET_ENTITLEMENT;
} }
}); }
this.statsButtons[3].statsValue = totalTicketsLeft;
}
});
} }
openattentracking() { openattentracking() {
@ -628,11 +695,16 @@ export class HomePage implements OnInit {
this.common.openEditProfile(); this.common.openEditProfile();
} }
openStatsButton(link: string) { openStatsButton(link: any) {
console.log(link); // console.log(link);
this.common.openPage(link); if (link == "1") {
this.common.openNotificationPage();
} else if (link == "2") {
this.openPage(this.missingSwipeRequestObject);
} else if (link == "3") {
this.openPage(this.leaveRequestObject);
} else if (link =="4") {
this.openPage(this.ticketRequestObject);
}
} }
} }

Loading…
Cancel
Save