fixed attendance tracking issue

myteam
umasoodch 6 years ago
parent a9128c93e2
commit a78477c192

@ -1,13 +1,13 @@
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { ConnectorService } from "src/app/hmg-common/services/connector/connector.service";
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
@Injectable({
providedIn: "root"
providedIn: 'root'
})
export class AccrualService {
public static GET_ACCRUAL_BALANCE =
"Services/ERP.svc/REST/GET_ACCRUAL_BALANCES";
'Services/ERP.svc/REST/GET_ACCRUAL_BALANCES';
constructor(
public con: ConnectorService,
public authService: AuthenticationService

@ -4,6 +4,9 @@ import { DashboredService } from 'src/app/hmg-common/services/dashbored/dashbore
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import {AttendScanService} from '../../hmg-common/services/attend-services/attend-scan.service';
import { AttendanceTrackingResponse } from 'src/app/hmg-common/services/dashbored/attendance-tracking.response';
import { SharedDataService } from '../../hmg-common/services/shared-data-service/shared-data.service';
import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
@ -22,11 +25,13 @@ export class HomeComponent implements OnInit {
public isCheckedIn = undefined;
public displayTime: any;
public percent: any;
public userData = this.sharedData.getSharedData(AuthenticatedUser.SHARED_DATA, false);
constructor(
public cs: CommonService,
public db: DashboredService,
public ts: TranslatorService,
public attendScanService: AttendScanService
public attendScanService: AttendScanService,
public sharedData: SharedDataService
) { }
ngOnInit() {
@ -96,7 +101,10 @@ export class HomeComponent implements OnInit {
}
showAttendanceTracking() {
this.db.getAttendanceTracking() .subscribe((result: AttendanceTrackingResponse) => {
const request = {
P_SELECTED_EMPLOYEE_NUMBER: this.userData.EMPLOYEE_NUMBER
};
this.db.getAttendanceTracking(request).subscribe((result: AttendanceTrackingResponse) => {
if (this.cs.validResponse(result)) {
const key = 'GetAttendanceTrackingList';
this.convertAndAssignTime(result[key]);

@ -107,7 +107,6 @@ export class AuthenticationService {
request.P_USER_NAME = user.EMPLOYEE_NUMBER;
request.UserName = user.EMPLOYEE_NUMBER;
request.P_EMAIL_ADDRESS = user.EMPLOYEE_EMAIL_ADDRESS;
if (AuthenticationService.requireRelogin) {
this.sessionTimeOutDialog();
}

@ -66,8 +66,8 @@ export class DashboredService {
oerrorLable
);
}
public getAttendanceTracking(onError ?: any ,oerrorLable ?: any): Observable<AttendanceTrackingResponse>{
const request = new Request();
public getAttendanceTracking(selectedEmployee: any, onError ?: any , oerrorLable ?: any): Observable<AttendanceTrackingResponse>{
const request = selectedEmployee;
this.authService.authenticateRequest(request);
return this.con.post(
DashboredService.attendancetrackingUrl,

@ -65,94 +65,6 @@
</ion-slides>
</ion-row>
<!-- <ion-row class="attendance-module">
<ion-col [size]="8">
<h3>Monthly Attendance</h3>
<span>View your Monthly Time Sheet</span>
<ion-button>
View Detail
</ion-button>
</ion-col>
<ion-col [size]="4">
<img src="assets/icon/new-design/attendance_button_icon.png"/>
</ion-col>
</ion-row> -->
<!-- <ion-row>
<ion-col [size]="12">
<ion-label>My Travelling</ion-label>
</ion-col>
<ion-col [size]="4">
<app-services-button
title="Ticket Request"
icon="assets/icon/new-design/ticket_request.png">
</app-services-button>
</ion-col>
<ion-col [size]="4">
<app-services-button
title="Borrowing Passport"
icon="assets/icon/new-design/borrowing_passport.png">
</app-services-button>
</ion-col>
<ion-col [size]="4">
<app-services-button
title="Vacations Rules"
icon="assets/icon/new-design/vacation_rules.png">
</app-services-button>
</ion-col>
</ion-row> -->
<!-- <ion-row>
<ion-col [size]="12">
<ion-label>Miscellaneous</ion-label>
</ion-col>
<ion-col [size]="4">
<app-services-button
title="Uniform Request"
icon="assets/icon/new-design/uniform_request.png">
</app-services-button>
</ion-col>
<ion-col [size]="4">
<app-services-button
title="ID Badge Request"
icon="assets/icon/new-design/id_badge_request.png">
</app-services-button>
</ion-col>
<ion-col [size]="4">
<app-services-button
title="Separation/ Resignation"
icon="assets/icon/new-design/separation_resignation.png">
</app-services-button>
</ion-col>
</ion-row> -->
<!--
<ion-row>
<ion-col [size]="4">
<app-services-button
title="Recreational Activities"
icon="assets/icon/new-design/recreational_activities.png">
</app-services-button>
</ion-col>
<ion-col [size]="4">
<app-services-button
title="Employee Certificate"
icon="assets/icon/new-design/employee_certificate.png">
</app-services-button>
</ion-col>
<ion-col [size]="4">
<app-services-button
title="IT Forms"
icon="assets/icon/new-design/it_forms.png">
</app-services-button>
</ion-col>
</ion-row> -->
</ion-grid>
<div class="fixed-shift-timer" *ngIf="isCheckedIn" (click)="openattentracking()">
<span class="subTitle">Time Left Today</span>

@ -15,7 +15,7 @@ import { attendanceSwipeScannerRequest } from './models/attendanceSwipe.Request'
import { Response } from 'src/app/hmg-common/services/models/response';
import { AttendanceService } from './services/attendance.services';
import { LoginRequest } from '../hmg-common/services/authentication/models/login.request';
import { FileUploaderComponent } from '../hmg-common/ui/file-uploader/file-uploader.component'
import { FileUploaderComponent } from '../hmg-common/ui/file-uploader/file-uploader.component';
import { Camera } from '@ionic-native/Camera/ngx';
import { File } from '@ionic-native/file/ngx';
import { DomSanitizer } from '@angular/platform-browser';
@ -28,10 +28,10 @@ import { PerformanceAppraisalResponse } from '../hmg-common/services/dashbored/p
import { AttendanceTrackingResponse } from '../hmg-common/services/dashbored/attendance-tracking.response';
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'
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';
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';
@ -125,7 +125,7 @@ export class HomePage implements OnInit {
public displayTime: any;
public menuEntries: any;
public percent: any;
/////////////////////////////////TIME AND DATE VALUES///////////////////////////////
///////////////////////////////// TIME AND DATE VALUES///////////////////////////////
public monthName: any;
public yearDate: any;
public selEmp: string;
@ -138,9 +138,9 @@ public selectedShiftFilter: any;
public arrDaysAttendance: any = [];
public arrDaysAbsent: any = [];
public arrDaysOff: any = [];
public arrFutrueDays: any =[];
public arrFutrueDays: any = [];
///////////////////////////////END//////////////////////////////////////////////////
/////////////////////////////// END//////////////////////////////////////////////////
constructor(
public ts: TranslatorService,
public menu: MenuController,
@ -162,9 +162,9 @@ public arrFutrueDays: any =[];
private permissions: DevicePermissionsService,
public DS: DashboredService,
public accrualService: AccrualService,
////////////////////////////////////////TIME AND DATE////////////////////////////
//////////////////////////////////////// TIME AND DATE////////////////////////////
public timeCardService: TimeCardService
/////////////////////END/////////////////////////////////////////////////////////
///////////////////// END/////////////////////////////////////////////////////////
) {
this.events.subscribe('img-change', displayImg => {
this.userImage = this.sanitizer.bypassSecurityTrustUrl('data:Image/*;base64,' + displayImg);
@ -526,16 +526,19 @@ convertAndAssignTime(data) {
this.scheduledTime = this.convertInSeconds(data.P_SCHEDULED_HOURS.split(':'));
this.isCheckedIn = this.remainingTime === this.scheduledTime ? false : true;
this.initTimer();
}
}
showAttendanceTracking() {
this.DS.getAttendanceTracking().subscribe((result: AttendanceTrackingResponse) => {
const request = {
P_SELECTED_EMPLOYEE_NUMBER: this.userData.EMPLOYEE_NUMBER
};
this.DS.getAttendanceTracking(request).subscribe((result: AttendanceTrackingResponse) => {
if (this.common.validResponse(result)) {
const key = 'GetAttendanceTrackingList';
this.convertAndAssignTime(result[key]);
}
});
}
}
openPeriodDateDashbored() {
this.DS.getOpenPeriodDates(() => { console.log('Error '); }).subscribe((result: OpenPeriodDatesResponse) => {
@ -645,7 +648,7 @@ openStatsButton(link: string) {
//////calling time and date to load it in calendar///////
////// calling time and date to load it in calendar///////
public getDayHoursTypeDetails() {
const dayAndHoursReqObj = new GetDayAndHoursDetailsRequest();
this.monthName = moment().format('MMMM');
@ -693,39 +696,39 @@ openStatsButton(link: string) {
countAllAttendDays(allDays) {
for (let i = 0; i < allDays.length; i++) {
if (allDays[i].DAY_TYPE == "OFF") {
//offDay
this.arrDaysOff.push({startTime:new Date(allDays[i].SCHEDULE_DATE),
if (allDays[i].DAY_TYPE == 'OFF') {
// offDay
this.arrDaysOff.push({startTime: new Date(allDays[i].SCHEDULE_DATE),
endTime: new Date(allDays[i].SCHEDULE_DATE)});
} else if (allDays[i].DAY_TYPE == "SCHEDULED" && !allDays[i].REMARKS) {
//attendace
} else if (allDays[i].DAY_TYPE == 'SCHEDULED' && !allDays[i].REMARKS) {
// attendace
this.arrDaysAttendance.push({startTime: new Date(allDays[i].SCHEDULE_DATE),
endTime: new Date(allDays[i].SCHEDULE_DATE)});
} else if(allDays[i].DAY_TYPE == "SCHEDULED" && allDays[i].REMARKS) {
//absent
} else if (allDays[i].DAY_TYPE == 'SCHEDULED' && allDays[i].REMARKS) {
// absent
this.arrDaysAbsent.push(
{
startTime: new Date(allDays[i].SCHEDULE_DATE),
endTime: new Date(allDays[i].SCHEDULE_DATE),
isoTime: "09:00:00",
isoTime: '09:00:00',
allDay: false
}
);
}else{
} else {
this.arrFutrueDays.push(
{
startTime: new Date(allDays[i].SCHEDULE_DATE),
endTime: new Date(allDays[i].SCHEDULE_DATE),
isoTime: "09:00:00",
isoTime: '09:00:00',
allDay: false
}
);
}
}
this.common.sharedService.setSharedData(this.arrDaysOff,'calendarDayOffDateValue');
this.common.sharedService.setSharedData(this.arrDaysAttendance,'calendarAttendanceDateValue');
this.common.sharedService.setSharedData( this.arrDaysAbsent,'calendarDaysAbsentDateValue');
this.common.sharedService.setSharedData( this.arrFutrueDays,'calendarDaysFutrueDateValue');
this.common.sharedService.setSharedData(this.arrDaysOff, 'calendarDayOffDateValue');
this.common.sharedService.setSharedData(this.arrDaysAttendance, 'calendarAttendanceDateValue');
this.common.sharedService.setSharedData( this.arrDaysAbsent, 'calendarDaysAbsentDateValue');
this.common.sharedService.setSharedData( this.arrFutrueDays, 'calendarDaysFutrueDateValue');
}
}

Loading…
Cancel
Save