haroon amjad 7 years ago
commit 8625ffcfca

@ -13,6 +13,7 @@
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="28" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
@ -84,6 +85,14 @@
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^4.0.0" />
<plugin name="cordova-plugin-cszbar" spec="1.3.4" />
<plugin name="cordova-plugin-geolocation" spec="4.0.1">
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value="To fetch location for marking attendance" />
</plugin>
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-android-support-gradle-release" spec="^3.0.1">
<variable name="ANDROID_SUPPORT_VERSION" value="27.+" />
</plugin>
<plugin name="call-number" spec="^1.0.1" />
<plugin name="cordova-android-support-gradle-release" spec="^2.1.0" />
<plugin name="phonegap-plugin-push" spec="2.2.3">
@ -97,7 +106,6 @@
<plugin name="cordova-plugin-themeablebrowser" spec="^0.2.18" />
<plugin name="cordova-plugin-inappbrowser" spec="^3.0.0" />
<plugin name="cordova-plugin-globalization" spec="^1.11.0" />
<plugin name="cordova-plugin-android-permissions" spec="^1.0.0" />
<plugin name="cordova-plugin-sms-receive" spec="^1.0.2" />
<plugin name="cordova-plugin-device" spec="^2.0.2" />
<plugin name="cordova-plugin-local-notification" spec="^0.9.0-beta.2" />

