|
|
|
|
@ -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() {
|
|
|
|
|
@ -112,43 +112,40 @@ export class AttendanceOptionsComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public setServicesPrivilage() {
|
|
|
|
|
for (const servicePrivilage of AuthenticationService.servicePrivilage) {
|
|
|
|
|
if (
|
|
|
|
|
servicePrivilage.Previlege &&
|
|
|
|
|
servicePrivilage.ServiceName === "enableNFC"
|
|
|
|
|
) {
|
|
|
|
|
this.serviceEnableNFC = true;
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
servicePrivilage.Previlege &&
|
|
|
|
|
servicePrivilage.ServiceName === "enableQR"
|
|
|
|
|
) {
|
|
|
|
|
this.serviceEnableQR = true;
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
servicePrivilage.Previlege &&
|
|
|
|
|
servicePrivilage.ServiceName === "enableWIFI"
|
|
|
|
|
) {
|
|
|
|
|
this.serviceEnableWifi = true;
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
servicePrivilage.Previlege &&
|
|
|
|
|
servicePrivilage.ServiceName === "enableLocationQR"
|
|
|
|
|
) {
|
|
|
|
|
this.enableLocationQR = true;
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
servicePrivilage.Previlege &&
|
|
|
|
|
servicePrivilage.ServiceName === "enableLocationNFC"
|
|
|
|
|
) {
|
|
|
|
|
this.enableLocationNFC = true;
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
servicePrivilage.Previlege &&
|
|
|
|
|
servicePrivilage.ServiceName === "enableLocationWIFI"
|
|
|
|
|
) {
|
|
|
|
|
this.enableLocationWIFI = true;
|
|
|
|
|
try {
|
|
|
|
|
for (const servicePrivilage of AuthenticationService.servicePrivilage) {
|
|
|
|
|
if (servicePrivilage.Previlege && servicePrivilage.ServiceName === "enableNFC") {
|
|
|
|
|
this.serviceEnableNFC = true;
|
|
|
|
|
}
|
|
|
|
|
if (servicePrivilage.Previlege && servicePrivilage.ServiceName === "enableQR") {
|
|
|
|
|
this.serviceEnableQR = true;
|
|
|
|
|
}
|
|
|
|
|
if (servicePrivilage.Previlege && servicePrivilage.ServiceName === "enableWIFI") {
|
|
|
|
|
this.serviceEnableWifi = true;
|
|
|
|
|
}
|
|
|
|
|
if (servicePrivilage.Previlege && servicePrivilage.ServiceName === "enableLocationQR") {
|
|
|
|
|
this.enableLocationQR = true;
|
|
|
|
|
}
|
|
|
|
|
if (servicePrivilage.Previlege && servicePrivilage.ServiceName === "enableLocationNFC") {
|
|
|
|
|
this.enableLocationNFC = true;
|
|
|
|
|
}
|
|
|
|
|
if (servicePrivilage.Previlege && servicePrivilage.ServiceName === "enableLocationWIFI") {
|
|
|
|
|
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.sharedService.setSharedData(false, 'enableFirestore');
|
|
|
|
|
this.common.stopLoading();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
this.common.stopLoading();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -165,19 +162,17 @@ export class AttendanceOptionsComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async nfcModal() {
|
|
|
|
|
const firestoreDocument = this.common.sharedService.getSharedData('firebase-document', false);
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: NfcModalComponent,
|
|
|
|
|
showBackdrop: true,
|
|
|
|
|
backdropDismiss: true,
|
|
|
|
|
componentProps:{ enableLocationNFC: this.enableLocationNFC, lat: this.lat, longt: this.longt, isDocumentAvailable: firestoreDocument.isDocumentAvailable},
|
|
|
|
|
componentProps:{ enableLocationNFC: this.enableLocationNFC, lat: this.lat, longt: this.longt},
|
|
|
|
|
});
|
|
|
|
|
modal.cssClass = "nfc-modal";
|
|
|
|
|
await modal.present();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public swipeAttendanceNFC(nfcSerialCode: any) {
|
|
|
|
|
const firestoreDocument = this.common.sharedService.getSharedData('firebase-document', false);
|
|
|
|
|
const request: attendanceSwipeScannerRequest = new attendanceSwipeScannerRequest();
|
|
|
|
|
request.PointType = 2;
|
|
|
|
|
request.Latitude = this.lat;
|
|
|
|
|
@ -192,7 +187,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);
|
|
|
|
|
}
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
this.ngZone.run(() => {
|
|
|
|
|
this.nfcIOSSuccess = true;
|
|
|
|
|
|