|
|
|
|
@ -16,10 +16,9 @@ import { Response } from 'src/app/hmg-common/services/models/response';
|
|
|
|
|
import { AttendanceService } from './services/attendance.services';
|
|
|
|
|
import { LoginRequest } from '../hmg-common/services/authentication/models/login.request';
|
|
|
|
|
import {FileUploaderComponent} from '../hmg-common/ui/file-uploader/file-uploader.component'
|
|
|
|
|
import { Camera, CameraOptions,PictureSourceType} from '@ionic-native/Camera/ngx';
|
|
|
|
|
import { Camera} from '@ionic-native/Camera/ngx';
|
|
|
|
|
import { File } from '@ionic-native/file/ngx';
|
|
|
|
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
|
|
|
import {FileUploderProfileComponent} from '../hmg-common/ui/file-uploder-profile/file-uploder-profile.component'
|
|
|
|
|
import { SharedDataService } from '../hmg-common/services/shared-data-service/shared-data.service';
|
|
|
|
|
import { DevicePermissionsService } from '../hmg-common/services/device-permissions/device-permissions.service';
|
|
|
|
|
import { DashboredService } from '../hmg-common/services/dashbored/dashbored.service';
|
|
|
|
|
@ -30,9 +29,9 @@ import { AttendanceTrackingResponse } from '../hmg-common/services/dashbored/att
|
|
|
|
|
import { OpenPeriodDatesResponse } from '../hmg-common/services/dashbored/models/openPeriodDatesResponse';
|
|
|
|
|
import {GetSubordinatesAttdStatusRequest} from '../hmg-common/services/dashbored/models/GetSubordinatesAttdStatusRequest';
|
|
|
|
|
import {GetSubordinatesLeavesRequest} from '../hmg-common/services/dashbored/models/GetSubordinatesLeavesRequest'
|
|
|
|
|
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 {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'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
@ -42,7 +41,7 @@ import {GetSubordinatesLeavesResponse}from '../hmg-common/services/dashbored/mod
|
|
|
|
|
})
|
|
|
|
|
export class HomePage implements OnInit {
|
|
|
|
|
userData: any = {};
|
|
|
|
|
user_image: any = '../assets/imgs/profile.png';
|
|
|
|
|
userImage: any = '../assets/imgs/profile.png';
|
|
|
|
|
menuList: any = [];
|
|
|
|
|
zbarOptions: any;
|
|
|
|
|
scannedResult: any;
|
|
|
|
|
@ -52,7 +51,6 @@ export class HomePage implements OnInit {
|
|
|
|
|
deviceID: string;
|
|
|
|
|
public maxFileSize = 10 * 1024 * 1024;
|
|
|
|
|
public fileUploder: FileUploaderComponent;
|
|
|
|
|
// public fileUploderProfile:FileUploderProfileComponent
|
|
|
|
|
location: boolean;
|
|
|
|
|
camera: boolean;
|
|
|
|
|
public statsButtons = [
|
|
|
|
|
@ -83,43 +81,42 @@ export class HomePage implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public employeeServicesButtons = [
|
|
|
|
|
{
|
|
|
|
|
title: 'Leave Management',
|
|
|
|
|
icon: 'assets/icon/new-design/leave_management.png'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Advance Payments',
|
|
|
|
|
icon: 'assets/icon/new-design/advance_payments.png'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Medical Insurance',
|
|
|
|
|
icon: 'assets/icon/new-design/medical_insurance.png'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Pay Slip',
|
|
|
|
|
icon: 'assets/icon/new-design/pay_slip.png'
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
// public employeeServicesButtons = [
|
|
|
|
|
// {
|
|
|
|
|
// title: 'Leave Management',
|
|
|
|
|
// icon: 'assets/icon/new-design/leave_management.png'
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// title: 'Advance Payments',
|
|
|
|
|
// icon: 'assets/icon/new-design/advance_payments.png'
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// title: 'Medical Insurance',
|
|
|
|
|
// icon: 'assets/icon/new-design/medical_insurance.png'
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// title: 'Pay Slip',
|
|
|
|
|
// icon: 'assets/icon/new-design/pay_slip.png'
|
|
|
|
|
// }
|
|
|
|
|
// ];
|
|
|
|
|
|
|
|
|
|
public slideOptsOne = {
|
|
|
|
|
slidesPerView: 3.5,
|
|
|
|
|
slidesPerView: 3.5,
|
|
|
|
|
spaceBetween: 10
|
|
|
|
|
};
|
|
|
|
|
public slideOptsTwo = {
|
|
|
|
|
slidesPerView: 3.2,
|
|
|
|
|
spaceBetween: 10
|
|
|
|
|
};
|
|
|
|
|
public slideOptsTwo = {
|
|
|
|
|
slidesPerView: 3.2,
|
|
|
|
|
spaceBetween: 10
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public timeInSeconds: any = .15 * 60 * 60;
|
|
|
|
|
public time: any;
|
|
|
|
|
public runTimer = false;
|
|
|
|
|
public hasStarted = false;
|
|
|
|
|
public hasFinished = false;
|
|
|
|
|
public remainingTime: any;
|
|
|
|
|
public displayTime: any;
|
|
|
|
|
public menuEntries: any;
|
|
|
|
|
public percent: any = 100 - ((this.timeInSeconds / 32400) * 100);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
public timeInSeconds: any = 0.15 * 60 * 60;
|
|
|
|
|
public time: any;
|
|
|
|
|
public runTimer = false;
|
|
|
|
|
public hasStarted = false;
|
|
|
|
|
public hasFinished = false;
|
|
|
|
|
public remainingTime: any;
|
|
|
|
|
public displayTime: any;
|
|
|
|
|
public menuEntries: any;
|
|
|
|
|
public percent: any = 100 - ((this.timeInSeconds / 32400) * 100);
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
public ts: TranslatorService,
|
|
|
|
|
@ -131,23 +128,21 @@ public percent: any = 100 - ((this.timeInSeconds / 32400) * 100);
|
|
|
|
|
private device: Device,
|
|
|
|
|
private zbar: ZBar,
|
|
|
|
|
private geolocation: Geolocation,
|
|
|
|
|
private attendance_service: AttendanceService,
|
|
|
|
|
private attendanceService: AttendanceService,
|
|
|
|
|
private eitService: EitService,
|
|
|
|
|
private barcodeScanner: BarcodeScanner,
|
|
|
|
|
public actionSheetCtrl: ActionSheetController,
|
|
|
|
|
private cameraController: Camera,
|
|
|
|
|
public sharedData: SharedDataService,
|
|
|
|
|
private sanitizer: DomSanitizer,
|
|
|
|
|
// private transfer: Transfer,
|
|
|
|
|
private file: File,
|
|
|
|
|
// private filePath: FilePath
|
|
|
|
|
private file: File,
|
|
|
|
|
private permissions: DevicePermissionsService,
|
|
|
|
|
public DS: DashboredService
|
|
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
this.events.subscribe('img-change', displayImg => {
|
|
|
|
|
this.user_image = this.sanitizer.bypassSecurityTrustUrl('data:Image/*;base64,'+displayImg);
|
|
|
|
|
console.log('html saved img: ' + this.user_image);
|
|
|
|
|
this.userImage = this.sanitizer.bypassSecurityTrustUrl('data:Image/*;base64,' + displayImg);
|
|
|
|
|
console.log('html saved img: ' + this.userImage);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -155,10 +150,9 @@ public percent: any = 100 - ((this.timeInSeconds / 32400) * 100);
|
|
|
|
|
this.getUserDetails();
|
|
|
|
|
this.getMenu();
|
|
|
|
|
this.setServicesPrivilage();
|
|
|
|
|
this.initTimer();
|
|
|
|
|
|
|
|
|
|
// this.getCount();
|
|
|
|
|
console.log(this.percent);
|
|
|
|
|
this.initTimer();
|
|
|
|
|
// this.events.subscribe('getNotCount', badge => {
|
|
|
|
|
// this.notBadge = badge;
|
|
|
|
|
// });
|
|
|
|
|
@ -174,45 +168,40 @@ public percent: any = 100 - ((this.timeInSeconds / 32400) * 100);
|
|
|
|
|
this.startTimer();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
startTimer() {
|
|
|
|
|
this.runTimer = true;
|
|
|
|
|
this.hasStarted = true;
|
|
|
|
|
this.timerTick();
|
|
|
|
|
}
|
|
|
|
|
startTimer() {
|
|
|
|
|
this.runTimer = true;
|
|
|
|
|
this.hasStarted = true;
|
|
|
|
|
this.timerTick();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
timerTick() {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
|
|
if (!this.runTimer) { return; }
|
|
|
|
|
this.remainingTime--;
|
|
|
|
|
this.displayTime = this.getSecondsAsDigitalClock(this.remainingTime);
|
|
|
|
|
console.log(this.remainingTime);
|
|
|
|
|
console.log(Math.floor((this.remainingTime / 32400) * 100));
|
|
|
|
|
if (this.remainingTime > 0) {
|
|
|
|
|
const newPercent: any = ((this.remainingTime / 32400) * 100).toFixed(2);
|
|
|
|
|
console.log(newPercent);
|
|
|
|
|
this.percent = 100 - newPercent;
|
|
|
|
|
console.log('umar:' + this.percent);
|
|
|
|
|
this.timerTick();
|
|
|
|
|
} else {
|
|
|
|
|
this.hasFinished = true;
|
|
|
|
|
}
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
timerTick() {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
if (!this.runTimer) { return; }
|
|
|
|
|
this.remainingTime--;
|
|
|
|
|
this.displayTime = this.getSecondsAsDigitalClock(this.remainingTime);
|
|
|
|
|
if (this.remainingTime > 0) {
|
|
|
|
|
const newPercent: any = ((this.remainingTime / 32400) * 100).toFixed(2);
|
|
|
|
|
this.percent = 100 - newPercent;
|
|
|
|
|
this.timerTick();
|
|
|
|
|
} else {
|
|
|
|
|
this.hasFinished = true;
|
|
|
|
|
}
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getSecondsAsDigitalClock(inputSeconds: number) {
|
|
|
|
|
const secNum = parseInt(inputSeconds.toString(), 10); // don't forget the second param
|
|
|
|
|
const hours = Math.floor(secNum / 3600);
|
|
|
|
|
const minutes = Math.floor((secNum - (hours * 3600)) / 60);
|
|
|
|
|
const seconds = secNum - (hours * 3600) - (minutes * 60);
|
|
|
|
|
let hoursString = '';
|
|
|
|
|
let minutesString = '';
|
|
|
|
|
let secondsString = '';
|
|
|
|
|
hoursString = (hours < 10) ? '0' + hours : hours.toString();
|
|
|
|
|
minutesString = (minutes < 10) ? '0' + minutes : minutes.toString();
|
|
|
|
|
secondsString = (seconds < 10) ? '0' + seconds : seconds.toString();
|
|
|
|
|
return hoursString + ':' + minutesString + ':' + secondsString;
|
|
|
|
|
}
|
|
|
|
|
getSecondsAsDigitalClock(inputSeconds: number) {
|
|
|
|
|
const secNum = parseInt(inputSeconds.toString(), 10); // don't forget the second param
|
|
|
|
|
const hours = Math.floor(secNum / 3600);
|
|
|
|
|
const minutes = Math.floor((secNum - (hours * 3600)) / 60);
|
|
|
|
|
const seconds = secNum - (hours * 3600) - (minutes * 60);
|
|
|
|
|
let hoursString = '';
|
|
|
|
|
let minutesString = '';
|
|
|
|
|
let secondsString = '';
|
|
|
|
|
hoursString = (hours < 10) ? '0' + hours : hours.toString();
|
|
|
|
|
minutesString = (minutes < 10) ? '0' + minutes : minutes.toString();
|
|
|
|
|
secondsString = (seconds < 10) ? '0' + seconds : seconds.toString();
|
|
|
|
|
return hoursString + ':' + minutesString + ':' + secondsString;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getDeviceLocation() {
|
|
|
|
|
@ -228,8 +217,6 @@ getSecondsAsDigitalClock(inputSeconds: number) {
|
|
|
|
|
this.geolocation
|
|
|
|
|
.getCurrentPosition({ maximumAge: 3000, timeout: 10000, enableHighAccuracy: true })
|
|
|
|
|
.then(resp => {
|
|
|
|
|
// console.log(resp.coords.latitude);
|
|
|
|
|
// console.log(resp.coords.longitude);
|
|
|
|
|
this.lat = resp.coords.latitude;
|
|
|
|
|
this.longt = resp.coords.longitude;
|
|
|
|
|
this.attendance();
|
|
|
|
|
@ -244,15 +231,16 @@ getSecondsAsDigitalClock(inputSeconds: number) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setServicesPrivilage() {
|
|
|
|
|
for (let i = 0; i < AuthenticationService.servicePrivilage.length; i++)
|
|
|
|
|
if (AuthenticationService.servicePrivilage[i].Previlege == false) {
|
|
|
|
|
document.getElementById(AuthenticationService.servicePrivilage[i].ServiceName).setAttribute('disabled', 'disabled');
|
|
|
|
|
document.getElementById(AuthenticationService.servicePrivilage[i].ServiceName).style.filter = 'grayscale(1)'
|
|
|
|
|
for (const servicePrivilage of AuthenticationService.servicePrivilage) {
|
|
|
|
|
if (servicePrivilage.Previlege === false) {
|
|
|
|
|
document.getElementById(servicePrivilage.ServiceName).setAttribute('disabled', 'disabled');
|
|
|
|
|
document.getElementById(servicePrivilage.ServiceName).style.filter = 'grayscale(1)';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
getCount() {
|
|
|
|
|
|
|
|
|
|
// getCount() {
|
|
|
|
|
// const req: any = {};
|
|
|
|
|
// this.menuService.getNotificationCount(req).subscribe((result: any) => {
|
|
|
|
|
// if (this.common.validResponse(result)) {
|
|
|
|
|
@ -264,39 +252,13 @@ getSecondsAsDigitalClock(inputSeconds: number) {
|
|
|
|
|
// this.events.publish("getNotCount", this.notBadge);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
// ionViewDidLoad() {
|
|
|
|
|
// this.geolocation
|
|
|
|
|
// .getCurrentPosition()
|
|
|
|
|
// .then(resp => {
|
|
|
|
|
// // resp.coords.latitude
|
|
|
|
|
// // resp.coords.longitude
|
|
|
|
|
// console.log(resp.coords.latitude);
|
|
|
|
|
// console.log(resp.coords.longitude);
|
|
|
|
|
// })
|
|
|
|
|
// .catch(error => {
|
|
|
|
|
// console.log("Error getting location", error);
|
|
|
|
|
// });
|
|
|
|
|
// this.geolocation.getCurrentPosition().then((resp) => {
|
|
|
|
|
// // resp.coords.latitude
|
|
|
|
|
// // resp.coords.longitude
|
|
|
|
|
// console.log(resp.coords.latitude);
|
|
|
|
|
// console.log(resp.coords.longitude);
|
|
|
|
|
// }).catch((error) => {
|
|
|
|
|
// console.log('Error getting location', error);
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
ionViewDidLoad() {
|
|
|
|
|
this.getUserDetails();
|
|
|
|
|
console.log('getUserDetails');
|
|
|
|
|
this.geolocation
|
|
|
|
|
.getCurrentPosition()
|
|
|
|
|
.then(resp => {
|
|
|
|
|
// resp.coords.latitude
|
|
|
|
|
// resp.coords.longitude
|
|
|
|
|
console.log(resp.coords.latitude);
|
|
|
|
|
console.log(resp.coords.longitude);
|
|
|
|
|
this.lat = resp.coords.latitude;
|
|
|
|
|
this.longt = resp.coords.longitude;
|
|
|
|
|
})
|
|
|
|
|
@ -304,9 +266,11 @@ getSecondsAsDigitalClock(inputSeconds: number) {
|
|
|
|
|
console.log('Error getting location', error);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private openMenu() {
|
|
|
|
|
this.menu.toggle();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private getUserDetails() {
|
|
|
|
|
this.authService
|
|
|
|
|
.loadAuthenticatedUser()
|
|
|
|
|
@ -316,276 +280,236 @@ getSecondsAsDigitalClock(inputSeconds: number) {
|
|
|
|
|
this.userData = user;
|
|
|
|
|
// set User Info
|
|
|
|
|
this.sharedData.setSharedData(this.userData, AuthenticatedUser.SHARED_DATA);
|
|
|
|
|
this.user_image = user.EMPLOYEE_IMAGE
|
|
|
|
|
this.userImage = user.EMPLOYEE_IMAGE
|
|
|
|
|
? 'data:image/png;base64,' + user.EMPLOYEE_IMAGE
|
|
|
|
|
: this.user_image;
|
|
|
|
|
: this.userImage;
|
|
|
|
|
console.log(user);
|
|
|
|
|
} else {
|
|
|
|
|
console.log(user);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
public Vacation_Rule() {
|
|
|
|
|
this.common.navigateForward('/vacation-rule/home');
|
|
|
|
|
}
|
|
|
|
|
private getMenu() {
|
|
|
|
|
this.menuService.getMenu().subscribe((result: MenuResponse) => {
|
|
|
|
|
this.handleMenuResult(result);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
private handleMenuResult(result) {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
if (this.common.hasData(result.List_Menu)) {
|
|
|
|
|
console.log('list menu');
|
|
|
|
|
this.menuList = result.List_Menu;
|
|
|
|
|
console.log('umar: ' + this.menuList);
|
|
|
|
|
this.getMenuDetails();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private accrualBalance() {
|
|
|
|
|
this.common.openAccuralPage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private changeImage() {
|
|
|
|
|
this.common.openChangeImagePage();
|
|
|
|
|
}
|
|
|
|
|
public Vacation_Rule() {
|
|
|
|
|
this.common.navigateForward('/vacation-rule/home');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getMenuDetails() {
|
|
|
|
|
const item = this.menuList[0];
|
|
|
|
|
const selMenu: MenuResponse = new MenuResponse();
|
|
|
|
|
selMenu.List_Menu = item;
|
|
|
|
|
selMenu.userid = this.userData.EMPLOYEE_NUMBER;
|
|
|
|
|
console.log('menu: ' + selMenu.List_Menu);
|
|
|
|
|
this.common.sharedService.setSharedData(selMenu, MenuResponse.SHARED_DATA);
|
|
|
|
|
this.getMenuEntries(item);
|
|
|
|
|
// if (item.MENU_TYPE === 'M') {
|
|
|
|
|
// this.common.openMyTeamPage();
|
|
|
|
|
// // this.navCtrl.push("MySubordinatePage");
|
|
|
|
|
// } else if (item.MENU_TYPE === 'S') {
|
|
|
|
|
// this.common.sharedService.setSharedData(item, 'mySpecList');
|
|
|
|
|
// this.common.openMySpecialistPage();
|
|
|
|
|
// // this.navCtrl.push('MySpecialistPage',{"mySpecList":item});
|
|
|
|
|
// } else {
|
|
|
|
|
// this.getMenuEntries(item);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
private getMenu() {
|
|
|
|
|
this.menuService.getMenu().subscribe((result: MenuResponse) => {
|
|
|
|
|
this.handleMenuResult(result);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getMenuEntries(item) {
|
|
|
|
|
console.log('umar I am clicked2');
|
|
|
|
|
const request: any = {};
|
|
|
|
|
let selEmpNo: string = null;
|
|
|
|
|
let nationality: string = null;
|
|
|
|
|
request.P_SELECTED_RESP_ID = -999;
|
|
|
|
|
if (item.MENU_TYPE === 'S') {
|
|
|
|
|
request.P_SELECTED_RESP_ID = item.RESP_ID;
|
|
|
|
|
} else {
|
|
|
|
|
selEmpNo = this.common.sharedService.getSharedData(
|
|
|
|
|
LoginRequest.SHARED_DATA,
|
|
|
|
|
false
|
|
|
|
|
);
|
|
|
|
|
private handleMenuResult(result) {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
if (this.common.hasData(result.List_Menu)) {
|
|
|
|
|
console.log('list menu');
|
|
|
|
|
this.menuList = result.List_Menu;
|
|
|
|
|
this.getMenuDetails();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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) {
|
|
|
|
|
const tree = this.common.list_to_tree(list);
|
|
|
|
|
this.menuEntries = tree;
|
|
|
|
|
console.log(this.menuEntries);
|
|
|
|
|
this.common.sharedService.setSharedData(tree, 'menuEntries');
|
|
|
|
|
// this.common.navigateForward("/eit/homepage");
|
|
|
|
|
// this.common.openEITPage();
|
|
|
|
|
}
|
|
|
|
|
private accrualBalance() {
|
|
|
|
|
this.common.openAccuralPage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private handleMenuEntiresResult(result) {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
if (this.common.hasData(result.GetMenuEntriesList)) {
|
|
|
|
|
this.sortMenuEntires(result.GetMenuEntriesList);
|
|
|
|
|
}
|
|
|
|
|
private changeImage() {
|
|
|
|
|
this.common.openChangeImagePage();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Change_password() {
|
|
|
|
|
this.common.openChangePassword();
|
|
|
|
|
}
|
|
|
|
|
private openPayslip() {
|
|
|
|
|
this.common.openPayslipPage();
|
|
|
|
|
}
|
|
|
|
|
private attendance() {
|
|
|
|
|
// this.zbarOptions = {
|
|
|
|
|
// flash: "off",
|
|
|
|
|
// drawSight: false
|
|
|
|
|
// };
|
|
|
|
|
// console.log("your currnt location is");
|
|
|
|
|
// console.log("Loc");
|
|
|
|
|
this.permissions.requestCameraAutherization().then(granted => {
|
|
|
|
|
this.camera = granted as boolean;
|
|
|
|
|
if (this.camera) {
|
|
|
|
|
this.scanCode();
|
|
|
|
|
}
|
|
|
|
|
public getMenuDetails() {
|
|
|
|
|
const item = this.menuList[0];
|
|
|
|
|
const selMenu: MenuResponse = new MenuResponse();
|
|
|
|
|
selMenu.List_Menu = item;
|
|
|
|
|
selMenu.userid = this.userData.EMPLOYEE_NUMBER;
|
|
|
|
|
console.log('menu: ' + selMenu.List_Menu);
|
|
|
|
|
this.common.sharedService.setSharedData(selMenu, MenuResponse.SHARED_DATA);
|
|
|
|
|
this.getMenuEntries(item);
|
|
|
|
|
// if (item.MENU_TYPE === 'M') {
|
|
|
|
|
// this.common.openMyTeamPage();
|
|
|
|
|
// // this.navCtrl.push("MySubordinatePage");
|
|
|
|
|
// } else if (item.MENU_TYPE === 'S') {
|
|
|
|
|
// this.common.sharedService.setSharedData(item, 'mySpecList');
|
|
|
|
|
// this.common.openMySpecialistPage();
|
|
|
|
|
// // this.navCtrl.push('MySpecialistPage',{"mySpecList":item});
|
|
|
|
|
// } else {
|
|
|
|
|
// this.getMenuEntries(item);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getMenuEntries(item) {
|
|
|
|
|
const request: any = {};
|
|
|
|
|
let selEmpNo: string = null;
|
|
|
|
|
let nationality: string = null;
|
|
|
|
|
request.P_SELECTED_RESP_ID = -999;
|
|
|
|
|
if (item.MENU_TYPE === 'S') {
|
|
|
|
|
request.P_SELECTED_RESP_ID = item.RESP_ID;
|
|
|
|
|
} else {
|
|
|
|
|
selEmpNo = this.common.sharedService.getSharedData(
|
|
|
|
|
LoginRequest.SHARED_DATA,
|
|
|
|
|
false
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
scanCode() {
|
|
|
|
|
// this.zbar
|
|
|
|
|
// .scan(this.zbarOptions)
|
|
|
|
|
// .then(result => {
|
|
|
|
|
// console.log(result); // Scanned code
|
|
|
|
|
// let strResult = JSON.parse(result);
|
|
|
|
|
// console.log(strResult.QRValue);
|
|
|
|
|
// this.scannedResult = result;
|
|
|
|
|
// this.deviceID = this.device.uuid;
|
|
|
|
|
// this.swipeAttendance();
|
|
|
|
|
// })
|
|
|
|
|
// .catch(error => {
|
|
|
|
|
// alert(error); // Error message
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
this.barcodeScanner.scan().then(barcodeData => {
|
|
|
|
|
console.log('Barcode data', barcodeData);
|
|
|
|
|
// let strResult = JSON.parse(barcodeData);
|
|
|
|
|
// console.log(strResult.QRValue);
|
|
|
|
|
this.scannedResult = barcodeData;
|
|
|
|
|
this.deviceID = this.device.uuid;
|
|
|
|
|
this.swipeAttendance();
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.log('Error', err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
this.eitService
|
|
|
|
|
.getMenuEntries(request)
|
|
|
|
|
.subscribe((result: MenuResponse) => {
|
|
|
|
|
this.handleMenuEntiresResult(result);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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('request');
|
|
|
|
|
console.log(JSON.stringify(request));
|
|
|
|
|
this.attendance_service
|
|
|
|
|
.attendanceSwipeScanner(request, () => {
|
|
|
|
|
console.log('Error inside in swipe attendance');
|
|
|
|
|
})
|
|
|
|
|
.subscribe((result: Response) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
console.log('response');
|
|
|
|
|
console.log(result);
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('home', 'swipeAlertSuccess'));
|
|
|
|
|
} else {
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('home', 'swipeAlertFailed'));
|
|
|
|
|
sortMenuEntires(list) {
|
|
|
|
|
const tree = this.common.list_to_tree(list);
|
|
|
|
|
this.menuEntries = tree;
|
|
|
|
|
console.log(this.menuEntries);
|
|
|
|
|
this.common.sharedService.setSharedData(tree, 'menuEntries');
|
|
|
|
|
// this.common.navigateForward("/eit/homepage");
|
|
|
|
|
// this.common.openEITPage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private handleMenuEntiresResult(result) {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
if (this.common.hasData(result.GetMenuEntriesList)) {
|
|
|
|
|
this.sortMenuEntires(result.GetMenuEntriesList);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
openPersonalInfo() {
|
|
|
|
|
this.common.openProfile();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Change_password() {
|
|
|
|
|
this.common.openChangePassword();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*************************************Dashboards Services**********************************************************8 */
|
|
|
|
|
private openPayslip() {
|
|
|
|
|
this.common.openPayslipPage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showOrganizationSalaries(){
|
|
|
|
|
this.DS.getOrganizationSalaries() .subscribe((result: OrganizationSalariesResponse ) => {
|
|
|
|
|
private attendance() {
|
|
|
|
|
this.permissions.requestCameraAutherization().then(granted => {
|
|
|
|
|
this.camera = granted as boolean;
|
|
|
|
|
if (this.camera) {
|
|
|
|
|
this.scanCode();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});;
|
|
|
|
|
}
|
|
|
|
|
scanCode() {
|
|
|
|
|
this.barcodeScanner.scan().then(barcodeData => {
|
|
|
|
|
this.scannedResult = barcodeData;
|
|
|
|
|
this.deviceID = this.device.uuid;
|
|
|
|
|
this.swipeAttendance();
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.log('Error', err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showOpenMissingSwipes(){
|
|
|
|
|
this.DS.getOpenMissingSwipes() .subscribe((result: OpenMissingSwipesResponse) => {
|
|
|
|
|
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'));
|
|
|
|
|
} else {
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('home', 'swipeAlertFailed'));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});;
|
|
|
|
|
openPersonalInfo() {
|
|
|
|
|
this.common.openProfile();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
showPerformanceAppraisal(){
|
|
|
|
|
this.DS.getPerformanceAppraisal() .subscribe((result: PerformanceAppraisalResponse) => {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
/*************************************Dashboards Services**********************************************************8 */
|
|
|
|
|
|
|
|
|
|
showOrganizationSalaries() {
|
|
|
|
|
this.DS.getOrganizationSalaries() .subscribe((result: OrganizationSalariesResponse ) => {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
showOpenMissingSwipes() {
|
|
|
|
|
this.DS.getOpenMissingSwipes() .subscribe((result: OpenMissingSwipesResponse) => {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showAttendanceTracking(){
|
|
|
|
|
this.DS.getAttendanceTracking() .subscribe((result: AttendanceTrackingResponse) => {
|
|
|
|
|
showPerformanceAppraisal() {
|
|
|
|
|
this.DS.getPerformanceAppraisal() .subscribe((result: PerformanceAppraisalResponse) => {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});;
|
|
|
|
|
}
|
|
|
|
|
showAttendanceTracking() {
|
|
|
|
|
this.DS.getAttendanceTracking() .subscribe((result: AttendanceTrackingResponse) => {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openPeriodDateDashbored(){
|
|
|
|
|
this.DS.getOpenPeriodDates( ()=> {console.log("Error ");} ).subscribe((result:OpenPeriodDatesResponse)=>{
|
|
|
|
|
openPeriodDateDashbored() {
|
|
|
|
|
this.DS.getOpenPeriodDates( () => {console.log('Error '); } ).subscribe((result: OpenPeriodDatesResponse) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
console.log("response");
|
|
|
|
|
console.log('response');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openNotificationsDashbored(){
|
|
|
|
|
this.DS.getOpenNotifications( ()=> {console.log("Error ");} ).subscribe((result:GetOpenNotificationsResponse)=>{
|
|
|
|
|
openNotificationsDashbored() {
|
|
|
|
|
this.DS.getOpenNotifications( () => {console.log('Error '); } ).subscribe((result: GetOpenNotificationsResponse) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
console.log("response");
|
|
|
|
|
console.log('response');
|
|
|
|
|
console.log(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getSubordinatesLeaves(){
|
|
|
|
|
let request:GetSubordinatesLeavesRequest=new GetSubordinatesLeavesRequest();
|
|
|
|
|
request.P_DATE_FROM="/Date(1578603600000+0300)/"; //test
|
|
|
|
|
request.P_DATE_TO="/Date(1576011600000+0300)/"; //test
|
|
|
|
|
|
|
|
|
|
this.DS.getSubordinatesLeaves( request,()=> {console.log("Error ");} ).subscribe((result:GetSubordinatesLeavesResponse)=>{
|
|
|
|
|
const request: GetSubordinatesLeavesRequest = new GetSubordinatesLeavesRequest();
|
|
|
|
|
request.P_DATE_FROM = '/Date(1578603600000+0300)/'; // test
|
|
|
|
|
request.P_DATE_TO = '/Date(1576011600000+0300)/'; // test
|
|
|
|
|
this.DS.getSubordinatesLeaves( request, () => {console.log('Error '); } ).subscribe((result: GetSubordinatesLeavesResponse) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
console.log("response");
|
|
|
|
|
console.log('response');
|
|
|
|
|
console.log(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getSubordinatesAttStatus(){
|
|
|
|
|
let request: GetSubordinatesAttdStatusRequest = new GetSubordinatesAttdStatusRequest();
|
|
|
|
|
request.P_SCHEDULE_DATE_FROM="/Date(1578603600000+0300)/"; //test
|
|
|
|
|
request.P_SCHEDULE_DATE_TO="/Date(1576011600000+0300)/";//test
|
|
|
|
|
|
|
|
|
|
this.DS.getSubordinatesAttStatus( request,()=> {console.log("Error ");} ).subscribe((result:GetSubordinatesAttdStatusResponse)=>{
|
|
|
|
|
getSubordinatesAttStatus() {
|
|
|
|
|
const request: GetSubordinatesAttdStatusRequest = new GetSubordinatesAttdStatusRequest();
|
|
|
|
|
request.P_SCHEDULE_DATE_FROM = '/Date(1578603600000+0300)/'; // test
|
|
|
|
|
request.P_SCHEDULE_DATE_TO = '/Date(1576011600000+0300)/'; // test
|
|
|
|
|
this.DS.getSubordinatesAttStatus( request, () => {console.log('Error '); }).subscribe((result: GetSubordinatesAttdStatusResponse) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
console.log("response");
|
|
|
|
|
console.log('response');
|
|
|
|
|
console.log(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|