absence page

MOHEMM-Q3-DEV-LATEST
Sultan Khan 7 years ago
parent a3d58d4b1c
commit 628cc89189

@ -4,11 +4,11 @@ import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { AbsenceListService } from "./service/service.service"; import { AbsenceListService } from "./service/service.service";
import { IonicModule } from '@ionic/angular'; import { IonicModule } from '@ionic/angular';
import { SubmitAbsenceService } from './service/submit.absence.service';
import { AbsencePage } from './absence.page'; import { AbsencePage } from './absence.page';
import { DatePicker } from '@ionic-native/date-picker/ngx';
import { HomeComponent } from './home/home.component'; import { HomeComponent } from './home/home.component';
import { SubmitAbsenceComponent } from './submit-absence/submit-absence.component';
const routes: Routes = [ const routes: Routes = [
{ {
path: '', path: '',
@ -17,6 +17,10 @@ const routes: Routes = [
{ {
path: 'home', path: 'home',
component: HomeComponent component: HomeComponent
},
{
path: 'submit-absence',
component: SubmitAbsenceComponent
} }
] ]
} }
@ -29,7 +33,7 @@ const routes: Routes = [
IonicModule, IonicModule,
RouterModule.forChild(routes) RouterModule.forChild(routes)
], ],
providers:[AbsenceListService], providers:[AbsenceListService, SubmitAbsenceService, DatePicker],
declarations: [AbsencePage, HomeComponent] declarations: [AbsencePage, HomeComponent, SubmitAbsenceComponent]
}) })
export class AbsencePageModule {} export class AbsencePageModule {}

@ -2,7 +2,7 @@
<ion-toolbar class="header-toolbar"> <ion-toolbar class="header-toolbar">
<ion-title color="light">{{ts.trPK('absenceList','absenceList')}}</ion-title> <ion-title color="light">{{ts.trPK('absenceList','absenceList')}}</ion-title>
<ion-buttons slot="start"> <ion-buttons slot="start">
<ion-back-button color="light" class="btnBack"></ion-back-button> <ion-back-button color="light" class="btnBack" defaultHref=""></ion-back-button>
</ion-buttons> </ion-buttons>
<ion-buttons slot="end"> <ion-buttons slot="end">
<button class="headerBtn" (click)="AccrualBalances()"> <button class="headerBtn" (click)="AccrualBalances()">
@ -111,6 +111,6 @@
</ion-content> </ion-content>
<ion-footer> <ion-footer>
<div class="centerDiv"> <div class="centerDiv">
<ion-button color="customnavy" class="gridBtn" (click)="CreateAbsence()">{{ts.trPK('absenceList','createAbs')}}</ion-button> <ion-button color="customnavy" class="gridBtn" (click)="createAbsence()">{{ts.trPK('absenceList','createAbs')}}</ion-button>
</div> </div>
</ion-footer> </ion-footer>

@ -1,16 +1,19 @@
import { Component, OnInit } from "@angular/core"; import { Component, OnInit, ViewChild } from "@angular/core";
import { CommonService } from "src/app/hmg-common/services/common/common.service"; import { CommonService } from "src/app/hmg-common/services/common/common.service";
import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service"; import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service";
import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response"; import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response";
import { MenuService } from "src/app/hmg-common/services/menu/menuservice.service"; import { MenuService } from "src/app/hmg-common/services/menu/menuservice.service";
import { AbsenceAttahcmentResponse } from "../models/abs.attach.response"; import { AbsenceAttahcmentResponse } from "../models/abs.attach.response";
import { AbsenceListService } from "../service/service.service"; import { AbsenceListService } from "../service/service.service";
import { IonInfiniteScroll } from "@ionic/angular";
@Component({ @Component({
selector: "app-home", selector: "app-home",
templateUrl: "./home.component.html", templateUrl: "./home.component.html",
styleUrls: ["./home.component.scss"] styleUrls: ["./home.component.scss"]
}) })
export class HomeComponent implements OnInit { export class HomeComponent implements OnInit {
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
P_PAGE_NUM: number; P_PAGE_NUM: number;
P_PAGE_LIMIT: number; P_PAGE_LIMIT: number;
GetAbsenceTransactionList: any; GetAbsenceTransactionList: any;
@ -26,17 +29,19 @@ export class HomeComponent implements OnInit {
) {} ) {}
ngOnInit() { ngOnInit() {
this.P_PAGE_LIMIT = 50;
this.P_PAGE_NUM = 1;
this.selMenu = this.common.sharedService.getSharedData( this.selMenu = this.common.sharedService.getSharedData(
MenuResponse.SHARED_DATA, MenuResponse.SHARED_DATA,
true false
); );
this.selEmp = this.common.sharedService.getSharedData( this.selEmp = this.common.sharedService.getSharedData(
MenuResponse.SHARED_SEL_EMP, MenuResponse.SHARED_SEL_EMP,
true false
); );
this.respID = this.common.sharedService.getSharedData( this.respID = this.common.sharedService.getSharedData(
MenuResponse.SHARED_SEL_RESP_ID, MenuResponse.SHARED_SEL_RESP_ID,
true false
); );
this.getAbsenceTransaction(); this.getAbsenceTransaction();
} }
@ -124,22 +129,25 @@ export class HomeComponent implements OnInit {
this.IsReachEnd = false; this.IsReachEnd = false;
} }
this.GetAbsenceTransactionList.push(vr); this.GetAbsenceTransactionList.push(vr);
// this.pro.GetVacationRulesList.push(vr);
}); });
} else { } else {
this.IsReachEnd = true; this.IsReachEnd = true;
} }
} }
//this.P_PAGE_NUM++; if (this.infiniteScroll) {
if (infiniteScroll) infiniteScroll.complete(); this.infiniteScroll.complete();
}
// console.log(resFlag);
}, },
Error => console.log(Error), Error => console.log(Error),
() => infiniteScroll.complete() () => this.infiniteScroll.complete()
); );
} else { } else {
if (infiniteScroll) infiniteScroll.complete(); if (this.infiniteScroll) {
this.infiniteScroll.complete();
}
}
} }
createAbsence() {
this.common.openSubmitAbsencePage();
} }
} }

