clean projest &will start phase 2

production
Mohamed Mekawy 6 years ago
parent 2117526e5f
commit 2d03ed75f3

@ -1,8 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.cloudsolutions.alhabibmohemm" version="1.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MOHEMM</name>
<widget id="com.cloudsolutions.alhabibmohemm" version="1.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Al Habib MOHEMM</name>
<description>an app created by cloud Solutions</description>
<author email="eservices.hmg@drsulaimanalhabib.com" href="http://cloudsolution-sa.com">Cloud Solutions</author>
<author email="eservices.hmg@drsulaimanalhabib.com-sa.com" href="http://hmg.com">HMG</author>
<content src="index.html" />
<content src="index.html" />
<access origin="*" />
@ -88,13 +88,10 @@
<plugin name="cordova-plugin-whitelist" spec="1.3.3" />
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="call-number" spec="^1.0.1" />
<plugin name="cordova-plugin-nativestorage" spec="^2.3.2" />
<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" />
<plugin name="mx.ferreyra.callnumber" spec="0.0.2" />
<plugin name="cordova-plugin-badge" spec="^0.8.8" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.1.3" />

@ -1,34 +1,34 @@
{
"project_info": {
"project_number": "679409052782",
"firebase_url": "https://mohemm-dce93.firebaseio.com",
"project_id": "mohemm-dce93",
"storage_bucket": "mohemm-dce93.appspot.com"
"project_number": "448880075189",
"firebase_url": "https://al-habib-mohemm.firebaseio.com",
"project_id": "al-habib-mohemm",
"storage_bucket": "al-habib-mohemm.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:679409052782:android:dba155ac0859d7fea78a7f",
"mobilesdk_app_id": "1:448880075189:android:5bb4821d515a826d88b9fc",
"android_client_info": {
"package_name": "hmg.cloudSolutions.mohem"
"package_name": "com.cloudsolutions.alhabibmohemm"
}
},
"oauth_client": [
{
"client_id": "679409052782-mtd6d8rjltucnm9uatn6g7et08sm6lbv.apps.googleusercontent.com",
"client_id": "448880075189-49hc2l78pr9hsmr9p3k7j411r40diej8.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDgWjuSBIKGghWxYg_KGBRIZTi-O_UA8mU"
"current_key": "AIzaSyC8nrli7eyuRNow8nF-QHvDMOxqUkj6fEw"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "679409052782-mtd6d8rjltucnm9uatn6g7et08sm6lbv.apps.googleusercontent.com",
"client_id": "448880075189-49hc2l78pr9hsmr9p3k7j411r40diej8.apps.googleusercontent.com",
"client_type": 3
}
]

@ -805,14 +805,6 @@
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/call-number": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@ionic-native/call-number/-/call-number-5.8.0.tgz",
"integrity": "sha512-mAM83IAyawaEbYMZvE8NZnKBW3hu9q0V8+YnOlYy20flC4mnJZssuLUlonH5L5IWf3zY0FjsG/fx4SPVQ5Ac/A==",
"requires": {
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/camera": {
"version": "5.14.0",
"resolved": "https://registry.npmjs.org/@ionic-native/camera/-/camera-5.14.0.tgz",
@ -930,14 +922,6 @@
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/local-notifications": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@ionic-native/local-notifications/-/local-notifications-5.8.0.tgz",
"integrity": "sha512-g8Q9cgSp9zGuR3oZRejIQWmkeQD0jOB9dzGiLUiq4QKzWtIy8KyL0kGiRdCYdRwCpszPnitm64PNVvjKkGOWjg==",
"requires": {
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/native-storage": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@ionic-native/native-storage/-/native-storage-5.8.0.tgz",
@ -969,21 +953,6 @@
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/sms": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@ionic-native/sms/-/sms-5.8.0.tgz",
"integrity": "sha512-4SRiwmOgTNU2BMhWt3kHXO5XBzeniP0ndyF45wViwrYfIU9Stp59YPjlSTwp1k9S9m7sou9Sm6D3B21UxVWDYQ==",
"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/splash-screen": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@ionic-native/splash-screen/-/splash-screen-5.8.0.tgz",
@ -2547,11 +2516,6 @@
"resolved": "https://registry.npmjs.org/calendar-utils/-/calendar-utils-0.2.3.tgz",
"integrity": "sha512-wXxvJX/fdVZqrHeyxEWq5kbwALXrjifbY2L3fXvuS815cCwoWv+Uuiu0jkfqZNTtOSKaTXHdMkIhmLRqcC0E5g=="
},
"call-number": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/call-number/-/call-number-1.0.1.tgz",
"integrity": "sha1-v52q5If9alVz+JqjZV++ivA2r9I="
},
"caller-callsite": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz",
@ -4280,11 +4244,6 @@
"resolved": "https://registry.npmjs.org/cordova-plugin-android-permissions/-/cordova-plugin-android-permissions-1.0.0.tgz",
"integrity": "sha1-nnwRa+Zo6336QUkbE9jUfalUgUk="
},
"cordova-plugin-badge": {
"version": "0.8.8",
"resolved": "https://registry.npmjs.org/cordova-plugin-badge/-/cordova-plugin-badge-0.8.8.tgz",
"integrity": "sha512-RhIBtd5xhD/iLnxjt35jvOae28oNW/wtMZBOmQR3Rf0y4wirvA1bpAZEhBoFqL+rZGhsd6ddOdQXdex1T0DRyQ=="
},
"cordova-plugin-camera": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-camera/-/cordova-plugin-camera-4.1.0.tgz",
@ -4320,21 +4279,11 @@
"resolved": "https://registry.npmjs.org/cordova-plugin-ionic-webview/-/cordova-plugin-ionic-webview-4.1.0.tgz",
"integrity": "sha512-aY1yI042TMgyDoh07rUSxSedlTwQfrvS44UnpakmCqmA/BapjSv88ixa5qUun95vwsYdTERX2VJp6h/YrR1lFQ=="
},
"cordova-plugin-local-notification": {
"version": "0.9.0-beta.2",
"resolved": "https://registry.npmjs.org/cordova-plugin-local-notification/-/cordova-plugin-local-notification-0.9.0-beta.2.tgz",
"integrity": "sha512-63n77K1pt8dnbWnNR8QWETi9Glezi1bvNHvHWmGNIOv0xCb0phZnm+Ku49BQ+omwe8Z5voMvrA4I03SYPpv38w=="
},
"cordova-plugin-nativestorage": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/cordova-plugin-nativestorage/-/cordova-plugin-nativestorage-2.3.2.tgz",
"integrity": "sha512-olg/BzYRk0NGbKQ5f7rf21RYQEyJI19CCZn6RpVMO9/kbRRFqae/6ixjDNy81dXSu2TQ42brjBddGe1Qpn5ViA=="
},
"cordova-plugin-sms-receive": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/cordova-plugin-sms-receive/-/cordova-plugin-sms-receive-1.0.2.tgz",
"integrity": "sha512-y2QMX709RgrbCHVDHAewjvXi50h+u+VcuCQADPJS+tH/BosFie+x1vo5mMwysuIEiaQ25b0qhIzo63RCyT5Fyw=="
},
"cordova-plugin-splashscreen": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/cordova-plugin-splashscreen/-/cordova-plugin-splashscreen-5.0.3.tgz",
@ -4350,11 +4299,6 @@
"resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.4.tgz",
"integrity": "sha512-EYC5eQFVkoYXq39l7tYKE6lEjHJ04mvTmKXxGL7quHLdFPfJMNzru/UYpn92AOfpl3PQaZmou78C7EgmFOwFQQ=="
},
"cordova-sms-plugin": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/cordova-sms-plugin/-/cordova-sms-plugin-1.0.0.tgz",
"integrity": "sha512-DdRf1zdJkwC9BJ3fVg2yx/faoW5eOscg6oFIWODfOIBu5AQ1oV6+gsGTO5pHVLBzlt5V8U9zG9PwhR1IbnW/EQ=="
},
"cordova-support-google-services": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/cordova-support-google-services/-/cordova-support-google-services-1.1.0.tgz",
@ -9112,11 +9056,6 @@
"integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=",
"dev": true
},
"mx.ferreyra.callnumber": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/mx.ferreyra.callnumber/-/mx.ferreyra.callnumber-0.0.2.tgz",
"integrity": "sha512-J9FJiMrfWG9Q8AQEz/cgYLcXTTD/Z5+vfq29hn8K7yVWjxkSzr7zFi7Dpn8wcv2iKHBHDJY+U0z8yoAzDugXMw=="
},
"nan": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",

