added remaining services for dashboard

missing-swipe
umasoodch 6 years ago
parent ffc3bca0a6
commit a8f9640f68

@ -1,13 +1,13 @@
import { Component, OnInit } from "@angular/core"; import { Component, OnInit } from '@angular/core';
import { CommonService } from "src/app/hmg-common/services/common/common.service"; import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service"; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service"; import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { AccrualService } from "../services/accrual.service"; import { AccrualService } from '../services/accrual.service';
import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/models/authenticated-user"; import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user';
@Component({ @Component({
selector: "app-home", selector: 'app-home',
templateUrl: "./home.component.html", templateUrl: './home.component.html',
styleUrls: ["./home.component.scss"] styleUrls: ['./home.component.scss']
}) })
export class HomeComponent implements OnInit { export class HomeComponent implements OnInit {
Sdate: any; Sdate: any;
@ -39,7 +39,7 @@ export class HomeComponent implements OnInit {
let day = today.getDate(); let day = today.getDate();
let month = today.getMonth() + 1; let month = today.getMonth() + 1;
let year = today.getFullYear(); let year = today.getFullYear();
let todayDate = month + "/" + day + "/" + year; let todayDate = month + '/' + day + '/' + year;
let effectiveDate = todayDate; let effectiveDate = todayDate;
const request = { const request = {
P_SELECTED_EMPLOYEE_NUMBER: this.emp_no, P_SELECTED_EMPLOYEE_NUMBER: this.emp_no,

@ -1,9 +1,5 @@
export class OpenMissingSwipesList {
public P_OPEN_MISSING_SWIPES: number;
export class OpenMissingSwipesList{ public P_RETURN_STATUS: string;
public OPEN_MISSING_SWIPES :number; public P_RETURN_MSG: string;
public RETURN_STATUS : string;
public RETURN_MSG : string;
} }

@ -1,8 +1,8 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service"; import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { ConnectorService } from "src/app/hmg-common/services/connector/connector.service"; import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { Request } from "src/app/hmg-common/services/models/request"; import { Request } from 'src/app/hmg-common/services/models/request';
import { OrganizationSalariesResponse } from './organization-salaries.response'; import { OrganizationSalariesResponse } from './organization-salaries.response';
import { OpenMissingSwipesResponse } from './open-missing-swipes.response'; import { OpenMissingSwipesResponse } from './open-missing-swipes.response';
import { PerformanceAppraisalResponse } from './performance-appraisal.response'; import { PerformanceAppraisalResponse } from './performance-appraisal.response';
@ -19,10 +19,10 @@ import {GetOpenNotificationsResponse} from './models/GetOpenNotificationsRespons
providedIn: 'root' providedIn: 'root'
}) })
export class DashboredService { export class DashboredService {
public static organizationSalariesUrl="Services/ERP.svc/REST/GET_ORGANIZATIONS_SALARIES" public static organizationSalariesUrl = 'Services/ERP.svc/REST/GET_ORGANIZATIONS_SALARIES';
public static openmissingswipesUrl="Services/ERP.svc/REST/GET_OPEN_MISSING_SWIPES" public static openMissingSwipesUrl = 'Services/ERP.svc/REST/GET_OPEN_MISSING_SWIPES';
public static performanceappraisalUrl="Services/ERP.svc/REST/GET_Performance_Appraisal" public static performanceappraisalUrl = 'Services/ERP.svc/REST/GET_Performance_Appraisal';
public static attendancetrackingUrl="Services/ERP.svc/REST/GET_Attendance_Tracking" public static attendancetrackingUrl = 'Services/ERP.svc/REST/GET_Attendance_Tracking';
public static getOpenPeriodDates = 'Services/ERP.svc/REST/GET_OPEN_PERIOD_DATES'; public static getOpenPeriodDates = 'Services/ERP.svc/REST/GET_OPEN_PERIOD_DATES';
public static getOpenNotifications = 'Services/ERP.svc/REST/GET_OPEN_NOTIFICATIONS'; public static getOpenNotifications = 'Services/ERP.svc/REST/GET_OPEN_NOTIFICATIONS';
@ -34,7 +34,7 @@ export class DashboredService {
public authService: AuthenticationService, public authService: AuthenticationService,
) { } ) { }
public getOrganizationSalaries(onError ?:any ,oerrorLable ?:any):Observable<OrganizationSalariesResponse>{ public getOrganizationSalaries(onError ?: any ,oerrorLable ?: any): Observable<OrganizationSalariesResponse>{
const request = new Request(); const request = new Request();
this.authService.authenticateRequest(request); this.authService.authenticateRequest(request);
return this.con.post( return this.con.post(
@ -44,11 +44,11 @@ export class DashboredService {
oerrorLable oerrorLable
);} );}
public getOpenMissingSwipes(onError ?:any ,oerrorLable ?:any):Observable<OpenMissingSwipesResponse>{ public getOpenMissingSwipes(onError ?: any, oerrorLable ?: any): Observable<OpenMissingSwipesResponse> {
const request = new Request(); const request = new Request();
this.authService.authenticateRequest(request); this.authService.authenticateRequest(request);
return this.con.post( return this.con.post(
DashboredService.openmissingswipesUrl, DashboredService.openMissingSwipesUrl,
request, request,
onError, onError,
oerrorLable oerrorLable
@ -56,7 +56,7 @@ export class DashboredService {
} }
public getPerformanceAppraisal(onError ?:any ,oerrorLable ?:any):Observable<PerformanceAppraisalResponse>{ public getPerformanceAppraisal(onError ?: any ,oerrorLable ?: any): Observable<PerformanceAppraisalResponse>{
const request = new Request(); const request = new Request();
this.authService.authenticateRequest(request); this.authService.authenticateRequest(request);
return this.con.post( return this.con.post(
@ -66,7 +66,7 @@ export class DashboredService {
oerrorLable oerrorLable
); );
} }
public getAttendanceTracking(onError ?:any ,oerrorLable ?:any):Observable<AttendanceTrackingResponse>{ public getAttendanceTracking(onError ?: any ,oerrorLable ?: any): Observable<AttendanceTrackingResponse>{
const request = new Request(); const request = new Request();
this.authService.authenticateRequest(request); this.authService.authenticateRequest(request);
return this.con.post( return this.con.post(
@ -86,11 +86,11 @@ public getAttendanceTracking(onError ?:any ,oerrorLable ?:any):Observable<Attend
this.authService.authenticateRequest(request); this.authService.authenticateRequest(request);
return this.con.post(DashboredService.getOpenNotifications, request, onError, errorLabel); return this.con.post(DashboredService.getOpenNotifications, request, onError, errorLabel);
} }
public getSubordinatesLeaves( req:GetSubordinatesLeavesRequest,onError?: any, errorLabel?: string): Observable<GetSubordinatesLeavesResponse> { public getSubordinatesLeaves( req: GetSubordinatesLeavesRequest,onError?: any, errorLabel?: string): Observable<GetSubordinatesLeavesResponse> {
this.authService.authenticateRequest(req); this.authService.authenticateRequest(req);
return this.con.post(DashboredService.getSubordinatesLeaves, req, onError, errorLabel); return this.con.post(DashboredService.getSubordinatesLeaves, req, onError, errorLabel);
} }
public getSubordinatesAttStatus( req:GetSubordinatesAttdStatusRequest, onError?: any, errorLabel?: string): Observable<GetSubordinatesAttdStatusResponse> { public getSubordinatesAttStatus( req: GetSubordinatesAttdStatusRequest, onError?: any, errorLabel?: string): Observable<GetSubordinatesAttdStatusResponse> {
this.authService.authenticateRequest(req); this.authService.authenticateRequest(req);
return this.con.post(DashboredService.getSubordinatesAttStatus, req, onError, errorLabel); return this.con.post(DashboredService.getSubordinatesAttStatus, req, onError, errorLabel);
} }

@ -1,11 +1,6 @@
export class GetOpenNotificationsList export class GetOpenNotificationsList {
public ITEM_TYPE: number;
{ public ITEM_TYPE_DISPLAY_NAME: number;
public ITEM_TYPE: number; public OPEN_NTF_NUMBER: number;
public P_OPEN_NTF_NUMBER: number;
public ITEM_TYPE_DISPLAY_NAME:number; }
public OPEN_NTF_NUMBER:number;
}

@ -2,7 +2,7 @@
import { Response } from "src/app/hmg-common/services/models/response"; import { Response } from "src/app/hmg-common/services/models/response";
import { OpenMissingSwipesList } from './OpenMissingSwipesList'; import { OpenMissingSwipesList } from './OpenMissingSwipesList';
export class OpenMissingSwipesResponse extends Response{ export class OpenMissingSwipesResponse extends Response{
public GetGetOpenMissingSwipesList : OpenMissingSwipesList[]; public GetGetOpenMissingSwipesList: OpenMissingSwipesList[];
} }

@ -24,7 +24,7 @@
.titleBox { .titleBox {
display: block; display: block;
span { span {
font-size: 40px; font-size: 35px;
font-weight: bold; font-weight: bold;
color: black; color: black;
text-align: left; text-align: left;

@ -32,7 +32,7 @@ import {GetSubordinatesLeavesRequest} from '../hmg-common/services/dashbored/mod
import {GetOpenNotificationsResponse} from '../hmg-common/services/dashbored/models/GetOpenNotificationsResponse' import {GetOpenNotificationsResponse} from '../hmg-common/services/dashbored/models/GetOpenNotificationsResponse'
import {GetSubordinatesAttdStatusResponse} from '../hmg-common/services/dashbored/models/GetSubordinatesAttdStatusResponse' import {GetSubordinatesAttdStatusResponse} from '../hmg-common/services/dashbored/models/GetSubordinatesAttdStatusResponse'
import {GetSubordinatesLeavesResponse} from '../hmg-common/services/dashbored/models/GetSubordinatesLeavesResponse' import {GetSubordinatesLeavesResponse} from '../hmg-common/services/dashbored/models/GetSubordinatesLeavesResponse'
import { AccrualService } from '../accrual-balances/services/accrual.service';
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
@ -56,27 +56,27 @@ export class HomePage implements OnInit {
public statsButtons = [ public statsButtons = [
{ {
title: 'Work List', title: 'Work List',
statsValue: '79', statsValue: 0,
icon: 'assets/icon/new-design/work_list.png' icon: 'assets/icon/new-design/work_list.png'
}, },
// { {
// title: 'Pending Request', title: 'Pending Request',
// statsValue: '13', statsValue: 13,
// icon: 'assets/icon/new-design/pending_request.png' icon: 'assets/icon/new-design/pending_request.png'
// }, },
{ {
title: 'Missing Swipes', title: 'Missing Swipes',
statsValue: '99', statsValue: 0,
icon: 'assets/icon/new-design/missing_swipe.png' icon: 'assets/icon/new-design/missing_swipe.png'
}, },
{ {
title: 'Leave Balance', // getAccrualBalance ticket balance title: 'Leave Balance', // getAccrualBalance ticket balance
statsValue: '02', statsValue: 0,
icon: 'assets/icon/new-design/leave_balance.png' icon: 'assets/icon/new-design/leave_balance.png'
}, },
{ {
title: 'Ticket Balance', title: 'Ticket Balance',
statsValue: '01', statsValue: 0,
icon: 'assets/icon/new-design/ticket_balance.png' icon: 'assets/icon/new-design/ticket_balance.png'
} }
]; ];
@ -137,8 +137,8 @@ export class HomePage implements OnInit {
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
private file: File, private file: File,
private permissions: DevicePermissionsService, private permissions: DevicePermissionsService,
public DS: DashboredService public DS: DashboredService,
public accrualService: AccrualService
) { ) {
this.events.subscribe('img-change', displayImg => { this.events.subscribe('img-change', displayImg => {
this.userImage = this.sanitizer.bypassSecurityTrustUrl('data:Image/*;base64,' + displayImg); this.userImage = this.sanitizer.bypassSecurityTrustUrl('data:Image/*;base64,' + displayImg);
@ -146,11 +146,18 @@ export class HomePage implements OnInit {
}); });
} }
ionViewWillEnter() {
this.getAccrualBalance();
}
ngOnInit() { ngOnInit() {
this.getUserDetails(); this.getUserDetails();
this.getMenu(); this.getMenu();
this.setServicesPrivilage(); this.setServicesPrivilage();
this.initTimer(); this.initTimer();
this.openNotificationsDashbored();
this.showOpenMissingSwipes();
this.showAttendanceTracking();
// this.getCount(); // this.getCount();
// this.events.subscribe('getNotCount', badge => { // this.events.subscribe('getNotCount', badge => {
@ -255,7 +262,7 @@ export class HomePage implements OnInit {
// } // }
ionViewDidLoad() { ionViewDidLoad() {
this.getUserDetails(); // this.getUserDetails();
this.geolocation this.geolocation
.getCurrentPosition() .getCurrentPosition()
.then(resp => { .then(resp => {
@ -456,6 +463,10 @@ export class HomePage implements OnInit {
showOpenMissingSwipes() { showOpenMissingSwipes() {
this.DS.getOpenMissingSwipes() .subscribe((result: OpenMissingSwipesResponse) => { this.DS.getOpenMissingSwipes() .subscribe((result: OpenMissingSwipesResponse) => {
if (this.common.validResponse(result)) {
const key = 'GetOpenMissingSwipesList';
this.statsButtons[2].statsValue = result[key].P_OPEN_MISSING_SWIPES;
}
}); });
} }
@ -466,6 +477,9 @@ export class HomePage implements OnInit {
showAttendanceTracking() { // spent hours left hours showAttendanceTracking() { // spent hours left hours
this.DS.getAttendanceTracking() .subscribe((result: AttendanceTrackingResponse) => { this.DS.getAttendanceTracking() .subscribe((result: AttendanceTrackingResponse) => {
if (this.common.validResponse(result)) {
console.log(result);
}
}); });
} }
@ -478,15 +492,15 @@ export class HomePage implements OnInit {
} }
openNotificationsDashbored() { // work list openNotificationsDashbored() { // work list
this.DS.getOpenNotifications( () => {console.log('Error '); } ).subscribe((result: GetOpenNotificationsResponse) => { this.DS.getOpenNotifications( () => { console.log('Error '); }).subscribe((result: GetOpenNotificationsResponse) => {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
console.log('response'); const key = 'P_OPEN_NTF_NUMBER';
console.log(result); this.statsButtons[0].statsValue = result[key];
} }
}); });
} }
getSubordinatesLeaves(){ getSubordinatesLeaves() {
const request: GetSubordinatesLeavesRequest = new GetSubordinatesLeavesRequest(); const request: GetSubordinatesLeavesRequest = new GetSubordinatesLeavesRequest();
request.P_DATE_FROM = '/Date(1578603600000+0300)/'; // test request.P_DATE_FROM = '/Date(1578603600000+0300)/'; // test
request.P_DATE_TO = '/Date(1576011600000+0300)/'; // test request.P_DATE_TO = '/Date(1576011600000+0300)/'; // test
@ -521,10 +535,38 @@ export class HomePage implements OnInit {
} else if (subMenu.REQUEST_TYPE === 'EIT') { } else if (subMenu.REQUEST_TYPE === 'EIT') {
this.common.openEitListPage(); this.common.openEitListPage();
} }
if (subMenu.REQUEST_TYPE === 'PAYSLIP'){ if (subMenu.REQUEST_TYPE === 'PAYSLIP') {
this.common.openPayslipPage(); this.common.openPayslipPage();
} }
} }
getAccrualBalance() {
const today = new Date();
const day = today.getDate();
const month = today.getMonth() + 1;
const year = today.getFullYear();
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) => {
if (this.common.validResponse(result)) {
let totalTicketsLeft = 0;
for (const accrualBalance of result.GetAccrualBalancesList) {
if (accrualBalance.ACCURAL_PLAN_NAME === 'HMG Annual Vacation Accrual Plan') {
this.statsButtons[3].statsValue = accrualBalance.ACCRUAL_NET_ENTITLEMENT;
} else {
totalTicketsLeft = totalTicketsLeft + accrualBalance.ACCRUAL_NET_ENTITLEMENT;
}
}
this.statsButtons[4].statsValue = totalTicketsLeft;
}
});
}
} }

Loading…
Cancel
Save