added firestore check in attendance

enad-Q1
umasoodch 4 years ago
parent f326278951
commit 7c45935cb5

@ -239,6 +239,8 @@ export class AttendScanService {
public swipeAttendance() {
const firestoreDocument = this.common.sharedService.getSharedData('firebase-document', false);
const isPlatformValue = this.platform.is('ios') ? 'QR-IOS' : 'QR-ANDROID';
const enableFirestore = this.common.sharedService.getSharedData('enableFirestore', false);
const request: attendanceSwipeScannerRequest = new attendanceSwipeScannerRequest();
request.PointType = 1;
request.Latitude = this.lat;
@ -255,7 +257,9 @@ export class AttendScanService {
console.log('Error inside in swipe attendance');
})
.subscribe((result: Response) => {
this.processFirebaseDocument(isPlatformValue, result, firestoreDocument.isDocumentAvailable);
if (enableFirestore) {
this.processFirebaseDocument(isPlatformValue, result, firestoreDocument.isDocumentAvailable);
}
if (this.common.validResponse(result)) {
console.log('response');
console.log(result);

@ -37,6 +37,7 @@ export class AttendanceOptionsComponent implements OnInit {
public enableLocationQR = false;
public enableLocationNFC = false;
public enableLocationWIFI = false;
public enableFirestore = false;
public deviceNFC = false;
public nfcIOSSuccess = false;
public lat = 0;
@ -75,7 +76,6 @@ export class AttendanceOptionsComponent implements OnInit {
this.priviligeList = AuthenticationService.servicePrivilage;
this.setServicesPrivilage();
this.checkNFCStatus("one");
this.checkFirebaseDocument();
}
public checkFirebaseDocument() {
@ -149,6 +149,18 @@ export class AttendanceOptionsComponent implements OnInit {
) {
this.enableLocationWIFI = true;
}
if (
servicePrivilage.Previlege &&
servicePrivilage.ServiceName === "enableFirestore"
) {
this.enableFirestore = true;
this.common.sharedService.setSharedData(true, 'enableFirestore');
this.checkFirebaseDocument();
} else {
this.enableFirestore = false;
this.common.stopLoading();
}
}
}
@ -192,7 +204,9 @@ export class AttendanceOptionsComponent implements OnInit {
console.log("Error inside in swipe attendance");
})
.subscribe((result: Response) => {
this.attendScanService.processFirebaseDocument('NFC-IOS', result, firestoreDocument.isDocumentAvailable);
if (this.enableFirestore) {
this.attendScanService.processFirebaseDocument('NFC-IOS', result, firestoreDocument.isDocumentAvailable);
}
if (this.common.validResponse(result)) {
this.ngZone.run(() => {
this.nfcIOSSuccess = true;

@ -60,6 +60,7 @@ export class NfcModalComponent implements OnInit {
public swipeAttendanceNFC (nfcSerialCode: any) {
this.nfcReader.unsubscribe();
const enableFirestore = this.common.sharedService.getSharedData('enableFirestore', false);
const request: attendanceSwipeScannerRequest = new attendanceSwipeScannerRequest();
request.PointType = 2;
request.Latitude = this.lat;
@ -73,7 +74,9 @@ export class NfcModalComponent implements OnInit {
console.log('Error inside in swipe attendance');
this.modalController.dismiss();
}).subscribe((result: Response) => {
this.attendScanService.processFirebaseDocument('NFC-ANDROID', result, this.isDocumentAvailable);
if (enableFirestore) {
this.attendScanService.processFirebaseDocument('NFC-ANDROID', result, this.isDocumentAvailable);
}
if (this.common.validResponse(result)) {
this.ngZone.run(() => {
this.gifStatus = true;

@ -138,7 +138,9 @@ export class WifiModalComponent implements OnInit {
async swipeAttendanceWifi(code:any) {
const firestoreDocument = this.common.sharedService.getSharedData('firebase-document', false);
const isPlatformValue = this.platform.is('ios') ? 'WIFI-IOS' : 'WIFI-ANDROID';
const isPlatformValue = this.platform.is('ios') ? 'WIFI-IOS' : 'WIFI-ANDROID';
const enableFirestore = this.common.sharedService.getSharedData('enableFirestore', false);
const request: attendanceSwipeScannerRequest = new attendanceSwipeScannerRequest();
request.PointType = 3;
request.Latitude = this.lat;
@ -157,7 +159,9 @@ export class WifiModalComponent implements OnInit {
this.disconnectWifi();
})
.subscribe((result: Response) => {
this.attendScanService.processFirebaseDocument(isPlatformValue, result, firestoreDocument.isDocumentAvailable);
if (enableFirestore) {
this.attendScanService.processFirebaseDocument(isPlatformValue, result, firestoreDocument.isDocumentAvailable);
}
this.disconnectWifi();
if (this.common.validResponse(result)) {
this.ngZone.run(() => {

Loading…
Cancel
Save