@ -871,6 +871,14 @@
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/geolocation": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@ionic-native/geolocation/-/geolocation-5.8.0.tgz",
"integrity": "sha512-b6eQ+G4h228u60Wk+c70EKqjqeY+WOi/UlRs3F+8sREJhmlVtfd1NJfpiNWsn4CnoxNSwvkt+mjiAwygBgZ5BA==",
"requires": {
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/globalization": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@ionic-native/globalization/-/globalization-5.8.0.tgz",
@ -995,6 +1003,11 @@
}
}
},
"@ionic-native/zbar": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@ionic-native/zbar/-/zbar-5.8.0.tgz",
"integrity": "sha512-G6dzorQJA83U2DgHHfJI4r3wt+h0ahMDy9V2bXmT3KS1K7CK2ZXj8ULQUQaWlc/TZXa2GFyrsrGXPdhjVfg7wg==",
},
"@ionic-native/themeable-browser": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@ionic-native/themeable-browser/-/themeable-browser-5.8.0.tgz",
@ -3257,6 +3270,15 @@
}
}
},
"cordova-android-support-gradle-release": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/cordova-android-support-gradle-release/-/cordova-android-support-gradle-release-3.0.1.tgz",
"integrity": "sha512-RSW55DkSckmqhX/kjj+a1YeVdy7s/AtlZn6Qa5XMQmmA4Iogq+IF2jvInZqzCF19DbI5YE95AP7VDbRk+DdDRw==",
"requires": {
"q": "^1.4.1",
"semver": "5.6.0"
}
},
"cordova-browser": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/cordova-browser/-/cordova-browser-5.0.4.tgz",
@ -4399,6 +4421,11 @@
"resolved": "https://registry.npmjs.org/cordova-plugin-compat/-/cordova-plugin-compat-1.2.0.tgz",
"integrity": "sha1-C8ZXVyduvZIMASzpIOJ0F3V2Nz4="
},
"cordova-plugin-cszbar": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/cordova-plugin-cszbar/-/cordova-plugin-cszbar-1.3.4.tgz",
"integrity": "sha1-+0mTGSPjVjwNTJaVaawGAsXz62o="
},
"cordova-plugin-device": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/cordova-plugin-device/-/cordova-plugin-device-2.0.2.tgz",
@ -4417,6 +4444,11 @@
"cordova-plugin-add-swift-support": "^2.0.2"
}
},
"cordova-plugin-geolocation": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/cordova-plugin-geolocation/-/cordova-plugin-geolocation-4.0.1.tgz",
"integrity": "sha1-RwP6ZJ0kBdJamnMsmev4aHVKLAQ="
},
"cordova-plugin-globalization": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-globalization/-/cordova-plugin-globalization-1.11.0.tgz",
@ -4478,17 +4510,17 @@
"integrity": "sha512-DdRf1zdJkwC9BJ3fVg2yx/faoW5eOscg6oFIWODfOIBu5AQ1oV6+gsGTO5pHVLBzlt5V8U9zG9PwhR1IbnW/EQ=="
},
"cordova-sqlite-storage": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/cordova-sqlite-storage/-/cordova-sqlite-storage-3.2.0.tgz",
"integrity": "sha512-++qDuswavJ6k9zvoG2rAGmkvvzBO0sUWwh2Ccs64/Fj+CV8pmED76crq3/Lj2myDFqwuJ1LnMIlmXIlb5dAaxg==",
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/cordova-sqlite-storage/-/cordova-sqlite-storage-3.2.1.tgz",
"integrity": "sha512-UC27DdyB/nji8o3mLEPoyo2hkZBtfVdT8CJVw9a6B/S9SbeqmkcwFFxUXxv62JgLgXHzNn0gg3ZtzxVGaY909g==",
"requires": {
"cordova-sqlite-storage-dependencies": "2.0.0"
"cordova-sqlite-storage-dependencies": "2.0.1"
}
},
"cordova-sqlite-storage-dependencies": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/cordova-sqlite-storage-dependencies/-/cordova-sqlite-storage-dependencies-2.0.0.tgz",
"integrity": "sha512-aYD5Cn1TJwgPmpZhQUYq4gOv5t+imzIxGo4SVa/fwEB/pLhiahi+2xK5gLd79YHrz6WdzFBr/126UPXhlSqRWA=="
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/cordova-sqlite-storage-dependencies/-/cordova-sqlite-storage-dependencies-2.0.1.tgz",
"integrity": "sha512-PJvFBCw8xRcYm2PxIppk0X0UTxhTc3TO4vizdasQwV/8XnxT2cjNN5bG4QBPoiL1qzpV0pTbdNJ75D0MzY6lXw=="
},
"cordova.plugins.diagnostic": {
"version": "4.0.12",
@ -6161,9 +6193,9 @@
},
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"dev": true
"bundled": true,
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@ -6613,9 +6645,9 @@
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
"bundled": true,
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@ -6678,6 +6710,7 @@
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -6724,15 +6757,15 @@
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
"bundled": true,
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz",
"integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
"dev": true
"bundled": true,
"dev": true,
"optional": true
}
}
},
@ -10854,8 +10887,7 @@
"semver": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz",
"integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==",
"dev": true
"integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg=="
},
"semver-dsl": {
"version": "1.0.1",

@ -25,6 +25,7 @@
"@ionic-native/app-availability": "^5.8.0",
"@ionic-native/app-rate": "^5.8.0",
"@ionic-native/background-geolocation": "^5.4.0",
"@ionic-native/geolocation": "^5.8.0",
"@ionic-native/badge": "^5.8.0",
"@ionic-native/barcode-scanner": "^5.8.0",
"@ionic-native/ble": "^5.8.0",
@ -41,12 +42,14 @@
"@ionic-native/launch-navigator": "^5.8.0",
"@ionic-native/local-notifications": "^5.8.0",
"@ionic-native/native-storage": "^5.8.0",
"@ionic-native/push": "^5.8.0",
"@ionic-native/sms": "^5.8.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/sqlite": "^5.8.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic-native/themeable-browser": "^5.8.0",
"@ionic-native/themeable-browser": "^5.5.1",
"@ionic-native/zbar": "^5.8.0",
"@ionic/angular": "^4.1.0",
"@ng-bootstrap/ng-bootstrap": "^4.2.1",
"@swimlane/ngx-charts": "^10.1.0",
@ -54,7 +57,7 @@
"call-number": "^1.0.1",
"chart.js": "^2.8.0",
"cordova-android": "7.1.4",
"cordova-android-support-gradle-release": "^2.1.0",
"cordova-android-support-gradle-release": "^3.0.1",
"cordova-browser": "5.0.4",
"cordova-ios": "4.5.5",
"cordova-opentok-android-permissions": "^1.0.1",
@ -67,9 +70,11 @@
"cordova-plugin-ble-central": "^1.2.2",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-cszbar": "1.3.4",
"cordova-plugin-device": "2.0.2",
"cordova-plugin-dialogs": "^2.0.1",
"cordova-plugin-fingerprint-aio": "^1.7.0",
"cordova-plugin-geolocation": "4.0.1",
"cordova-plugin-globalization": "^1.11.0",
"cordova-plugin-inappbrowser": "^3.0.0",
"cordova-plugin-ionic-keyboard": "^2.1.3",
@ -82,7 +87,7 @@
"cordova-plugin-themeablebrowser": "^0.2.18",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-sms-plugin": "^1.0.0",
"cordova-sqlite-storage": "^3.2.0",
"cordova-sqlite-storage": "^3.2.1",
"cordova.plugins.diagnostic": "^4.0.12",
"core-js": "^2.5.4",
"date-fns": "^1.30.1",
@ -131,7 +136,7 @@
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "28.0.0"
},
"cordova-plugin-mauron85-background-geolocation": {
"GOOGLE_PLAY_SERVICES_VERSION": "16.0.0",
@ -159,8 +164,9 @@
"cordova-plugin-fingerprint-aio": {
"FACEID_USAGE_DESCRIPTION": "User Authentication"
},
"cordova.plugins.diagnostic": {},
"phonegap-plugin-barcodescanner": {},
"cordova.plugins.diagnostic": {
"ANDROID_SUPPORT_VERSION": "28.0.0"
},
"cordova-plugin-camera": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-android-support-gradle-release": {},
@ -179,7 +185,14 @@
},
"cordova-plugin-apprate": {},
"cordova-plugin-inappbrowser": {},
"cordova-sms-plugin": {}
"cordova-sms-plugin": {},
"cordova-plugin-cszbar": {},
"cordova-plugin-geolocation": {
"GEOLOCATION_USAGE_DESCRIPTION": "To fetch location for marking attendance"
},
"cordova-android-support-gradle-release": {
"ANDROID_SUPPORT_VERSION": "27.+"
}
},
"platforms": [
"browser",

@ -1,26 +1,27 @@
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{ path: '', redirectTo: 'authentication/login', pathMatch: 'full' },
{
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule',
data: { preload: true, delay: 1000 }
},
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
{ path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' },
{ path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' },
{ path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' }, { path: 'attendance', loadChildren: './attendance/attendance.module#AttendancePageModule' }
const routes: Routes = [
{ path: '', redirectTo: 'authentication/login', pathMatch: 'full' },
{
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule',
data: { preload: true, delay: 1000 }
},
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
{ path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' },
{ path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' },
{ path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' }
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }

@ -9,6 +9,8 @@ import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ZBar } from '@ionic-native/zbar/ngx';
import { Geolocation } from '@ionic-native/geolocation/ngx';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
@ -24,6 +26,8 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
providers: [
StatusBar,
SplashScreen,
ZBar,
Geolocation,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]

@ -0,0 +1,33 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { AttendancePage } from './attendance.page';
import { HomeComponent } from './home/home.component';
const routes: Routes = [
{
path: '',
component: AttendancePage,
children: [
{
path: 'home',
component: HomeComponent
}
]
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
declarations: [AttendancePage, HomeComponent]
})
export class AttendancePageModule {}

@ -0,0 +1,5 @@
<ion-content>
<ion-router-outlet></ion-router-outlet>
</ion-content>

@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AttendancePage } from './attendance.page';
describe('AttendancePage', () => {
let component: AttendancePage;
let fixture: ComponentFixture<AttendancePage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AttendancePage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AttendancePage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,16 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-attendance',
templateUrl: './attendance.page.html',
styleUrls: ['./attendance.page.scss'],
})
export class AttendancePage implements OnInit {
constructor() { }
ngOnInit() {
}
}

@ -0,0 +1,11 @@
<ion-header>
<ion-toolbar class="header-toolbar">
<ion-buttons slot="start">
<ion-back-button color="light" class="btnBack" defaultHref="/home"></ion-back-button>
</ion-buttons>
<ion-title color="light" >{{ts.trPK('attendance','attendance')}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
</ion-content>

@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HomeComponent ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,51 @@
import { Component, OnInit } from '@angular/core';
import { Geolocation } from '@ionic-native/geolocation/ngx';
import { ZBar, ZBarOptions } from '@ionic-native/zbar/ngx';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'],
})
export class HomeComponent implements OnInit {
zbarOptions:any;
scannedResult:any;
lat : any;
longt : any;
constructor(private zbar: ZBar, private geolocation: Geolocation) {
this.zbarOptions = {
flash: 'off',
drawSight: false
}
console.log("your currnt location is");
this.geolocation.getCurrentPosition().then((resp) => {
// resp.coords.latitude
// resp.coords.longitude
console.log(resp.coords.latitude);
console.log(resp.coords.longitude);
}).catch((error) => {
console.log('Error getting location', error);
});
this.scanCode();
}
ngOnInit() {}
onClick()
{
this.scanCode();
}
scanCode(){
this.zbar.scan(this.zbarOptions)
.then(result => {
console.log(result); // Scanned code
this.scannedResult = result;
})
.catch(error => {
alert(error); // Error message
});
}
}

@ -1,7 +1,7 @@
<ion-header>
<ion-toolbar class="header-toolbar">
<ion-buttons slot="start">
<ion-back-button color="light" class="btnBack" ></ion-back-button>
<ion-back-button color="light" class="btnBack" defaultHref="/home"></ion-back-button>
</ion-buttons>
<ion-title color="light" > {{'changePassword,changePassword' | translate}}</ion-title>
</ion-toolbar>

@ -121,6 +121,7 @@ export class ConnectorService {
if (!this.cs.validResponse(result)) {
// not authorized
console.log(result.MessageStatus);
console.log("erroe")
if (result.ErrorType === 2) {
//console.log("error expired");
} else {

@ -6,6 +6,12 @@ import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/mo
import { MenuService } from "src/app/hmg-common/services/menu/menuservice.service";
import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response";
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 { Device } from '@ionic-native/device/ngx';
import { attendanceSwipeScannerRequest } from './models/attendanceSwipe.Request';
import { Response } from "src/app/hmg-common/services/models/response";
import { AttendanceService } from './services/attendance.services';
@Component({
selector: "app-home",
@ -16,18 +22,49 @@ export class HomePage implements OnInit {
userData: any = {};
user_image: any = "../assets/imgs/profile.png";
menuList: any = [];
zbarOptions:any;
scannedResult:any;
lat : any;
longt : any;
deviceID: string;
constructor(
public ts: TranslatorService,
public menu: MenuController,
public authService: AuthenticationService,
public menuService: MenuService,
public common: CommonService,
public events:Events
) {}
public events:Events,
private device: Device,
private zbar: ZBar,
private geolocation: Geolocation,
private attendance_service:AttendanceService
) {
}
ngOnInit() {
this.getUserDetails();
this.getMenu();
this.geolocation.getCurrentPosition().then((resp) => {
// resp.coords.latitude
// resp.coords.longitude
console.log(resp.coords.latitude);
console.log(resp.coords.longitude);
}).catch((error) => {
console.log('Error getting location', error);
});
}
ionViewDidLoad()
{
this.geolocation.getCurrentPosition().then((resp) => {
// resp.coords.latitude
// resp.coords.longitude
console.log(resp.coords.latitude);
console.log(resp.coords.longitude);
}).catch((error) => {
console.log('Error getting location', error);
});
}
private openMenu() {
this.menu.toggle();
@ -68,4 +105,52 @@ export class HomePage implements OnInit {
private Change_password(){
this.common.openChangePassword();
}
private attendance(){
this.zbarOptions = {
flash: 'off',
drawSight: false
}
console.log("your currnt location is");
this.scanCode();
}
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.deviceID = this.device.uuid;
this.swipeAttendance();
})
.catch(error => {
alert(error); // Error message
});
}
swipeAttendance(){
let request: attendanceSwipeScannerRequest = new attendanceSwipeScannerRequest();
request.Latitude = this.lat;
request.Longitude = this.longt;
request.QRValue = this.scannedResult;
request.UID = this.deviceID;
request.UserName = this.userData.EMPLOYEE_NUMBER;
console.log("request");
console.log(JSON.stringify(request));
this.attendance_service.attendanceSwipeScanner(
request,()=>{
console.log("Error inside in swipe attendance");
}).
subscribe((result: Response) => {
if (this.common.validResponse(result)) {
console.log("response");
console.log(result);
this.common.presentAlert(this.ts.trPK('home', 'swipeAlertSuccess'));
} else {
this.common.presentAlert(this.ts.trPK('home', 'swipeAlertFailed'));
}
});
}
}

@ -0,0 +1,23 @@
import { Request } from 'src/app/hmg-common/services/models/request';
export class attendanceSwipeScannerRequest extends Request{
public static SHARED_DATA = 'attendanceSwipeScanner-request';
public P_USER_NAME:string;
public P_PASSWORD: string;
public UserName: string;
public CompanyID:number;
public BranchID: number;
public UID:string;
public Latitude:number;
public Longitude:number;
public QRValue: string;
public MemberID:number;
public EmployeeID: number;
public IPAdress: string;
public UserID: string;
}

@ -0,0 +1,20 @@
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { ConnectorService } from "src/app/hmg-common/services/connector/connector.service";
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
import { attendanceSwipeScannerRequest } from '../models/attendanceSwipe.Request';
@Injectable({
providedIn: "root"
})
export class AttendanceService {
public AttendanceSwipeURL : string ='Services/SWP.svc/REST/AuthenticateAndSwipeUser';
constructor(
public con: ConnectorService,
public authService: AuthenticationService
) {}
public attendanceSwipeScanner(attendanceSwipeScanner: attendanceSwipeScannerRequest, onError?: any, errorLabel?: string): Observable<any> {
const request = attendanceSwipeScanner;
this.authService.authenticateRequest(request);
return this.con.post(this.AttendanceSwipeURL,request,onError,errorLabel);
}
}
Loading…
Cancel
Save