|
|
|
|
@ -6,6 +6,9 @@ import { MenuService } from "src/app/hmg-common/services/menu/menuservice.servic
|
|
|
|
|
import { AbsenceAttahcmentResponse } from "../models/abs.attach.response";
|
|
|
|
|
import { AbsenceListService } from "../service/service.service";
|
|
|
|
|
import { IonInfiniteScroll } from "@ionic/angular";
|
|
|
|
|
import { AccrualService } from 'src/app/accrual-balances/services/accrual.service';
|
|
|
|
|
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
|
|
|
|
|
import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: "app-home",
|
|
|
|
|
@ -13,6 +16,7 @@ import { IonInfiniteScroll } from "@ionic/angular";
|
|
|
|
|
styleUrls: ["./home.component.scss"]
|
|
|
|
|
})
|
|
|
|
|
export class HomeComponent implements OnInit {
|
|
|
|
|
[x: string]: any;
|
|
|
|
|
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
|
|
|
|
|
P_PAGE_NUM: number;
|
|
|
|
|
P_PAGE_LIMIT: number;
|
|
|
|
|
@ -21,14 +25,55 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
selEmp: string = "";
|
|
|
|
|
respID: number;
|
|
|
|
|
selMenu: MenuResponse;
|
|
|
|
|
leaveAccrualBalance: any;
|
|
|
|
|
data: any;
|
|
|
|
|
accrualNet: any;
|
|
|
|
|
getleaveAccrualBalance: any;
|
|
|
|
|
accrualUsed: any;
|
|
|
|
|
accrualYearly: any;
|
|
|
|
|
effectiveDate: any;
|
|
|
|
|
Sdate: any;
|
|
|
|
|
emp_no: any;
|
|
|
|
|
balance: any;
|
|
|
|
|
ACCRUAL_NET_ENTITLEMENT: any;
|
|
|
|
|
ACCRUAL_USED_ENTITLEMENT: any;
|
|
|
|
|
ACCRUAL_YEARLY_ENTITLEMENT: any;
|
|
|
|
|
totalnumber: any;
|
|
|
|
|
|
|
|
|
|
public options = {
|
|
|
|
|
cutoutPercentage: 80,
|
|
|
|
|
tooltips: { enabled: false },
|
|
|
|
|
legend: { display: false }};
|
|
|
|
|
gaugeType = "full";
|
|
|
|
|
// gaugeValue = 11.200;
|
|
|
|
|
// gaugeLabel = "";
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
public common: CommonService,
|
|
|
|
|
public ts: TranslatorService,
|
|
|
|
|
public menuService: MenuService,
|
|
|
|
|
public absService: AbsenceListService
|
|
|
|
|
public absService: AbsenceListService,
|
|
|
|
|
public accrualService: AccrualService,
|
|
|
|
|
public authService: AuthenticationService
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
|
|
|
|
|
this.Sdate = new Date().toISOString();
|
|
|
|
|
|
|
|
|
|
this.getUserDetails();
|
|
|
|
|
}
|
|
|
|
|
private getUserDetails(){
|
|
|
|
|
this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => {
|
|
|
|
|
if (user) {
|
|
|
|
|
this.emp_no=user.EMPLOYEE_NUMBER;
|
|
|
|
|
this.getAccrualBalance();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.P_PAGE_LIMIT = 50;
|
|
|
|
|
this.P_PAGE_NUM = 1;
|
|
|
|
|
this.selMenu = this.common.sharedService.getSharedData(
|
|
|
|
|
@ -43,13 +88,41 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
MenuResponse.SHARED_SEL_RESP_ID,
|
|
|
|
|
false
|
|
|
|
|
);
|
|
|
|
|
this.leaveAccrualBalance = this.common.sharedService.getSharedData('leaveAccrualBalance', false);
|
|
|
|
|
console.log("this.leaveAccrualBalance>>>>>>>>>>" + this.leaveAccrualBalance.ACCRUAL_NET_ENTITLEMENT);
|
|
|
|
|
/***
|
|
|
|
|
ACCRUAL_NET_ENTITLEMENT: 24.59
|
|
|
|
|
ACCRUAL_USED_ENTITLEMENT: 0
|
|
|
|
|
ACCRUAL_YEARLY_ENTITLEMENT: 50.4*/
|
|
|
|
|
this.accrualNet = this.leaveAccrualBalance.ACCRUAL_NET_ENTITLEMENT;
|
|
|
|
|
this.accrualUsed = this.leaveAccrualBalance.ACCRUAL_USED_ENTITLEMENT;
|
|
|
|
|
this.accrualYearly = this.leaveAccrualBalance.ACCRUAL_YEARLY_ENTITLEMENT;
|
|
|
|
|
|
|
|
|
|
this.request = this.common.sharedService.getSharedData('leaveAccrualBalanceDate', false);
|
|
|
|
|
console.log("this.request" + this.request.P_EFFECTIVE_DATE);
|
|
|
|
|
this.effectiveDate = this.request.P_EFFECTIVE_DATE;
|
|
|
|
|
this.data = {
|
|
|
|
|
// labels: ['earingTotal', 'deductionTotal'],
|
|
|
|
|
datasets: [
|
|
|
|
|
{ data: [this.accrualNet,this.accrualUsed,this.accrualYearly],
|
|
|
|
|
backgroundColor: [
|
|
|
|
|
'#DDB017',
|
|
|
|
|
'#094875',
|
|
|
|
|
'#CB3232',],
|
|
|
|
|
borderWidth: 2
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.getAbsenceTransaction();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AccrualBalances() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AccrualBalances() {
|
|
|
|
|
this.common.openAccuralPage();
|
|
|
|
|
}
|
|
|
|
|
AttachmentDocuments(id) {
|
|
|
|
|
AttachmentDocuments(id) {
|
|
|
|
|
const request = {
|
|
|
|
|
P_ABSENCE_ATTENDANCE_ID: id
|
|
|
|
|
};
|
|
|
|
|
@ -77,7 +150,7 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
//this.GetAbsenceTransactionList =result.GetAbsenceTransactionList;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
getAbsenceTransaction() {
|
|
|
|
|
getAbsenceTransaction() {
|
|
|
|
|
this.IsReachEnd = false;
|
|
|
|
|
const request = {
|
|
|
|
|
P_SELECTED_EMPLOYEE_NUMBER: this.selEmp,
|
|
|
|
|
@ -91,7 +164,7 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private handleAbsListResult(result) {
|
|
|
|
|
handleAbsListResult(result) {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
if (this.common.hasData(result.GetAbsenceTransactionList)) {
|
|
|
|
|
this.GetAbsenceTransactionList = result.GetAbsenceTransactionList;
|
|
|
|
|
@ -108,7 +181,7 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
doInfinite(infiniteScroll) {
|
|
|
|
|
doInfinite() {
|
|
|
|
|
if (!this.IsReachEnd) {
|
|
|
|
|
//this.P_PAGE_NUM++;
|
|
|
|
|
const request = {
|
|
|
|
|
@ -148,7 +221,53 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
createAbsence() {
|
|
|
|
|
createAbsence() {
|
|
|
|
|
this.common.openSubmitAbsencePage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
|
getAccrualBalance() {
|
|
|
|
|
if (this.Sdate) {
|
|
|
|
|
let today = new Date(this.Sdate);
|
|
|
|
|
let day = today.getDate();
|
|
|
|
|
let month = today.getMonth() + 1;
|
|
|
|
|
let year = today.getFullYear();
|
|
|
|
|
let todayDate = month + '/' + day + '/' + year;
|
|
|
|
|
let effectiveDate = todayDate;
|
|
|
|
|
const request = {
|
|
|
|
|
P_SELECTED_EMPLOYEE_NUMBER: this.emp_no,
|
|
|
|
|
P_EFFECTIVE_DATE: effectiveDate
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.accrualService
|
|
|
|
|
.getAccrualBalances(request)
|
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
|
this.handleAccrualResult(result);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
handleAccrualResult(result) {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
this.balance = result.GetAccrualBalancesList;
|
|
|
|
|
}
|
|
|
|
|
if(this.balance){
|
|
|
|
|
this.accrualNet = this.balance[0].ACCRUAL_NET_ENTITLEMENT;
|
|
|
|
|
this.accrualUsed = this.balance[0].ACCRUAL_USED_ENTITLEMENT;
|
|
|
|
|
this.accrualYearly = this.balance[0].ACCRUAL_YEARLY_ENTITLEMENT;
|
|
|
|
|
|
|
|
|
|
this.data = {
|
|
|
|
|
// labels: ['earingTotal', 'deductionTotal'],
|
|
|
|
|
datasets: [
|
|
|
|
|
{ data: [this.accrualNet,this.accrualUsed,this.accrualYearly],
|
|
|
|
|
backgroundColor: [
|
|
|
|
|
'#DDB017',
|
|
|
|
|
'#094875',
|
|
|
|
|
'#CB3232',],
|
|
|
|
|
borderWidth: 2
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|