pushed for new release

master-newdesign-15-Dec-location
umasoodch 4 years ago
parent f997ac8812
commit 1d832ba36d

@ -0,0 +1,29 @@
<?xml version='1.0' encoding='utf-8'?>
<plugin id="com.huawei.cordovahmsgmscheckplugin" version="1.0.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>CordovaHMSGMSCheckPlugin</name>
<js-module name="CordovaHMSGMSCheckPlugin" src="www/CordovaHMSGMSCheckPlugin.js">
<clobbers target="cordova.plugins.CordovaHMSGMSCheckPlugin" />
</js-module>
<platform name="android">
<!-- hook for add maven repositories and agc plugin-->
<hook src="scripts/android/after_plugin_install.js" type="after_plugin_install" />
<hook src="scripts/android/before_plugin_uninstall.js" type="before_plugin_uninstall" />
<framework custom="true" src="src/android/build.gradle" type="gradleReference" />
<!-- Account Kit dependency-->
<framework src="com.huawei.hms:base:5.0.4.301" />
<!-- <framework src="com.google.android.gms:play-services-base:17.2.1" /> -->
<config-file parent="/*" target="res/xml/config.xml">
<feature name="CordovaHMSGMSCheckPlugin">
<param name="android-package"
value="com.huawei.cordovahmsgmscheckplugin.CordovaHMSGMSCheckPlugin" />
</feature>
</config-file>
<config-file parent="/*" target="AndroidManifest.xml"></config-file>
<source-file src="src/android/CordovaHMSGMSCheckPlugin.java"
target-dir="src/com/huawei/cordovahmsgmscheckplugin" />
</platform>
<!-- Script help to copy agconnect-services.json to right places-->
<hook src="scripts/after_prepare.js" type="after_prepare" />
</plugin>

@ -0,0 +1,37 @@
#!/usr/bin/env node
"use strict";
/**
* This hook makes sure projects using [cordova-plugin-firebase](https://github.com/arnesson/cordova-plugin-firebase)
* will build properly and have the required key files copied to the proper destinations when the app is build on Ionic Cloud using the package command.
* Credits: https://github.com/arnesson.
*/
var fs = require("fs");
var path = require("path");
var utilities = require("./lib/utilities");
var config = fs.readFileSync("config.xml").toString();
var name = utilities.getValue(config, "name");
var ANDROID_DIR = "platforms/android";
var PLATFORM = {
ANDROID: {
dest: [ANDROID_DIR + "/app/agconnect-services.json"],
src: ["agconnect-services.json"],
},
};
module.exports = function (context) {
//get platform from the context supplied by cordova
var platforms = context.opts.platforms;
// Copy key files to their platform specific folders
if (
platforms.indexOf("android") !== -1 &&
utilities.directoryExists(ANDROID_DIR)
) {
console.log("Preparing HMS GMS Check Kit on Android");
// utilities.copyKey(PLATFORM.ANDROID);
}
};

@ -0,0 +1,9 @@
var helper = require('./helper');
module.exports = function(context) {
// Modify the Gradle build file to add a task that will upload the debug symbols
// at build time.
helper.restoreRootBuildGradle();
helper.modifyRootBuildGradle();
};

@ -0,0 +1,7 @@
var helper = require('./helper');
module.exports = function(context) {
// Remove the Gradle modifications that were added when the plugin was installed.
helper.restoreRootBuildGradle();
};

@ -0,0 +1,131 @@
var fs = require("fs");
var path = require("path");
function rootBuildGradleExists() {
var target = path.join("platforms", "android", "build.gradle");
return fs.existsSync(target);
}
/*
* Helper function to read the build.gradle that sits at the root of the project
*/
function readRootBuildGradle() {
var target = path.join("platforms", "android", "build.gradle");
return fs.readFileSync(target, "utf-8");
}
/*
* Added a dependency on 'com.google.gms' based on the position of the know 'com.android.tools.build' dependency in the build.gradle
*/
function addDependencies(buildGradle) {
// find the known line to match
var match = buildGradle.match(
/^(\s*)classpath 'com.android.tools.build(.*)/m
);
var whitespace = match[1];
// modify the line to add the necessary dependencies
var agcDependency =
whitespace + "classpath 'com.huawei.agconnect:agcp:1.2.0.300'";
var modifiedLine = match[0] + "\n" + agcDependency;
// modify the actual line
return buildGradle.replace(
/^(\s*)classpath 'com.android.tools.build(.*)/m,
modifiedLine
);
}
/*
* Add 'google()' and Crashlytics to the repository repo list
*/
function addRepos(buildGradle) {
// find the known line to match
var match = buildGradle.match(/^(\s*)jcenter\(\)/m);
var whitespace = match[1];
// modify the line to add the necessary repo
var huaweiMavenRepo =
whitespace + "maven { url 'http://developer.huawei.com/repo/' }";
var modifiedLine = match[0] + "\n" + huaweiMavenRepo;
// modify the actual line
buildGradle = buildGradle.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
// update the all projects grouping
var allProjectsIndex = buildGradle.indexOf("allprojects");
if (allProjectsIndex > 0) {
// split the string on allprojects because jcenter is in both groups and we need to modify the 2nd instance
var firstHalfOfFile = buildGradle.substring(0, allProjectsIndex);
var secondHalfOfFile = buildGradle.substring(allProjectsIndex);
// Add google() to the allprojects section of the string
match = secondHalfOfFile.match(/^(\s*)jcenter\(\)/m);
var huaweiMavenRepo =
whitespace + "maven { url 'http://developer.huawei.com/repo/' }";
modifiedLine = match[0] + "\n" + huaweiMavenRepo;
// modify the part of the string that is after 'allprojects'
secondHalfOfFile = secondHalfOfFile.replace(
/^(\s*)jcenter\(\)/m,
modifiedLine
);
// recombine the modified line
buildGradle = firstHalfOfFile + secondHalfOfFile;
} else {
// this should not happen, but if it does, we should try to add the dependency to the buildscript
match = buildGradle.match(/^(\s*)jcenter\(\)/m);
var huaweiMavenRepo =
whitespace + "maven { url 'http://developer.huawei.com/repo/' }";
modifiedLine = match[0] + "\n" + huaweiMavenRepo;
// modify the part of the string that is after 'allprojects'
buildGradle = buildGradle.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
}
return buildGradle;
}
/*
* Helper function to write to the build.gradle that sits at the root of the project
*/
function writeRootBuildGradle(contents) {
var target = path.join("platforms", "android", "build.gradle");
fs.writeFileSync(target, contents);
}
module.exports = {
modifyRootBuildGradle: function () {
// be defensive and don't crash if the file doesn't exist
if (!rootBuildGradleExists) {
return;
}
var buildGradle = readRootBuildGradle();
// Add Google Play Services Dependency
buildGradle = addDependencies(buildGradle);
// Add Google's Maven Repo
buildGradle = addRepos(buildGradle);
writeRootBuildGradle(buildGradle);
},
restoreRootBuildGradle: function () {
// be defensive and don't crash if the file doesn't exist
if (!rootBuildGradleExists) {
return;
}
var buildGradle = readRootBuildGradle();
// remove any lines we added
buildGradle = buildGradle.replace(
/(?:^|\r?\n)(.*)com.huawei.cordovahmsgmscheckplugin*?(?=$|\r?\n)/g,
""
);
writeRootBuildGradle(buildGradle);
},
};

@ -0,0 +1,93 @@
/**
* Utilities and shared functionality for the build hooks.
*/
var fs = require("fs");
var path = require("path");
fs.ensureDirSync = function (dir) {
if (!fs.existsSync(dir)) {
dir.split(path.sep).reduce(function (currentPath, folder) {
currentPath += folder + path.sep;
if (!fs.existsSync(currentPath)) {
fs.mkdirSync(currentPath);
}
return currentPath;
}, "");
}
};
module.exports = {
/**
* Used to get the name of the application as defined in the config.xml.
*
* @param {object} context - The Cordova context.
* @returns {string} The value of the name element in config.xml.
*/
getAppName: function (context) {
var ConfigParser = context.requireCordovaModule("cordova-lib").configparser;
var config = new ConfigParser("config.xml");
return config.name();
},
/**
* The ID of the plugin; this should match the ID in plugin.xml.
*/
getPluginId: function () {
return "com.huawei.cordovahmsgmscheckplugin";
},
copyKey: function (platform) {
for (var i = 0; i < platform.src.length; i++) {
var file = platform.src[i];
if (this.fileExists(file)) {
try {
var contents = fs.readFileSync(file).toString();
try {
platform.dest.forEach(function (destinationPath) {
var folder = destinationPath.substring(
0,
destinationPath.lastIndexOf("/")
);
fs.ensureDirSync(folder);
fs.writeFileSync(destinationPath, contents);
});
} catch (e) {
// skip
}
} catch (err) {
console.log(err);
}
break;
}
}
},
getValue: function (config, name) {
var value = config.match(
new RegExp("<" + name + "(.*?)>(.*?)</" + name + ">", "i")
);
if (value && value[2]) {
return value[2];
} else {
return null;
}
},
fileExists: function (path) {
try {
return fs.statSync(path).isFile();
} catch (e) {
return false;
}
},
directoryExists: function (path) {
try {
return fs.statSync(path).isDirectory();
} catch (e) {
return false;
}
},
};

@ -0,0 +1,88 @@
package com.huawei.cordovahmsgmscheckplugin;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.huawei.hms.api.HuaweiApiAvailability;
// import com.google.android.gms.common.GoogleApiAvailability;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaInterfaceImpl;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/**
* This class echoes a string called from JavaScript.
*/
public class CordovaHMSGMSCheckPlugin extends CordovaPlugin {
private static final String TAG = CordovaHMSGMSCheckPlugin.class.getSimpleName();
private CallbackContext mCallbackContext;
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
switch (action) {
case "isHmsAvailable":
mCallbackContext = callbackContext;
cordova.getThreadPool().execute(this::isHmsAvailable);
return true;
case "isGmsAvailable":
// mCallbackContext = callbackContext;
// cordova.getThreadPool().execute(this::isGmsAvailable);
return false;
}
return false;
}
private void isHmsAvailable() {
boolean isAvailable = false;
Context context = cordova.getContext();
if (null != cordova.getContext()) {
int result = HuaweiApiAvailability.getInstance().isHuaweiMobileServicesAvailable(context);
isAvailable = (com.huawei.hms.api.ConnectionResult.SUCCESS == result);
}
Log.i("Cordova", "isHmsAvailable: " + isAvailable);
String msg = "false";
if(isAvailable){
msg = "true";
}
outputCallbackContext(0, msg);
}
// private void isGmsAvailable() {
// boolean isAvailable = false;
// Context context = cordova.getContext();
// if (null != context) {
// int result = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
// isAvailable = (com.google.android.gms.common.ConnectionResult.SUCCESS == result);
// }
// Log.i("Cordova", "isGmsAvailable: " + isAvailable);
// String msg = "false";
// if(isAvailable){
// msg = "true";
// }
// outputCallbackContext(0, msg);
// }
/**
* @param type 0-success,1-error
* @param msg message
*/
private void outputCallbackContext(int type, String msg) {
if (mCallbackContext != null) {
switch (type) {
case 0:
mCallbackContext.success(msg);
break;
case 1:
mCallbackContext.error(msg);
break;
}
}
}
}

@ -0,0 +1,29 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
// huawei maven
maven { url 'http://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// classpath 'com.huawei.agconnect:agcp:1.2.0.300'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
// huawei maven
maven { url 'http://developer.huawei.com/repo/' }
}
}
cdvPluginPostBuildExtras.add({
apply plugin: 'com.huawei.agconnect'
})

@ -0,0 +1,29 @@
<?xml version='1.0' encoding='utf-8'?>
<plugin xmlns:android="http://schemas.android.com/apk/res/android" id="com.huawei.cordovahmslocationplugin"
version="1.0.0"
xmlns="http://apache.org/cordova/ns/plugins/1.0">
<name>CordovaHMSLocationPlugin</name>
<js-module name="CordovaHMSLocationPlugin" src="www/CordovaHMSLocationPlugin.js">
<clobbers target="cordova.plugins.CordovaHMSLocationPlugin" />
</js-module>
<platform name="android">
<!-- hook for add maven repositories and agc plugin-->
<hook src="scripts/android/after_plugin_install.js" type="after_plugin_install" />
<hook src="scripts/android/before_plugin_uninstall.js" type="before_plugin_uninstall" />
<framework custom="true" src="src/android/build.gradle" type="gradleReference" />
<!-- Location Kit dependency-->
<framework src="com.huawei.hms:location:4.0.0.300" />
<config-file parent="/*" target="res/xml/config.xml">
<feature name="CordovaHMSLocationPlugin">
<param name="android-package"
value="com.huawei.cordovahmslocationplugin.CordovaHMSLocationPlugin" />
</feature>
</config-file>
<config-file parent="/*" target="AndroidManifest.xml"></config-file>
<source-file src="src/android/CordovaHMSLocationPlugin.java"
target-dir="src/com/huawei/cordovahmslocationplugin" />
</platform>
<!-- Script help to copy agconnect-services.json to right places-->
<hook src="scripts/after_prepare.js" type="after_prepare" />
</plugin>

@ -0,0 +1,38 @@
#!/usr/bin/env node
'use strict';
/**
* This hook makes sure projects using [cordova-plugin-firebase](https://github.com/arnesson/cordova-plugin-firebase)
* will build properly and have the required key files copied to the proper destinations when the app is build on Ionic Cloud using the package command.
* Credits: https://github.com/arnesson.
*/
var fs = require('fs');
var path = require('path');
var utilities = require("./lib/utilities");
var config = fs.readFileSync('config.xml').toString();
var name = utilities.getValue(config, 'name');
var ANDROID_DIR = 'platforms/android';
var PLATFORM = {
ANDROID: {
dest: [
ANDROID_DIR + '/app/agconnect-services.json'
],
src: [
'agconnect-services.json'
],
}
};
module.exports = function (context) {
//get platform from the context supplied by cordova
var platforms = context.opts.platforms;
// Copy key files to their platform specific folders
if (platforms.indexOf('android') !== -1 && utilities.directoryExists(ANDROID_DIR)) {
console.log('Preparing HMS Location Kit on Android');
utilities.copyKey(PLATFORM.ANDROID);
}
};

@ -0,0 +1,9 @@
var helper = require('./helper');
module.exports = function(context) {
// Modify the Gradle build file to add a task that will upload the debug symbols
// at build time.
helper.restoreRootBuildGradle();
helper.modifyRootBuildGradle();
};

@ -0,0 +1,7 @@
var helper = require('./helper');
module.exports = function(context) {
// Remove the Gradle modifications that were added when the plugin was installed.
helper.restoreRootBuildGradle();
};

@ -0,0 +1,117 @@
var fs = require("fs");
var path = require("path");
function rootBuildGradleExists() {
var target = path.join("platforms", "android", "build.gradle");
return fs.existsSync(target);
}
/*
* Helper function to read the build.gradle that sits at the root of the project
*/
function readRootBuildGradle() {
var target = path.join("platforms", "android", "build.gradle");
return fs.readFileSync(target, "utf-8");
}
/*
* Added a dependency on 'com.google.gms' based on the position of the know 'com.android.tools.build' dependency in the build.gradle
*/
function addDependencies(buildGradle) {
// find the known line to match
var match = buildGradle.match(/^(\s*)classpath 'com.android.tools.build(.*)/m);
var whitespace = match[1];
// modify the line to add the necessary dependencies
var agcDependency = whitespace + 'classpath \'com.huawei.agconnect:agcp:1.2.0.300\''
var modifiedLine = match[0] + '\n' + agcDependency;
// modify the actual line
return buildGradle.replace(/^(\s*)classpath 'com.android.tools.build(.*)/m, modifiedLine);
}
/*
* Add 'google()' and Crashlytics to the repository repo list
*/
function addRepos(buildGradle) {
// find the known line to match
var match = buildGradle.match(/^(\s*)jcenter\(\)/m);
var whitespace = match[1];
// modify the line to add the necessary repo
var huaweiMavenRepo = whitespace + 'maven { url \'http://developer.huawei.com/repo/\' }'
var modifiedLine = match[0] + '\n' + huaweiMavenRepo;
// modify the actual line
buildGradle = buildGradle.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
// update the all projects grouping
var allProjectsIndex = buildGradle.indexOf('allprojects');
if (allProjectsIndex > 0) {
// split the string on allprojects because jcenter is in both groups and we need to modify the 2nd instance
var firstHalfOfFile = buildGradle.substring(0, allProjectsIndex);
var secondHalfOfFile = buildGradle.substring(allProjectsIndex);
// Add google() to the allprojects section of the string
match = secondHalfOfFile.match(/^(\s*)jcenter\(\)/m);
var huaweiMavenRepo = whitespace + 'maven { url \'http://developer.huawei.com/repo/\' }'
modifiedLine = match[0] + '\n' + huaweiMavenRepo;
// modify the part of the string that is after 'allprojects'
secondHalfOfFile = secondHalfOfFile.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
// recombine the modified line
buildGradle = firstHalfOfFile + secondHalfOfFile;
} else {
// this should not happen, but if it does, we should try to add the dependency to the buildscript
match = buildGradle.match(/^(\s*)jcenter\(\)/m);
var huaweiMavenRepo = whitespace + 'maven { url \'http://developer.huawei.com/repo/\' }'
modifiedLine = match[0] + '\n' + huaweiMavenRepo;
// modify the part of the string that is after 'allprojects'
buildGradle = buildGradle.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
}
return buildGradle;
}
/*
* Helper function to write to the build.gradle that sits at the root of the project
*/
function writeRootBuildGradle(contents) {
var target = path.join("platforms", "android", "build.gradle");
fs.writeFileSync(target, contents);
}
module.exports = {
modifyRootBuildGradle: function() {
// be defensive and don't crash if the file doesn't exist
if (!rootBuildGradleExists) {
return;
}
var buildGradle = readRootBuildGradle();
// Add Google Play Services Dependency
buildGradle = addDependencies(buildGradle);
// Add Google's Maven Repo
buildGradle = addRepos(buildGradle);
writeRootBuildGradle(buildGradle);
},
restoreRootBuildGradle: function() {
// be defensive and don't crash if the file doesn't exist
if (!rootBuildGradleExists) {
return;
}
var buildGradle = readRootBuildGradle();
// remove any lines we added
buildGradle = buildGradle.replace(/(?:^|\r?\n)(.*)com.huawei.cordovahmspushplugin*?(?=$|\r?\n)/g, '');
writeRootBuildGradle(buildGradle);
}
};

@ -0,0 +1,88 @@
/**
* Utilities and shared functionality for the build hooks.
*/
var fs = require('fs');
var path = require("path");
fs.ensureDirSync = function (dir) {
if (!fs.existsSync(dir)) {
dir.split(path.sep).reduce(function (currentPath, folder) {
currentPath += folder + path.sep;
if (!fs.existsSync(currentPath)) {
fs.mkdirSync(currentPath);
}
return currentPath;
}, '');
}
};
module.exports = {
/**
* Used to get the name of the application as defined in the config.xml.
*
* @param {object} context - The Cordova context.
* @returns {string} The value of the name element in config.xml.
*/
getAppName: function (context) {
var ConfigParser = context.requireCordovaModule("cordova-lib").configparser;
var config = new ConfigParser("config.xml");
return config.name();
},
/**
* The ID of the plugin; this should match the ID in plugin.xml.
*/
getPluginId: function () {
return "com.huawei.cordovahmspushplugin";
},
copyKey: function (platform) {
for (var i = 0; i < platform.src.length; i++) {
var file = platform.src[i];
if (this.fileExists(file)) {
try {
var contents = fs.readFileSync(file).toString();
try {
platform.dest.forEach(function (destinationPath) {
var folder = destinationPath.substring(0, destinationPath.lastIndexOf('/'));
fs.ensureDirSync(folder);
fs.writeFileSync(destinationPath, contents);
});
} catch (e) {
// skip
}
} catch (err) {
console.log(err);
}
break;
}
}
},
getValue: function (config, name) {
var value = config.match(new RegExp('<' + name + '(.*?)>(.*?)</' + name + '>', 'i'));
if (value && value[2]) {
return value[2]
} else {
return null
}
},
fileExists: function (path) {
try {
return fs.statSync(path).isFile();
} catch (e) {
return false;
}
},
directoryExists: function (path) {
try {
return fs.statSync(path).isDirectory();
} catch (e) {
return false;
}
}
};

@ -0,0 +1,186 @@
package com.huawei.cordovahmslocationplugin;
import android.Manifest;
import android.content.IntentSender;
import android.location.Location;
import android.os.Build;
import android.os.Looper;
import android.util.Log;
import com.huawei.hms.common.ApiException;
import com.huawei.hms.common.ResolvableApiException;
import com.huawei.hms.location.FusedLocationProviderClient;
import com.huawei.hms.location.LocationCallback;
import com.huawei.hms.location.LocationRequest;
import com.huawei.hms.location.LocationResult;
import com.huawei.hms.location.LocationServices;
import com.huawei.hms.location.LocationSettingsRequest;
import com.huawei.hms.location.LocationSettingsStatusCodes;
import com.huawei.hms.location.SettingsClient;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.PluginResult;
import org.json.JSONArray;
import org.json.JSONException;
/**
*
*/
// https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-References-V1/data-types-0000001056511617-V1#section2512153819346
public class CordovaHMSLocationPlugin extends CordovaPlugin {
private static final String TAG = CordovaHMSLocationPlugin.class.getSimpleName();
private FusedLocationProviderClient fusedLocationProviderClient;
private LocationRequest mLocationRequest;
private LocationCallback mLocationCallback;
private CallbackContext mCallbackContext;
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
requestPermission();
if (fusedLocationProviderClient == null) {
fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(cordova.getContext());
}
switch (action) {
case "requestLocation":
this.setLocationRequest();
this.setLocationCallback();
this.checkLocationSetting(callbackContext);
return true;
case "removeLocation":
this.stopLocation();
return true;
case "getLastlocation":
this.getLastlocation(callbackContext);
return true;
default:
return false;
}
}
private void returnLocation(Location location) {
if (mCallbackContext != null) {
Log.d(TAG, "returnLocation");
String message = location.getLatitude() + "," + location.getLongitude() + "," + location.isFromMockProvider();
PluginResult result = new PluginResult(PluginResult.Status.OK, message);
result.setKeepCallback(true);
mCallbackContext.sendPluginResult(result);
}
}
private void getLastlocation(CallbackContext callbackContext) {
fusedLocationProviderClient.getLastLocation().addOnSuccessListener(location -> {
Log.d(TAG, "getLastlocation success");
if (location == null) {
return;
}
// Location对象的处理逻辑
String message = location.getLatitude() + "," + location.getLongitude();
callbackContext.success(message);
}).addOnFailureListener(e -> {
// 异常处理逻辑
callbackContext.error("getLastlocation fail");
});
}
private void stopLocation() {
if (fusedLocationProviderClient == null) {
Log.d(TAG, "fusedLocationProviderClient is null");
return;
}
// 注意停止位置更新时mLocationCallback必须与requestLocationUpdates方法中的LocationCallback参数为同一对象。
fusedLocationProviderClient.removeLocationUpdates(mLocationCallback)
.addOnSuccessListener(aVoid -> {
// 停止位置更新成功
Log.d(TAG, "stop success");
mCallbackContext = null;
})
.addOnFailureListener(e -> {
// 停止位置更新失败
Log.d(TAG, "stop fail");
});
}
private void setLocationCallback() {
mLocationCallback = new LocationCallback() {
@Override
public void onLocationResult(LocationResult locationResult) {
if (locationResult != null) {
//处理位置回调结果
if (mLocationCallback != null) {
Log.d(TAG, "onLocationResult");
Location location = locationResult.getLocations().get(0);
returnLocation(location);
}
}
}
};
}
private void setLocationRequest() {
mLocationRequest = new LocationRequest();
// 设置位置更新的间隔(毫秒为单位)
mLocationRequest.setInterval(10000);
// mLocationRequest.setNumUpdates(1);
// 设置权重
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
}
private void checkLocationSetting(CallbackContext callbackContext) {
SettingsClient settingsClient = LocationServices.getSettingsClient(cordova.getContext());
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder();
builder.addLocationRequest(mLocationRequest);
LocationSettingsRequest locationSettingsRequest = builder.build();
// 检查设备定位设置
settingsClient.checkLocationSettings(locationSettingsRequest)
.addOnSuccessListener(locationSettingsResponse -> {
// 设置满足定位条件,再发起位置请求
fusedLocationProviderClient
.requestLocationUpdates(mLocationRequest, mLocationCallback, Looper.getMainLooper())
.addOnSuccessListener(aVoid -> {
// 接口调用成功的处理
Log.d(TAG, "request success");
mCallbackContext = callbackContext;
});
})
.addOnFailureListener(e -> {
// 设置不满足定位条件
int statusCode = ((ApiException) e).getStatusCode();
switch (statusCode) {
case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
try {
ResolvableApiException rae = (ResolvableApiException) e;
// 调用startResolutionForResult可以弹窗提示用户打开相应权限
rae.startResolutionForResult(cordova.getActivity(), 0);
} catch (IntentSender.SendIntentException sie) {
Log.d(TAG, sie.getMessage());
}
break;
}
});
}
private void requestPermission() {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
Log.i(TAG, "sdk < 29 Q");
if (!cordova.hasPermission(Manifest.permission.ACCESS_FINE_LOCATION)
|| !cordova.hasPermission(Manifest.permission.ACCESS_COARSE_LOCATION)) {
String[] strings =
{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION};
cordova.requestPermissions(this, 1, strings);
}
} else {
if (!cordova.hasPermission(Manifest.permission.ACCESS_FINE_LOCATION)
|| !cordova.hasPermission(Manifest.permission.ACCESS_COARSE_LOCATION)
|| !cordova.hasPermission("android.permission.ACCESS_BACKGROUND_LOCATION")) {
String[] strings = {android.Manifest.permission.ACCESS_FINE_LOCATION,
android.Manifest.permission.ACCESS_COARSE_LOCATION,
"android.permission.ACCESS_BACKGROUND_LOCATION"};
cordova.requestPermissions(this, 2, strings);
}
}
}
}

