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.
mohemmionic5/Mohem/src/app/mowadhafi/request-details/request-details.component.ts

110 lines
3.4 KiB
TypeScript

5 years ago
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';
@Component({
selector: 'app-request-details',
templateUrl: './request-details.component.html',
styleUrls: ['./request-details.component.scss'],
})
export class RequestDetailsComponent implements OnInit {
public direction : String;
public actionInfo:any = [];
public teckitInfo:any;
public description:any;
public section:any;
public topic:any;
public ticketRefre:any;
public date:any;
public status:any;
public teckitDetial:any;
5 years ago
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.teckitDetial = this.cs.sharedService.getSharedData('ticket-info', true)
this.getTicketDetails();
5 years ago
this.getTicketTransaction();
}
goback() {
this.location.back();
}
getTicketTransaction(){
const request = {
EmployeeNumber:'',
ItgTicketId:this.teckitDetial.ticketId,
5 years ago
};
this.MowadhafiService.getTicketTransaction(request, ()=> {} , this.ts.trPK('general', 'retry')).subscribe((result)=>
{
this.handlegetTicketTransactionResult(result);
}) }
handlegetTicketTransactionResult(result){
let x;
if(this.cs.validResponse(result)){
x = JSON.parse(result.Mohemm_ITG_ResponseItem);
console.log(x);
this.actionInfo=x.result.data;
for (let i = 0; i < this.actionInfo.length; i++) {
console.log(i + ' : ' + this.actionInfo[i].ticketTypeName)
}
}
5 years ago
}
getTicketDetails(){
const request = {
EmployeeNumber:'',
ItgTicketId:this.teckitDetial.ticketId,
5 years ago
};
this.MowadhafiService.getTicketDetails(request, ()=> {} , this.ts.trPK('general', 'retry')).subscribe((result)=>
{
this.handlegetTicketDetailsResult(result);
}) }
handlegetTicketDetailsResult(result){
let res;
if(this.cs.validResponse(result)){
res = JSON.parse(result.Mohemm_ITG_ResponseItem);
console.log(res);
this.teckitInfo = res.result.data;
this.status =this.teckitInfo.ticketStatusName;
this.date =this.teckitInfo.created.substring(0, 10);
this.ticketRefre =this.teckitInfo.ticketReferenceNo;
this.section = this.teckitInfo.sectionName;
this.topic =this.teckitInfo.topicName;
this.description =this.teckitInfo.description;
}
5 years ago
}
}