finish leave balance chart

MOHEMM-SFH-COLORS
Fatimah.Alshammari 6 years ago
parent 6385c93e56
commit e71dd383da

@ -1,4 +1,4 @@
<ion-header >
<!-- <ion-header >
<ion-toolbar class="header-toolbar-new">
<ion-title color="light">{{ts.trPK('absenceList','absenceList')}}</ion-title>
<ion-buttons slot="start">
@ -10,9 +10,135 @@
</button>
</ion-buttons>
</ion-toolbar>
</ion-header>
</ion-header> -->
<ion-content class="colorBG">
<div class="header-div">
<!-- <ion-buttons slot="end">
<button class="headerBtn" (click)="AccrualBalances()">
<img class="headerImg" src="../assets/imgs/accubalance.png">
</button>
</ion-buttons> -->
<ion-buttons slot="start">
<ion-back-button color="light" class="btnBack" defaultHref="/home"></ion-back-button>
</ion-buttons>
<p class="Title">{{ts.trPK('absenceList','absenceList')}}</p>
</div>
<div class="">
<div >
<ion-grid class="headerGrid">
<div style="color: black;">
<div class="result-graph">
<div>
<!-- <ion-item> -->
<!-- <ion-label class="datelabel">{{request.P_EFFECTIVE_DATE}}</ion-label> -->
<ion-datetime [(ngModel)]="Sdate" class="datetime" displayFormat="DD MMMM YYYY" placeholder="DD MMMM YYYY"
(ionChange)="getAccrualBalance()"></ion-datetime>
<ion-icon class="iconCalendar" ios="ios-calendar" md="md-calendar"></ion-icon>
<!-- </ion-item> -->
</div>
<div style=" border-bottom: 1px solid #a7a4a4; margin-bottom: 12px;
margin-top: -10px; margin-right: -9px;"></div>
<div class="result-text-container">
<!-- <h2>10</h2> -->
<h2>{{accrualNet + accrualUsed + accrualYearly}}</h2>
<span>{{ts.trPK('absenceList','totalNumber')}}</span>
</div>
<p-chart #chart class="today-graph" type="doughnut" [data]="data" [options]="options"></p-chart>
</div>
<div style="position: relative;
left: 82%;
bottom: 128px;
color: black;
background-color: #DDB017;
width: 13%;
height: 6px;">
<ion-col>
<ion-row>
<label class="green-label">{{ts.trPK('absenceList','accrualNet')}}</label>
</ion-row>
<ion-row>
<label class="green-amount">{{accrualNet}}</label>
</ion-row>
</ion-col>
</div>
<div style="position: relative;
left: 59%;
bottom: 131px;
color: black;
background-color: #094875;
width: 13%;
height: 6px;">
<ion-col>
<ion-row>
<label class="blue-label">{{ts.trPK('absenceList','accrualUsed')}}</label>
</ion-row>
<ion-row>
<label class="blue-amount" for="">{{accrualUsed}}</label>
</ion-row>
</ion-col>
</div>
<div style="position: relative;
left: 82%;
bottom: 80px;
color: black;
background-color: #CB3232;
width: 13%;
height: 6px;">
<ion-col>
<ion-row>
<label class="blue-label">{{ts.trPK('absenceList','accrualYearly')}}</label>
</ion-row>
<ion-row>
<label class="blue-amount" for="">{{accrualYearly}}</label>
</ion-row>
</ion-col>
</div>
<!-- <div style="position: relative;
left: 59%;
bottom: 73px;
color: black;
background-color: #094875;
width: 16%;
height: 6px;">
<ion-col>
<ion-row>
<label class="blue-label">text</label>
</ion-row>
<ion-row> -->
<!-- <label class="blue-amount" for="">{{getleaveAccrualBalance.ACCRUAL_YEARLY_ENTITLEMENT}}</label> -->
<!-- </ion-row>
</ion-col>
</div> -->
</div>
</ion-grid>
</div>
</div>
<!-- /////////////////////////////////////////////////////////up -->
<ion-content padding>
<div class="no-dataDiv" *ngIf="!GetAbsenceTransactionList || GetAbsenceTransactionList.length <= 0" >

