You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mohemmhmg/Mohem/src/app/eit/home/home.component.ts

67 lines
2.2 KiB
TypeScript

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;
pageType :string;
constructor(private cs: CommonService, private ts: TranslatorService) {
this.menu = this.cs.sharedService.getSharedData('menuEntries', false);
this.pageType = this.cs.sharedService.getSharedData('homemenuentries', false);
this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false);
const title: string = this.ts.trPK('eit', 'my-requests');
this.headerTitle = this.menu.PROMPT ? this.menu.PROMPT : 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;
}
}
console.log("selected>>>>>>>"+this.selectedMenu);
}
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.cs.openEitListPage();
}
if (menuEntry.REQUEST_TYPE === 'PAYSLIP'){
this.cs.openPayslipPage();
}
if (menuEntry.REQUEST_TYPE === 'TIME_CARD') {
this.cs.openTimeCardPage();
}
}
}