My Request Menu implemented
parent
ceb4968a69
commit
892082fb78
File diff suppressed because it is too large
Load Diff
@ -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"> {{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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue