|
|
|
@ -136,9 +136,25 @@ export class AttendScanService {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fakeSwipeAttendance() {
|
|
|
|
|
|
|
|
const request: any = {};
|
|
|
|
|
|
|
|
request.Latitude = this.lat;
|
|
|
|
|
|
|
|
request.Longitude = this.longt;
|
|
|
|
|
|
|
|
request.QRValue = this.scannedResult.text;
|
|
|
|
|
|
|
|
request.NFCValue = '';
|
|
|
|
|
|
|
|
request.WIFIValue = '';
|
|
|
|
|
|
|
|
request.UID = this.deviceID;
|
|
|
|
|
|
|
|
request.EmployeeID = this.userData.EMPLOYEE_NUMBER;
|
|
|
|
|
|
|
|
this.attendance_service.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'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async checkFirestoreDocument(userID : string) {
|
|
|
|
public async checkFirestoreDocument(userID : string) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
let result = {};
|
|
|
|
let result = {};
|
|
|
|
await this.firebasex.fetchDocumentInFirestoreCollection(userID, this.collection, (document: any) => {
|
|
|
|
await this.firebasex.fetchDocumentInFirestoreCollection(userID, this.collection, (document: any) => {
|
|
|
|
console.log("Successfully Fetched the document with id =");
|
|
|
|
console.log("Successfully Fetched the document with id =");
|
|
|
|
@ -157,26 +173,14 @@ export class AttendScanService {
|
|
|
|
this.common.sharedService.setSharedData(result, 'firebase-document');
|
|
|
|
this.common.sharedService.setSharedData(result, 'firebase-document');
|
|
|
|
this.common.stopLoading();
|
|
|
|
this.common.stopLoading();
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
} catch(error) {
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
this.common.stopLoading();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fakeSwipeAttendance() {
|
|
|
|
|
|
|
|
const request: any = {};
|
|
|
|
|
|
|
|
request.Latitude = this.lat;
|
|
|
|
|
|
|
|
request.Longitude = this.longt;
|
|
|
|
|
|
|
|
request.QRValue = this.scannedResult.text;
|
|
|
|
|
|
|
|
request.NFCValue = '';
|
|
|
|
|
|
|
|
request.WIFIValue = '';
|
|
|
|
|
|
|
|
request.UID = this.deviceID;
|
|
|
|
|
|
|
|
request.EmployeeID = this.userData.EMPLOYEE_NUMBER;
|
|
|
|
|
|
|
|
this.attendance_service.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'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public updateFirebaseDocument(resultObject: any) {
|
|
|
|
public updateFirebaseDocument(resultObject: any) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
let currentFirebaseDocument = this.common.sharedService.getSharedData('firebase-document');
|
|
|
|
let currentFirebaseDocument = this.common.sharedService.getSharedData('firebase-document');
|
|
|
|
let currentSwipeArray = currentFirebaseDocument.document.swipeData;
|
|
|
|
let currentSwipeArray = currentFirebaseDocument.document.swipeData;
|
|
|
|
currentSwipeArray.push(resultObject);
|
|
|
|
currentSwipeArray.push(resultObject);
|
|
|
|
@ -189,9 +193,13 @@ export class AttendScanService {
|
|
|
|
}, (error) => {
|
|
|
|
}, (error) => {
|
|
|
|
console.error("Error adding document: " + error);
|
|
|
|
console.error("Error adding document: " + error);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public processFirebaseDocument(mode: string, result: any, isDocumentAvailable: boolean) {
|
|
|
|
public processFirebaseDocument(mode: string, result: any, isDocumentAvailable: boolean) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
console.log(mode);
|
|
|
|
console.log(mode);
|
|
|
|
console.log(result);
|
|
|
|
console.log(result);
|
|
|
|
console.log(isDocumentAvailable);
|
|
|
|
console.log(isDocumentAvailable);
|
|
|
|
@ -210,6 +218,9 @@ export class AttendScanService {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.createNewDocument(resultObject);
|
|
|
|
this.createNewDocument(resultObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public createNewDocument(resultObject: any) {
|
|
|
|
public createNewDocument(resultObject: any) {
|
|
|
|
|