absence list added

production
Sultan Khan 7 years ago
commit a3d58d4b1c

2
Mohem/.gitignore vendored

@ -11,6 +11,8 @@ log.txt
*.sublime-workspace
.vscode/
npm-debug.log*
package-lock.json
package.json
.idea/
.ionic/

@ -85,10 +85,6 @@
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^4.0.0" />
<plugin name="cordova-plugin-cszbar" spec="1.3.4" />
<plugin name="cordova-plugin-geolocation" spec="4.0.1">
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value="To fetch location for marking attendance" />
</plugin>
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-android-support-gradle-release" spec="^3.0.1">
<variable name="ANDROID_SUPPORT_VERSION" value="27.+" />
@ -124,4 +120,8 @@
<engine name="browser" spec="5.0.4" />
<engine name="ios" spec="4.5.5" />
<engine name="android" spec="7.1.4" />
<plugin name="cordova-plugin-geolocation" spec="4.0.1">
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value="To fetch location for marking attendance" />
</plugin>
<plugin name="cordova-plugin-cszbar" spec="1.3.4" />
</widget>

1988
Mohem/package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -25,7 +25,6 @@
"@ionic-native/app-availability": "^5.8.0",
"@ionic-native/app-rate": "^5.8.0",
"@ionic-native/background-geolocation": "^5.4.0",
"@ionic-native/geolocation": "^5.8.0",
"@ionic-native/badge": "^5.8.0",
"@ionic-native/barcode-scanner": "^5.8.0",
"@ionic-native/ble": "^5.8.0",
@ -35,6 +34,7 @@
"@ionic-native/device": "^5.8.0",
"@ionic-native/diagnostic": "^5.8.0",
"@ionic-native/fingerprint-aio": "^5.8.0",
"@ionic-native/geolocation": "^5.9.0",
"@ionic-native/globalization": "^5.8.0",
"@ionic-native/health": "^5.4.0",
"@ionic-native/in-app-browser": "^5.8.0",
@ -42,14 +42,13 @@
"@ionic-native/launch-navigator": "^5.8.0",
"@ionic-native/local-notifications": "^5.8.0",
"@ionic-native/native-storage": "^5.8.0",
"@ionic-native/push": "^5.8.0",
"@ionic-native/sms": "^5.8.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/sqlite": "^5.8.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic-native/themeable-browser": "^5.5.1",
"@ionic-native/zbar": "^5.8.0",
"@ionic-native/zbar": "^5.9.0",
"@ionic/angular": "^4.1.0",
"@ng-bootstrap/ng-bootstrap": "^4.2.1",
"@swimlane/ngx-charts": "^10.1.0",
@ -169,7 +168,6 @@
},
"cordova-plugin-camera": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-android-support-gradle-release": {},
"cordova-opentok-android-permissions": {},
"cordova-plugin-health": {
"HEALTH_READ_PERMISSION": "App needs read access to read heart rate",
@ -200,4 +198,4 @@
"android"
]
}
}
}

@ -0,0 +1,35 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { AbsenceListService } from "./service/service.service";
import { IonicModule } from '@ionic/angular';
import { AbsencePage } from './absence.page';
import { HomeComponent } from './home/home.component';
const routes: Routes = [
{
path: '',
component: AbsencePage,
children: [
{
path: 'home',
component: HomeComponent
}
]
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
providers:[AbsenceListService],
declarations: [AbsencePage, HomeComponent]
})
export class AbsencePageModule {}

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

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

