Attendance
parent
2ff9b567aa
commit
2d58a2ab10
@ -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 { }
|
||||
|
||||
@ -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
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -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…
Reference in New Issue