|
|
|
|
@ -62,6 +62,7 @@ export class HomePage implements OnInit {
|
|
|
|
|
missingSwipeRequestObject: any;
|
|
|
|
|
public isShow = false;
|
|
|
|
|
public showVcationRule = false;
|
|
|
|
|
public isFakeLocationUsed = false;
|
|
|
|
|
public statsButtons = [
|
|
|
|
|
{
|
|
|
|
|
title: this.ts.trPK('attendance-tracking', 'title'),
|
|
|
|
|
@ -248,14 +249,12 @@ export class HomePage implements OnInit {
|
|
|
|
|
this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {
|
|
|
|
|
if (this.platform.is('android')) {
|
|
|
|
|
if (resp && (resp.latitude && resp.longitude)) {
|
|
|
|
|
console.log(resp);
|
|
|
|
|
if (resp.isFromMockProvider || resp.mockLocationsEnabled) {
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('home', 'fake-location'));
|
|
|
|
|
} else {
|
|
|
|
|
this.lat = resp.latitude;
|
|
|
|
|
this.longt = resp.longitude;
|
|
|
|
|
this.attendance();
|
|
|
|
|
this.isFakeLocationUsed = true;
|
|
|
|
|
}
|
|
|
|
|
this.lat = resp.latitude;
|
|
|
|
|
this.longt = resp.longitude;
|
|
|
|
|
this.attendance();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (resp && (resp.latitude && resp.longitude)) {
|
|
|
|
|
@ -507,7 +506,11 @@ export class HomePage implements OnInit {
|
|
|
|
|
if (!barcodeData.cancelled) {
|
|
|
|
|
this.scannedResult = barcodeData;
|
|
|
|
|
this.deviceID = this.device.uuid;
|
|
|
|
|
this.swipeAttendance();
|
|
|
|
|
if (this.isFakeLocationUsed) {
|
|
|
|
|
this.fakeSwipeAttendance();
|
|
|
|
|
} else {
|
|
|
|
|
this.swipeAttendance();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(err => {
|
|
|
|
|
@ -515,6 +518,21 @@ export class HomePage implements OnInit {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fakeSwipeAttendance() {
|
|
|
|
|
const request: any = {};
|
|
|
|
|
request.Latitude = this.lat;
|
|
|
|
|
request.Longitude = this.longt;
|
|
|
|
|
request.QRValue = this.scannedResult.text;
|
|
|
|
|
request.UID = this.deviceID;
|
|
|
|
|
request.EmployeeID = this.userData.EMPLOYEE_NUMBER;
|
|
|
|
|
this.attendanceService.fakeAttendanceSwipeScanner(request, () => {console.log('Error inside in swipe attendance');})
|
|
|
|
|
.subscribe((result: Response) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('home', 'fake-location'));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
swipeAttendance() {
|
|
|
|
|
const request: attendanceSwipeScannerRequest = new attendanceSwipeScannerRequest();
|
|
|
|
|
request.Latitude = this.lat;
|
|
|
|
|
@ -531,9 +549,6 @@ export class HomePage implements OnInit {
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('home', 'swipeAlertSuccess'));
|
|
|
|
|
this.showAttendanceTracking();
|
|
|
|
|
}
|
|
|
|
|
// else {
|
|
|
|
|
// this.common.presentAlert(this.ts.trPK('home', 'swipeAlertFailed'));
|
|
|
|
|
// }
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -720,6 +735,7 @@ openattentracking() {
|
|
|
|
|
openStatsButton(link: any) {
|
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
|
if (link == '0') {
|
|
|
|
|
this.isFakeLocationUsed = false;
|
|
|
|
|
this.getDeviceLocation();
|
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
|
} else if (link == '1') {
|
|
|
|
|
|