@ -0,0 +1,66 @@
import {Injectable} from '@angular/core';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
import { Observable } from 'rxjs';
import {AbsenceTransaction} from '../models/absence.transaction'
@Injectable()
export class SubmitAbsenceService {
public static submitAbsence='Services/ERP.svc/REST/SUBMIT_ABSENCE_TRANSACTION';
public static getAbsDffStructure='Services/ERP.svc/REST/GET_ABSENCE_DFF_STRUCTURE';
public static getAbsenceTypes='Services/ERP.svc/REST/GET_ABSENCE_ATTENDANCE_TYPES';
public static getCalc='Services/ERP.svc/REST/CALCULATE_ABSENCE_DURATION';
public static validateAbsence='Services/ERP.svc/REST/VALIDATE_ABSENCE_TRANSACTION';
public static getSetValue='Services/ERP.svc/REST/GET_VALUE_SET_VALUES';
public static getDefaultValue='Services/ERP.svc/REST/GET_DEFAULT_VALUE';
public static resubmitAbsence='Services/ERP.svc/REST/RESUBMIT_ABSENCE_TRANSACTION'
constructor(
public api: ConnectorService,
public authService: AuthenticationService,
) { }
public submitAbsence(absence: any, onError?: any, errorLabel?: string): Observable<any> {
const request = absence;
this.authService.authenticateRequest(request);
return this.api.post(SubmitAbsenceService.submitAbsence, request, onError, errorLabel);
}
public getAbsenceDffStructure(absence: any, onError?: any, errorLabel?: string): Observable<any> {
const request = absence;
this.authService.authenticateRequest(request);
return this.api.post(SubmitAbsenceService.getAbsDffStructure, request, onError, errorLabel);
}
public getAbsenceType(absence: any, onError?: any, errorLabel?: string): Observable<any> {
const request = absence;
this.authService.authenticateRequest(request);
return this.api.post(SubmitAbsenceService.getAbsenceTypes, request, onError, errorLabel);
}
public getCalc(absence: any, onError?: any, errorLabel?: string): Observable<any> {
const request = absence;
this.authService.authenticateRequest(request);
return this.api.post(SubmitAbsenceService.getCalc, request, onError, errorLabel);
}
public validateAbsenceTransaction (validateAbsReq: any, onError?: any, errorLabel?: string): Observable<any> {
const request = validateAbsReq;
this.authService.authenticateRequest(request);
return this.api.post(SubmitAbsenceService.validateAbsence, request, onError, errorLabel);
}
public getSetValue(SetValueReq: any, onError?: any, errorLabel?: string): Observable<any> {
const request = SetValueReq;
this.authService.authenticateRequest(request);
return this.api.post(SubmitAbsenceService.getSetValue, request, onError, errorLabel);
}
public getDefaultValue(DefaultValueReq: any, onError?: any, errorLabel?: string): Observable<any> {
const request = DefaultValueReq;
this.authService.authenticateRequest(request);
return this.api.post(SubmitAbsenceService.getDefaultValue, request, onError, errorLabel);
}
public resubmitAbsence(absence: any, onError?: any, errorLabel?: string): Observable<any> {
const request = absence;
this.authService.authenticateRequest(request);
return this.api.post(SubmitAbsenceService.resubmitAbsence, request, onError, errorLabel);
}
}

