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

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

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

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

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

@ -24,7 +24,7 @@
.titleBox {
display: block;
span {
font-size: 40px;
font-size: 35px;
font-weight: bold;
color: black;
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 {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';
@Component({
selector: 'app-home',
@ -56,27 +56,27 @@ export class HomePage implements OnInit {
public statsButtons = [
{
title: 'Work List',
statsValue: '79',
statsValue: 0,
icon: 'assets/icon/new-design/work_list.png'
},
// {
// title: 'Pending Request',
// statsValue: '13',
// icon: 'assets/icon/new-design/pending_request.png'
// },
{
title: 'Pending Request',
statsValue: 13,
icon: 'assets/icon/new-design/pending_request.png'
},
{
title: 'Missing Swipes',
statsValue: '99',
statsValue: 0,
icon: 'assets/icon/new-design/missing_swipe.png'
},
{
title: 'Leave Balance', // getAccrualBalance ticket balance
statsValue: '02',
statsValue: 0,
icon: 'assets/icon/new-design/leave_balance.png'
},
{
title: 'Ticket Balance',
statsValue: '01',
statsValue: 0,
icon: 'assets/icon/new-design/ticket_balance.png'
}
];
@ -137,8 +137,8 @@ export class HomePage implements OnInit {
private sanitizer: DomSanitizer,
private file: File,
private permissions: DevicePermissionsService,
public DS: DashboredService
public DS: DashboredService,
public accrualService: AccrualService
) {
this.events.subscribe('img-change', displayImg => {
this.userImage = this.sanitizer.bypassSecurityTrustUrl('data:Image/*;base64,' + displayImg);
@ -146,11 +146,18 @@ export class HomePage implements OnInit {
});
}
ionViewWillEnter() {
this.getAccrualBalance();
}
ngOnInit() {
this.getUserDetails();
this.getMenu();
this.setServicesPrivilage();
this.initTimer();
this.openNotificationsDashbored();
this.showOpenMissingSwipes();
this.showAttendanceTracking();
// this.getCount();
// this.events.subscribe('getNotCount', badge => {
@ -255,7 +262,7 @@ export class HomePage implements OnInit {
// }
ionViewDidLoad() {
this.getUserDetails();
// this.getUserDetails();
this.geolocation
.getCurrentPosition()
.then(resp => {
@ -456,6 +463,10 @@ export class HomePage implements OnInit {
showOpenMissingSwipes() {
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
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
this.DS.getOpenNotifications( () => {console.log('Error '); } ).subscribe((result: GetOpenNotificationsResponse) => {
this.DS.getOpenNotifications( () => { console.log('Error '); }).subscribe((result: GetOpenNotificationsResponse) => {
if (this.common.validResponse(result)) {
console.log('response');
console.log(result);
const key = 'P_OPEN_NTF_NUMBER';
this.statsButtons[0].statsValue = result[key];
}
});
}
getSubordinatesLeaves(){
getSubordinatesLeaves() {
const request: GetSubordinatesLeavesRequest = new GetSubordinatesLeavesRequest();
request.P_DATE_FROM = '/Date(1578603600000+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') {
this.common.openEitListPage();
}
if (subMenu.REQUEST_TYPE === 'PAYSLIP'){
if (subMenu.REQUEST_TYPE === 'PAYSLIP') {
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