From ab2ace51b99c47738295833efb026a4d70ea1473 Mon Sep 17 00:00:00 2001 From: umasoodch Date: Mon, 9 Mar 2020 14:34:18 +0300 Subject: [PATCH] MM-112 FIXED - worklist and home loader issue resolved --- .../services/accrual.service.ts | 23 ++- Mohem/src/app/eit/services/eit.service.ts | 16 +- .../services/connector/connector.service.ts | 70 ++++--- .../services/dashbored/dashbored.service.ts | 58 +++--- .../services/menu/menuservice.service.ts | 44 +++-- .../hmg-common/services/push/push.service.ts | 4 +- Mohem/src/app/home/home.page.ts | 172 +++++++----------- .../app/notification/home/home.component.html | 11 -- .../app/notification/home/home.component.ts | 15 +- .../service/work-list.main.service.ts | 55 ++++-- .../notification/service/worklist.service.ts | 8 +- .../worklist-advanced-search.component.html | 14 +- .../worklist-advanced-search.component.scss | 8 +- 13 files changed, 266 insertions(+), 232 deletions(-) diff --git a/Mohem/src/app/accrual-balances/services/accrual.service.ts b/Mohem/src/app/accrual-balances/services/accrual.service.ts index c7b6c198..d99a0c5b 100644 --- a/Mohem/src/app/accrual-balances/services/accrual.service.ts +++ b/Mohem/src/app/accrual-balances/services/accrual.service.ts @@ -12,14 +12,23 @@ export class AccrualService { public con: ConnectorService, public authService: AuthenticationService ) {} - public getAccrualBalances(balance: any, onError?: any, errorLabel?: string) { + public getAccrualBalances(balance: any, onError?: any, errorLabel?: string, isPostNoLoad = false) { const request = balance; this.authService.authenticateRequest(request); - return this.con.post( - AccrualService.GET_ACCRUAL_BALANCE, - request, - onError, - errorLabel - ); + if (isPostNoLoad) { + return this.con.postNoLoad( + AccrualService.GET_ACCRUAL_BALANCE, + request, + onError, + errorLabel + ); + } else { + return this.con.post( + AccrualService.GET_ACCRUAL_BALANCE, + request, + onError, + errorLabel + ); + } } } diff --git a/Mohem/src/app/eit/services/eit.service.ts b/Mohem/src/app/eit/services/eit.service.ts index c88b7401..9063a6ff 100644 --- a/Mohem/src/app/eit/services/eit.service.ts +++ b/Mohem/src/app/eit/services/eit.service.ts @@ -27,18 +27,22 @@ export class EitService { public static deleteAttach = 'Services/ERP.svc/REST/DELETE_ATTACHMENT'; public static getApproversList = 'Services/ERP.svc/REST/GET_APPROVERS_LIST'; public static addAttachment = 'Services/ERP.svc/REST/ADD_ATTACHMENT'; - public static cancelHRTransaction = 'Services/ERP.svc/REST/CANCEL_HR_TRANSACTION' + public static cancelHRTransaction = 'Services/ERP.svc/REST/CANCEL_HR_TRANSACTION'; public static getAttach = 'Services/ERP.svc/REST/GET_ATTACHMENTS'; constructor(public authService: AuthenticationService, public con: ConnectorService) { } - public getMenuEntries(menuEntries: any, onError?: any, errorLabel?: string): Observable { + public getMenuEntries(menuEntries: any, onError?: any, errorLabel?: string, isPostNoLoad = false): Observable { const request = menuEntries; this.authService.authenticateRequest(request); - console.log(request); - return this.con.post(EitService.getMenuEntries, request, onError, errorLabel); + if (isPostNoLoad) { + return this.con.postNoLoad(EitService.getMenuEntries, request, onError, errorLabel); + } else { + return this.con.post(EitService.getMenuEntries, request, onError, errorLabel); + } } + // tslint:disable-next-line: no-shadowed-variable public getEITTransactionsList(EITTransactionsRequest: EITTransactionsRequest, onError?: any, errorLabel?: string): Observable { const request = EITTransactionsRequest; this.authService.authenticateRequest(request); @@ -78,9 +82,9 @@ export class EitService { public getApproversList(abProcess: any, onError?: any, errorLabel?: string): Observable { const request = abProcess; - request.P_AME_TRANSACTION_TYPE = "SSHRMS"; + request.P_AME_TRANSACTION_TYPE = 'SSHRMS'; request.P_PAGE_NUM = 1; - request.P_PAGE_LIMIT = 1000;//check later on + request.P_PAGE_LIMIT = 1000; // check later on this.authService.authenticateRequest(request); return this.con.post(EitService.getApproversList, request, onError, errorLabel); } diff --git a/Mohem/src/app/hmg-common/services/connector/connector.service.ts b/Mohem/src/app/hmg-common/services/connector/connector.service.ts index adb01bad..1335e79d 100644 --- a/Mohem/src/app/hmg-common/services/connector/connector.service.ts +++ b/Mohem/src/app/hmg-common/services/connector/connector.service.ts @@ -1,31 +1,31 @@ -import { Injectable } from "@angular/core"; +import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders, HttpErrorResponse -} from "@angular/common/http"; -import { Observable, throwError, TimeoutError } from "rxjs"; -import { catchError, retry, tap, timeout } from "rxjs/operators"; -import { CommonService } from "../common/common.service"; -//import { Response } from "../models/response"; +} from '@angular/common/http'; +import { Observable, throwError, TimeoutError } from 'rxjs'; +import { catchError, retry, tap, timeout } from 'rxjs/operators'; +import { CommonService } from '../common/common.service'; +// import { Response } from "../models/response"; import { Response } from 'src/app/hmg-common/services/models/response'; @Injectable({ - providedIn: "root" + providedIn: 'root' }) export class ConnectorService { /* connection configuration settings */ static httpOptions = { - headers: new HttpHeaders({ "Content-Type": "application/json" }) + headers: new HttpHeaders({ 'Content-Type': 'application/json' }) }; public static retryTimes = 0; public static timeOut = 30 * 1000; // public static host = 'http://10.50.100.113:6060/'; // development service -public static host = "https://uat.hmgwebservices.com/"; - //public static host = 'https://hmgwebservices.com/'; +public static host = 'https://uat.hmgwebservices.com/'; + // public static host = 'https://hmgwebservices.com/'; // public static host = 'http://10.50.100.198:6060/'; // public static host = 'http://10.50.100.113:6060/'; // development service /* public static host = 'http://10.50.100.198:6060/'; @@ -64,17 +64,33 @@ public static host = "https://uat.hmgwebservices.com/"; ); } - public postNoLoad(service: string, data: any, onError: any): Observable { + // public postNoLoad(service: string, data: any, onError: any): Observable { + // return this.httpClient + // .post( + // ConnectorService.host + service, + // data, + // ConnectorService.httpOptions + // ) + // .pipe( + // retry(ConnectorService.retryTimes), + // tap(() => {}, () => {}) + // ); + // } + + public postNoLoad(service: string, data: any, onError: any, errorLabel?: string): Observable { return this.httpClient - .post( + .post( ConnectorService.host + service, data, - ConnectorService.httpOptions - ) - .pipe( - retry(ConnectorService.retryTimes), - tap(() => {}, () => {}) - ); + ConnectorService.httpOptions) + .pipe( + timeout(ConnectorService.timeOut), + retry(ConnectorService.retryTimes), + tap((res) => { + this.handleResponse(res, onError, errorLabel, true); + }, (error) => { + this.handleError(error, onError, errorLabel, true); + })); } // absolute url connection @@ -133,7 +149,10 @@ public static host = "https://uat.hmgwebservices.com/"; } */ - public handleError(error: any, onError: any, errorLabel: string) { + public handleError(error: any, onError: any, errorLabel: string, isPostNoLoad = false) { + // if (!isPostNoLoad) { + // this.cs.stopLoading(); + // } this.cs.stopLoading(); if (error instanceof TimeoutError) { this.cs.showConnectionTimeout(onError, errorLabel); @@ -142,20 +161,19 @@ public static host = "https://uat.hmgwebservices.com/"; } } - public handleResponse(result: Response, onError: any, errorLabel: string) { - this.cs.stopLoading(); + public handleResponse(result: Response, onError: any, errorLabel: string, isPostNoLoad = false) { + if (!isPostNoLoad) { + this.cs.stopLoading(); + } if (!this.cs.validResponse(result)) { - // not authorized - console.log(result.MessageStatus); - console.log("erroe"); - if (result.IsAuthenticated == false) { + if (result.IsAuthenticated === false) { this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => { this.cs.sharedService.clearAll(); this.cs.openLogin(); }); return false; } else if (result.ErrorType === 2 || result.ErrorType === 4) { - //console.log("error expired"); + // console.log("error expired"); } else { this.cs.showErrorMessageDialog( onError, diff --git a/Mohem/src/app/hmg-common/services/dashbored/dashbored.service.ts b/Mohem/src/app/hmg-common/services/dashbored/dashbored.service.ts index 587aeee6..fb532437 100644 --- a/Mohem/src/app/hmg-common/services/dashbored/dashbored.service.ts +++ b/Mohem/src/app/hmg-common/services/dashbored/dashbored.service.ts @@ -34,7 +34,7 @@ export class DashboredService { public authService: AuthenticationService, ) { } - public getOrganizationSalaries(onError ?: any ,oerrorLable ?: any): Observable{ + public getOrganizationSalaries(onError ?: any , oerrorLable ?: any): Observable{ const request = new Request(); this.authService.authenticateRequest(request); return this.con.post( @@ -42,21 +42,20 @@ export class DashboredService { request, onError, oerrorLable - );} + ); + } - public getOpenMissingSwipes(onError ?: any, oerrorLable ?: any): Observable { + public getOpenMissingSwipes(onError ?: any, oerrorLable ?: any, isPostNoLoad = false): Observable { const request = new Request(); this.authService.authenticateRequest(request); - return this.con.post( - DashboredService.openMissingSwipesUrl, - request, - onError, - oerrorLable - ); + if (isPostNoLoad) { + return this.con.postNoLoad(DashboredService.openMissingSwipesUrl, request, onError, oerrorLable); + } else { + return this.con.post( DashboredService.openMissingSwipesUrl, request, onError, oerrorLable); + } } - - public getPerformanceAppraisal(onError ?: any ,oerrorLable ?: any): Observable{ + public getPerformanceAppraisal(onError ?: any , oerrorLable ?: any): Observable{ const request = new Request(); this.authService.authenticateRequest(request); return this.con.post( @@ -66,30 +65,47 @@ export class DashboredService { oerrorLable ); } -public getAttendanceTracking(selectedEmployee: any, onError ?: any , oerrorLable ?: any): Observable{ +// tslint:disable-next-line: max-line-length +public getAttendanceTracking(selectedEmployee: any, onError ?: any , oerrorLable ?: any, isPostNoLoad = false): Observable{ const request = selectedEmployee; this.authService.authenticateRequest(request); - return this.con.post( - DashboredService.attendancetrackingUrl, - request, - onError, - oerrorLable - ); + if (isPostNoLoad) { + return this.con.postNoLoad( + DashboredService.attendancetrackingUrl, + request, + onError, + oerrorLable + ); + } else { + return this.con.post( + DashboredService.attendancetrackingUrl, + request, + onError, + oerrorLable + ); + } } public getOpenPeriodDates( onError?: any, errorLabel?: string): Observable { const request = new Request(); this.authService.authenticateRequest(request); return this.con.post(DashboredService.getOpenPeriodDates, request, onError, errorLabel); } - public getOpenNotifications( onError?: any, errorLabel?: string): Observable { + public getOpenNotifications( onError?: any, errorLabel?: string, isPostNoLoad = false): Observable { + console.log(isPostNoLoad); const request = new Request(); this.authService.authenticateRequest(request); - return this.con.post(DashboredService.getOpenNotifications, request, onError, errorLabel); + if (isPostNoLoad) { + return this.con.postNoLoad(DashboredService.getOpenNotifications, request, onError, errorLabel); + } else { + return this.con.post(DashboredService.getOpenNotifications, request, onError, errorLabel); + } } - public getSubordinatesLeaves( req: GetSubordinatesLeavesRequest,onError?: any, errorLabel?: string): Observable { + // tslint:disable-next-line: max-line-length + public getSubordinatesLeaves( req: GetSubordinatesLeavesRequest, onError?: any, errorLabel?: string): Observable { this.authService.authenticateRequest(req); return this.con.post(DashboredService.getSubordinatesLeaves, req, onError, errorLabel); } + // tslint:disable-next-line: max-line-length public getSubordinatesAttStatus( req: GetSubordinatesAttdStatusRequest, onError?: any, errorLabel?: string): Observable { this.authService.authenticateRequest(req); return this.con.post(DashboredService.getSubordinatesAttStatus, req, onError, errorLabel); diff --git a/Mohem/src/app/hmg-common/services/menu/menuservice.service.ts b/Mohem/src/app/hmg-common/services/menu/menuservice.service.ts index 68487c69..e8b16739 100644 --- a/Mohem/src/app/hmg-common/services/menu/menuservice.service.ts +++ b/Mohem/src/app/hmg-common/services/menu/menuservice.service.ts @@ -1,51 +1,55 @@ import {Injectable} from '@angular/core'; -import {Http, Response, Headers, } from "@angular/http"; -import {AuthenticationService} from "../authentication/authentication.service"; +import {Http, Response, Headers, } from '@angular/http'; +import {AuthenticationService} from '../authentication/authentication.service'; import { Observable } from 'rxjs'; import {MenuEntries} from './models/menu-entries.request'; import { Request } from 'src/app/hmg-common/services/models/request'; -//import {Request} from '../models/request'; -import {MenuResponse} from './models/menu-response' +// import {Request} from '../models/request'; +import {MenuResponse} from './models/menu-response'; import { ConnectorService } from '../connector/connector.service'; @Injectable() export class MenuService { - public static getMenu ='Services/ERP.svc/REST/GET_MENU'; + public static getMenu = 'Services/ERP.svc/REST/GET_MENU'; public static getMenuEntries = 'Services/ERP.svc/REST/GET_MENU_ENTRIES'; public static getMyTeam = 'Services/ERP.svc/REST/GET_EMPLOYEE_SUBORDINATES'; - public static getNotCount='Services/ERP.svc/REST/GET_OPEN_NOTIFICATIONS_NUM'; - public static disableSession="Services/ERP.svc/REST/DisableSession"; - public static detectLanguage='Services/ERP.svc/REST/Get_LanguageAvailable'; + public static getNotCount = 'Services/ERP.svc/REST/GET_OPEN_NOTIFICATIONS_NUM'; + public static disableSession = 'Services/ERP.svc/REST/DisableSession'; + public static detectLanguage = 'Services/ERP.svc/REST/Get_LanguageAvailable'; constructor( public authService: AuthenticationService, - public con:ConnectorService - + public con: ConnectorService + ) { } - - public getMenu(onError?: any, errorLabel?: string): Observable { + + public getMenu(onError?: any, errorLabel?: string, isPostNoLoad = false): Observable { const request = new Request(); this.authService.authenticateRequest(request); - return this.con.post(MenuService.getMenu, request, onError, errorLabel); + if (isPostNoLoad) { + return this.con.postNoLoad(MenuService.getMenu, request, onError, errorLabel); + } else { + return this.con.post(MenuService.getMenu, request, onError, errorLabel); + } } - public getMenuEntires(menuEntries:any, onError?: any, errorLabel?: string): Observable { + public getMenuEntires(menuEntries: any, onError?: any, errorLabel?: string): Observable { const request = menuEntries; this.authService.authenticateRequest(request); return this.con.post(MenuService.getMenuEntries, request, onError, errorLabel); } - public getNotificationCount(req:any, onError?: any, errorLabel?: string): Observable { + public getNotificationCount(req: any, onError?: any, errorLabel?: string): Observable { const request = req; this.authService.authenticateRequest(request); return this.con.post(MenuService.getNotCount, request, onError, errorLabel); } - public disableSession(req:any, onError?: any, errorLabel?: string): Observable { + public disableSession(req: any, onError?: any, errorLabel?: string): Observable { const request = req; this.authService.authenticateRequest(request); return this.con.post(MenuService.disableSession, request, onError, errorLabel); - } + } - public getAppLanguages(req:any, onError?: any, errorLabel?: string): Observable { + public getAppLanguages(req: any, onError?: any, errorLabel?: string): Observable { const request = req; this.authService.authenticateRequest(request); return this.con.post(MenuService.detectLanguage, request, onError, errorLabel); - } -} \ No newline at end of file + } +} diff --git a/Mohem/src/app/hmg-common/services/push/push.service.ts b/Mohem/src/app/hmg-common/services/push/push.service.ts index c1b5ed3f..eeb2a7a7 100644 --- a/Mohem/src/app/hmg-common/services/push/push.service.ts +++ b/Mohem/src/app/hmg-common/services/push/push.service.ts @@ -183,11 +183,11 @@ export class PushService { request.DeviceType = this.getDeviceType(); const user = this.authService.getAuthenticatedUser(); // request.PatientMobileNumber = user.MobileNo; - //request.NationalID = user.IdentificationNo; + // request.NationalID = user.IdentificationNo; request.Gender = user.Gender; request.PatientID = user.PatientID; // request.PatientOutSA = user.PatientOutSA ? 1 : 0; - //request.LoginType = user.biometricEnabled ? 2 : 1; // 1 sms , 2 touch id + // request.LoginType = user.biometricEnabled ? 2 : 1; // 1 sms , 2 touch id request.MACAddress = '00:00:00:00:00:00'; return this.con.postNoLoad(PushService.loggedInUserURL, request , () => { }).subscribe((result: Response) => { diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index a817b1f6..cd93537b 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -8,7 +8,6 @@ import { MenuService } from 'src/app/hmg-common/services/menu/menuservice.servic import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { Geolocation } from '@ionic-native/geolocation/ngx'; -import { ZBar, ZBarOptions } from '@ionic-native/zbar/ngx'; import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx'; import { Device } from '@ionic-native/device/ngx'; import { attendanceSwipeScannerRequest } from './models/attendanceSwipe.Request'; @@ -33,8 +32,6 @@ import { GetOpenNotificationsResponse } from '../hmg-common/services/dashbored/m import { GetSubordinatesAttdStatusResponse } from '../hmg-common/services/dashbored/models/GetSubordinatesAttdStatusResponse'; import { GetSubordinatesLeavesResponse } from '../hmg-common/services/dashbored/models/GetSubordinatesLeavesResponse'; import { AccrualService } from '../accrual-balances/services/accrual.service'; -import { GetDayAndHoursDetailsRequest } from '../time-card/service/models/get-day-hours-type-details.request'; -import * as moment from 'moment'; import { TimeCardService } from '../time-card/service/time-card.service'; import { WorklistMainService } from '../notification/service/work-list.main.service'; @@ -57,9 +54,9 @@ export class HomePage implements OnInit { public fileUploder: FileUploaderComponent; location: boolean; camera: boolean; - ticketRequestObject : any; - leaveRequestObject : any; - missingSwipeRequestObject : any; + ticketRequestObject: any; + leaveRequestObject: any; + missingSwipeRequestObject: any; public statsButtons = [ { title: 'Work List', @@ -93,25 +90,6 @@ export class HomePage implements OnInit { } ]; - // public employeeServicesButtons = [ - // { - // title: 'Leave Management', - // icon: 'assets/icon/new-design/leave_management.png' - // }, - // { - // title: 'Advance Payments', - // icon: 'assets/icon/new-design/advance_payments.png' - // }, - // { - // title: 'Medical Insurance', - // icon: 'assets/icon/new-design/medical_insurance.png' - // }, - // { - // title: 'Pay Slip', - // icon: 'assets/icon/new-design/pay_slip.png' - // } - // ]; - public slideOptsOne = { slidesPerView: 3.5, spaceBetween: 10 @@ -136,6 +114,7 @@ export class HomePage implements OnInit { public menuType: any; accrualBalancesList: any; public countAllNotification = 0; + public isPostNoLoad = true; constructor( public ts: TranslatorService, @@ -145,35 +124,30 @@ export class HomePage implements OnInit { public common: CommonService, public events: Events, private device: Device, - private zbar: ZBar, private geolocation: Geolocation, private attendanceService: AttendanceService, private eitService: EitService, private barcodeScanner: BarcodeScanner, public actionSheetCtrl: ActionSheetController, - private cameraController: Camera, public sharedData: SharedDataService, private sanitizer: DomSanitizer, private file: File, private permissions: DevicePermissionsService, public DS: DashboredService, public accrualService: AccrualService, - //////////////////////////////////////// TIME AND DATE//////////////////////////// public timeCardService: TimeCardService, - ///////////////////// END///////////////////////////////////////////////////////// public workListService: WorklistMainService ) { this.events.subscribe('img-change', displayImg => { this.userImage = this.sanitizer.bypassSecurityTrustUrl( 'data:Image/*;base64,' + displayImg ); - console.log('html saved img: ' + this.userImage); }); } ngOnInit() { - this.menu.enable(true) - + this.common.startLoading(); + this.menu.enable(true); // this.getUserDetails(); // this.getCount(); this.events.subscribe('getNotCount', badge => { @@ -182,6 +156,7 @@ export class HomePage implements OnInit { } ionViewWillEnter() { + this.common.startLoading(); this.remainingTime = 0; this.displayTime = '00:00:00'; this.runTimer = false; @@ -320,9 +295,9 @@ export class HomePage implements OnInit { this.userData, AuthenticatedUser.SHARED_DATA ); - if(this.common.getUpdateImage().status){ - this.userImage =this.sanitizer.bypassSecurityTrustUrl("data:image/png;base64,"+this.common.getUpdateImage().img); - }else{ + if (this.common.getUpdateImage().status) { + this.userImage = this.sanitizer.bypassSecurityTrustUrl('data:image/png;base64,' + this.common.getUpdateImage().img); + } else { this.userImage = user.EMPLOYEE_IMAGE ? 'data:image/png;base64,' + user.EMPLOYEE_IMAGE : this.userImage; @@ -341,6 +316,7 @@ export class HomePage implements OnInit { this.showOpenMissingSwipes(); this.showAttendanceTracking(); this.getAccrualBalance(); + // this.common.stopLoading(); } public Vacation_Rule() { @@ -348,7 +324,7 @@ export class HomePage implements OnInit { } private getMenu() { - this.menuService.getMenu().subscribe((result: MenuResponse) => { + this.menuService.getMenu('', '', this.isPostNoLoad).subscribe((result: MenuResponse) => { this.handleMenuResult(result); }); } @@ -356,7 +332,6 @@ export class HomePage implements OnInit { private handleMenuResult(result) { if (this.common.validResponse(result)) { if (this.common.hasData(result.List_Menu)) { - console.log('list menu'); this.menuList = result.List_Menu; this.getMenuDetails(); } @@ -376,15 +351,15 @@ export class HomePage implements OnInit { const selMenu: MenuResponse = new MenuResponse(); selMenu.List_Menu = item; selMenu.userid = this.userData.EMPLOYEE_NUMBER; - console.log("menu: " + selMenu.List_Menu); this.common.sharedService.setSharedData(selMenu, MenuResponse.SHARED_DATA); this.getMenuEntries(item); - for(let i=0;i { this.handleMenuEntiresResult(result); }); @@ -446,9 +420,8 @@ export class HomePage implements OnInit { sortMenuEntires(list) { const tree = this.common.list_to_tree(list); this.menuEntries = tree; - console.log(this.menuEntries); - this.common.sharedService.setSharedData(tree, "menuEntries"); - this.common.sharedService.setSharedData("home", "homemenuentries"); + this.common.sharedService.setSharedData(tree, 'menuEntries'); + this.common.sharedService.setSharedData('home', 'homemenuentries'); // this.common.navigateForward("/eit/homepage"); // this.common.openEITPage(); } @@ -456,24 +429,26 @@ export class HomePage implements OnInit { private handleMenuEntiresResult(result) { if (this.common.validResponse(result)) { if (this.common.hasData(result.GetMenuEntriesList)) { - for(let i=0;i { - console.log("Error", err); + console.log('Error', err); }); } @@ -513,14 +488,13 @@ export class HomePage implements OnInit { request.QRValue = this.scannedResult.text; request.UID = this.deviceID; request.UserName = this.userData.EMPLOYEE_NUMBER; - console.log(JSON.stringify(request)); this.attendanceService .attendanceSwipeScanner(request, () => { - console.log("Error inside in swipe attendance"); + console.log('Error inside in swipe attendance'); }) .subscribe((result: Response) => { if (this.common.validResponse(result)) { - this.common.presentAlert(this.ts.trPK("home", "swipeAlertSuccess")); + this.common.presentAlert(this.ts.trPK('home', 'swipeAlertSuccess')); this.showAttendanceTracking(); } // else { @@ -533,8 +507,7 @@ export class HomePage implements OnInit { this.common.openProfile(); } - /*************************************Dashboards Services**********************************************************8 */ - + // Dashboard Services showOrganizationSalaries() { this.DS.getOrganizationSalaries().subscribe( (result: OrganizationSalariesResponse) => {} @@ -542,10 +515,10 @@ export class HomePage implements OnInit { } showOpenMissingSwipes() { - this.DS.getOpenMissingSwipes().subscribe( + this.DS.getOpenMissingSwipes('', '', this.isPostNoLoad).subscribe( (result: OpenMissingSwipesResponse) => { if (this.common.validResponse(result)) { - const key = "GetOpenMissingSwipesList"; + const key = 'GetOpenMissingSwipesList'; this.statsButtons[1].statsValue = Math.floor(result[key].P_OPEN_MISSING_SWIPES); } } @@ -567,7 +540,6 @@ export class HomePage implements OnInit { } convertAndAssignTime(data) { - console.log(data); this.remainingTime = this.convertInSeconds(data.P_REMAINING_HOURS.split(':')); this.scheduledTime = this.convertInSeconds(data.P_SCHEDULED_HOURS.split(':')); this.spentHours = this.convertInSeconds(data.P_SPENT_HOURS.split(':')); @@ -581,7 +553,7 @@ showAttendanceTracking() { const request = { P_SELECTED_EMPLOYEE_NUMBER: this.userData.EMPLOYEE_NUMBER }; - this.DS.getAttendanceTracking(request).subscribe((result: AttendanceTrackingResponse) => { + this.DS.getAttendanceTracking(request, '', '', this.isPostNoLoad).subscribe((result: AttendanceTrackingResponse) => { if (this.common.validResponse(result)) { const key = 'GetAttendanceTrackingList'; this.convertAndAssignTime(result[key]); @@ -598,10 +570,7 @@ openPeriodDateDashbored() { } openNotificationsDashbored() { - // work list - this.DS.getOpenNotifications(() => { - console.log("Error "); - }).subscribe((result: GetOpenNotificationsResponse) => { + this.DS.getOpenNotifications('', '', this.isPostNoLoad).subscribe((result: GetOpenNotificationsResponse) => { if (this.common.validResponse(result)) { const key = 'P_OPEN_NTF_NUMBER'; this.countAllNotification = result[key]; @@ -615,18 +584,19 @@ openPeriodDateDashbored() { } ITGCountAllNotification() { - this.workListService.getITGDetails().subscribe((result: any) => { + this.workListService.getITGDetails('', '', this.isPostNoLoad).subscribe((result: any) => { this.statsButtons[0].statsValue = Math.floor(this.countAllNotification + result.TotalCount); + this.common.stopLoading(); }); } getSubordinatesLeaves() { const request: GetSubordinatesLeavesRequest = new GetSubordinatesLeavesRequest(); - request.P_DATE_FROM = "/Date(1578603600000+0300)/"; // test - request.P_DATE_TO = "/Date(1576011600000+0300)/"; // test + request.P_DATE_FROM = '/Date(1578603600000+0300)/'; // test + request.P_DATE_TO = '/Date(1576011600000+0300)/'; // test this.DS.getSubordinatesLeaves(request, () => { - console.log("Error "); + console.log('Error '); }).subscribe((result: GetSubordinatesLeavesResponse) => { if (this.common.validResponse(result)) { console.log('response'); @@ -637,10 +607,10 @@ openPeriodDateDashbored() { getSubordinatesAttStatus() { const request: GetSubordinatesAttdStatusRequest = new GetSubordinatesAttdStatusRequest(); - request.P_SCHEDULE_DATE_FROM = "/Date(1578603600000+0300)/"; // test - request.P_SCHEDULE_DATE_TO = "/Date(1576011600000+0300)/"; // test + request.P_SCHEDULE_DATE_FROM = '/Date(1578603600000+0300)/'; // test + request.P_SCHEDULE_DATE_TO = '/Date(1576011600000+0300)/'; // test this.DS.getSubordinatesAttStatus(request, () => { - console.log("Error "); + console.log('Error '); }).subscribe((result: GetSubordinatesAttdStatusResponse) => { if (this.common.validResponse(result)) { console.log('response'); @@ -650,7 +620,6 @@ getSubordinatesAttStatus() { } openPage(subMenu) { - console.log("openPage"); let selMenu: MenuResponse = new MenuResponse(); selMenu = this.common.sharedService.getSharedData( MenuResponse.SHARED_DATA, @@ -681,41 +650,28 @@ getSubordinatesAttStatus() { const day = today.getDate(); const month = today.getMonth() + 1; const year = today.getFullYear(); - const todayDate = month + "/" + day + "/" + year; + const todayDate = month + '/' + day + '/' + year; const effectiveDate = todayDate; const request = { P_SELECTED_EMPLOYEE_NUMBER: this.userData.EMPLOYEE_NUMBER, P_EFFECTIVE_DATE: effectiveDate }; - this.accrualService.getAccrualBalances(request).subscribe((result: any) => { + this.accrualService.getAccrualBalances(request, '', '', this.isPostNoLoad).subscribe((result: any) => { if (this.common.validResponse(result)) { let totalTicketsLeft = 0; this.accrualBalancesList = result.GetAccrualBalancesList; for (const accrualBalance of result.GetAccrualBalancesList) { - if ( - accrualBalance.ACCURAL_PLAN_NAME === - "HMG Annual Vacation Accrual Plan" - ) { + if (accrualBalance.ACCURAL_PLAN_NAME === 'HMG Annual Vacation Accrual Plan') { this.statsButtons[2].statsValue = Math.floor(accrualBalance.ACCRUAL_NET_ENTITLEMENT); - this.common.sharedService.setSharedData( - accrualBalance, - "leaveAccrualBalance" - ); - this.common.sharedService.setSharedData( - request, - "leaveAccrualBalanceDate" - ); - this.common.sharedService.setSharedData( - this.accrualBalancesList, - "tickitsbalance" - ); + this.common.sharedService.setSharedData(accrualBalance, 'leaveAccrualBalance'); + this.common.sharedService.setSharedData(request, 'leaveAccrualBalanceDate'); + this.common.sharedService.setSharedData(this.accrualBalancesList, 'tickitsbalance'); } else { - totalTicketsLeft = - totalTicketsLeft + accrualBalance.ACCRUAL_NET_ENTITLEMENT; + totalTicketsLeft = totalTicketsLeft + accrualBalance.ACCRUAL_NET_ENTITLEMENT; } } - this.statsButtons[3].statsValue = Math.floor(totalTicketsLeft); + this.statsButtons[3].statsValue = Math.floor(totalTicketsLeft); } }); } @@ -730,14 +686,18 @@ openProfilePage() { openStatsButton(link: any) { - // console.log(link); - if (link == "1") { + // tslint:disable-next-line: triple-equals + if (link == '1') { + this.common.startLoading(); this.common.openNotificationPage(); - } else if (link == "2") { + // tslint:disable-next-line: triple-equals + } else if (link == '2') { this.openPage(this.missingSwipeRequestObject); - } else if (link == "3") { + // tslint:disable-next-line: triple-equals + } else if (link == '3') { this.openPage(this.leaveRequestObject); - } else if (link =="4") { + // tslint:disable-next-line: triple-equals + } else if (link == '4') { this.openPage(this.ticketRequestObject); } } diff --git a/Mohem/src/app/notification/home/home.component.html b/Mohem/src/app/notification/home/home.component.html index 546dc045..793aaed6 100644 --- a/Mohem/src/app/notification/home/home.component.html +++ b/Mohem/src/app/notification/home/home.component.html @@ -7,7 +7,6 @@ -
@@ -50,9 +49,6 @@ Advanced Search - @@ -75,7 +71,6 @@
-
{{segmentInfo.ModifiedDate |date}} @@ -84,19 +79,13 @@
-
No Data Available
- - - - -
diff --git a/Mohem/src/app/notification/home/home.component.ts b/Mohem/src/app/notification/home/home.component.ts index 790b2ac3..15dd47c8 100644 --- a/Mohem/src/app/notification/home/home.component.ts +++ b/Mohem/src/app/notification/home/home.component.ts @@ -72,6 +72,7 @@ export class HomeComponent implements OnInit { public totalMR = 0; public showChart = false; + public isPostNoLoad = true; public options = { cutoutPercentage: 80, tooltips: { enabled: false }, @@ -165,6 +166,7 @@ export class HomeComponent implements OnInit { } ngOnInit() { + this.common.startLoading(); this.openNotificationsDashboard(); } @@ -175,7 +177,7 @@ export class HomeComponent implements OnInit { } openNotificationsDashboard() { - this.DS.getOpenNotifications().subscribe((result: GetOpenNotificationsResponse) => { + this.DS.getOpenNotifications('', '', this.isPostNoLoad).subscribe((result: GetOpenNotificationsResponse) => { if (this.common.validResponse(result)) { this.worklistNotifications = result; this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER; @@ -256,6 +258,7 @@ export class HomeComponent implements OnInit { modal.onDidDismiss().then(result => { if (result.data) { if (result.data.notificationType !== '' || result.data.selectedValue !== '' || result.data.itemType !== '') { + this.common.startLoading(); this.showSearchButton = true; this.itemType = result.data.itemType; this.notificationType = result.data.notificationType; @@ -273,6 +276,7 @@ export class HomeComponent implements OnInit { if (this.itemType !== '') { this.disableFilters(); } + this.isPostNoLoad = false; this.getAllPushNotificationFun(); } } @@ -296,7 +300,7 @@ export class HomeComponent implements OnInit { this.WorkListObj.P_SEARCH_SENT_DATE = ''; this.WorkListObj.P_SEARCH_SUBJECT = ''; } - this.WorklistService.getWorkList(this.WorkListObj).subscribe((result) => { + this.WorklistService.getWorkList(this.WorkListObj, '', '', this.isPostNoLoad).subscribe((result) => { if (this.common.validResponse(result)) { this.handleWorkListResult(result.GetWorkList); } @@ -412,6 +416,7 @@ export class HomeComponent implements OnInit { this.showFormattedData = this.sortArray(categorizedWorkListResponse); this.allFormattedData = this.showFormattedData; this.common.sharedService.setSharedData(this.newWorkListResponse, HomeComponent.NOTIFICATION_ARR); + this.common.stopLoading(); } else { this.newWorkListResponse = []; } @@ -449,8 +454,10 @@ export class HomeComponent implements OnInit { } clearSearch() { + this.common.startLoading(); this.itemType = ''; this.selectedFilter = 'ALL'; + this.isPostNoLoad = true; this.disableFilters(); this.resetData(); this.getAllPushNotificationFun(); @@ -471,7 +478,7 @@ export class HomeComponent implements OnInit { } Count() { - this.workListService.getITGCount() + this.workListService.getITGCount('', '', this.isPostNoLoad) .subscribe((result: any) => { for (let i = 0; i < result.RequestType.length; i++) { this.ITGSegment[i] = { @@ -486,7 +493,7 @@ export class HomeComponent implements OnInit { } Details() { - this.workListService.getITGDetails() + this.workListService.getITGDetails('', '', this.isPostNoLoad) .subscribe((result: any) => { this.ITGCount = result.TotalCount; this.totalRequestCount = this.totalRequestCount + result.TotalCount; diff --git a/Mohem/src/app/notification/service/work-list.main.service.ts b/Mohem/src/app/notification/service/work-list.main.service.ts index 720f5c1e..55721b2a 100644 --- a/Mohem/src/app/notification/service/work-list.main.service.ts +++ b/Mohem/src/app/notification/service/work-list.main.service.ts @@ -240,19 +240,27 @@ export class WorklistMainService { ); } - public getITGCount( onError?: any, errorLabel?: string): Observable { - const request = new Request; - console.log(request) + public getITGCount( onError?: any, errorLabel?: string, isPostNoLoad = false): Observable { + const request = new Request(); this.authService.authenticateRequest(request); - return this.api.post( - WorklistMainService.getITGFormTaskCount, - request, - onError, - errorLabel - ); + if (isPostNoLoad) { + return this.api.postNoLoad( + WorklistMainService.getITGFormTaskCount, + request, + onError, + errorLabel + ); + } else { + return this.api.post( + WorklistMainService.getITGFormTaskCount, + request, + onError, + errorLabel + ); + } } - public getITGFormDetails(request:itgRequest, onError?: any, errorLabel?: string): Observable { + public getITGFormDetails(request: itgRequest, onError?: any, errorLabel?: string): Observable { this.authService.authenticateRequest(request); request.EmployeeNumber = request.P_USER_NAME; console.log(request); @@ -266,16 +274,25 @@ export class WorklistMainService { - public getITGDetails( onError?: any, errorLabel?: string): Observable { - const request = new Request; - console.log(request) + public getITGDetails( onError?: any, errorLabel?: string, isPostNoLoad = false): Observable { + const request = new Request(); + console.log(request); this.authService.authenticateRequest(request); - return this.api.post( - WorklistMainService.getITGFormTaskDetails, - request, - onError, - errorLabel - ); + if (isPostNoLoad) { + return this.api.postNoLoad( + WorklistMainService.getITGFormTaskDetails, + request, + onError, + errorLabel + ); + } else { + return this.api.post( + WorklistMainService.getITGFormTaskDetails, + request, + onError, + errorLabel + ); + } } diff --git a/Mohem/src/app/notification/service/worklist.service.ts b/Mohem/src/app/notification/service/worklist.service.ts index 6dce8f24..2c719e86 100644 --- a/Mohem/src/app/notification/service/worklist.service.ts +++ b/Mohem/src/app/notification/service/worklist.service.ts @@ -22,10 +22,14 @@ export class WorklistService { ) { } - public getWorkList(WorkListReq: any, onError?: any, errorLabel?: string): Observable { + public getWorkList(WorkListReq: any, onError?: any, errorLabel?: string, isPostNoLoad = false): Observable { const request = WorkListReq; this.authService.authenticateRequest(request); - return this.api.post(WorklistService.getWorkList, request, onError, errorLabel); + if (isPostNoLoad) { + return this.api.postNoLoad(WorklistService.getWorkList, request, onError, errorLabel); + } else { + return this.api.post(WorklistService.getWorkList, request, onError, errorLabel); + } } public getReplacmentEmployeeList(ReplacmentEmployeeRequest: any, onError?: any, errorLabel?: string): Observable { diff --git a/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.html b/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.html index e0b313d3..9319d83d 100644 --- a/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.html +++ b/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.html @@ -7,8 +7,8 @@
- {{ts.trPK('worklist','view')}} - {{ts.trPK('worklist','view')}} + {{ts.trPK('worklist','openNot')}} {{ts.trPK('worklist','fyi')}} @@ -19,8 +19,8 @@ - {{ts.trPK('worklist','searchby')}} - {{ts.trPK('worklist','searchby')}} + {{ts.trPK('worklist','from')}} {{ts.trPK('worklist','subject')}} @@ -32,7 +32,7 @@
- {{ts.trPK('worklist','sent')}} + {{ts.trPK('worklist','sent')}} @@ -46,8 +46,8 @@
- Item Type - Item Type + HR PO diff --git a/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.scss b/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.scss index 36f26405..f842613c 100644 --- a/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.scss +++ b/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.scss @@ -18,7 +18,7 @@ .search-container { margin-right: 15px; margin-left: 15px; - padding-bottom: 100px; + // padding-bottom: 100px; margin-top: 5px; ion-item{ border: 2px solid #eaeaea; @@ -37,4 +37,10 @@ span{ color: white; } +} +.custom-width{ + max-width: 100% !important; +} +.enable-overflow{ + overflow: visible !important; } \ No newline at end of file