@ -0,0 +1,60 @@
<ion-header >
<ion-toolbar class="header-toolbar">
<ion-title color="light"> {{ts.trPK('submitAbsence','submitAbsence')}}</ion-title>
<ion-buttons slot="start">
<ion-back-button color="light" class="btnBack" defaultHref=""></ion-back-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content padding>
<ion-item>
<ion-label 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>
<!-- 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>
</ion-item>
<ion-item>
<ion-label class="colBold requiredClass">{{ts.trPK('submitAbsence','startDate')}} </ion-label>
<ion-datetime (ionChange)="calcDay()" [(ngModel)]="startDate" min="1900" max="2100" displayFormat="MMM/DD/YYYY" placeholder="MM/DD/YYYY" required></ion-datetime>
</ion-item>
<ion-item *ngIf="hoursOrDay!='D'">
<ion-label class="colBold requiredClass">{{ts.trPK('submitAbsence','startTime')}} </ion-label>
<ion-datetime displayFormat="HH:mm" [(ngModel)]="startTime" required></ion-datetime>
</ion-item>
<ion-item>
<ion-label class="colBold requiredClass">{{ts.trPK('submitAbsence','endDate')}}</ion-label>
<ion-datetime (ionChange)="calcDay()" [(ngModel)]="endDate" min="1900" max="2100" displayFormat="MMM/DD/YYYY" placeholder="MM/DD/YYYY" required ></ion-datetime>
</ion-item>
<ion-item *ngIf="hoursOrDay!='D'">
<ion-label class="colBold requiredClass">{{ts.trPK('submitAbsence','endTime')}}</ion-label>
<ion-datetime displayFormat="HH:mm" [(ngModel)]="endTime" required></ion-datetime>
</ion-item>
<ion-item>
<ion-label class="colBold" >{{ts.trPK('submitAbsence','totalDays')}} </ion-label>
<ion-label end style="text-align: center;">{{totalDays}}</ion-label>
</ion-item>
<ion-item>
<ion-input placeholder="{{ts.trPK('searchForReplacment','searchForReplacment')}}" type="text" [(ngModel)]="employeeSel">
</ion-input>
<button ion-button class="search-button" icon-only (click)="SearchReplacment()" clear type="button" item-end >
<ion-icon name="search" ></ion-icon>
</button>
</ion-item>
<ion-item>
<ion-label class="colBold">{{ts.trPK('submitAbsence','comments')}}</ion-label>
<ion-textarea [(ngModel)]="absComments"></ion-textarea>
</ion-item>
<div id="dynamic-abs-container" >
</div>
</ion-content>
<ion-footer>
<div class="centerDiv">
<ion-button color="customnavy" (click)="validateAbcenseTransaction()">{{ts.trPK('general','next')}}</ion-button>
</div>
</ion-footer>

@ -0,0 +1,5 @@
.search-button{
background: transparent;
font-size: 25px;
color: #7F8C8D;
}

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

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

@ -35,9 +35,14 @@ ion-col.colPad.col {
padding-top: 20px; padding-top: 20px;
} }
ion-img { img.centerDiv {
width: 170px; width: 180px;
height: 170px; height: 140px;
contain: strict;
min-width: 20px;
min-height: 20px;
display: block;
margin-top: 30px;
background: var(--light); background: var(--light);
} }

