add dashbored services

MOHEMM-Q3-DEV-LATEST
ashwaq 6 years ago
parent 4bdc08b42d
commit 7456ab6e0a

@ -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<OpenPeriodDatesResponse> {
const request = new Request();
this.authService.authenticateRequest(request);
return this.api.post(DashboredService.getOpenPeriodDates, request, onError, errorLabel);
}
public getOpenNotifications( onError?: any, errorLabel?: string): Observable<GetOpenNotificationsResponse> {
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<GetSubordinatesLeavesResponse> {
this.authService.authenticateRequest(req);
return this.api.post(DashboredService.getSubordinatesLeaves, req, onError, errorLabel);
}
public getSubordinatesAttStatus( req:GetSubordinatesAttdStatusRequest, onError?: any, errorLabel?: string): Observable<GetSubordinatesAttdStatusResponse> {
this.authService.authenticateRequest(req);
return this.api.post(DashboredService.getSubordinatesAttStatus, req, onError, errorLabel);
}
}

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

@ -0,0 +1,7 @@
import { GetOpenNotificationsList } from './GetOpenNotificationsList';
import { Response } from '../../../services/models/response'
export class GetOpenNotificationsResponse extends Response {
public GetOpenNotificationsList: GetOpenNotificationsList [];
}

@ -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;
}

@ -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;
}

@ -0,0 +1,7 @@
import { GetSubordinatesAttdStatusList } from './GetSubordinatesAttdStatusList';
import { Response } from '../../../services/models/response'
export class GetSubordinatesAttdStatusResponse extends Response {
public GetSubordinatesAttdStatusList: GetSubordinatesAttdStatusList [];
}

@ -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;
}

@ -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;
}

@ -0,0 +1,7 @@
import { GetSubordinatesLeavesList } from './GetSubordinatesLeavesList';
import { Response } from '../../../services/models/response'
export class GetSubordinatesLeavesResponse extends Response {
public GetSubordinatesLeavesList: GetSubordinatesLeavesList [];
}

@ -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;
}

@ -0,0 +1,7 @@
import { OpenPeriodDatesList } from './openPeriodDatesList';
import { Response } from '../../../services/models/response'
export class OpenPeriodDatesResponse extends Response {
public openPeriodDatesList: OpenPeriodDatesList [];
}

@ -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);
}
});
}
}

Loading…
Cancel
Save