@ -28,7 +28,6 @@
"@ionic-native/badge": "^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.14.0",
"@ionic-native/core": "^5.8.0",
"@ionic-native/date-picker": "^5.10.0",
@ -41,11 +40,9 @@
"@ionic-native/in-app-browser": "^5.8.0",
"@ionic-native/keyboard": "^5.8.0",
"@ionic-native/launch-navigator": "^5.8.0",
"@ionic-native/local-notifications": "^5.8.0",
"@ionic-native/native-storage": "^5.8.0",
"@ionic-native/open-native-settings": "^5.14.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",
@ -56,7 +53,6 @@
"@swimlane/ngx-charts": "^10.1.0",
"angular-calendar": "^0.26.11",
"app": "0.1.0",
"call-number": "^1.0.1",
"chart.js": "^2.8.0",
"cordova-android": "8.1.0",
"cordova-android-support-gradle-release": "^3.0.1",
@ -65,7 +61,6 @@
"cordova-open-native-settings": "^1.5.2",
"cordova-plugin-add-swift-support": "^2.0.2",
"cordova-plugin-android-permissions": "^1.0.0",
"cordova-plugin-badge": "^0.8.8",
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-datepicker": "^0.9.3",
"cordova-plugin-device": "^2.0.3",
@ -73,18 +68,14 @@
"cordova-plugin-globalization": "^1.11.0",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "4.1.0",
"cordova-plugin-local-notification": "^0.9.0-beta.2",
"cordova-plugin-nativestorage": "^2.3.2",
"cordova-plugin-sms-receive": "^1.0.2",
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-sms-plugin": "^1.0.0",
"cordova-support-google-services": "^1.1.0",
"cordova.plugins.diagnostic": "^5.0.1",
"core-js": "^2.5.4",
"date-fns": "^1.30.1",
"mx.ferreyra.callnumber": "0.0.2",
"ng2-file-upload": "^1.3.0",
"ng2-pdf-viewer": "^5.3.2",
"phonegap-plugin-barcodescanner": "8.1.0",
@ -132,13 +123,9 @@
"cordova-plugin-nativestorage": {},
"cordova-plugin-globalization": {},
"cordova-plugin-android-permissions": {},
"cordova-plugin-sms-receive": {},
"cordova-plugin-local-notification": {},
"mx.ferreyra.callnumber": {},
"cordova-plugin-badge": {},
"cordova-plugin-ionic-keyboard": {},
"call-number": {},
"cordova-sms-plugin": {},
"cordova-plugin-datepicker": {},
"cordova-plugin-geolocation": {},
"phonegap-plugin-barcodescanner": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 210 KiB