@ -0,0 +1,29 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
// huawei maven
maven { url 'http://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.huawei.agconnect:agcp:1.2.0.300'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
// huawei maven
maven { url 'http://developer.huawei.com/repo/' }
}
}
cdvPluginPostBuildExtras.add({
apply plugin: 'com.huawei.agconnect'
})

@ -0,0 +1,38 @@
<?xml version='1.0' encoding='utf-8'?><!-- Plugin Id and Version-->
<plugin xmlns:android="http://schemas.android.com/apk/res/android"
id="com.huawei.cordovahmspushplugin" version="1.0.0"
xmlns="http://apache.org/cordova/ns/plugins/1.0">
<js-module name="CordovaHMSPushPlugin" src="www/CordovaHMSPushPlugin.js">
<clobbers target="cordova.plugins.CordovaHMSPushPlugin" />
</js-module>
<!-- Plugin Name -->
<name>CordovaHMSPushPlugin</name>
<platform name="android">
<!-- hook for add maven repositories and agc plugin-->
<hook src="scripts/android/after_plugin_install.js" type="after_plugin_install" />
<hook src="scripts/android/before_plugin_uninstall.js" type="before_plugin_uninstall" />
<framework custom="true" src="src/android/build.gradle" type="gradleReference" />
<!-- Push Kit dependency-->
<framework src="com.huawei.hms:push:4.0.0.300" />
<config-file parent="/*" target="res/xml/config.xml">
<feature name="CordovaHMSPushPlugin">
<param name="android-package"
value="com.huawei.cordovahmspushplugin.CordovaHMSPushPlugin" />
</feature>
</config-file>
<config-file parent="/manifest/application" target="AndroidManifest.xml">
<service android:exported="false" android:name="com.huawei.cordovahmspushplugin.MessageService">
<intent-filter>
<action android:name="com.huawei.push.action.MESSAGING_EVENT" />
</intent-filter>
</service>
</config-file>
<source-file src="src/android/CordovaHMSPushPlugin.java"
target-dir="src/com/huawei/cordovahmspushplugin" />
<source-file src="src/android/MessageService.java"
target-dir="src/com/huawei/cordovahmspushplugin" />
</platform>
<!-- Script help to copy agconnect-services.json to right places-->
<hook src="scripts/after_prepare.js" type="after_prepare" />
</plugin>

@ -0,0 +1,38 @@
#!/usr/bin/env node
'use strict';
/**
* This hook makes sure projects using [cordova-plugin-firebase](https://github.com/arnesson/cordova-plugin-firebase)
* will build properly and have the required key files copied to the proper destinations when the app is build on Ionic Cloud using the package command.
* Credits: https://github.com/arnesson.
*/
var fs = require('fs');
var path = require('path');
var utilities = require("./lib/utilities");
var config = fs.readFileSync('config.xml').toString();
var name = utilities.getValue(config, 'name');
var ANDROID_DIR = 'platforms/android';
var PLATFORM = {
ANDROID: {
dest: [
ANDROID_DIR + '/app/agconnect-services.json'
],
src: [
'agconnect-services.json'
],
}
};
module.exports = function (context) {
//get platform from the context supplied by cordova
var platforms = context.opts.platforms;
// Copy key files to their platform specific folders
if (platforms.indexOf('android') !== -1 && utilities.directoryExists(ANDROID_DIR)) {
console.log('Preparing HMS Push Kit on Android');
utilities.copyKey(PLATFORM.ANDROID);
}
};

@ -0,0 +1,9 @@
var helper = require('./helper');
module.exports = function(context) {
// Modify the Gradle build file to add a task that will upload the debug symbols
// at build time.
helper.restoreRootBuildGradle();
helper.modifyRootBuildGradle();
};

@ -0,0 +1,7 @@
var helper = require('./helper');
module.exports = function(context) {
// Remove the Gradle modifications that were added when the plugin was installed.
helper.restoreRootBuildGradle();
};

@ -0,0 +1,117 @@
var fs = require("fs");
var path = require("path");
function rootBuildGradleExists() {
var target = path.join("platforms", "android", "build.gradle");
return fs.existsSync(target);
}
/*
* Helper function to read the build.gradle that sits at the root of the project
*/
function readRootBuildGradle() {
var target = path.join("platforms", "android", "build.gradle");
return fs.readFileSync(target, "utf-8");
}
/*
* Added a dependency on 'com.google.gms' based on the position of the know 'com.android.tools.build' dependency in the build.gradle
*/
function addDependencies(buildGradle) {
// find the known line to match
var match = buildGradle.match(/^(\s*)classpath 'com.android.tools.build(.*)/m);
var whitespace = match[1];
// modify the line to add the necessary dependencies
var agcDependency = whitespace + 'classpath \'com.huawei.agconnect:agcp:1.2.0.300\''
var modifiedLine = match[0] + '\n' + agcDependency;
// modify the actual line
return buildGradle.replace(/^(\s*)classpath 'com.android.tools.build(.*)/m, modifiedLine);
}
/*
* Add 'google()' and Crashlytics to the repository repo list
*/
function addRepos(buildGradle) {
// find the known line to match
var match = buildGradle.match(/^(\s*)jcenter\(\)/m);
var whitespace = match[1];
// modify the line to add the necessary repo
var huaweiMavenRepo = whitespace + 'maven { url \'http://developer.huawei.com/repo/\' }'
var modifiedLine = match[0] + '\n' + huaweiMavenRepo;
// modify the actual line
buildGradle = buildGradle.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
// update the all projects grouping
var allProjectsIndex = buildGradle.indexOf('allprojects');
if (allProjectsIndex > 0) {
// split the string on allprojects because jcenter is in both groups and we need to modify the 2nd instance
var firstHalfOfFile = buildGradle.substring(0, allProjectsIndex);
var secondHalfOfFile = buildGradle.substring(allProjectsIndex);
// Add google() to the allprojects section of the string
match = secondHalfOfFile.match(/^(\s*)jcenter\(\)/m);
var huaweiMavenRepo = whitespace + 'maven { url \'http://developer.huawei.com/repo/\' }'
modifiedLine = match[0] + '\n' + huaweiMavenRepo;
// modify the part of the string that is after 'allprojects'
secondHalfOfFile = secondHalfOfFile.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
// recombine the modified line
buildGradle = firstHalfOfFile + secondHalfOfFile;
} else {
// this should not happen, but if it does, we should try to add the dependency to the buildscript
match = buildGradle.match(/^(\s*)jcenter\(\)/m);
var huaweiMavenRepo = whitespace + 'maven { url \'http://developer.huawei.com/repo/\' }'
modifiedLine = match[0] + '\n' + huaweiMavenRepo;
// modify the part of the string that is after 'allprojects'
buildGradle = buildGradle.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
}
return buildGradle;
}
/*
* Helper function to write to the build.gradle that sits at the root of the project
*/
function writeRootBuildGradle(contents) {
var target = path.join("platforms", "android", "build.gradle");
fs.writeFileSync(target, contents);
}
module.exports = {
modifyRootBuildGradle: function() {
// be defensive and don't crash if the file doesn't exist
if (!rootBuildGradleExists) {
return;
}
var buildGradle = readRootBuildGradle();
// Add Google Play Services Dependency
buildGradle = addDependencies(buildGradle);
// Add Google's Maven Repo
buildGradle = addRepos(buildGradle);
writeRootBuildGradle(buildGradle);
},
restoreRootBuildGradle: function() {
// be defensive and don't crash if the file doesn't exist
if (!rootBuildGradleExists) {
return;
}
var buildGradle = readRootBuildGradle();
// remove any lines we added
buildGradle = buildGradle.replace(/(?:^|\r?\n)(.*)com.huawei.cordovahmspushplugin*?(?=$|\r?\n)/g, '');
writeRootBuildGradle(buildGradle);
}
};

@ -0,0 +1,88 @@
/**
* Utilities and shared functionality for the build hooks.
*/
var fs = require('fs');
var path = require("path");
fs.ensureDirSync = function (dir) {
if (!fs.existsSync(dir)) {
dir.split(path.sep).reduce(function (currentPath, folder) {
currentPath += folder + path.sep;
if (!fs.existsSync(currentPath)) {
fs.mkdirSync(currentPath);
}
return currentPath;
}, '');
}
};
module.exports = {
/**
* Used to get the name of the application as defined in the config.xml.
*
* @param {object} context - The Cordova context.
* @returns {string} The value of the name element in config.xml.
*/
getAppName: function (context) {
var ConfigParser = context.requireCordovaModule("cordova-lib").configparser;
var config = new ConfigParser("config.xml");
return config.name();
},
/**
* The ID of the plugin; this should match the ID in plugin.xml.
*/
getPluginId: function () {
return "com.huawei.cordovahmspushplugin";
},
copyKey: function (platform) {
for (var i = 0; i < platform.src.length; i++) {
var file = platform.src[i];
if (this.fileExists(file)) {
try {
var contents = fs.readFileSync(file).toString();
try {
platform.dest.forEach(function (destinationPath) {
var folder = destinationPath.substring(0, destinationPath.lastIndexOf('/'));
fs.ensureDirSync(folder);
fs.writeFileSync(destinationPath, contents);
});
} catch (e) {
// skip
}
} catch (err) {
console.log(err);
}
break;
}
}
},
getValue: function (config, name) {
var value = config.match(new RegExp('<' + name + '(.*?)>(.*?)</' + name + '>', 'i'));
if (value && value[2]) {
return value[2]
} else {
return null
}
},
fileExists: function (path) {
try {
return fs.statSync(path).isFile();
} catch (e) {
return false;
}
},
directoryExists: function (path) {
try {
return fs.statSync(path).isDirectory();
} catch (e) {
return false;
}
}
};

@ -0,0 +1,112 @@
package com.huawei.cordovahmspushplugin;
import android.text.TextUtils;
import android.util.Log;
import com.huawei.agconnect.config.AGConnectServicesConfig;
import com.huawei.hms.aaid.HmsInstanceId;
import com.huawei.hms.push.HmsMessaging;
import com.huawei.hmf.tasks.OnCompleteListener;
import com.huawei.hmf.tasks.Task;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.PluginResult;
import org.json.JSONArray;
import org.json.JSONException;
/**
* This class echoes a string called from JavaScript.
*/
public class CordovaHMSPushPlugin extends CordovaPlugin {
private static final String TAG = CordovaHMSPushPlugin.class.getSimpleName();
private static CallbackContext mCallbackContext;
private static CallbackContext mTokenCallback;
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
switch (action) {
case "getToken":
this.getToken(callbackContext);
return true;
case "getMessageCallback":
Log.d(TAG, "getMessageCallback");
mCallbackContext = callbackContext;
return true;
case "subscribeTopic":
Log.d(TAG, "subscribeTopic");
try {
String topic = args.getString(0);
this.subscribeTopic(topic, callbackContext);
} catch (JSONException e) {
return true;
}
return true;
default:
return false;
}
}
public static void returnMessage(String message) {
if (mCallbackContext != null) {
Log.d(TAG, "returnMessage");
PluginResult result = new PluginResult(PluginResult.Status.OK, message);
result.setKeepCallback(true);
mCallbackContext.sendPluginResult(result);
}
}
public static void returnToken(String token) {
if (mTokenCallback != null) {
mTokenCallback.success(token);
mTokenCallback = null;
}
}
/**
* get push token
*/
private void getToken(CallbackContext callbackContext) {
Log.i(TAG, "get token: begin");
try {
String appId = AGConnectServicesConfig.fromContext(cordova.getContext()).getString("client/app_id");
String pushToken = HmsInstanceId.getInstance(cordova.getContext()).getToken(appId, "HCM");
if (!TextUtils.isEmpty(pushToken)) {
Log.i(TAG, "get token:" + pushToken);
callbackContext.success(pushToken);
}else {
mTokenCallback = callbackContext;
}
} catch (Exception e) {
Log.e(TAG, "getToken Failed, " + e);
callbackContext.error("getToken Failed, error : " + e.getMessage());
}
}
public void subscribeTopic(String topic, final CallbackContext callBack) {
// callBack.success("user subscribe to topic named as: "+ topic);
if (topic == null || topic.toString().equals("")) {
callBack.error("topic is empty!");
return;
}
try {
HmsMessaging.getInstance(cordova.getContext()).subscribe(topic).
addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(Task<Void> task) {
if (task.isSuccessful()) {
callBack.success("user subscribe to topic: "+ topic);
} else {
callBack.error("getToken Failed, error : " + task.getException().getMessage());
}
}
});
} catch (Exception e) {
callBack.error("getToken Failed, error : " + e.getMessage());
}
}
}

@ -0,0 +1,32 @@
package com.huawei.cordovahmspushplugin;
import com.huawei.cordovahmspushplugin.CordovaHMSPushPlugin;
import com.huawei.hms.push.HmsMessageService;
import com.huawei.hms.push.RemoteMessage;
import android.util.Log;
public class MessageService extends HmsMessageService {
private static final String TAG = MessageService.class.getSimpleName();
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Log.d(TAG, "onMessageReceived");
if (remoteMessage != null) {
String message = remoteMessage.getData();
Log.d(TAG, message);
CordovaHMSPushPlugin.returnMessage(message);
}
}
@Override
public void onNewToken(String s) {
super.onNewToken(s);
if (s != null) {
Log.d(TAG, "token:" + s);
CordovaHMSPushPlugin.returnToken(s);
}
}
}

@ -0,0 +1,29 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
// huawei maven
maven { url 'http://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.huawei.agconnect:agcp:1.2.0.300'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
// huawei maven
maven { url 'http://developer.huawei.com/repo/' }
}
}
cdvPluginPostBuildExtras.add({
apply plugin: 'com.huawei.agconnect'
})

@ -22,50 +22,68 @@
<!-- colorBG -->
<div class="contentEit" style="background: #f3f1f1;">
<div class="header-div">
<!-- <ion-buttons slot="end">
<button class="headerBtn" (click)="AccrualBalances()">
<img class="headerImg" src="../assets/imgs/accubalance.png">
</button>
</ion-buttons> -->
<!-- <ion-buttons slot="start">
<ion-back-button color="light" class="btnBack" defaultHref="/home"></ion-back-button>
</ion-buttons>
<p class="Title">{{ts.trPK('absenceList','absenceList')}}</p> -->
</div>
<div class="">
<div >
<div>
<ion-grid class="headerGrid">
<div >
<ion-datetime [(ngModel)]="Sdate" class="datetime" displayFormat="DD MMMM YYYY"
placeholder="DD MMMM YYYY" cancelText="{{ts.trPK('general','cancel')}}"
doneText="{{ts.trPK('general','done')}}" (ionChange)="getAccrualBalance()"></ion-datetime>
<ion-icon class="iconCalendar" ios="ios-calendar" md="md-calendar"></ion-icon>
</div>
<div style="position: relative;">
<!-- <div [ngClass]=" direction == 'ltr' ? 'subTitle' : 'subTitle-ar'" >{{ts.trPK('absenceList','AccrualUsed')}} </div> -->
<div class="label-container">
<ion-row [ngClass]=" direction == 'ltr' ? 'green-label-container' : 'green-label-container-ar'" >
<label class="current-label"> </label>
<span [ngClass]=" direction == 'ltr' ? 'span-one' : 'span-one-ar'" >{{ts.trPK('absenceList','currentBalance')}}</span>
<span class="span-two">{{accrualNet}}</span>
</ion-row>
<!-- <div [ngClass]=" direction == 'ltr' ? 'yearLabel' : 'yearLabel-ar'">2021</div> -->
</div>
<!-- <div class="label-container">
<ion-row [ngClass]=" direction == 'ltr' ? 'black-label-container' : 'black-label-container-ar'" >
<label class="current-label-container"> </label>
<span [ngClass]=" direction == 'ltr' ? 'black-span1' : 'black-span1-ar'" >{{ts.trPK('absenceList','currentBalance')}}</span>
<span class="black-span2">{{accrualNet}}</span>
</ion-row>
<div [ngClass]=" direction == 'ltr' ? 'yearLabel' : 'yearLabel-ar'" > {{ts.trPK('absenceList','PreviousYears')}}</div>
</div> -->
<div class="label-container">
<ion-row [ngClass]=" direction == 'ltr' ? 'black-label-container' : 'black-label-container-ar'" >
<label class="used-label-container"> </label>
<span [ngClass]=" direction == 'ltr' ? 'red-span1' : 'red-span1-ar'" >{{ts.trPK('absenceList','usedBalance')}}</span>
<span class="red-span2">{{accrualUsed}}</span>
</ion-row>
</div>
<div class="graph-container">
<p-chart [ngClass]=" direction == 'ltr' ? 'today-graph' : 'today-graph-ar'" type="doughnut" [data]="data" [options]="options" ></p-chart>
</div>
</div>
</ion-grid>
<ion-grid class="headerGrid">
<!-- <ion-grid class="headerGrid">
<div style="color: black;">
<div class="result-graph">
<div >
<!-- <ion-item> -->
<!-- <ion-label class="datelabel">{{request.P_EFFECTIVE_DATE}}</ion-label> -->
<ion-datetime [(ngModel)]="Sdate" class="datetime" displayFormat="DD MMMM YYYY"
placeholder="DD MMMM YYYY" cancelText="{{ts.trPK('general','cancel')}}"
doneText="{{ts.trPK('general','done')}}" (ionChange)="getAccrualBalance()"></ion-datetime>
<!-- <ion-datetime [(ngModel)]="Sdate" class="datetime" displayFormat="DD MMMM YYYY"
placeholder="DD MMMM YYYY" (ionChange)="getAccrualBalance()"></ion-datetime> -->
<ion-icon class="iconCalendar" ios="ios-calendar" md="md-calendar"></ion-icon>
<!-- </ion-item> -->
</div>
<div style=" border-bottom: 1px solid #a7a4a4; margin-bottom: 12px;
margin-top: -10px; margin-right: -9px;"></div>
<div class="result-text-container">
<!-- <h2>{{totalnumber}}</h2> -->
<!-- <h2>{{accrualNet + accrualUsed + accrualYearly}}</h2> -->
<!-- <span>{{ts.trPK('absenceList','totalNumber')}}</span> -->
</div>
@ -94,38 +112,10 @@
</ion-row>
</ion-col>
</div>
<!-- <div [ngClass]=" direction == 'ltr' ? 'div-orng' : 'div-orng-ar'">
<ion-col>
<ion-row>
<label class="orng-label">{{ts.trPK('absenceList','annualBalance')}}</label>
</ion-row>
<ion-row>
<label class="orng-amount" for="">{{accrualYearly}}</label>
</ion-row>
</ion-col>
</div> -->
<!-- <div style="position: relative;
left: 59%;
bottom: 73px;
color: black;
background-color: #269DB8;
width: 16%;
height: 6px;">
<ion-col>
<ion-row>
<label class="blue-label">text</label>
</ion-row>
<ion-row> -->
<!-- <label class="blue-amount" for="">{{getleaveAccrualBalance.ACCRUAL_YEARLY_ENTITLEMENT}}</label> -->
<!-- </ion-row>
</ion-col>
</div> -->
</div>
</ion-grid>
</div>
</ion-grid> -->
</div>

@ -56,13 +56,9 @@
.header-div {
background-color: #269DB8;
text-transform: capitalize;
height: 160px;
/* position: relative; */
/* display: block; */
margin-bottom: -28px;
height: 100px;
}
.header-toolbar-new{
@ -102,12 +98,9 @@
}
.datetime{
// text-align: center;
// font-family: WorkSans-Bold;
// margin-left: 111px;
text-align: center;
font-family: WorkSans-Bold;
margin-left: 47px;
margin-left: -120px;
margin-top: -19px;
}
@ -119,52 +112,40 @@
.iconCalendar{
// margin-left: -241px;
// margin-top: 5px;
margin-left: 30px !important;
margin-left: -12px !important;
width: 22% !important;
height: 26px !important;
margin-top: -69px !important;
margin-bottom: 20px !important;
margin-top: -50px !important;
margin-bottom: 23px !important;
}
.today-graph{
// display:block !important;
// height: 150px !important;
// width: 300 !important;
// margin-left: -70px !important;
display: block !important;
height: 196px;
width: 385px;
padding-left: 51px;
// padding-top: 29px;
margin-left: -70px !important;
}
.today-graph-ar{
// display: block !important;
// height: 196px;
// width: 385px;
// padding-left: 51px;
/* margin-left: -70px !important; */
// font-size: 14px;
// margin-left: -48px;
// margin-right: 63px;
// margin-bottom: -30px;
display: block !important;
height: 175px;
width: 320px;
padding-left: 51px;
font-size: 14px;
margin-right: 75px;
margin-bottom: -30px;
}
// .today-graph{
// display: block !important;
// height: 196px;
// width: 385px;
// padding-left: 51px;
// // padding-top: 29px;
// margin-left: -70px !important;
// }
// .today-graph-ar{
// display: block !important;
// height: 175px;
// width: 320px;
// padding-left: 51px;
// font-size: 14px;
// margin-right: 75px;
// margin-bottom: -30px;
// }
.headerGrid{
background-color: white !important;
border: 1px solid #cac8c8 !important;
border-radius: 20px !important;
padding-top: 28px;
padding-bottom: 14px;
padding-bottom: 26px;
margin-left: 13px;
margin-right: 13px;
margin-top: -136px;
margin-top: -93px;
margin-bottom: 10px;
}
@ -310,3 +291,217 @@ margin-top: -13px;
height: 6px;
right: 16px;
}
.subTitle{
margin-top: -10px;
margin-left: 10px;
font-family: WorkSans-Bold;
font-size: 16px;
}
.subTitle-ar{
margin-top: -10px;
margin-right: 10px;
font-family: WorkSans-Bold;
font-size: 16px;
}
.today-graph {
display: block;
height: 102px;
width: 211px;
margin-top: 20px;
margin-left: -39px;
max-height: 4cm;
}
.today-graph-ar {
display: block;
height: 102px;
width: 211px;
margin-top: 20px;
/* margin-right: -39px; */
max-height: 4cm;
margin-right: 105px;
}
.graph-container{
margin-left: 160px;
position: relative;
margin-top: -98px;
}
// .label-container{
// position: absolute;
// // width: 20%;
// // right: 30px;
// top: 50%;
// margin-top: -27px;
// left: 20px;
// }
.green-label-container{
margin-top: 20px; margin-left: 12px;
}
.green-label-container-ar{
margin-top: 20px; margin-right: 12px;
}
.black-label-container{
margin-left: 12px;
}
.black-label-container-ar{
margin-right: 12px;
}
.used-label-container{
// border-top: 5px solid #292F42;
// padding: 1px 0px;
// margin: 15px 0px
width: 12px;
height: 12px;
padding-right: -10px;
border-radius: 100%;
background-color: #b60c0c;
margin-top: 30px;
}
.current-label-container{
width: 12px;
height: 12px;
padding-right: -10px;
border-radius: 100%;
background-color: black;
margin-top: 21px;
}
.current-label{
width: 12px;
height: 12px;
padding-right: -10px;
border-radius: 100%;
background-color: #269DB8;
// margin-top: 30px;
}
.span-one{
// display: block;
// font-size: 12px;
// color: black;
display: block;
font-size: 12px;
color: #269DB8;
margin-left: 6px;
margin-top: -2px;
font-weight: bold;
}
.span-one-ar{
display: block;
font-size: 12px;
color: #269DB8;
margin-right: 6px;
margin-top: -2px;
font-weight: bold;
}
.span-two{
// display: block;
// font-size: 22px;
display: block;
font-size: 12px;
color: #269DB8;
margin-left: 6px;
margin-top: -2px;
font-weight: bold;
font-family: WorkSans-Bold;
}
.black-span1{
// display: block;
// font-size: 12px;
// color: black;
display: block;
font-size: 12px;
color: black;
margin-left: 6px;
margin-top: 20px;
font-weight: bold;
}
.black-span1-ar{
// display: block;
// font-size: 12px;
// color: black;
display: block;
font-size: 12px;
color: black;
margin-right: 6px;
margin-top: 20px;
font-weight: bold;
}
.black-span2{
// display: block;
// font-size: 22px;
display: block;
font-size: 12px;
color: black;
margin-left: 6px;
margin-top: 20px;
font-weight: bold;
font-family: WorkSans-Bold;
}
.red-span1{
// display: block;
// font-size: 12px;
// color: black;
display: block;
font-size: 12px;
color: #b60c0c;
margin-left: 6px;
margin-top: 28px;
font-weight: bold;
}
.red-span1-ar{
// display: block;
// font-size: 12px;
// color: black;
display: block;
font-size: 12px;
color: #b60c0c;
margin-right: 6px;
margin-top: 28px;
font-weight: bold;
}
.red-span2{
// display: block;
// font-size: 22px;
display: block;
font-size: 12px;
color: #b60c0c;
margin-left: 6px;
margin-top: 28px;
font-weight: bold;
font-family: WorkSans-Bold;
}
.yearLabel{
font-size: 13px;
color: gray;
font-family: WorkSans-Bold;
margin-left: 29px;
margin-top: 5px;
}
.yearLabel-ar{
font-size: 13px;
color: gray;
font-family: WorkSans-Bold;
margin-right: 29px;
margin-top: 5px;
}

