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.
174 lines
4.7 KiB
TypeScript
174 lines
4.7 KiB
TypeScript
import { Component, OnInit, ViewChild, SimpleChanges } from '@angular/core';
|
|
import { PayslipService } from '../service/payslip.service'
|
|
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
|
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
|
import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response';
|
|
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
|
|
import { DeductionRequest } from '../model/deductionReq';
|
|
import { IonInfiniteScroll, IonSlides } from '@ionic/angular';
|
|
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
|
|
import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/models/authenticated-user";
|
|
import { UIChart } from 'primeng/components/chart/chart';
|
|
|
|
@Component({
|
|
selector: 'app-home',
|
|
templateUrl: './home.component.html',
|
|
styleUrls: ['./home.component.scss'],
|
|
})
|
|
export class HomeComponent implements OnInit {
|
|
selEmp: string;
|
|
respID: number;
|
|
selMenu: MenuResponse;
|
|
GetPayslipList: any = '';
|
|
GetSummaryOfPaymentList: any = '';
|
|
GetPaymentInformationList: any = '';
|
|
showPaySlip: any = [];
|
|
ActionContextID: any;
|
|
public static ACTION_CONTEXT_ID = "passActionContectID";
|
|
GetEarningsList: any = '';
|
|
GetDeductionsList: any = '';
|
|
earingTotal: any;
|
|
deductionTotal: any;
|
|
firstPayslip: any;
|
|
defultSelected: any;
|
|
IsReachEnd: any;
|
|
private deductionReq: DeductionRequest;
|
|
doinfiniteDedReq: any;
|
|
doinfinitEarReq: any;
|
|
personalInfo: any;
|
|
setImage: any;
|
|
imageSrc: any = "../assets/imgs/profile.png";
|
|
slideView: any;
|
|
sliderOne: any;
|
|
payslipIndex: any;
|
|
data: any;
|
|
public paySlipYearsData: any;
|
|
public paySlipMonthsData: any;
|
|
public direction: string;
|
|
@ViewChild('slides') slides: IonSlides;
|
|
@ViewChild('slideWithNav') slideWithNav: IonSlides;
|
|
@ViewChild('chart') chart: UIChart;
|
|
slideOptsOne = {
|
|
initialSlide: 0,
|
|
slidesPerView: 1,
|
|
autoplay: true
|
|
};
|
|
public userData: any;
|
|
public selectedYear: any;
|
|
public selectedMonth: any;
|
|
|
|
|
|
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
|
|
public options = {
|
|
cutoutPercentage: 85,
|
|
tooltips: { enabled: false },
|
|
legend: { display: false }
|
|
};
|
|
gaugeType = "full";
|
|
|
|
|
|
|
|
constructor(
|
|
public payslipService: PayslipService,
|
|
public ts: TranslatorService,
|
|
public common: CommonService,
|
|
public sharedData: SharedDataService,
|
|
public authService: AuthenticationService,
|
|
public cs: CommonService,
|
|
|
|
|
|
) {}
|
|
|
|
|
|
ngOnInit() {
|
|
this.direction = TranslatorService.getCurrentLanguageName()
|
|
this.userData = this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA, false);
|
|
|
|
this.getPayslip();
|
|
}
|
|
|
|
|
|
public callPayslipData() {
|
|
console.log(this.selectedYear);
|
|
console.log(this.selectedMonth);
|
|
if (this.selectedYear && this.selectedMonth) {
|
|
this.getDeduction();
|
|
this.getEarings();
|
|
}
|
|
}
|
|
|
|
|
|
getPayslip() {
|
|
this.respID = -999;
|
|
const request = {};
|
|
this.payslipService.getPayslipPeriods(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => {
|
|
this.handleRespondGetPayslipResult(result.GetPayslipPeriodsList);
|
|
}
|
|
);
|
|
}
|
|
|
|
handleRespondGetPayslipResult(result) {
|
|
|
|
if (result != null) {
|
|
this.paySlipYearsData = result.GetPayslipsYearList;
|
|
this.paySlipMonthsData = result.GetPayslipsMonthList
|
|
}
|
|
}
|
|
|
|
|
|
handleGetPaymentInfoResult(result) {
|
|
if (result.GetPaymentInformationList != null) {
|
|
this.GetPaymentInformationList = result.GetPaymentInformationList;
|
|
}
|
|
}
|
|
|
|
openEarings() {
|
|
this.common.openEarningsPage();
|
|
}
|
|
openDeductions() {
|
|
this.common.openDeductionsPage();
|
|
}
|
|
|
|
getEarings() {
|
|
const request = {
|
|
P_PAGE_NUM: 1,
|
|
P_PAGE_LIMIT: 100,
|
|
P_MON: this.selectedMonth,
|
|
P_YEAR: this.selectedYear
|
|
}
|
|
this.doinfinitEarReq = request;
|
|
this.payslipService.getEarings(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => {
|
|
this.handleGetEaringsResult(result);
|
|
}
|
|
);
|
|
}
|
|
|
|
handleGetEaringsResult(result) {
|
|
if (result.GetEarningsList != null) {
|
|
this.GetEarningsList = result.GetEarningsList;
|
|
}
|
|
}
|
|
|
|
getDeduction() {
|
|
console.log("getDeduction");
|
|
const request = {
|
|
P_PAGE_NUM: 1,
|
|
P_PAGE_LIMIT: 100,
|
|
P_MON: this.selectedMonth,
|
|
P_YEAR: this.selectedYear
|
|
}
|
|
|
|
this.payslipService.getDeduction(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => {
|
|
this.handleGetDeductionResult(result);
|
|
}
|
|
);
|
|
}
|
|
|
|
handleGetDeductionResult(result) {
|
|
if (result.GetDeductionsList != null) {
|
|
this.GetDeductionsList = result.GetDeductionsList;
|
|
}
|
|
}
|
|
|
|
}
|