accrual balances page added

master
Sultan Khan 6 years ago
parent 3b5da38b09
commit 7282366c03

@ -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 {}

@ -0,0 +1,7 @@
<ion-content>
<ion-router-outlet></ion-router-outlet>
</ion-content>

@ -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<AccrualBalancesPage>;
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();
});
});

@ -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() {
}
}

@ -0,0 +1,31 @@
<ion-header>
<ion-toolbar class="header-toolbar">
<ion-buttons slot="start">
<ion-back-button color="light" class="btnBack" defaultHref="/home"></ion-back-button>
</ion-buttons>
<ion-title color="light" >{{ts.trPK('accrualBalances','accrualBalances')}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<div class="tipsPadding" [innerHTML]="ts.trPK('accrualBalances','tip')"></div>
<ion-item>
<ion-label>{{ts.trPK('accrualBalances','selectDate')}}</ion-label>
<ion-datetime [(ngModel)]="Sdate" min="1900" max="2100" displayFormat="MMM/DD/YYYY " placeholder="MM/DD/YYYY"
(ionChange)="getAccrualBalance()"></ion-datetime>
</ion-item>
<ul>
<li *ngFor="let data of balance; let i=index">
<ion-card no-shadow text-center >
<div class="content-line accuralBox">
<div class="accuralImage"><img src="../assets/imgs/accrual.png" /></div>
<div class="accuralTxt"> <p class="balanceVal boldTxt"> {{data.ACCRUAL_NET_ENTITLEMENT}} </p>
<p class="balanceTxt">{{data.ACCURAL_PLAN_NAME}}</p></div>
</div>
</ion-card>
</li>
</ul>
</ion-content>

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

@ -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<HomeComponent>;
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();
});
});

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

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

@ -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();
});
});

@ -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 { }

@ -1,64 +1,63 @@
<!-- <ion-nav [root]="rootPage" #mycontent swipeBackEnabled="false"></ion-nav> -->
<!-- (ionWillOpen)="menuOpened(true)" -->
<ion-app [dir]="direction">
<ion-split-pane>
<ion-menu [side]=" direction === 'rtl' ? 'end' : 'start'" [swipeGesture]="false" >
<ion-content class="sidebar-menu" >
<div class="header-div">
<div class="centerDiv">
<p class="TxtPlace">{{ts.trPK('home','hello')}}, {{User_name_Emp}}</p>
<div> <img src="{{user_image}}" class="profileImg" ></div>
</div>
</div>
<ion-menu [side]=" direction === 'rtl' ? 'end' : 'start'" [swipeGesture]="false">
<ion-content class="sidebar-menu">
<div class="header-div">
<div class="centerDiv">
<p class="TxtPlace">{{ts.trPK('home','hello')}}, {{User_name_Emp}}</p>
<div> <img src="{{user_image}}" class="profileImg"></div>
</div>
</div>
<ion-list>
<ion-item>
<ion-thumbnail slot="start" class="menu-thumb">
<img width="30" src="../assets/imgs/bell.png" item-left >
</ion-thumbnail>
<ion-label>
{{ts.trPK('home','worklist')}}
<ion-badge item-end>{{notBadge}}</ion-badge>
</ion-label>
<ion-thumbnail slot="start" class="menu-thumb">
<img width="30" src="../assets/imgs/bell.png" item-left>
</ion-thumbnail>
<ion-label>
{{ts.trPK('home','worklist')}}
<ion-badge item-end>{{notBadge}}</ion-badge>
</ion-label>
<!-- <button class="menu-item" ion-item menuClose ion-item (click)="goToWorkListPage()" >
</button> -->
</ion-item>
<ion-item (click)="profile()">
<ion-thumbnail slot="start" class="menu-thumb">
<img width="30" src="../assets/imgs/username.png" item-left >
</ion-thumbnail>
<ion-label>
{{ts.trPK('userProfile','title')}}
</ion-label>
</ion-item>
<ion-item (click)="logout();">
<ion-thumbnail slot="start" class="menu-thumb">
<img width="30" src="../assets/imgs/signout.png" item-left >
</ion-thumbnail>
<ion-label>
<ion-item (click)="profile()">
<ion-thumbnail slot="start" class="menu-thumb">
<img width="30" src="../assets/imgs/username.png" item-left>
</ion-thumbnail>
<ion-label>
{{ts.trPK('userProfile','title')}}
</ion-label>
</ion-item>
<ion-item (click)="logout();">
<ion-thumbnail slot="start" class="menu-thumb">
<img width="30" src="../assets/imgs/signout.png" item-left>
</ion-thumbnail>
<ion-label>
{{ts.trPK('home','logout')}}
</ion-label>
</ion-item>
</ion-label>
</ion-item>
</ion-list>
<div class="menuFooter">
<div> <img src="{{companyUrl}}" class="CompanyImg" ></div>
<p class="companyTxt">{{companyDesc}}</p>
</div>
<div> <img src="{{companyUrl}}" class="CompanyImg"></div>
<p class="companyTxt">{{companyDesc}}</p>
</div>
</ion-content>
</ion-menu>
<ion-router-outlet main></ion-router-outlet>
<ion-router-outlet main></ion-router-outlet>
</ion-split-pane>

@ -111,4 +111,5 @@ export class AppComponent implements OnInit, AfterViewInit {
this.cs.openProfile();
this.menu.toggle();
}
}

@ -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();

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

@ -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();
}

@ -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),

@ -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();
}
}

@ -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();

@ -61,4 +61,7 @@ export class HomePage implements OnInit {
}
}
}
private accrualBalance(){
this.common.openAccuralPage();
}
}

@ -941,5 +941,19 @@
"en": "Attachment List",
"ar": "قائمة المرفقات"
}
},
"accrualBalances": {
"accrualBalances":{
"en":"Accrual Balances",
"ar":"رصيد حساب المستحقات"
},
"selectDate":{
"en": "Select Date",
"ar": "اختر التاريخ"
},
"tip":{
"en":"<p>Enter the <span class=\"boldTxtNav\">date</span> for which you wish to view your accrual balances.</p>",
"ar":"<p>أدخل <span class=\"boldTxtNav\">التاريخ</span> الذي تريد عرض الإستحقاقات له</p>"
}
}
}
Loading…
Cancel
Save