@ -37,17 +37,18 @@ export class HomeComponent implements OnInit {
balance: any;
ACCRUAL_NET_ENTITLEMENT: any;
ACCRUAL_USED_ENTITLEMENT: any;
ACCRUAL_YEARLY_ENTITLEMENT: any;
totalnumber: any;
public direction: string;
ACCRUAL_YEARLY_ENTITLEMENT: any;
totalnumber: any;
public direction: string;
public options = {
cutoutPercentage: 80,
tooltips: { enabled: false },
legend: { display: false }};
gaugeType = "full";
// gaugeValue = 11.200;
// gaugeLabel = "";
legend: { display: false }
};
gaugeType = "full";
// gaugeValue = 11.200;
// gaugeLabel = "";
constructor(
public common: CommonService,
@ -58,22 +59,23 @@ export class HomeComponent implements OnInit {
public authService: AuthenticationService
) {
this.direction = TranslatorService.getCurrentDirection();
// this.userData =this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA,false);
// this.userData =this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA,false);
}
ngOnInit() {
this.Sdate = new Date().toISOString();
this.getUserDetails();
this.getAccrualBalance();
}
private getUserDetails(){
private getUserDetails() {
this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => {
if (user) {
// this.emp_no=user.EMPLOYEE_NUMBER;
// this.getAccrualBalance();
}
});
if (user) {
// this.emp_no=user.EMPLOYEE_NUMBER;
// this.getAccrualBalance();
}
});
@ -101,34 +103,36 @@ export class HomeComponent implements OnInit {
this.accrualNet = this.leaveAccrualBalance.ACCRUAL_NET_ENTITLEMENT;
this.accrualUsed = this.leaveAccrualBalance.ACCRUAL_USED_ENTITLEMENT;
this.accrualYearly = this.leaveAccrualBalance.ACCRUAL_YEARLY_ENTITLEMENT;
this.totalnumber= this.accrualNet + this.accrualUsed + this.accrualYearly;
this.totalnumber= this.totalnumber.toFixed(3);
this.totalnumber = this.accrualNet + this.accrualUsed + this.accrualYearly;
this.totalnumber = this.totalnumber.toFixed(3);
this.request = this.common.sharedService.getSharedData('leaveAccrualBalanceDate', false);
console.log("this.request" + this.request.P_EFFECTIVE_DATE);
this.effectiveDate = this.request.P_EFFECTIVE_DATE;
this.data = {
// labels: ['earingTotal', 'deductionTotal'],
datasets: [
// { data: [this.accrualNet,this.accrualYearly,this.accrualUsed],
{
data: [this.accrualNet,this.accrualUsed],
backgroundColor: [
'#1FA269',
'#CB3232',],
borderWidth: 2
}
]
};
// { data: [this.accrualNet,this.accrualYearly,this.accrualUsed],
{
data: [this.accrualNet, this.accrualUsed],
backgroundColor: [
// '#1FA269',
// '#CB3232',],
'#269DB8',
'#b60c0c',],
borderWidth: 1
}
]
};
this.getAbsenceTransaction();
}
AccrualBalances() {
AccrualBalances() {
this.common.openAccuralPage();
}
AttachmentDocuments(id) {
AttachmentDocuments(id) {
const request = {
P_ABSENCE_ATTENDANCE_ID: id
};
@ -156,7 +160,7 @@ AttachmentDocuments(id) {
//this.GetAbsenceTransactionList =result.GetAbsenceTransactionList;
}
}
getAbsenceTransaction() {
getAbsenceTransaction() {
this.IsReachEnd = false;
const request = {
P_SELECTED_EMPLOYEE_NUMBER: this.selEmp,
@ -170,7 +174,7 @@ getAbsenceTransaction() {
});
}
handleAbsListResult(result) {
handleAbsListResult(result) {
if (this.common.validResponse(result)) {
if (this.common.hasData(result.GetAbsenceTransactionList)) {
this.GetAbsenceTransactionList = result.GetAbsenceTransactionList;
@ -187,7 +191,7 @@ getAbsenceTransaction() {
}
}
}
doInfinite(event: any) {
doInfinite(event: any) {
if (!this.IsReachEnd) {
// this.P_PAGE_NUM++;
const request = {
@ -227,11 +231,11 @@ doInfinite(event: any) {
}
}
}
createAbsence() {
createAbsence() {
this.common.openSubmitAbsencePage();
}
///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
getAccrualBalance() {
if (this.Sdate) {
let today = new Date(this.Sdate);
@ -252,31 +256,32 @@ createAbsence() {
});
}
}
handleAccrualResult(result) {
if (this.common.validResponse(result)) {
this.balance = result.GetAccrualBalancesList;
}
if(this.balance){
this.accrualNet = this.balance[0].ACCRUAL_NET_ENTITLEMENT;
this.accrualUsed = this.balance[0].ACCRUAL_USED_ENTITLEMENT;
// this.accrualYearly = this.balance[0].ACCRUAL_YEARLY_ENTITLEMENT;
// this.totalnumber= this.accrualNet + this.accrualUsed + this.accrualYearly;
this.totalnumber= this.accrualNet + this.accrualUsed;
this.totalnumber= this.totalnumber.toFixed(3);
this.data = {
// labels: ['earingTotal', 'deductionTotal'],
datasets: [
// { data: [this.accrualNet,this.accrualYearly,this.accrualUsed],
{ data: [this.accrualNet,this.accrualUsed],
backgroundColor: [
'#1FA269',
'#CB3232',],
borderWidth: 2
}
]
};
}
if (this.balance) {
this.accrualNet = this.balance[0].ACCRUAL_NET_ENTITLEMENT;
this.accrualUsed = this.balance[0].ACCRUAL_USED_ENTITLEMENT;
// this.accrualYearly = this.balance[0].ACCRUAL_YEARLY_ENTITLEMENT;
// this.totalnumber= this.accrualNet + this.accrualUsed + this.accrualYearly;
this.totalnumber = this.accrualNet + this.accrualUsed;
this.totalnumber = this.totalnumber.toFixed(3);
this.data = {
// labels: ['earingTotal', 'deductionTotal'],
datasets: [
// { data: [this.accrualNet,this.accrualYearly,this.accrualUsed],
{
data: [this.accrualNet, this.accrualUsed],
backgroundColor: [
'#269DB8',
'#b60c0c',],
borderWidth: 1
}
]
};
}
}
}
}

@ -4,14 +4,20 @@
</app-generic-header>
<ion-content padding>
<ion-item class='dynamicField'>
<div [ngClass]=" direction === 'en' ? 'custom-text-area-element Field-en' : 'custom-text-area-element Field-ar'" >
<label class="label" position='floating' class="colBold requiredClass">{{ts.trPK('submitAbsence','absenceType')}} </label>
<select class="label-Select" [(ngModel)]="absenceType" (change)="onTypeAbsenceChange()" required>
<option value= "{{item.ABSENCE_ATTENDANCE_TYPE_ID}}" *ngFor="let item of absenceTypeList; let i=index;">{{item.ABSENCE_ATTENDANCE_TYPE_NAME}} </option>
</select>
</div>
<!-- <ion-item class='dynamicField'>
<ion-label position='floating' class="colBold requiredClass">{{ts.trPK('submitAbsence','absenceType')}} </ion-label>
<ion-select (ionChange)="calcDay()" okText="{{ts.trPK('general','ok')}}" cancelText="{{ts.trPK('general','cancel')}}" [(ngModel)]="absenceType" (ionChange)="onTypeAbsenceChange()" required>
<ion-select (ionChange)="calcDay()" okText="{{ts.trPK('general','ok')}}" cancelText="{{ts.trPK('general','cancel')}}" [(ngModel)]="absenceType" (ionChange)="onTypeAbsenceChange()" required> -->
<!-- let item of AbsenceType; let i=index; -->
<ion-select-option value= "{{item.ABSENCE_ATTENDANCE_TYPE_ID}}" *ngFor="let item of absenceTypeList; let i=index;">{{item.ABSENCE_ATTENDANCE_TYPE_NAME}} </ion-select-option>
<!-- <ion-select-option value= "{{item.ABSENCE_ATTENDANCE_TYPE_ID}}" *ngFor="let item of absenceTypeList; let i=index;">{{item.ABSENCE_ATTENDANCE_TYPE_NAME}} </ion-select-option>
</ion-select>
</ion-item>
</ion-item> -->
<ion-item class='dynamicField'>
<ion-label position='floating' class="colBold requiredClass">{{ts.trPK('submitAbsence','startDate')}} </ion-label>

@ -21,3 +21,94 @@
}
.label-Select{
color: var(--dark);
font-size: 15px;
border: none;
font-weight: 400;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
width: 80%;
padding: 1px 0px;
background-color: var(--light);
border-bottom: var(--cusgray) solid 1px;
border-radius: 0px;
// margin-left: 20px;
margin-left: 30px;
// margin-top: -10px;
// -webkit-appearance: none;
// -moz-appearance: none;
text-indent: 1px;
// text-overflow: '';
box-shadow: none;
-webkit-box-shadow:none;
-moz-box-shadow: none;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
:root[dir="ltr"]{
background-image: linear-gradient(45deg, transparent 50%, #999 50%), linear-gradient(135deg, #999 50%, transparent 50%), linear-gradient(to right, #ffffff, #ffffff);
background-position: calc(100% - 14px) calc(1em + 2px), calc(100% - 8px) calc(1em + 2px), 100% 0;
background-size: 6px 6px, 6px 6px, 2.9em 2.9em;
background-repeat: no-repeat;
padding-right: 20px;
}
:root[dir="rtl"]{
background-image: linear-gradient(-135deg, #999 50%, transparent 50%),linear-gradient(-45deg, transparent 50%, #999 50%), linear-gradient(to right, #ffffff, #ffffff);
background-position: calc(1em - 10px) calc(100% - 8px), calc(1em - 4px) calc(100% - 8px), 0 100%;
background-size: 6px 6px, 6px 6px, 2.9em 2.9em;
background-repeat: no-repeat;
padding-left: 20px;
}
}
.label{
font-size: 16px;
// margin-left: 15px;
color: #a2a5a6 !important;
display: block;
overflow: hidden;
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
/* font-size: inherit; */
// text-overflow: ellipsis;
// white-space: nowrap;
white-space: normal;
// padding-top: 10px;
padding: 5px 0px;
padding-left: 10px !important;
margin: 10px auto;
:root[dir="ltr"]{
font-family: var(--fontFamilySemiBoldEN) !important;
}
:root[dir="rtl"]{
font-family: var(--fontFamilyIOSAR) !important;
font-weight: bold;
}
}
.Field-en{
border-radius: 30px;
border: 1px solid #a2a5a6!important;
margin-bottom: 20px;
padding-left: 20px !important;
padding-top: 6px !important;
color: #999999 !important;
}
.Field-ar{
border-radius: 30px;
border: 1px solid #a2a5a6!important;
margin-bottom: 20px;
padding-right: 20px !important;
padding-top: 6px !important;
color: #999999 !important;
}

@ -1,33 +1,42 @@
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'},
{ 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: 'my-team', loadChildren: './my-team/my-team.module#MyTeamPageModule' },
{ path: 'attendance', loadChildren: './attendance/attendance.module#AttendancePageModule' },
{ path: 'eit', loadChildren: './eit/eit.module#EITPageModule' },
{ path: 'absence', loadChildren: './absence/absence.module#AbsencePageModule' },
{ path: 'notification', loadChildren: './notification/notification.module#NotificationPageModule' },
{ path: 'my-specialist', loadChildren: './my-specialist/my-specialist.module#MySpecialistPageModule' },
{ path: 'my-subordinate', loadChildren: './my-subordinate/my-subordinate.module#MySubordinatePageModule' },
{ path: 'time-card', loadChildren: './time-card/time-card.module#TimeCardPageModule' },
{ path: 'payslip', loadChildren: './payslip/payslip.module#PayslipPageModule' }, { path: 'attendance-tracking', loadChildren: './attendance-tracking/attendance-tracking.module#AttendanceTrackingPageModule' }
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
];
@NgModule({
imports: [
/*RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules}),*/
RouterModule.forRoot(routes),
],
exports: [RouterModule]
})
export class AppRoutingModule { }
const routes: Routes = [
{ path: '', redirectTo: 'authentication/login', pathMatch: 'full' },
{
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule'
},
{ 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: 'my-team', loadChildren: './my-team/my-team.module#MyTeamPageModule' },
{ path: 'attendance', loadChildren: './attendance/attendance.module#AttendancePageModule' },
{ path: 'eit', loadChildren: './eit/eit.module#EITPageModule' },
{ path: 'absence', loadChildren: './absence/absence.module#AbsencePageModule' },
{ path: 'notification', loadChildren: './notification/notification.module#NotificationPageModule' },
{ path: 'my-specialist', loadChildren: './my-specialist/my-specialist.module#MySpecialistPageModule' },
{ path: 'my-subordinate', loadChildren: './my-subordinate/my-subordinate.module#MySubordinatePageModule' },
{ path: 'time-card', loadChildren: './time-card/time-card.module#TimeCardPageModule' },
{ path: 'payslip', loadChildren: './payslip/payslip.module#PayslipPageModule' },
{ path: 'attendance-tracking', loadChildren: './attendance-tracking/attendance-tracking.module#AttendanceTrackingPageModule' },
{ path: 'itemforsale', loadChildren: './itemforsale/itemforsale.module#ItemforsalePageModule' },
{ path: 'offersdiscount', loadChildren: './offersdiscount/offersdiscount.module#OffersdiscountPageModule' },
{ path: 'mowadhafi', loadChildren: './mowadhafi/mowadhafi.module#MowadhafiPageModule' },
{ path: 'erm-channel', loadChildren: './erm-channel/erm-channel.module#ErmChannelPageModule' },
{ path: 'backend-integrations', loadChildren: './backend-integrations/backend-integrations.module#BackendIntegrationsPageModule' }
];
@NgModule({
imports: [
/*RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules}),*/
RouterModule.forRoot(routes),
],
exports: [RouterModule]
})
export class AppRoutingModule { }

@ -45,6 +45,15 @@
</ion-label>
</ion-item>
<ion-item (click)="openMyRequestPage()">
<ion-thumbnail slot="start" class="menu-thumb">
<img style= "height: 14px !important;" src="../assets/imgs/my_team_icon.png" item-left>
</ion-thumbnail>
<ion-label class="profile">
{{ts.trPK('userProfile','HR-Request')}}
</ion-label>
</ion-item>
<!-- <ion-item (click)="openChangePassword()"> -->
<ion-item (click)="openChangePassword()">
@ -66,6 +75,16 @@
<ion-badge class="start-badge main-badge" slot="end" color="danger">{{notBadge}}</ion-badge>
</ion-label>
</ion-item>
<ion-item *ngIf='userInfo?.show_business' (click)="openBusinessCard()">
<ion-thumbnail slot="start" class="menu-thumb">
<img style= "height: 25px !important;" src="../assets/imgs/business-card-design.png" item-left>
</ion-thumbnail>
<ion-label class="changepassword" >
{{ts.trPK('general','business-card')}}
<ion-badge class="start-badge main-badge" slot="end" color="danger">{{notBadge}}</ion-badge>
</ion-label>
</ion-item>
</ion-list>
@ -122,6 +141,14 @@
{{ts.trPK('myTeam','myTeam-header')}}
</ion-label>
</ion-item>
<ion-item (click)="openMyRequestPage()">
<ion-thumbnail slot="start" class="menu-thumb">
<img style= "height: 14px !important;" src="../assets/imgs/my_team_icon.png" item-left>
</ion-thumbnail>
<ion-label class="profile">
{{ts.trPK('userProfile','HR-Request')}}
</ion-label>
</ion-item>
<ion-item (click)="openChangePassword()">
<ion-thumbnail slot="start" class="menu-thumb">
<img style= "height: 25px !important;" src="../assets/imgs/lock_icon.png" item-left>
@ -148,6 +175,15 @@
</ion-label>
</ion-item>
<ion-item *ngIf='userInfo?.show_business' (click)="openBusinessCard()">
<ion-thumbnail slot="start" class="menu-thumb">
<img style= "height: 25px !important;" src="../assets/imgs/business-card-design.png" item-left>
</ion-thumbnail>
<ion-label class="changepassword" >
{{ts.trPK('general','business-card')}}
<ion-badge class="start-badge main-badge" slot="end" color="danger">{{notBadge}}</ion-badge>
</ion-label>
</ion-item>
<!-- <ion-item (click)="profile()">
<ion-thumbnail slot="start" class="menu-thumb">
@ -171,7 +207,7 @@
</ion-list>
<div class="" style="text-align:center">
<img src="{{companyUrl}}" class="CompanyImg logoImg">
<img src="{{companyUrl}}" class="CompanyImg" [ngClass]="TeamFlag!='true'? 'logoImg':'logoImgWithMyTeam'">
<!-- <p class="companyTxt">{{companyDesc}}</p> -->
</div>
<div class="menuFooter">

@ -304,7 +304,7 @@ button.menu-item.item.item-block.item-ios {
}
.menuFooter {
position: fixed;
// position: fixed;
bottom: 0px;
text-align: center;
margin: auto;
@ -336,10 +336,17 @@ button.menu-item.item.item-block.item-ios {
// position: relative;
// }
.logoImgWithMyTeam{
width: 77px;
// position: relative;
margin-top: -1px;
margin-bottom: 70px;
}
.logoImg{
width: 77px;
position: relative;
// position: relative;
margin-top: -1px;
margin-bottom: 180px;
}
.companyTxt {
font-size: 12px;

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Platform, Events, MenuController, ModalController } from '@ionic/angular';
import { Platform, Events, MenuController, ModalController, NavController } from '@ionic/angular';
import { TranslatorService } from './hmg-common/services/translator/translator.service';
import { CommonService } from './hmg-common/services/common/common.service';
import { AuthenticationService } from './hmg-common/services/authentication/authentication.service';
@ -9,8 +9,11 @@ import { PushService } from '../../src/app/hmg-common/services/push/push.service
import { LazyLoadingService } from './hmg-common/services/lazy-loading/lazy-loading.service';
import { DomSanitizer } from '@angular/platform-browser';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { Router } from '@angular/router';
import { Router, NavigationEnd } from '@angular/router';
import { DigitalIdComponent } from './authentication/digital-id/digital-id.component';
import { checkAndUpdatePureExpressionInline } from '@angular/core/src/view/pure_expression';
import { FirebaseX } from '@ionic-native/firebase-x/ngx';
import { BusinessCardComponent } from './authentication/business-card/business-card.component';
@Component({
selector: 'app-root',
@ -33,6 +36,7 @@ export class AppComponent implements OnInit {
deviceToken: string;
TeamFlag: string = 'false';
isIOS = false;
userInfo;
public requestGetLoginInfo: {
DeviceType: string;
DeviceToken: string; // this.deviceToken
@ -53,7 +57,9 @@ export class AppComponent implements OnInit {
public pushService: PushService,
private splashScreen: SplashScreen,
public router: Router,
public modalController: ModalController
public modalController: ModalController,
public nav: NavController,
public firebasex: FirebaseX
) {
this.events.subscribe('img-change', displayImg => {
console.log('app compont: ' + displayImg);
@ -67,9 +73,9 @@ export class AppComponent implements OnInit {
private hideSplashScreen() {
setTimeout(() => {
this.splashScreen.hide();
this.splashScreen.hide();
}, 1000);
}
}
public initializeApp() {
this.cs.startLoading();
@ -81,6 +87,7 @@ export class AppComponent implements OnInit {
this.ts.loadResources(() => {
this.isIOS = this.platform.is('ios') ? true : false;
this.initializeDirection();
this.monitorAnalytics();
this.start = true;
if (this.isIOS) {
this.monitUrlChange();
@ -103,39 +110,110 @@ export class AppComponent implements OnInit {
});
}
public monitorAnalytics() {
this.router.events.subscribe((val) => {
if (val instanceof NavigationEnd) {
const lastIndex = val.urlAfterRedirects.lastIndexOf('/');
const currentPageName = val.urlAfterRedirects.substr(lastIndex + 1);
this.setScreenNameAnalytics(currentPageName);
}
});
}
public setScreenNameAnalytics(currentPageName: string) {
try {
this.firebasex.setScreenName(currentPageName).then((result)=>{
console.log(result);
});
} catch (Error) { }
}
private startReceivingPushService() {
this.pushService.startReceiving();
setTimeout(() => {
console.log(' in setTimeout startReceiving');
this.getLastLoginInfo();
}, 4000);
console.log(' in setTimeout startReceiving');
this.getLastLoginInfo();
}, 4000);
}
public subscribeEvents() {
this.platform.backButton.subscribe(() => {
if (this.router.isActive('/authentication/login', true)) {
navigator['app'].exitApp();
} else if (this.router.isActive('/home', true)) {
this.nav.navigateRoot('/home');
}
});
this.events.subscribe('setMenu', () => {
const user = this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => {
if (user) {
console.log(user);
localStorage.setItem("digitalIDUser", JSON.stringify(user));
this.digitalIDUser = user//JSON.stringify(user);
this.companyUrl = user.CompanyImageURL ? user.CompanyImageURL : '../assets/imgs/CSLogo.png';
this.companyDesc = user.CompanyImageDescription ? user.CompanyImageDescription : 'Powered By Cloud Solutions';
this.User_name_Emp = user.EMPLOYEE_DISPLAY_NAME;
if (this.cs.getUpdateImage().status) {
this.user_image = this.sanitizer.bypassSecurityTrustUrl('data:image/png;base64,' + this.cs.getUpdateImage().img);
} else {
this.user_image = user.EMPLOYEE_IMAGE ? 'data:image/png;base64,' + user.EMPLOYEE_IMAGE : '../assets/imgs/profile.png';
if (user) {
console.log(user);
localStorage.setItem("digitalIDUser", JSON.stringify(user));
this.digitalIDUser = user//JSON.stringify(user);
this.companyUrl = user.CompanyImageURL ? user.CompanyImageURL : '../assets/imgs/CSLogo.png';
this.companyDesc = user.CompanyImageDescription ? user.CompanyImageDescription : 'Powered By Cloud Solutions';
this.User_name_Emp = user.EMPLOYEE_DISPLAY_NAME;
this.authService.checkAds({
EmployeeNumber: '',
ItgEnableAt: "After Service Submission", //After Service Submission
ItgServiceName: "Login"
}, () => { }, this.ts.trPK('general', 'ok')).subscribe(res => {
var result = JSON.parse(res.Mohemm_ITG_ResponseItem).result.data;
this.cs.sharedService.setSharedData(
result,
AuthenticationService.SERVEY_DATA
)
if (!CommonService.SKIP && result) {
if (result.notificationType == 'Survey') {
this.cs.navigateForward('/erm-channel/survey');
} else {
this.authService.adsDetails({
"ItgNotificationMasterId": result['notificationMasterId']
},
() => { }, this.ts.trPK('general', 'ok')
).subscribe((result) => {
var data = result.Mohemm_ITG_ResponseItem;
if (data) {
this.cs.sharedService.setSharedData(
JSON.parse(data),
AuthenticationService.ADS_DATA
);
this.cs.navigateForward('/erm-channel/home');
}
})
}
}
this.User_Job_name = user.JOB_NAME;
});
if (this.cs.getUpdateImage().status) {
this.user_image = this.sanitizer.bypassSecurityTrustUrl('data:image/png;base64,' + this.cs.getUpdateImage().img);
} else {
console.log(user);
this.user_image = user.EMPLOYEE_IMAGE ? 'data:image/png;base64,' + user.EMPLOYEE_IMAGE : '../assets/imgs/profile.png';
}
});
// this.User_Job_name = user.JOB_NAME;
let jobTitle = user.POSITION_NAME.split('.');
if (jobTitle && jobTitle.length > 1) {
this.User_Job_name = jobTitle[0] + " " + jobTitle[1];
}
//erm channel
// if (!CommonService.SKIP)
// this.cs.navigateForward('/erm-channel/survey');
} else {
console.log(user);
}
});
});
this.events.subscribe('getNotCount', badge => { this.notBadge = badge; });
this.events.subscribe('myTeamFlag', myTeamFlag => { this.TeamFlag = myTeamFlag; });
@ -178,8 +256,13 @@ export class AppComponent implements OnInit {
this.cs.openMyTeamPage();
}
public openMyRequestPage() {
this.menu.toggle();
this.cs.openMyRequestPage();
}
public profile() {
this.cs.openEditProfile();
this.cs.openProfile('sideMenu');
this.menu.toggle();
}
@ -195,14 +278,27 @@ export class AppComponent implements OnInit {
async openDigitalId() {
const modal = await this.modalController.create({
component: DigitalIdComponent,
cssClass: 'digital-id-modal-css',
componentProps: {
'userInfo':this.digitalIDUser//JSON.parse(this.digitalIDUser)
}
component: DigitalIdComponent,
cssClass: 'digital-id-modal-css',
componentProps: {
'userInfo': this.digitalIDUser//JSON.parse(this.digitalIDUser)
}
});
return await modal.present();
}
}
async openBusinessCard() {
this.userInfo = JSON.parse(localStorage.getItem('bussiness-card-info'));
console.log(this.userInfo);
//this.userInfo = this.cs.sharedService.getSharedData('bussiness-card-info', false);
const modal = await this.modalController.create({
component: BusinessCardComponent,
cssClass: 'digital-id-modal-css',
componentProps: {
'userInfo': this.userInfo
}
});
return await modal.present();
}
private changeImage() {
this.cs.openChangeImagePage();
@ -214,40 +310,40 @@ export class AppComponent implements OnInit {
}
public getLastLoginInfo() {
this.deviceToken = this.cs.getDeviceToken();
this.deviceToken = this.cs.getDeviceToken();
if (this.deviceToken) {
console.log('login enabled first time: ' + this.deviceToken);
console.log('login enabled first time: ' + this.deviceToken);
} else {
this.pushService.startReceiving();
setTimeout(() => {
this.deviceToken = localStorage.getItem('deviceToken');
this.deviceToken = localStorage.getItem('deviceToken');
}, 1000);
}
this.requestGetLoginInfo = {
DeviceType: this.cs.getDeviceType(),
DeviceToken: this.deviceToken
DeviceType: this.cs.getDeviceType(),
DeviceToken: this.deviceToken
};
this.authService.getLoginInfo(this.requestGetLoginInfo, () => {}, this.ts.trPK('general', 'ok')).subscribe(res => {
this.authService.getLoginInfo(this.requestGetLoginInfo, () => { }, this.ts.trPK('general', 'ok')).subscribe(res => {
if (this.cs.validResponse(res)) {
if (res.Mohemm_GetMobileLoginInfoList.length > 0) {
this.cs.sharedService.setSharedData(res.Mohemm_GetMobileLoginInfoList[0], AuthenticationService.IMEI_USER_DATA);
this.user = true;
this.events.publish('user', this.user);
if (this.logoutFlage) {
this.cs.openLogin();
}
} else {
this.user = false;
this.events.publish('user', this.user);
if (res.Mohemm_GetMobileLoginInfoList.length > 0) {
this.cs.sharedService.setSharedData(res.Mohemm_GetMobileLoginInfoList[0], AuthenticationService.IMEI_USER_DATA);
this.user = true;
this.events.publish('user', this.user);
if (this.logoutFlage) {
this.cs.openLogin();
}
}
} else {}
if (this.logoutFlage) {
this.cs.openLogin();
}
} else {
this.user = false;
this.events.publish('user', this.user);
if (this.logoutFlage) {
this.cs.openLogin();
}
}
} else { }
});
}
}

@ -19,10 +19,12 @@ import { NgCalendarModule } from 'ionic2-calendar';
import { NFC, Ndef} from "@ionic-native/nfc/ngx"
import { WifiWizard2 } from "@ionic-native/wifi-wizard-2/ngx";
import { DigitalIdComponent } from './authentication/digital-id/digital-id.component';
import { BusinessCardComponent } from './authentication/business-card/business-card.component';
import { AppUpdateComponent } from './authentication/app-update/app-update.component';
@NgModule({
declarations: [AppComponent, DigitalIdComponent],
entryComponents: [DigitalIdComponent],
declarations: [AppComponent, DigitalIdComponent, BusinessCardComponent, AppUpdateComponent],
entryComponents: [DigitalIdComponent, BusinessCardComponent, AppUpdateComponent],
imports: [
BrowserModule,
BrowserAnimationsModule,

@ -12,7 +12,7 @@
.alert-tappable.sc-ion-alert-md,
.alert-tappable.sc-ion-alert-ios {
height: 70px;
height: 50px;
}
.main-badge{
position: absolute;
@ -30,4 +30,9 @@
}
.start-badge{
right:16px;
}
.my-custom-modal-css .modal-wrapper {
width: 95%;
height: 60%;
}

@ -0,0 +1,26 @@
<ion-content style="--background: white;">
<div>
<img src="assets/icon/update_rocket_image.png" style="width: 100%;" />
</div>
<div style="text-align: center;">
<img src="assets/imgs/CSLogo.png" />
</div>
<h1 style="text-align: center; font-weight: bold"> {{ 'general,app-update' | translate }}</h1>
<h2 style="text-align: center;font-size: 22px;font-weight: bold;">{{'home, app-update' | translate}}</h2>
<p style="text-align: center;padding: 10px;font-size: 14px;">{{msg}}</p>
<!-- <p *ngIf="direction == 'rtl'" style="text-align: center;padding: 10px;font-size: 14px;">{{messageAR}}</p> -->
<ion-footer style="z-index: 100;">
<ion-grid>
<ion-row class="ion-justify-content-center">
<ion-col [size]="11" [sizeLg]="8" [sizeXl]="6" no-padding>
<ion-button style="font-size: 16px !important; width:100%; --background: #259CB8; background: white;" expand="block"
(click)='dismiss()'>
{{ 'general,update-now' | translate }}
</ion-button>
</ion-col>
</ion-row>
</ion-grid>
</ion-footer>
</ion-content>

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

@ -0,0 +1,24 @@
import { Component, Input, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
@Component({
selector: 'app-app-update',
templateUrl: './app-update.component.html',
styleUrls: ['./app-update.component.scss'],
})
export class AppUpdateComponent implements OnInit {
@Input() msg: string;
constructor(public modalController: ModalController) { }
ngOnInit() {}
dismiss() {
// using the injected ModalController this page
// can "dismiss" itself and optionally pass back data
this.modalController.dismiss({
'dismissed': true
});
}
}

@ -0,0 +1,111 @@
<ion-content dir="ltr" *ngIf="userInfo.company_type == 'CS'">
<ion-grid class="card-size">
<ion-row>
<ion-col size='6'>
<img class="logo-img-style" [src]='userInfo.company_logo' alt="https://hmgwebservices.com/images/Moheem/CS.jpg"/>
</ion-col>
<ion-col size='6'>
<img class="qr-style" [src]="userInfo.qr"/>
</ion-col>
</ion-row>
<ion-row>
<ion-col size='6'>
<ion-label>
<h1 class='font-text-style' style="font-size: 25px !important; width: 400px;">{{userInfo.name_en}}</h1>
</ion-label>
</ion-col>
<ion-col size='6'>
<ion-label>
<h1 class='font-text-style name-ar-style'>{{userInfo.name_ar}}</h1>
</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-label>
<h5 class='font-text-style'>{{userInfo.job_en}}</h5>
</ion-label>
</ion-col>
<ion-col>
<ion-label>
<h5 class='font-text-style' style="position: relative; left: 398px; text-align: end;">{{userInfo.ar}}</h5>
</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-label>
<h5 class='font-text-style'>{{userInfo.mobile}}</h5>
</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-label>
<h5 class='font-text-style'>{{userInfo.email}}</h5>
</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-label>
<h5 class='font-text-style'>{{userInfo.company_url}}</h5>
</ion-label>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>
<!-- <ion-footer>
<div class="centerDiv" style="margin-top: 20px !important;">
<ion-button class="button-login" (click)="dismiss()"><b>{{ts.trPK('general','close')}}</b></ion-button>
</div>
</ion-footer> -->
<ion-content dir="ltr" *ngIf="userInfo.company_type != 'CS'">
<ion-grid class="cs-card-size">
<ion-row>
<ion-col style="padding-left: 315px;">
<img class="logo-img-hmg-style" [alt]='userInfo.company_logo' src="../assets/icon/HMG_LOGO.png"/>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<img class="qr-img-hmg-style" [src]="userInfo.qr"/>
</ion-col>
<ion-col>
<ion-label>
<h1 class='font-text-style' style="font-size: 25px !important; width: 400px;">{{userInfo.name_en}}</h1>
</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-label>
<h5 class='font-text-style'>{{userInfo.job_en}}</h5>
</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-label>
<h5 class='font-text-style'>{{userInfo.mobile}}</h5>
</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-label>
<h5 class='font-text-style'>{{userInfo.email}}</h5>
</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-label>
<h5 class='font-text-style'>{{userInfo.company_url}}</h5>
</ion-label>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>

@ -0,0 +1,233 @@
.button-login{
--background: #c1272d !important;
background: #c1272d !important;
white-space: normal;
color: var(--light);
text-transform: capitalize;
min-height: 1.0cm;
--border-radius: 33px !important;
border-radius: 33px !important;
--min-height: 1.6cm !important;
width: 315px;
}
@media only screen and (max-device-height: 640px) {
.digital-id-image-size{
width: 70% !important;
height: 160% !important;
bottom: 0% !important;
position: absolute !important;
border: 1px solid #e6e6e6 !important;
border-radius: 20px !important;
}
}
.digital-id-image-size{
width: 70%;height: 180%; ; bottom: 0%; position: absolute; border: 1px solid #e6e6e6; border-radius: 20px;
}
.font-text-style{
font-family: 'WorkSans-Bold';
color: black;
font-size: 15px;
font-weight: bold;
}
@media screen and (min-width: 400px)and (min-height:800px) and (max-height: 900px) {
// CS
.card-size{
transform: rotate(90deg) !important;
padding: 10px !important;
padding-right: 0px !important;
}
.qr-style{
left: 410px !important;
}
.name-ar-style{
left: 320px !important;
}
// HMG
.logo-img-hmg-style{
left: 360px !important;
}
.qr-img-hmg-style{
left: 580px !important;
}
}
@media screen and (min-width: 400px) and (min-height:700px) and (max-height: 799px){
// CS
.card-size{
transform: rotate(90deg) !important;
padding: 10px !important;
padding-right: 0px !important;
}
.qr-style{
left: 324px !important;
}
.name-ar-style{
left: 230px !important;
}
// HMG
.logo-img-hmg-style{
left: 275px !important;
}
.qr-img-hmg-style{
left: 495px !important;
}
}
@media screen and (min-width: 325px) and (max-width:399px) and (max-height: 812px){
// CS
.card-size{
transform: rotate(90deg) !important;
padding: 5px !important;
padding-right: 0px !important;
}
.qr-style{
left: 400px !important;
}
.name-ar-style{
left: 310px !important;
}
// HMG
.logo-img-hmg-style{
left: 360px !important;
}
.qr-img-hmg-style{
left: 550px !important;
}
}
@media screen and (min-width: 325px) and (max-width:399px) and (max-height: 700px){
.card-size{
transform: rotate(90deg) !important;
padding: 5px !important;
padding-right: 0px !important;
}
.qr-style{
left: 280px !important;
}
.name-ar-style{
left: 190px !important;
}
// HMG
.logo-img-hmg-style{
left: 360px !important;
}
.qr-img-hmg-style{
left: 550px !important;
}
}
@media screen and (min-width: 325px) and (max-width:399px) and (max-height: 699px){
.card-size{
transform: rotate(90deg) !important;
padding: 5px !important;
padding-right: 0px !important;
}
.qr-style{
left: 280px !important;
}
.name-ar-style{
left: 190px !important;
}
// HMG
.logo-img-hmg-style{
left: 245px !important;
}
.qr-img-hmg-style{
left: 430px !important;
}
}
@media screen and (min-width: 1px) and (max-width:320px) {
.card-size{
transform: rotate(90deg) !important;
position: relative;
bottom: 30px;
left: 26px;
}
.qr-style{
width: 80px !important;
margin-top: 50px !important;
position: relative !important;
left: 265px !important;
}
.name-ar-style{
font-size: 15px !important;
position: relative !important;
left: 130px !important;
text-align: end !important;
padding: 10px !important;
width: 225px !important;
}
.logo-img-style{
width: 80px !important;
margin-top: 50px !important;
}
// HMG
.logo-img-hmg-style{
width: 380px !important;
position: fixed !important;
left: 200px !important;
height: 81px !important;
bottom: 205px !important;
}
.qr-img-hmg-style{
width: 105px !important;
margin-top: 0px !important;
position: relative !important;
left: 390px !important;
top: 160px !important;
}
.cs-card-size{
padding: 15px !important;
padding-top: 0px !important;
padding-left: 1px !important;
}
}
.card-size{
transform: rotate(90deg);
}
.qr-style{
width: 130px;
margin-top: 0px;
position: relative;
left: 410px;
}
.name-ar-style{
font-size: 25px;
position: relative;
left: 314px;
text-align: end;
padding: 10px;
width: 225px;
}
.logo-img-style{
width: 120px;
}
.logo-img-hmg-style{
width: 380px;
position: fixed;
left: 340;
height: 81px;
}
.qr-img-hmg-style{
width: 130px;
margin-top: 0px;
position: relative;
left: 560px;
top: 160px;
}
.cs-card-size{
transform: rotate(90deg);
padding: 25px;
}

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

@ -0,0 +1,32 @@
import { Component, OnInit, Input } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
@Component({
selector: 'app-business-card',
templateUrl: './business-card.component.html',
styleUrls: ['./business-card.component.scss'],
})
export class BusinessCardComponent implements OnInit {
@Input() userInfo: any;
public userJobName: any;
constructor(
public modalCtrl: ModalController,
public ts: TranslatorService,
public common: CommonService
) { }
ngOnInit() {
console.log(this.userInfo);
}
dismiss() {
this.modalCtrl.dismiss({
'dismissed': true
});
}
}

@ -19,6 +19,7 @@ import * as moment from 'moment';
import { CheckAppVersionResponse } from 'src/app/hmg-common/services/authentication/models/check-app-version.response';
import { NFC } from "@ionic-native/nfc/ngx";
import { DigitalIdComponent } from '../digital-id/digital-id.component';
import { AppUpdateComponent } from '../app-update/app-update.component';
@Component({
selector: 'app-confirm-login',
@ -455,16 +456,25 @@ export class ConfirmLoginComponent implements OnInit {
this.authService.checkApplicationVersion(() => { }).subscribe((result: CheckAppVersionResponse) => {
// tslint:disable-next-line: triple-equals
if (result.MessageStatus == 2 && result.ErrorType == 4) {
this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => {
this.handleAppUpdate(result);
});
// tslint:disable-next-line: triple-equals
this.appUpdate(result.ErrorEndUserMessage, result);
} else if (result.MessageStatus == 1) {
this.checkUserAuthentication();
}
});
}
async appUpdate(msg, result) {
const modal = await this.modalController.create({
component: AppUpdateComponent,
cssClass: 'app-update-modal-css',
componentProps: {'msg':msg}
});
modal.onDidDismiss().then((data) => {
this.handleAppUpdate(result);
});
return await modal.present();
}
checkAccess(el: any, isDigitalID = false, buttonType?) {
const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
if (isDigitalID) {

@ -1,6 +1,6 @@
<ion-content *ngIf="userInfo.CompanyMainCompany == 'CS'" dir="ltr">
<img *ngIf="userInfo.PAYROLL_CODE === 'CS' " style="width: 100%; max-width: 100%; height: 30%;" src="../assets/imgs/IDTOP.png">
<img *ngIf="userInfo.PAYROLL_CODE !== 'CS' " style="width: 100%; max-width: 100%;" src="../assets/imgs/IDTOP_HMG.png.png">
<img *ngIf="userInfo.PAYROLL_CODE === 'CS' " style="width: 100%; max-width: 100%; height: 30%;" src="../../../assets/imgs/IDTOP.png">
<img *ngIf="userInfo.PAYROLL_CODE !== 'CS' " style="width: 100%; max-width: 100%;" src="../../../assets/imgs/IDTOP_HMG.png.png">
<ion-grid>
<ion-row>
<ion-col size="6" *ngIf="userInfo.EMPLOYEE_IMAGE != null">
@ -9,7 +9,7 @@
</ion-col>
<ion-col size="6" *ngIf="userInfo.EMPLOYEE_IMAGE == null">
<img style="width: 70%;height: 180%; ; bottom: 0%; position: absolute; border: 1px solid #e6e6e6; border-radius: 20px;"
src="../assets/imgs/profilePic.png">
src="../../../assets/imgs/profilePic.png">
</ion-col>
<ion-col size="6">
<p><b style="font-size: 25px !important; font-family: sans-serif;">{{userInfo.ASSIGNMENT_NUMBER}}</b></p>
@ -18,7 +18,7 @@
<ion-row>
<ion-col>
<p><b style="font-size: 20px !important;">{{userInfo.EMPLOYEE_DISPLAY_NAME}}</b></p>
<p style="font-size: 15px !important;">{{userInfo.JOB_NAME}}</p>
<p style="font-size: 15px !important;">{{userJobName}}</p>
</ion-col>
</ion-row>
<ion-row>
@ -35,7 +35,7 @@
<ion-col size="3"></ion-col>
<ion-col size="9" *ngIf="userInfo.EMPLOYEE_IMAGE != null" padding>
<img *ngIf="userInfo.EMPLOYEE_IMAGE != null" [src]="'data:image/png;base64,'+userInfo.EMPLOYEE_IMAGE" style="width: 60%; height: 100%; border: 3px solid black;">
<img *ngIf="userInfo.EMPLOYEE_IMAGE == null" src="../assets/imgs/profilePic.png" style="width: 60%; height: 100%; border: 3px solid black;">
<img *ngIf="userInfo.EMPLOYEE_IMAGE == null" src="../../../assets/imgs/profilePic.png" style="width: 60%; height: 100%; border: 3px solid black;">
</ion-col>
</ion-row>
<ion-row style="padding: 0%;">
@ -50,13 +50,13 @@
</ion-row>
<ion-row style="padding: 0%;">
<ion-col style="text-align: center;font-weight: bold;font-family: 'WorkSans-Bold'; padding: 0%;">
<p style="font-size: 15px; padding: 0%;">{{userInfo.JOB_NAME}}</p>
<p style="font-size: 15px; padding: 0%;">{{userJobName}}</p>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<img *ngIf="userInfo.CompanyImageURL" style="width: 90%; max-width: 100%; margin-left: 6%;" [src]="userInfo.CompanyBadge">
<img *ngIf="!userInfo.CompanyImageURL" style="width: 50%; max-width: 100%; margin-left: 16%;" src="../assets/imgs/HMG_LOGO.png">
<img *ngIf="!userInfo.CompanyImageURL" style="width: 50%; max-width: 100%; margin-left: 16%;" src="../../../assets/imgs/HMG_LOGO.png">
</ion-col>
</ion-row>
<ion-row>

@ -9,6 +9,7 @@ import { TranslatorService } from 'src/app/hmg-common/services/translator/transl
})
export class DigitalIdComponent implements OnInit {
@Input() userInfo: any;
public userJobName: any;
constructor(
public modalCtrl: ModalController,
@ -20,6 +21,12 @@ export class DigitalIdComponent implements OnInit {
this.userInfo = JSON.parse(localStorage.getItem('digitalIDUser'));
}
console.log(this.userInfo);
if (this.userInfo) {
let jobTitle = this.userInfo.POSITION_NAME.split('.');
if (jobTitle && jobTitle.length > 1) {
this.userJobName = jobTitle[0] + " " + jobTitle[1];
}
}
}

@ -35,8 +35,7 @@ export class ForgotComponent implements OnInit {
) {
}
ngOnInit() {
}
ngOnInit() {}
public onForgot() {
this.sendSMSForForgotPassword();
@ -59,12 +58,18 @@ export class ForgotComponent implements OnInit {
public forgotpassword(){
const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
const forgetPasswordTokenResult = this.sharedData.getSharedData('checkSMSResponse', false);
let forgetPasswordTokenID = '';
if (forgetPasswordTokenResult.ForgetPasswordTokenID) {
forgetPasswordTokenID = forgetPasswordTokenResult.ForgetPasswordTokenID;
}
this.loginData.P_USER_NAME = this.P_USER_NAME;
let request:ForgetPassword = new ForgetPassword();
let request: any = {};
request.P_Confirm_NEW_PASSWORD=this.P_NEW_PASSWORD;
request.P_NEW_PASSWORD=this.P_Confirm_NEW_PASSWORD;
request.P_USER_NAME = data.P_USER_NAME;
request.ForgetPasswordTokenID = forgetPasswordTokenID;
this.authService.submitForgetPassword(
request,
() => {

@ -42,12 +42,12 @@
<!-- <div *ngIf="welcomeBack"> -->
<welcome-login (onLogin)="login()" (loginWithUser)="loginWithUser()" *ngIf="user ">
<welcome-login (onLogin)="login()" (loginWithUser)="loginWithUser()" *ngIf="user">
</welcome-login>
<!-- </div> -->
<div class="centerDiv" style="margin-top: 20px !important;">
<ion-button [ngClass]="{'disable-button-opacity': isValidForm()}" class="button-login" (click)="onLogin()" [disabled]="isValidForm()">{{ts.trPK('login','login')}}</ion-button>
<div *ngIf="!user" class="centerDiv" style="margin-top: 20px !important;">
<ion-button [ngClass]="{'disable-button-opacity': isValidForm()}" class="button-login" (click)="onLogin()" [disabled]="isValidForm()" style="width: 100% !important;">{{ts.trPK('login','login')}}</ion-button>
<!-- digital ID button -->
<!-- <ion-button *ngIf="userInfo" class="button-digital-id" (click)="openDigitalId()">
@ -62,7 +62,7 @@
</div>
</ion-content>
<ion-footer *ngIf="!user" [ngStyle]="keyboardOpened === true ? {'display': 'none'} : {}">
<ion-footer *ngIf="!user" [ngStyle]="keyboardOpened === true ? {'display': 'none'} : {}" style="padding: 0px;">
<ion-row>
<ion-col class="colPad">
<img class="centerDiv logoFotor" src="../assets/imgs/CSLogo.png" />

@ -20,6 +20,7 @@ import { KeyboardService } from 'src/app/hmg-common/services/keyboard/keyboard.s
import { KeyboardStatusModel } from 'src/app/hmg-common/services/keyboard/keyboard-status.model';
import { ModalController } from '@ionic/angular';
import { DigitalIdComponent } from '../digital-id/digital-id.component';
import { AppUpdateComponent } from '../app-update/app-update.component';
@Component({
selector: 'login',
@ -194,12 +195,8 @@ export class LoginComponent implements OnInit, OnDestroy {
public checkAppUpdated() {
this.authService.checkApplicationVersion(() => { }).subscribe((result: CheckAppVersionResponse) => {
// tslint:disable-next-line: triple-equals
if (result.MessageStatus == 2 && result.ErrorType == 4) {
this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => {
this.handleAppUpdate(result);
});
// tslint:disable-next-line: triple-equals
this.appUpdate(result.ErrorEndUserMessage, result);
} else if (result.MessageStatus == 1) {
this.checkUserAuthentication();
}
@ -401,4 +398,16 @@ export class LoginComponent implements OnInit, OnDestroy {
this.inputType = 'text';
}
async appUpdate(msg, result) {
const modal = await this.modalController.create({
component: AppUpdateComponent,
cssClass: 'app-update-modal-css',
componentProps: {'msg':msg}
});
modal.onDidDismiss().then((data) => {
this.handleAppUpdate(result);
});
return await modal.present();
}
}

@ -58,6 +58,8 @@
</ion-col>
</ion-row>
<div *ngIf="showErrorMessage"><p style="color: red; font-weight: bold; font-size: 14px; text-align: center;">{{messageValue}}</p></div>
</div>
</ion-content>

@ -50,6 +50,9 @@ export class SmsPageComponent implements OnInit {
loginType: any;
activeType: any;
public isNFCAvailable = false;
public showErrorMessage = false;
public messageValue: string;
public businessInfo: object;
constructor(
public navCtrl: NavController,
@ -183,6 +186,7 @@ export class SmsPageComponent implements OnInit {
}
public checkSMS() {
this.showErrorMessage = false;
const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
const request = new SMSCheckRequest();
request.LogInTokenID = data.LogInTokenID;
@ -190,12 +194,31 @@ export class SmsPageComponent implements OnInit {
request.P_USER_NAME = data.P_USER_NAME;
request.MobileNumber = data.MobileNumber;
request.IsDeviceNFC = this.isNFCAvailable;
this.authService.checkSMS(request, () => {}, this.translate.trPK('general', 'ok')).subscribe((result: SMSCheckResponse) => {
if (this.common.validResponse(result)) {
this.authService.checkSMS(request, () => {}, this.translate.trPK('general', 'ok'), true).subscribe((result: SMSCheckResponse) => {
if (this.common.validResponse(result)) {
//save business card info
this.businessInfo = {
show_business: result.BusinessCardPrivilege,
name_en: result.MemberInformationList[0].EMPLOYEE_NAME_En,
job_en: result.MemberInformationList[0].JOB_NAME_En,
name_ar: result.MemberInformationList[0].EMPLOYEE_NAME_Ar,
job_ar: result.MemberInformationList[0].JOB_NAME_Ar,
mobile: result.MemberInformationList[0].MobileNumberWithZipCode,
qr: result.MemberInformationList[0].BusinessCardQR,
company_logo: result.BC_Logo ? result.BC_Logo: result.CompanyImageURL,
company_url: result.BC_Domain,
company_type: result.CompanyMainCompany,
email: result.MemberInformationList[0].EMPLOYEE_EMAIL_ADDRESS
}
// Wifi Credientials
CommonService.MOHEMM_WIFI_SSID = result.Mohemm_Wifi_SSID;
CommonService.MOHEMM_WIFI_PASSWORD = result.Mohemm_Wifi_Password;
console.log('ENAD');
console.log(JSON.stringify(this.businessInfo));
localStorage.setItem('bussiness-card-info', JSON.stringify(this.businessInfo));
// this.common.sharedService.setSharedData(this.businessInfo,'bussiness-card-info');
AuthenticationService.servicePrivilage = result.Privilege_List;
this.authService.setAuthenticatedUser(result).subscribe(() => {
@ -206,9 +229,20 @@ export class SmsPageComponent implements OnInit {
if (this.platform.is('cordova')) {
this.insertMobileLogin();
}
this.common.sharedService.setSharedData(result.MemberInformationList[0].PAYROLL_CODE, "projcet-code");
this.activeType =this.common.setActiveTypeLogin(0);
this.common.openHome();
});
} else {
let errorResult: any;
errorResult = result;
this.showErrorMessage = true;
this.messageValue = errorResult.ErrorEndUserMessage;
this.smc_code = [];
(document.activeElement as HTMLElement).blur();
setTimeout(() => {
this.showErrorMessage = false;
}, 5000);
}
});
}
@ -239,6 +273,7 @@ export class SmsPageComponent implements OnInit {
request.P_USER_NAME = data.P_USER_NAME;
this.authService.checkForgetSMS(request, () => {}, this.translate.trPK('general', 'ok')).subscribe((result: SMSCheckResponse) => {
if (this.common.validResponse(result)) {
this.sharedData.setSharedData(result, 'checkSMSResponse');
if (this.isForgetPwd) {
this.common.openForgotPassword();
}

@ -0,0 +1,90 @@
<app-generic-header
showBack="true"
[headerText]="'login,announcement' | translate">
</app-generic-header>
<ion-content style="--background:#F4F4F4;">
<ion-searchbar mode='md' (ionInput)="filterList($event)" style="--background: white; margin-top: 10px; padding-bottom: 20px;"></ion-searchbar>
<ion-list style="background: #f4f4f4; margin-top: -8px !important;">
<div *ngFor="let item of announcementList; let i = index"
[ngClass]="item.Open ? 'class-dev-close': 'class-dev-open'"
style="margin: 15px; background: white; border-radius: 10px;">
<!-- <ion-card *ngIf="i === 0 && !item.isOpen" (click)="toggleAnnouncement(item)" class="main-card-style">
<img [src]="item.img" class="main-card-image">
<ion-item class="main-card-item-list-style">
<ion-label class="main-card-label-style-all">
<p class="text-style item-list-first-date">{{item.date}}</p>
<h2 class="text-style item-list-first-h" *ngIf="direction === 'en'">{{item.title_EN}}</h2>
<h2 class="text-style item-list-first-h" *ngIf="direction === 'ar'">{{item.title_AR}}</h2>
</ion-label>
</ion-item>
</ion-card>
<ion-card *ngIf="i === 0 && item.isOpen" (click)="toggleAnnouncement(item)" style="margin: 0px; background: white;">
<ion-card-header style="background: transparent;">
<ion-card-title *ngIf="direction === 'en'"><h2 class="card-style-h">{{item.title_EN}}</h2><br>
<p class="card-style-date">{{item.date}}</p>
</ion-card-title>
<ion-card-title *ngIf="direction === 'ar'" class="card-style-h">{{item.title_AR}} <br>
<p class="card-style-date">{{item.date}}</p>
</ion-card-title>
<img [src]="item.img" class="image-center">
</ion-card-header>
<ion-card-content>
<p *ngIf="direction === 'en'" class="card-style-p"><span [innerHTML]="item.body_EN"></span></p>
<p *ngIf="direction === 'ar'" class="card-style-p">{{item.body_AR}}</p>
</ion-card-content>
</ion-card> -->
<ion-item no-padding *ngIf="!item.isOpen && item.img" (click)="toggleAnnouncement(item)" lines='none' class="announcement-items">
<img [src]="item.img" [ngClass]="direction === 'en'? 'image-item-en': 'image-item-ar' ">
<ion-label style="margin: 5px; margin-top: -20px;">
<h2 class="item-list-h" *ngIf="direction === 'en'">{{item.title_EN}}</h2>
<!-- <p class="item-list-p-title" *ngIf="direction === 'en'"><span [innerHTML]="item.body_EN"></span></p> -->
<h2 class="item-list-h" *ngIf="direction === 'ar'">{{item.title_AR}}</h2>
<!-- <p class="item-list-p-title" *ngIf="direction === 'ar'">{{item.body_AR}}</p> -->
<p class="item-list-date-title">{{item.date}}</p>
</ion-label>
</ion-item>
<ion-item *ngIf="!item.isOpen && !item.img" (click)="toggleAnnouncement(item)" lines='none' class="announcement-items">
<ion-label style="margin: 10px;">
<h2 class="item-list-h" *ngIf="direction === 'en'">{{item.title_EN}}</h2>
<p class="item-list-p-title" *ngIf="direction === 'en'"><span [innerHTML]="item.body_EN"></span></p>
<h2 class="item-list-h" *ngIf="direction === 'ar'">{{item.title_AR}}</h2>
<p class="item-list-p-title" *ngIf="direction === 'ar'"><span [innerHTML]="item.body_AR"></span></p>
<p class="item-list-date-title">{{item.date}}</p>
</ion-label>
</ion-item>
<ion-card *ngIf="item.isOpen" (click)="closeAnnouncement(item)" style="margin: 0px;">
<ion-card-header style="background: transparent;">
<ion-card-title style="font-size: 20px; margin: 5px;" *ngIf="direction === 'en'">{{detialData.title_EN}} <br>
<p style="font-size: 12px; color: gray;">{{detialData.date}}</p>
</ion-card-title>
<ion-card-title style="font-size: 20px; margin: 5px;" *ngIf="direction === 'ar'">{{detialData.title_AR}} <br>
<p style="font-size: 12px; color: gray;">{{detialData.date}}</p>
</ion-card-title>
<img *ngIf='detialData.img' [src]="detialData.img" class="image-center">
<div *ngIf='!detialData.img'></div>
</ion-card-header>
<ion-card-content>
<p *ngIf="direction === 'en'"><span [innerHTML]="detialData.body_EN"></span></p>
<p *ngIf="direction === 'ar'"><span [innerHTML]="detialData.body_AR"></span></p>
</ion-card-content>
</ion-card>
</div>
</ion-list>
<ion-infinite-scroll threshold="100px" (ionInfinite)="loadData($event)">
<ion-infinite-scroll-content
loadingSpinner="bubbles"
loadingText="Loading more data...">
</ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content>
<!-- <ion-footer>
<ion-button (click)="loadData($event)"><ion-label><p>more</p></ion-label></ion-button>
</ion-footer> -->

@ -0,0 +1,140 @@
.image-center {
width: 100%;
display: block;
margin-left: auto;
margin-right: auto;
height: 190px;
}
.main-card-image {
width: 100%;
display: block;
margin-left: auto;
margin-right: auto;
position: absolute;
height: 100%;
}
.text-style {
margin: 5px;
}
.class-dev-close {
// border: 1px solid lightgray;
// border-radius: 30px;
}
.class-dev-open {
}
.class-item-open {
border: 1px solid lightgray;
border-radius: 30px;
height: 100px;
}
.class-item-close {
}
.image-item-en {
padding-left: 5px;
width: 100px;
min-height: 100px;
border: 5px solid white;
border-radius: 11px;
border-left: 0px;
border-right: 0px;
object-fit: cover;
}
.image-item-ar {
padding-right: 5px;
width: 100px;
min-height: 100px;
border: 5px solid white;
border-radius: 11px;
border-left: 0px;
border-right: 0px;
}
.announcement-items {
border: 1px solid #00000029;
border-radius: 10px;
height: 100px;
box-shadow: 0px 0px 5px #00000000;
}
.item-list-h {
font: normal normal 600 14px/11px Poppins;
letter-spacing: -0.56px;
color: #2b353e;
opacity: 1;
padding-bottom: 5px;
}
.item-list-p-title {
font: normal normal medium 11px/16px Poppins;
letter-spacing: -0.44px;
color: #535353;
}
.item-list-date-title {
font: normal normal 600 10px/16px Poppins;
letter-spacing: -0.4px;
color: #7c7c7c;
}
.item-list-first-h {
font: normal normal bold 23px/24px Poppins;
letter-spacing: -0.3px;
color: #ffffff;
white-space: break-spaces;
}
.item-list-first-p {
font: normal normal normal 12px/17px Poppins;
letter-spacing: -0.12px;
color: #ffffff;
}
.item-list-first-date {
text-align: left;
font: normal normal bold 8px/23px Poppins;
letter-spacing: 0px;
color: #ffffff;
}
.card-style-h {
font: normal normal 600 20px/22px Poppins;
letter-spacing: -0.8px;
color: #2b353e;
margin-bottom: -34px;
}
.card-style-p {
font: normal normal medium 13px/18px Poppins;
letter-spacing: -0.52px;
color: #535353;
}
.card-style-date {
font: normal normal 600 12px/18px Poppins;
letter-spacing: -0.48px;
color: #7c7c7c;
}
.main-card-style {
margin: 0px;
position: relative;
min-height: 283px;
}
.main-card-item-list-style {
position: absolute;
bottom: 0px;
--background: transparent;
}
.main-card-label-stle{
margin: 0px;
padding: 0px;
width: 237px;
}
.main-card-label-style-all{
padding: 0px;
margin: 0px;
width: 200px;
}
.item-native {
padding-left: 5px !important;
}

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

@ -0,0 +1,147 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { detachEmbeddedView } from '@angular/core/src/view';
import { AnnouncementService } from 'src/app/hmg-common/services/announcement-services/announcement.service';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { IonInfiniteScroll } from '@ionic/angular';
@Component({
selector: 'app-announcement',
templateUrl: './announcement.component.html',
styleUrls: ['./announcement.component.scss'],
})
export class AnnouncementComponent implements OnInit {
public arr: { id: number, title_EN: string, title_AR: string, body_EN: string, body_AR: string, img?: string, date: Date, isopen: boolean }[] = [];
public arrList = [];
public listOfAnnouncement;
direction: string;
public announcementList = [];
public numberOfListLength = 10;
public announcememntCounter = this.numberOfListLength;
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
public pageSize = 1;
public pageLength = 0;
public lengthCounter = 5;
public detialData: {
id: number,
title_EN: string,
title_AR: string,
body_EN: string,
body_AR: string,
img?: string,
date: Date};
constructor(
public announcementService: AnnouncementService,
public translate: TranslatorService,
public common: CommonService
) { }
ngOnInit() {
this.common.startLoading();
this.direction = TranslatorService.getCurrentLanguageName();
this.getAnnouncementListService();
}
filterList(event) {
const val = event.target.value;
if (val === '') {
this.announcementList = this.arrList;
}
this.announcementList = this.arrList.filter((item) => {
return (item.title_EN.toLowerCase().indexOf(val.toLowerCase()) > -1);
});
}
toggleAnnouncement(item) {
this.common.startLoading();
let holdData;
let data;
this.announcementList.forEach(element => {
if (element.id === item.id) {
this.announcementService.getAnnouncementListService(this.pageSize, item.id).subscribe((result: any) => {
this.common.stopLoading();
if (this.common.validResponse(result)) {
holdData = JSON.parse(result.Mohemm_ITG_ResponseItem);
data = JSON.parse(holdData.result.data)[0];
console.log(data);
this.detialData = {
id: data.rowID,
title_EN: data.Title_EN,
title_AR: data.Title_AR,
body_EN: data.Body_EN,
body_AR: data.Body_AR,
date: data.created,
img: data.Banner_Image
};
element.isOpen = !element.isOpen;
// this.common.stopLoading();
}
console.log(this.detialData);
});
} else {
element.isOpen = false;
}
});
}
closeAnnouncement(item){
item.isOpen = false;
}
getAnnouncementListService() {
// this.common.startLoading();
let holdData;
this.announcementService.getAnnouncementListService(this.pageSize).subscribe((result: any) => {
this.common.stopLoading();
if (this.common.validResponse(result)) {
holdData = JSON.parse(result.Mohemm_ITG_ResponseItem);
this.listOfAnnouncement = JSON.parse(holdData.result.data);
this.pageLength = this.listOfAnnouncement[0].TotalItems;
for (let i = 0; i < this.listOfAnnouncement.length; i++) {
this.listOfAnnouncement[i].Title_EN = this.listOfAnnouncement[i].Title_EN;
this.listOfAnnouncement[i].Title_AR = this.listOfAnnouncement[i].Title_AR;
this.listOfAnnouncement[i].EmailBody_EN = this.listOfAnnouncement[i].EmailBody_EN;
this.listOfAnnouncement[i].EmailBody_AR = this.listOfAnnouncement[i].EmailBody_AR;
this.arr[i] = {
id: this.listOfAnnouncement[i].rowID,
title_EN: this.listOfAnnouncement[i].Title_EN,
title_AR: this.listOfAnnouncement[i].Title_AR,
body_EN: this.listOfAnnouncement[i].EmailBody_EN,
body_AR: this.listOfAnnouncement[i].EmailBody_AR,
date: this.listOfAnnouncement[i].created,
img: this.listOfAnnouncement[i].Banner_Image,
isopen: false
};
if ( i < this.numberOfListLength){
this.announcementList.push(this.arr[i]);
}
this.arrList.push(this.arr[i]);
}
}
// this.common.stopLoading();
});
}
loadData(event) {
// let counter = this.numberOfListLength + this.announcememntCounter;
setTimeout(() => {
event.target.complete();
// for(let i = this.announcememntCounter; i < counter; i++) {
// if(this.arrList[i]) {
// this.announcementList.push(this.arrList[i]);
// this.announcememntCounter ++;
// }
// }
this.pageSize += 1;
if (this.lengthCounter >= this.pageLength) {
event.target.disabled = true;
} else {
this.getAnnouncementListService();
}
this.lengthCounter += 5;
}, 500);
}
}

@ -0,0 +1,36 @@
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 { HmgCommonModule } from '../hmg-common/hmg-common.module';
import { BackendIntegrationsPage } from './backend-integrations.page';
import { AnnouncementComponent } from './announcement/announcement.component';
const routes: Routes = [
{
path: '',
component: BackendIntegrationsPage,
children: [
{
path: 'announcement',
component: AnnouncementComponent
}
]
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
HmgCommonModule,
RouterModule.forChild(routes)
],
declarations: [BackendIntegrationsPage, AnnouncementComponent]
})
export class BackendIntegrationsPageModule {}

@ -0,0 +1,3 @@
<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 { BackendIntegrationsPage } from './backend-integrations.page';
describe('BackendIntegrationsPage', () => {
let component: BackendIntegrationsPage;
let fixture: ComponentFixture<BackendIntegrationsPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ BackendIntegrationsPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(BackendIntegrationsPage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

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

@ -2,7 +2,7 @@
showBack="true"
[headerText]="headerTitle">
</app-generic-header>
<!-- backLink="/home" -->
<ion-content>

@ -31,6 +31,7 @@ export class HomeComponent implements OnInit {
ngOnInit() { }
openPage(page, index) {
console.log(page + "index" + index);
// Reset the content nav to have just this page
// we wouldn't want the back button to show in this scenario
if (page.children.length === 0) {
@ -56,6 +57,10 @@ export class HomeComponent implements OnInit {
this.cs.openAbsencePage();
} else if (menuEntry.REQUEST_TYPE === 'EIT') {
this.cs.openEitListPage();
} else if (menuEntry.REQUEST_TYPE === 'BASIC_DETAILS') {
this.cs.openProfile('basicDetails');
} else if (menuEntry.REQUEST_TYPE === 'ADDRESS') {
this.cs.openProfile('address');
}
if (menuEntry.REQUEST_TYPE === 'PAYSLIP') {
this.cs.openPayslipPage();

@ -0,0 +1,15 @@
import { EitTransactionModel } from './eit.transaction.model';
export class EitAddressRequest {
public static SHARED_DATA = 'eit-request';
public P_MENU_TYPE: string;
public P_SELECTED_EMPLOYEE_NUMBER: string;
public P_FUNCTION_NAME: string;
public P_SELECTED_RESP_ID: Number;
P_DESC_FLEX_CONTEXT_CODE: string;
EITTransactionTBL: EitTransactionModel[];
P_COUNTRY_CODE: string;
P_EFFECTIVE_DATE: string;
P_ACTION: string;
}

@ -8,4 +8,5 @@ export class EitRequest {
public P_SELECTED_RESP_ID: Number;
P_DESC_FLEX_CONTEXT_CODE: string;
EITTransactionTBL: EitTransactionModel[];
}

@ -0,0 +1,41 @@
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 { IonicRatingModule } from 'ionic4-rating';
import { ErmChannelPage } from './erm-channel.page';
import { HomeComponent } from './home/home.component';
import { SurveyComponent } from './survey/survey.component';
import { HmgCommonModule } from '../hmg-common/hmg-common.module';
const routes: Routes = [
{
path: '',
component: ErmChannelPage,
children: [
{
path: 'home',
component: HomeComponent
},
{
path: 'survey',
component: SurveyComponent
},
]
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
IonicRatingModule,
HmgCommonModule,
RouterModule.forChild(routes)
],
declarations: [ErmChannelPage, HomeComponent, SurveyComponent]
})
export class ErmChannelPageModule { }

@ -0,0 +1,4 @@
<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 { ErmChannelPage } from './erm-channel.page';
describe('ErmChannelPage', () => {
let component: ErmChannelPage;
let fixture: ComponentFixture<ErmChannelPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ErmChannelPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ErmChannelPage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

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

@ -0,0 +1,20 @@
<div class="full-ads" >
<img [src]="advertisement.base64String" *ngIf="advertisement.contentType =='image/jpeg'"/>
<video style="width: 100%; position: absolute; bottom: 45%;" autoplay="autoplay" *ngIf="advertisement.contentType =='video/mp4'" controls>
<source type="video/mp4" [src]="advertisement.base64String">
</video>
<!-- <div class="skip-btn" (click)="skip()" *ngIf="isSkip ==true">{{ts.trPK('worklistMain','skip')}}</div> -->
<div class="info-container">
<div class="seconds" *ngIf="isSkip ==false">{{setTime}}</div>
<div *ngIf="setTime ==0">
<ion-icon name="thumbs-down" class="red" (click)="setView('Dislike')"></ion-icon>
<img src="../../../assets/imgs/light-bulb.svg" style="width: 70px; padding: 15px;" (click)="setView('Info')">
<ion-icon name="thumbs-up" class="green" (click)="setView('Like')"></ion-icon>
</div>
</div>
</div>

@ -0,0 +1,48 @@
.full-ads{
position: absolute;
height: 100%;
width: 100%;
background-size: cover;
}
.skip-btn{
position: absolute;
background: black;
color: #fff;
margin: 10px;
right: 10px;
padding: 5px;
border-radius: 5px;
}
.info-container {
width: 100%;
text-align: center;
bottom: 10%;
position: absolute;
}
.info-container ion-icon{
margin: 10px;
font-size: 32px;
padding: 10px;
border-radius: 50%;
display: inline-block;
}
.red{
background: #ff5757;
color: #fff;
}
.green{
background: #23f172;
color: #fff;
}
.white{
background: #fff;
color: #000;
}
.seconds{
font-size: 28px;
font-weight: bold;
}

@ -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,68 @@
import { Component, OnInit } from '@angular/core';
import { NavController } from '@ionic/angular';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { DomSanitizer } from '@angular/platform-browser';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'],
})
export class HomeComponent implements OnInit {
isSkip: boolean = false;
setTime: number = 5;
advertisement: any;
data: any;
constructor(public nav: NavController, public cs: CommonService, public sanitizer: DomSanitizer, public authService: AuthenticationService, public ts: TranslatorService) { }
ngOnInit() {
this.data = this.cs.sharedService.getSharedData(
AuthenticationService.ADS_DATA,
false
);
this.advertisement = this.data.result.data.advertisement.viewAttachFileColl[0];
this.setTime = this.data.result.data.advertisement.durationInSeconds;
this.setTimer();
}
skip() {
this.nav.pop();
CommonService.SKIP = true;
}
setTimer() {
setTimeout(() => {
this.setTime--;
if (this.setTime == 0) {
this.isSkip = true;
} else {
this.setTimer();
}
}, 1000);
}
setView(status) {
// var request =
// {
// "ItgSurveyId": data.serviceId, "ItgNotificationMasterId": data.notificationMasterId, "ItgComments": this.note, "ItgQuestionResponses": [
// { "questionId": 1, "optionId": null, "starRating": parseInt(this.rate) },
// { "questionId": 2, "optionId": 4, "starRating": parseInt(this.satisfied) }
// ]
// };
this.authService.setViewAds({
"ItgNotificationMasterId": this.data.result.data.notificationMasterId,
"ItgAdvertisement": {
"advertisementId": this.data.result.data.advertisementId,
"acknowledgment": status
}
}, (
) => { }, this.ts.trPK('general', 'ok')).subscribe((result) => {
CommonService.SKIP = true;
this.cs.openHome();
})
}
}

@ -0,0 +1,72 @@
<ion-content padding class="survey-content">
<!-- <div class="skip-btn" (click)="skip()" *ngIf="isSkip ==true">{{ts.trPK('worklistMain','skip')}} </div>
<div class="seconds" *ngIf="isSkip ==false">{{setTime}}</div> -->
<ion-grid class="ion-no-padding grid-parent">
<ion-row>
<ion-text class="title-text">
{{ts.trPK('erm-channel','fedback-about-ux')}}
</ion-text>
</ion-row>
<ion-row>
<ion-col [size]="12">
<p class="subheading">1. {{ts.trPK('erm-channel','how-would-you-like')}} </p>
</ion-col>
</ion-row>
<ion-row>
<ion-col [size]="12">
<rating id="surveyRatingNew" [(ngModel)]="rate" readonly="false" size="default"></rating>
</ion-col>
</ion-row>
</ion-grid>
<ion-grid>
<ion-row>
<ion-col>
<p class="subheading">2. {{ts.trPK('erm-channel','how-would-you-satisfied')}} </p>
</ion-col>
</ion-row>
<ion-row class="faces-row">
<ion-col [ngClass]="{'select2' : satisfied=='1'}">
<img class="face" src="assets/icon/rate/poor.svg" (click)="select(1)">
</ion-col>
<ion-col [ngClass]="{'select2' : satisfied=='2'}">
<img class="face" src="assets/icon/rate/bad.svg" (click)="select(2)">
</ion-col>
<ion-col [ngClass]="{'select2' : satisfied=='3'}">
<img class="face" src="assets/icon/rate/normal.svg" (click)="select(3)">
</ion-col>
<ion-col [ngClass]="{'select2' : satisfied=='4'}">
<img class="face" src="assets/icon/rate/good.svg" (click)="select(4)">
</ion-col>
<ion-col [ngClass]="{'select2' : satisfied=='5'}">
<img class="face" src="assets/icon/rate/xcellent.svg" (click)="select(5)">
</ion-col>
</ion-row>
</ion-grid>
<ion-row>
<ion-col>
<p class="comments"> {{ts.trPK('erm-channel','give-comments')}} </p>
</ion-col>
</ion-row>
<ion-card class="doctor-card">
<ion-row class="input-field">
<ion-col [size]="12">
<ion-textarea rows="6" cols="20" [(ngModel)]="note" [placeholder]="ts.trPK('replacementRoll','enterNote')"></ion-textarea>
</ion-col>
</ion-row>
</ion-card>
</ion-content>
<ion-footer >
<div class="centerDiv">
<ion-button class="footer-button" ion-button (click)="saveSurvey()" [disabled]="!rate || (rate==1 && !note)">
{{'general,submit' | translate}} </ion-button>
</div>
</ion-footer>

@ -0,0 +1,55 @@
.survey-content{
--background:#f5f5f5;
}
.title-text{ font-size: 28px; font-weight: bold;text-align: center; margin-top:20%}
.survey-content{
margin-top:50px;
}
.subheading{
margin:30px 30px 0px 30px;
font-size: 20px;
font-weight: bold;}
.bottom-line{
height: 150px;
}
.doctor-card{
background: #fff;
margin: 10px 20px 10px 20px;
border-radius: 10px;
}
.comments{
margin-left: 20px;
margin-bottom: 0;
font-weight: bold;
}
.faces-row{
margin-left: 20px;
margin-right:20px;
}
.faces-row ion-col{
background: #fff;
text-align: center;
border-radius: 7px;
margin: 5px;
}
ion-footer .footer-button{
--background: #259CB8;
width: 80%;
background: #259CB8;
border-radius: 10px;
}
.skip-btn{
position: absolute;
background: black;
color: #fff;
margin: 10px;
right: 10px;
padding: 5px;
border-radius: 5px;
}
.select2{
border:1px solid #000;
}

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

@ -0,0 +1,63 @@
import { Component, OnInit } from '@angular/core';
import { NavController } from '@ionic/angular';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
@Component({
selector: 'app-survey',
templateUrl: './survey.component.html',
styleUrls: ['./survey.component.scss'],
})
export class SurveyComponent implements OnInit {
rate: any;
isSkip: boolean = false;
setTime: number = 5;
satisfied: any = '5';
note: any;
constructor(public ts: TranslatorService, public cs: CommonService, public nav: NavController, public authService: AuthenticationService) { }
ngOnInit() {
this.setTimer();
}
skip() {
this.nav.pop();
CommonService.SKIP = true;
}
setTimer() {
setTimeout(() => {
this.setTime--;
if (this.setTime == 0) {
this.isSkip = true;
} else {
this.setTimer();
}
}, 1000);
}
saveSurvey() {
var data = this.cs.sharedService.getSharedData(
AuthenticationService.SERVEY_DATA,
false
)
var request =
{
"ItgSurveyId": data.serviceId, "ItgNotificationMasterId": data.notificationMasterId, "ItgComments": this.note, "ItgQuestionResponses": [
{ "questionId": 1, "optionId": null, "starRating": parseInt(this.rate) },
{ "questionId": 2, "optionId": 4, "starRating": parseInt(this.satisfied) }
]
};
this.authService.saveAdsStatus(request, () => { }, this.ts.trPK('general', 'ok')).subscribe((result) => {
CommonService.SKIP = true;
this.cs.openHome();
})
}
select(rating) {
this.satisfied = rating;
}
}

@ -110,6 +110,7 @@ import { ChartModule } from 'primeng/chart';
import { GenericHeaderComponent } from './ui/generic-header/generic-header.component';
import { BackgroundGeolocation } from '@ionic-native/background-geolocation/ngx';
import { AttendanceOptionsComponent } from '../home/attendance-options/attendance-options.component';
import { CardCalendarComponent } from './ui/card-calendar/card-calendar.component';
@NgModule({
imports: [
@ -192,7 +193,8 @@ import { AttendanceOptionsComponent } from '../home/attendance-options/attendanc
DateInfoModalComponent,
Modal,
GenericHeaderComponent,
AttendanceOptionsComponent
AttendanceOptionsComponent,
CardCalendarComponent
],
exports: [
FabButtonComponent,
@ -262,7 +264,8 @@ import { AttendanceOptionsComponent } from '../home/attendance-options/attendanc
FileUploadModule,
Modal,
GenericHeaderComponent,
AttendanceOptionsComponent
AttendanceOptionsComponent,
CardCalendarComponent
],
providers: [
AttendScanService,

@ -0,0 +1,130 @@
import { Injectable } from "@angular/core";
import { BackgroundGeolocation } from '@ionic-native/background-geolocation/ngx';
import { CommonService } from "src/app/hmg-common/services/common/common.service";
import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service";
import { DevicePermissionsService } from 'src/app/hmg-common/services/device-permissions/device-permissions.service';
import { Geolocation } from '@ionic-native/geolocation/ngx';
import { Platform } from "@ionic/angular";
declare const cordova: any;
@Injectable({
providedIn: 'root'
})
export class HMGUtils {
constructor(
public backgroundGeolocation: BackgroundGeolocation,
public common: CommonService,
public ts: TranslatorService,
private geolocation: Geolocation,
public platform: Platform,
public devicePermissionsService:DevicePermissionsService,
) { }
async getCurrentLocation(callBack: Function) {
this.devicePermissionsService.requestLocationAutherization().then( async granted => {
if(granted == true) {
if (this.platform.is('android')) {
if ((await this.isHuaweiDevice())) {
this.getHMSLocation(callBack);
} else {
this.getGMSLocation(callBack);
}
} else {
this.getIOSLocation(callBack);
}
} else {
return false;
}
});
}
async isHuaweiDevice(): Promise<boolean> {
const result: any = await new Promise((resolve, reject) => {
cordova.plugins.CordovaHMSGMSCheckPlugin.isHmsAvailable(
"index.js",
(_res) => {
const hmsAvailable = _res === "true";
resolve(hmsAvailable);
},
(_err) => {
reject({ "status": false, "error": JSON.stringify(_err) });
this.common.presentAlert(this.ts.trPK('general', 'huawei-hms-gms-error'));
}
);
});
return result;
}
private getHMSLocation(callBack: Function) {
try {
cordova.plugins.CordovaHMSLocationPlugin.requestLocation(
"index.js",
(_res) => {
console.log("Huawei Location Success: [Stop Getting]");
cordova.plugins.CordovaHMSLocationPlugin.removeLocation("", (_res) => { }, (_err) => { });
const location = _res.split(',')
console.log(location);
if (location.length == 3) {
let mock = false;
const lat = Number(_res.split(',')[0]);
const long = Number(_res.split(',')[1]);
const mockValue = _res.split(',')[2];
// if (mockValue == 'true') {
// mock = true;
// } else {
// mock = false;
// }
callBack({"latitude":lat, "longitude":long, "isfake":mock})
} else {
this.common.presentAlert(this.ts.trPK('general', 'invalid-huawei-location'));
}
},
(_err) => {
console.log("Huawei Location [Getting Error]: " + JSON.stringify(_err));
this.common.presentAlert(this.ts.trPK('general', 'invalid-huawei-location'));
}
);
} catch (_err) {
console.log("Huawei Location Plugin [Error]: " + + JSON.stringify(_err));
this.common.presentAlert(this.ts.trPK('general', 'huawei-plugin-issue'));
}
}
private getGMSLocation(callBack: Function) {
this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {
if (resp && (resp.latitude && resp.longitude)) {
const isFakeLocation = resp.isFromMockProvider || resp.mockLocationsEnabled;
const lat = resp.latitude;
const long = resp.longitude;
callBack({"latitude":lat, "longitude":long, "isfake":isFakeLocation})
} else {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
}
}, (error) => {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
});
}
private getIOSLocation(callBack: Function) {
this.geolocation.getCurrentPosition({ maximumAge: 3000, timeout: 10000, enableHighAccuracy: true }).then(resp => {
if (resp && resp.coords.latitude && resp.coords.longitude) {
const lat = resp.coords.latitude;
const long = resp.coords.longitude;
callBack({"latitude":lat, "longitude":long, "isfake":false})
} else {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
}
}).catch(error => {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
});
}
}

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

@ -0,0 +1,35 @@
import { Injectable } from '@angular/core';
import { Request } from 'src/app/hmg-common/services/models/request';
import { Observable } from 'rxjs';
import { AuthenticationService } from '../authentication/authentication.service';
import { ConnectorService } from '../connector/connector.service';
import { AnnouncementRequest } from '../models/announcement-request';
@Injectable({
providedIn: 'root'
})
export class AnnouncementService {
public static getAnnouncemntList = 'Services/COCWS.svc/REST/GetAnnouncementDiscountsConfigData';
constructor(
public authService: AuthenticationService,
public con: ConnectorService,
) { }
getAnnouncementListService(pageNumber: number, id?: number, onError ?: any , oerrorLable ?: any) {
const request = new AnnouncementRequest();
this.authService.authenticateRequest(request);
request.EmployeeNumber = request.P_USER_NAME;
request.ItgPageNo = pageNumber;
request.ItgPageSize = 5;
request.ItgAwarenessID = 0;
request.ItgRowID = (id) ? Number(id) : 0;
return this.con.postNoLoad(
AnnouncementService.getAnnouncemntList,
request,
onError,
oerrorLable
);
}
}

@ -17,6 +17,8 @@ import { Device } from '@ionic-native/device/ngx';
import { BackgroundGeolocation } from '@ionic-native/background-geolocation/ngx';
import { Platform } from '@ionic/angular';
import { ModalController } from '@ionic/angular';
import { FirebaseX } from '@ionic-native/firebase-x/ngx';
import { HMGUtils } from 'src/app/hmg-common/hmg_utils';
@Injectable({
@ -32,6 +34,7 @@ export class AttendScanService {
userData: any = {};
public isFakeLocationUsed = false;
public isGpsRequired = false;
public collection = 'CS';
constructor(private device: Device,
private zbar: ZBar,
@ -46,12 +49,15 @@ export class AttendScanService {
public ts: TranslatorService,
public backgroundGeolocation: BackgroundGeolocation,
public platform: Platform,
public modalController: ModalController
public modalController: ModalController,
public firebasex: FirebaseX,
public hmgUtils: HMGUtils
) {
this.userData = this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA, false);
console.log(this.userData);
}
getDeviceLocation() {
public getDeviceLocation() {
this.isGpsRequired = true;
this.isFakeLocationUsed = false;
const isVirtual = this.device.isVirtual;
@ -60,43 +66,58 @@ export class AttendScanService {
alert('You are using virtual device');
return false;
}
this.permissions.requestLocationAutherization().then(granted => {
this.location = granted as boolean;
if (this.location) {
if (this.platform.is('android')) {
this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {
if (resp && (resp.latitude && resp.longitude)) {
if (resp.isFromMockProvider || resp.mockLocationsEnabled) {
this.isFakeLocationUsed = true;
}
this.lat = resp.latitude;
this.longt = resp.longitude;
this.attendance(true);
//////////// Getting location from hmg_utils //////////////////
try {
this.hmgUtils.getCurrentLocation((resp) => {
console.log(resp);
if (resp) {
this.isFakeLocationUsed = resp.isfake;
this.lat = resp.latitude;
this.longt = resp.longitude;
this.attendance(true);
}
});
} catch (e) {
this.common.presentAlert(this.ts.trPK('general', 'something-went-wrong'));
}
// this.permissions.requestLocationAutherization().then(granted => {
// this.location = granted as boolean;
// if (this.location) {
// if (this.platform.is('android')) {
// this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {
// if (resp && (resp.latitude && resp.longitude)) {
// if (resp.isFromMockProvider || resp.mockLocationsEnabled) {
// this.isFakeLocationUsed = true;
// }
// this.lat = resp.latitude;
// this.longt = resp.longitude;
// this.attendance(true);
} else {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
}
}, (error) => {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
});
} else {
this.geolocation.getCurrentPosition({maximumAge: 3000, timeout: 10000, enableHighAccuracy: true}).then(resp => {
if(resp && resp.coords.latitude && resp.coords.longitude) {
this.lat = resp.coords.latitude;
this.longt = resp.coords.longitude;
this.attendance(true);
} else {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
}
}).catch(error => {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
});
}
} else {
return false;
}
});
// } else {
// this.common.presentAlert(this.ts.trPK('home', 'position-error'));
// }
// }, (error) => {
// this.common.presentAlert(this.ts.trPK('home', 'position-error'));
// });
// } else {
// this.geolocation.getCurrentPosition({maximumAge: 3000, timeout: 10000, enableHighAccuracy: true}).then(resp => {
// if(resp && resp.coords.latitude && resp.coords.longitude) {
// this.lat = resp.coords.latitude;
// this.longt = resp.coords.longitude;
// this.attendance(true);
// } else {
// this.common.presentAlert(this.ts.trPK('home', 'position-error'));
// }
// }).catch(error => {
// this.common.presentAlert(this.ts.trPK('home', 'position-error'));
// });
// }
// } else {
// return false;
// }
// });
}
public attendance(isGPSValue: boolean) {
@ -149,8 +170,119 @@ export class AttendScanService {
});
}
public async checkFirestoreDocument(userID : string) {
try {
let result = {};
await this.firebasex.fetchDocumentInFirestoreCollection(userID, this.collection, (document: any) => {
console.log("Successfully Fetched the document with id =" + userID);
result = {
isDocumentAvailable: true,
document: document
};
this.common.sharedService.setSharedData(result, 'firebase-document');
this.common.stopLoading();
}, (error: any) => {
console.log(error);
result = {
isDocumentAvailable: false,
document: null
};
this.common.sharedService.setSharedData(result, 'firebase-document');
this.common.stopLoading();
})
} catch(error) {
console.log(error);
const result = {
isDocumentAvailable: false,
document: null
};
this.common.sharedService.setSharedData(result, 'firebase-document');
this.common.stopLoading();
}
}
public updateFirebaseDocument(resultObject: any) {
try {
let currentFirebaseDocument = this.common.sharedService.getSharedData('firebase-document', false);
let currentSwipeArray = currentFirebaseDocument.document.swipeData;
if (currentSwipeArray) {
currentSwipeArray.push(resultObject);
} else {
let swipeData = [];
swipeData.push(resultObject);
currentSwipeArray = swipeData;
}
const updatedDocument = {
swipeData: currentSwipeArray
};
console.log(updatedDocument);
this.firebasex.updateDocumentInFirestoreCollection(this.userData.EMPLOYEE_NUMBER, updatedDocument, this.collection, () => {
console.log("Successfully updated document with id = " + this.userData.EMPLOYEE_NUMBER);
const result = {
isDocumentAvailable: true,
document: updatedDocument
};
this.common.sharedService.setSharedData(result, 'firebase-document');
}, (error) => {
console.error("Error adding document: " + error);
});
} catch (error) {
console.log(error);
}
}
public checkDocumentAvailability(resultObject: any) {
const firestoreDocument = this.common.sharedService.getSharedData('firebase-document', false);
if (firestoreDocument) {
if (firestoreDocument.isDocumentAvailable) {
this.updateFirebaseDocument(resultObject);
} else {
this.createNewDocument(resultObject);
}
} else {
this.createNewDocument(resultObject);
}
}
public processFirebaseDocument(mode: string, result: any) {
try {
this.userData = this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA, false);
const resultObject = {
modeOfAttendance: mode,
messageStatus: result.MessageStatus,
transactionID: result.SWP_AuthenticateAndSwipeUserModel.TransactionID,
userID: result.SWP_AuthenticateAndSwipeUserModel.UserID,
pointID: result.SWP_AuthenticateAndSwipeUserModel.PointID,
branchDescription: result.SWP_AuthenticateAndSwipeUserModel.BranchDescription
}
this.checkDocumentAvailability(resultObject);
} catch (error) {
console.log(error);
}
}
public createNewDocument(resultObject: any) {
let swipeData = [];
swipeData.push(resultObject);
const newDocument = {
swipeData: swipeData
};
this.firebasex.setDocumentInFirestoreCollection(this.userData.EMPLOYEE_NUMBER, newDocument, this.collection, () => {
console.log("Successfully added document");
const result = {
isDocumentAvailable: true,
document: newDocument
};
this.common.sharedService.setSharedData(result, 'firebase-document');
}, (error) => {
console.error("Error adding document: "+error);
});
}
public swipeAttendance() {
const isPlatformValue = this.platform.is('ios') ? 'QR-IOS' : 'QR-ANDROID';
const enableFirestore = this.common.sharedService.getSharedData('enableFirestore', false);
const request: attendanceSwipeScannerRequest = new attendanceSwipeScannerRequest();
request.PointType = 1;
request.Latitude = this.lat;
@ -167,6 +299,9 @@ export class AttendScanService {
console.log('Error inside in swipe attendance');
})
.subscribe((result: Response) => {
if (enableFirestore) {
this.processFirebaseDocument(isPlatformValue, result);
}
if (this.common.validResponse(result)) {
console.log('response');
console.log(result);
@ -175,23 +310,4 @@ export class AttendScanService {
}
});
}
// public swipeAttendanceNFC (nfcSerialCode: any) {
// const request: attendanceSwipeScannerRequest = new attendanceSwipeScannerRequest();
// request.PointType = 2;
// request.Latitude = 0;
// request.Longitude = 0;
// request.QRValue = "";
// request.NFCValue = nfcSerialCode;
// request.UID = this.device.uuid;
// request.UserName = this.userData.EMPLOYEE_NUMBER;
// this.attendance_service.attendanceSwipeScanner(request, () => {
// console.log('Error inside in swipe attendance');
// }).subscribe((result: Response) => {
// if (this.common.validResponse(result)) {
// this.modalController.dismiss();
// }
// });
// }
}

@ -38,87 +38,96 @@ import { SendActivationByType } from 'src/app/authentication/models/sendActivati
})
export class AuthenticationService {
/* login methods */
public static loginURL = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
public static checkUserAuthURL = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
public static login = 'Services/ERP.svc/REST/MemberLogin';
public static activationCodeURL = 'Services/Authentication.svc/REST/CheckActivationCode';
public static getLoginInfoURL = 'Services/Authentication.svc/REST/GetMobileLoginInfo';
public static smsCheck='Services/ERP.svc/REST/CheckActivationCode';
public static smsCheckForget='Services/ERP.svc/REST/CheckPublicActivationCode';
public static smsSendCode='Services/ERP.svc/REST/SendPublicActivationCode';
public static sendActivationCodeByType = 'Services/ERP.svc/REST/Mohemm_SendActivationCodebyOTPNotificationType';
public static getMobileLoginInfo ='Services/ERP.svc/REST/Mohemm_GetMobileLoginInfo_NEW';//Mohemm_GetMobileLoginInfo
public static insertMobileLoginInfo ='Services/ERP.svc/REST/Mohemm_InsertMobileLoginInfo';
/* register methods */
public static checkPatientForRegisterationURL = 'Services/Authentication.svc/REST/CheckPatientForRegisteration';
public static sendSmsForRegisterURL = 'Services/Authentication.svc/REST/SendSMSForPatientRegisteration';
public static registerTempUserURL = 'Services/Authentication.svc/REST/RegisterTempPatientWithoutSMS';
public static sendSMSForgotFileNoURL = 'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber';
public static forgotFileIDURL = 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo';
public static user: AuthenticatedUser;
public static servicePrivilage : PrivilageModel[];
/*user checking methods */
public static userChecking = 'Services/ERP.svc/REST/Get_BasicUserInformation';
public static changePasswordForget ='Services/ERP.svc/REST/ChangePassword_Forget';
public static changePassword ='Services/ERP.svc/REST/ChangePassword_FromActiveSession';
public static expiredPassword = 'Services/ERP.svc/REST/ChangePassword_Expired';
public static checkAppVersion = 'Services/Utilities.svc/REST/CheckMobileAppVersion';
public static LOGIN_EVENT = 'user-login-event';
public static FAMILY_LOGIN_EVENT = 'family-login-event';
public static AUTHENTICATED_USER_KEY = 'save-authenticated-user';
public static LOGIN_DATA="logindata";
public static DEVICE_TOKEN = "device_token";
public static LAST_LOGIN = 'last-login';
public static IMEI_USER_DATA = "imei-user-data";
// private static user: AuthenticatedUser;
constructor(
public con: ConnectorService,
public cs: CommonService,
public ts: TranslatorService,
public nativeStorage: NativeStorage,
// public localNotifications: UserLocalNotificationService,
private events: Events,
private menu: MenuController,
public platform: Platform
) { }
public authenticateRequest(request: Request, automaticLogin = true): Request {
this.setPublicFields(request);
const user = this.getAuthenticatedUser();
if (user) {
request.P_SESSION_ID = user.P_SESSION_ID;
request.MobileNumber = user.EMPLOYEE_MOBILE_NUMBER;
request.LogInTokenID = user.LogInTokenID;
request.TokenID = user.TokenID;
request.P_USER_NAME = user.EMPLOYEE_NUMBER;
request.UserName = user.EMPLOYEE_NUMBER;
request.P_EMAIL_ADDRESS = user.EMPLOYEE_EMAIL_ADDRESS;
if (AuthenticationService.requireRelogin) {
this.sessionTimeOutDialog();
}
} else {
this.cs.userNeedToReLogin();
}
/*
else {
if (automaticLogin) {
this.cs.openUserLogin();
}
/* login methods */
public static loginURL = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
public static checkUserAuthURL = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
public static login = 'Services/ERP.svc/REST/MemberLogin';
public static activationCodeURL = 'Services/Authentication.svc/REST/CheckActivationCode';
public static getLoginInfoURL = 'Services/Authentication.svc/REST/GetMobileLoginInfo';
public static smsCheck = 'Services/ERP.svc/REST/CheckActivationCode';
public static smsCheckForget = 'Services/ERP.svc/REST/CheckPublicActivationCode';
public static smsSendCode = 'Services/ERP.svc/REST/SendPublicActivationCode';
public static sendActivationCodeByType = 'Services/ERP.svc/REST/Mohemm_SendActivationCodebyOTPNotificationType';
public static getMobileLoginInfo = 'Services/ERP.svc/REST/Mohemm_GetMobileLoginInfo_NEW';//Mohemm_GetMobileLoginInfo
public static insertMobileLoginInfo = 'Services/ERP.svc/REST/Mohemm_InsertMobileLoginInfo';
/* register methods */
public static checkPatientForRegisterationURL = 'Services/Authentication.svc/REST/CheckPatientForRegisteration';
public static sendSmsForRegisterURL = 'Services/Authentication.svc/REST/SendSMSForPatientRegisteration';
public static registerTempUserURL = 'Services/Authentication.svc/REST/RegisterTempPatientWithoutSMS';
public static sendSMSForgotFileNoURL = 'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber';
public static forgotFileIDURL = 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo';
public static user: AuthenticatedUser;
public static servicePrivilage: PrivilageModel[];
/*user checking methods */
public static userChecking = 'Services/ERP.svc/REST/Get_BasicUserInformation';
public static changePasswordForget = 'Services/ERP.svc/REST/ChangePassword_Forget';
public static changePassword = 'Services/ERP.svc/REST/ChangePassword_FromActiveSession';
public static expiredPassword = 'Services/ERP.svc/REST/ChangePassword_Expired';
public static checkAppVersion = 'Services/Utilities.svc/REST/CheckMobileAppVersion';
/* check survey or ads */
public static getITGPageNotification = 'Services/COCWS.svc/REST/Mohemm_ITG_GetPageNotification';
public static getITGPageNotificationDetails = 'Services/COCWS.svc/REST/Mohemm_ITG_GetPageNotificationDetails';
public static saveSurveyAds = 'Services/COCWS.svc/REST/Mohemm_ITG_Survey_Response';
public static setViewAdvertisement = 'Services/COCWS.svc/REST/Mohemm_ITG_UpdateAdvertisementAsViewed';
public static LOGIN_EVENT = 'user-login-event';
public static FAMILY_LOGIN_EVENT = 'family-login-event';
public static AUTHENTICATED_USER_KEY = 'save-authenticated-user';
public static LOGIN_DATA = "logindata";
public static DEVICE_TOKEN = "device_token";
public static LAST_LOGIN = 'last-login';
public static IMEI_USER_DATA = "imei-user-data";
public static SERVEY_DATA = "survey-data";
public static ADS_DATA = "ads-data";
// private static user: AuthenticatedUser;
constructor(
public con: ConnectorService,
public cs: CommonService,
public ts: TranslatorService,
public nativeStorage: NativeStorage,
// public localNotifications: UserLocalNotificationService,
private events: Events,
private menu: MenuController,
public platform: Platform
) { }
public authenticateRequest(request: Request, automaticLogin = true): Request {
this.setPublicFields(request);
const user = this.getAuthenticatedUser();
if (user) {
request.P_SESSION_ID = user.P_SESSION_ID;
request.MobileNumber = user.EMPLOYEE_MOBILE_NUMBER;
request.LogInTokenID = user.LogInTokenID;
request.TokenID = user.TokenID;
request.P_USER_NAME = user.EMPLOYEE_NUMBER;
request.UserName = user.EMPLOYEE_NUMBER;
request.P_EMAIL_ADDRESS = user.EMPLOYEE_EMAIL_ADDRESS;
if (AuthenticationService.requireRelogin) {
this.sessionTimeOutDialog();
}
} else {
this.cs.userNeedToReLogin();
}
/*
else {
if (automaticLogin) {
this.cs.openUserLogin();
}
*/
}
*/
return request;
}
@ -127,17 +136,17 @@ export class AuthenticationService {
const isIOS = this.platform.is('ios');
let mobileType = '';
if (isAndroid) {
mobileType = 'android';
mobileType = 'android';
} else if (isIOS) {
mobileType = 'ios';
}else{
mobileType = 'android';
mobileType = 'ios';
} else {
mobileType = 'android';
}
request.VersionID = 2.9;
request.Channel = 33;
request.VersionID = 3.1;
request.Channel = 31;
request.LanguageID = TranslatorService.getCurrentLanguageCode();
request.MobileType = mobileType;
return request;
}
public authenticateAndSetPersonalInformation(
@ -194,65 +203,65 @@ export class AuthenticationService {
public getPublicRequest(): Request {
const request = new Request();
this.setPublicFields(request);
return request;
}
public getPublicRequest(): Request {
const request = new Request();
this.setPublicFields(request);
return request;
}
public checkApplicationVersion(onError: any): Observable<CheckAppVersionResponse> {
const request = new Request();
this.setPublicFields(request);
return this.con.post(AuthenticationService.checkAppVersion, request, onError);
public checkApplicationVersion(onError: any): Observable<CheckAppVersionResponse> {
const request = new Request();
this.setPublicFields(request);
return this.con.post(AuthenticationService.checkAppVersion, request, onError, '', true);
}
public login(request: LoginRequest, onError: any, errorLabel: string): Observable<Response> {
this.setPublicFields(request);
request.P_APP_VERSION="HMG";
return this.con.post(AuthenticationService.login, request, onError, errorLabel);
public login(request: LoginRequest, onError: any, errorLabel: string): Observable<Response> {
this.setPublicFields(request);
request.P_APP_VERSION = "CS";
return this.con.post(AuthenticationService.login, request, onError, errorLabel);
}
}
public isAuthenticated(): boolean {
return AuthenticationService.user != null;
}
/**
* this fucntion load from user information if he logged in before
* and save user into memory and local storage
* disable notifications for previous user if new user logged in with different user
*
*
* info:
* 1- user stored in local storage without token
* @param result check activation code result
*/
public setAuthenticatedUser(
result: SMSCheckResponse
): Observable<boolean> {
return Observable.create(observer => {
this.loadAuthenticatedUser().subscribe(
(loadedUser: AuthenticatedUser) => {
AuthenticationService.requireRelogin = false;
this.startIdleMonitoring();
const user = this.updateAuthenticatedUser(result, loadedUser);
/* we store in hd without token but with token in memory*/
this.saveUserInStorage(user).subscribe((success: boolean) => {
AuthenticationService.user = user;
this.publishUserChangeEvent();
observer.next(true);
observer.complete();
});
}
);
});
}
public isAuthenticated(): boolean {
return AuthenticationService.user != null;
}
/**
* this fucntion load from user information if he logged in before
* and save user into memory and local storage
* disable notifications for previous user if new user logged in with different user
*
*
* info:
* 1- user stored in local storage without token
* @param result check activation code result
*/
public setAuthenticatedUser(
result: SMSCheckResponse
): Observable<boolean> {
return Observable.create(observer => {
this.loadAuthenticatedUser().subscribe(
(loadedUser: AuthenticatedUser) => {
AuthenticationService.requireRelogin = false;
this.startIdleMonitoring();
const user = this.updateAuthenticatedUser(result, loadedUser);
/* we store in hd without token but with token in memory*/
this.saveUserInStorage(user).subscribe((success: boolean) => {
AuthenticationService.user = user;
this.publishUserChangeEvent();
observer.next(true);
observer.complete();
});
}
);
});
}
public resetAuthenticatedUser(user: AuthenticatedUser) {
AuthenticationService.user = user;
AuthenticationService.requireRelogin = false;
@ -334,8 +343,8 @@ export class AuthenticationService {
user.P_SESSION_ID = result.P_SESSION_ID;
user.MobileNumber = result.EMPLOYEE_MOBILE_NUMBER;
user.TokenID = result.TokenID;
user.CompanyImageDescription=result.CompanyImageDescription;
user.CompanyImageURL=result.CompanyImageURL;
user.CompanyImageDescription = result.CompanyImageDescription;
user.CompanyImageURL = result.CompanyImageURL;
user.CompanyBadge = result.CompanyBadge;
user.CompanyMainCompany = result.CompanyMainCompany;
user.LogInTokenID = this.cs.sharedService.getSharedData(
@ -455,163 +464,163 @@ export class AuthenticationService {
return AuthenticationService.user;
}
*/
if(AuthenticationService.user){
return AuthenticationService.user;
}else{
this.cs.openLogin();
}
if (AuthenticationService.user) {
return AuthenticationService.user;
} else {
this.cs.openLogin();
}
}
public checkUserAuthentication(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
request.P_APP_VERSION="HMG";
return this.con.post(AuthenticationService.userChecking, request, onError, errorLabel);
}
public checkUserAuthentication(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
request.P_APP_VERSION = "CS";
return this.con.post(AuthenticationService.userChecking, request, onError, errorLabel);
}
public checkActivationCode(request: CheckActivationCodeRequest, onError: any, errorLabel: string)
: Observable<CheckActivationCodeResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
}
public checkActivationCode(request: CheckActivationCodeRequest, onError: any, errorLabel: string)
: Observable<CheckActivationCodeResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
}
public checkSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
: Observable<SMSCheckResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.smsCheck, request, onError, errorLabel);
}
public checkSMS(request: SMSCheckRequest, onError: any, errorLabel: string, fromSMS = false )
: Observable<SMSCheckResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.smsCheck, request, onError, errorLabel, fromSMS);
}
public checkForgetSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
: Observable<SMSCheckResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.smsCheckForget, request, onError, errorLabel);
}
public checkForgetSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
: Observable<SMSCheckResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.smsCheckForget, request, onError, errorLabel);
}
public sendPublicSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.smsSendCode, request, onError, errorLabel);
}
public sendPublicSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.smsSendCode, request, onError, errorLabel);
}
/*
client side:
id no , mobile no , zip code
*/
/*
client side:
id no , mobile no , zip code
*/
/*
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 checkRegisterationActivationCode(request: CheckRegisterationCodeRequest, onError: any, errorLabel: string)
: Observable<Response> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.activationCodeURL, 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 sendForgetPassword(request: ForgetPassword, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.smsSendCode, request, onError, errorLabel);
}
public checkRegisterationActivationCode(request: CheckRegisterationCodeRequest, onError: any, errorLabel: string)
: Observable<Response> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
}
public submitForgetPassword(request: ForgetPassword, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.changePasswordForget, request, onError, errorLabel);
}
public sendForgetPassword(request: ForgetPassword, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.smsSendCode, request, onError, errorLabel);
}
public submitChangePassword(request: ForgetPassword, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
this.authenticateRequest(request);
return this.con.post(AuthenticationService.changePassword, request, onError, errorLabel);
}
public submitForgetPassword(request: ForgetPassword, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.changePasswordForget, request, onError, errorLabel);
}
public submitExpiredPassword(request: ForgetPassword, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.expiredPassword, request, onError, errorLabel);
}
public submitChangePassword(request: ForgetPassword, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
this.authenticateRequest(request);
return this.con.post(AuthenticationService.changePassword, request, onError, errorLabel);
}
public sendSMSForForgotFileNumber(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
request.TokenID = '';
//request.SearchType = 2;
//request.isRegister = false;
return this.con.post(AuthenticationService.sendSMSForgotFileNoURL, request, onError, errorLabel);
}
public submitExpiredPassword(request: ForgetPassword, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.expiredPassword, request, onError, errorLabel);
}
public forgotFileIdActivation(request: CheckActivationCodeRequest, onError: any, errorLabel: string)
: Observable<ForgotFileIDResponse> {
this.setPublicFields(request);
request.TokenID = '';
request.SearchType = 2;
request.isRegister = false;
return this.con.post(AuthenticationService.forgotFileIDURL, request, onError, errorLabel);
}
public sendSMSForForgotFileNumber(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
request.TokenID = '';
//request.SearchType = 2;
//request.isRegister = false;
return this.con.post(AuthenticationService.sendSMSForgotFileNoURL, request, onError, errorLabel);
}
// tslint:disable-next-line: max-line-length
public insertMobileLoginInfo(request: GetLoginInfoRequest, onError: any, errorLabel: string, isPostNoLoad = false): Observable<GetLoginInfoResponse> {
this.authenticateRequest(request);
if (isPostNoLoad) {
return this.con.postNoLoad(AuthenticationService.insertMobileLoginInfo, request, onError, errorLabel);
} else {
return this.con.post(AuthenticationService.insertMobileLoginInfo, request, onError, errorLabel);
}
public forgotFileIdActivation(request: CheckActivationCodeRequest, onError: any, errorLabel: string)
: Observable<ForgotFileIDResponse> {
this.setPublicFields(request);
request.TokenID = '';
request.SearchType = 2;
request.isRegister = false;
return this.con.post(AuthenticationService.forgotFileIDURL, request, onError, errorLabel);
}
// tslint:disable-next-line: max-line-length
public insertMobileLoginInfo(request: GetLoginInfoRequest, onError: any, errorLabel: string, isPostNoLoad = false): Observable<GetLoginInfoResponse> {
this.authenticateRequest(request);
if (isPostNoLoad) {
return this.con.postNoLoad(AuthenticationService.insertMobileLoginInfo, request, onError, errorLabel);
} else {
return this.con.post(AuthenticationService.insertMobileLoginInfo, request, onError, errorLabel);
}
}
public isSAUDIIDValid(id: string): boolean {
if (!id) {
public isSAUDIIDValid(id: string): boolean {
if (!id) {
return false;
}
try {
id = id.toString();
id = id.trim();
const returnValue = Number(id);
let sum = 0;
if (returnValue > 0) {
const type = Number(id.charAt(0));
if (id.length !== 10) {
return false;
}
try {
id = id.toString();
id = id.trim();
const returnValue = Number(id);
let sum = 0;
if (returnValue > 0) {
const type = Number(id.charAt(0));
if (id.length !== 10) {
return false;
}
if (type !== 2 && type !== 1) {
return false;
}
for (let i = 0; i < 10; i++) {
if (i % 2 === 0) {
const a = id.charAt(i);
const x = Number(a) * 2;
let b = x.toString();
if (b.length === 1) {
b = "0" + b;
}
sum += Number(b.charAt(0)) + Number(b.charAt(1));
} else {
sum += Number(id.charAt(i));
}
if (type !== 2 && type !== 1) {
return false;
}
for (let i = 0; i < 10; i++) {
if (i % 2 === 0) {
const a = id.charAt(i);
const x = Number(a) * 2;
let b = x.toString();
if (b.length === 1) {
b = "0" + b;
}
return sum % 10 === 0;
sum += Number(b.charAt(0)) + Number(b.charAt(1));
} else {
sum += Number(id.charAt(i));
}
} catch (err) {}
return false;
}
return sum % 10 === 0;
}
} catch (err) { }
return false;
}
public checkUserHasEmailDialog(): Observable<void> {
return Observable.create(observer => {
if (this.isAuthenticatedUserHasRealEmail()) {
@ -662,26 +671,26 @@ export class AuthenticationService {
public getLastLoginInfo() {
let deviceToken = localStorage.getItem('deviceToken');
let deviceToken = localStorage.getItem('deviceToken');
const requestGetLoginInfo = {
DeviceType: this.cs.getDeviceType(),
DeviceToken: deviceToken
DeviceType: this.cs.getDeviceType(),
DeviceToken: deviceToken
};
this.getLoginInfo(requestGetLoginInfo, () => {}, this.ts.trPK('general', 'ok')).subscribe(res => {
this.getLoginInfo(requestGetLoginInfo, () => { }, this.ts.trPK('general', 'ok')).subscribe(res => {
if (this.cs.validResponse(res)) {
if (res.Mohemm_GetMobileLoginInfoList.length > 0) {
this.cs.sharedService.setSharedData(res.Mohemm_GetMobileLoginInfoList[0], AuthenticationService.IMEI_USER_DATA);
const user = true;
this.events.publish('user', user);
this.cs.openLogin();
} else {
const user = false;
this.events.publish('user', user);
this.cs.openLogin();
}
} else {}
if (res.Mohemm_GetMobileLoginInfoList.length > 0) {
this.cs.sharedService.setSharedData(res.Mohemm_GetMobileLoginInfoList[0], AuthenticationService.IMEI_USER_DATA);
const user = true;
this.events.publish('user', user);
this.cs.openLogin();
} else {
const user = false;
this.events.publish('user', user);
this.cs.openLogin();
}
} else { }
});
}
@ -727,6 +736,34 @@ export class AuthenticationService {
);
}
}
checkAds(request, onError, errorLabel) {
request = this.authenticateRequest(request);
request.EmployeeNumber = request.UserName;
return this.con.post(AuthenticationService.getITGPageNotification, request, onError, errorLabel);
}
adsDetails(request, onError, errorLabel) {
request = this.authenticateRequest(request);
request.EmployeeNumber = request.UserName;
return this.con.post(AuthenticationService.getITGPageNotificationDetails, request, onError, errorLabel);
}
saveAdsStatus(request, onError, errorLabel) {
request = this.authenticateRequest(request);
request.EmployeeNumber = request.UserName;
return this.con.post(AuthenticationService.saveSurveyAds, request, onError, errorLabel);
}
setViewAds(request, onError, errorLabel) {
request = this.authenticateRequest(request);
request.EmployeeNumber = request.UserName;
return this.con.post(AuthenticationService.setViewAdvertisement, request, onError, errorLabel);
}
//**************************//
public sendActivationCodeByType(
@ -744,4 +781,5 @@ export class AuthenticationService {
onError,
errorLabel
);
}}
}
}

@ -2,86 +2,92 @@ import { PatientUserModel } from './PatientUserModel';
import { TestBed } from '@angular/core/testing';
export class AuthenticatedUser extends PatientUserModel {
public static SHARED_DATA = 'user-info';
TokenID:string;
ACTUAL_TERMINATION_DATE: string;
ASSIGNMENT_END_DATE: string;
ASSIGNMENT_ID: number;
ASSIGNMENT_NUMBER: string;
ASSIGNMENT_START_DATE: string;
ASSIGNMENT_STATUS_TYPE_ID: number;
ASSIGNMENT_TYPE: string;
BUSINESS_GROUP_ID: number;
BUSINESS_GROUP_NAME: string;
CURRENT_EMPLOYEE_FLAG: string;
EMPLOYEE_DISPLAY_NAME: string;
EMPLOYEE_EMAIL_ADDRESS:string;
EMPLOYEE_IMAGE:string;
EMPLOYEE_MOBILE_NUMBER: string;
EMPLOYEE_NAME:string;
EMPLOYEE_NUMBER: string;
EMPLOYEE_WORK_NUMBER:string;
EMPLOYMENT_CATEGORY: string;
EMPLOYMENT_CATEGORY_MEANING: string;
FREQUENCY: string;
FREQUENCY_MEANING: string;
FROM_ROW_NUM: number;
GRADE_ID: number;
GRADE_NAME: string;
HIRE_DATE: string;
JOB_ID: number;
JOB_NAME: string;
LEDGER_ID: number;
LOCATION_ID: number;
LOCATION_NAME: string;
MANUAL_TIMECARD_FLAG: string;
MANUAL_TIMECARD_MEANING: string;
NATIONALITY_CODE: string;
NATIONALITY_MEANING: string;
NATIONAL_IDENTIFIER:string;
NORMAL_HOURS: string;
NO_OF_ROWS: number;
ORGANIZATION_ID: number;
ORGANIZATION_NAME: string;
PAYROLL_CODE: string;
PAYROLL_ID: number;
PAYROLL_NAME: string;
PERSON_ID: number;
PERSON_TYPE:string;
PERSON_TYPE_ID: number;
PER_INFORMATION_CATEGORY: string;
POSITION_ID: number;
POSITION_NAME: string;
PRIMARY_FLAG: string;
ROW_NUM:number;
SUPERVISOR_ASSIGNMENT_ID: string;
SUPERVISOR_DISPLAY_NAME: string;
SUPERVISOR_EMAIL_ADDRESS: string;
SUPERVISOR_ID: number;
SUPERVISOR_MOBILE_NUMBER: string;
SUPERVISOR_NAME: string;
SUPERVISOR_NUMBER: string;
SUPERVISOR_WORK_NUMBER: string;
SWIPES_EXEMPTED_FLAG: string;
SWIPES_EXEMPTED_MEANING: string;
SYSTEM_PERSON_TYPE: string;
TK_EMAIL_ADDRESS: string;
TK_EMPLOYEE_DISPLAY_NAME: string;
TK_EMPLOYEE_NAME: string;
TK_EMPLOYEE_NUMBER: string;
TK_PERSON_ID: number;
TO_ROW_NUM: number;
UNIT_NUMBER: string;
USER_STATUS: string;
P_SESSION_ID:number;
MobileNumber:string;
LogInTokenID:string;
CompanyImageDescription: string;
CompanyImageURL: string;
CompanyMainCompany: string;
CompanyBadge: string;
SERVICE_DAYS:Number;
SERVICE_MONTHS:Number;
SERVICE_YEARS:Number;
public static SHARED_DATA = 'user-info';
TokenID: string;
ACTUAL_TERMINATION_DATE: string;
ASSIGNMENT_END_DATE: string;
ASSIGNMENT_ID: number;
ASSIGNMENT_NUMBER: string;
ASSIGNMENT_START_DATE: string;
ASSIGNMENT_STATUS_TYPE_ID: number;
ASSIGNMENT_TYPE: string;
BUSINESS_GROUP_ID: number;
BUSINESS_GROUP_NAME: string;
CURRENT_EMPLOYEE_FLAG: string;
EMPLOYEE_DISPLAY_NAME: string;
EMPLOYEE_EMAIL_ADDRESS: string;
EMPLOYEE_IMAGE: string;
EMPLOYEE_MOBILE_NUMBER: string;
EMPLOYEE_NAME: string;
EMPLOYEE_NUMBER: string;
EMPLOYEE_WORK_NUMBER: string;
EMPLOYMENT_CATEGORY: string;
EMPLOYMENT_CATEGORY_MEANING: string;
FREQUENCY: string;
FREQUENCY_MEANING: string;
FROM_ROW_NUM: number;
GRADE_ID: number;
GRADE_NAME: string;
HIRE_DATE: string;
JOB_ID: number;
JOB_NAME: string;
LEDGER_ID: number;
LOCATION_ID: number;
LOCATION_NAME: string;
MANUAL_TIMECARD_FLAG: string;
MANUAL_TIMECARD_MEANING: string;
NATIONALITY_CODE: string;
NATIONALITY_MEANING: string;
NATIONAL_IDENTIFIER: string;
NORMAL_HOURS: string;
NO_OF_ROWS: number;
ORGANIZATION_ID: number;
ORGANIZATION_NAME: string;
PAYROLL_CODE: string;
PAYROLL_ID: number;
PAYROLL_NAME: string;
PERSON_ID: number;
PERSON_TYPE: string;
PERSON_TYPE_ID: number;
PER_INFORMATION_CATEGORY: string;
POSITION_ID: number;
POSITION_NAME: string;
PRIMARY_FLAG: string;
ROW_NUM: number;
SUPERVISOR_ASSIGNMENT_ID: string;
SUPERVISOR_DISPLAY_NAME: string;
SUPERVISOR_EMAIL_ADDRESS: string;
SUPERVISOR_ID: number;
SUPERVISOR_MOBILE_NUMBER: string;
SUPERVISOR_NAME: string;
SUPERVISOR_NUMBER: string;
SUPERVISOR_WORK_NUMBER: string;
SWIPES_EXEMPTED_FLAG: string;
SWIPES_EXEMPTED_MEANING: string;
SYSTEM_PERSON_TYPE: string;
TK_EMAIL_ADDRESS: string;
TK_EMPLOYEE_DISPLAY_NAME: string;
TK_EMPLOYEE_NAME: string;
TK_EMPLOYEE_NUMBER: string;
TK_PERSON_ID: number;
TO_ROW_NUM: number;
UNIT_NUMBER: string;
USER_STATUS: string;
P_SESSION_ID: number;
MobileNumber: string;
LogInTokenID: string;
CompanyImageDescription: string;
CompanyImageURL: string;
CompanyMainCompany: string;
CompanyBadge: string;
SERVICE_DAYS: Number;
SERVICE_MONTHS: Number;
SERVICE_YEARS: Number;
public BusinessCardQR: string;
public MobileNumberWithZipCode: SVGStringList;
public JOB_NAME_Ar: string;
public JOB_NAME_En: string;
public EMPLOYEE_NAME_Ar: string;
public EMPLOYEE_NAME_En: string;
}

@ -21,5 +21,9 @@ export class SMSCheckResponse extends Response {
public EMPLOYEE_NAME:string;
public Mohemm_Wifi_SSID:string;
public Mohemm_Wifi_Password:string;
public ForgetPasswordTokenID: string;
public BC_Domain: string;
public BC_Logo: string;
public BusinessCardPrivilege: boolean;
}

@ -7,7 +7,7 @@ import {
Platform,
MenuController
} from '@ionic/angular';
import { Router } from '@angular/router';
import { Router, NavigationExtras } from '@angular/router';
import { TranslatorService } from '../translator/translator.service';
import { AlertControllerService } from '../../ui/alert/alert-controller.service';
//import { Response } from "../models/response";
@ -35,7 +35,7 @@ export class CommonService {
public static MOHEMM_WIFI_SSID = "";
public static MOHEMM_WIFI_PASSWORD = "";
public static SKIP = false;
public static months_en_long = [
'January',
'February',
@ -81,8 +81,8 @@ export class CommonService {
private progressLoaders: any[] = [];
private loadingProgress: any;
public updateImage:boolean=false;
public setUpdateImg:any;
public updateImage: boolean = false;
public setUpdateImg: any;
DT: any;
activeType: any;
constructor(
@ -105,7 +105,7 @@ export class CommonService {
public diagnostic: Diagnostic,
public iab: InAppBrowser,
private menu: MenuController,
) {}
) { }
public back() {
// this.nav.pop();
@ -118,61 +118,61 @@ export class CommonService {
public getMonthName(value: number): string {
switch (value) {
case 1:
return 'January';
case 2:
return 'February';
case 3:
return 'March';
case 4:
return 'April';
case 5:
return 'May';
case 6:
return 'June';
case 7:
return 'July';
case 8:
return 'August';
case 9:
return 'September';
case 10:
return 'October';
case 11:
return 'November';
case 12:
return 'December';
case 1:
return 'January';
case 2:
return 'February';
case 3:
return 'March';
case 4:
return 'April';
case 5:
return 'May';
case 6:
return 'June';
case 7:
return 'July';
case 8:
return 'August';
case 9:
return 'September';
case 10:
return 'October';
case 11:
return 'November';
case 12:
return 'December';
}
}
}
public getMonthNameAr(value: number): string {
public getMonthNameAr(value: number): string {
switch (value) {
case 1:
return 'يناير';
case 2:
return ' فبراير';
case 3:
return 'مارس';
case 4:
return 'أبريل';
case 5:
return 'مايو';
case 6:
return 'يونيو';
case 7:
return 'يوليو';
case 8:
return 'أغسطس';
case 9:
return 'سبتمبر';
case 10:
return ' اكتوبر';
case 11:
return ' نوفمبر';
case 12:
return 'ديسمبر';
case 1:
return 'يناير';
case 2:
return ' فبراير';
case 3:
return 'مارس';
case 4:
return 'أبريل';
case 5:
return 'مايو';
case 6:
return 'يونيو';
case 7:
return 'يوليو';
case 8:
return 'أغسطس';
case 9:
return 'سبتمبر';
case 10:
return ' اكتوبر';
case 11:
return ' نوفمبر';
case 12:
return 'ديسمبر';
}
}
}
public round(value: number, decimal: number): string {
const valueStr = value.toString();
@ -202,6 +202,7 @@ public getMonthNameAr(value: number): string {
public toastPK(page: string, key: string) {
this.toast(this.ts.trPK(page, key));
}
async toast(message: string) {
const toast = await this.toastController.create({
message: message,
@ -213,6 +214,37 @@ public getMonthNameAr(value: number): string {
toast.present();
}
public redToastPK(page: string, key: string) {
this.redToast(this.ts.trPK(page, key));
}
public greenToastPK(page: string, key: string) {
this.greenToast(this.ts.trPK(page, key));
}
async redToast(message: string) {
const toast = await this.toastController.create({
message: message,
showCloseButton: true,
position: 'middle',
duration: 2000,
color: 'danger',
closeButtonText: this.ts.trPK('general', 'close')
});
toast.present();
}
async greenToast(message: string) {
const toast = await this.toastController.create({
message: message,
showCloseButton: true,
position: 'middle',
duration: 2000,
color: 'success',
closeButtonText: this.ts.trPK('general', 'close')
});
toast.present();
}
private loaderIsActive = false;
async startLoadingOld() {
this.stopLoading();
@ -290,7 +322,7 @@ public getMonthNameAr(value: number): string {
public confirmNotAllowedDialog() {
this.openHome();
this.alertDialog(
() => {},
() => { },
this.ts.trPK('general', 'ok'),
this.ts.trPK('general', 'info'),
this.ts.trPK('general', 'not-allowed')
@ -436,7 +468,7 @@ public getMonthNameAr(value: number): string {
message: message,
buttons: [
{
text:this.ts.trPK('general', 'ok'),
text: this.ts.trPK('general', 'ok'),
handler: () => {
if (onAccept) {
onAccept();
@ -587,8 +619,8 @@ public getMonthNameAr(value: number): string {
public getDeviceType(): string {
if (this.platform.is('mobile')) {
// return "Mobile " + (this.platform.is("ios") ? "Iphone" : "android");
return (this.platform.is('ios') ? 'Iphone' : 'android');
// return "Mobile " + (this.platform.is("ios") ? "Iphone" : "android");
return (this.platform.is('ios') ? 'Iphone' : 'android');
} else {
return 'Desktop';
@ -620,7 +652,7 @@ public getMonthNameAr(value: number): string {
private openBrowserHtml(url, onExit?, onFaild?, onSuccess?) {
const browser = window.open(url, '_blank', 'location=no');
browser.addEventListener('loadstart', () => {});
browser.addEventListener('loadstart', () => { });
browser.addEventListener('loaderror', () => {
if (onFaild) {
@ -696,7 +728,7 @@ public getMonthNameAr(value: number): string {
public openLocation(lat: number, lng: number) {
this.platform.ready().then(() => {
this.launchNavigation.navigate([lat, lng]).then(
() => {},
() => { },
err => {
// this.failedToOpenMap();
window.open('https://maps.google.com/?q=' + lat + ',' + lng);
@ -896,7 +928,7 @@ public getMonthNameAr(value: number): string {
return targetCode >= minDigit && targetCode <= maxDigit;
}
public enterPage() {}
public enterPage() { }
private smsAlertDialog = null;
public presentSMSPasswordDialog(
@ -928,7 +960,7 @@ public getMonthNameAr(value: number): string {
text: this.ts.trPK('general', 'cancel'),
role: 'cancel',
cssClass: 'cancel-button',
handler: () => {}
handler: () => { }
},
{
text: this.ts.trPK('general', 'ok'),
@ -1075,10 +1107,10 @@ public getMonthNameAr(value: number): string {
/*
open calls
*/
public openAttenTrackingpage(){
public openAttenTrackingpage() {
this.nav.navigateForward(['/attendance-tracking/home']);
}
public openAttendanceOptionsComponent(){
public openAttendanceOptionsComponent() {
this.nav.navigateForward(['/home/attendance-option']);
}
public openEitListPage() {
@ -1090,6 +1122,9 @@ public getMonthNameAr(value: number): string {
public openConfirmEitPage() {
this.nav.navigateForward(['/eit/confirm-add-eit']);
}
public openConfirmBasicDetailsPage() {
this.nav.navigateForward(['/profile/confirm-basic']);
}
public openHome() {
this.nav.navigateRoot(['/home']);
}
@ -1099,12 +1134,31 @@ public getMonthNameAr(value: number): string {
public openChangePassword() {
this.nav.navigateForward(['/authentication/changepassowrd']);
}
public openProfile() {
this.nav.navigateForward(['/profile/home']);
// public openProfile() {
// this.nav.navigateForward(['/profile/home']);
// }
public openProfile(target: any) {
const navigationExtras: NavigationExtras = {
queryParams: {
targetValue: target
}
};
this.nav.navigateForward(['/profile/home'], navigationExtras);
}
public openEditProfile() {
this.nav.navigateForward(['/profile/editprofile']);
}
public openAddBasicDetails(target: string) {
const navigationExtras: NavigationExtras = {
queryParams: {
targetValue: target
}
};
this.nav.navigateForward(['/profile/addBasicDetails'], navigationExtras);
}
public openAccuralPage() {
this.nav.navigateForward(['/accrual-balances/home']);
}
@ -1118,14 +1172,28 @@ public getMonthNameAr(value: number): string {
public openMyTeamDetailPage() {
this.nav.navigateForward(['/my-team/details']);
}
public openMyRequestPage() {
this.nav.navigateForward(['/mowadhafi/my-request']);
}
public openHRRequestPage() {
this.nav.navigateForward(['/mowadhafi/hr-request']);
}
public openHRRequestFormPage() {
this.nav.navigateForward(['/mowadhafi/hr-request-form']);
}
public openRequestDetailsPage() {
this.nav.navigateForward(['/mowadhafi/request-details']);
}
public openPage(link: string) {
this.nav.navigateForward([link]);
}
public static myTeamDetailUrl =['/my-team/details','/my-team/details-2']
public static myTeamDetailUrl = ['/my-team/details', '/my-team/details-2']
public openMyTeamDetails() {
this.alternateNavigate(CommonService.myTeamDetailUrl,'teamDetail-open',true);
// this.nav.navigateForward(["/my-team/details"]);
this.alternateNavigate(CommonService.myTeamDetailUrl, 'teamDetail-open', true);
// this.nav.navigateForward(["/my-team/details"]);
}
public openAbsencePage() {
this.nav.navigateForward(['/absence/home']);
@ -1176,9 +1244,8 @@ public getMonthNameAr(value: number): string {
this.nav.navigateForward(['/notification/item-history-PO']);
}
public openMOItemHistoryPage(){
public openMOItemHistoryPage() {
this.nav.navigateForward(['/notification/item-history-MO']);
}
public openQutationAnalysisPage() {
this.nav.navigateForward(['/notification/qutation-analysis-PO']);
@ -1186,6 +1253,9 @@ public getMonthNameAr(value: number): string {
public openWorklistMainMRPage() {
this.nav.navigateForward(['/notification/worklist-main-MR']);
}
public openWorklistMainICPage() {
this.nav.navigateForward(['/notification/item-creation-IC']);
}
public openWorklistITGPage() {
this.nav.navigateForward(['/notification/worklist-main-ITG']);
}
@ -1217,15 +1287,24 @@ public getMonthNameAr(value: number): string {
public openEditprofile() {
this.nav.navigateForward(['/profile/editProfile']);
}
public openAddAddress() {
this.nav.navigateForward(['/profile/add-address']);
}
public openConfirmAddAddress() {
this.nav.navigateForward(['/profile/confirm-add-address']);
}
public openPerformanceevaluation() {
this.nav.navigateForward(['/profile/performanceevaluation']);
}
public eitUpdate() {
this.nav.navigateForward(['/eit/eit-update-list']);
}
public openAnnouncement() {
this.nav.navigateForward(['/backend-integrations/announcement']);
}
public navigatePage(path) {
this.nav.navigateForward([path]);
}
@ -1252,7 +1331,7 @@ public getMonthNameAr(value: number): string {
this.nav.navigateBack([url]);
}
private alternateNavigate(paths: string[], key: string, root = false) {
let url: string;
if (localStorage.getItem(key) === 'yes') {
@ -1373,7 +1452,7 @@ public getMonthNameAr(value: number): string {
public formatDate(date) {
let FormatedDate;
console.log(date);
if (date) {
date = date.slice(0, 10);
FormatedDate = date.replace(/-/g, '/');
@ -1398,34 +1477,34 @@ public getMonthNameAr(value: number): string {
return FormatedDate;
}
public setUpdateImage (image,status?){
public setUpdateImage(image, status?) {
console.log('setUpdateImage');
this.setUpdateImg=image;
this.updateImage=status;
this.setUpdateImg = image;
this.updateImage = status;
}
public getUpdateImage(){
public getUpdateImage() {
console.log('getUpdateImage');
const objImg={
img: this.setUpdateImg,
const objImg = {
img: this.setUpdateImg,
status: this.updateImage
}
return objImg;
}
setDeviceToken(deviceToken) {
this.DT = deviceToken;
}
setDeviceToken(deviceToken){
this.DT=deviceToken;
}
getDeviceToken(){
return this.DT;
}
getDeviceToken() {
return this.DT;
}
setActiveTypeLogin(activeType){
this.activeType=activeType;
}
setActiveTypeLogin(activeType) {
this.activeType = activeType;
}
getActiveTypeLogin(){
return this.activeType;
}
getActiveTypeLogin() {
return this.activeType;
}
}

@ -27,19 +27,20 @@ export class ConnectorService {
public static retryTimes = 0;
public static timeOut = 120 * 1000;
// public static host = 'https://uat.hmgwebservices.com/';
// public static host = 'https://uat.hmgwebservices.com/';
public static host = 'https://hmgwebservices.com/';
constructor(public httpClient: HttpClient,
public cs: CommonService,
private events: Events,
public ts: TranslatorService) {}
public cs: CommonService,
private events: Events,
public ts: TranslatorService) { }
public post(
service: string,
data: any,
onError: any,
errorLabel?: string
errorLabel?: string,
fromSMS = false
): Observable<any> {
this.cs.startLoading();
return this.httpClient
@ -52,7 +53,7 @@ export class ConnectorService {
timeout(ConnectorService.timeOut),
retry(ConnectorService.retryTimes),
tap(
res => this.handleResponse(res, onError, errorLabel),
res => this.handleResponse(res, onError, errorLabel, false, fromSMS),
error => this.handleError(error, onError, errorLabel)
)
);
@ -98,18 +99,18 @@ export class ConnectorService {
public postNoLoad(service: string, data: any, onError: any, errorLabel?: string): Observable<any> {
return this.httpClient
.post<any>(
.post<any>(
ConnectorService.host + service,
data,
ConnectorService.httpOptions)
.pipe(
timeout(ConnectorService.timeOut),
retry(ConnectorService.retryTimes),
tap((res) => {
this.handleResponse(res, onError, errorLabel, true);
}, (error) => {
this.handleError(error, onError, errorLabel, true);
}));
.pipe(
timeout(ConnectorService.timeOut),
retry(ConnectorService.retryTimes),
tap((res) => {
this.handleResponse(res, onError, errorLabel, true);
}, (error) => {
this.handleError(error, onError, errorLabel, true);
}));
}
// absolute url connection
@ -198,49 +199,55 @@ export class ConnectorService {
let deviceToken = localStorage.getItem('deviceToken');
const requestGetLoginInfo = {
DeviceType: this.cs.getDeviceType(),
DeviceToken: deviceToken
DeviceType: this.cs.getDeviceType(),
DeviceToken: deviceToken
};
this.getLoginInfo(requestGetLoginInfo, () => {}, this.ts.trPK('general', 'ok')).subscribe(res => {
this.getLoginInfo(requestGetLoginInfo, () => { }, this.ts.trPK('general', 'ok')).subscribe(res => {
if (this.cs.validResponse(res)) {
if (res.Mohemm_GetMobileLoginInfoList.length > 0) {
this.cs.sharedService.setSharedData(res.Mohemm_GetMobileLoginInfoList[0], 'imei-user-data');
const user = true;
this.events.publish('user', user);
this.cs.openLogin();
} else {
const user = false;
this.events.publish('user', user);
this.cs.openLogin();
}
} else {}
if (res.Mohemm_GetMobileLoginInfoList.length > 0) {
this.cs.sharedService.setSharedData(res.Mohemm_GetMobileLoginInfoList[0], 'imei-user-data');
const user = true;
this.events.publish('user', user);
this.cs.openLogin();
} else {
const user = false;
this.events.publish('user', user);
this.cs.openLogin();
}
} else { }
});
}
public handleResponse(result: Response, onError: any, errorLabel: string, isPostNoLoad = false) {
public handleResponse(result: Response, onError: any, errorLabel: string, isPostNoLoad = false, fromSMS = false) {
console.log('fromSMSValue ' + fromSMS)
if (!isPostNoLoad) {
this.cs.stopLoading();
}
if (!this.cs.validResponse(result)) {
if (result.IsAuthenticated === false) {
this.cs.stopLoading();
this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => {
this.cs.sharedService.clearAll();
// this.cs.openLogin();
this.getLastLoginInfo();
});
if (!fromSMS) {
this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => {
this.cs.sharedService.clearAll();
this.getLastLoginInfo();
});
}
return false;
} else if (result.ErrorType === 2 || result.ErrorType === 4) {
// console.log("error expired");
this.cs.stopLoading();
this.cs.stopLoading();
} else {
this.cs.stopLoading();
this.cs.showErrorMessageDialog(
onError,
errorLabel,
result.ErrorEndUserMessage
);
if (!fromSMS) {
this.cs.showErrorMessageDialog(
onError,
errorLabel,
result.ErrorEndUserMessage
);
} else {
console.log('its an error from sms')
}
//add flag if user not auth
}
@ -257,7 +264,7 @@ export class ConnectorService {
this.cs.stopLoading();
this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => {
console.log("presentAcceptDialog");
this.cs.sharedService.clearAll();
this.cs.sharedService.clearAll();
// this.cs.openLogin();
this.getLastLoginInfo();
});

@ -4,7 +4,7 @@ import { CommonService } from 'src/app/hmg-common/services/common/common.service
import { Observable } from 'rxjs';
import { SubjectSubscriber } from 'rxjs/internal/Subject';
import { TranslatorService } from '../translator/translator.service';
import { promise } from 'protractor';
import { NativeStorage } from '@ionic-native/native-storage/ngx';
import { OpenNativeSettings } from '@ionic-native/open-native-settings/ngx';
@ -42,17 +42,17 @@ export class DevicePermissionsService {
private requestCamera(observer: any) {
this.hasCameraPermission().then((isAvailable) => {
if (isAvailable) {
// this.requestMicophonePermission(observer);
this.observerDone(observer, true);
// this.requestMicophonePermission(observer);
this.observerDone(observer, true);
} else {
this.diagnostic.requestCameraAuthorization(true).then((value) => {
// tslint:disable-next-line: triple-equals
if (value == DevicePermissionsService.GRANTED) {
// this.requestMicophonePermission(observer);
this.observerDone(observer, true);
// tslint:disable-next-line: triple-equals
// tslint:disable-next-line: triple-equals
} else if (value == DevicePermissionsService.DENIED_ALWAYS) {
// this.setAlwaysDenied(DevicePermissionsService.CAMERA_MIC, true);
// this.setAlwaysDenied(DevicePermissionsService.CAMERA_MIC, true);
this.observerDone(observer, false);
} else {
this.observerDone(observer, false);
@ -84,7 +84,7 @@ export class DevicePermissionsService {
// tslint:disable-next-line: triple-equals
if (value == DevicePermissionsService.GRANTED) {
this.observerDone(observer, true);
// tslint:disable-next-line: triple-equals
// tslint:disable-next-line: triple-equals
} else if (value == DevicePermissionsService.DENIED_ALWAYS) {
this.setAlwaysDenied(DevicePermissionsService.CAMERA_MIC, true);
this.observerDone(observer, false);
@ -113,15 +113,15 @@ export class DevicePermissionsService {
observer.complete();
}
public async hasCameraPermission(): Promise<boolean> {
public async hasCameraPermission(): Promise<boolean> {
return this.diagnostic.isCameraAuthorized(true);
}
public async hasCameraAndMicPermissions(): Promise<boolean> {
public async hasCameraAndMicPermissions(): Promise<boolean> {
const camera = await this.hasCameraPermission();
// let mic = await this.diagnostic.isMicrophoneAuthorized();
if (camera) {
// await this.setAlwaysDenied(DevicePermissionsService.CAMERA_MIC, false);
// await this.setAlwaysDenied(DevicePermissionsService.CAMERA_MIC, false);
return true;
} else {
return false;
@ -218,8 +218,8 @@ export class DevicePermissionsService {
// }
// } else {
if (await this.permissionRequestDialog(message)) {
return this.requestCameraPermission().toPromise();
}
return this.requestCameraPermission().toPromise();
}
// }
return false;
}
@ -229,7 +229,7 @@ export class DevicePermissionsService {
/* geolocation permission */
public async requestLocationAutherization() {
if ( await this.isLocationEnabled()) {
if (await this.isLocationEnabled()) {
if (await this.hasLocationPermissions()) {
return true;
} else {
@ -240,8 +240,8 @@ export class DevicePermissionsService {
// }
// } else {
if (await this.permissionRequestDialog(message)) {
return this.requestLocationPermission();
}
return this.requestLocationPermission();
}
// }
return false;
}
@ -259,7 +259,7 @@ export class DevicePermissionsService {
return isAvailable;
}
public async hasLocationPermissions(): Promise<boolean> {
public async hasLocationPermissions(): Promise<boolean> {
const location = await this.diagnostic.isLocationAvailable();
if (location) {
await this.setAlwaysDenied(DevicePermissionsService.LOCATION, false);
@ -289,7 +289,7 @@ export class DevicePermissionsService {
// tslint:disable-next-line: triple-equals
if (value == DevicePermissionsService.GRANTED) {
return true;
// tslint:disable-next-line: triple-equals
// tslint:disable-next-line: triple-equals
} else if (value == DevicePermissionsService.DENIED_ALWAYS) {
this.setAlwaysDenied(DevicePermissionsService.LOCATION, true);
}

@ -0,0 +1,12 @@
import { Request } from 'src/app/hmg-common/services/models/request';
export class AnnouncementRequest extends Request {
public TokenID: string;
public EmployeeNumber: string;
public ItgPageNo: number;
public ItgPageSize: number;
public ItgAwarenessID: number;
public ItgRowID: number;
}

@ -38,7 +38,7 @@
margin-right: 6%;
width: 88%;
text-align: center;
font-size: 0.38cm;
font-size: 0.3cm;
color: var(--ion-color-secondary);
}

@ -0,0 +1,6 @@
<div class="main-container" [ngStyle]="active === true ? {'color': color} : {}">
<div class="main-container-radius" [ngStyle]="active === true ? {'color': '#ffffff'} : {'color': color}"></div>
<span class="text-span" [ngStyle]="active === true ? {'color': '#269DB8'} : {}">{{text}}</span>
</div>

@ -0,0 +1,21 @@
.main-container{
width: 47px;
position: relative;
margin-left: 9px;
}
.main-container-radius{
position: absolute;
width: 30px;
}
.number-span{
display: block;
}
.text-span{
font-size: 13px;
font-family: var(--fontFamilyPoppins-SemiBold, inherit);
}

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

@ -0,0 +1,18 @@
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-card-calendar',
templateUrl: './card-calendar.component.html',
styleUrls: ['./card-calendar.component.scss'],
})
export class CardCalendarComponent implements OnInit {
@Input() text: string;
@Input() active: boolean;
@Input() color: string;
constructor() { }
ngOnInit() {}
}

@ -9,12 +9,13 @@
</ion-col>
<ion-col [size]="9" style="padding: 8px 5px 0px;margin-top: 14px;">
<div>
<span class="employee-name" (click)="getDetails()">
<span [ngClass]=" direction == 'en'? 'employee-name' : 'employee-name-ar'" (click)="getDetails()">
<h2 class="name">{{name}}</h2>
<span class="title">{{title}}</span>
</span>
<a [ngClass]="employeePhoneNumber == '' ? 'disable-phone image-container' : 'image-container'" href="tel:{{employeePhoneNumber}}">
<img src="../assets/imgs/green_call_icon.png" >
<!-- <img src="../assets/imgs/green_call_icon.png" > -->
<img src="../assets/imgs/call.svg" >
</a>
</div>
<!-- <div class="swipe-information">

@ -1,16 +1,26 @@
.team-member-container{
// background: white;
// border-radius: 100px 20px 20px 100px;
// margin-top: 15px;
// font-family: WorkSans-Regular;
// border: 1px solid #ccc;
// border-radius: 15px;
// padding-bottom: 8px;
background: white;
border-radius: 100px 20px 20px 100px;
margin-top: 15px;
/* margin-top: 2px; */
font-family: WorkSans-Regular;
border: 1px solid #ccc;
border-radius: 15px;
padding-bottom: 8px;
margin-bottom: 7px;
}
.user-image-container{
position: relative;
width: 70px;
height: 70px;
display: block;
margin: 0 auto;
// .user-image-container{
// position: relative;
// width: 70px;
// height: 70px;
// display: block;
// margin: 0 auto;
// &:before{
// position: absolute;
// content: "";
@ -26,19 +36,24 @@
// &.present:before{
// background-color: green !important;
// }
}
// }
.user-image{
overflow: hidden;
position: relative;
display: block;
width: 100%;
height: 100%;
border-radius: 80px;
border: 1px solid #ccc;
margin: 0px auto 6px;
// overflow: hidden;
// position: relative;
// display: block;
// width: 100%;
// height: 100%;
// border-radius: 80px;
// border: 1px solid #ccc;
// margin: 0px auto 6px;
img {
width: 100%;
max-height: 100%;
// width: 100%;
// max-height: 100%;
width: 74%;
max-height: 74%;
margin-top: 4px;
margin-left: 6px;
}
}
@ -46,22 +61,109 @@
display: inline-block;
width: 80%;
.name{
font-size: 16px;
color: black;
margin: 0;
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
// font-size: 16px;
// color: black;
// // margin: 0;
// width: 100%;
// text-overflow: ellipsis;
// white-space: nowrap;
// overflow: hidden;
// margin-left: -10px;
// margin-top: -5px;
// font-family: 'WorkSans-Bold';
font-size: 16px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
margin-left: -10px;
margin-top: -5px;
text-align: left;
font-family: var(--fontFamilyPoppins-SemiBold, inherit);
line-height: 25px;
letter-spacing: -0.64px;
color: #2B353E;
opacity: 1;
}
.title{
// font-size: 13px;
// color: #888;
// width: 100%;
// text-overflow: ellipsis;
// white-space: nowrap;
// overflow: hidden;
// display: block;
// margin-left: -10px;
// margin-top: -6px;
// color: black;
font-family: var(--fontFamilyPoppins-SemiBold, inherit);
line-height: 12px;
letter-spacing: -0.56px;
color: #575757;
opacity: 1;
font-size: 14px;
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
display: block;
margin-left: -10px;
margin-top: -10px;
}
}
.employee-name-ar{
display: inline-block;
width: 80%;
.name{
// font-size: 16px;
// color: black;
// // margin: 0;
// width: 100%;
// text-overflow: ellipsis;
// white-space: nowrap;
// overflow: hidden;
// margin-left: -10px;
// margin-top: -5px;
// font-family: 'WorkSans-Bold';
font-size: 16px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
margin-left: -10px;
margin-top: -5px;
text-align: right;
font-family: var(--fontFamilyPoppins-SemiBold, inherit);
line-height: 25px;
letter-spacing: -0.64px;
color: #2B353E;
opacity: 1;
}
.title{
font-size: 13px;
color: #888;
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
display: block;
// font-size: 13px;
// color: #888;
// width: 100%;
// text-overflow: ellipsis;
// white-space: nowrap;
// overflow: hidden;
// display: block;
// margin-left: -10px;
// margin-top: -6px;
// color: black;
font-family: var(--fontFamilyPoppins-SemiBold, inherit);
line-height: 12px;
letter-spacing: -0.56px;
color: #575757;
opacity: 1;
font-size: 14px;
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
display: block;
margin-left: -10px;
margin-top: -10px;
}
}
.image-container{

@ -1,12 +1,13 @@
import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
@Component({
selector: 'app-employee-information',
templateUrl: './employee-information.component.html',
styleUrls: ['./employee-information.component.scss'],
})
export class EmployeeInformationComponent implements OnInit {
public direction: string;
public userImage: any = '../assets/imgs/profile.png';
@Input() name: string;
@Input() title: string;
@ -15,9 +16,19 @@ export class EmployeeInformationComponent implements OnInit {
// tslint:disable-next-line: no-output-on-prefix
@Output() onGetDetails = new EventEmitter();
constructor() { }
constructor(
public ts: TranslatorService,
) {
this.direction = TranslatorService.getCurrentLanguageName();
}
ngOnInit() {}
ngOnInit() {
console.log(this.title);
let jobTitle = this.title.split('.');
if (jobTitle && jobTitle.length > 1) {
this.title = jobTitle[0] + " " + jobTitle[1];
}
}
getDetails() {
this.onGetDetails.emit();

@ -28,7 +28,7 @@ export class GenericHeaderComponent implements OnInit {
}
openProfilePage() {
this.common.openEditProfile();
this.common.openProfile('sideMenu');
}
closeModal() {

@ -33,9 +33,9 @@ export class NavButtonsComponent implements OnInit {
this.isIOS = this.platform.is('ios');
this.direction = TranslatorService.getCurrentDirection();
this.platform.backButton.subscribeWithPriority(0 , () => {
this.backButtonClicked({});
});
// this.platform.backButton.subscribeWithPriority(0 , () => {
// this.backButtonClicked({});
// });
});
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save