diff --git a/Mohem/src/app/accrual-balances/accrual-balances.module.ts b/Mohem/src/app/accrual-balances/accrual-balances.module.ts new file mode 100644 index 00000000..a80bafaf --- /dev/null +++ b/Mohem/src/app/accrual-balances/accrual-balances.module.ts @@ -0,0 +1,33 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { Routes, RouterModule } from '@angular/router'; +import {AccrualService} from './services/accrual.service'; +import { IonicModule } from '@ionic/angular'; + +import { AccrualBalancesPage } from './accrual-balances.page'; +import { HomeComponent } from './home/home.component'; +const routes: Routes = [ + { + path: '', + component: AccrualBalancesPage, + children: [ + { + path: 'home', + component: HomeComponent + } + ], + } +]; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + RouterModule.forChild(routes) + ], + declarations: [AccrualBalancesPage, HomeComponent], + providers:[AccrualService] +}) +export class AccrualBalancesPageModule {} diff --git a/Mohem/src/app/accrual-balances/accrual-balances.page.html b/Mohem/src/app/accrual-balances/accrual-balances.page.html new file mode 100644 index 00000000..5e531d12 --- /dev/null +++ b/Mohem/src/app/accrual-balances/accrual-balances.page.html @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Mohem/src/app/accrual-balances/accrual-balances.page.scss b/Mohem/src/app/accrual-balances/accrual-balances.page.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/accrual-balances/accrual-balances.page.spec.ts b/Mohem/src/app/accrual-balances/accrual-balances.page.spec.ts new file mode 100644 index 00000000..8e34b21d --- /dev/null +++ b/Mohem/src/app/accrual-balances/accrual-balances.page.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AccrualBalancesPage } from './accrual-balances.page'; + +describe('AccrualBalancesPage', () => { + let component: AccrualBalancesPage; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AccrualBalancesPage ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AccrualBalancesPage); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/accrual-balances/accrual-balances.page.ts b/Mohem/src/app/accrual-balances/accrual-balances.page.ts new file mode 100644 index 00000000..2c2c0c4d --- /dev/null +++ b/Mohem/src/app/accrual-balances/accrual-balances.page.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-accrual-balances', + templateUrl: './accrual-balances.page.html', + styleUrls: ['./accrual-balances.page.scss'], +}) +export class AccrualBalancesPage implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/Mohem/src/app/accrual-balances/home/home.component.html b/Mohem/src/app/accrual-balances/home/home.component.html new file mode 100644 index 00000000..c2304685 --- /dev/null +++ b/Mohem/src/app/accrual-balances/home/home.component.html @@ -0,0 +1,31 @@ + + + + + + {{ts.trPK('accrualBalances','accrualBalances')}} + + + +
+ + {{ts.trPK('accrualBalances','selectDate')}} + + + + + +
\ No newline at end of file diff --git a/Mohem/src/app/accrual-balances/home/home.component.scss b/Mohem/src/app/accrual-balances/home/home.component.scss new file mode 100644 index 00000000..827a8aab --- /dev/null +++ b/Mohem/src/app/accrual-balances/home/home.component.scss @@ -0,0 +1,89 @@ +ul{ + padding: 0px; + margin: 0px; +li{ + + +ion-card ,.card-md,.card-ios{ + position: relative; + box-shadow: none; + -webkit-box-shadow:none; + -moz-box-shadow: none; + border: 2px solid var(--gray); + margin: auto !important; + color: var(--darkgray); + border-radius: 10px !important; +} +} +} +li:nth-child(3n-1), +li:nth-child(3n){ + + display: inline-block; + width: calc(50% - 0px); + + div { + display: flex; + align-items: center; + flex-direction: column; + + p.balanceVal{ + color:var(--secondary); + font-size: 20px; + } + img { + width: 90px; + margin: auto; + } + .accuralImage{ + + min-height: auto; + margin-top:60px; + } + .boldTxt{position:absolute; left:0px;top:20px; width:100%;} + p.balanceTxt{ + font-size: 16px; + padding: 5px; + } + } + } + + li:nth-child(3n+1){ + display: flex; + align-items: center; + justify-content: center; + height: 140px; + overflow: visible; + div.content-line { + p.balanceVal{ + color:var(--secondary); + font-size: 20px; + } + img { + width: 100px; + margin: auto; + } + .accuralImage{ + + float:left; + width:50%; + } + .accuralTxt{ + + float:left; + width:50%; + } + p.balanceTxt{ + font-size: 16px; + padding: 5px; + + } + } + } + + + + +.content-line.accuralBox { + position: relative; +} \ No newline at end of file diff --git a/Mohem/src/app/accrual-balances/home/home.component.spec.ts b/Mohem/src/app/accrual-balances/home/home.component.spec.ts new file mode 100644 index 00000000..5ec1377b --- /dev/null +++ b/Mohem/src/app/accrual-balances/home/home.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomeComponent } from './home.component'; + +describe('HomeComponent', () => { + let component: HomeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HomeComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/accrual-balances/home/home.component.ts b/Mohem/src/app/accrual-balances/home/home.component.ts new file mode 100644 index 00000000..be5ffba5 --- /dev/null +++ b/Mohem/src/app/accrual-balances/home/home.component.ts @@ -0,0 +1,60 @@ +import { Component, OnInit } from "@angular/core"; +import { CommonService } from "src/app/hmg-common/services/common/common.service"; +import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service"; +import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service"; +import { AccrualService } from "../services/accrual.service"; +import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/models/authenticated-user"; +@Component({ + selector: "app-home", + templateUrl: "./home.component.html", + styleUrls: ["./home.component.scss"] +}) +export class HomeComponent implements OnInit { + Sdate: any; + emp_no: any; + balance:any; + constructor( + public ts: TranslatorService, + public cs: CommonService, + 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(); + } + }); + } + private 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.cs.validResponse(result)) { + this.balance=result.GetAccrualBalancesList; + } + } +} diff --git a/Mohem/src/app/accrual-balances/services/accrual.service.ts b/Mohem/src/app/accrual-balances/services/accrual.service.ts new file mode 100644 index 00000000..6e063d3e --- /dev/null +++ b/Mohem/src/app/accrual-balances/services/accrual.service.ts @@ -0,0 +1,25 @@ +import { Injectable } from "@angular/core"; +import { Observable } from "rxjs"; +import { ConnectorService } from "src/app/hmg-common/services/connector/connector.service"; +import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service"; +@Injectable({ + providedIn: "root" +}) +export class AccrualService { + public static GET_ACCRUAL_BALANCE = + "Services/ERP.svc/REST/GET_ACCRUAL_BALANCES"; + constructor( + public con: ConnectorService, + public authService: AuthenticationService + ) {} + public getAccrualBalances(balance: any, onError?: any, errorLabel?: string) { + const request = balance; + this.authService.authenticateRequest(request); + return this.con.post( + AccrualService.GET_ACCRUAL_BALANCE, + request, + onError, + errorLabel + ); + } +} diff --git a/Mohem/src/app/accrual-balances/services/service.service.spec.ts b/Mohem/src/app/accrual-balances/services/service.service.spec.ts new file mode 100644 index 00000000..d2923aa3 --- /dev/null +++ b/Mohem/src/app/accrual-balances/services/service.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { ServiceService } from './service.service'; + +describe('ServiceService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: ServiceService = TestBed.get(ServiceService); + expect(service).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/app-routing.module.ts b/Mohem/src/app/app-routing.module.ts index 0396eb74..9dc81222 100644 --- a/Mohem/src/app/app-routing.module.ts +++ b/Mohem/src/app/app-routing.module.ts @@ -1,25 +1,26 @@ -import { NgModule } from '@angular/core'; -import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; +import { NgModule } from '@angular/core'; +import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; + +const routes: Routes = [ + { path: '', redirectTo: 'authentication/login', pathMatch: 'full' }, + { + path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule', + data: { preload: true, delay: 1000 } + }, + { path: 'home', loadChildren: './home/home.module#HomePageModule' }, + { path: 'sms-page', loadChildren: './authentication/sms-page/sms-page.module#SmsPagePageModule' }, + { path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' }, + { path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' }, { path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' } -const routes: Routes = [ - { path: '', redirectTo: 'authentication/login', pathMatch: 'full' }, - { - path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule', - data: { preload: true, delay: 1000 } - }, - { path: 'home', loadChildren: './home/home.module#HomePageModule' }, - { path: 'sms-page', loadChildren: './authentication/sms-page/sms-page.module#SmsPagePageModule' }, - { path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' }, - { path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' } - - - -]; - -@NgModule({ - imports: [ - RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) - ], - exports: [RouterModule] -}) -export class AppRoutingModule { } + + + +]; + +@NgModule({ + imports: [ + RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) + ], + exports: [RouterModule] +}) +export class AppRoutingModule { } diff --git a/Mohem/src/app/app.component.html b/Mohem/src/app/app.component.html index 8dd02575..d4260c37 100644 --- a/Mohem/src/app/app.component.html +++ b/Mohem/src/app/app.component.html @@ -1,64 +1,63 @@ - - - -
-
-

