|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
this.getTicketTransaction();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
goback() {
|
|
|
|
|
this.location.back();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getTicketTransaction(){
|
|
|
|
|
const request = {
|
|
|
|
|
EmployeeNumber:'',
|
|
|
|
|
ItgTicketId:this.teckitDetial.ticketId,
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getTicketDetails(){
|
|
|
|
|
const request = {
|
|
|
|
|
EmployeeNumber:'',
|
|
|
|
|
ItgTicketId:this.teckitDetial.ticketId,
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|