diff --git a/Mohem/config.xml b/Mohem/config.xml
index 4cdb7a4f..f401fc25 100644
--- a/Mohem/config.xml
+++ b/Mohem/config.xml
@@ -99,6 +99,9 @@
+
+
+
diff --git a/Mohem/package-lock.json b/Mohem/package-lock.json
index c3c11cf2..1e98e603 100644
--- a/Mohem/package-lock.json
+++ b/Mohem/package-lock.json
@@ -790,11 +790,18 @@
}
},
"@ionic-native/barcode-scanner": {
- "version": "5.8.0",
- "resolved": "https://registry.npmjs.org/@ionic-native/barcode-scanner/-/barcode-scanner-5.8.0.tgz",
- "integrity": "sha512-fypCb/8MikdTPaUl+oAtK+abrdgWnsYk3FtN3HPcNU4VB53QtBrx4LFC0l9xXD9rW8S7S0Xr2uHogtzhbh1bdg==",
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/@ionic-native/barcode-scanner/-/barcode-scanner-5.14.0.tgz",
+ "integrity": "sha512-FwTHQD5TUaR441V76IoXQmrSdz7AZ/qBfrfh/rDaXWgYHg7iJA3prOlBPCW+YGfLV3qvlRJeq/ASub/JkTBDrg==",
"requires": {
"@types/cordova": "^0.0.34"
+ },
+ "dependencies": {
+ "@types/cordova": {
+ "version": "0.0.34",
+ "resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
+ "integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
+ }
}
},
"@ionic-native/ble": {
@@ -1454,9 +1461,7 @@
"abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
- "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
- "dev": true,
- "optional": true
+ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
},
"accepts": {
"version": "1.3.7",
@@ -7435,8 +7440,7 @@
"interpret": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz",
- "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==",
- "dev": true
+ "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw=="
},
"invariant": {
"version": "2.2.4",
@@ -9566,8 +9570,7 @@
"os-homedir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
- "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
- "dev": true
+ "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M="
},
"os-locale": {
"version": "1.4.0",
@@ -9582,14 +9585,12 @@
"os-tmpdir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
- "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
- "dev": true
+ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
},
"osenv": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz",
"integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
- "dev": true,
"requires": {
"os-homedir": "^1.0.0",
"os-tmpdir": "^1.0.0"
@@ -9907,8 +9908,7 @@
"path-parse": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
- "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
- "dev": true
+ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
},
"path-to-regexp": {
"version": "0.1.7",
@@ -9958,6 +9958,26 @@
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
"dev": true
},
+ "phonegap-plugin-barcodescanner": {
+ "version": "8.1.0",
+ "resolved": "https://registry.npmjs.org/phonegap-plugin-barcodescanner/-/phonegap-plugin-barcodescanner-8.1.0.tgz",
+ "integrity": "sha512-WQCDCoH9EQ9WEn2bce+B95jbNJduilAn2Vtske8KfcYAeGu7bdFqRD7zGCLCQao62VwoEwlX0cUvbQ/am12Jwg==",
+ "requires": {
+ "nopt": "^4.0.1",
+ "shelljs": "^0.8.3"
+ },
+ "dependencies": {
+ "nopt": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz",
+ "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=",
+ "requires": {
+ "abbrev": "1",
+ "osenv": "^0.1.4"
+ }
+ }
+ }
+ },
"phonegap-plugin-multidex": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/phonegap-plugin-multidex/-/phonegap-plugin-multidex-1.0.0.tgz",
@@ -10539,7 +10559,6 @@
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
"integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=",
- "dev": true,
"requires": {
"resolve": "^1.1.6"
}
@@ -10724,7 +10743,6 @@
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz",
"integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==",
- "dev": true,
"requires": {
"path-parse": "^1.0.6"
}
@@ -11184,7 +11202,6 @@
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.3.tgz",
"integrity": "sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==",
- "dev": true,
"requires": {
"glob": "^7.0.0",
"interpret": "^1.0.0",
diff --git a/Mohem/package.json b/Mohem/package.json
index 5ea1cd1e..f2ce5242 100755
--- a/Mohem/package.json
+++ b/Mohem/package.json
@@ -26,7 +26,7 @@
"@ionic-native/app-rate": "^5.8.0",
"@ionic-native/background-geolocation": "^5.4.0",
"@ionic-native/badge": "^5.8.0",
- "@ionic-native/barcode-scanner": "^5.8.0",
+ "@ionic-native/barcode-scanner": "^5.14.0",
"@ionic-native/ble": "^5.8.0",
"@ionic-native/call-number": "^5.8.0",
"@ionic-native/camera": "^5.8.0",
@@ -83,6 +83,7 @@
"mx.ferreyra.callnumber": "0.0.2",
"ng2-file-upload": "^1.3.0",
"ng2-pdf-viewer": "^5.3.2",
+ "phonegap-plugin-barcodescanner": "^8.1.0",
"phonegap-plugin-multidex": "^1.0.0",
"primeicons": "^1.0.0",
"primeng": "^7.1.3",
@@ -141,7 +142,10 @@
"call-number": {},
"cordova-sms-plugin": {},
"cordova-plugin-datepicker": {},
- "cordova-plugin-geolocation": {}
+ "cordova-plugin-geolocation": {},
+ "phonegap-plugin-barcodescanner": {
+ "ANDROID_SUPPORT_V4_VERSION": "27.+"
+ }
},
"platforms": [
"browser",
diff --git a/Mohem/src/app/home/home.module.ts b/Mohem/src/app/home/home.module.ts
index 603eccc5..58e6cd52 100644
--- a/Mohem/src/app/home/home.module.ts
+++ b/Mohem/src/app/home/home.module.ts
@@ -5,6 +5,7 @@ import { Routes, RouterModule } from '@angular/router';
import { HmgCommonModule } from '../hmg-common/hmg-common.module';
import { IonicModule } from '@ionic/angular';
import { HomePage } from './home.page';
+import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx';
const routes: Routes = [
{
@@ -23,6 +24,9 @@ const routes: Routes = [
],
declarations: [
HomePage
+ ],
+ providers:[
+ BarcodeScanner
]
})
export class HomePageModule { }
diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts
index 55dbb8c0..c881ff58 100644
--- a/Mohem/src/app/home/home.page.ts
+++ b/Mohem/src/app/home/home.page.ts
@@ -9,6 +9,7 @@ import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-respo
import { CommonService } from "src/app/hmg-common/services/common/common.service";
import { Geolocation } from "@ionic-native/geolocation/ngx";
import { ZBar, ZBarOptions } from "@ionic-native/zbar/ngx";
+import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx';
import { Device } from "@ionic-native/device/ngx";
import { attendanceSwipeScannerRequest } from "./models/attendanceSwipe.Request";
import { Response } from "src/app/hmg-common/services/models/response";
@@ -41,7 +42,8 @@ export class HomePage implements OnInit {
private zbar: ZBar,
private geolocation: Geolocation,
private attendance_service: AttendanceService,
- private eitService: EitService
+ private eitService: EitService,
+ private barcodeScanner: BarcodeScanner
) { }
ngOnInit() {
@@ -225,10 +227,10 @@ export class HomePage implements OnInit {
this.common.openChangePassword();
}
private attendance() {
- this.zbarOptions = {
- flash: "off",
- drawSight: false
- };
+ // this.zbarOptions = {
+ // flash: "off",
+ // drawSight: false
+ // };
//console.log("your currnt location is");
//console.log("Loc");
@@ -236,26 +238,37 @@ export class HomePage implements OnInit {
}
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.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(error => {
- alert(error); // Error message
- });
+ }).catch(err => {
+ console.log('Error', err);
+ });
}
swipeAttendance() {
let request: attendanceSwipeScannerRequest = new attendanceSwipeScannerRequest();
request.Latitude = this.lat;
request.Longitude = this.longt;
- request.QRValue = this.scannedResult;
+ request.QRValue = this.scannedResult.text;
request.UID = this.deviceID;
request.UserName = this.userData.EMPLOYEE_NUMBER;
console.log("request");