import { Component, OnInit } from '@angular/core'; import { Platform, Events, MenuController } from '@ionic/angular'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user'; import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service'; import { MowadhafiService } from '../mowadhafi.service'; import { Location } from '@angular/common'; import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; import { LoginModel } from 'src/app/authentication/models/LoginModel'; import { SendActivationByType } from 'src/app/authentication/models/sendActivationByType'; @Component({ selector: 'app-hr-request', templateUrl: './hr-request.component.html', styleUrls: ['./hr-request.component.scss'], }) export class HRRequestComponent implements OnInit { public EmpName : string; public EmpNum : string; public EmpGroup : string; public EmpMobile : string; public EmpJob : string; public EmpOrgName : string; public EmpPayrol : string; public EmpPosition : string; public EmpEmail: string; public EmpCatMeaning:string; public EmpGRADENAME : string; public EmpLocation : string; public EmpImg : string; public userImage: any = '../assets/imgs/profile.png'; public loginData = new LoginModel(); public searchKeySelect = 'Complaints'; myColor: string = 'secondary'; public showRequestDetails = false; public proID= "CS" public direction: string; constructor( public ts: TranslatorService, public cs: CommonService, public authService: AuthenticationService, public sharedData: SharedDataService, public events: Events, public MowadhafiService: MowadhafiService, private location: Location, private menu: MenuController, ) { this.direction = TranslatorService.getCurrentLanguageName(); } ngOnInit() { this.getUserInformation(); this.getTicketTypes(); this.getProject(); this.getProjectDepartments(); this.getDepartmentSections(); this.getSectionTopics(); } goback() { this.location.back(); } getUserInformation(){ const request = { // P_SELECTED_EMPLOYEE_NUMBER:"121816", P_SELECTED_RESP_ID:-999, P_PAGE_NUM:1, P_PAGE_LIMIT:1 }; this.MowadhafiService.getUserInfo(request, ()=> {} , this.ts.trPK('general', 'retry')).subscribe((result)=> { this.handleUserInfoResult(result); }) } handleUserInfoResult(result){ this.EmpName = result.MemberInformationList[0].EMPLOYEE_NAME; console.log("____________" + this.EmpName); this.EmpNum = result.MemberInformationList[0].EMPLOYEE_NUMBER; this.EmpGroup = result.MemberInformationList[0].BUSINESS_GROUP_NAME; this.EmpMobile = result.MemberInformationList[0].EMPLOYEE_MOBILE_NUMBER; this.EmpJob = result.MemberInformationList[0].JOB_NAME; this.EmpOrgName = result.MemberInformationList[0].ORGANIZATION_NAME; this.EmpPayrol = result.MemberInformationList[0].PAYROLL_NAME; this.EmpPosition = result.MemberInformationList[0].POSITION_NAME; this.EmpEmail = result.MemberInformationList[0].EMPLOYEE_EMAIL_ADDRESS; this.EmpCatMeaning = result.MemberInformationList[0].EMPLOYMENT_CATEGORY_MEANING; this.EmpGRADENAME = result.MemberInformationList[0].GRADE_NAME; this.EmpLocation = result.MemberInformationList[0].LOCATION_NAME; this.EmpImg = result.MemberInformationList[0].EMPLOYEE_IMAGE // console.log("total no "+this.EmpTotal) } getTicketTypes(){ const request = { // TokenID:"xxx", // EmployeeNumber:"191817" }; this.MowadhafiService.getTicketTypes(request, ()=> {} , this.ts.trPK('general', 'retry')).subscribe((result)=> { this.handlegetTicketTypesResult(result); }) } handlegetTicketTypesResult(result){ } getProject(){ const request = { // TokenID:"xxx", // EmployeeNumber:"191817", ItgProjectCode:"CS" }; this.MowadhafiService.getProject(request, ()=> {} , this.ts.trPK('general', 'retry')).subscribe((result)=> { this.handlegetProjectResult(result); }) } handlegetProjectResult(result){ } getProjectDepartments(){ const request = { // TokenID:"xxx", // EmployeeNumber:"191817", ItgProjectId:11, }; this.MowadhafiService.getProjectDepartments(request, ()=> {} , this.ts.trPK('general', 'retry')).subscribe((result)=> { this.handlegetProjectDepartmentsResult(result); }) } handlegetProjectDepartmentsResult(result){ } getDepartmentSections(){ const request = { // TokenID:"xxx", // EmployeeNumber:"191817", ItgProjectDepartmentId:1 }; this.MowadhafiService.getDepartmentSections(request, ()=> {} , this.ts.trPK('general', 'retry')).subscribe((result)=> { this.handlegetDepartmentSectionsResult(result); }) } handlegetDepartmentSectionsResult(result){ } getSectionTopics(){ const request = { // TokenID:"xxx", // EmployeeNumber:"191817", ItgDepartmentSectionId:1 }; this.MowadhafiService.getSectionTopics(request, ()=> {} , this.ts.trPK('general', 'retry')).subscribe((result)=> { this.handlegetSectionTopicsResult(result); }) } handlegetSectionTopicsResult(result){ } createRequest(){ if(this.showRequestDetails){ this.showRequestDetails = false }else{ this.showRequestDetails = true }} public cancelRequest() { this.cs.openMyRequestPage(); this.menu.toggle(); } submitRequest(){ } uploadDocument(){ } }