|
|
|
|
@ -10,6 +10,7 @@ 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';
|
|
|
|
|
import { FileUploader } from 'ng2-file-upload';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-hr-request',
|
|
|
|
|
@ -37,6 +38,21 @@ export class HRRequestComponent implements OnInit {
|
|
|
|
|
myColor: string = 'secondary';
|
|
|
|
|
public showRequestDetails = false;
|
|
|
|
|
public proID= "CS"
|
|
|
|
|
public inquiry: string;
|
|
|
|
|
public HR : string;
|
|
|
|
|
public complaints:string;
|
|
|
|
|
public Projectresult:any;
|
|
|
|
|
public EmpRelations:any;
|
|
|
|
|
public Hr:any;
|
|
|
|
|
public Payroll:any;
|
|
|
|
|
public GovRelation:any;
|
|
|
|
|
public projName:any;
|
|
|
|
|
public topicName:any;
|
|
|
|
|
public departTypeList: any;
|
|
|
|
|
public topicTypeList:any;
|
|
|
|
|
public sectionTypeList:any;
|
|
|
|
|
filterAllowedType: any = ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public direction: string;
|
|
|
|
|
@ -106,7 +122,7 @@ export class HRRequestComponent implements OnInit {
|
|
|
|
|
getTicketTypes(){
|
|
|
|
|
const request = {
|
|
|
|
|
// TokenID:"xxx",
|
|
|
|
|
// EmployeeNumber:"191817"
|
|
|
|
|
EmployeeNumber:"121816",
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
this.MowadhafiService.getTicketTypes(request, ()=> {} , this.ts.trPK('general', 'retry')).subscribe((result)=>
|
|
|
|
|
@ -115,14 +131,16 @@ export class HRRequestComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
}) }
|
|
|
|
|
handlegetTicketTypesResult(result){
|
|
|
|
|
|
|
|
|
|
this.HR = result.Mohemm_Itg_TicketTypesList[0].typeName;
|
|
|
|
|
this.complaints = result.Mohemm_Itg_TicketTypesList[1].typeName;
|
|
|
|
|
this.inquiry = result.Mohemm_Itg_TicketTypesList[2].typeName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getProject(){
|
|
|
|
|
const request = {
|
|
|
|
|
// TokenID:"xxx",
|
|
|
|
|
// EmployeeNumber:"191817",
|
|
|
|
|
EmployeeNumber:"121816",
|
|
|
|
|
ItgProjectCode:"CS"
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
@ -132,14 +150,14 @@ export class HRRequestComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
}) }
|
|
|
|
|
handlegetProjectResult(result){
|
|
|
|
|
|
|
|
|
|
this.Projectresult=result.Mohemm_Itg_ProjectsList[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getProjectDepartments(){
|
|
|
|
|
const request = {
|
|
|
|
|
// TokenID:"xxx",
|
|
|
|
|
// EmployeeNumber:"191817",
|
|
|
|
|
EmployeeNumber:"121816",
|
|
|
|
|
ItgProjectId:11,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -150,13 +168,18 @@ export class HRRequestComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
}) }
|
|
|
|
|
handlegetProjectDepartmentsResult(result){
|
|
|
|
|
this.departTypeList= result.Mohemm_ITG_ProjectDepartmentsList;
|
|
|
|
|
// this.EmpRelations= result .Mohemm_ITG_ProjectDepartmentsList[0].departmentName;
|
|
|
|
|
// this.Hr = result .Mohemm_ITG_ProjectDepartmentsList[1].departmentName;
|
|
|
|
|
// this.Payroll = result .Mohemm_ITG_ProjectDepartmentsList[2].departmentName;
|
|
|
|
|
// this.GovRelation = result .Mohemm_ITG_ProjectDepartmentsList[3].departmentName;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getDepartmentSections(){
|
|
|
|
|
const request = {
|
|
|
|
|
// TokenID:"xxx",
|
|
|
|
|
// EmployeeNumber:"191817",
|
|
|
|
|
EmployeeNumber:"121816",
|
|
|
|
|
ItgProjectDepartmentId:1
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
@ -166,13 +189,15 @@ export class HRRequestComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
}) }
|
|
|
|
|
handlegetDepartmentSectionsResult(result){
|
|
|
|
|
// this.projName=result.Mohemm_ITG_DepartmentSectionsList[0].projectName;
|
|
|
|
|
this.sectionTypeList= result.Mohemm_ITG_DepartmentSectionsList;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getSectionTopics(){
|
|
|
|
|
const request = {
|
|
|
|
|
// TokenID:"xxx",
|
|
|
|
|
// EmployeeNumber:"191817",
|
|
|
|
|
EmployeeNumber:"121816",
|
|
|
|
|
ItgDepartmentSectionId:1
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
@ -182,6 +207,8 @@ export class HRRequestComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
}) }
|
|
|
|
|
handlegetSectionTopicsResult(result){
|
|
|
|
|
// this.topicName=result.Mohemm_ITG_SectionTopicsList[0].topicName
|
|
|
|
|
this.topicTypeList= result.Mohemm_ITG_SectionTopicsList;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -202,11 +229,80 @@ export class HRRequestComponent implements OnInit {
|
|
|
|
|
this.menu.toggle();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
submitRequest(){
|
|
|
|
|
|
|
|
|
|
/*******************Add attchement Functions*************/
|
|
|
|
|
public uploader: FileUploader = new FileUploader({
|
|
|
|
|
allowedMimeType: ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
|
|
|
|
|
maxFileSize: 10 * 1024 * 1024,
|
|
|
|
|
formatDataFunctionIsAsync: true,
|
|
|
|
|
formatDataFunction: async (item) => {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
resolve({
|
|
|
|
|
name: item._file.name,
|
|
|
|
|
length: item._file.size,
|
|
|
|
|
contentType: item._file.type,
|
|
|
|
|
date: new Date()
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
onFileSelectedclick(event){
|
|
|
|
|
event.target.value = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uploadDocument(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onFileSelected(input) {
|
|
|
|
|
|
|
|
|
|
// this.uploader.onWhenAddingFileFailed = function (item: any, filter: any, options: any){
|
|
|
|
|
if (!(this.filterAllowedType.indexOf(input.target.files[0].type) > -1)) {
|
|
|
|
|
let msg: string = "";
|
|
|
|
|
msg = this.ts.trPK("general", "notSupport");
|
|
|
|
|
this.cs.presentAlert(msg);
|
|
|
|
|
return
|
|
|
|
|
} // todo: show alert that you tried uploading wrong files
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
const file = input.target.files[0];
|
|
|
|
|
this.getBase64(file).then(
|
|
|
|
|
data => this.pushObject(data, file.name, file.type)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getBase64(file) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
const reader = new FileReader();
|
|
|
|
|
reader.readAsDataURL(file);
|
|
|
|
|
reader.onload = () => resolve(reader.result);
|
|
|
|
|
reader.onerror = error => reject(error);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pushObject(fileData, name, type) {
|
|
|
|
|
// console.log('before push: '+ this.index);
|
|
|
|
|
// try {
|
|
|
|
|
// let array = name.split('.');
|
|
|
|
|
// let attachType: string = array[array.length - 1];
|
|
|
|
|
|
|
|
|
|
// this.attachListOver.push(
|
|
|
|
|
// AttachmentID: this.attachListOver.length,
|
|
|
|
|
// P_FILE_CONTENT_TYPE: attachType,//type.split('/')[1],
|
|
|
|
|
// P_FILE_DATA: fileData.split(',')[1],
|
|
|
|
|
// P_FILE_NAME: name,//.split('.')[0],
|
|
|
|
|
// P_TRANSACTION_ID: this.P_TransactionID
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
// } catch (e) {
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
submitRequest(){}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|