no message

MOE_DEV_NEW_TEMPORARY_DESIGN
Zohaib Iqbal Kambrani 5 years ago
parent 077538efe5
commit 424d02c9e1

@ -42,7 +42,7 @@
"input": "src/app/app.scss"
}
],
"scripts": ["node_modules/chart.js/dist/Chart.js"],
"scripts": [],
"es5BrowserSupport": true
},
"configurations": {

@ -144,5 +144,5 @@
<plugin name="cordova-plugin-fingerprint-aio" spec="^3.0.0">
<variable name="FACEID_USAGE_DESCRIPTION" value="User Authentication" />
</plugin>
<engine name="ios" spec="4.5.5" />
<allow-navigation href="http://localhost:8100" sessionid="ccddd6d3" />
</widget>

7042
Mohem/package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -53,6 +53,7 @@
"@ionic-native/sqlite": "^5.18.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic-native/themeable-browser": "^5.18.0",
"@ionic-native/wifi-wizard-2": "^5.31.1",
"@ionic-native/zbar": "^5.10.0",
"@ionic/angular": "^4.1.0",
"@mauron85/cordova-plugin-background-geolocation": "^3.1.0",
@ -65,7 +66,6 @@
"com-badrit-base64": "^0.2.0",
"cordova-android": "^8.1.0",
"cordova-android-support-gradle-release": "^3.0.1",
"cordova-ios": "4.5.5",
"cordova-open-native-settings": "^1.5.2",
"cordova-opentok-android-permissions": "^1.0.1",
"cordova-plugin-actionsheet": "^2.3.3",
@ -107,7 +107,7 @@
"ng2-file-upload": "^1.3.0",
"ng2-pdf-viewer": "^5.3.2",
"ngx-gauge": "^1.0.0-beta.10",
"npm": "^6.13.7",
"npm": "^6.14.11",
"phonegap-nfc": "^1.2.0",
"phonegap-plugin-barcodescanner": "^8.1.0",
"phonegap-plugin-multidex": "^1.0.0",
@ -125,7 +125,7 @@
"@angular-devkit/build-angular": "^0.13.9",
"@angular-devkit/core": "~7.2.3",
"@angular-devkit/schematics": "~7.2.3",
"@angular/cli": "7.3.6",
"@angular/cli": "^7.3.6",
"@angular/compiler": "~7.2.2",
"@angular/compiler-cli": "~7.2.2",
"@angular/language-service": "~7.2.2",
@ -135,6 +135,9 @@
"@types/jasminewd2": "~2.0.3",
"@types/node": "~10.12.0",
"codelyzer": "~4.5.0",
"cordova-ios": "^5.1.1",
"cordova-plugin-wifiwizard2": "^3.1.1",
"es6-promise-plugin": "^4.1.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.0.1",
@ -214,11 +217,12 @@
"cordova-plugin-background-geolocation": {
"GOOGLE_PLAY_SERVICES_VERSION": "+"
},
"phonegap-nfc": {}
"phonegap-nfc": {},
"wifiwizard2": {}
},
"platforms": [
"ios",
"android"
"android",
"ios"
]
}
}
}

@ -17,6 +17,7 @@ import { Base64 } from '@ionic-native/base64/ngx';
import { FirebaseX } from '@ionic-native/firebase-x/ngx';
import { NgCalendarModule } from 'ionic2-calendar';
import { NFC, Ndef} from "@ionic-native/nfc/ngx"
import { WifiWizard2 } from "@ionic-native/wifi-wizard-2/ngx";
@NgModule({
declarations: [AppComponent],
@ -43,7 +44,8 @@ import { NFC, Ndef} from "@ionic-native/nfc/ngx"
FirebaseX,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
NFC,
Ndef
Ndef,
WifiWizard2
],
bootstrap: [AppComponent]
})