@ -60,8 +60,8 @@
background-color: #22C6B3;
text-transform: capitalize;
height: 160px;
position: relative;
display: block;
/* position: relative; */
/* display: block; */
margin-bottom: -28px;
}
@ -77,3 +77,131 @@
background: #fff !important;
height: 1px;
}
//////////////////////////////////////////////down
.colorBG{
--background: #f0efef;
}
.Title{
text-align: center;
color: white;
margin-top: -33px;
font-size: 17px;
}
.result-graph{
font-size: 14px;
margin-left: -48px;
margin-right: 3px;
margin-bottom: -30px;
}
.datetime{
// text-align: center;
// font-family: WorkSans-Bold;
// margin-left: 111px;
text-align: center;
font-family: WorkSans-Bold;
margin-left: 47px;
margin-top: -19px;
}
.datelabel{
margin-left: 150px;
color: black !important;
font-family: WorkSans-Bold;
}
.iconCalendar{
// margin-left: -241px;
// margin-top: 5px;
margin-left: 30px !important;
width: 22% !important;
height: 26px !important;
margin-top: -69px !important;
margin-bottom: 20px !important;
}
.today-graph{
// display:block !important;
// height: 150px !important;
// width: 300 !important;
// margin-left: -70px !important;
display: block !important;
height: 196px;
width: 385px;
padding-left: 51px;
// padding-top: 29px;
margin-left: -70px !important;
}
.headerGrid{
background-color: white !important;
border: 1px solid #cac8c8 !important;
border-radius: 20px !important;
padding-top: 28px;
padding-bottom: 14px;
margin-left: 9px;
margin-right: 13px;
margin-top: -94px;
margin-bottom: 10px;
}
.header{
margin-top: -126px;
}
.result-text-container {
padding: 0;
margin: 0;
position: absolute;
left: 31%;
top: 26%;
display: block;
text-align: center;
transform: translate(-50%, -50%);
h2 {
font-size: 25px;
font-family: WorkSans-Bold;
margin: 0 auto;
// margin-top: 289px;
line-height: 36px;
}
span {
width: 125px;
display: block;
margin: 0 auto;
font-size: 12px;
// margin-top: 289px;
font-family: workSans-Regular;
}
}
.green-label{
font-size: 12px;
margin-top: -13px;
}
.green-amount{
font-size: 17px;
font-family: WorkSans-Bold;
margin-top: -3px;
}
.blue-label{
font-size: 12px;
margin-top: -13px;
}
.blue-amount{
font-size: 17px;
font-family: WorkSans-Bold;
margin-top: -4px;
}

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

@ -579,6 +579,8 @@ export class HomePage implements OnInit {
for (const accrualBalance of result.GetAccrualBalancesList) {
if (accrualBalance.ACCURAL_PLAN_NAME === 'HMG Annual Vacation Accrual Plan') {
this.statsButtons[3].statsValue = accrualBalance.ACCRUAL_NET_ENTITLEMENT;
this.common.sharedService.setSharedData( accrualBalance, 'leaveAccrualBalance');
this.common.sharedService.setSharedData( request, 'leaveAccrualBalanceDate');
} else {
totalTicketsLeft = totalTicketsLeft + accrualBalance.ACCRUAL_NET_ENTITLEMENT;
}

@ -1210,6 +1210,22 @@
"en": "Accrual Balances",
"ar": "رصيد حساب المستحقات"
},
"accrualNet": {
"en": "Accrual Net",
"ar": "صافي الاستحقاق"
},
"accrualUsed": {
"en": "Accrual Used",
"ar": "الاستحقاق المستخدم"
},
"accrualYearly": {
"en": "Accrual Yearly",
"ar": "الاستحقاق السنوي"
},
"totalNumber": {
"en": "TOTAL NUMBERS",
"ar": "المجموع"
},
"createAbsence": {
"en": "Create Absence",
"ar": "إنشاء إجازة"

Loading…
Cancel
Save