@ -23,17 +23,14 @@ import { Observable, throwError } from "rxjs";
import { SharedDataService } from "../shared-data-service/shared-data.service"; import { SharedDataService } from "../shared-data-service/shared-data.service";
import { Badge } from "@ionic-native/badge/ngx"; import { Badge } from "@ionic-native/badge/ngx";
import { LifeCycleService } from "../life-cycle/life-cycle.service"; import { LifeCycleService } from "../life-cycle/life-cycle.service";
import { Diagnostic } from '@ionic-native/diagnostic/ngx'; import { Diagnostic } from "@ionic-native/diagnostic/ngx";
import { CallNumber } from '@ionic-native/call-number/ngx'; import { CallNumber } from "@ionic-native/call-number/ngx";
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; import { InAppBrowser } from "@ionic-native/in-app-browser/ngx";
@Injectable({ @Injectable({
providedIn: "root" providedIn: "root"
}) })
export class CommonService { export class CommonService {
public static months_en_long = [ public static months_en_long = [
"January", "January",
"February", "February",
@ -99,7 +96,7 @@ export class CommonService {
public diagnostic: Diagnostic, public diagnostic: Diagnostic,
public callNumber: CallNumber, public callNumber: CallNumber,
public iab: InAppBrowser public iab: InAppBrowser
) { } ) {}
public back() { public back() {
// this.nav.pop(); // this.nav.pop();
@ -120,19 +117,18 @@ export class CommonService {
} }
} }
getSecondsAsDigitalClock(inputSeconds: number) { getSecondsAsDigitalClock(inputSeconds: number) {
var sec_num = parseInt(inputSeconds.toString(), 10); // don't forget the second param var sec_num = parseInt(inputSeconds.toString(), 10); // don't forget the second param
var hours = Math.floor(sec_num / 3600); var hours = Math.floor(sec_num / 3600);
var minutes = Math.floor((sec_num - (hours * 3600)) / 60); var minutes = Math.floor((sec_num - hours * 3600) / 60);
var seconds = sec_num - (hours * 3600) - (minutes * 60); var seconds = sec_num - hours * 3600 - minutes * 60;
var hoursString = ''; var hoursString = "";
var minutesString = ''; var minutesString = "";
var secondsString = ''; var secondsString = "";
hoursString = (hours < 10) ? "0" + hours : hours.toString(); hoursString = hours < 10 ? "0" + hours : hours.toString();
minutesString = (minutes < 10) ? "0" + minutes : minutes.toString(); minutesString = minutes < 10 ? "0" + minutes : minutes.toString();
secondsString = (seconds < 10) ? "0" + seconds : seconds.toString(); secondsString = seconds < 10 ? "0" + seconds : seconds.toString();
return minutesString + ':' + secondsString; return minutesString + ":" + secondsString;
} }
public toastPK(page: string, key: string) { public toastPK(page: string, key: string) {
@ -167,13 +163,15 @@ export class CommonService {
this.progressLoadingService.presentLoading( this.ts.trPK("general", "loading") , small ); this.progressLoadingService.presentLoading( this.ts.trPK("general", "loading") , small );
*/ */
this.stopLoading(); this.stopLoading();
this.progressLoadingService.presentLoading(this.ts.trPK("general", "loading")); this.progressLoadingService.presentLoading(
this.ts.trPK("general", "loading")
);
} }
public mobileNumber(number: string) { public mobileNumber(number: string) {
return number.substr(1, number.length - 1); return number.substr(1, number.length - 1);
} }
public testFunction() { } public testFunction() {}
public stopLoading() { public stopLoading() {
this.progressLoadingService.dismiss(); this.progressLoadingService.dismiss();
@ -225,8 +223,7 @@ export class CommonService {
public confirmNotAllowedDialog() { public confirmNotAllowedDialog() {
this.openHome(); this.openHome();
this.alertDialog( this.alertDialog(
() => { () => {},
},
this.ts.trPK("general", "ok"), this.ts.trPK("general", "ok"),
this.ts.trPK("general", "info"), this.ts.trPK("general", "info"),
this.ts.trPK("general", "not-allowed") this.ts.trPK("general", "not-allowed")
@ -270,8 +267,7 @@ export class CommonService {
); );
} }
async JustAlertDialog(acceptLabel: string, async JustAlertDialog(acceptLabel: string, message: string) {
message: string) {
this.clearAllAlerts(); this.clearAllAlerts();
const alert = await this.alertControllerIonic.create({ const alert = await this.alertControllerIonic.create({
header: this.ts.trPK("general", "info"), header: this.ts.trPK("general", "info"),
@ -305,7 +301,7 @@ export class CommonService {
{ {
text: cancelLabel, text: cancelLabel,
role: "cancel", role: "cancel",
cssClass: 'cancel-button', cssClass: "cancel-button",
handler: () => { handler: () => {
if (onCancel) { if (onCancel) {
onCancel(); onCancel();
@ -448,7 +444,13 @@ export class CommonService {
return false; return false;
} }
public openBrowser(url: string, onExit?, onFaild?, onSuccess?, successURLS?: string[]) { public openBrowser(
url: string,
onExit?,
onFaild?,
onSuccess?,
successURLS?: string[]
) {
console.log(url); console.log(url);
if (this.isCordova()) { if (this.isCordova()) {
this.openBrowserInApp(url, onExit, onFaild, onSuccess, successURLS); this.openBrowserInApp(url, onExit, onFaild, onSuccess, successURLS);
@ -458,39 +460,45 @@ export class CommonService {
} }
private openBrowserHtml(url, onExit?, onFaild?, onSuccess?) { 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("loaderror", () => {
browser.addEventListener('loadstart', () => {
});
browser.addEventListener('loaderror', () => {
if (onFaild) { if (onFaild) {
onFaild(); onFaild();
} }
}); });
browser.addEventListener('loadstop', () => { browser.addEventListener("loadstop", () => {
if (onSuccess) { if (onSuccess) {
onSuccess(); onSuccess();
} }
}); });
} }
private openBrowserInApp(url: string, onExit?, onFaild?, onSuccess?, successURLS?: string[]) { private openBrowserInApp(
url: string,
onExit?,
onFaild?,
onSuccess?,
successURLS?: string[]
) {
this.platform.ready().then(() => { this.platform.ready().then(() => {
const browser = this.iab.create(url, '_blank', 'closebuttoncolor=#60686b,hidenavigationbuttons=yes,hideurlbar=yes,zoom=no'); const browser = this.iab.create(
url,
"_blank",
"closebuttoncolor=#60686b,hidenavigationbuttons=yes,hideurlbar=yes,zoom=no"
);
// browser.executeScript(...); // browser.executeScript(...);
// browser.insertCSS(...); // browser.insertCSS(...);
browser.on('loaderror').subscribe(event => { browser.on("loaderror").subscribe(event => {
if (onFaild) { if (onFaild) {
onFaild(); onFaild();
} }
browser.close(); browser.close();
}); });
/* /*
browser.on('loadstop').subscribe(event => { browser.on('loadstop').subscribe(event => {
// browser.insertCSS({ code: 'body{color: white;}' }); // browser.insertCSS({ code: 'body{color: white;}' });
@ -500,17 +508,16 @@ export class CommonService {
}); });
*/ */
browser.on('exit').subscribe(event => { browser.on("exit").subscribe(event => {
if (onExit) { if (onExit) {
onExit(); onExit();
} }
}); });
browser.on('loadstart').subscribe(event => { browser.on("loadstart").subscribe(event => {
if (successURLS) { if (successURLS) {
successURLS.forEach((successURL, index) => { successURLS.forEach((successURL, index) => {
if (event.url && (event.url.indexOf(successURL) >= 0)) { if (event.url && event.url.indexOf(successURL) >= 0) {
// alert('load start found success url'); // alert('load start found success url');
browser.close(); browser.close();
if (onSuccess) { if (onSuccess) {
@ -520,13 +527,9 @@ export class CommonService {
}); });
} }
}); });
}); });
} }
public imageFromBase64(base64: string) { public imageFromBase64(base64: string) {
return "data:image/jpeg;base64," + base64; return "data:image/jpeg;base64," + base64;
} }
@ -534,17 +537,16 @@ export class CommonService {
public openLocation(lat: number, lng: number) { public openLocation(lat: number, lng: number) {
this.platform.ready().then(() => { this.platform.ready().then(() => {
this.launchNavigation.navigate([lat, lng]).then( this.launchNavigation.navigate([lat, lng]).then(
() => { }, () => {},
err => { err => {
// this.failedToOpenMap(); // this.failedToOpenMap();
window.open('https://maps.google.com/?q=' + lat + ',' + lng); window.open("https://maps.google.com/?q=" + lat + "," + lng);
} }
); );
}); });
} }
private failedToOpenMap() { private failedToOpenMap() {
this.presentAlert(this.ts.trPK("error", "map")); this.presentAlert(this.ts.trPK("error", "map"));
} }
public localizeTime(date: Date) { public localizeTime(date: Date) {
@ -562,12 +564,22 @@ export class CommonService {
const lng = TranslatorService.getCurrentLanguageName(); const lng = TranslatorService.getCurrentLanguageName();
let dateStr; let dateStr;
if (lng === TranslatorService.AR) { if (lng === TranslatorService.AR) {
dateStr = CommonService.months_ar[date.getMonth()] + ' ' + date.getDate() + ' ' + date.getFullYear(); dateStr =
CommonService.months_ar[date.getMonth()] +
" " +
date.getDate() +
" " +
date.getFullYear();
} else { } else {
dateStr = CommonService.months_en[date.getMonth()] + ' ' + date.getDate() + ',' + date.getFullYear(); 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) { public localizeMonth(monthIndex) {
@ -596,9 +608,17 @@ export class CommonService {
public evaluateDateShort(dateStr: string): string { public evaluateDateShort(dateStr: string): string {
const date = this.evaluteDateAsObject(dateStr); const date = this.evaluteDateAsObject(dateStr);
if (date) { if (date) {
return date.getMonth() + 1 + "/" + date.getFullYear().toString().substr(2); return (
date.getMonth() +
1 +
"/" +
date
.getFullYear()
.toString()
.substr(2)
);
} else { } else {
return '--'; return "--";
} }
} }
public convertISODateToJsonDate(isoDate: string): string { public convertISODateToJsonDate(isoDate: string): string {
@ -614,13 +634,13 @@ export class CommonService {
*/ */
public convertIsoDateToObject(isoDate: string, isoTime: string): Date { public convertIsoDateToObject(isoDate: string, isoTime: string): Date {
const date = new Date(isoDate); const date = new Date(isoDate);
const parts = isoTime.split(':'); const parts = isoTime.split(":");
if (this.hasData(parts)) { if (this.hasData(parts)) {
// remove if numbers start with 0 // remove if numbers start with 0
let hrsStr = parts[0]; let hrsStr = parts[0];
let msStr = parts[1]; let msStr = parts[1];
hrsStr = hrsStr[0] == '0' ? hrsStr.substr(1) : hrsStr; hrsStr = hrsStr[0] == "0" ? hrsStr.substr(1) : hrsStr;
msStr = msStr[0] == '0' ? msStr.substr(1) : msStr; msStr = msStr[0] == "0" ? msStr.substr(1) : msStr;
date.setHours(Number(hrsStr)); date.setHours(Number(hrsStr));
date.setMinutes(Number(msStr)); date.setMinutes(Number(msStr));
} }
@ -634,7 +654,7 @@ export class CommonService {
date.setTime(date.getTime() + timezoneOffset); date.setTime(date.getTime() + timezoneOffset);
return date; return date;
} }
return null return null;
} }
public evaluteDateAsObject(dateStr: string): Date { public evaluteDateAsObject(dateStr: string): Date {
@ -717,7 +737,7 @@ export class CommonService {
return targetCode >= minDigit && targetCode <= maxDigit; return targetCode >= minDigit && targetCode <= maxDigit;
} }
public enterPage() { } public enterPage() {}
private smsAlertDialog = null; private smsAlertDialog = null;
public presentSMSPasswordDialog( public presentSMSPasswordDialog(
@ -748,8 +768,8 @@ export class CommonService {
{ {
text: this.ts.trPK("general", "cancel"), text: this.ts.trPK("general", "cancel"),
role: "cancel", role: "cancel",
cssClass: 'cancel-button', cssClass: "cancel-button",
handler: () => { } handler: () => {}
}, },
{ {
text: this.ts.trPK("general", "ok"), text: this.ts.trPK("general", "ok"),
@ -817,7 +837,12 @@ export class CommonService {
] ]
}; };
} }
public getGraphDataSet(title: string, data: number[], color: string, fill = false) { public getGraphDataSet(
title: string,
data: number[],
color: string,
fill = false
) {
return { return {
label: title, label: title,
data: data, data: data,
@ -833,7 +858,14 @@ export class CommonService {
}; };
} }
public get2SeriesMultiGraphData(dataList: any[], value1Key, title1, value2Key, title2, labels: string[]) { public get2SeriesMultiGraphData(
dataList: any[],
value1Key,
title1,
value2Key,
title2,
labels: string[]
) {
const series1: number[] = []; const series1: number[] = [];
const series2: number[] = []; const series2: number[] = [];
@ -843,8 +875,8 @@ export class CommonService {
} }
const dataSets = [ const dataSets = [
this.getGraphDataSet(this.ts.trInline(title1), series1, '#d12026'), this.getGraphDataSet(this.ts.trInline(title1), series1, "#d12026"),
this.getGraphDataSet(this.ts.trInline(title2), series2, '#60686b') this.getGraphDataSet(this.ts.trInline(title2), series2, "#60686b")
]; ];
return this.getGraphMultiSeries(labels, dataSets); return this.getGraphMultiSeries(labels, dataSets);
} }
@ -912,6 +944,9 @@ export class CommonService {
public openAbsencePage() { public openAbsencePage() {
this.nav.navigateForward(["/absence/home"]); this.nav.navigateForward(["/absence/home"]);
} }
public openSubmitAbsencePage() {
this.nav.navigateForward(["/absence/submit-absence"]);
}
public reload(url: string, from: string) { public reload(url: string, from: string) {
console.log("force reload called from:" + from); console.log("force reload called from:" + from);
@ -962,7 +997,6 @@ export class CommonService {
this.nav.navigateForward(["/authentication/smspage"]); this.nav.navigateForward(["/authentication/smspage"]);
} }
public navigateTo(url: string) { public navigateTo(url: string) {
this.nav.navigateForward([url]); this.nav.navigateForward([url]);
} }
@ -990,35 +1024,40 @@ export class CommonService {
public checkBlueTooth(feedback: any) { public checkBlueTooth(feedback: any) {
this.platform.ready().then(() => { this.platform.ready().then(() => {
this.diagnostic
this.diagnostic.getBluetoothState() .getBluetoothState()
.then((state) => { .then(state => {
if (state == this.diagnostic.bluetoothState.POWERED_ON) { if (state == this.diagnostic.bluetoothState.POWERED_ON) {
feedback(); feedback();
} else { } else {
this.presentAlert(this.ts.trPK('bluetooth', 'start')); this.presentAlert(this.ts.trPK("bluetooth", "start"));
} }
}).catch(e => { })
this.presentAlert(this.ts.trPK('bluetooth', 'start')) .catch(e => {
this.presentAlert(this.ts.trPK("bluetooth", "start"));
}); });
}); });
} }
public callPhoneNumber(phoneNumber: string) { public callPhoneNumber(phoneNumber: string) {
this.platform.ready().then(() => { this.platform.ready().then(() => {
if (this.isCordova()) { if (this.isCordova()) {
this.callNumber.callNumber(phoneNumber, true) this.callNumber
.then(res => { }).catch(err => { }); .callNumber(phoneNumber, true)
.then(res => {})
.catch(err => {});
} else { } else {
window.open('tel:' + phoneNumber); window.open("tel:" + phoneNumber);
// this.presentAlert(this.ts.trPK('error', 'call')); // this.presentAlert(this.ts.trPK('error', 'call'));
} }
}); });
} }
list_to_tree(list) { list_to_tree(list) {
let map = {}, node, roots = [], i; let map = {},
node,
roots = [],
i;
for (i = 0; i < list.length; i += 1) { for (i = 0; i < list.length; i += 1) {
map[list[i].MENU_NAME] = i; // initialize the map map[list[i].MENU_NAME] = i; // initialize the map
list[i].children = []; // initialize the children list[i].children = []; // initialize the children
@ -1034,5 +1073,42 @@ export class CommonService {
} }
return roots; return roots;
} }
public reverseFormatDate(date) {
let FormatedDate;
if (date) {
FormatedDate = date.replace(/\//g, "-");
FormatedDate = FormatedDate.replace(/ 00:00:00/g, "");
} else {
FormatedDate = date;
}
return FormatedDate;
}
public formatStandardDate(date) {
let FormatedDate;
if (date) {
FormatedDate = date.replace(/-/g, "/");
} else {
FormatedDate = date;
}
return FormatedDate;
}
public reverseFormatStandardDate(date) {
let FormatedDate;
if (date) {
FormatedDate = date.replace(/\//g, "-");
} else {
FormatedDate = date;
}
return FormatedDate;
}
public formatDate(date) {
let FormatedDate;
if (date) {
FormatedDate = date.replace(/-/g, "/");
FormatedDate = FormatedDate + " 00:00:00";
} else {
FormatedDate = date;
}
return FormatedDate;
}
} }

@ -33,7 +33,7 @@
<div> <div>
<ion-list no-lines *ngIf="empSubordinate && empSubordinate.length>0"> <ion-list no-lines *ngIf="empSubordinate && empSubordinate.length>0">
<ion-item no-border *ngFor="let subordinate of empSubordinate;let i=index" (click)="getDetails(i);"> <ion-item no-border *ngFor="let subordinate of empSubordinate;let i=index" (click)="getDetails(i);">
<ion-avatar item-start> <ion-avatar slot="start">
<!-- <img *ngIf="subordinate.EMPLOYEE_IMAGE" src="data:image/*;base64,{{ subordinate.EMPLOYEE_IMAGE}}"> --> <!-- <img *ngIf="subordinate.EMPLOYEE_IMAGE" src="data:image/*;base64,{{ subordinate.EMPLOYEE_IMAGE}}"> -->
<img [src]="subordinate.EMPLOYEE_IMAGE ? 'data:image/png;base64,'+subordinate.EMPLOYEE_IMAGE : '../assets/imgs/profile.png'"> <img [src]="subordinate.EMPLOYEE_IMAGE ? 'data:image/png;base64,'+subordinate.EMPLOYEE_IMAGE : '../assets/imgs/profile.png'">
</ion-avatar> </ion-avatar>

@ -45,7 +45,7 @@ export class DateTimeInput extends UiElement {
"<ion-item>" + "<ion-item>" +
" <ion-label class='daynamicForm-Label " + requiredClass + "' id='title' >" + this.label + "</ion-label>" + " <ion-label class='daynamicForm-Label " + requiredClass + "' id='title' >" + this.label + "</ion-label>" +
// " <div class='daynamicForm-DateTime " + disaledClass + "' id='" + this.elementId + "' data-dtvalue='" + this.value + "' " + this.disabled + ">" + this.value + "</div>" + // " <div class='daynamicForm-DateTime " + disaledClass + "' id='" + this.elementId + "' data-dtvalue='" + this.value + "' " + this.disabled + ">" + this.value + "</div>" +
"<ion-datetime displayFormat='DD/MM/YYYY' value=" + this.value + " id='" + this.elementId + "' data-dtvalue='" + this.value + "' " + this.disabled + "></ion-datetime>" + "<ion-datetime displayFormat='DD/MM/YYYY' value='" + this.value + "' id='" + this.elementId + "' data-dtvalue='" + this.value + "' " + this.disabled + "></ion-datetime>" +
// " <input class='daynamicForm-DateTime' type='text' id='" + this.elementId + "' value='" + this.value + "' "+this.disabled+" (click)='showDateTimePicker()'/>"+ // " <input class='daynamicForm-DateTime' type='text' id='" + this.elementId + "' value='" + this.value + "' "+this.disabled+" (click)='showDateTimePicker()'/>"+
// " <input class='daynamicForm-DateTime' type='date' id='" + this.elementId + "' value='" + dateValue+ "' "+this.disabled+" />"+ // " <input class='daynamicForm-DateTime' type='date' id='" + this.elementId + "' value='" + dateValue+ "' "+this.disabled+" />"+
// " <input class='daynamicForm-DateTime' type='time' id='" + this.elementId + "Time' value='" + timeValue + "' "+this.disabled+" />"+ // " <input class='daynamicForm-DateTime' type='time' id='" + this.elementId + "Time' value='" + timeValue + "' "+this.disabled+" />"+

@ -41,7 +41,7 @@ export class DateInput extends UiElement {
"<ion-item>" + "<ion-item>" +
" <ion-label class='daynamicForm-Label " + requiredClass + "' id='title' >" + this.label + "</ion-label>" + " <ion-label class='daynamicForm-Label " + requiredClass + "' id='title' >" + this.label + "</ion-label>" +
// " <div class='daynamicForm-DateTime " + disaledClass + "' id='" + this.elementId + "' data-dtvalue='" + this.value + "' " + this.disabled + ">" + this.value + "</div>" + // " <div class='daynamicForm-DateTime " + disaledClass + "' id='" + this.elementId + "' data-dtvalue='" + this.value + "' " + this.disabled + ">" + this.value + "</div>" +
"<ion-datetime displayFormat='DD/MM/YYYY' value=" + this.value + " id='" + this.elementId + "' data-dtvalue='" + this.value + "' " + this.disabled + "></ion-datetime>" + "<ion-datetime displayFormat='DD/MM/YYYY' value='" + this.value + "' id='" + this.elementId + "' data-dtvalue='" + this.value + "' " + this.disabled + "></ion-datetime>" +
// " <input class='daynamicForm-DateTime' type='text' id='" + this.elementId + "' value='" + this.value + "' "+this.disabled+" (click)='showDateTimePicker()'/>"+ // " <input class='daynamicForm-DateTime' type='text' id='" + this.elementId + "' value='" + this.value + "' "+this.disabled+" (click)='showDateTimePicker()'/>"+
// " <input class='daynamicForm-DateTime' type='date' id='" + this.elementId + "' value='" + dateValue+ "' "+this.disabled+" />"+ // " <input class='daynamicForm-DateTime' type='date' id='" + this.elementId + "' value='" + dateValue+ "' "+this.disabled+" />"+
// " <input class='daynamicForm-DateTime' type='time' id='" + this.elementId + "Time' value='" + timeValue + "' "+this.disabled+" />"+ // " <input class='daynamicForm-DateTime' type='time' id='" + this.elementId + "Time' value='" + timeValue + "' "+this.disabled+" />"+

@ -23,19 +23,19 @@ export class SelectInput extends UiElement {
if (this.disabled == "N") { this.disabled = "disabled" } else { this.disabled = "" } if (this.disabled == "N") { this.disabled = "disabled" } else { this.disabled = "" }
if (this.hidden == "N") { this.hidden = "display:none;" } else { this.hidden = "" } if (this.hidden == "N") { this.hidden = "display:none;" } else { this.hidden = "" }
const template = const template =
// "<div class='custom-text-area-element' style='" + this.hidden + "'>" + "<div class='custom-text-area-element' style='" + this.hidden + "'>" +
// "<label class='daynamicForm-Label " + requiredClass + "' id='title' >" + this.label + "</label>" + "<label class='daynamicForm-Label " + requiredClass + "' id='title' >" + this.label + "</label>" +
// "<select class='daynamicForm-Select' id='" + this.elementId + "' " + this.disabled + ">" + "<select class='daynamicForm-Select' id='" + this.elementId + "' " + this.disabled + ">" +
// "<option value='" + this.value + "' >" + this.value + "</option>" + "<option value='" + this.value + "' >" + this.value + "</option>" +
// "</select>" + "</select>" +
// "</div> "; "</div> ";
"<ion-item style='" + this.hidden + "'>" + // "<ion-item style='" + this.hidden + "'>" +
"<ion-label id='title' >" + this.label + "</ion-label>" + // "<ion-label id='title' >" + this.label + "</ion-label>" +
"<ion-select id='" + this.elementId + "' " + this.disabled + ">" + // "<ion-select id='" + this.elementId + "' " + this.disabled + ">" +
"<ion-select-option value='" + this.value + "' >" + this.value + "</ion-select-option>" +
"</ion-select>" + // "</ion-select>" +
"</ion-item> "; // "</ion-item> ";
return template; return template;
} }

@ -297,6 +297,10 @@
"en": "Done successfully", "en": "Done successfully",
"ar": "تم بنجاح" "ar": "تم بنجاح"
}, },
"next":{
"en":"Next",
"ar":"التالي"
},
"other": { "other": {
"en": "Other", "en": "Other",
"ar": "أخري" "ar": "أخري"
@ -1073,5 +1077,78 @@
"en": "My Requests", "en": "My Requests",
"ar": "طلباتي" "ar": "طلباتي"
} }
},
"submitAbsence": {
"submitAbsence": {
"en":"Submit Absence",
"ar":"رفع إجازة"
},
"absenceStatus": {
"en": "Absence Status:",
"ar":"حالة الإجازة:"
},
"absenceType": {
"en": "Absence Type",
"ar":"نوع الإجازة"
},
"duration": {
"en": "Duration:",
"ar":"المدة:"
},
"startDate": {
"en": "Start Date",
"ar": "تاريخ البداية"
},
"startTime": {
"en":"Start Time",
"ar":"وقت البداية"
},
"endDate": {
"en": "End Date",
"ar":"تاريخ النهاية"
},
"endTime": {
"en":"End Time",
"ar": "وقت النهاية"
},
"totalDays": {
"en":"Total Days:",
"ar":"مجموع الأيام:"
},
"calculateDays": {
"en":"Calculate Days",
"ar":"حساب الأيام"
},
"search": {
"en":"Search",
"ar": "بحث"
},
"expectedReturnToWork": {
"en":"Expected Return to work",
"ar":"العودة المتوقعة إلى العمل"
},
"comments": {
"en":"Comments",
"ar": "ملاحظات"
},
"clear": {
"en": "Clear",
"ar":"إزالة"
},
"enterSDate": {
"en":"Please select the start date",
"ar":"ادخل تاريخ البداية"
},
"enterEDate": {
"en":"Please select the end date",
"ar":"ادخل تاريخ النهاية"
},
"selAbsType": {
"en":"Please select absence type",
"ar":"اختر نوع الإجازة"
}
} }
} }

@ -514,8 +514,8 @@ img.flipImg{
background-color: var(--light); background-color: var(--light);
border-bottom: var(--cusgray) solid 1px; border-bottom: var(--cusgray) solid 1px;
border-radius: 0px; border-radius: 0px;
-webkit-appearance: none; // -webkit-appearance: none;
-moz-appearance: none; // -moz-appearance: none;
text-indent: 1px; text-indent: 1px;
// text-overflow: ''; // text-overflow: '';
box-shadow: none; box-shadow: none;
@ -556,7 +556,7 @@ img.flipImg{
:root[dir="rtl"]{ :root[dir="rtl"]{
left: 5px; left: 5px;
} }
content: "";
z-index: 98; z-index: 98;
} }

Loading…
Cancel
Save