@ -24,7 +24,7 @@ export class AppComponent implements OnInit, AfterViewInit {
user_image: string = "../assets/imgs/profile.png";
menuSide: string = "left";
notBadge: number;
companyUrl: string = "../assets/imgs/CS.png";
companyUrl: string = "../assets/imgs/HMG.png";
companyDesc: string = "Powered By Cloud Solutions";
public direction = "ltr";
constructor(
@ -63,7 +63,7 @@ export class AppComponent implements OnInit, AfterViewInit {
if (user) {
this.companyUrl = user.CompanyImageURL
? user.CompanyImageURL
: "../assets/imgs/CS.png";
: "../assets/imgs/HMG.png";
this.companyDesc = user.CompanyImageDescription
? user.CompanyImageDescription

@ -1,28 +0,0 @@
<ion-header>
<ion-toolbar>
<nav-buttons [navigate]="false" (backClick)="onRejectClicked()" ></nav-buttons>
<ion-title>{{ 'general,usage-agreement' | translate}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<scroll-content>
<ion-grid>
<ion-row *ngIf="agreementContent" class="ion-justify-content-center">
<ion-col [size]="11">
<div class="html-container" [innerHTML]="agreementContent | safeHtml"> </div>
</ion-col>
</ion-row>
</ion-grid>
<page-trailer [small]="true"></page-trailer>
</scroll-content>
<footer>
<ion-grid>
<ion-row class="ion-justify-content-center">
<ion-col [size]="10" [sizeLg]="8" [sizeXl]="6" no-padding>
<ion-button (click)="onAcceptClicked()" expand="block">{{ 'general,accept' | translate}}</ion-button>
</ion-col>
</ion-row>
</ion-grid>
</footer>
</ion-content>

@ -1,9 +0,0 @@
.agreement_area{
width: 100%;
height: 80%;
}
.html-container {
width: 96%;
padding: 2%;
}

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

@ -1,76 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { AgreementService } from './service/agreement.service';
import { CheckUserAgreementResponse } from './service/models/check-user-agreement.response';
import { GetUserAgreementResponse } from './service/models/get-user-agreement.response';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
@Component({
selector: 'app-agreement',
templateUrl: './agreement.component.html',
styleUrls: ['./agreement.component.scss']
})
export class AgreementComponent implements OnInit {
public agreementContent: string;
constructor(
public ts: TranslatorService,
public cs: CommonService,
public agreementService: AgreementService,
public auth: AuthenticationService
) { }
ngOnInit() {
this.checkUserAgreement();
}
checkUserAgreement() {
this.agreementService.checkUserAgreement(
() => {
this.checkUserAgreement();
}, this.ts.trPK('general', 'retry')).subscribe((result: CheckUserAgreementResponse) => {
if (this.cs.validResponse(result)) {
if (result.IsPatientAlreadyAgreed) {
// this.auth.setUserAgreed(true);
this.cs.openHome();
} else {
this.getUserAgreement();
}
}
});
}
private getUserAgreement() {
this.agreementService.getAgreement(
() => {
this.getUserAgreement();
}, this.ts.trPK('general', 'retry')).subscribe((result: GetUserAgreementResponse) => {
if (this.cs.validResponse(result)) {
this.agreementContent = result.UserAgreementContent;
}
});
}
public onAcceptClicked() {
this.agreementService.addUserAgreement(
() => {
this.onAcceptClicked();
}, this.ts.trPK('general', 'retry')).subscribe((result: GetUserAgreementResponse) => {
if (this.cs.validResponse(result)) {
//this.auth.setUserAgreed(true);
this.cs.openHome();
}
});
}
public onRejectClicked() {
this.auth.clearUser().subscribe(success => {
this.cs.openHome();
});
}
}

@ -1,12 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { AgreementService } from './agreement.service';
describe('AgreementService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: AgreementService = TestBed.get(AgreementService);
expect(service).toBeTruthy();
});
});

@ -1,53 +0,0 @@
import { Injectable } from '@angular/core';
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
import { CheckUserAgreementRequest } from './models/check-user-agreement.request';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { Observable } from 'rxjs';
import { CheckUserAgreementResponse } from './models/check-user-agreement.response';
import { Request } from 'src/app/hmg-common/services/models/request';
import { GetUserAgreementResponse } from './models/get-user-agreement.response';
import { AddUserAgreementRequest } from './models/add-user-agreement.request';
@Injectable({
providedIn: 'root'
})
export class AgreementService {
public static checkAgreementURL = 'Services/Patients.svc/REST/CheckForUsageAgreement';
public static getAgreementURL = 'Services/Patients.svc/REST/GetUsageAgreementText';
public static addAgreementURL = 'Services/Patients.svc/REST/AddUsageAgreement';
constructor(
public con: ConnectorService,
public auth: AuthenticationService
) {
}
public checkUserAgreement(onError: any, errorLabel: string): Observable<CheckUserAgreementResponse> {
const request = new CheckUserAgreementRequest();
request.Region = 1;
this.auth.authenticateRequest(request);
request.TokenID = '';
return this.con.post(AgreementService.checkAgreementURL, request, onError, errorLabel);
}
public getAgreement(onError: any, errorLabel: string): Observable<GetUserAgreementResponse> {
const request = new Request();
this.auth.setPublicFields(request);
request.TokenID = '';
return this.con.post(AgreementService.getAgreementURL, request, onError, errorLabel);
}
public addUserAgreement(onError: any, errorLabel: string): Observable<GetUserAgreementResponse> {
const request = new AddUserAgreementRequest();
request.Region = 1;
this.auth.authenticateRequest(request);
request.TokenID = '';
return this.con.post(AgreementService.addAgreementURL, request, onError, errorLabel);
}
}

@ -1,5 +0,0 @@
import { Request } from 'src/app/hmg-common/services/models/request';
export class AddUserAgreementRequest extends Request {
Region: number; // 1
}

@ -1,5 +0,0 @@
import { Request } from 'src/app/hmg-common/services/models/request';
export class CheckUserAgreementRequest extends Request {
Region: number; // 1
}

@ -1,5 +0,0 @@
import { Response } from 'src/app/hmg-common/services/models/response';
export class CheckUserAgreementResponse extends Response {
IsPatientAlreadyAgreed: boolean;
}

@ -1,5 +0,0 @@
import { Response } from 'src/app/hmg-common/services/models/response';
export class GetUserAgreementResponse extends Response {
UserAgreementContent: string;
}

@ -8,7 +8,7 @@ import { LoginComponent } from './login/login.component';
import { ForgotComponent } from './forgot/forgot.component';
import { HmgCommonModule } from '../hmg-common/hmg-common.module';
import { SelectButtonModule } from 'primeng/selectbutton';
import { AgreementComponent } from './agreement/agreement.component';
//import { AgreementComponent } from './agreement/agreement.component';
import { FingerprintAIO } from '@ionic-native/fingerprint-aio/ngx';
import { Device } from '@ionic-native/device/ngx';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
@ -36,10 +36,6 @@ const routes: Routes = [
path: 'forgot',
component: ForgotComponent
},
{
path: 'agreement',
component: AgreementComponent
},
{
path: 'smspage',
component: SmsPageComponent
@ -74,7 +70,6 @@ const routes: Routes = [
AuthenticationPage,
LoginComponent,
ForgotComponent,
AgreementComponent,
SmsPageComponent,
CheckUserComponent,
ChangePasswordComponent

@ -2,7 +2,7 @@
<ion-grid class="customGrid">
<ion-row>
<ion-col class="colPad">
<img class="centerDiv" src="../assets/imgs/CS.png" />
<img class="centerDiv" src="../assets/imgs/HMG.png" />
</ion-col>
</ion-row>
<ion-row>

@ -11,7 +11,7 @@
<ion-grid>
<ion-row>
<ion-col class="colPad">
<ion-img class="centerDiv" src="../assets/imgs/CS.png"></ion-img>
<ion-img class="centerDiv" src="../assets/imgs/HMG.png"></ion-img>
</ion-col>
</ion-row>
<ion-row>

@ -42,8 +42,8 @@ import { NativeStorage } from '@ionic-native/native-storage/ngx';
import { ProgressLoadingService } from './ui/progressLoading/progress-loading.service';
import { BarChartComponent } from './ui/bar-chart/bar-chart.component';
import { DonutChartComponent } from './ui/donut-chart/donut-chart.component';
import { UserLocalNotificationService } from './services/user-local-notification/user-local-notification.service';
import { LocalNotifications } from '@ionic-native/local-notifications/ngx';
//import { UserLocalNotificationService } from './services/user-local-notification/user-local-notification.service';
//import { LocalNotifications } from '@ionic-native/local-notifications/ngx';
import { EmailComponent } from './ui/email/email.component';
import { Badge } from '@ionic-native/badge/ngx';
// import { Push } from '@ionic-native/push/ngx';
@ -53,7 +53,7 @@ import { HmgBrowserService } from './services/hmg-browser/hmg-browser.service';
import { GuidService } from './services/guid/guid.service';
import { TabsBarComponent } from './ui/tabs-bar/tabs-bar.component';
import { PageTrailerComponent } from './ui/spacer/page-trailer/page-trailer.component';
import { GeofencingService } from './services/geofencing/geofencing.service';
//import { GeofencingService } from './services/geofencing/geofencing.service';
import { BackgroundGeolocation } from '@ionic-native/background-geolocation/ngx';
import { ButtonComponent } from './ui/button/button.component';
import { ToolbarButtonComponent } from './ui/toolbar-button/toolbar-button.component';
@ -82,13 +82,13 @@ import { Diagnostic } from '@ionic-native/diagnostic/ngx';
import { DetailButtonComponent } from './ui/detail-button/detail-button.component';
import { RouterModule } from '@angular/router';
import { HeaderButtonComponent } from './ui/header-button/header-button.component';
import { CallNumber } from '@ionic-native/call-number/ngx';
//import { CallNumber } from '@ionic-native/call-number/ngx';
import { AppRate } from '@ionic-native/app-rate/ngx';
import { RatingService } from './services/rating/rating.service';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { RateService } from './services/rate/rate.service';
import { PaymentComponent } from './ui/payment/payment.component';
import { PaymentService } from './ui/payment/service/payment.service';
//import { PaymentComponent } from './ui/payment/payment.component';
//import { PaymentService } from './ui/payment/service/payment.service';
import { MenuService } from './services/menu/menuservice.service';
import { ReplacementListComponent } from '../vacation-rule/replacement-list/replacement-list.component';
import { FileSelectDirective } from 'ng2-file-upload';
@ -155,7 +155,7 @@ import { OpenNativeSettings } from '@ionic-native/open-native-settings/ngx';
EmptyDataComponent,
DetailButtonComponent,
HeaderButtonComponent,
PaymentComponent,
//PaymentComponent,
ReplacementListComponent,
FileSelectDirective,
WorkListAttachViewComponent
@ -205,7 +205,7 @@ import { OpenNativeSettings } from '@ionic-native/open-native-settings/ngx';
EmptyDataComponent,
DetailButtonComponent,
HeaderButtonComponent,
PaymentComponent,
//PaymentComponent,
ReplacementListComponent,
FileSelectDirective,
WorkListAttachViewComponent
@ -224,14 +224,14 @@ import { OpenNativeSettings } from '@ionic-native/open-native-settings/ngx';
NativeStorage,
ProgressLoadingService,
PushService,
UserLocalNotificationService,
LocalNotifications,
//UserLocalNotificationService,
//LocalNotifications,
Badge,
LifeCycleService,
HmgBrowserService,
GuidService,
BackgroundGeolocation,
GeofencingService,
//GeofencingService,
Keyboard,
KeyboardService,
Diagnostic,
@ -240,12 +240,12 @@ import { OpenNativeSettings } from '@ionic-native/open-native-settings/ngx';
HMGPreloadingStrategy,
HMGPreloadingStrategyLoading,
Diagnostic,
CallNumber,
// CallNumber,
AppRate,
RatingService,
InAppBrowser,
RateService,
PaymentService,
//PaymentService,
MenuService,
OpenNativeSettings
]

@ -3,7 +3,7 @@ import { Request } from "../models/request";
import { TranslatorService } from "../translator/translator.service";
import { ConnectorService } from "../connector/connector.service";
import { Observable, throwError } from "rxjs";
import { CheckPatientRegisterationRequest } from "./models/check-patient-registeration.request";
//import { CheckPatientRegisterationRequest } from "./models/check-patient-registeration.request";
import { LoginRequest } from "./models/login.request";
import { Response } from "../models/response";
import { AuthenticatedUser } from "./models/authenticated-user";
@ -18,7 +18,7 @@ import { RegisterInformationRequest } from "./models/register-information.reques
import { ForgotFileIDResponse } from "./models/forgot-File-ID.response";
import { EmailRequest } from "../models/email-request";
import { EmailInput } from "../../ui/email/models/email-input";
import { UserLocalNotificationService } from "../user-local-notification/user-local-notification.service";
//import { UserLocalNotificationService } from "../user-local-notification/user-local-notification.service";
import { GetLoginInfoRequest } from "./models/get-login-info.request";
import { GetLoginInfoResponse } from "./models/get-login-info.response";
import { analyzeAndValidateNgModules } from "@angular/compiler";
@ -81,7 +81,7 @@ export class AuthenticationService {
public cs: CommonService,
public ts: TranslatorService,
public nativeStorage: NativeStorage,
public localNotifications: UserLocalNotificationService,
// public localNotifications: UserLocalNotificationService,
private events: Events,
private menu: MenuController,
) { }
@ -116,7 +116,7 @@ export class AuthenticationService {
public setPublicFields(request: Request): Request {
request.VersionID = 1.3;
request.Channel = 31;
request.Channel = 33;
request.LanguageID = TranslatorService.getCurrentLanguageCode();
//request.IPAdress = '10.10.10.10';
//request.SessionID = "any thing"; // ??? required for not authorized login funny
@ -193,7 +193,7 @@ export class AuthenticationService {
public login(request: LoginRequest, onError: any, errorLabel: string): Observable<Response> {
this.setPublicFields(request);
request.P_APP_VERSION="CS";
request.P_APP_VERSION="HMG";
return this.con.post(AuthenticationService.login, request, onError, errorLabel);
}
@ -448,7 +448,7 @@ export class AuthenticationService {
public checkUserAuthentication(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
request.P_APP_VERSION="CS";
request.P_APP_VERSION="HMG";
return this.con.post(AuthenticationService.userChecking, request, onError, errorLabel);
}
@ -485,13 +485,13 @@ export class AuthenticationService {
client side:
id no , mobile no , zip code
*/
public sendSmsForPatientRegisteration(request: CheckPatientRegisterationRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
request.TokenID = '';
request.isRegister = false;
return this.con.post(AuthenticationService.sendSmsForRegisterURL, request, onError, errorLabel);
}
// public sendSmsForPatientRegisteration(request: CheckPatientRegisterationRequest, onError: any, errorLabel: string)
// : Observable<CheckUserAuthenticationResponse> {
// this.setPublicFields(request);
// request.TokenID = '';
// request.isRegister = false;
// return this.con.post(AuthenticationService.sendSmsForRegisterURL, request, onError, errorLabel);
// }
public checkRegisterationActivationCode(request: CheckRegisterationCodeRequest, onError: any, errorLabel: string)
: Observable<Response> {

@ -1,9 +0,0 @@
import { Request } from '../../models/request';
export class CheckPatientRegisterationRequest extends Request {
PatientIdentificationID: string; // "iqama"
PatientMobileNumber: string; // "phone without start 0"
TokenID: string; // should be empty ""
ZipCode: string; // "966 or 971"
isRegister: boolean;
}

@ -25,7 +25,7 @@ import { SharedDataService } from "../shared-data-service/shared-data.service";
import { Badge } from "@ionic-native/badge/ngx";
import { LifeCycleService } from "../life-cycle/life-cycle.service";
import { Diagnostic } from "@ionic-native/diagnostic/ngx";
import { CallNumber } from "@ionic-native/call-number/ngx";
//import { CallNumber } from "@ionic-native/call-number/ngx";
import { InAppBrowser } from "@ionic-native/in-app-browser/ngx";
@Injectable({
@ -95,7 +95,7 @@ export class CommonService {
public badge: Badge,
public lifeCycle: LifeCycleService,
public diagnostic: Diagnostic,
public callNumber: CallNumber,
//public callNumber: CallNumber,
public iab: InAppBrowser,
private menu: MenuController,
) {}
@ -1089,19 +1089,19 @@ export class CommonService {
});
}
public callPhoneNumber(phoneNumber: string) {
this.platform.ready().then(() => {
if (this.isCordova()) {
this.callNumber
.callNumber(phoneNumber, true)
.then(res => {})
.catch(err => {});
} else {
window.open("tel:" + phoneNumber);
// this.presentAlert(this.ts.trPK('error', 'call'));
}
});
}
// public callPhoneNumber(phoneNumber: string) {
// this.platform.ready().then(() => {
// if (this.isCordova()) {
// this.callNumber
// .callNumber(phoneNumber, true)
// .then(res => {})
// .catch(err => {});
// } else {
// window.open("tel:" + phoneNumber);
// // this.presentAlert(this.ts.trPK('error', 'call'));
// }
// });
// }
list_to_tree(list) {
let map = {},

@ -19,8 +19,8 @@ export class ConnectorService {
public static timeOut = 30 * 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/';

@ -1,12 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { GeofencingService } from './geofencing.service';
describe('GeofencingService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: GeofencingService = TestBed.get(GeofencingService);
expect(service).toBeTruthy();
});
});

@ -1,446 +0,0 @@
import { Injectable } from '@angular/core';
import { BackgroundGeolocation, BackgroundGeolocationEvents } from '@ionic-native/background-geolocation/ngx';
import { BackgroundGeolocationConfig, BackgroundGeolocationResponse } from '@ionic-native/background-geolocation/ngx';
import { UserLocalNotificationService } from '../user-local-notification/user-local-notification.service';
import { Platform } from '@ionic/angular';
import { LocationModel } from './models/location.model';
import { ConnectorService } from '../connector/connector.service';
import { NativeStorage } from '@ionic-native/native-storage/ngx';
import { AuthenticationService } from '../authentication/authentication.service';
import { ZoneModel } from './models/zone.model';
import { CommonService } from '../common/common.service';
import { InsertLocationRequest } from './models/insert-location.request';
import { GeoUserModel } from './models/geo-user.model';
import { TranslatorService } from '../translator/translator.service';
export enum zoneState {
out = 0, enter = 1, exit = 2, in = 3
}
@Injectable({
providedIn: 'root'
})
export class GeofencingService {
public static ZONES_KEY = 'geofencing-zones';
public static USER_DATA_KEY = 'geofencing-user-data';
public static GEO_STATUS_KEY = 'geofencing-status';
public static zonesUrl = 'Services/Patients.svc/REST/GeoF_GetAllPoints';
public static loggingUrl = 'Services/Patients.svc/rest/GeoF_InsertPatientFileInfo';
private zonesList: ZoneModel [];
private userData: GeoUserModel;
private isPaused: boolean;
private debug: boolean;
locations: any [];
constructor(
private backgroundGeolocation: BackgroundGeolocation,
public notif: UserLocalNotificationService,
public platform: Platform,
public con: ConnectorService,
public auth: AuthenticationService,
public storage: NativeStorage,
public cs: CommonService,
public authService: AuthenticationService,
public ts: TranslatorService,
) {
this.debug = false;
}
/*
* logs location on server.
*/
private logLocation(id: number, type: number, userData: GeoUserModel, zone: ZoneModel) {
this.toast('logging location..');
this.setNotification('Logging location ' , 'location id: ' + id + ' type: ' + type);
const req = new InsertLocationRequest();
req.PointsID = id;
req.GeoType = type;
//req.PatientID = userData.PatientID;
//req.PatientOutSA = userData.PatientOutSA;
this.auth.setPublicFields(req);
this.con.postNoLoad(GeofencingService.loggingUrl, req, () => {
zone.pendingRequest = type; // failed to log, setup pending request
this.storeZones(this.zonesList);
this.log('pending request from onError');
this.setNotification('Pending request from onError', 'zone: ' + zone.Description + ' request type: ' + type);
}).subscribe((response) => {
if (this.cs.validResponse(response)) {
this.setNotification('Log success' , 'location id: ' + id + ' patientID: ' + userData.PatientID);
this.log('logged successfuly');
zone.pendingRequest = zoneState.out; // cancel pending requests if any
} else {
zone.pendingRequest = type; // failed to log, setup pending request
this.log('pending request from invalid');
this.setNotification('Pending request from invalid', 'zone: ' + zone.Description + ' request type: ' + type);
}
this.storeZones(this.zonesList);
});
}
/*
* Requests geofence zones list
*/
private requestZones() {
const req = this.auth.getPublicRequest();
this.con.postNoLoad(GeofencingService.zonesUrl, req, _ => { // TODO: handle error
}).subscribe((response: any) => {
if (this.cs.validResponse(response)) {
if (this.cs.hasData(response.GeoF_PointsList)) {
// update zonelist if it doesnt exist or if the server has an updated one
if (!this.cs.hasData(this.zonesList) || (this.zonesList.length !== response.GeoF_PointsList.length)) {
this.log('setting new zone list');
this.zonesList = response.GeoF_PointsList;
for (const zone of this.zonesList) {
zone.in = false;
}
this.log('storing zones');
this.storeZones(this.zonesList);
}
}
}
});
}
/*
* Store zones list in local storage
*/
public async storeZones(zones: ZoneModel []) {
return await this.storage.setItem(GeofencingService.ZONES_KEY, zones);
}
/*
* Retrieve and set list of zones from local storage
*/
public async setZones() {
try {
const data = await this.storage.getItem(GeofencingService.ZONES_KEY);
if (this.cs.hasData(data)) {
this.zonesList = data;
} else {
this.requestZones(); // zones list not stored in local storage
}
} catch {
this.requestZones(); // zones list not stored in local storage
}
}
public async storeUserData(user: GeoUserModel) {
return await this.storage.setItem(GeofencingService.USER_DATA_KEY, user);
}
/*
* Retrieve and set user data from local storage
*/
public async setUserFromStorage() {
const data = await this.storage.getItem(GeofencingService.USER_DATA_KEY);
if (data) {
this.userData = data;
} else {
this.userData = null;
}
}
/*
// turns location tracking on. Sets geo user data and zones list
*/
public async turnTrackingOn(patientID?: number, outSa?: number): Promise<boolean> {
this.toast('turning tracking on');
// set zones list from storage
await this.setZones();
// update zone list from server
this.requestZones();
// Set user data
if (patientID) {
this.userData = new GeoUserModel;
this.userData.PatientID = patientID;
this.userData.PatientOutSA = outSa;
} else if (!this.userData) {
try {
await this.setUserFromStorage();
} catch {
return false;
}
}
this.userData.isTrackingOn = true;
this.storeUserData(this.userData);
this.startTracking();
return true;
}
/*
// turns location tracking off. Stops background tracking
*/
public turnTrackingOff() {
this.toast('turning tracking off');
this.stopTracking();
if (this.userData) {
this.userData.isTrackingOn = false;
this.storeUserData(this.userData);
} else {
this.setUserFromStorage().then(() => {
this.userData.isTrackingOn = false;
this.storeUserData(this.userData);
});
}
}
/*
// Check if geofencing service is enabled
*/
public async isTrackingEnabled(): Promise<boolean> {
// if (this.userData) {
// return this.userData.isTrackingOn;
// } else {
try {
await this.setUserFromStorage();
if (this.userData) {
return this.userData.isTrackingOn;
} else {
return false;
}
} catch {
throw false;
}
// }
}
/*
// setup and start background gelocation plugin
*/
public startTracking() {
const config: BackgroundGeolocationConfig = {
desiredAccuracy: 10000, // HIGH_ACCURACY = 1 // low = 10000
stationaryRadius: 20, // 20
distanceFilter: 10, // 10
debug: false, // enable this hear sounds for background-geolocation life-cycle.
stopOnTerminate: false, // enable this to clear background location settings when the app terminates
// startOnBoot: true,
// Android options
notificationsEnabled: false,
interval: 60000, // interval vars for improved battery life
fastestInterval: 120000,
activitiesInterval: 10000,
startForeground: false,
notificationTitle: 'Running in the background',
notificationText: '',
// IOS options
saveBatteryOnBackground: false
};
this.backgroundGeolocation.configure(config)
.then((location: BackgroundGeolocationResponse) => {
});
this.backgroundGeolocation.on(BackgroundGeolocationEvents.location)
.subscribe((location: BackgroundGeolocationResponse) => {
this.reportLocation(location);
});
this.backgroundGeolocation.on(BackgroundGeolocationEvents.stationary)
.subscribe((location: BackgroundGeolocationResponse) => {
this.reportLocation(location);
});
this.storage.getItem(GeofencingService.GEO_STATUS_KEY).then(status => {
if (!status) {
this.backgroundGeolocation.start();
this.storage.setItem(GeofencingService.GEO_STATUS_KEY, true);
}
}).catch(() => {
this.toast('turning geofencing on');
this.backgroundGeolocation.start();
this.storage.setItem(GeofencingService.GEO_STATUS_KEY, true);
});
}
/*
// Helper to startTracking()
*/
private async reportLocation(location: BackgroundGeolocationResponse) {
// Check if zones and user is set
if (!this.userData) {
await this.setUserFromStorage();
}
if (!this.cs.hasData(this.zonesList)) {
await this.setZones();
}
if (this.platform.is('ios')) {
this.backgroundGeolocation.startTask().then((taskKey) => {
this.checklocationInZones(location, this.zonesList, this.userData);
this.backgroundGeolocation.endTask(taskKey);
});
} else {
this.checklocationInZones(location, this.zonesList, this.userData);
}
this.storeZones(this.zonesList);
}
/*
// stops background geoloacation plugin tracking
*/
public stopTracking() {
this.toast('Stop Tracking' );
this.storage.setItem(GeofencingService.GEO_STATUS_KEY, false);
this.backgroundGeolocation.stop().then(value => {
// this.toast('Stop Tracking value returned: ' + value);
});
}
/*
// Checks if given location triggers any zone events (enter, exit) for all zones, and pauses the service if
// the location was far from all zones
*/
private checklocationInZones(location: BackgroundGeolocationResponse, zones: ZoneModel [], user: GeoUserModel) {
this.printLocation(location, 'check location in zones');
let currentMinDist = 9999999;
for (const zone of zones) {
const userLocation = new LocationModel(location.latitude, location.longitude);
const event = this.checkLocationInZone(userLocation, zone);
const currentDistance = this.distanceFromZone(userLocation, zone);
currentMinDist = (currentMinDist > currentDistance ? currentDistance : currentMinDist);
if (zone.GEOF_ID === 16) {
this.log(zone.Description);
this.log('zone state: ' + zone.in + ' pending: ' + zone.pendingRequest + 'current event: ' + event);
}
if (event === zoneState.in) {
zone.in = true;
}
// send enter request
if (event === zoneState.enter ||
(event === zoneState.in && zone.pendingRequest === zoneState.enter)) {
zone.in = true;
this.setNotification('Enter ZONE ' + zone.Description, 'location lat: ' + location.latitude + ' lng: ' + location.longitude);
this.log('enter Zone' + zone.Description + ' ' + 'location: ' + location.latitude + ',' + location.longitude);
this.logLocation(zone.GEOF_ID, zoneState.enter, user, zone);
}
// send exit request
if (event === zoneState.exit ||
(event === zoneState.out && zone.pendingRequest === zoneState.exit)) {
zone.in = false;
this.setNotification('Exit ZONE ' + zone.Description, 'location lat: ' + location.latitude + ' lng: ' + location.longitude);
this.log('exit Zone' + zone.Description + ' ' + 'location: ' + location.latitude + ',' + location.longitude);
this.logLocation(zone.GEOF_ID, zoneState.exit, user, zone);
}
}
const minDist = this.toDecimalDegrees(5000); // minimum distance location needs to be to all zones to pause service
const maxDist = this.toDecimalDegrees(10000); // Max distance used to have a factor between 0-1
if (currentMinDist >= minDist) {
const currentDis = (currentMinDist > maxDist ? maxDist : currentMinDist);
this.pauseService((currentDis - minDist) / (maxDist - minDist));
}
}
/*
// Checks the state of given location for the given zone
*/
private checkLocationInZone(userLocation: LocationModel, zone: ZoneModel): zoneState {
const isIn = this.isPointInZone(userLocation.lng, userLocation.lat, zone.Longitude,
zone.Latitude, this.toDecimalDegrees(zone.Radius));
if (isIn === false && zone.in === true) {
return zoneState.exit;
}
if (isIn === true && zone.in === false) {
return zoneState.enter;
}
if (isIn) {
return zoneState.in;
}
return zoneState.out;
}
/*
// calculates the distance between given location and given zone
*/
private distanceFromZone(userLocation: LocationModel, zone: ZoneModel): number {
return this.distance(userLocation.lng, userLocation.lat, zone.Longitude, zone.Latitude);
}
/*
// checks if a point p is in a circular zone with center z and radius r
*/
public isPointInZone(xp, yp, xz, yz, r): boolean {
return this.distance(xp, yp, xz, yz) < r;
}
/*
// Measures distance between two points
*/
public distance(xp, yp, xz, yz): number {
return Math.sqrt(Math.pow(Math.abs(xp - xz), 2) + Math.pow(Math.abs(yp - yz) , 2));
}
/*
// Convert meters to decimal degrees
*/
public toDecimalDegrees(meters: number) {
return meters / 1000 / 111.32;
}
/*
// Pauses tracking service for a time multiplied by given factor
*/
public pauseService(factor: number) {
if (!this.isPaused) {
this.stopTracking();
this.isPaused = true;
// time to pause min=120 sec max=1800 sec
const time = (1680000 * factor); // time in milliseconds
this.setNotification('pausing tracking service', 'Pause for ' + time + ' FYI factor is: ' + factor);
setTimeout(() => {
this.startTracking();
this.isPaused = false;
this.setNotification('resuming tracking service', 'Paused for ' + time + ' FYI factor is: ' + factor);
}, time);
}
}
public startGeoFromHome() {
if (this.cs.isCordova()) {
this.isTrackingEnabled().then((result) => {
if (result) {
this.turnTrackingOff();
this.turnTrackingOn();
}
}).catch(() => {
// first time login, setup geofencing
// local storage should reset when user logs out
if (this.authService.isAuthenticated()) {
const user = this.authService.getAuthenticatedUser();
this.turnTrackingOff();
this.cs.presentConfirmDialog(this.ts.trPK('settings', 'enable-geo'), () => {
// this.turnTrackingOn(user.PatientID, +user.PatientOutSA);
}, () => {
// this.turnTrackingOn(user.PatientID, +user.PatientOutSA);
this.turnTrackingOff();
});
}
});
}
}
// ---------- TESTING FUNCTIONS -------------- //
public setNotification(title: string, text: string) {
if (this.debug) {
const date = new Date();
date.setSeconds(date.getSeconds() + 2);
this.notif.createNotification(title, text, date, 'geofencing');
}
}
public printLocation(location: BackgroundGeolocationResponse, source: string) {
if (this.debug) {
console.log('-------------------------------------------------------------');
console.log(source);
console.log(this.zonesList);
console.log(location);
console.log('location: ' + location.latitude + ', ' + location.longitude);
}
}
public printAllLocations() {
if (this.debug) {
this.backgroundGeolocation.getLocations().then(locations => {
console.log(locations);
});
}
}
public log(msg: string) {
if (this.debug) {
console.log(msg);
}
}
public toast(msg: string) {
if (this.debug) {
this.cs.toast(msg);
}
}
}

@ -1,5 +0,0 @@
export class GeoUserModel {
PatientID: number;
PatientOutSA: number;
isTrackingOn: boolean;
}

@ -1,6 +0,0 @@
import { Request } from 'src/app/hmg-common/services/models/request';
export class InsertLocationRequest extends Request {
PointsID: number;
GeoType: number; // 1 enter 2 exit
}

@ -1,8 +0,0 @@
export class LocationModel {
lat: number;
lng: number;
constructor(lat: number, lng: number, radius?: number, name?: string) {
this.lat = lat;
this.lng = lng;
}
}

@ -1,17 +0,0 @@
import { zoneState } from '../geofencing.service';
export class ZoneModel {
CreatedBy?: number;
CreatedOn?: string;
Description: string;
DescriptionN?: string;
GEOF_ID?: number;
IsCity?: boolean;
Latitude: string;
Longitude: string;
ProjectID?: number;
Radius: number;
Type?: number;
in: boolean;
pendingRequest: zoneState;
}

@ -1,12 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { UserLocalNotificationService } from './user-local-notification.service';
describe('UserLocalNotificationService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: UserLocalNotificationService = TestBed.get(UserLocalNotificationService);
expect(service).toBeTruthy();
});
});

@ -1,97 +0,0 @@
import { Injectable } from '@angular/core';
import { LocalNotifications, ILocalNotification } from '@ionic-native/local-notifications/ngx';
export interface UserLocalData {
[key: string]: any;
}
@Injectable({
providedIn: 'root'
})
export class UserLocalNotificationService {
public static STORAGE_KEY = 'notifications';
constructor(
public localNotification: LocalNotifications,
) { }
public async requestNotificationPermission(): Promise<boolean> {
const hasPermission = await this.checkNotificationPermission();
if (!hasPermission) {
return await this.localNotification.requestPermission();
} else {
return true;
}
}
public async checkNotificationPermission(): Promise<boolean> {
return await this.localNotification.hasPermission();
}
public async cancelCategoryNotifications(category: string) {
const notifications = await this.localNotification.getAll();
for (const notification of notifications) {
const parsedData = JSON.parse(notification.data);
const notifCategory = parsedData['category'];
if (notifCategory === category) {
await this.localNotification.cancel(notification.id);
}
}
}
public async isCategoryExist(category: string) {
const notifications = await this.localNotification.getAll();
for (const notification of notifications) {
const parsedData = JSON.parse(notification.data);
const notifCategory = parsedData['category'];
// alert( 'notifCategory:' + notifCategory + ' category:' + category);
if (notifCategory === category) {
return true;
}
}
return false;
}
public createNotification(title: string, text: string, date: Date,
category: string) {
const notifID = this.generateNotificationID();
this.scheduleNotification(notifID, title, text, date, category);
}
private scheduleNotification(notifId: number, title: string, text: string,
date: Date, category: string) {
this.localNotification.on('click').subscribe(notification => {
this.localNotification.clear(notification.id);
});
this.localNotification.schedule({
id: notifId,
title: title,
text: text,
trigger: {at: date},
data : {'category': category},
});
}
public deleteAllNotifications() {
this.localNotification.clearAll();
this.localNotification.cancelAll();
}
public cancelNotification(notifID: number) {
this.localNotification.cancel(notifID);
}
public clearTriggeredNotifications() {
this.localNotification.clearAll();
}
private generateNotificationID(): number {
return Date.now() + Math.floor(Math.random() * (1000 - 1) + 1);
}
public async getNotifications(): Promise<ILocalNotification[]> {
const notifs = await this.localNotification.getAll();
return notifs;
}
}

@ -1,33 +0,0 @@
<ion-grid class="zoomIn">
<ion-row>
<!-- button with text under-->
<ion-col text-center *ngFor="let method of methods" [size]="6">
<ion-grid>
<ion-row text-center (click)="openPayment(method.method)">
<ion-col center [size]="12">
<img class="button-anim rubberBand" [src]=" 'assets/icon/payment/' + method.icon + '.png'">
</ion-col>
<ion-col center [size]="12">
<ion-text color="primary">{{ method.title | translate }}</ion-text>
</ion-col>
</ion-row>
<ion-row>
<ion-col [size]="12" class="slideInUp">
<divider></divider>
</ion-col>
</ion-row>
</ion-grid>
</ion-col>
</ion-row>
<ion-row>
<div style="height: 1cm;"></div>
</ion-row>
<ion-row class="ion-justify-content-center">
<ion-col [size]="10" [sizeLg]="8" [sizeXl]="6" no-padding>
<ion-button (click)="onCancel()" expand="block">
{{'general,cancel' | translate}}
</ion-button>
</ion-col>
</ion-row>
</ion-grid>

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

@ -1,94 +0,0 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
import { PaymentService } from './service/payment.service';
import { PayRequestInfo } from './service/models/pay-request.info';
import { PaymentInfoModel } from './service/models/payment-info.model';
import { PaymentValidationResponse } from './service/models/payment-validation.response';
@Component({
selector: 'payment',
templateUrl: './payment.component.html',
styleUrls: ['./payment.component.scss'],
})
export class PaymentComponent implements OnInit {
public methods = [
{
icon: 'visa',
title: 'payment,visa',
method: PaymentService.VISA
},
{
icon: 'sadad',
title: 'payment,sadad',
method: PaymentService.SADAD
},
{
icon: 'mada',
title: 'payment,mada',
method: PaymentService.MADA
},
{
icon: 'mastercard',
title: 'payment,mastercard',
method: PaymentService.MASTERCARD
},
{
icon: 'instalment',
title: 'payment,instalment',
method: PaymentService.INSTALMENT
}
];
@Output() success = new EventEmitter();
@Output() faild = new EventEmitter();
@Output() cancel = new EventEmitter();
public orderDescription: string;
public amount: number;
private requestInfo: PayRequestInfo;
constructor(
public ts: TranslatorService,
public cs: CommonService,
public paymentService: PaymentService,
public sharedData: SharedDataService
) { }
ngOnInit() {
}
@Input() set payRequestInfo(payRequestInfo: PayRequestInfo) {
this.requestInfo = payRequestInfo;
this.amount = payRequestInfo.amount;
this.orderDescription = payRequestInfo.orderDescription;
}
get payRequestInfo(): PayRequestInfo {
return this.requestInfo;
}
public openPayment(method: string) {
/*this.paymentService.openPayment(this.amount, method, this.orderDescription).subscribe((success) => {
if (success) {
this.success.emit(this.requestInfo.data);
} else {
this.faild.emit();
}
});
*/
}
public onComplete(info: PaymentInfoModel) {
}
public onCancel() {
this.cancel.emit();
}
}

@ -1,6 +0,0 @@
export class PayRequestInfo {
public static SHARED_DATA = 'pay-request-info-shared';
amount: number;
orderDescription: string;
data: any;
}

@ -1,9 +0,0 @@
export class PaymentInfoModel {
transactionId: string;
amount: number;
constructor(amount: number, transactionId: string){
this.transactionId = transactionId;
this.amount = amount;
}
}

@ -1,9 +0,0 @@
import { Request } from 'src/app/hmg-common/services/models/request';
export class PaymentValidationRequest extends Request {
MerchantModuleSessionID: string;
PayOneProject: number ; // 0
PayOneService: number; // 4
LanguageID: number;
}

@ -1,8 +0,0 @@
import { Response } from 'src/app/hmg-common/services/models/response';
export class PaymentValidationResponse extends Response {
public static SHARED_DATA = 'payment_validation_shared';
Amount: number;
Merchant_Reference: string;
Response_Message: string;
}

@ -1,100 +0,0 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { PaymentInfoModel } from './models/payment-info.model';
import { PaymentValidationRequest } from './models/payment-validation.request';
import { PaymentValidationResponse } from './models/payment-validation.response';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { GuidService } from 'src/app/hmg-common/services/guid/guid.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
@Injectable({
providedIn: 'root'
})
export class PaymentService {
public static MADA = 'MADA';
public static MASTERCARD = 'MASTERCARD';
public static SADAD = 'SADAD ';
public static VISA = 'VISA';
public static INSTALMENT = 'INSTALMENT';
public static validateURL = 'Services/PayFort_Serv.svc/REST/GetRequestStatusByRequestID';
private static SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx';
constructor(
public cs: CommonService,
public ts: TranslatorService,
public con: ConnectorService,
public authService: AuthenticationService,
public guid: GuidService
) { }
public validatePayment(transactionID: string, onError: any, errorLabel: string): Observable<PaymentValidationResponse> {
const request = new PaymentValidationRequest();
request.ClientRequestID = transactionID;
// this.authService.authenticateRequest(request);
return this.con.post(PaymentService.validateURL, request, onError, errorLabel);
}
public openPayment(amount: number, method: string, orderDesc: string, ): Observable<boolean> {
return Observable.create(observer => {
const transactionID = this.guid.generate();
this.cs.openBrowser( this.generateURL( amount, method, orderDesc, transactionID) ,
() => this.notifyCallerDone(observer, true) ,
() => this.notifyCallerDone(observer, false) );
// this.hmgBrowser.registerBack(() => this.notifyCaller(observer, amount, transactionID));
// this.hmgBrowser.registerClose(() => this.notifyCaller(observer, amount, transactionID));
});
}
private notifyCaller(observer: any, amount: number, transactionID: string) {
observer.next(new PaymentInfoModel(amount, transactionID)) ;
observer.complete();
}
private notifyCallerDone(observer: any,done: boolean) {
observer.next( done) ;
observer.complete();
}
private generateURL( amount: number, method: string, orderDesc: string, transactionID: string): string {
let form = this.getForm();
const user = this.authService.getAuthenticatedUser();
if (user) {
form = form.replace('EMAIL_VALUE', user.Email || user.EmailAddress);
}
form = form.replace('AMOUNT_VALUE', (amount || 0 ).toString());
form = form.replace('METHOD_VALUE', method);
form = form.replace('ORDER_DESCRIPTION_VALUE', orderDesc);
form = form.replace('ORDER_ID_VALUE', transactionID);
form = form.replace('SERVICE_URL_VALUE', PaymentService.SERVICE_URL);
console.log(form);
const base64URL = 'data:text/html;base64,' + btoa(form);
console.log(base64URL);
return base64URL;
}
public getForm(): string {
return '<html> ' +
'<head></head>' +
'<body>' +
'<form id="paymentForm" action="SERVICE_URL_VALUE" method="post">' +
'<input type="hidden" name="Amount" value="AMOUNT_VALUE">' +
'<input type="hidden" name="ServID" value="2">' +
'<input type="hidden" name="Email" value="EMAIL_VALUE">' +
'<input type="hidden" name="PaymentOption" value="METHOD_VALUE">' +
'<input type="hidden" name="Order_Desc" value="ORDER_DESCRIPTION_VALUE">' +
'<input type="hidden" name="OrderID" value="ORDER_ID_VALUE">' +
'<input type="hidden" name="ChannelID" value="3">' +
'<input type="hidden" name="ProjID" value="0">' +
'<input type="hidden" name="Lang" value="en" >' +
'<input type="hidden" name="ReturnURL" value="' + TranslatorService.getCurrentLanguageName() + '" >' +
'</form>' +
'<script type="text/javascript"> document.getElementById("paymentForm").submit(); </script>' +
'</body>' +
'</html>';
}
}

@ -1,12 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { PaymentService } from './payment.service';
describe('PaymentService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: PaymentService = TestBed.get(PaymentService);
expect(service).toBeTruthy();
});
});

@ -1,110 +0,0 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { PaymentInfoModel } from './models/payment-info.model';
import { PaymentValidationRequest } from './models/payment-validation.request';
import { PaymentValidationResponse } from './models/payment-validation.response';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { GuidService } from 'src/app/hmg-common/services/guid/guid.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { Response } from 'src/app/hmg-common/services/models/response';
@Injectable({
providedIn: 'root'
})
export class PaymentService {
public static MADA = 'MADA';
public static MASTERCARD = 'MASTERCARD';
public static SADAD = 'SADAD ';
public static VISA = 'VISA';
public static INSTALMENT = 'INSTALMENT';
private static SERVICE_URL = 'https://hmgwebservices.com/PayOneDev/Pay_Request.aspx';
public static paymentStatusURL = 'Services/PayOne.svc/REST/PayOneGetRequestsByProjectServiceAndItem';
constructor(
public cs: CommonService,
public ts: TranslatorService,
public con: ConnectorService,
public authService: AuthenticationService,
public guid: GuidService
) { }
public getPaymentLanguageID(): number {
return TranslatorService.getCurrentLanguageName() == 'en' ? 1 : 0;
}
public getPaymentStatus(transactionID: string, onError: any, errorLabel: string):
Observable<Response> {
const request = new PaymentValidationRequest();
request.MerchantModuleSessionID = transactionID;
request.PayOneProject = 0;
request.PayOneService = 4;
request.LanguageID = this.getPaymentLanguageID();
this.authService.authenticateRequest(request);
return this.con.postNoLoad(PaymentService.paymentStatusURL, request, onError);
}
public openPayment(amount: number, transactionID: string, orderDesc: string): Observable<boolean> {
return Observable.create(observer => {
// const transactionID = this.guid.generate();
this.cs.openBrowser(this.generateURL(amount, orderDesc, transactionID),
() => this.notifyCallerDone(observer, true),
() => this.notifyCallerDone(observer, false),
() => this.notifyCallerDone(observer, true),
['success' ]);
// this.hmgBrowser.registerBack(() => this.notifyCaller(observer, amount, transactionID));
// this.hmgBrowser.registerClose(() => this.notifyCaller(observer, amount, transactionID));
});
}
private notifyCaller(observer: any, amount: number, transactionID: string) {
observer.next(new PaymentInfoModel(amount, transactionID));
observer.complete();
}
private notifyCallerDone(observer: any, done: boolean) {
observer.next(done);
observer.complete();
}
private generateURL(amount: number, orderDesc: string, transactionID: string): string {
let form = this.getForm();
const user = this.authService.getAuthenticatedUser();
// if (user) {
// form = form.replace('EMAIL_VALUE', user.Email || user.EmailAddress);
// }
form = form.replace('AMOUNT_VALUE', (amount || 0).toString());
form = form.replace('ORDER_DESCRIPTION_VALUE', orderDesc);
form = form.replace('SESSION_ID_VALUE', transactionID);
form = form.replace('REQUEST_ID_VALUE', transactionID);
form = form.replace('PROJECT_ID_VALUE', 'ENTED');
form = form.replace('SERVICE_URL_VALUE', PaymentService.SERVICE_URL);
console.log(form);
const base64URL = 'data:text/html;base64,' + btoa(form);
console.log(base64URL);
return base64URL;
}
public getForm(): string {
return '<html> ' +
'<head></head>' +
'<body>' +
'<form id="paymentForm" action="SERVICE_URL_VALUE" method="post">' +
'<input type="hidden" name="amount" value="AMOUNT_VALUE">' +
'<input type="hidden" name="ProjID" value="PROJECT_ID_VALUE">' +
'<input type="hidden" name="PaymentDesc" value="ORDER_DESCRIPTION_VALUE">' +
'<input type="hidden" name="sessID" value="SESSION_ID_VALUE">' +
'<input type="hidden" name="reqID" value="REQUEST_ID_VALUE">' +
'<input type="hidden" name="PayType" value="0">' +
'<input type="hidden" name="langID" value="' + (TranslatorService.getCurrentLanguageName() == 'en' ? '1' : '0') + '" >' +
'<input type="hidden" name="ResponseContinueURL" value="http://hmg.com/Documents/success.html" >' +
'<input type="hidden" name="BackClickUrl" value="http://hmg.com/Documents/success.html" >' +
'</form>' +
'<script type="text/javascript"> document.getElementById("paymentForm").submit(); </script>' +
'</body>' +
'</html>';
}
}

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { UserDetailsRequest } from './model/user-details.request';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
import { UserLocalNotificationService } from 'src/app/hmg-common/services/user-local-notification/user-local-notification.service';
//import { UserLocalNotificationService } from 'src/app/hmg-common/services/user-local-notification/user-local-notification.service';
import { Observable } from 'rxjs';
import { Response } from 'src/app/hmg-common/services/models/response';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
@ -26,7 +26,7 @@ export class SMSService {
constructor(
public con: ConnectorService,
public auth: AuthenticationService,
public notifications: UserLocalNotificationService,
//public notifications: UserLocalNotificationService,
public ts: TranslatorService
) {
}

@ -8,7 +8,7 @@
<ion-grid>
<ion-row>
<ion-col class="colPad">
<ion-img class="centerDiv" src="../assets/imgs/CS.png"></ion-img>
<ion-img class="centerDiv" src="../assets/imgs/HMG.png"></ion-img>
</ion-col>
</ion-row>
<ion-row>

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { UserDetailsRequest } from './model/user-details.request';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
import { UserLocalNotificationService } from 'src/app/hmg-common/services/user-local-notification/user-local-notification.service';
//import { UserLocalNotificationService } from 'src/app/hmg-common/services/user-local-notification/user-local-notification.service';
import { Observable } from 'rxjs';
import { Response } from 'src/app/hmg-common/services/models/response';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
@ -21,7 +21,7 @@ export class SMSDialogService {
constructor(
public con: ConnectorService,
public auth: AuthenticationService,
public notifications: UserLocalNotificationService,
//public notifications: UserLocalNotificationService,
public ts: TranslatorService
) {
}

@ -0,0 +1,40 @@
{
"project_info": {
"project_number": "679409052782",
"firebase_url": "https://mohemm-dce93.firebaseio.com",
"project_id": "mohemm-dce93",
"storage_bucket": "mohemm-dce93.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:679409052782:android:dba155ac0859d7fea78a7f",
"android_client_info": {
"package_name": "hmg.cloudSolutions.mohem"
}
},
"oauth_client": [
{
"client_id": "679409052782-mtd6d8rjltucnm9uatn6g7et08sm6lbv.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDgWjuSBIKGghWxYg_KGBRIZTi-O_UA8mU"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "679409052782-mtd6d8rjltucnm9uatn6g7et08sm6lbv.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}

@ -0,0 +1,40 @@
{
"project_info": {
"project_number": "448880075189",
"firebase_url": "https://al-habib-mohemm.firebaseio.com",
"project_id": "al-habib-mohemm",
"storage_bucket": "al-habib-mohemm.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:448880075189:android:5bb4821d515a826d88b9fc",
"android_client_info": {
"package_name": "com.cloudsolutions.alhabibmohemm"
}
},
"oauth_client": [
{
"client_id": "448880075189-49hc2l78pr9hsmr9p3k7j411r40diej8.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyC8nrli7eyuRNow8nF-QHvDMOxqUkj6fEw"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "448880075189-49hc2l78pr9hsmr9p3k7j411r40diej8.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}

Binary file not shown.
Loading…
Cancel
Save