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

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

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

Loading…
Cancel
Save