@ -50,7 +50,7 @@ export class AttendScanService {
this.userData = this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA, false);
}
getDeviceLocation() {
getDeviceLocation(callback?:(latitude: number,longitude: number) => void) {
this.isFakeLocationUsed = false;
const isVirtual = this.device.isVirtual;
if (isVirtual === true) {
@ -69,7 +69,13 @@ export class AttendScanService {
}
this.lat = resp.latitude;
this.longt = resp.longitude;
if(callback != null){
callback(this.lat,this.longt);
return;
}
this.attendance();
} else {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
}
@ -81,7 +87,13 @@ export class AttendScanService {
if(resp && resp.coords.latitude && resp.coords.longitude) {
this.lat = resp.coords.latitude;
this.longt = resp.coords.longitude;
if(callback != null){
callback(this.lat,this.longt);
return;
}
this.attendance();
} else {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
}
@ -96,13 +108,12 @@ export class AttendScanService {
}
public attendance() {
this.permissions.requestCameraAutherization().then(granted => {
this.camera = granted as boolean;
if (this.camera) {
this.scanCode();
}
this.permissions.requestCameraAutherization().then(granted => {
this.camera = granted as boolean;
if (this.camera) {
this.scanCode();
}
);
});
}
scanCode() {

@ -133,6 +133,8 @@ export class AuthenticationService {
mobileType = 'android';
} else if (isIOS) {
mobileType = 'ios';
}else{
mobileType = 'android';
}
request.VersionID = 2.6;
request.Channel = 31;

@ -24,8 +24,8 @@ export class ConnectorService {
public static timeOut = 120 * 1000;
// public static host = 'http://10.50.100.113:6060/'; // development service
// public static host = 'https://uat.hmgwebservices.com/';
public static host = 'https://hmgwebservices.com/';
public static host = 'https://uat.hmgwebservices.com/';
// public static host = 'https://hmgwebservices.com/';
// public static host = 'http://10.50.100.198:6060/';
// public static host = 'http://10.50.100.113:6060/'; // development service
/* public static host = 'http://10.50.100.198:6060/';

@ -38,6 +38,17 @@
</div>
</ion-col>
</ion-row>
<ion-row padding>
<ion-col size="5" [ngClass]="{'margin-col': direction === 'en', 'disable-attendance': false}" class="buttonStyle" >
<div class="textAndIcon" (click)="startWifi()">
<img src="../assets/imgs/nfc_icon.png" />
<p>{{ "general, wifi-text" | translate }}</p>
</div>
</ion-col>
</ion-row>
</ion-grid>
<div *ngIf="nfcIOSSuccess" style="display: block; text-align: center; margin-top: 50%" >

@ -6,6 +6,7 @@ import { AttendScanService } from "../../hmg-common/services/attend-services/att
import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service";
import { ModalController } from "@ionic/angular";
import { NfcModalComponent } from "../nfc-modal/nfc-modal.component";
import { WifiModalComponent } from "../wifi-model/wifi-modal.component";
import { AuthenticatedUser } from "../../hmg-common/services/authentication/models/authenticated-user";
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
import { attendanceSwipeScannerRequest } from "src/app/home/models/attendanceSwipe.Request";
@ -13,6 +14,8 @@ import { Device } from "@ionic-native/device/ngx";
import { AttendanceService } from "src/app/home/services/attendance.services";
import { Response } from "src/app/hmg-common/services/models/response";
@Component({
selector: "app-attendance-options",
templateUrl: "./attendance-options.component.html",
@ -49,6 +52,7 @@ export class AttendanceOptionsComponent implements OnInit {
this.priviligeList = AuthenticationService.servicePrivilage;
this.setServicesPrivilage();
this.checkNFCStatus("one");
}
async checkNFCStatus(checkValue: string) {
@ -156,4 +160,25 @@ export class AttendanceOptionsComponent implements OnInit {
public startQRCode() {
this.attendScanService.getDeviceLocation();
}
// Wifi Attendance
public async startWifi() {
let modal = await this.modalController.create({
component: WifiModalComponent,
showBackdrop: true,
backdropDismiss: true,
});
modal.cssClass = "wifi-modal";
await modal.present();
// modal = await this.modalController.create({
// component: NfcModalComponent,
// showBackdrop: true,
// backdropDismiss: true,
// });
// modal.cssClass = "nfc-modal";
// await modal.present();
}
}

@ -9,6 +9,7 @@ import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx';
import { WorklistMainService } from '../notification/service/work-list.main.service';
import { AttendanceOptionsComponent } from './attendance-options/attendance-options.component';
import { NfcModalComponent } from './nfc-modal/nfc-modal.component';
import { WifiModalComponent } from './wifi-model/wifi-modal.component';
const routes: Routes = [
{
path: '',
@ -31,12 +32,16 @@ const routes: Routes = [
],
declarations: [
HomePage,
NfcModalComponent
NfcModalComponent,
WifiModalComponent
],
providers: [
BarcodeScanner,
WorklistMainService
],
entryComponents: [NfcModalComponent]
entryComponents: [
NfcModalComponent,
WifiModalComponent
]
})
export class HomePageModule { }

@ -17,6 +17,7 @@ export class attendanceSwipeScannerRequest extends Request{
public UserID: string;
public PointType: number;
public NFCValue: string;
public WifiValue: string;
}

@ -33,6 +33,12 @@
}
}
.wifi-div {
display: block;
text-align: center;
margin-top: -5%;
}
.checked-img {
display: block;
text-align: center;

@ -0,0 +1,15 @@
<ion-content>
<div class="heading-div">
<p class="heading-text"></p>
</div>
<div *ngIf="!gifStatus" class="ripple-div">
<img src="../assets/imgs/wifi_gif.gif" />
<ion-label class="ion-text-wrap">{{ "general, wifi-connect-message" | translate }}</ion-label>
</div>
<div *ngIf="gifStatus" class="checked-img">
<ion-label class="ion-text-wrap">{{ "general, success-attendance" | translate }}</ion-label>
<img src="../assets/imgs/check.png" />
</div>
</ion-content>

@ -0,0 +1,40 @@
.centerDiv {
margin: auto;
text-align: center;
display: block;
}
.heading-div {
display: block;
text-align: center;
}
.heading-text {
font-size: 16px;
color: #bbbbbb;
font-family: 'WorkSans-Bold';
margin-top: 7%;
}
.ripple-div {
display: block;
text-align: center;
margin-top: -20%;
p {
font-size: 16px;
color: #bbbbbb;
font-family: 'WorkSans-Bold';
margin-top: -20%;
padding-right: 10px;
}
ion-button {
--background: #282f42;
color: var(--light);
border-radius: 33px;
width: 270px;
}
}
.checked-img {
display: block;
text-align: center;
margin-top: 25%;
}

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

@ -0,0 +1,165 @@
import { Component, OnInit, NgZone } from '@angular/core';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import {AttendScanService} from '../../hmg-common/services/attend-services/attend-scan.service';
import { attendanceSwipeScannerRequest } from 'src/app/home/models/attendanceSwipe.Request';
import { Device } from '@ionic-native/device/ngx';
import { AuthenticatedUser } from '../../hmg-common/services/authentication/models/authenticated-user';
import { AttendanceService } from 'src/app/home/services/attendance.services';
import { Response } from 'src/app/hmg-common/services/models/response';
import { ModalController } from '@ionic/angular';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { Platform } from "@ionic/angular";
import { WifiWizard2 } from "@ionic-native/wifi-wizard-2/ngx";
import { OpenNativeSettings } from '@ionic-native/open-native-settings/ngx';
@Component({
selector: 'app-wifi-modal',
templateUrl: './wifi-modal.component.html',
styleUrls: ['./wifi-modal.component.scss'],
})
export class WifiModalComponent implements OnInit {
public userData: any = {};
public gifStatus = false;
private ssid = 'HMG-MobileApp'; // Mobile-Team-Official
private password = '12345678';
private algo = 'WPA'; // WPA -> WPA2
constructor(
public common: CommonService,
private device: Device,
private attendance_service: AttendanceService,
public modalController: ModalController,
public ts: TranslatorService,
public ngZone: NgZone,
private wifiWizard2: WifiWizard2,
private openNativeSettings: OpenNativeSettings,
private platform: Platform,
private attendScanService: AttendScanService
) { }
ngOnInit() {
this.userData = this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA, false);
setTimeout(() => {
this.startWifiConnection();
}
, 1000);
}
ionViewDidLeave() {
}
async startWifiConnection() {
const isAndroid = this.platform.is("android");
const isIOS = this.platform.is("ios");
if (isAndroid) {
console.log("Connecting wifi to mark attendance...");
this.wifiWizard2.connect(this.ssid, true, this.password, this.algo).then((value) => {
console.log("Wifi Connected: Verified Access | " + value);
setTimeout(() => {
this.swipeAttendanceWifi(this.ssid);
},2000);
})
.catch((err) => {
console.log(err);
this.showErrorInvalidWorkspace();
});;
} else if (isIOS) {
if(this.wifiWizard2.isWifiEnabled){
console.log("Connecting wifi to mark attendance...");
this.wifiWizard2.iOSConnectNetwork(this.ssid,this.password).then((value) => {
let ssid_ = this.wifiWizard2.getConnectedSSID();
let bssid = this.wifiWizard2.getConnectedBSSID();
console.log("Wifi Connected: Verified Access | " + value + " | " + ssid_ + " | " + bssid);
setTimeout(() => {
this.swipeAttendanceWifi(this.ssid);
},2000);
})
.catch((err) => {
console.log(err);
this.showErrorInvalidWorkspace();
});
}else{
console.log("Wifi not enabled...");
this.common.showErrorMessageDialog(()=>{
this.openNativeSettings.open('wifi').then(()=>{});
},
"OK",
"Wifi is not enabled, Please enable it");
}
}
}
showErrorInvalidWorkspace(){
this.closeModal();
this.common.showErrorMessageDialog(()=>{
},
"OK",
"Failed to validate workspace, Make sure you are in HMG workspace coverage.");
}
disconnectWifi(){
this.wifiWizard2.remove(this.ssid);
console.log("Wifi Removed");
}
async swipeAttendanceWifi(code:string) {
this.attendScanService.getDeviceLocation( async (latitude, longitude)=>{
console.log("Marking attendance to server... at location: "); //+ latitude +","+longitude
let ip = await this.wifiWizard2.getWifiIP();
let mac = await this.wifiWizard2.getConnectedBSSID();
const request: attendanceSwipeScannerRequest = new attendanceSwipeScannerRequest();
request.PointType = 3;
request.Latitude = 24.708761;
request.Longitude = 46.665952;
request.QRValue = "";
request.NFCValue = "";
request.WifiValue = "100";//code + "|" + ip + "|" + mac;
request.UID = this.device.uuid;
request.UserName = this.userData.EMPLOYEE_NUMBER;
console.log("HTTP Request Mark Attendance:")
console.log(request);
this.attendance_service
.attendanceSwipeScanner(request, () => {
console.log("Error inside in swipe attendance");
})
.subscribe((result: Response) => {
this.disconnectWifi();
if (this.common.validResponse(result)) {
this.ngZone.run(() => {
this.gifStatus = true;
});
setTimeout(() => {
this.closeModal();
this.common.openHome();
}, 4000);
}else{
console.log(result);
this.closeModal();
}
});
});
}
public closeModal() {
this.modalController.dismiss();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

@ -887,6 +887,10 @@
"en": "NFC",
"ar": "NFC"
},
"wifi-text": {
"en": "Wifi",
"ar": "Wifi"
},
"qr-text": {
"en": "QR Code",
"ar": "الشفرة QR"
@ -914,6 +918,14 @@
"nfc-cancel": {
"en": "CANCEL",
"ar": "إلغاء"
},
"wifi-connect-message": {
"en": "Please wait, While we are verifying your availablity at workspace",
"ar": "Please wait, While we are verifying your availablity at workspace"
},
"success-attendance": {
"en": "Your attendance is marked successfully.",
"ar": "Your attendance is marked successfully."
}
},
"home": {

@ -1382,6 +1382,12 @@ border:0px
--border-radius: 0.4cm;
}
.wifi-modal {
--height: 10cm !important;
--width: 90% !important;
--border-radius: 0.4cm;
}
.monthview-datetable {
@media screen and (min-width: 300px) and (max-width:360px) {
*{

@ -1,6 +1,7 @@
{
"compileOnSave": false,
"compilerOptions": {
"skipLibCheck": true,
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,

@ -0,0 +1,3 @@
/// <reference path="../.vscode/typings/cordova-ionic/plugins/keyboard.d.ts"/>
/// <reference path="../.vscode/typings/jquery/jquery.d.ts"/>
Loading…
Cancel
Save