My Request Menu implemented

production
haroon amjad 6 years ago
parent ceb4968a69
commit 892082fb78

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>

1964
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",

@ -12,7 +12,8 @@ const routes: Routes = [
{ 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: 'attendance', loadChildren: './attendance/attendance.module#AttendancePageModule' },
{ path: 'eit', loadChildren: './eit/eit.module#EITPageModule' }
];

@ -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,37 @@
<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 col-12 class="menu-name">
<div [ngClass]="{'selectedDiv': selectedMenu == i,'notSelected': selectedMenu != i }">
<ion-text>
<b>{{menuItem.PROMPT}}</b>
<ion-icon [name]="selectedMenu == i? 'ios-arrow-down' : 'ios-arrow-forward'"
*ngIf="menuItem.children && menuItem.MENU_ENTRY_TYPE=='MENU'" slot="end"></ion-icon>
</ion-text>
</div>
<!-- Child Pages -->
<ion-list [hidden]="selectedMenu != i">
<ion-item class="childItem" *ngFor="let subPage of menuItem.children;let i2=index" text-wrap
(click)="openPage(subPage)">
<ion-row>
<ion-col col-11 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-item>
</ion-list>
</ion-content>

@ -0,0 +1,62 @@
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;
}
// .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,59 @@
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.navCtrl.push('AbsenceListPage');
// this.cs.open
} 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();
}

@ -12,6 +12,8 @@ export class LoginRequest extends Request {
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
}

@ -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"),
@ -901,7 +900,9 @@ export class CommonService {
public openAccuralPage() {
this.nav.navigateForward(["/accrual-balances/home"]);
}
public openEITPage() {
this.nav.navigateForward(["/eit/homepage"]);
}
public openMyTeamPage() {
this.nav.navigateForward(["/my-team/home"]);
}
@ -1012,4 +1013,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,7 +39,8 @@ 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() {
@ -53,8 +56,7 @@ export class HomePage implements OnInit {
});
}
ionViewDidLoad()
{
ionViewDidLoad() {
this.geolocation.getCurrentPosition().then((resp) => {
// resp.coords.latitude
// resp.coords.longitude
@ -113,9 +115,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();
}

@ -1033,7 +1033,6 @@
}
},
"myTeam": {
"requestFor": {
"en": "Request for",
"ar": "اطلب ل"
@ -1068,5 +1067,11 @@
"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