You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sfh-mohemm/Mohem/src/app/attendance-tracking/home/home.component.ts

84 lines
2.4 KiB
TypeScript

import { Component, OnInit } from '@angular/core';
import { CommonService } from "src/app/hmg-common/services/common/common.service";
import { DashboredService } from 'src/app/hmg-common/services/dashbored/dashbored.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { AttendanceTrackingResponse } from 'src/app/hmg-common/services/dashbored/attendance-tracking.response';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'],
})
export class HomeComponent implements OnInit {
attendanceTrackingList:any =[];
cuurentDate:any;
direction: string;
checkOut:boolean= true;
constructor(
public cs:CommonService,
public db:DashboredService,
public ts:TranslatorService
) { }
ngOnInit() {
this.attendanceTracking();
this.cuurentDate = new Date();
this.direction = TranslatorService.getCurrentLanguageName();
this.cuurentDate =this.getHeaderDate(this.cuurentDate);
//**condition to check is checkout or not to display PUSE Button**
// if(ischeckOut){
// this.checkOut=true;
// }else{
// this.checkOut=false;
// }
}
// call services
public attendanceTracking(){
this.db.getAttendanceTracking(()=> {},this.ts.trPK('general', 'retry')).subscribe(
(result)=>{
console.log("result: "+result);
this.handleRespondGetAttendanceTracking(result);
}
)
}
public handleRespondGetAttendanceTracking(result){
if (this.cs.validResponse(result)) {
this.attendanceTrackingList=result.GetAttendanceTrackingList;
}
}
getHeaderDate(date: any) {
if (this.direction == "en") {
return this.cs.getMonthName(date.getMonth() + 1) + ", " + date.getDate() +" "+ date.getFullYear();
} else {
return this.cs.getMonthNameAr(date.getMonth() + 1) + ", " + date.getDate() +" "+ date.getFullYear();
}
}
openDialog(){
this.cs.confirmAlertDialogAttendance(
() => {
//to open scan();
}, this.ts.trPK('general', 'ok'),
() => {}, this.ts.trPK('general', 'cancel'),
this.ts.trPK('vacation-rule', 'confirmation'),
this.ts.trPK('attendance-tracking', 'confirm-alert3')
+ "<br/>"+"<br/>"+ this.ts.trPK('attendance-tracking', 'confirm-alert1')
+ this.ts.trPK('attendance-tracking', 'confirm-alert2')
);
}
}// end home