|
|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { Injectable } from "@angular/core";
|
|
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
|
import {
|
|
|
|
|
NavController,
|
|
|
|
|
ToastController,
|
|
|
|
|
@ -6,74 +6,74 @@ import {
|
|
|
|
|
AlertController,
|
|
|
|
|
Platform,
|
|
|
|
|
MenuController
|
|
|
|
|
} from "@ionic/angular";
|
|
|
|
|
import { Router } from "@angular/router";
|
|
|
|
|
import { TranslatorService } from "../translator/translator.service";
|
|
|
|
|
import { AlertControllerService } from "../../ui/alert/alert-controller.service";
|
|
|
|
|
} from '@ionic/angular';
|
|
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
import { TranslatorService } from '../translator/translator.service';
|
|
|
|
|
import { AlertControllerService } from '../../ui/alert/alert-controller.service';
|
|
|
|
|
//import { Response } from "../models/response";
|
|
|
|
|
import { Response } from 'src/app/hmg-common/services/models/response';
|
|
|
|
|
import { Location, DatePipe } from "@angular/common";
|
|
|
|
|
import { ThemeableBrowser } from "@ionic-native/themeable-browser/ngx";
|
|
|
|
|
import { BrowserConfig } from "./models/browser-config";
|
|
|
|
|
import { Location, DatePipe } from '@angular/common';
|
|
|
|
|
import { ThemeableBrowser } from '@ionic-native/themeable-browser/ngx';
|
|
|
|
|
import { BrowserConfig } from './models/browser-config';
|
|
|
|
|
import {
|
|
|
|
|
LaunchNavigator,
|
|
|
|
|
LaunchNavigatorOptions
|
|
|
|
|
} from "@ionic-native/launch-navigator/ngx";
|
|
|
|
|
import { Device } from "@ionic-native/device/ngx";
|
|
|
|
|
import { ProgressLoadingService } from "../../ui/progressLoading/progress-loading.service";
|
|
|
|
|
import { Observable, throwError } from "rxjs";
|
|
|
|
|
import { SharedDataService } from "../shared-data-service/shared-data.service";
|
|
|
|
|
import { Badge } from "@ionic-native/badge/ngx";
|
|
|
|
|
import { LifeCycleService } from "../life-cycle/life-cycle.service";
|
|
|
|
|
import { Diagnostic } from "@ionic-native/diagnostic/ngx";
|
|
|
|
|
} from '@ionic-native/launch-navigator/ngx';
|
|
|
|
|
import { Device } from '@ionic-native/device/ngx';
|
|
|
|
|
import { ProgressLoadingService } from '../../ui/progressLoading/progress-loading.service';
|
|
|
|
|
import { Observable, throwError } from 'rxjs';
|
|
|
|
|
import { SharedDataService } from '../shared-data-service/shared-data.service';
|
|
|
|
|
import { Badge } from '@ionic-native/badge/ngx';
|
|
|
|
|
import { LifeCycleService } from '../life-cycle/life-cycle.service';
|
|
|
|
|
import { Diagnostic } from '@ionic-native/diagnostic/ngx';
|
|
|
|
|
//import { CallNumber } from "@ionic-native/call-number/ngx";
|
|
|
|
|
import { InAppBrowser } from "@ionic-native/in-app-browser/ngx";
|
|
|
|
|
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
|
|
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
|
providedIn: "root"
|
|
|
|
|
providedIn: 'root'
|
|
|
|
|
})
|
|
|
|
|
export class CommonService {
|
|
|
|
|
public static months_en_long = [
|
|
|
|
|
"January",
|
|
|
|
|
"February",
|
|
|
|
|
"March",
|
|
|
|
|
"April",
|
|
|
|
|
"May",
|
|
|
|
|
"June",
|
|
|
|
|
"July",
|
|
|
|
|
"August",
|
|
|
|
|
"September",
|
|
|
|
|
"October",
|
|
|
|
|
"November",
|
|
|
|
|
"December"
|
|
|
|
|
'January',
|
|
|
|
|
'February',
|
|
|
|
|
'March',
|
|
|
|
|
'April',
|
|
|
|
|
'May',
|
|
|
|
|
'June',
|
|
|
|
|
'July',
|
|
|
|
|
'August',
|
|
|
|
|
'September',
|
|
|
|
|
'October',
|
|
|
|
|
'November',
|
|
|
|
|
'December'
|
|
|
|
|
];
|
|
|
|
|
public static months_en = [
|
|
|
|
|
"Jan",
|
|
|
|
|
"Feb",
|
|
|
|
|
"Mar",
|
|
|
|
|
"Apr",
|
|
|
|
|
"May",
|
|
|
|
|
"Jun",
|
|
|
|
|
"Jul",
|
|
|
|
|
"Aug",
|
|
|
|
|
"Sep",
|
|
|
|
|
"Oct",
|
|
|
|
|
"Nov",
|
|
|
|
|
"Dec"
|
|
|
|
|
'Jan',
|
|
|
|
|
'Feb',
|
|
|
|
|
'Mar',
|
|
|
|
|
'Apr',
|
|
|
|
|
'May',
|
|
|
|
|
'Jun',
|
|
|
|
|
'Jul',
|
|
|
|
|
'Aug',
|
|
|
|
|
'Sep',
|
|
|
|
|
'Oct',
|
|
|
|
|
'Nov',
|
|
|
|
|
'Dec'
|
|
|
|
|
];
|
|
|
|
|
public static months_ar = [
|
|
|
|
|
"يناير",
|
|
|
|
|
"فبراير",
|
|
|
|
|
"مارس",
|
|
|
|
|
"أبريل",
|
|
|
|
|
"مايو",
|
|
|
|
|
"يونيو",
|
|
|
|
|
"يوليو",
|
|
|
|
|
"أغسطس",
|
|
|
|
|
"سبتمبر",
|
|
|
|
|
"أكتوبر",
|
|
|
|
|
"نوفمبر",
|
|
|
|
|
"ديسمبر"
|
|
|
|
|
'يناير',
|
|
|
|
|
'فبراير',
|
|
|
|
|
'مارس',
|
|
|
|
|
'أبريل',
|
|
|
|
|
'مايو',
|
|
|
|
|
'يونيو',
|
|
|
|
|
'يوليو',
|
|
|
|
|
'أغسطس',
|
|
|
|
|
'سبتمبر',
|
|
|
|
|
'أكتوبر',
|
|
|
|
|
'نوفمبر',
|
|
|
|
|
'ديسمبر'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
private progressLoaders: any[] = [];
|
|
|
|
|
@ -114,7 +114,7 @@ export class CommonService {
|
|
|
|
|
|
|
|
|
|
public round(value: number, decimal: number): string {
|
|
|
|
|
const valueStr = value.toString();
|
|
|
|
|
const dotIndex = valueStr.indexOf(".");
|
|
|
|
|
const dotIndex = valueStr.indexOf('.');
|
|
|
|
|
|
|
|
|
|
if (dotIndex >= 0) {
|
|
|
|
|
return valueStr.toString().substr(0, dotIndex + decimal);
|
|
|
|
|
@ -128,13 +128,13 @@ export class CommonService {
|
|
|
|
|
var hours = Math.floor(sec_num / 3600);
|
|
|
|
|
var minutes = Math.floor((sec_num - hours * 3600) / 60);
|
|
|
|
|
var seconds = sec_num - hours * 3600 - minutes * 60;
|
|
|
|
|
var hoursString = "";
|
|
|
|
|
var minutesString = "";
|
|
|
|
|
var secondsString = "";
|
|
|
|
|
hoursString = hours < 10 ? "0" + hours : hours.toString();
|
|
|
|
|
minutesString = minutes < 10 ? "0" + minutes : minutes.toString();
|
|
|
|
|
secondsString = seconds < 10 ? "0" + seconds : seconds.toString();
|
|
|
|
|
return minutesString + ":" + secondsString;
|
|
|
|
|
var hoursString = '';
|
|
|
|
|
var minutesString = '';
|
|
|
|
|
var secondsString = '';
|
|
|
|
|
hoursString = hours < 10 ? '0' + hours : hours.toString();
|
|
|
|
|
minutesString = minutes < 10 ? '0' + minutes : minutes.toString();
|
|
|
|
|
secondsString = seconds < 10 ? '0' + seconds : seconds.toString();
|
|
|
|
|
return minutesString + ':' + secondsString;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public toastPK(page: string, key: string) {
|
|
|
|
|
@ -144,9 +144,9 @@ export class CommonService {
|
|
|
|
|
const toast = await this.toastController.create({
|
|
|
|
|
message: message,
|
|
|
|
|
showCloseButton: true,
|
|
|
|
|
position: "middle",
|
|
|
|
|
position: 'middle',
|
|
|
|
|
duration: 2000,
|
|
|
|
|
closeButtonText: this.ts.trPK("general", "close")
|
|
|
|
|
closeButtonText: this.ts.trPK('general', 'close')
|
|
|
|
|
});
|
|
|
|
|
toast.present();
|
|
|
|
|
}
|
|
|
|
|
@ -155,9 +155,9 @@ export class CommonService {
|
|
|
|
|
async startLoadingOld() {
|
|
|
|
|
this.stopLoading();
|
|
|
|
|
const loader = await this.loadingController.create({
|
|
|
|
|
spinner: "bubbles",
|
|
|
|
|
spinner: 'bubbles',
|
|
|
|
|
duration: 30000,
|
|
|
|
|
message: this.ts.trPK("error", "wait"),
|
|
|
|
|
message: this.ts.trPK('error', 'wait'),
|
|
|
|
|
translucent: true
|
|
|
|
|
});
|
|
|
|
|
this.progressLoaders.push(loader);
|
|
|
|
|
@ -170,7 +170,7 @@ export class CommonService {
|
|
|
|
|
*/
|
|
|
|
|
this.stopLoading();
|
|
|
|
|
this.progressLoadingService.presentLoading(
|
|
|
|
|
this.ts.trPK("general", "loading")
|
|
|
|
|
this.ts.trPK('general', 'loading')
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -190,8 +190,8 @@ export class CommonService {
|
|
|
|
|
onAccept();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
this.ts.trPK("general", "ok"),
|
|
|
|
|
this.ts.trPK("general", "alert"),
|
|
|
|
|
this.ts.trPK('general', 'ok'),
|
|
|
|
|
this.ts.trPK('general', 'alert'),
|
|
|
|
|
message
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -199,10 +199,10 @@ export class CommonService {
|
|
|
|
|
public presentConfirmDialog(message: string, onAccept: any, onCancel?: any) {
|
|
|
|
|
this.confirmAlertDialog(
|
|
|
|
|
onAccept,
|
|
|
|
|
this.ts.trPK("general", "ok"),
|
|
|
|
|
this.ts.trPK('general', 'ok'),
|
|
|
|
|
onCancel,
|
|
|
|
|
this.ts.trPK("general", "cancel"),
|
|
|
|
|
this.ts.trPK("general", "confirm"),
|
|
|
|
|
this.ts.trPK('general', 'cancel'),
|
|
|
|
|
this.ts.trPK('general', 'confirm'),
|
|
|
|
|
message
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -210,8 +210,8 @@ export class CommonService {
|
|
|
|
|
public presentAcceptDialog(message: string, onAccept: any) {
|
|
|
|
|
this.alertDialog(
|
|
|
|
|
onAccept,
|
|
|
|
|
this.ts.trPK("general", "ok"),
|
|
|
|
|
this.ts.trPK("general", "confirm"),
|
|
|
|
|
this.ts.trPK('general', 'ok'),
|
|
|
|
|
this.ts.trPK('general', 'confirm'),
|
|
|
|
|
message
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -221,8 +221,8 @@ export class CommonService {
|
|
|
|
|
() => {
|
|
|
|
|
this.back();
|
|
|
|
|
},
|
|
|
|
|
this.ts.trPK("general", "ok"),
|
|
|
|
|
this.ts.trPK("general", "info"),
|
|
|
|
|
this.ts.trPK('general', 'ok'),
|
|
|
|
|
this.ts.trPK('general', 'info'),
|
|
|
|
|
message
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -230,9 +230,9 @@ export class CommonService {
|
|
|
|
|
this.openHome();
|
|
|
|
|
this.alertDialog(
|
|
|
|
|
() => {},
|
|
|
|
|
this.ts.trPK("general", "ok"),
|
|
|
|
|
this.ts.trPK("general", "info"),
|
|
|
|
|
this.ts.trPK("general", "not-allowed")
|
|
|
|
|
this.ts.trPK('general', 'ok'),
|
|
|
|
|
this.ts.trPK('general', 'info'),
|
|
|
|
|
this.ts.trPK('general', 'not-allowed')
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -243,14 +243,14 @@ export class CommonService {
|
|
|
|
|
) {
|
|
|
|
|
this.alertDialog(
|
|
|
|
|
onClick,
|
|
|
|
|
this.ts.trPK("general", "ok"),
|
|
|
|
|
this.ts.trPK("general", "alert"),
|
|
|
|
|
this.ts.trPK('general', 'ok'),
|
|
|
|
|
this.ts.trPK('general', 'alert'),
|
|
|
|
|
message
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public userNeedToReLogin() {
|
|
|
|
|
this.presentAcceptDialog(this.ts.trPK("general", "relogin"), () => {
|
|
|
|
|
this.presentAcceptDialog(this.ts.trPK('general', 'relogin'), () => {
|
|
|
|
|
this.sharedService.clearAll();
|
|
|
|
|
this.openLogin();
|
|
|
|
|
});
|
|
|
|
|
@ -259,9 +259,9 @@ export class CommonService {
|
|
|
|
|
public showConnectionErrorDialog(onClick: any, okLabel: string) {
|
|
|
|
|
this.alertDialog(
|
|
|
|
|
onClick,
|
|
|
|
|
this.ts.trPK("general", "ok"),
|
|
|
|
|
this.ts.trPK("general", "alert"),
|
|
|
|
|
this.ts.trPK("general", "connError")
|
|
|
|
|
this.ts.trPK('general', 'ok'),
|
|
|
|
|
this.ts.trPK('general', 'alert'),
|
|
|
|
|
this.ts.trPK('general', 'connError')
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -269,15 +269,15 @@ export class CommonService {
|
|
|
|
|
this.alertDialog(
|
|
|
|
|
onClick,
|
|
|
|
|
okLabel,
|
|
|
|
|
this.ts.trPK("general", "alert"),
|
|
|
|
|
this.ts.trPK("general", "timeout")
|
|
|
|
|
this.ts.trPK('general', 'alert'),
|
|
|
|
|
this.ts.trPK('general', 'timeout')
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async JustAlertDialog(acceptLabel: string, message: string) {
|
|
|
|
|
this.clearAllAlerts();
|
|
|
|
|
const alert = await this.alertControllerIonic.create({
|
|
|
|
|
header: this.ts.trPK("general", "info"),
|
|
|
|
|
header: this.ts.trPK('general', 'info'),
|
|
|
|
|
message: message,
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
@ -302,13 +302,13 @@ export class CommonService {
|
|
|
|
|
) {
|
|
|
|
|
this.clearAllAlerts();
|
|
|
|
|
const alert = await this.alertControllerIonic.create({
|
|
|
|
|
header: this.ts.trPK("general", "confirm"),
|
|
|
|
|
header: this.ts.trPK('general', 'confirm'),
|
|
|
|
|
message: message,
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
text: cancelLabel,
|
|
|
|
|
role: "cancel",
|
|
|
|
|
cssClass: "cancel-button",
|
|
|
|
|
role: 'cancel',
|
|
|
|
|
cssClass: 'cancel-button',
|
|
|
|
|
handler: () => {
|
|
|
|
|
if (onCancel) {
|
|
|
|
|
onCancel();
|
|
|
|
|
@ -341,7 +341,7 @@ export class CommonService {
|
|
|
|
|
) {
|
|
|
|
|
this.clearAllAlerts();
|
|
|
|
|
const alert = await this.alertControllerIonic.create({
|
|
|
|
|
header: this.ts.trPK("general", "confirm"),
|
|
|
|
|
header: this.ts.trPK('general', 'confirm'),
|
|
|
|
|
message: message,
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
@ -375,7 +375,7 @@ export class CommonService {
|
|
|
|
|
message: message,
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
text:this.ts.trPK("general", "ok"),
|
|
|
|
|
text:this.ts.trPK('general', 'ok'),
|
|
|
|
|
handler: () => {
|
|
|
|
|
if (onAccept) {
|
|
|
|
|
onAccept();
|
|
|
|
|
@ -418,13 +418,13 @@ export class CommonService {
|
|
|
|
|
) {
|
|
|
|
|
this.clearAllAlerts();
|
|
|
|
|
const alert = await this.alertControllerIonic.create({
|
|
|
|
|
header: this.ts.trPK("general", "confirm"),
|
|
|
|
|
header: this.ts.trPK('general', 'confirm'),
|
|
|
|
|
message: message,
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
text: cancelLabel,
|
|
|
|
|
role: "cancel",
|
|
|
|
|
cssClass: "cancelBtn",
|
|
|
|
|
role: 'cancel',
|
|
|
|
|
cssClass: 'cancelBtn',
|
|
|
|
|
handler: () => {
|
|
|
|
|
if (onCancel) {
|
|
|
|
|
onCancel();
|
|
|
|
|
@ -434,9 +434,9 @@ export class CommonService {
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: acceptLabel,
|
|
|
|
|
role: "Confirm",
|
|
|
|
|
role: 'Confirm',
|
|
|
|
|
|
|
|
|
|
cssClass: "confirmBtn",
|
|
|
|
|
cssClass: 'confirmBtn',
|
|
|
|
|
|
|
|
|
|
handler: () => {
|
|
|
|
|
|
|
|
|
|
@ -455,7 +455,7 @@ export class CommonService {
|
|
|
|
|
|
|
|
|
|
public clearAllAlerts() {
|
|
|
|
|
// custom solutions because of async issue
|
|
|
|
|
const alerts = document.getElementsByTagName("ion-alert");
|
|
|
|
|
const alerts = document.getElementsByTagName('ion-alert');
|
|
|
|
|
for (let i = 0; i < alerts.length; i++) {
|
|
|
|
|
const alert = alerts[i];
|
|
|
|
|
alert.parentNode.removeChild(alert);
|
|
|
|
|
@ -463,15 +463,15 @@ export class CommonService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getDeviceInfo(): string {
|
|
|
|
|
if (this.platform.is("mobile")) {
|
|
|
|
|
const os = this.platform.is("ios") ? "Iphone" : "android";
|
|
|
|
|
if (this.platform.is('mobile')) {
|
|
|
|
|
const os = this.platform.is('ios') ? 'Iphone' : 'android';
|
|
|
|
|
return (
|
|
|
|
|
os +
|
|
|
|
|
" - " +
|
|
|
|
|
' - ' +
|
|
|
|
|
this.device.platform +
|
|
|
|
|
" - " +
|
|
|
|
|
' - ' +
|
|
|
|
|
this.device.version +
|
|
|
|
|
" , " +
|
|
|
|
|
' , ' +
|
|
|
|
|
this.device.manufacturer
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
@ -480,19 +480,19 @@ export class CommonService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getDeviceType(): string {
|
|
|
|
|
if (this.platform.is("mobile")) {
|
|
|
|
|
if (this.platform.is('mobile')) {
|
|
|
|
|
// return "Mobile " + (this.platform.is("ios") ? "Iphone" : "android");
|
|
|
|
|
return (this.platform.is("ios") ? "Iphone" : "android");
|
|
|
|
|
return (this.platform.is('ios') ? 'Iphone' : 'android');
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
return "Desktop";
|
|
|
|
|
return 'Desktop';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public validResponse(result: Response): boolean {
|
|
|
|
|
if (result.MessageStatus === 1) {
|
|
|
|
|
return true;
|
|
|
|
|
} else if (result.MessageStatus === 2) {
|
|
|
|
|
return this.hasData(result["SameClinicApptList"]);
|
|
|
|
|
return this.hasData(result['SameClinicApptList']);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@ -513,15 +513,15 @@ export class CommonService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private openBrowserHtml(url, onExit?, onFaild?, onSuccess?) {
|
|
|
|
|
const browser = window.open(url, "_blank", "location=no");
|
|
|
|
|
browser.addEventListener("loadstart", () => {});
|
|
|
|
|
const browser = window.open(url, '_blank', 'location=no');
|
|
|
|
|
browser.addEventListener('loadstart', () => {});
|
|
|
|
|
|
|
|
|
|
browser.addEventListener("loaderror", () => {
|
|
|
|
|
browser.addEventListener('loaderror', () => {
|
|
|
|
|
if (onFaild) {
|
|
|
|
|
onFaild();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
browser.addEventListener("loadstop", () => {
|
|
|
|
|
browser.addEventListener('loadstop', () => {
|
|
|
|
|
if (onSuccess) {
|
|
|
|
|
onSuccess();
|
|
|
|
|
}
|
|
|
|
|
@ -538,14 +538,14 @@ export class CommonService {
|
|
|
|
|
this.platform.ready().then(() => {
|
|
|
|
|
const browser = this.iab.create(
|
|
|
|
|
url,
|
|
|
|
|
"_blank",
|
|
|
|
|
"closebuttoncolor=#60686b,hidenavigationbuttons=yes,hideurlbar=yes,zoom=no"
|
|
|
|
|
'_blank',
|
|
|
|
|
'closebuttoncolor=#60686b,hidenavigationbuttons=yes,hideurlbar=yes,zoom=no'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// browser.executeScript(...);
|
|
|
|
|
|
|
|
|
|
// browser.insertCSS(...);
|
|
|
|
|
browser.on("loaderror").subscribe(event => {
|
|
|
|
|
browser.on('loaderror').subscribe(event => {
|
|
|
|
|
if (onFaild) {
|
|
|
|
|
onFaild();
|
|
|
|
|
}
|
|
|
|
|
@ -561,13 +561,13 @@ export class CommonService {
|
|
|
|
|
});
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
browser.on("exit").subscribe(event => {
|
|
|
|
|
browser.on('exit').subscribe(event => {
|
|
|
|
|
if (onExit) {
|
|
|
|
|
onExit();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
browser.on("loadstart").subscribe(event => {
|
|
|
|
|
browser.on('loadstart').subscribe(event => {
|
|
|
|
|
if (successURLS) {
|
|
|
|
|
successURLS.forEach((successURL, index) => {
|
|
|
|
|
if (event.url && event.url.indexOf(successURL) >= 0) {
|
|
|
|
|
@ -584,7 +584,7 @@ export class CommonService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public imageFromBase64(base64: string) {
|
|
|
|
|
return "data:image/jpeg;base64," + base64;
|
|
|
|
|
return 'data:image/jpeg;base64,' + base64;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public openLocation(lat: number, lng: number) {
|
|
|
|
|
@ -593,24 +593,24 @@ export class CommonService {
|
|
|
|
|
() => {},
|
|
|
|
|
err => {
|
|
|
|
|
// this.failedToOpenMap();
|
|
|
|
|
window.open("https://maps.google.com/?q=" + lat + "," + lng);
|
|
|
|
|
window.open('https://maps.google.com/?q=' + lat + ',' + lng);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
private failedToOpenMap() {
|
|
|
|
|
this.presentAlert(this.ts.trPK("error", "map"));
|
|
|
|
|
this.presentAlert(this.ts.trPK('error', 'map'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public localizeTime(date: Date) {
|
|
|
|
|
if (!(date.getHours() == 0 && date.getMinutes() == 0)) {
|
|
|
|
|
let h = date.getHours() % 12 || 12;
|
|
|
|
|
let hStr = h < 10 ? "0" + h : h; // leading 0 at the left for 1 digit hours
|
|
|
|
|
let hStr = h < 10 ? '0' + h : h; // leading 0 at the left for 1 digit hours
|
|
|
|
|
const m = date.getMinutes();
|
|
|
|
|
let mStr = m < 10 ? "0" + m : m;
|
|
|
|
|
return hStr + ":" + mStr + (date.getHours() < 12 ? " AM" : " PM");
|
|
|
|
|
let mStr = m < 10 ? '0' + m : m;
|
|
|
|
|
return hStr + ':' + mStr + (date.getHours() < 12 ? ' AM' : ' PM');
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public localizeDate(date: Date, time = false) {
|
|
|
|
|
@ -619,20 +619,20 @@ export class CommonService {
|
|
|
|
|
if (lng === TranslatorService.AR) {
|
|
|
|
|
dateStr =
|
|
|
|
|
CommonService.months_ar[date.getMonth()] +
|
|
|
|
|
" " +
|
|
|
|
|
' ' +
|
|
|
|
|
date.getDate() +
|
|
|
|
|
" " +
|
|
|
|
|
' ' +
|
|
|
|
|
date.getFullYear();
|
|
|
|
|
} else {
|
|
|
|
|
dateStr =
|
|
|
|
|
CommonService.months_en[date.getMonth()] +
|
|
|
|
|
" " +
|
|
|
|
|
' ' +
|
|
|
|
|
date.getDate() +
|
|
|
|
|
"," +
|
|
|
|
|
',' +
|
|
|
|
|
date.getFullYear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return time ? dateStr + " " + this.localizeTime(date) : dateStr;
|
|
|
|
|
return time ? dateStr + ' ' + this.localizeTime(date) : dateStr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public localizeMonth(monthIndex) {
|
|
|
|
|
@ -664,21 +664,21 @@ export class CommonService {
|
|
|
|
|
return (
|
|
|
|
|
date.getMonth() +
|
|
|
|
|
1 +
|
|
|
|
|
"/" +
|
|
|
|
|
'/' +
|
|
|
|
|
date
|
|
|
|
|
.getFullYear()
|
|
|
|
|
.toString()
|
|
|
|
|
.substr(2)
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
return "--";
|
|
|
|
|
return '--';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public convertISODateToJsonDate(isoDate: string): string {
|
|
|
|
|
return "/Date(" + Date.parse(isoDate) + ")/";
|
|
|
|
|
return '/Date(' + Date.parse(isoDate) + ')/';
|
|
|
|
|
}
|
|
|
|
|
public convertDateToJsonDate(date: Date): string {
|
|
|
|
|
return "/Date(" + date.getTime() + ")/";
|
|
|
|
|
return '/Date(' + date.getTime() + ')/';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
@ -687,13 +687,13 @@ export class CommonService {
|
|
|
|
|
*/
|
|
|
|
|
public convertIsoDateToObject(isoDate: string, isoTime: string): Date {
|
|
|
|
|
const date = new Date(isoDate);
|
|
|
|
|
const parts = isoTime.split(":");
|
|
|
|
|
const parts = isoTime.split(':');
|
|
|
|
|
if (this.hasData(parts)) {
|
|
|
|
|
// remove if numbers start with 0
|
|
|
|
|
let hrsStr = parts[0];
|
|
|
|
|
let msStr = parts[1];
|
|
|
|
|
hrsStr = hrsStr[0] == "0" ? hrsStr.substr(1) : hrsStr;
|
|
|
|
|
msStr = msStr[0] == "0" ? msStr.substr(1) : msStr;
|
|
|
|
|
hrsStr = hrsStr[0] == '0' ? hrsStr.substr(1) : hrsStr;
|
|
|
|
|
msStr = msStr[0] == '0' ? msStr.substr(1) : msStr;
|
|
|
|
|
date.setHours(Number(hrsStr));
|
|
|
|
|
date.setMinutes(Number(msStr));
|
|
|
|
|
}
|
|
|
|
|
@ -721,9 +721,9 @@ export class CommonService {
|
|
|
|
|
public getDateISO(date: Date): string {
|
|
|
|
|
return (
|
|
|
|
|
date.getFullYear().toString() +
|
|
|
|
|
"-" +
|
|
|
|
|
'-' +
|
|
|
|
|
this.trailerZero(date.getMonth() + 1) +
|
|
|
|
|
"-" +
|
|
|
|
|
'-' +
|
|
|
|
|
this.trailerZero(date.getDate())
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -735,19 +735,19 @@ export class CommonService {
|
|
|
|
|
public getTimeISO(date: Date): string {
|
|
|
|
|
return (
|
|
|
|
|
this.trailerZero(date.getHours()) +
|
|
|
|
|
":" +
|
|
|
|
|
':' +
|
|
|
|
|
this.trailerZero(date.getMinutes()) +
|
|
|
|
|
":00"
|
|
|
|
|
':00'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getDateTimeISO(date: Date): string {
|
|
|
|
|
return this.getDateISO(date) + " " + this.getTimeISO(date);
|
|
|
|
|
return this.getDateISO(date) + ' ' + this.getTimeISO(date);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getDateTimeISOFromString(dateStr: string): string {
|
|
|
|
|
const date = this.evaluteDateAsObject(dateStr);
|
|
|
|
|
return this.getDateTimeISO(date) + " " + this.getTimeISO(date);
|
|
|
|
|
return this.getDateTimeISO(date) + ' ' + this.getTimeISO(date);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getCurrentTimeISO(): string {
|
|
|
|
|
@ -756,7 +756,7 @@ export class CommonService {
|
|
|
|
|
|
|
|
|
|
private trailerZero(value: number): string {
|
|
|
|
|
const str = value.toString();
|
|
|
|
|
return str.length > 1 ? str : "0" + str;
|
|
|
|
|
return str.length > 1 ? str : '0' + str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public hasData(array: any[]): boolean {
|
|
|
|
|
@ -780,13 +780,13 @@ export class CommonService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return startIndex ? message.substring(startIndex, endIndex) : "";
|
|
|
|
|
return startIndex ? message.substring(startIndex, endIndex) : '';
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
public inNumberRange(targetCode: number): boolean {
|
|
|
|
|
const minDigit = "0".charCodeAt(0);
|
|
|
|
|
const maxDigit = "9".charCodeAt(0);
|
|
|
|
|
const minDigit = '0'.charCodeAt(0);
|
|
|
|
|
const maxDigit = '9'.charCodeAt(0);
|
|
|
|
|
return targetCode >= minDigit && targetCode <= maxDigit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -808,24 +808,24 @@ export class CommonService {
|
|
|
|
|
title?: string
|
|
|
|
|
) {
|
|
|
|
|
this.smsAlertDialog = await this.alertControllerIonic.create({
|
|
|
|
|
header: title || this.ts.trPK("general", "enter-sms-code"),
|
|
|
|
|
header: title || this.ts.trPK('general', 'enter-sms-code'),
|
|
|
|
|
inputs: [
|
|
|
|
|
{
|
|
|
|
|
name: "sms",
|
|
|
|
|
type: "number",
|
|
|
|
|
name: 'sms',
|
|
|
|
|
type: 'number',
|
|
|
|
|
value: smsCode,
|
|
|
|
|
placeholder: this.ts.trPK("general", "enter-sms")
|
|
|
|
|
placeholder: this.ts.trPK('general', 'enter-sms')
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
text: this.ts.trPK("general", "cancel"),
|
|
|
|
|
role: "cancel",
|
|
|
|
|
cssClass: "cancel-button",
|
|
|
|
|
text: this.ts.trPK('general', 'cancel'),
|
|
|
|
|
role: 'cancel',
|
|
|
|
|
cssClass: 'cancel-button',
|
|
|
|
|
handler: () => {}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: this.ts.trPK("general", "ok"),
|
|
|
|
|
text: this.ts.trPK('general', 'ok'),
|
|
|
|
|
handler: data => {
|
|
|
|
|
onAccept(data.sms);
|
|
|
|
|
}
|
|
|
|
|
@ -928,8 +928,8 @@ export class CommonService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const dataSets = [
|
|
|
|
|
this.getGraphDataSet(this.ts.trInline(title1), series1, "#d12026"),
|
|
|
|
|
this.getGraphDataSet(this.ts.trInline(title2), series2, "#60686b")
|
|
|
|
|
this.getGraphDataSet(this.ts.trInline(title1), series1, '#d12026'),
|
|
|
|
|
this.getGraphDataSet(this.ts.trInline(title2), series2, '#60686b')
|
|
|
|
|
];
|
|
|
|
|
return this.getGraphMultiSeries(labels, dataSets);
|
|
|
|
|
}
|
|
|
|
|
@ -945,7 +945,7 @@ export class CommonService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public isHtml5VideoSupported(): boolean {
|
|
|
|
|
const v = document.createElement("video");
|
|
|
|
|
const v = document.createElement('video');
|
|
|
|
|
if (v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@ -959,7 +959,7 @@ export class CommonService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public isCordova(): boolean {
|
|
|
|
|
return this.platform.is("cordova");
|
|
|
|
|
return this.platform.is('cordova');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public pageRevisited(pageName: string): Observable<boolean> {
|
|
|
|
|
@ -970,119 +970,119 @@ export class CommonService {
|
|
|
|
|
open calls
|
|
|
|
|
*/
|
|
|
|
|
public openEitListPage() {
|
|
|
|
|
this.nav.navigateForward(["/eit/eit-list"]);
|
|
|
|
|
this.nav.navigateForward(['/eit/eit-list']);
|
|
|
|
|
}
|
|
|
|
|
public openAddEitPage() {
|
|
|
|
|
this.nav.navigateForward(["/eit/add-eit"]);
|
|
|
|
|
this.nav.navigateForward(['/eit/add-eit']);
|
|
|
|
|
}
|
|
|
|
|
public openConfirmEitPage() {
|
|
|
|
|
this.nav.navigateForward(["/eit/confirm-add-eit"]);
|
|
|
|
|
this.nav.navigateForward(['/eit/confirm-add-eit']);
|
|
|
|
|
}
|
|
|
|
|
public openHome() {
|
|
|
|
|
this.nav.navigateRoot(["/home"]);
|
|
|
|
|
this.nav.navigateRoot(['/home']);
|
|
|
|
|
}
|
|
|
|
|
public openForgotPassword() {
|
|
|
|
|
this.nav.navigateForward(["/authentication/forgot"]);
|
|
|
|
|
this.nav.navigateForward(['/authentication/forgot']);
|
|
|
|
|
}
|
|
|
|
|
public openChangePassword() {
|
|
|
|
|
this.nav.navigateForward(["/authentication/changepassowrd"]);
|
|
|
|
|
this.nav.navigateForward(['/authentication/changepassowrd']);
|
|
|
|
|
}
|
|
|
|
|
public openProfile() {
|
|
|
|
|
this.nav.navigateForward(["/profile/home"]);
|
|
|
|
|
this.nav.navigateForward(['/profile/home']);
|
|
|
|
|
}
|
|
|
|
|
public openAccuralPage() {
|
|
|
|
|
this.nav.navigateForward(["/accrual-balances/home"]);
|
|
|
|
|
this.nav.navigateForward(['/accrual-balances/home']);
|
|
|
|
|
}
|
|
|
|
|
public openEITPage() {
|
|
|
|
|
this.nav.navigateForward(["/eit/homepage"]);
|
|
|
|
|
this.nav.navigateForward(['/eit/homepage']);
|
|
|
|
|
}
|
|
|
|
|
public openMyTeamPage() {
|
|
|
|
|
this.nav.navigateForward(["/my-team/home"]);
|
|
|
|
|
this.nav.navigateForward(['/my-team/home']);
|
|
|
|
|
}
|
|
|
|
|
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.alternateNavigate(CommonService.myTeamDetailUrl,'teamDetail-open',true);
|
|
|
|
|
// this.nav.navigateForward(["/my-team/details"]);
|
|
|
|
|
}
|
|
|
|
|
public openAbsencePage() {
|
|
|
|
|
this.nav.navigateForward(["/absence/home"]);
|
|
|
|
|
this.nav.navigateForward(['/absence/home']);
|
|
|
|
|
}
|
|
|
|
|
public openSubmitAbsencePage() {
|
|
|
|
|
this.nav.navigateForward(["/absence/submit-absence"]);
|
|
|
|
|
this.nav.navigateForward(['/absence/submit-absence']);
|
|
|
|
|
}
|
|
|
|
|
public openConfirmAbsece() {
|
|
|
|
|
this.nav.navigateForward(["/absence/confirm-absence"]);
|
|
|
|
|
this.nav.navigateForward(['/absence/confirm-absence']);
|
|
|
|
|
}
|
|
|
|
|
public openWorkListAttachViewPage() {
|
|
|
|
|
this.nav.navigateForward(["/notification/work-list-attach-view"]);
|
|
|
|
|
this.nav.navigateForward(['/notification/work-list-attach-view']);
|
|
|
|
|
}
|
|
|
|
|
public openviewAbsenceAttachment() {
|
|
|
|
|
this.nav.navigateForward(["/absence/view-attachements"]);
|
|
|
|
|
this.nav.navigateForward(['/absence/view-attachements']);
|
|
|
|
|
}
|
|
|
|
|
public openNotificationPage() {
|
|
|
|
|
this.nav.navigateForward(["/notification/homepage"]);
|
|
|
|
|
this.nav.navigateForward(['/notification/homepage']);
|
|
|
|
|
}
|
|
|
|
|
public openWorklistMainPage() {
|
|
|
|
|
this.nav.navigateForward(["/notification/worklist-main"]);
|
|
|
|
|
this.nav.navigateForward(['/notification/worklist-main']);
|
|
|
|
|
}
|
|
|
|
|
public openWorklistMainPRPage() {
|
|
|
|
|
this.nav.navigateForward(["/notification/worklist-main-PR"]);
|
|
|
|
|
this.nav.navigateForward(['/notification/worklist-main-PR']);
|
|
|
|
|
}
|
|
|
|
|
public openWorklistMainPOPage() {
|
|
|
|
|
this.nav.navigateForward(["/notification/worklist-main-PO"]);
|
|
|
|
|
this.nav.navigateForward(['/notification/worklist-main-PO']);
|
|
|
|
|
}
|
|
|
|
|
public openWorklistReplacementRollPage() {
|
|
|
|
|
this.nav.navigateForward(["/notification/work-list-replacement-roll"]);
|
|
|
|
|
this.nav.navigateForward(['/notification/work-list-replacement-roll']);
|
|
|
|
|
}
|
|
|
|
|
public openNotificationDetailsPage() {
|
|
|
|
|
this.nav.navigateForward(["/notification/work-list-details"]);
|
|
|
|
|
this.nav.navigateForward(['/notification/work-list-details']);
|
|
|
|
|
}
|
|
|
|
|
public openWorklistHistoryPage() {
|
|
|
|
|
this.nav.navigateForward(["/notification/work-list-action-history"]);
|
|
|
|
|
this.nav.navigateForward(['/notification/work-list-action-history']);
|
|
|
|
|
}
|
|
|
|
|
public openWorklistAttachPage() {
|
|
|
|
|
this.nav.navigateForward(["/notification/work-list-attach"]);
|
|
|
|
|
this.nav.navigateForward(['/notification/work-list-attach']);
|
|
|
|
|
}
|
|
|
|
|
public openWorklistRFCPage() {
|
|
|
|
|
this.nav.navigateForward(["/notification/work-list-rfc"]);
|
|
|
|
|
this.nav.navigateForward(['/notification/work-list-rfc']);
|
|
|
|
|
}
|
|
|
|
|
public openWorklistRollReplacement() {
|
|
|
|
|
this.nav.navigateForward(["/notification/work-list-replacement-roll"]);
|
|
|
|
|
this.nav.navigateForward(['/notification/work-list-replacement-roll']);
|
|
|
|
|
}
|
|
|
|
|
public openItemHistoryPage() {
|
|
|
|
|
this.nav.navigateForward(["/notification/item-history-PO"]);
|
|
|
|
|
this.nav.navigateForward(['/notification/item-history-PO']);
|
|
|
|
|
}
|
|
|
|
|
public openQutationAnalysisPage() {
|
|
|
|
|
this.nav.navigateForward(["/notification/qutation-analysis-PO"]);
|
|
|
|
|
this.nav.navigateForward(['/notification/qutation-analysis-PO']);
|
|
|
|
|
}
|
|
|
|
|
public openWorklistMainMRPage() {
|
|
|
|
|
this.nav.navigateForward(["/notification/worklist-main-MR"]);
|
|
|
|
|
this.nav.navigateForward(['/notification/worklist-main-MR']);
|
|
|
|
|
}
|
|
|
|
|
public openMySpecialistPage() {
|
|
|
|
|
this.nav.navigateForward(["/my-specialist/home"]);
|
|
|
|
|
this.nav.navigateForward(['/my-specialist/home']);
|
|
|
|
|
}
|
|
|
|
|
public openMySubordinatePage() {
|
|
|
|
|
this.nav.navigateForward(["/my-subordinate/home"]);
|
|
|
|
|
this.nav.navigateForward(['/my-subordinate/home']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public openChangeImagePage() {
|
|
|
|
|
this.nav.navigateForward(["/profile/profileImg"]);
|
|
|
|
|
this.nav.navigateForward(['/profile/profileImg']);
|
|
|
|
|
}
|
|
|
|
|
public openPayslipPage() {
|
|
|
|
|
this.nav.navigateForward(["/payslip/home"]);
|
|
|
|
|
this.nav.navigateForward(['/payslip/home']);
|
|
|
|
|
}
|
|
|
|
|
public openEarningsPage() {
|
|
|
|
|
this.nav.navigateForward(["/payslip/Earnings"]);
|
|
|
|
|
this.nav.navigateForward(['/payslip/Earnings']);
|
|
|
|
|
}
|
|
|
|
|
public openDeductionsPage() {
|
|
|
|
|
this.nav.navigateForward(["/payslip/Deductions"]);
|
|
|
|
|
this.nav.navigateForward(['/payslip/Deductions']);
|
|
|
|
|
}
|
|
|
|
|
public openConfirmLoginPage() {
|
|
|
|
|
this.nav.navigateForward(["/authentication/confirmLogin"]);
|
|
|
|
|
this.nav.navigateForward(['/authentication/confirmLogin']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public reload(url: string, from: string) {
|
|
|
|
|
console.log("force reload called from:" + from);
|
|
|
|
|
console.log('force reload called from:' + from);
|
|
|
|
|
// window.location.reload();
|
|
|
|
|
location.href = url;
|
|
|
|
|
}
|
|
|
|
|
@ -1106,11 +1106,11 @@ export class CommonService {
|
|
|
|
|
|
|
|
|
|
private alternateNavigate(paths: string[], key: string, root = false) {
|
|
|
|
|
let url: string;
|
|
|
|
|
if (localStorage.getItem(key) === "yes") {
|
|
|
|
|
localStorage.setItem(key, "no");
|
|
|
|
|
if (localStorage.getItem(key) === 'yes') {
|
|
|
|
|
localStorage.setItem(key, 'no');
|
|
|
|
|
url = paths[0];
|
|
|
|
|
} else {
|
|
|
|
|
localStorage.setItem(key, "yes");
|
|
|
|
|
localStorage.setItem(key, 'yes');
|
|
|
|
|
url = paths[1];
|
|
|
|
|
}
|
|
|
|
|
if (root) {
|
|
|
|
|
@ -1121,14 +1121,14 @@ export class CommonService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public openLogin() {
|
|
|
|
|
this.nav.navigateRoot(["/authentication/login"]);
|
|
|
|
|
this.nav.navigateRoot(['/authentication/login']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public openUserForgot() {
|
|
|
|
|
this.nav.navigateForward(["/authentication/checkuser"]);
|
|
|
|
|
this.nav.navigateForward(['/authentication/checkuser']);
|
|
|
|
|
}
|
|
|
|
|
public openSMSPage() {
|
|
|
|
|
this.nav.navigateForward(["/authentication/smspage"]);
|
|
|
|
|
this.nav.navigateForward(['/authentication/smspage']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public navigateTo(url: string) {
|
|
|
|
|
@ -1164,11 +1164,11 @@ export class CommonService {
|
|
|
|
|
if (state == this.diagnostic.bluetoothState.POWERED_ON) {
|
|
|
|
|
feedback();
|
|
|
|
|
} else {
|
|
|
|
|
this.presentAlert(this.ts.trPK("bluetooth", "start"));
|
|
|
|
|
this.presentAlert(this.ts.trPK('bluetooth', 'start'));
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(e => {
|
|
|
|
|
this.presentAlert(this.ts.trPK("bluetooth", "start"));
|
|
|
|
|
this.presentAlert(this.ts.trPK('bluetooth', 'start'));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -1198,7 +1198,7 @@ export class CommonService {
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < list.length; i += 1) {
|
|
|
|
|
node = list[i];
|
|
|
|
|
if (node.PARENT_MENU_NAME !== "") {
|
|
|
|
|
if (node.PARENT_MENU_NAME !== '') {
|
|
|
|
|
// if you have dangling branches check that map[node.parentId] exists
|
|
|
|
|
list[map[node.PARENT_MENU_NAME]].children.push(node);
|
|
|
|
|
} else {
|
|
|
|
|
@ -1210,8 +1210,8 @@ export class CommonService {
|
|
|
|
|
public reverseFormatDate(date) {
|
|
|
|
|
let FormatedDate;
|
|
|
|
|
if (date) {
|
|
|
|
|
FormatedDate = date.replace(/\//g, "-");
|
|
|
|
|
FormatedDate = FormatedDate.replace(/ 00:00:00/g, "");
|
|
|
|
|
FormatedDate = date.replace(/\//g, '-');
|
|
|
|
|
FormatedDate = FormatedDate.replace(/ 00:00:00/g, '');
|
|
|
|
|
} else {
|
|
|
|
|
FormatedDate = date;
|
|
|
|
|
}
|
|
|
|
|
@ -1220,7 +1220,7 @@ export class CommonService {
|
|
|
|
|
public formatStandardDate(date) {
|
|
|
|
|
let FormatedDate;
|
|
|
|
|
if (date) {
|
|
|
|
|
FormatedDate = date.replace(/-/g, "/");
|
|
|
|
|
FormatedDate = date.replace(/-/g, '/');
|
|
|
|
|
} else {
|
|
|
|
|
FormatedDate = date;
|
|
|
|
|
}
|
|
|
|
|
@ -1229,7 +1229,7 @@ export class CommonService {
|
|
|
|
|
public reverseFormatStandardDate(date) {
|
|
|
|
|
let FormatedDate;
|
|
|
|
|
if (date) {
|
|
|
|
|
FormatedDate = date.replace(/\//g, "-");
|
|
|
|
|
FormatedDate = date.replace(/\//g, '-');
|
|
|
|
|
} else {
|
|
|
|
|
FormatedDate = date;
|
|
|
|
|
}
|
|
|
|
|
@ -1241,8 +1241,8 @@ export class CommonService {
|
|
|
|
|
|
|
|
|
|
if (date) {
|
|
|
|
|
date = date.slice(0, 10);
|
|
|
|
|
FormatedDate = date.replace(/-/g, "/");
|
|
|
|
|
FormatedDate = FormatedDate + " 00:00:00";
|
|
|
|
|
FormatedDate = date.replace(/-/g, '/');
|
|
|
|
|
FormatedDate = FormatedDate + ' 00:00:00';
|
|
|
|
|
} else {
|
|
|
|
|
FormatedDate = date;
|
|
|
|
|
}
|
|
|
|
|
@ -1254,8 +1254,8 @@ export class CommonService {
|
|
|
|
|
console.log(date);
|
|
|
|
|
if (date) {
|
|
|
|
|
// FormatedDate = date.replace(/-/g, "/");
|
|
|
|
|
FormatedDate = date.split("T")[0];
|
|
|
|
|
FormatedDate = FormatedDate + " 00:00:00";
|
|
|
|
|
FormatedDate = date.split('T')[0];
|
|
|
|
|
FormatedDate = FormatedDate + ' 00:00:00';
|
|
|
|
|
console.log(FormatedDate);
|
|
|
|
|
} else {
|
|
|
|
|
FormatedDate = date;
|
|
|
|
|
@ -1264,12 +1264,12 @@ export class CommonService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public setUpdateImage (image){
|
|
|
|
|
console.log("setUpdateImage");
|
|
|
|
|
console.log('setUpdateImage');
|
|
|
|
|
this.setUpdateImg=image;
|
|
|
|
|
this.updateImage=true;
|
|
|
|
|
}
|
|
|
|
|
public getUpdateImage(){
|
|
|
|
|
console.log("getUpdateImage");
|
|
|
|
|
console.log('getUpdateImage');
|
|
|
|
|
const objImg={
|
|
|
|
|
img: this.setUpdateImg,
|
|
|
|
|
status: this.updateImage
|
|
|
|
|
|