@ -0,0 +1,116 @@
<ion-header >
<ion-toolbar class="header-toolbar">
<ion-title color="light">{{ts.trPK('absenceList','absenceList')}}</ion-title>
<ion-buttons slot="start">
<ion-back-button color="light" class="btnBack"></ion-back-button>
</ion-buttons>
<ion-buttons slot="end">
<button class="headerBtn" (click)="AccrualBalances()">
<img class="headerImg" src="../assets/imgs/accubalance.png">
</button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content padding>
<div class="no-dataDiv" *ngIf="!GetAbsenceTransactionList || GetAbsenceTransactionList.length <= 0" >
<ion-row>
<img class="empty-data" src="../assets/imgs/noData.png"/>
</ion-row>
<h4> {{ts.trPK('general','noData')}}</h4>
</div>
<div *ngIf="GetAbsenceTransactionList && GetAbsenceTransactionList.length > 0 ">
<ion-card *ngFor="let item of GetAbsenceTransactionList; let i=index;">
<ion-card-header class="boxHdr">
<div class="hrTitle">{{ts.trPK('absenceList','absHeader')}}</div>
<button ion-button *ngIf="item.ATTACHMENT_EXIST=='Y'" (click)="AttachmentDocuments(item.ABSENCE_ATTENDANCE_ID)">
<img class="imgSize" src="../assets/imgs/attachment.png"></button>
</ion-card-header>
<ion-card-content>
<ion-grid>
<div>
<ion-row>
<ion-col class="colBold">
<label for="">{{ts.trPK('absenceList','startDate')}} </label>
</ion-col>
<ion-col>
<label for=""> {{item.START_DATE}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold">
<label for="">{{ts.trPK('absenceList','endDate')}}</label>
</ion-col>
<ion-col>
<label for=""> {{item.END_DATE}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold">
<label for="">{{ts.trPK('absenceList','absenceType')}} </label>
</ion-col>
<ion-col>
<label for="">{{item.ABSENCE_TYPE}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold">
<label for="">{{ts.trPK('absenceList','absenceCategory')}}</label>
</ion-col>
<ion-col>
<label for="">{{item.ABSENCE_CATEGORY}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold">
<label for="">{{ts.trPK('absenceList','days')}}</label>
</ion-col>
<ion-col>
<label for="">{{item.ABSENCE_DAYS}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold">
<label for="">{{ts.trPK('absenceList','hours')}}</label>
</ion-col>
<ion-col>
<label for="">{{item.ABSENCE_HOURS}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold">
<label for="">{{ts.trPK('absenceList','approvalStatus')}}</label>
</ion-col>
<ion-col>
<label for="">{{item.APPROVAL_STATUS}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold">
<label for="">{{ts.trPK('absenceList','absenceStatus')}}</label>
</ion-col>
<ion-col>
<label for="">{{item.ABSENCE_STATUS}}</label>
</ion-col>
</ion-row>
</div>
</ion-grid>
</ion-card-content>
</ion-card>
</div>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content>
<ion-footer>
<div class="centerDiv">
<ion-button color="customnavy" class="gridBtn" (click)="CreateAbsence()">{{ts.trPK('absenceList','createAbs')}}</ion-button>
</div>
</ion-footer>

@ -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,145 @@
import { Component, OnInit } from "@angular/core";
import { CommonService } from "src/app/hmg-common/services/common/common.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 { MenuService } from "src/app/hmg-common/services/menu/menuservice.service";
import { AbsenceAttahcmentResponse } from "../models/abs.attach.response";
import { AbsenceListService } from "../service/service.service";
@Component({
selector: "app-home",
templateUrl: "./home.component.html",
styleUrls: ["./home.component.scss"]
})
export class HomeComponent implements OnInit {
P_PAGE_NUM: number;
P_PAGE_LIMIT: number;
GetAbsenceTransactionList: any;
IsReachEnd: boolean = false;
selEmp: string = "";
respID: number;
selMenu: MenuResponse;
constructor(
public common: CommonService,
public ts: TranslatorService,
public menuService: MenuService,
public absService: AbsenceListService
) {}
ngOnInit() {
this.selMenu = this.common.sharedService.getSharedData(
MenuResponse.SHARED_DATA,
true
);
this.selEmp = this.common.sharedService.getSharedData(
MenuResponse.SHARED_SEL_EMP,
true
);
this.respID = this.common.sharedService.getSharedData(
MenuResponse.SHARED_SEL_RESP_ID,
true
);
this.getAbsenceTransaction();
}
AccrualBalances() {
this.common.openAccuralPage();
}
AttachmentDocuments(id) {
const request = {
P_ABSENCE_ATTENDANCE_ID: id
};
this.absService
.getAbsenceAttachment(request)
.subscribe((result: AbsenceAttahcmentResponse) => {
this.handleAbsAttachResult(result);
});
}
private handleAbsAttachResult(result) {
if (this.common.validResponse(result)) {
if (this.common.hasData(result.GetAbsenceAttachmentsList)) {
this.common.sharedService.setSharedData(
result.GetAbsenceAttachmentsList,
AbsenceAttahcmentResponse.SHARED_DATA
);
// this.navCtrl.push("AbsenceAttachmentPage");
} else {
let msg: string = "";
// msg=this.translate.translate("general.notAttch");
// this.common.showAlert(msg);
}
//this.GetAbsenceTransactionList =result.GetAbsenceTransactionList;
}
}
getAbsenceTransaction() {
this.IsReachEnd = false;
const request = {
P_SELECTED_EMPLOYEE_NUMBER: this.selEmp,
P_MENU_TYPE: this.selMenu.List_Menu.MENU_TYPE,
P_SELECTED_RESP_ID: this.respID,
P_PAGE_NUM: this.P_PAGE_NUM,
P_PAGE_LIMIT: this.P_PAGE_LIMIT
};
this.absService.getAbsenceList(request).subscribe((result: any) => {
this.handleAbsListResult(result);
});
}
private handleAbsListResult(result) {
if (this.common.validResponse(result)) {
if (this.common.hasData(result.GetAbsenceTransactionList)) {
this.GetAbsenceTransactionList = result.GetAbsenceTransactionList;
this.P_PAGE_NUM++;
let lastItemIndex = this.GetAbsenceTransactionList.length - 1;
if (result.GetAbsenceTransactionList[lastItemIndex]) {
let lastitem = result.GetAbsenceTransactionList[lastItemIndex];
if (lastitem.NO_OF_ROWS == lastitem.ROW_NUM) {
this.IsReachEnd = true;
} else {
this.IsReachEnd = false;
}
}
}
}
}
doInfinite(infiniteScroll) {
if (!this.IsReachEnd) {
//this.P_PAGE_NUM++;
const request = {
P_SELECTED_EMPLOYEE_NUMBER: this.selEmp,
P_MENU_TYPE: this.selMenu.List_Menu.MENU_TYPE,
P_SELECTED_RESP_ID: this.respID,
P_PAGE_NUM: this.P_PAGE_NUM,
P_PAGE_LIMIT: this.P_PAGE_LIMIT
};
this.absService.getAbsenceList(request).subscribe(
(result: any) => {
if (this.common.validResponse(result)) {
if (this.common.hasData(result.GetWorkList)) {
this.P_PAGE_NUM++;
result.GetAbsenceTransactionList.forEach(vr => {
if (vr.ROW_NUM == vr.NO_OF_ROWS) {
this.IsReachEnd = true;
} else {
this.IsReachEnd = false;
}
this.GetAbsenceTransactionList.push(vr);
// this.pro.GetVacationRulesList.push(vr);
});
} else {
this.IsReachEnd = true;
}
}
//this.P_PAGE_NUM++;
if (infiniteScroll) infiniteScroll.complete();
// console.log(resFlag);
},
Error => console.log(Error),
() => infiniteScroll.complete()
);
} else {
if (infiniteScroll) infiniteScroll.complete();
}
}
}

@ -0,0 +1,6 @@
import {Response} from './response'
import {AbsenceAttahcment} from './abs.attach'
export class AbsenceAttahcmentResponse extends Response{
public static SHARED_DATA = 'absence-attachment';
public GetAbsenceAttachmentsList :AbsenceAttahcment[];
}

@ -0,0 +1,16 @@
export class AbsenceAttahcment{
public SEQ_NUM:number;
public ATTACHED_DOCUMENT_ID:number;
public FILE_NAME: string;
public DOCUMENT_ID: number;
public FILE_DATA: string;
public CATEGORY_ID: number;
public PK1_VALUE: string;
public DATATYPE_ID: number;
public PK2_VALUE: string;
public ENTITY_NAME: string;
public PK3_VALUE: string;
public FILE_ID: number;
public PK4_VALUE: string;
public PK5_VALUE: string;
}

@ -0,0 +1,41 @@
import {Response} from './response'
export class AbsenceDffResponse extends Response{
public static SHARED_DATA = 'absence_dff_resp';
public P_TRANSACTION_ID:number;
public APPLICATION_COLUMN_NAME:string;
public USED_FLAG:string;
public DESC_FLEX_NAME:string;
public DESC_FLEX_CONTEXT_CODE:string;
public DESC_FLEX_CONTEXT_NAME:string;
public SEGMENT_SEQ_NUM:number;
public SEGMENT_NAME:string;
public SEGMENT_PROMPT:string;
public ENABLED_FLAG:string;
public REQUIRED_FLAG:string;
public DISPLAY_FLAG :string;
public READ_ONLY:string;
public DEFAULT_TYPE:string;
public DEFAULT_VALUE:string;
public LONGLIST_FLAG:string;
public FLEX_VALUE_SET_NAME:string;
public VALIDATION_TYPE :string;
public VALIDATION_TYPE_DSP :string;
public FORMAT_TYPE :string;
public FORMAT_TYPE_DSP :string;
public MAXIMUM_SIZE: number;
public ALPHANUMERIC_ALLOWED_FLAG :string;
public UPPERCASE_ONLY_FLAG :string;
public NUMERIC_MODE_ENABLED_FLAG:string;
public NUMBER_PRECISION :string;
public MINIMUM_VALUE :string;
public MAXIMUM_VALUE :string;
public PARENT_SEGMENTS_VS :string;
public PARENT_SEGMENTS_DV :string;
public MOBILE_ENABLED :string;
public CHILD_SEGMENTS_DV :string;
public PARENT_SEGMENTS_VS_SplitedVS:any;
public CHILD_SEGMENTS_VS_Splited:any;
public CHILD_SEGMENTS_VS:string;
public PARENT_SEGMENTS_DV_Splited: any;
public CHILD_SEGMENTS_DV_Splited: any;
}

@ -0,0 +1,5 @@
import {Response} from './response'
export class AbsenceResponse extends Response{
public static SHARED_DATA = 'absence_tr_id';
public P_TRANSACTION_ID:number;
}

@ -0,0 +1,43 @@
import { Request } from './request';
export class AbsenceTransaction extends Request{
public static SHARED_DATA = 'absence_transaction';
public P_SELECTED_EMPLOYEE_NUMBER:string;
public P_MENU_TYPE :string;
public P_SELECTED_RESP_ID:number;
public P_FUNCTION_NAME :string;
public P_ABSENCE_ACTION :string;
public P_ABSENCE_ATTENDANCE_ID = null;
public P_ITEM_KEY: string ;
public P_ABSENCE_ATTENDANCE_TYPE_ID: number ;
public P_DATE_START: string ;
public P_DATE_END: string ;
public P_TIME_START:string ;
public P_TIME_END:string ;
public P_DESC_FLEX_CONTEXT_CODE:string ;
public P_REPLACEMENT_USER_NAME:string ;
public P_ATTRIBUTE1:string ;
public P_ATTRIBUTE2 :string ;
public P_ATTRIBUTE3:string ;
public P_ATTRIBUTE4 :string ;
public P_ATTRIBUTE5 :string ;
public P_ATTRIBUTE6 :string ;
public P_ATTRIBUTE7 :string ;
public P_ATTRIBUTE8 :string ;
public P_ATTRIBUTE9 :string ;
public P_ATTRIBUTE10 :string ;
public P_ATTRIBUTE11 :string ;
public P_ATTRIBUTE12 :string ;
public P_ATTRIBUTE13 :string ;
public P_ATTRIBUTE14 :string ;
public P_ATTRIBUTE15 :string ;
public P_ATTRIBUTE16 :string;
public P_ATTRIBUTE17 :string;
public P_ATTRIBUTE18 :string;
public P_ATTRIBUTE19 :string;
public P_ATTRIBUTE20 :string;
public P_ABSENCE_COMMENTS:string;
}

@ -0,0 +1,9 @@
export class ApproversList {
public LINE_NO:number;
public APPROVER:string;
public APPROVER_TYPE:string;
public ROW_NUM:number;
public NO_OF_ROWS:number;
}

@ -0,0 +1,18 @@
export class Request {
public P_USER_NAME: string;
public LanguageID: number;
//public IPAdress: string;
public P_SESSION_ID: number;
public VersionID: number;
public Channel: number;
public P_PASSWORD: string;
public P_MOBILE_NUMBER: string;
public P_EMAIL_ADDRESS: string;
public TokenID:string;
public P_NOTIFICATION_ID:number;
public MobileNumber: string;
public UserName:string;
public LogInTokenID:string;
public MobileType:string;
}

@ -0,0 +1,11 @@
export class Response {
public LanguageID?: number;
public ErrorCode:string;
public ErrorEndUserMessage:string;
public ErrorMessage:string;
public ErrorType: number;
public MessageStatus: number;
public SuccessMsg:string;
public SuccessMsgN:string;
public IsAuthenticated:boolean;
}

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

@ -0,0 +1,29 @@
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'
import {AbsenceAttahcmentResponse} from '../models/abs.attach.response'
@Injectable()
export class AbsenceListService {
public static getAbsenceTransaction='Services/ERP.svc/REST/GET_ABSENCE_TRANSACTIONS';
public static getAbsenceAttachment='Services/ERP.svc/REST/GET_ABSENCE_ATTACHMENTS';
constructor(
public api: ConnectorService,
public authService: AuthenticationService,
) { }
public getAbsenceList(absence: any, onError?: any, errorLabel?: string): Observable<AbsenceTransaction> {
const request = absence;
this.authService.authenticateRequest(request);
return this.api.post(AbsenceListService.getAbsenceTransaction, request, onError, errorLabel);
}
public getAbsenceAttachment(absence: any, onError?: any, errorLabel?: string): Observable<AbsenceAttahcmentResponse> {
const request = absence;
this.authService.authenticateRequest(request);
return this.api.post(AbsenceListService.getAbsenceAttachment, request, onError, errorLabel);
}
}

@ -1,25 +1,27 @@
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
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',
data: { preload: true, delay: 1000 }
},
{ 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' }
const routes: Routes = [
{ path: '', redirectTo: 'authentication/login', pathMatch: 'full' },
{
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule',
data: { preload: true, delay: 1000 }
},
{ 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' }
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }

@ -102,6 +102,7 @@ export class LoginComponent implements OnInit, OnDestroy {
this.loginData.MobileNumber = result.MemberLoginList.P_MOBILE_NUMBER;
this.loginData.P_USER_NAME=this.username;
this.sharedData.setSharedData(this.loginData, AuthenticationService.LOGIN_DATA);
this.cs.sharedService.setSharedData(this.loginData.P_USER_NAME, LoginRequest.SHARED_DATA);
this.cs.openSMSPage();
}
// console.log("result.IsPasswordExpired");
@ -179,6 +180,7 @@ export class LoginComponent implements OnInit, OnDestroy {
console.log(result);
this.loginData.LogInTokenID = result.LogInTokenID;
this.loginData.P_USER_NAME = this.username;
this.cs.sharedService.setSharedData(this.loginData.P_USER_NAME, LoginRequest.SHARED_DATA);
this.sharedData.setSharedData(this.loginData, AuthenticationService.LOGIN_DATA);
this.sharedData.setSharedData(true,Password.IS_FORGET_PSW);
this.cs.stopLoading();

@ -0,0 +1,38 @@
import { HmgCommonModule } from 'src/app/hmg-common/hmg-common.module';
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 { EITPage } from './eit.page';
import { HomeComponent } from './home/home.component';
const routes: Routes = [
{
path: '',
component: EITPage,
children: [
{
path: 'homepage',
component: HomeComponent
}
]
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
HmgCommonModule,
RouterModule.forChild(routes)
],
declarations: [
EITPage,
HomeComponent
]
})
export class EITPageModule { }

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

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

@ -0,0 +1,38 @@
<ion-header>
<ion-toolbar class="header-toolbar">
<nav-buttons></nav-buttons>
<ion-title color="light">{{headerTitle}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<ion-list>
<ion-item lines="none" class="custCollabs ion-item-styling" *ngFor="let menuItem of menu; let i=index"
(click)="openPage(menuItem, i);">
<ion-row>
<!-- Parent Pages -->
<ion-col size="12" class="menu-name">
<div [ngClass]="{'selectedDiv': selectedMenu == i,'notSelected': selectedMenu != i }">
<ion-text>
<b>{{menuItem.PROMPT}}</b>
</ion-text>
</div>
<!-- Child Pages -->
<ion-list [hidden]="selectedMenu != i">
<ion-item lines="none" class="childItem" *ngFor="let subPage of menuItem.children;let i2=index" text-wrap
(click)="openPage(subPage)">
<ion-row>
<ion-col size="12" class="menu-name"><span ion-text color="color2">&nbsp;{{subPage.PROMPT}}</span>
</ion-col>
</ion-row>
</ion-item>
</ion-list>
</ion-col>
</ion-row>
<ion-icon [name]="selectedMenu == i? 'ios-arrow-down' : 'ios-arrow-forward'"
*ngIf="menuItem.children && menuItem.MENU_ENTRY_TYPE=='MENU'" slot="end" class="arrow-down"></ion-icon>
</ion-item>
</ion-list>
</ion-content>

@ -0,0 +1,67 @@
ion-item.custCollabs.item.item-block.item-md,
ion-item.custCollabs.item.item-block.item-ios {
padding: 0px;
}
.ion-item-styling {
-webkit-box-shadow: 0px 2px 7px 0px #7f8c8d;
-moz-box-shadow: 0px 2px 7px 0px #7f8c8d;
box-shadow: 0px 2px 7px 0px #7f8c8d;
color: #209a83 !important;
border: 0px;
border-radius: 5px;
line-height: 2;
margin: 8px 2px;
min-height: 40px;
}
ion-item.item.item-block {
.item-inner {
border: 0px !important;
padding: 0px !important;
}
ion-item.childItem.item.item-block {
padding: 0px 5px;
width: 100%;
ion-label.label.label-md,
ion-label.label.label-ios {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border-bottom: 1px solid #e4e5e7;
border-radius: 0px;
color: #000000;
}
}
ion-col.menu-name.col {
padding: 0px;
}
div.selectedDiv {
background: #209a83;
color: #ffffff;
padding: 0px 10px;
min-height: 40px;
}
div.notSelected {
padding: 0px 10px;
}
// ion-label.label.label-md,
// ion-label.label.label-ios {
}
ion-icon::before {
line-height: 2;
}
.arrow-down{
position: absolute;
top: 0;
right:0;
}
// .list-md > .item-block:last-child .item-inner,
// .list-ios > .item-block:last-child .item-inner{
// border-bottom: 1px solid #dedede;
// }

@ -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,58 @@
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { Component, OnInit } from '@angular/core';
import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response';
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 {
menu: any;
pages: any;
headerTitle: string;
selMenu: MenuResponse = new MenuResponse();
// Selected Side Menu
selectedMenu: any;
constructor(private cs: CommonService, private ts: TranslatorService) {
this.menu = this.cs.sharedService.getSharedData('menuEntries', false);
this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false);
let title: string = this.ts.trPK('eit', 'my-requests');
this.headerTitle = this.selMenu.List_Menu.MENU_NAME ? this.selMenu.List_Menu.MENU_NAME : title;
}
ngOnInit() { }
openPage(page, 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) {
this.goToRequest(page);
} else {
if (this.selectedMenu == 0) {
this.selectedMenu = -1;
} else if (this.selectedMenu != -1) {
this.selectedMenu = -1;
} else {
this.selectedMenu = index;
}
}
}
goToRequest(menuEntry) {
let selMenu: MenuResponse = new MenuResponse();
selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false);
selMenu.GetMenuEntriesList = menuEntry;
this.cs.sharedService.setSharedData(selMenu, MenuResponse.SHARED_DATA);
if (menuEntry.REQUEST_TYPE == 'ABSENCE') {
this.cs.openAbsencePage();
} else if (menuEntry.REQUEST_TYPE == 'EIT') {
// this.navCtrl.push('EitListPage');
}
}
}

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

@ -0,0 +1,23 @@
import { Observable } from 'rxjs';
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';
@Injectable({
providedIn: 'root'
})
export class EitService {
/* EIT Services URLs */
public static getMenuEntries = 'Services/ERP.svc/REST/GET_MENU_ENTRIES';
constructor(public authService: AuthenticationService, public con: ConnectorService) { }
public getMenuEntries(menuEntries: any, onError?: any, errorLabel?: string): Observable<any> {
const request = menuEntries;
this.authService.authenticateRequest(request);
console.log(request);
return this.con.post(EitService.getMenuEntries, request, onError, errorLabel);
}
}

@ -92,6 +92,7 @@ export class AuthenticationService {
request.TokenID = user.TokenID;
request.P_USER_NAME = user.EMPLOYEE_NUMBER;
request.UserName = user.EMPLOYEE_NUMBER;
if (AuthenticationService.requireRelogin) {
this.sessionTimeOutDialog();
}

@ -6,12 +6,14 @@ export class LoginRequest extends Request {
PatientMobileNumber: string; // "537753536"
SearchType: number; // 1 for iqama 2 for file number
TokenID: string; // ""
ZipCode: string; // "966"
ZipCode: string; // "966"
MobileNumber: string;
P_USER_NAME : string;
P_MOBILE_NUMBER : string;
P_PASSWORD : string;
P_LANGUAGE : string;
P_USER_NAME: string;
P_MOBILE_NUMBER: string;
P_PASSWORD: string;
P_LANGUAGE: string;
public static SHARED_DATA = 'login-request';
public static NATIONALITY_CODE = "Nationality_Code";
// isDentalAllowedBackend: false
isRegister: boolean; // false
}

@ -120,7 +120,7 @@ export class CommonService {
}
}
getSecondsAsDigitalClock(inputSeconds: number) {
var sec_num = parseInt(inputSeconds.toString(), 10); // don't forget the second param
var hours = Math.floor(sec_num / 3600);
@ -271,8 +271,7 @@ export class CommonService {
}
async JustAlertDialog(acceptLabel: string,
message: string)
{
message: string) {
this.clearAllAlerts();
const alert = await this.alertControllerIonic.create({
header: this.ts.trPK("general", "info"),
@ -397,7 +396,7 @@ export class CommonService {
{
text: acceptLabel,
handler: () => {
// this.openUserLogin();
// this.openUserLogin();
this.alertControllerIonic.dismiss();
}
}
@ -509,17 +508,17 @@ export class CommonService {
browser.on('loadstart').subscribe(event => {
if ( successURLS ) {
successURLS.forEach((successURL, index) => {
if (event.url && (event.url.indexOf(successURL) >= 0)) {
// alert('load start found success url');
browser.close();
if (onSuccess) {
onSuccess();
if (successURLS) {
successURLS.forEach((successURL, index) => {
if (event.url && (event.url.indexOf(successURL) >= 0)) {
// alert('load start found success url');
browser.close();
if (onSuccess) {
onSuccess();
}
}
}
});
}
});
}
});
});
@ -901,13 +900,19 @@ export class CommonService {
public openAccuralPage() {
this.nav.navigateForward(["/accrual-balances/home"]);
}
public openMyTeamPage(){
public openEITPage() {
this.nav.navigateForward(["/eit/homepage"]);
}
public openMyTeamPage() {
this.nav.navigateForward(["/my-team/home"]);
}
public openMyTeamDetails(){
public openMyTeamDetails() {
this.nav.navigateForward(["/my-team/details"]);
}
public openAbsencePage() {
this.nav.navigateForward(["/absence/home"]);
}
public reload(url: string, from: string) {
console.log("force reload called from:" + from);
// window.location.reload();
@ -929,7 +934,7 @@ export class CommonService {
public navigateBack(url: string) {
this.nav.navigateBack([url]);
}
private alternateNavigate(paths: string[], key: string, root = false) {
let url: string;
if (localStorage.getItem(key) === "yes") {
@ -949,7 +954,7 @@ export class CommonService {
public openLogin() {
this.nav.navigateRoot(["/authentication/login"]);
}
public openUserForgot() {
this.nav.navigateForward(["/authentication/checkuser"]);
}
@ -1012,4 +1017,22 @@ export class CommonService {
});
}
list_to_tree(list) {
let map = {}, node, roots = [], i;
for (i = 0; i < list.length; i += 1) {
map[list[i].MENU_NAME] = i; // initialize the map
list[i].children = []; // initialize the children
}
for (i = 0; i < list.length; i += 1) {
node = list[i];
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 {
roots.push(node);
}
}
return roots;
}
}

@ -1,3 +1,4 @@
import { EitService } from './../eit/services/eit.service';
import { Component, OnInit } from "@angular/core";
import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service";
import { MenuController, Events } from "@ionic/angular";
@ -12,6 +13,7 @@ import { Device } from "@ionic-native/device/ngx";
import { attendanceSwipeScannerRequest } from "./models/attendanceSwipe.Request";
import { Response } from "src/app/hmg-common/services/models/response";
import { AttendanceService } from "./services/attendance.services";
import { LoginRequest } from '../hmg-common/services/authentication/models/login.request';
@Component({
selector: "app-home",
@ -37,9 +39,11 @@ export class HomePage implements OnInit {
private device: Device,
private zbar: ZBar,
private geolocation: Geolocation,
private attendance_service: AttendanceService
private attendance_service: AttendanceService,
private eitService: EitService
) {}
ngOnInit() {
this.getUserDetails();
this.getMenu();
@ -56,18 +60,37 @@ export class HomePage implements OnInit {
});
}
// ionViewDidLoad() {
// this.geolocation
// .getCurrentPosition()
// .then(resp => {
// // resp.coords.latitude
// // resp.coords.longitude
// console.log(resp.coords.latitude);
// console.log(resp.coords.longitude);
// })
// .catch(error => {
// console.log("Error getting location", error);
// });
// this.geolocation.getCurrentPosition().then((resp) => {
// // resp.coords.latitude
// // resp.coords.longitude
// console.log(resp.coords.latitude);
// console.log(resp.coords.longitude);
// }).catch((error) => {
// console.log('Error getting location', error);
// });
// }
ionViewDidLoad() {
this.geolocation
.getCurrentPosition()
.then(resp => {
// resp.coords.latitude
// resp.coords.longitude
console.log(resp.coords.latitude);
console.log(resp.coords.longitude);
})
.catch(error => {
console.log("Error getting location", error);
});
this.geolocation.getCurrentPosition().then((resp) => {
// resp.coords.latitude
// resp.coords.longitude
console.log(resp.coords.latitude);
console.log(resp.coords.longitude);
}).catch((error) => {
console.log('Error getting location', error);
});
}
private openMenu() {
this.menu.toggle();
@ -118,9 +141,50 @@ export class HomePage implements OnInit {
} else if (item.MENU_TYPE == "S") {
//this.navCtrl.push('MySpecialistPage',{"mySpecList":item});
} else {
//this.getMenuEntries(item);
this.getMenuEntries(item);
}
}
getMenuEntries(item) {
let request: any = {};
let selEmpNo: string = null;
let nationality: string = null;
request.P_SELECTED_RESP_ID = -999;
if (item.MENU_TYPE == 'S') {
request.P_SELECTED_RESP_ID = item.RESP_ID;
} else {
selEmpNo = this.common.sharedService.getSharedData(LoginRequest.SHARED_DATA, false);
}
nationality = this.common.sharedService.getSharedData(LoginRequest.NATIONALITY_CODE, false);
request.P_SELECTED_EMPLOYEE_NUMBER = selEmpNo;
request.P_MENU_TYPE = item.MENU_TYPE;
request.NationalityCode = nationality;
//set emp and resp id
this.common.sharedService.setSharedData(selEmpNo, MenuResponse.SHARED_SEL_EMP);
this.common.sharedService.setSharedData(request.P_SELECTED_RESP_ID, MenuResponse.SHARED_SEL_RESP_ID);
this.eitService.getMenuEntries(
request).
subscribe((result: MenuResponse) => {
this.handleMenuEntiresResult(result);
});
}
sortMenuEntires(list) {
let tree = this.common.list_to_tree(list);
this.common.sharedService.setSharedData(tree, 'menuEntries');
// this.common.navigateForward("/eit/homepage");
this.common.openEITPage();
}
private handleMenuEntiresResult(result) {
if (this.common.validResponse(result)) {
if (this.common.hasData(result.GetMenuEntriesList)) {
this.sortMenuEntires(result.GetMenuEntriesList);
}
}
}
private Change_password() {
this.common.openChangePassword();
}
@ -135,8 +199,7 @@ export class HomePage implements OnInit {
}
scanCode() {
this.zbar
.scan(this.zbarOptions)
this.zbar.scan(this.zbarOptions)
.then(result => {
console.log(result); // Scanned code
let strResult = JSON.parse(result);
@ -159,8 +222,8 @@ export class HomePage implements OnInit {
request.UserName = this.userData.EMPLOYEE_NUMBER;
console.log("request");
console.log(JSON.stringify(request));
this.attendance_service
.attendanceSwipeScanner(request, () => {
this.attendance_service.attendanceSwipeScanner(
request, () => {
console.log("Error inside in swipe attendance");
})
.subscribe((result: Response) => {

@ -765,7 +765,7 @@
},
"confirmPassword": {
"en": "Confirm Password",
"ar": "تأكيد كلمة المرور"
"ar": "تأكيد كلمة المرور"
},
"newPassword": {
"en": "New Password",
@ -1019,54 +1019,59 @@
}
},
"accrualBalances": {
"accrualBalances":{
"en":"Accrual Balances",
"ar":"رصيد حساب المستحقات"
},
"selectDate":{
"accrualBalances": {
"en": "Accrual Balances",
"ar": "رصيد حساب المستحقات"
},
"selectDate": {
"en": "Select Date",
"ar": "اختر التاريخ"
},
"tip":{
"en":"<p>Enter the <span class=\"boldTxtNav\">date</span> for which you wish to view your accrual balances.</p>",
"ar":"<p>أدخل <span class=\"boldTxtNav\">التاريخ</span> الذي تريد عرض الإستحقاقات له</p>"
"tip": {
"en": "<p>Enter the <span class=\"boldTxtNav\">date</span> for which you wish to view your accrual balances.</p>",
"ar": "<p>أدخل <span class=\"boldTxtNav\">التاريخ</span> الذي تريد عرض الإستحقاقات له</p>"
}
},
"myTeam":{
"requestFor":{
"en":"Request for",
"ar":"اطلب ل"
"myTeam": {
"requestFor": {
"en": "Request for",
"ar": "اطلب ل"
}
},
"searchForReplacment": {
"searchForReplacment": {
"en":"Search for an Employee",
"ar":"ابحث عن موظف"
"en": "Search for an Employee",
"ar": "ابحث عن موظف"
},
"searchBy": {
"en": " Search by",
"ar": " البحث بـ"
},
"name":{
"en":"Name",
"ar":"الاسم"
"name": {
"en": "Name",
"ar": "الاسم"
},
"userName": {
"en":"User Name",
"ar":"اسم المستخدم"
"en": "User Name",
"ar": "اسم المستخدم"
},
"email": {
"en":"Email",
"ar":"البريد الإلكتروني"
"en": "Email",
"ar": "البريد الإلكتروني"
},
"search": {
"en":"Search",
"ar":"بحث"
"en": "Search",
"ar": "بحث"
},
"tip":{
"en": "You can search for an employee by <span class=\"boldTxtNav\">Name </span>, <span class=\"boldTxtNav\">User Name </span> and <span class=\"boldTxtNav\">Email </span>",
"ar":"يمكنك البحث عن موظف ب <span class=\"boldTxtNav\">الاسم </span>, <span class=\"boldTxtNav\">اسم المستخدم </span> ,أو <span class=\"boldTxtNav\">البريد الإلكتروني </span>"
"tip": {
"en": "You can search for an employee by <span class=\"boldTxtNav\">Name </span>, <span class=\"boldTxtNav\">User Name </span> and <span class=\"boldTxtNav\">Email </span>",
"ar": "يمكنك البحث عن موظف ب <span class=\"boldTxtNav\">الاسم </span>, <span class=\"boldTxtNav\">اسم المستخدم </span> ,أو <span class=\"boldTxtNav\">البريد الإلكتروني </span>"
}
},
"eit": {
"my-requests": {
"en": "My Requests",
"ar": "طلباتي"
}
}
}

@ -35,6 +35,7 @@ body{
ion-label{
color:var(--labelColor) !important;
}
.tipsPadding{
padding: 0px 10px;
}

Loading…
Cancel
Save