enad-Q1
enadhilal 5 years ago
parent 301dafbf3f
commit b6e109db56

@ -37,17 +37,18 @@ export class HomeComponent implements OnInit {
balance: any; balance: any;
ACCRUAL_NET_ENTITLEMENT: any; ACCRUAL_NET_ENTITLEMENT: any;
ACCRUAL_USED_ENTITLEMENT: any; ACCRUAL_USED_ENTITLEMENT: any;
ACCRUAL_YEARLY_ENTITLEMENT: any; ACCRUAL_YEARLY_ENTITLEMENT: any;
totalnumber: any; totalnumber: any;
public direction: string; public direction: string;
public options = { public options = {
cutoutPercentage: 80, cutoutPercentage: 80,
tooltips: { enabled: false }, tooltips: { enabled: false },
legend: { display: false }}; legend: { display: false }
gaugeType = "full"; };
// gaugeValue = 11.200; gaugeType = "full";
// gaugeLabel = ""; // gaugeValue = 11.200;
// gaugeLabel = "";
constructor( constructor(
public common: CommonService, public common: CommonService,
@ -58,23 +59,23 @@ export class HomeComponent implements OnInit {
public authService: AuthenticationService public authService: AuthenticationService
) { ) {
this.direction = TranslatorService.getCurrentDirection(); this.direction = TranslatorService.getCurrentDirection();
// this.userData =this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA,false); // this.userData =this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA,false);
} }
ngOnInit() { ngOnInit() {
this.Sdate = new Date().toISOString(); this.Sdate = new Date().toISOString();
this.getUserDetails(); this.getUserDetails();
this.getAccrualBalance(); this.getAccrualBalance();
} }
private getUserDetails(){ private getUserDetails() {
this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => { this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => {
if (user) { if (user) {
// this.emp_no=user.EMPLOYEE_NUMBER; // this.emp_no=user.EMPLOYEE_NUMBER;
// this.getAccrualBalance(); // this.getAccrualBalance();
} }
}); });
@ -102,36 +103,36 @@ export class HomeComponent implements OnInit {
this.accrualNet = this.leaveAccrualBalance.ACCRUAL_NET_ENTITLEMENT; this.accrualNet = this.leaveAccrualBalance.ACCRUAL_NET_ENTITLEMENT;
this.accrualUsed = this.leaveAccrualBalance.ACCRUAL_USED_ENTITLEMENT; this.accrualUsed = this.leaveAccrualBalance.ACCRUAL_USED_ENTITLEMENT;
this.accrualYearly = this.leaveAccrualBalance.ACCRUAL_YEARLY_ENTITLEMENT; this.accrualYearly = this.leaveAccrualBalance.ACCRUAL_YEARLY_ENTITLEMENT;
this.totalnumber= this.accrualNet + this.accrualUsed + this.accrualYearly; this.totalnumber = this.accrualNet + this.accrualUsed + this.accrualYearly;
this.totalnumber= this.totalnumber.toFixed(3); this.totalnumber = this.totalnumber.toFixed(3);
this.request = this.common.sharedService.getSharedData('leaveAccrualBalanceDate', false); this.request = this.common.sharedService.getSharedData('leaveAccrualBalanceDate', false);
console.log("this.request" + this.request.P_EFFECTIVE_DATE); console.log("this.request" + this.request.P_EFFECTIVE_DATE);
this.effectiveDate = this.request.P_EFFECTIVE_DATE; this.effectiveDate = this.request.P_EFFECTIVE_DATE;
this.data = { this.data = {
// labels: ['earingTotal', 'deductionTotal'], // labels: ['earingTotal', 'deductionTotal'],
datasets: [ datasets: [
// { data: [this.accrualNet,this.accrualYearly,this.accrualUsed], // { data: [this.accrualNet,this.accrualYearly,this.accrualUsed],
{ {
data: [this.accrualNet,this.accrualUsed], data: [this.accrualNet, this.accrualUsed],
backgroundColor: [ backgroundColor: [
// '#1FA269', // '#1FA269',
// '#CB3232',], // '#CB3232',],
'#269DB8', '#269DB8',
'#b60c0c',], '#b60c0c',],
borderWidth: 1 borderWidth: 1
} }
] ]
}; };
this.getAbsenceTransaction(); this.getAbsenceTransaction();
} }
AccrualBalances() { AccrualBalances() {
this.common.openAccuralPage(); this.common.openAccuralPage();
} }
AttachmentDocuments(id) { AttachmentDocuments(id) {
const request = { const request = {
P_ABSENCE_ATTENDANCE_ID: id P_ABSENCE_ATTENDANCE_ID: id
}; };
@ -159,7 +160,7 @@ AttachmentDocuments(id) {
//this.GetAbsenceTransactionList =result.GetAbsenceTransactionList; //this.GetAbsenceTransactionList =result.GetAbsenceTransactionList;
} }
} }
getAbsenceTransaction() { getAbsenceTransaction() {
this.IsReachEnd = false; this.IsReachEnd = false;
const request = { const request = {
P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, P_SELECTED_EMPLOYEE_NUMBER: this.selEmp,
@ -173,7 +174,7 @@ getAbsenceTransaction() {
}); });
} }
handleAbsListResult(result) { handleAbsListResult(result) {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
if (this.common.hasData(result.GetAbsenceTransactionList)) { if (this.common.hasData(result.GetAbsenceTransactionList)) {
this.GetAbsenceTransactionList = result.GetAbsenceTransactionList; this.GetAbsenceTransactionList = result.GetAbsenceTransactionList;
@ -190,7 +191,7 @@ getAbsenceTransaction() {
} }
} }
} }
doInfinite(event: any) { doInfinite(event: any) {
if (!this.IsReachEnd) { if (!this.IsReachEnd) {
// this.P_PAGE_NUM++; // this.P_PAGE_NUM++;
const request = { const request = {
@ -230,11 +231,11 @@ doInfinite(event: any) {
} }
} }
} }
createAbsence() { createAbsence() {
this.common.openSubmitAbsencePage(); this.common.openSubmitAbsencePage();
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
getAccrualBalance() { getAccrualBalance() {
if (this.Sdate) { if (this.Sdate) {
let today = new Date(this.Sdate); let today = new Date(this.Sdate);
@ -255,31 +256,32 @@ createAbsence() {
}); });
} }
} }
handleAccrualResult(result) { handleAccrualResult(result) {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
this.balance = result.GetAccrualBalancesList; this.balance = result.GetAccrualBalancesList;
} }
if(this.balance){ if (this.balance) {
this.accrualNet = this.balance[0].ACCRUAL_NET_ENTITLEMENT; this.accrualNet = this.balance[0].ACCRUAL_NET_ENTITLEMENT;
this.accrualUsed = this.balance[0].ACCRUAL_USED_ENTITLEMENT; this.accrualUsed = this.balance[0].ACCRUAL_USED_ENTITLEMENT;
// this.accrualYearly = this.balance[0].ACCRUAL_YEARLY_ENTITLEMENT; // this.accrualYearly = this.balance[0].ACCRUAL_YEARLY_ENTITLEMENT;
// this.totalnumber= this.accrualNet + this.accrualUsed + this.accrualYearly; // this.totalnumber= this.accrualNet + this.accrualUsed + this.accrualYearly;
this.totalnumber= this.accrualNet + this.accrualUsed; this.totalnumber = this.accrualNet + this.accrualUsed;
this.totalnumber= this.totalnumber.toFixed(3); this.totalnumber = this.totalnumber.toFixed(3);
this.data = { this.data = {
// labels: ['earingTotal', 'deductionTotal'], // labels: ['earingTotal', 'deductionTotal'],
datasets: [ datasets: [
// { data: [this.accrualNet,this.accrualYearly,this.accrualUsed], // { data: [this.accrualNet,this.accrualYearly,this.accrualUsed],
{ data: [this.accrualNet,this.accrualUsed], {
backgroundColor: [ data: [this.accrualNet, this.accrualUsed],
'#269DB8', backgroundColor: [
'#b60c0c',], '#269DB8',
borderWidth: 1 '#b60c0c',],
} borderWidth: 1
] }
}; ]
};
} }
} }
} }

