From 7456ab6e0a72c476cec69957076ac32e4f9efacc Mon Sep 17 00:00:00 2001 From: ashwaq Date: Thu, 9 Jan 2020 08:54:07 +0300 Subject: [PATCH] add dashbored services --- .../services/dashbored/dashbored.service.ts | 30 +++++++++ .../models/GetOpenNotificationsList.ts | 11 ++++ .../models/GetOpenNotificationsResponse.ts | 7 ++ .../models/GetSubordinatesAttdStatusList.ts | 16 +++++ .../GetSubordinatesAttdStatusRequest.ts | 7 ++ .../GetSubordinatesAttdStatusResponse.ts | 7 ++ .../models/GetSubordinatesLeavesList.ts | 35 ++++++++++ .../models/GetSubordinatesLeavesRequest.ts | 8 +++ .../models/GetSubordinatesLeavesResponse.ts | 7 ++ .../dashbored/models/openPeriodDatesList.ts | 7 ++ .../models/openPeriodDatesResponse.ts | 7 ++ Mohem/src/app/home/home.page.ts | 64 +++++++++++++++++++ 12 files changed, 206 insertions(+) create mode 100644 Mohem/src/app/hmg-common/services/dashbored/models/GetOpenNotificationsList.ts create mode 100644 Mohem/src/app/hmg-common/services/dashbored/models/GetOpenNotificationsResponse.ts create mode 100644 Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesAttdStatusList.ts create mode 100644 Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesAttdStatusRequest.ts create mode 100644 Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesAttdStatusResponse.ts create mode 100644 Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesLeavesList.ts create mode 100644 Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesLeavesRequest.ts create mode 100644 Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesLeavesResponse.ts create mode 100644 Mohem/src/app/hmg-common/services/dashbored/models/openPeriodDatesList.ts create mode 100644 Mohem/src/app/hmg-common/services/dashbored/models/openPeriodDatesResponse.ts 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 8cb5a14a..97e8681e 100644 --- a/Mohem/src/app/hmg-common/services/dashbored/dashbored.service.ts +++ b/Mohem/src/app/hmg-common/services/dashbored/dashbored.service.ts @@ -2,16 +2,46 @@ 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 { Observable } from 'rxjs'; +import {OpenPeriodDatesResponse} from '../../services/dashbored/models/openPeriodDatesResponse' +import {Request} from '../../services/models/request'; +import {GetSubordinatesLeavesRequest} from './models/GetSubordinatesLeavesRequest'; +import {GetSubordinatesLeavesResponse} from './models/GetSubordinatesLeavesResponse'; +import {GetSubordinatesAttdStatusRequest} from './models/GetSubordinatesAttdStatusRequest'; +import {GetSubordinatesAttdStatusResponse} from './models/GetSubordinatesAttdStatusResponse'; +import {GetOpenNotificationsResponse} from './models/GetOpenNotificationsResponse' @Injectable({ providedIn: 'root' }) export class DashboredService { + public static getOpenPeriodDates = 'Services/ERP.svc/REST/GET_OPEN_PERIOD_DATES'; + public static getOpenNotifications = 'Services/ERP.svc/REST/GET_OPEN_NOTIFICATIONS'; + public static getSubordinatesLeaves = 'Services/ERP.svc/REST/GET_SUBORDINATES_LEAVES'; + public static getSubordinatesAttStatus = 'Services/ERP.svc/REST/GET_SUBORDINATES_ATTD_STATUS'; constructor( public api: ConnectorService, public authService: AuthenticationService, ) { } + public getOpenPeriodDates( onError?: any, errorLabel?: string): Observable { + const request = new Request(); + this.authService.authenticateRequest(request); + return this.api.post(DashboredService.getOpenPeriodDates, request, onError, errorLabel); + } + public getOpenNotifications( onError?: any, errorLabel?: string): Observable { + const request = new Request(); + this.authService.authenticateRequest(request); + return this.api.post(DashboredService.getOpenNotifications, request, onError, errorLabel); + } + public getSubordinatesLeaves( req:GetSubordinatesLeavesRequest,onError?: any, errorLabel?: string): Observable { + this.authService.authenticateRequest(req); + return this.api.post(DashboredService.getSubordinatesLeaves, req, onError, errorLabel); + } + public getSubordinatesAttStatus( req:GetSubordinatesAttdStatusRequest, onError?: any, errorLabel?: string): Observable { + this.authService.authenticateRequest(req); + return this.api.post(DashboredService.getSubordinatesAttStatus, req, onError, errorLabel); + } + } diff --git a/Mohem/src/app/hmg-common/services/dashbored/models/GetOpenNotificationsList.ts b/Mohem/src/app/hmg-common/services/dashbored/models/GetOpenNotificationsList.ts new file mode 100644 index 00000000..baef1032 --- /dev/null +++ b/Mohem/src/app/hmg-common/services/dashbored/models/GetOpenNotificationsList.ts @@ -0,0 +1,11 @@ +export class GetOpenNotificationsList + +{ +public ITEM_TYPE: number; + +public ITEM_TYPE_DISPLAY_NAME:number; + +public OPEN_NTF_NUMBER:number; + + +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/dashbored/models/GetOpenNotificationsResponse.ts b/Mohem/src/app/hmg-common/services/dashbored/models/GetOpenNotificationsResponse.ts new file mode 100644 index 00000000..7165f0b4 --- /dev/null +++ b/Mohem/src/app/hmg-common/services/dashbored/models/GetOpenNotificationsResponse.ts @@ -0,0 +1,7 @@ +import { GetOpenNotificationsList } from './GetOpenNotificationsList'; +import { Response } from '../../../services/models/response' + + +export class GetOpenNotificationsResponse extends Response { + public GetOpenNotificationsList: GetOpenNotificationsList []; +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesAttdStatusList.ts b/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesAttdStatusList.ts new file mode 100644 index 00000000..7a2cf0b0 --- /dev/null +++ b/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesAttdStatusList.ts @@ -0,0 +1,16 @@ +export class GetSubordinatesAttdStatusList + +{ +public NUMBER_OF_EMPLOYEES: number; + +public LATE_IN:number; + +public EARLY_OUT:number; + +public ON_TIME:number; + +public ABSENCE:number; + + + +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesAttdStatusRequest.ts b/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesAttdStatusRequest.ts new file mode 100644 index 00000000..740656b8 --- /dev/null +++ b/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesAttdStatusRequest.ts @@ -0,0 +1,7 @@ +import { Request } from '../../../services/models/request' + +export class GetSubordinatesAttdStatusRequest extends Request{ + //public static SHARED_DATA = ''; + public P_SCHEDULE_DATE_FROM :any; + public P_SCHEDULE_DATE_TO :any; +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesAttdStatusResponse.ts b/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesAttdStatusResponse.ts new file mode 100644 index 00000000..f66cae7b --- /dev/null +++ b/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesAttdStatusResponse.ts @@ -0,0 +1,7 @@ +import { GetSubordinatesAttdStatusList } from './GetSubordinatesAttdStatusList'; +import { Response } from '../../../services/models/response' + + +export class GetSubordinatesAttdStatusResponse extends Response { + public GetSubordinatesAttdStatusList: GetSubordinatesAttdStatusList []; +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesLeavesList.ts b/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesLeavesList.ts new file mode 100644 index 00000000..08818ef8 --- /dev/null +++ b/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesLeavesList.ts @@ -0,0 +1,35 @@ +export class GetSubordinatesLeavesList + +{ + public LVL: number; + +public EMPLOYEE_NUMBER:String; + +public EMPLOYEE_NAME:String; + +public ORGANIZATION_ID:number; + +public ORGANIZATION_NAME:String + +public SUPERVISOR_NUMBER:String; + +public SUPERVISOR_NAME:String; + +public SUPERVISOR_ORGANIZATION_ID:number; + +public SUPERVISOR_ORGANIZATION_NAME:String; + +public EVENT_DATE:any;//DATE; + +public LEAVE_TYPE:String; + +public DATE_START:any;//DATE; + +public DATE_END:any;//DATE; + +public ABSENCE_ATTENDANCE_TYPE_NAME:String; + +public CALENDAR_ENTRY_DESC:String; + +public STATUS:String; +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesLeavesRequest.ts b/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesLeavesRequest.ts new file mode 100644 index 00000000..30a4befd --- /dev/null +++ b/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesLeavesRequest.ts @@ -0,0 +1,8 @@ +import { Request } from '../../../services/models/request' + +export class GetSubordinatesLeavesRequest extends Request{ + //public static SHARED_DATA = ''; + public P_DATE_FROM :any; + public P_DATE_TO :any; + +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesLeavesResponse.ts b/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesLeavesResponse.ts new file mode 100644 index 00000000..469cad3e --- /dev/null +++ b/Mohem/src/app/hmg-common/services/dashbored/models/GetSubordinatesLeavesResponse.ts @@ -0,0 +1,7 @@ +import { GetSubordinatesLeavesList } from './GetSubordinatesLeavesList'; +import { Response } from '../../../services/models/response' + + +export class GetSubordinatesLeavesResponse extends Response { + public GetSubordinatesLeavesList: GetSubordinatesLeavesList []; +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/dashbored/models/openPeriodDatesList.ts b/Mohem/src/app/hmg-common/services/dashbored/models/openPeriodDatesList.ts new file mode 100644 index 00000000..dbcab478 --- /dev/null +++ b/Mohem/src/app/hmg-common/services/dashbored/models/openPeriodDatesList.ts @@ -0,0 +1,7 @@ +export class OpenPeriodDatesList { + public P_CLOSING_PERIOD_DATE: any; + public P_PERIOD_END_DATE: any; + public P_PERIOD_START_DATE: any; + public P_RETURN_MSG: string; + public P_RETURN_STATUS: string; +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/dashbored/models/openPeriodDatesResponse.ts b/Mohem/src/app/hmg-common/services/dashbored/models/openPeriodDatesResponse.ts new file mode 100644 index 00000000..3b559bc7 --- /dev/null +++ b/Mohem/src/app/hmg-common/services/dashbored/models/openPeriodDatesResponse.ts @@ -0,0 +1,7 @@ +import { OpenPeriodDatesList } from './openPeriodDatesList'; +import { Response } from '../../../services/models/response' + + +export class OpenPeriodDatesResponse extends Response { + public openPeriodDatesList: OpenPeriodDatesList []; +} \ No newline at end of file diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index c4f01a48..d9318037 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -25,6 +25,14 @@ import { DomSanitizer } from '@angular/platform-browser'; import {FileUploderProfileComponent} from '../hmg-common/ui/file-uploder-profile/file-uploder-profile.component' import { SharedDataService } from '../hmg-common/services/shared-data-service/shared-data.service'; import { DevicePermissionsService } from '../hmg-common/services/device-permissions/device-permissions.service'; +import {DashboredService} from '../hmg-common/services/dashbored/dashbored.service' +import { OpenPeriodDatesResponse } from '../hmg-common/services/dashbored/models/openPeriodDatesResponse'; +import {GetSubordinatesAttdStatusRequest} from '../hmg-common/services/dashbored/models/GetSubordinatesAttdStatusRequest'; +import {GetSubordinatesLeavesRequest} from '../hmg-common/services/dashbored/models/GetSubordinatesLeavesRequest' +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' + @Component({ selector: "app-home", @@ -63,6 +71,7 @@ export class HomePage implements OnInit { private cameraController: Camera, public sharedData: SharedDataService, private sanitizer: DomSanitizer, + public dashboredService:DashboredService, //private transfer: Transfer, private file: File, //private filePath: FilePath @@ -377,4 +386,59 @@ export class HomePage implements OnInit { openPersonalInfo() { this.common.openProfile(); } + + openPeriodDateDashbored(){ + this.dashboredService.getOpenPeriodDates( ()=> {console.log("Error ");} ).subscribe((result:OpenPeriodDatesResponse)=>{ + if (this.common.validResponse(result)) { + console.log("response"); + } + + }); + + } + + openNotificationsDashbored(){ + this.dashboredService.getOpenNotifications( ()=> {console.log("Error ");} ).subscribe((result:GetOpenNotificationsResponse)=>{ + if (this.common.validResponse(result)) { + console.log("response"); + console.log(result); + } + + }); + + } + + getSubordinatesLeaves(){ + let request:GetSubordinatesLeavesRequest=new GetSubordinatesLeavesRequest(); + request.P_DATE_FROM="/Date(1578603600000+0300)/"; //test + request.P_DATE_TO="/Date(1576011600000+0300)/"; //test + + this.dashboredService.getSubordinatesLeaves( request,()=> {console.log("Error ");} ).subscribe((result:GetSubordinatesLeavesResponse)=>{ + if (this.common.validResponse(result)) { + console.log("response"); + console.log(result); + } + + }); + + } + + getSubordinatesAttStatus(){ + let request: GetSubordinatesAttdStatusRequest = new GetSubordinatesAttdStatusRequest(); + request.P_SCHEDULE_DATE_FROM="/Date(1578603600000+0300)/"; //test + request.P_SCHEDULE_DATE_TO="/Date(1576011600000+0300)/";//test + + this.dashboredService.getSubordinatesAttStatus( request,()=> {console.log("Error ");} ).subscribe((result:GetSubordinatesAttdStatusResponse)=>{ + if (this.common.validResponse(result)) { + console.log("response"); + console.log(result); + } + + }); + + } + + + + }