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.
sfh-mohemm/Mohem/src/app/mowadhafi/my-request/my-request.component.ts

98 lines
3.0 KiB
TypeScript

import { Component, Input, 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';
@Component({
selector: 'app-my-request',
templateUrl: './my-request.component.html',
styleUrls: ['./my-request.component.scss'],
})
export class MyRequestComponent implements OnInit {
public direction: String;
public ticketsInfo : any = [];
public ticketCount = 10;
public ticketPage = 1;
public increseCount = 0;
@Input()
ngClass:string |string[]| Set<string>| {[klass:string]:any;}
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.getTicketsByEmployee();
}
goback() {
this.location.back();
}
public openHRRequestPage() {
this.cs.openHRRequestPage();
// this.menu.toggle();
}
public openRequestDetailsPage(item) {
this.cs.sharedService.setSharedData(item,'ticket-info')
this.cs.openRequestDetailsPage();
// this.menu.toggle();
}
getTicketsByEmployee() {
const request = {
// TokenID:"xxx",
EmployeeNumber: "",
ItgPageSize: this.ticketCount,
ItgPageNo: this.ticketPage
};
this.MowadhafiService.getTicketsByEmployee(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => {
this.handlegetTicketsByEmployeeResult(result);
})
}
handlegetTicketsByEmployeeResult(result){
this.ticketsInfo=result.Mohemm_ITG_TicketsByEmployeeList
console.log("length______________________-.");
console.log(this.ticketsInfo.length);
this.increseCount++;
this.ticketCount = this.ticketCount * this.increseCount
this.ticketPage = this.increseCount;
// let x;
// if(this.cs.validResponse(result)){
// x = JSON.parse(result.Mohemm_ITG_ResponseItem);
// console.log(x);
// this.ticketsInfo=x.result.data;
// for (let i = 0; i < this.ticketsInfo.length; i++) {
// // console.log(i + ' : ' + this.ticketsInfo[i].ticketTypeName)
// }
// console.log("length______________________-.");
// console.log(this.ticketsInfo.length);
// }
}
}