@ -18,20 +18,22 @@ import { ApplyActionModalComponent } from '../apply-action-modal/apply-action-mo
export class WorkListMainItgComponent implements OnInit { export class WorkListMainItgComponent implements OnInit {
@ViewChild('slides') slides: IonSlides; @ViewChild('slides') slides: IonSlides;
public static APPROVAL = "Services/COCWS.svc/REST/ITGApproveRequest" // tslint:disable: member-ordering
public static REJECT = 'Services/COCWS.svc/REST/ITGRejectRequest' public static APPROVAL = 'Services/COCWS.svc/REST/ITGApproveRequest';
public static REJECT = 'Services/COCWS.svc/REST/ITGRejectRequest';
public static DELEGATE = 'Services/COCWS.svc/REST/ITGDelegateRequest'; public static DELEGATE = 'Services/COCWS.svc/REST/ITGDelegateRequest';
public static REQUEST_INFORMATION = 'Services/COCWS.svc/REST/ITGRequestInformation'; public static REQUEST_INFORMATION = 'Services/COCWS.svc/REST/ITGRequestInformation';
public static ANSWER = 'Services/COCWS.svc/REST/ITGAnswer'; public static ANSWER = 'Services/COCWS.svc/REST/ITGAnswer';
public static GRANT = 'Services/COCWS.svc/REST/ITGGrantAccess'; public static GRANT = 'Services/COCWS.svc/REST/ITGGrantAccess';
// tslint:disable: variable-name
public request_info: any; public request_info: any;
public request_name: any; public request_name: any;
public all_request: any; public all_request: any;
public all_request_names: any; public all_request_names: any;
public is_all_items_sents: any; public is_all_items_sents: any;
public request = new itgRequest(); public request = new itgRequest();
public activeSegment: any = "info"; public activeSegment: any = 'info';
public request_details: any; public request_details: any;
public segmentsArray: { name: string, number: number }[] = []; public segmentsArray: { name: string, number: number }[] = [];
public segmentData: { name: string, data: any }[] = []; public segmentData: { name: string, data: any }[] = [];
@ -44,7 +46,7 @@ export class WorkListMainItgComponent implements OnInit {
public replcamentID: string; public replcamentID: string;
public actionSelected: any; public actionSelected: any;
public options: any; public options: any;
public index: number = 0; public index = 0;
public grantDATA: any; public grantDATA: any;
public grantInfo: any; public grantInfo: any;
public grantFieldsConditionalValue: any = []; public grantFieldsConditionalValue: any = [];
@ -67,7 +69,7 @@ export class WorkListMainItgComponent implements OnInit {
public modalCtrl: ModalController) { } public modalCtrl: ModalController) { }
ngOnInit() { ngOnInit() {
this.direction = TranslatorService.getCurrentLanguageName() this.direction = TranslatorService.getCurrentLanguageName();
this.request_info = this.common.sharedService.getSharedData(HomeComponent.REQUSET_INFO); this.request_info = this.common.sharedService.getSharedData(HomeComponent.REQUSET_INFO);
this.request_name = this.common.sharedService.getSharedData(HomeComponent.REQUSET_NAME); this.request_name = this.common.sharedService.getSharedData(HomeComponent.REQUSET_NAME);
this.all_request = this.common.sharedService.getSharedData(HomeComponent.ALL_REQUEST); this.all_request = this.common.sharedService.getSharedData(HomeComponent.ALL_REQUEST);
@ -90,19 +92,14 @@ export class WorkListMainItgComponent implements OnInit {
this.workListService.getITGFormDetails(this.request).subscribe((result: any) => { this.workListService.getITGFormDetails(this.request).subscribe((result: any) => {
this.request_details = result.ITGRequest; this.request_details = result.ITGRequest;
this.grantInfo = result.ITGRequest.GrantFields; this.grantInfo = result.ITGRequest.GrantFields;
let count = 0;
for (let i = 0; i < result.ITGRequest.FieldGoups.length; i++) { for (let i = 0; i < result.ITGRequest.FieldGoups.length; i++) {
this.segmentsArray[i] = { name: result.ITGRequest.FieldGoups[i].Title, number: i }; this.segmentsArray[i] = { name: result.ITGRequest.FieldGoups[i].Title, number: i };
this.segmentData[i] = { name: result.ITGRequest.FieldGoups[i].Title, data: result.ITGRequest.FieldGoups[i].Fields } this.segmentData[i] = { name: result.ITGRequest.FieldGoups[i].Title, data: result.ITGRequest.FieldGoups[i].Fields };
// tslint:disable: prefer-for-of
for (let j = 0; j < this.segmentData[i].data.length; j++) { for (let j = 0; j < this.segmentData[i].data.length; j++) {
if (this.segmentData[i].data[j].Type === "table") { if (this.segmentData[i].data[j].Type === 'table') {
this.dataLabelAndValue.push(JSON.parse(this.segmentData[i].data[j].Value)) this.dataLabelAndValue.push(JSON.parse(this.segmentData[i].data[j].Value));
} }
// if (this.segmentData[i].data[j].TableValue){
// this.requestDetailsData[count] ={ name:this.segmentData[i].data[j].TableValue.Header,
// data: this.segmentData[i].data[j].TableValue.Rows}
// count++;
// }
} }
} }
this.segmentsArray[this.segmentsArray.length] = { name: 'Approval Level', number: this.segmentsArray.length }; this.segmentsArray[this.segmentsArray.length] = { name: 'Approval Level', number: this.segmentsArray.length };
@ -135,62 +132,56 @@ export class WorkListMainItgComponent implements OnInit {
} }
} }
} }
//result.ITGRequest.FieldGoups.Fields
}); });
} }
imageURL(actionName) { imageURL(actionName) {
if (actionName == "Approve") { if (actionName === 'Approve') {
return "../assets/imgs/mohemm-action/Approve.png" return '../assets/imgs/mohemm-action/Approve.png';
} }
if (actionName == "Reject") { if (actionName === 'Reject') {
return "../assets/imgs/mohemm-action/Reject.png" return '../assets/imgs/mohemm-action/Reject.png';
} }
if (actionName == "RequestInformation") { if (actionName === 'RequestInformation') {
return "../assets/imgs/mohemm-action/info.png" return '../assets/imgs/mohemm-action/info.png';
} }
if (actionName == "Grant") { if (actionName === 'Grant') {
return "../assets/imgs/mohemm-action/info.png" return '../assets/imgs/mohemm-action/info.png';
} }
if (actionName == "Delegate") { if (actionName === 'Delegate') {
return "../assets/imgs/mohemm-action/info.png" return '../assets/imgs/mohemm-action/info.png';
} }
if (actionName == "Answer") { if (actionName === 'Answer') {
return "../assets/imgs/mohemm-action/info.png" return '../assets/imgs/mohemm-action/info.png';
} }
if (actionName == "ReportGenerated") { if (actionName === 'Question') {
return "../assets/imgs/mohemm-action/info.png" return '../assets/imgs/mohemm-action/info.png';
} }
if (actionName == "Doable") { if (actionName === 'ReportGenerated') {
return "../assets/imgs/mohemm-action/info.png" return '../assets/imgs/mohemm-action/info.png';
} }
if (actionName == "NotDoable") { if (actionName === 'Doable') {
return "../assets/imgs/mohemm-action/info.png" return '../assets/imgs/mohemm-action/info.png';
} }
if (actionName == "DataCorrected") { if (actionName === 'NotDoable') {
return "../assets/imgs/mohemm-action/info.png" return '../assets/imgs/mohemm-action/info.png';
}
if (actionName === 'DataCorrected') {
return '../assets/imgs/mohemm-action/info.png';
} }
} }
public segmentChangedClick(event: any) { public segmentChangedClick(event: any) {
if (event.detail.value === "Request Details") { if (event.detail.value === 'Request Details') {
this.slides.slideTo(0); this.slides.slideTo(0);
this.activeSegment = event.detail.value; this.activeSegment = event.detail.value;
} } else if (event.detail.value === 'Approval Level') {
else if (event.detail.value === "Approval Level") {
this.slides.slideTo(1); this.slides.slideTo(1);
this.activeSegment = event.detail.value; this.activeSegment = event.detail.value;
} } else if (event.detail.value === 'Requester Details') {
else if (event.detail.value === "Requester Details") {
this.slides.slideTo(2); this.slides.slideTo(2);
this.activeSegment = event.detail.value; this.activeSegment = event.detail.value;
} }
// for(let i=0; i< this.segmentsArray.length; i++){
// if(this.segmentsArray[i].name === event.detail.value){
// this.slides.slideTo(i);
// this.activeSegment = event.detail.value;
// }
// }
} }
slideChanged(event: any) { slideChanged(event: any) {
@ -224,11 +215,9 @@ export class WorkListMainItgComponent implements OnInit {
} }
} }
} }
} } else { // if user clicked on spicific type of ITG request
//if user clicked on spicific type of ITG request
else {
for (let i = 0; i < this.all_request.length; i++) { // search for the request that clicked on all request for (let i = 0; i < this.all_request.length; i++) { // search for the request that clicked on all request
if (this.request_info.ID == this.all_request[i].ID) { // check if the ID for the request is found. if (this.request_info.ID === this.all_request[i].ID) { // check if the ID for the request is found.
this.index = i + 1; this.index = i + 1;
if (this.index !== this.all_request.length) { // check if its last one to redirecte to home otherwise to next request. if (this.index !== this.all_request.length) { // check if its last one to redirecte to home otherwise to next request.
this.clearDataArray(); this.clearDataArray();
@ -240,11 +229,6 @@ export class WorkListMainItgComponent implements OnInit {
return; return;
} }
} }
// else {
// this.common.sharedService.setSharedData(true, 'loadWorkList');
// this.common.openNotificationPage();
// return;
// }
} }
} }
this.common.sharedService.setSharedData(true, 'loadWorkList'); this.common.sharedService.setSharedData(true, 'loadWorkList');
@ -266,7 +250,7 @@ export class WorkListMainItgComponent implements OnInit {
actionService(action, comments?, grantRequests?) { actionService(action, comments?, grantRequests?) {
let url: string; let url: string;
let request = new itgRequest(); const request = new itgRequest();
request.RequestType = this.request_name; request.RequestType = this.request_name;
request.ItemID = this.request_info.ItemID; request.ItemID = this.request_info.ItemID;
request.TaskID = this.request_info.ID; request.TaskID = this.request_info.ID;
@ -276,14 +260,14 @@ export class WorkListMainItgComponent implements OnInit {
request.NewUserEMPId = this.replcamentID; request.NewUserEMPId = this.replcamentID;
this.common.confirmAlertDialogAction( this.common.confirmAlertDialogAction(
() => { () => {
if (action == 1) { //approved if (action === 1) { // approved
url = WorkListMainItgComponent.APPROVAL; url = WorkListMainItgComponent.APPROVAL;
this.workListService.getITGActionRequest(request, url) this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => { .subscribe((result: any) => {
if (result.MessageStatus != 1) { if (result.MessageStatus !== 1) {
this.common.presentAlert(this.ts.trPK('general', 'error-itg')); this.common.presentAlert(this.ts.trPK('general', 'error-itg'));
} else if (result.MessageStatus == 1) { } else if (result.MessageStatus === 1) {
this.messageSuccess = true; this.messageSuccess = true;
setTimeout(() => { setTimeout(() => {
this.messageSuccess = false; this.messageSuccess = false;
@ -293,26 +277,24 @@ export class WorkListMainItgComponent implements OnInit {
}, 2000); }, 2000);
} }
}); });
} else if (action == 2) {//reject } else if (action === 2) {// reject
url = WorkListMainItgComponent.REJECT; url = WorkListMainItgComponent.REJECT;
this.workListService.getITGActionRequest(request, url) this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => { .subscribe((result: any) => {
if (result.MessageStatus != 1) { if (result.MessageStatus !== 1) {
this.common.presentAlert(this.ts.trPK('general', 'error-itg')); this.common.presentAlert(this.ts.trPK('general', 'error-itg'));
} else if (result.MessageStatus == 1) { } else if (result.MessageStatus === 1) {
setTimeout(() => { setTimeout(() => {
this.messageSuccess = true; this.messageSuccess = true;
this.common.sharedService.setSharedData(true, 'loadWorkList'); this.common.sharedService.setSharedData(true, 'loadWorkList');
// this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ'));
// this.common.sharedService.setSharedData(true, 'loadWorkList');
this.confirmMsg(2); this.confirmMsg(2);
this.skip(); this.skip();
this.messageSuccess = false; this.messageSuccess = false;
}, 2000); }, 2000);
} }
}); });
} else if (action == 3) {//request more info } else if (action === 3) {// request more info
request.NewUserEMPId = this.replcamentID; request.NewUserEMPId = this.replcamentID;
url = WorkListMainItgComponent.REQUEST_INFORMATION; url = WorkListMainItgComponent.REQUEST_INFORMATION;
if (!comments) { if (!comments) {
@ -321,12 +303,11 @@ export class WorkListMainItgComponent implements OnInit {
request.Comments = comments; request.Comments = comments;
this.workListService.getITGActionRequest(request, url) this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => { .subscribe((result: any) => {
if (result.MessageStatus != 1) { if (result.MessageStatus !== 1) {
//this.common.presentAlert(result.Message);
this.common.presentAlert(this.ts.trPK('general', 'error-itg')); this.common.presentAlert(this.ts.trPK('general', 'error-itg'));
} }
if (result.MessageStatus == 1) { if (result.MessageStatus === 1) {
this.messageSuccess = true; this.messageSuccess = true;
setTimeout(() => { setTimeout(() => {
this.messageSuccess = false; this.messageSuccess = false;
@ -339,15 +320,15 @@ export class WorkListMainItgComponent implements OnInit {
} }
}); });
} }
} else if (action == 4) {//delegate } else if (action === 4) {// delegate
request.NewUserEMPId = this.replcamentID; request.NewUserEMPId = this.replcamentID;
url = WorkListMainItgComponent.DELEGATE; url = WorkListMainItgComponent.DELEGATE;
this.workListService.getITGActionRequest(request, url) this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => { .subscribe((result: any) => {
if (result.MessageStatus != 1) { if (result.MessageStatus !== 1) {
this.common.presentAlert(this.ts.trPK('general', 'error-itg')); this.common.presentAlert(this.ts.trPK('general', 'error-itg'));
} else if (result.MessageStatus == 1) { } else if (result.MessageStatus === 1) {
this.messageSuccess = true; this.messageSuccess = true;
setTimeout(() => { setTimeout(() => {
this.messageSuccess = false; this.messageSuccess = false;
@ -359,17 +340,17 @@ export class WorkListMainItgComponent implements OnInit {
}, 2000); }, 2000);
} }
}); });
} else if (action == 5) { //answer } else if (action === 5) { // answer
url = WorkListMainItgComponent.ANSWER; url = WorkListMainItgComponent.ANSWER;
if (!comments) { if (!comments) {
this.common.presentAlert(this.ts.trPK('worklist', 'empty-comment')); this.common.presentAlert(this.ts.trPK('worklist', 'empty-comment'));
} else { } else {
this.workListService.getITGActionRequest(request, url) this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => { .subscribe((result: any) => {
if (result.MessageStatus != 1) { if (result.MessageStatus !== 1) {
this.common.presentAlert(this.ts.trPK('general', 'error-itg')); this.common.presentAlert(this.ts.trPK('general', 'error-itg'));
} else if (result.MessageStatus == 1) { } else if (result.MessageStatus === 1) {
this.messageSuccess = true; this.messageSuccess = true;
setTimeout(() => { setTimeout(() => {
this.messageSuccess = false; this.messageSuccess = false;
@ -382,20 +363,19 @@ export class WorkListMainItgComponent implements OnInit {
} }
}); });
} }
} else if (action == 6) { //grant } else if (action === 6) { // grant
url = WorkListMainItgComponent.GRANT; url = WorkListMainItgComponent.GRANT;
if (!comments) { if (!comments) {
this.common.presentAlert(this.ts.trPK('worklist', 'empty-comment')); this.common.presentAlert(this.ts.trPK('worklist', 'empty-comment'));
} } else {
else {
if (this.grantRequest) { if (this.grantRequest) {
request.AdditionalFields = this.grantRequest; request.AdditionalFields = this.grantRequest;
this.workListService.getITGActionRequest(request, url) this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => { .subscribe((result: any) => {
if (result.MessageStatus != 1) { if (result.MessageStatus !== 1) {
this.common.presentAlert(this.ts.trPK('general', 'error-itg')); this.common.presentAlert(this.ts.trPK('general', 'error-itg'));
} else if (result.MessageStatus == 1) { } else if (result.MessageStatus === 1) {
this.messageSuccess = true; this.messageSuccess = true;
setTimeout(() => { setTimeout(() => {
this.messageSuccess = false; this.messageSuccess = false;
@ -412,16 +392,16 @@ export class WorkListMainItgComponent implements OnInit {
} }
} }
} else if (action == 7) { //grant } else if (action === 7) { // grant
url = WorkListMainItgComponent.GRANT; url = WorkListMainItgComponent.GRANT;
if (this.grantRequest) { if (this.grantRequest) {
request.AdditionalFields = this.grantRequest; request.AdditionalFields = this.grantRequest;
this.workListService.getITGActionRequest(request, url) this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => { .subscribe((result: any) => {
if (result.MessageStatus != 1) { if (result.MessageStatus !== 1) {
this.common.presentAlert(this.ts.trPK('general', 'error-itg')); this.common.presentAlert(this.ts.trPK('general', 'error-itg'));
} else if (result.MessageStatus == 1) { } else if (result.MessageStatus === 1) {
this.messageSuccess = true; this.messageSuccess = true;
setTimeout(() => { setTimeout(() => {
this.messageSuccess = false; this.messageSuccess = false;
@ -476,13 +456,13 @@ export class WorkListMainItgComponent implements OnInit {
selectAtion(actionSelected) { selectAtion(actionSelected) {
this.actionSelected = actionSelected; this.actionSelected = actionSelected;
if (this.actionSelected == "Answer") { if (this.actionSelected === 'Answer') {
this.actionService(5, this.commentText) this.actionService(5, this.commentText);
} }
if (this.actionSelected == "Approve") { if (this.actionSelected === 'Approve') {
this.actionService(1, this.commentText); this.actionService(1, this.commentText);
} }
if (this.actionSelected == "Delegate") { if (this.actionSelected === 'Delegate') {
this.presentModal(4); this.presentModal(4);
} }
if (this.actionSelected === 'Doable') { if (this.actionSelected === 'Doable') {
@ -495,6 +475,7 @@ export class WorkListMainItgComponent implements OnInit {
this.actionService(2, this.commentText); this.actionService(2, this.commentText);
} }
if (this.actionSelected === 'Question') { if (this.actionSelected === 'Question') {
this.actionService(5, this.commentText);
} }
if (this.actionSelected === 'Reject') { if (this.actionSelected === 'Reject') {
this.actionService(2, this.commentText); this.actionService(2, this.commentText);
@ -522,9 +503,9 @@ export class WorkListMainItgComponent implements OnInit {
.then((data) => { .then((data) => {
this.replcamentID = data.data.empData.USER_NAME; this.replcamentID = data.data.empData.USER_NAME;
this.commentText = data.data.comments; this.commentText = data.data.comments;
if (actionNumber == 3) { if (actionNumber === 3) {
this.actionService(3, this.commentText); this.actionService(3, this.commentText);
} else if (actionNumber == 4) { } else if (actionNumber === 4) {
this.actionService(4); this.actionService(4);
} }

Loading…
Cancel
Save