diff --git a/Mohem/src/app/absence/home/home.component.html b/Mohem/src/app/absence/home/home.component.html index 1fe0d412..c953957f 100644 --- a/Mohem/src/app/absence/home/home.component.html +++ b/Mohem/src/app/absence/home/home.component.html @@ -1,4 +1,4 @@ - + + + +
+ + + + + +

{{ts.trPK('absenceList','absenceList')}}

+ +
+ + +
+
+ + + + +
+ +
+
+ + + + + +
+
+ +
+ + +

{{accrualNet + accrualUsed + accrualYearly}}

+ + {{ts.trPK('absenceList','totalNumber')}} + +
+ + + + +
+
+ + + + + + + + +
+
+ + + + + + + + + +
+
+ + + + + + + + + +
+ + + + + +
+
+
+
+ + + +
diff --git a/Mohem/src/app/absence/home/home.component.scss b/Mohem/src/app/absence/home/home.component.scss index 41a72312..03435cc4 100644 --- a/Mohem/src/app/absence/home/home.component.scss +++ b/Mohem/src/app/absence/home/home.component.scss @@ -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; + } \ No newline at end of file diff --git a/Mohem/src/app/absence/home/home.component.ts b/Mohem/src/app/absence/home/home.component.ts index 50dd3494..2163da6e 100644 --- a/Mohem/src/app/absence/home/home.component.ts +++ b/Mohem/src/app/absence/home/home.component.ts @@ -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 + } + ] + }; + + } + } } diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index c29c014b..2016f9a5 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -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; } diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index 6a42895d..308b8b42 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -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": "إنشاء إجازة"