|
|
|
|
@ -54,9 +54,9 @@ export class HrRequestFormComponent implements OnInit {
|
|
|
|
|
public sectionDep: any;
|
|
|
|
|
public projectCode;
|
|
|
|
|
public SelectedServiceType: any;
|
|
|
|
|
public depType: any ="";
|
|
|
|
|
public secType: any ="";
|
|
|
|
|
public topicType: any ="";
|
|
|
|
|
public depType: any = "";
|
|
|
|
|
public secType: any = "";
|
|
|
|
|
public topicType: any = "";
|
|
|
|
|
indexLastObj: any;
|
|
|
|
|
addAttachRequest: any = [];
|
|
|
|
|
TransactionID: any;
|
|
|
|
|
@ -73,17 +73,17 @@ export class HrRequestFormComponent implements OnInit {
|
|
|
|
|
"application/vnd.ms-excel",
|
|
|
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
|
|
|
];
|
|
|
|
|
projctid:any;
|
|
|
|
|
employeeNumber:any;
|
|
|
|
|
ticketType: any =[];
|
|
|
|
|
projctid: any;
|
|
|
|
|
employeeNumber: any;
|
|
|
|
|
ticketType: any = [];
|
|
|
|
|
public direction: string;
|
|
|
|
|
HRServices = '';
|
|
|
|
|
Complaints='';
|
|
|
|
|
Inquiry='';
|
|
|
|
|
input = document.getElementById ("firstLabel");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Complaints = '';
|
|
|
|
|
Inquiry = '';
|
|
|
|
|
input = document.getElementById("firstLabel");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
public ts: TranslatorService,
|
|
|
|
|
public cs: CommonService,
|
|
|
|
|
@ -100,20 +100,20 @@ export class HrRequestFormComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.projectCode = this.cs.sharedService.getSharedData("projcet-code",false);
|
|
|
|
|
this.projectCode = this.cs.sharedService.getSharedData("projcet-code", false);
|
|
|
|
|
this.getTicketTypes();
|
|
|
|
|
this.getProject();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public isValidForm(): boolean {
|
|
|
|
|
if (this.depType && this.SelectedServiceType && this.secType && this.topicType) {
|
|
|
|
|
return false;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onSelectChange(event, type) {
|
|
|
|
|
@ -121,20 +121,20 @@ export class HrRequestFormComponent implements OnInit {
|
|
|
|
|
console.log(value);
|
|
|
|
|
// this.topicTypeList =[];
|
|
|
|
|
// this.sectionTypeList =[];
|
|
|
|
|
if(type==1){
|
|
|
|
|
if (type == 1) {
|
|
|
|
|
this.depType = value;
|
|
|
|
|
this.sectionTypeList =[];
|
|
|
|
|
this.topicTypeList =[];
|
|
|
|
|
this.sectionTypeList = [];
|
|
|
|
|
this.topicTypeList = [];
|
|
|
|
|
this.getDepartmentSections(value);
|
|
|
|
|
|
|
|
|
|
}else if(type==2){
|
|
|
|
|
|
|
|
|
|
} else if (type == 2) {
|
|
|
|
|
this.getSectionTopics(value);
|
|
|
|
|
this.topicTypeList =[];
|
|
|
|
|
this.topicTypeList = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onFileSelectedclick(event){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onFileSelectedclick(event) {
|
|
|
|
|
event.target.value = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -158,8 +158,8 @@ export class HrRequestFormComponent implements OnInit {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
handlegetTicketTypesResult(result) {
|
|
|
|
|
this.ticketType =result.Mohemm_Itg_TicketTypesList;
|
|
|
|
|
|
|
|
|
|
this.ticketType = result.Mohemm_Itg_TicketTypesList;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////
|
|
|
|
|
@ -177,11 +177,11 @@ export class HrRequestFormComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
handlegetProjectResult(result) {
|
|
|
|
|
this.Projectresult = result.Mohemm_Itg_ProjectsList;
|
|
|
|
|
this.projctid=this.Projectresult[0].projectId;
|
|
|
|
|
this.projctid = this.Projectresult[0].projectId;
|
|
|
|
|
this.getProjectDepartments();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////
|
|
|
|
|
////////////////////////////////////////////////////
|
|
|
|
|
getProjectDepartments() {
|
|
|
|
|
const request = {
|
|
|
|
|
EmployeeNumber: "",
|
|
|
|
|
@ -204,7 +204,7 @@ export class HrRequestFormComponent implements OnInit {
|
|
|
|
|
getDepartmentSections(value) {
|
|
|
|
|
const request = {
|
|
|
|
|
EmployeeNumber: "",
|
|
|
|
|
ItgProjectDepartmentId: value ?value : this.departTypeList.projectDepartmentId,
|
|
|
|
|
ItgProjectDepartmentId: value ? value : this.departTypeList.projectDepartmentId,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
@ -218,11 +218,11 @@ export class HrRequestFormComponent implements OnInit {
|
|
|
|
|
// this.getSectionTopics();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getSectionTopics(value=null) {
|
|
|
|
|
getSectionTopics(value = null) {
|
|
|
|
|
const request = {
|
|
|
|
|
EmployeeNumber: "",
|
|
|
|
|
// ItgDepartmentSectionId: this.sectionTypeList.departmentSectionId,
|
|
|
|
|
ItgDepartmentSectionId: value ?value : this.sectionTypeList.departmentSectionId,
|
|
|
|
|
ItgDepartmentSectionId: value ? value : this.sectionTypeList.departmentSectionId,
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
this.MowadhafiService.getSectionTopics(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => {
|
|
|
|
|
@ -238,41 +238,57 @@ export class HrRequestFormComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************Create Ticket Function*************/
|
|
|
|
|
/*******************Create Ticket Function*************/
|
|
|
|
|
|
|
|
|
|
CreateTicket() {
|
|
|
|
|
|
|
|
|
|
var authUser =this.authService.getAuthenticatedRequest();
|
|
|
|
|
|
|
|
|
|
var authUser = this.authService.getAuthenticatedRequest();
|
|
|
|
|
this.cs.startLoading();
|
|
|
|
|
var request = new FormData();
|
|
|
|
|
request.append('ticketTypeId', this.SelectedServiceType);
|
|
|
|
|
request.append('projectId', this.projctid);
|
|
|
|
|
request.append('departmentId', this.depType);
|
|
|
|
|
request.append('sectionId', this.secType);
|
|
|
|
|
request.append('sectionTopicId', this.topicType);
|
|
|
|
|
request.append('description', this.Description);
|
|
|
|
|
console.log("TEST:______")
|
|
|
|
|
console.log(this.selectedFile);
|
|
|
|
|
if(this.selectedFile && this.selectedFile !== undefined){
|
|
|
|
|
request.append('fileColl', this.selectedFile[0], this.selectedFile[0].name);
|
|
|
|
|
}
|
|
|
|
|
request.append('employeeNumber', authUser.P_USER_NAME);
|
|
|
|
|
request.append('ticketStatus', 'new');
|
|
|
|
|
request.append('channelId', '3');
|
|
|
|
|
request.append('Channel', authUser.Channel.toString());
|
|
|
|
|
request.append('LogInToken', authUser.LogInTokenID);
|
|
|
|
|
request.append('Token', authUser.TokenID);
|
|
|
|
|
request.append('EmployeeNumber', authUser.P_USER_NAME);
|
|
|
|
|
request.append('MobileNo', authUser.MobileNumber);
|
|
|
|
|
// var request = new FormData();
|
|
|
|
|
// request.append('ticketTypeId', this.SelectedServiceType);
|
|
|
|
|
// request.append('projectId', this.projctid);
|
|
|
|
|
// request.append('departmentId', this.depType);
|
|
|
|
|
// request.append('sectionId', this.secType);
|
|
|
|
|
// request.append('sectionTopicId', this.topicType);
|
|
|
|
|
// request.append('description', this.Description);
|
|
|
|
|
|
|
|
|
|
// if(this.selectedFile && this.selectedFile !== undefined){
|
|
|
|
|
// request.append('fileColl', this.selectedFile[0], this.selectedFile[0].name);
|
|
|
|
|
// }
|
|
|
|
|
// request.append('employeeNumber', authUser.P_USER_NAME);
|
|
|
|
|
// request.append('ticketStatus', 'new');
|
|
|
|
|
// request.append('channelId', '3');
|
|
|
|
|
// request.append('Channel', authUser.Channel.toString());
|
|
|
|
|
// request.append('LogInToken', authUser.LogInTokenID);
|
|
|
|
|
// request.append('Token', authUser.TokenID);
|
|
|
|
|
// request.append('EmployeeNumber', authUser.P_USER_NAME);
|
|
|
|
|
// request.append('MobileNo', authUser.MobileNumber);
|
|
|
|
|
|
|
|
|
|
var request = {
|
|
|
|
|
"TokenID": authUser.LogInTokenID, "EmployeeNumber": authUser.P_USER_NAME, "ItgImageCollList": this.addAttachRequest,
|
|
|
|
|
"ticketTypeId": this.SelectedServiceType,
|
|
|
|
|
"projectId": this.projctid,
|
|
|
|
|
"departmentId": this.depType,
|
|
|
|
|
"sectionId": this.secType,
|
|
|
|
|
"sectionTopicId": this.topicType,
|
|
|
|
|
"description": this.Description,
|
|
|
|
|
"employeeNumber": authUser.P_USER_NAME,
|
|
|
|
|
"ticketStatus": "new",
|
|
|
|
|
"channelId": 3,
|
|
|
|
|
"Channel": authUser.Channel.toString(),
|
|
|
|
|
"LogInToken": authUser.LogInTokenID,
|
|
|
|
|
"Token": authUser.TokenID,
|
|
|
|
|
"MobileNo": authUser.MobileNumber,
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.MowadhafiService.getCreateTicket(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result: any) => {
|
|
|
|
|
if(this.cs.validResponse(result)){
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
this.cs.stopLoading();
|
|
|
|
|
this.checkERM('After Service Submission');
|
|
|
|
|
this.cs.greenToastPK("general", "success-create");
|
|
|
|
|
this.cs.openMyRequestPage();
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
this.cs.stopLoading();
|
|
|
|
|
this.cs.redToastPK("general", "try-again");
|
|
|
|
|
}
|
|
|
|
|
@ -329,7 +345,7 @@ export class HrRequestFormComponent implements OnInit {
|
|
|
|
|
else {
|
|
|
|
|
const file = input.target.files[0];
|
|
|
|
|
this.selectedFile = input.target.files;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getBase64(file).then(data =>
|
|
|
|
|
this.pushObject(data, file.name, file.type)
|
|
|
|
|
@ -348,18 +364,21 @@ export class HrRequestFormComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pushObject(fileData, name, type) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.indexLastObj++;
|
|
|
|
|
try {
|
|
|
|
|
let array = name.split(".");
|
|
|
|
|
let attachType: string = array[array.length - 1];
|
|
|
|
|
|
|
|
|
|
this.addAttachRequest.push({
|
|
|
|
|
AttachmentID: this.indexLastObj,
|
|
|
|
|
P_FILE_CONTENT_TYPE: attachType, //type.split('/')[1],
|
|
|
|
|
P_FILE_DATA: fileData.split(",")[1],
|
|
|
|
|
P_FILE_NAME: name, //.split('.')[0],
|
|
|
|
|
P_TRANSACTION_ID: this.TransactionID
|
|
|
|
|
// AttachmentID: this.indexLastObj,
|
|
|
|
|
// P_FILE_CONTENT_TYPE: attachType, //type.split('/')[1],
|
|
|
|
|
// P_FILE_DATA: fileData.split(",")[1],
|
|
|
|
|
// P_FILE_NAME: name, //.split('.')[0],
|
|
|
|
|
// P_TRANSACTION_ID: this.TransactionID
|
|
|
|
|
Base64Data: fileData.split(",")[1],
|
|
|
|
|
FileName: name,
|
|
|
|
|
ContentType: 'image/' + attachType
|
|
|
|
|
});
|
|
|
|
|
} catch (e) { }
|
|
|
|
|
}
|
|
|
|
|
|