{{ts.trPK('home','hello')}}, {{User_name_Emp}}

-
- -
-
+ + +
+
+

{{ts.trPK('home','hello')}}, {{User_name_Emp}}

+
+ +
+
- - - - - {{ts.trPK('home','worklist')}} - - {{notBadge}} - + + + + + {{ts.trPK('home','worklist')}} + + {{notBadge}} + - - - - - - {{ts.trPK('userProfile','title')}} - - - - - - - - - + + + + + + {{ts.trPK('userProfile','title')}} + + + + + + + + + {{ts.trPK('home','logout')}} - - - + + + - - + + +
+

{{companyDesc}}

+
- +
- +
diff --git a/Mohem/src/app/app.component.ts b/Mohem/src/app/app.component.ts index e38bb54c..c77be859 100644 --- a/Mohem/src/app/app.component.ts +++ b/Mohem/src/app/app.component.ts @@ -111,4 +111,5 @@ export class AppComponent implements OnInit, AfterViewInit { this.cs.openProfile(); this.menu.toggle(); } + } diff --git a/Mohem/src/app/authentication/check-user/check-user.component.ts b/Mohem/src/app/authentication/check-user/check-user.component.ts index ba44cdbe..d0b0579a 100644 --- a/Mohem/src/app/authentication/check-user/check-user.component.ts +++ b/Mohem/src/app/authentication/check-user/check-user.component.ts @@ -12,7 +12,7 @@ import { LoginRequest } from 'src/app/hmg-common/services/authentication/models/ import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service'; import { Password } from '../models/password'; import { LoginModel } from '../models/LoginModel'; - +import {LoginComponent} from 'src/app/authentication/login/login.component'; @Component({ selector: 'app-check-user', templateUrl: './check-user.component.html', @@ -77,7 +77,7 @@ export class CheckUserComponent implements OnInit { console.log(result); this.loginData.LogInTokenID = result.LogInTokenID; this.loginData.P_USER_NAME = this.P_USER_NAME; - this.sharedData.setSharedData(this.loginData, "logindata"); + this.sharedData.setSharedData(this.loginData, AuthenticationService.LOGIN_DATA); this.sharedData.setSharedData(true,Password.IS_FORGET_PSW); this.cs.stopLoading(); this.cs.openSMSPage(); diff --git a/Mohem/src/app/authentication/forgot/forgot.component.ts b/Mohem/src/app/authentication/forgot/forgot.component.ts index 92865083..e2bd4b92 100644 --- a/Mohem/src/app/authentication/forgot/forgot.component.ts +++ b/Mohem/src/app/authentication/forgot/forgot.component.ts @@ -10,7 +10,7 @@ import { InternationalMobileComponent } from 'src/app/hmg-common/ui/mobile-numbe import { ForgetPassword } from '../models/forget.password'; import { LoginModel } from '../models/LoginModel'; import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service'; - +import {LoginComponent} from "src/app/authentication/login/login.component"; @Component({ selector: 'app-forgot', templateUrl: './forgot.component.html', @@ -58,7 +58,7 @@ export class ForgotComponent implements OnInit { } public forgotpassword(){ - const data = this.sharedData.getSharedData("logindata", false); + const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); this.loginData.P_USER_NAME = this.P_USER_NAME; let request:ForgetPassword = new ForgetPassword(); request.P_Confirm_NEW_PASSWORD=this.P_NEW_PASSWORD; diff --git a/Mohem/src/app/authentication/login/login.component.ts b/Mohem/src/app/authentication/login/login.component.ts index 4e3b310b..9d5656b1 100644 --- a/Mohem/src/app/authentication/login/login.component.ts +++ b/Mohem/src/app/authentication/login/login.component.ts @@ -33,6 +33,7 @@ export class LoginComponent implements OnInit, OnDestroy { private isMobileFingerPrint: boolean; private FingerPrintPatientIdentificationID: string; private loginData = new LoginModel(); + constructor( public cs: CommonService, public authService: AuthenticationService, @@ -90,7 +91,8 @@ export class LoginComponent implements OnInit, OnDestroy { if (this.cs.validResponse(result)) { this.loginData.LogInTokenID = result.LogInTokenID; this.loginData.MobileNumber = result.MemberLoginList.P_MOBILE_NUMBER; - this.sharedData.setSharedData(this.loginData, "logindata"); + this.loginData.P_USER_NAME=this.username; + this.sharedData.setSharedData(this.loginData, AuthenticationService.LOGIN_DATA); this.cs.stopLoading(); this.cs.openSMSPage(); } diff --git a/Mohem/src/app/authentication/sms-page/sms-page.page.ts b/Mohem/src/app/authentication/sms-page/sms-page.page.ts index 24a54baa..41f39074 100644 --- a/Mohem/src/app/authentication/sms-page/sms-page.page.ts +++ b/Mohem/src/app/authentication/sms-page/sms-page.page.ts @@ -125,7 +125,7 @@ export class SmsPagePage implements OnInit { } public checkSMS() { - const data = this.sharedData.getSharedData("logindata", false); + const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); const request = new SMSCheckRequest(); (request.LogInTokenID = data.LogInTokenID), @@ -144,7 +144,7 @@ export class SmsPagePage implements OnInit { } public checkForgetPwdSMS() { - const data = this.sharedData.getSharedData("logindata", false); + const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); const request = new SMSCheckRequest(); (request.LogInTokenID = data.LogInTokenID), diff --git a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts index 210c3e6a..bfccc7a4 100644 --- a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts +++ b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts @@ -66,8 +66,7 @@ export class AuthenticationService { public static LOGIN_EVENT = 'user-login-event'; public static FAMILY_LOGIN_EVENT = 'family-login-event'; public static AUTHENTICATED_USER_KEY = 'save-authenticated-user'; - - + public static LOGIN_DATA="logindata"; // private static user: AuthenticatedUser; @@ -307,7 +306,7 @@ export class AuthenticationService { user.CompanyImageDescription=result.CompanyImageDescription; user.CompanyImageURL=result.CompanyImageURL; user.LogInTokenID = this.cs.sharedService.getSharedData( - "logindata" + AuthenticationService.LOGIN_DATA ).LogInTokenID; return user; } @@ -406,7 +405,7 @@ export class AuthenticationService { // this.getAuthenticatedUser() //commented for now will uncomment when we are going to deploy on the device; //observer.next(null); - observer.next(AuthenticationService.user); + observer.next(this.getAuthenticatedUser()); observer.complete(); } ); @@ -422,7 +421,11 @@ export class AuthenticationService { return AuthenticationService.user; } */ + if(AuthenticationService.user){ return AuthenticationService.user; + }else{ + this.cs.openLogin(); + } } diff --git a/Mohem/src/app/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts index aab50a10..c3b17829 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -895,7 +895,9 @@ export class CommonService { public openProfile() { this.nav.navigateForward(["/profile/home"]); } - + public openAccuralPage() { + this.nav.navigateForward(["/accrual-balances/home"]); + } public reload(url: string, from: string) { console.log("force reload called from:" + from); // window.location.reload(); diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index 50e4f169..be1c6674 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -61,4 +61,7 @@ export class HomePage implements OnInit { } } } + private accrualBalance(){ + this.common.openAccuralPage(); + } } diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index f5e7c8b6..3db8c7ea 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -941,5 +941,19 @@ "en": "Attachment List", "ar": "قائمة المرفقات" } + }, + "accrualBalances": { + "accrualBalances":{ + "en":"Accrual Balances", + "ar":"رصيد حساب المستحقات" + }, + "selectDate":{ + "en": "Select Date", + "ar": "اختر التاريخ" + }, + "tip":{ + "en":"

Enter the date for which you wish to view your accrual balances.

", + "ar":"

أدخل التاريخ الذي تريد عرض الإستحقاقات له

" + } } } \ No newline at end of file