working on vacation rule

MOHEMM-Q3-DEV-LATEST
haroon amjad 7 years ago
parent ecb14d5df7
commit f24b082f7c

@ -8,7 +8,8 @@ const routes: Routes = [
data: { preload: true, delay: 1000 }
},
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
{ path: 'sms-page', loadChildren: './authentication/sms-page/sms-page.module#SmsPagePageModule' }
{ path: 'sms-page', loadChildren: './authentication/sms-page/sms-page.module#SmsPagePageModule' },
{ path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' }
];

@ -3,4 +3,5 @@
// Put style rules here that you want to apply to the entire application. These
// styles are for the entire app and not just one component. Additionally, this
// file can hold Sass mixins, functions, and placeholder classes to be imported
// and used throughout the application.
// and used throughout the application.

@ -14,7 +14,7 @@ export class TranslatorService {
public static EN = 'en';
public static EN_US = 'en-us';
public static AR = 'ar';
public static CURRENT_LANGUAGE = TranslatorService.AR;
public static CURRENT_LANGUAGE = TranslatorService.EN;
public static CHANGE_EVENT = 'language-changed-event';
private static translations: any;
constructor(

@ -9,7 +9,7 @@ import { HomePage } from './home.page';
const routes: Routes = [
{
path: '',
component: HomePage
component: HomePage,
}
];
@ -19,13 +19,10 @@ const routes: Routes = [
FormsModule,
IonicModule,
HmgCommonModule,
RouterModule.forChild([
{
path: '',
component: HomePage
}
])
RouterModule.forChild(routes)
],
declarations: [HomePage]
declarations: [
HomePage
]
})
export class HomePageModule {}
export class HomePageModule { }

@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { MenuController } from '@ionic/angular';
import { MenuController, NavController } from '@ionic/angular';
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
import { SMSCheckResponse } from "src/app/hmg-common/services/authentication/models/smscheck.response";
import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user';
@ -10,37 +10,41 @@ import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/mo
styleUrls: ['./home.page.scss'],
})
export class HomePage implements OnInit {
userData: any ={};
user_image : any = "../assets/imgs/profile.png";
constructor(public ts: TranslatorService, public menu: MenuController, public authService: AuthenticationService ) { }
userData: any = {};
user_image: any = "../assets/imgs/profile.png";
constructor(public ts: TranslatorService, public menu: MenuController, public authService: AuthenticationService, public nav: NavController) { }
ngOnInit() {
this.getUserDetails();
}
private openMenu(){
private openMenu() {
this.menu.toggle();
}
private getUserDetails(){
const user = this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => {
if (user) {
this.userData=user;
console.log(user);
}else{
console.log(user);
}
})
private getUserDetails() {
const user = this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => {
if (user) {
this.userData = user;
console.log(user);
} else {
console.log(user);
}
});
}
// private getMenu(){
// this.menuService.getMenu().
// subscribe((result: MenuResponse) => {
// this.handleMenuResult(result);
// });
// }
// private handleMenuResult(result){
// if (this.common.validResponse(result)) {
// if (this.common.hasData(result.List_Menu)) {
// this.menuList = result.List_Menu;
// }
// }
public Vaction_Rule() {
this.nav.navigateForward(['/vacation-rule/home']);
}
// private getMenu(){
// this.menuService.getMenu().
// subscribe((result: MenuResponse) => {
// this.handleMenuResult(result);
// });
// }
// private handleMenuResult(result){
// if (this.common.validResponse(result)) {
// if (this.common.hasData(result.List_Menu)) {
// this.menuList = result.List_Menu;
// }
// }
}

@ -0,0 +1,82 @@
<ion-header>
<!-- <ion-toolbar>
<nav-buttons></nav-buttons>
<ion-title>{{ 'general,vacation-rule' | translate}}</ion-title>
</ion-toolbar> -->
<ion-toolbar class="header-toolbar">
<ion-buttons slot="start">
<ion-back-button color="light" class="btnBack"></ion-back-button>
</ion-buttons>
<ion-title color="light">{{ 'general,vacation-rule' | translate}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<div style="padding: 0 10px;" [innerHTML]='"vacation-rule, main-heading" | translate'></div>
<div>
<ion-card *ngFor="let item of GetVacationRulesList; let i = index;">
<ion-card-header class="boxHdr">
<ion-grid no-padding>
<ion-row class="hrTitle" nowrap>
<ion-col size="8">
<ion-text style="font-size: larger;"><b>{{'vacation-rule, rule-Info' | translate}}</b></ion-text>
</ion-col>
<ion-col size="2">
<button class="btnBack" ion-button (click)="deleteFunc(i)">
<img class="imgSize" src="../assets/imgs/delete.png"></button>
</ion-col>
<ion-col size="2">
<button class="btnBack" ion-button (click)="updateFunc(i)">
<img class="imgSize" src="../assets/imgs/edit.png"></button>
</ion-col>
</ion-row>
</ion-grid>
</ion-card-header>
<ion-card-content>
<ion-grid>
<div>
<ion-row>
<ion-col class="colBold">
<label for="">{{'vacation-rule, rule-name' | translate}}</label>
</ion-col>
<ion-col>
<label for=""> {{item.RULE_NAME}}</label>
</ion-col>
</ion-row>
</div>
<ion-row>
<ion-col class="colBold">
<label for="">{{'vacation-rule, rule-type' | translate}}</label>
</ion-col>
<ion-col>
<label for=""> {{item.ITEM_TYPE_DISPLAY_NAME}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold">
<label for="">{{'vacation-rule, notification-label' | translate}}</label>
</ion-col>
<ion-col>
<label for=""> {{item.NOTIFICATION_SUBJECT}}</label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="colBold">
<label for="">{{'vacation-rule, rule-status' | translate}}</label>
</ion-col>
<ion-col>
<label for=""> {{item.RULE_STATUS}}</label>
</ion-col>
</ion-row>
</ion-grid>
</ion-card-content>
</ion-card>
</div>
</ion-content>

@ -0,0 +1,93 @@
.item-md p,
.item-md ios {
white-space: normal;
}
.col {
white-space: normal;
font-size: 14px;
}
ion-col.colBold {
color: #1a586d;
}
.imgSize {
width: 22px;
height: 22px;
-webkit-box-shadow: none;
box-shadow: none;
}
ion-button {
background: transparent;
}
ion-card-header {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.header-toolbar {
--background: linear-gradient(45deg, #3ac1f1 0%, #19a163 36%, #19a163 59%, #1a586d 100%);
}
.btnBack {
background: transparent;
float: right;
}
.button,
.button-md,
button-ios {
background: transparent;
}
ion-card-header {
padding: 0px 10px !important;
color: #ffffff !important;
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
background: #acacac;
.hrTitle {
white-space: normal;
padding: 5px;
padding-top: 12px;
width: 100%;
min-height: 45px;
// @media screen and (max-width: 565px) {
// width: 80%;
// }
// @media screen and (max-width: 450px) {
// width: 74%;
// }
// @include ltr() {
// float: left;
// }
// @include rtl() {
// float: right;
// }
line-height: 1.2;
}
.button,
.button-md,
button-ios {
background: transparent;
box-shadow: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
min-width: auto;
padding: 0px !important;
margin: 0px 5px !important;
// @include ltr() {
// float: right;
// }
// @include rtl() {
// float: left;
// }
}
}

@ -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,152 @@
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { VacationRuleServiceService } from './../service/vacation-rule-service.service';
import { VacationRuleRequest } from './../model/VacationRuleRequest';
import { Component, OnInit } from '@angular/core';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'],
})
export class HomeComponent implements OnInit {
userName: any;
P_PAGE_NUM: number;
P_PAGE_LIMIT: number;
GetVacationRulesList: any = [];
isUpdate: boolean = false;
IsReachEnd: boolean = false;
RespondAttributeList: any;
constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService) {
this.P_PAGE_NUM = 1;
this.P_PAGE_LIMIT = 50;
this.GetVacationRulesList = [
{
"ACTION": "FORWARD",
"ACTION_DISPLAY": "Forward",
"BEGIN_DATE": "6/26/2019 2:50:14 PM",
"END_DATE": "6/30/2019 2:50:22 PM",
"FROM_ROW_NUM": 1,
"FYI_FLAG": "Y",
"ITEM_TYPE": "HRSSA",
"ITEM_TYPE_DISPLAY_NAME": "HR",
"MESSAGE": "TEst Rule",
"NOTIFICATION_DISPLAY_NAME": "<All>",
"NOTIFICATION_NAME": "*",
"NOTIFICATION_SUBJECT": "<All>",
"NO_OF_ROWS": 1,
"REPLACEMENT_USER_NAME": "70915",
"ROW_NUM": 1,
"RULE_ID": 7770756,
"RULE_NAME": "Delegate: Al Oulah, Mohammed",
"RULE_STATUS": "Active",
"RULE_TIP_MESSAGE": "",
"TO_ROW_NUM": 1
},
{
"ACTION": "FORWARD",
"ACTION_DISPLAY": "Forward",
"BEGIN_DATE": "6/26/2019 2:50:14 PM",
"END_DATE": "6/30/2019 2:50:22 PM",
"FROM_ROW_NUM": 1,
"FYI_FLAG": "Y",
"ITEM_TYPE": "HRSSA",
"ITEM_TYPE_DISPLAY_NAME": "HR",
"MESSAGE": "TEst Rule",
"NOTIFICATION_DISPLAY_NAME": "<All>",
"NOTIFICATION_NAME": "*",
"NOTIFICATION_SUBJECT": "<All>",
"NO_OF_ROWS": 1,
"REPLACEMENT_USER_NAME": "70915",
"ROW_NUM": 1,
"RULE_ID": 7770756,
"RULE_NAME": "Delegate: Al Oulah, Mohammed",
"RULE_STATUS": "Active",
"RULE_TIP_MESSAGE": "",
"TO_ROW_NUM": 1
},
{
"ACTION": "FORWARD",
"ACTION_DISPLAY": "Forward",
"BEGIN_DATE": "6/26/2019 2:50:14 PM",
"END_DATE": "6/30/2019 2:50:22 PM",
"FROM_ROW_NUM": 1,
"FYI_FLAG": "Y",
"ITEM_TYPE": "HRSSA",
"ITEM_TYPE_DISPLAY_NAME": "HR",
"MESSAGE": "TEst Rule",
"NOTIFICATION_DISPLAY_NAME": "<All>",
"NOTIFICATION_NAME": "*",
"NOTIFICATION_SUBJECT": "<All>",
"NO_OF_ROWS": 1,
"REPLACEMENT_USER_NAME": "70915",
"ROW_NUM": 1,
"RULE_ID": 7770756,
"RULE_NAME": "Delegate: Al Oulah, Mohammed",
"RULE_STATUS": "Active",
"RULE_TIP_MESSAGE": "",
"TO_ROW_NUM": 1
},
{
"ACTION": "FORWARD",
"ACTION_DISPLAY": "Forward",
"BEGIN_DATE": "6/26/2019 2:50:14 PM",
"END_DATE": "6/30/2019 2:50:22 PM",
"FROM_ROW_NUM": 1,
"FYI_FLAG": "Y",
"ITEM_TYPE": "HRSSA",
"ITEM_TYPE_DISPLAY_NAME": "HR",
"MESSAGE": "TEst Rule",
"NOTIFICATION_DISPLAY_NAME": "<All>",
"NOTIFICATION_NAME": "*",
"NOTIFICATION_SUBJECT": "<All>",
"NO_OF_ROWS": 1,
"REPLACEMENT_USER_NAME": "70915",
"ROW_NUM": 1,
"RULE_ID": 7770756,
"RULE_NAME": "Delegate: Al Oulah, Mohammed",
"RULE_STATUS": "Active",
"RULE_TIP_MESSAGE": "",
"TO_ROW_NUM": 1
}
];
}
ngOnInit() {
console.log('OnInit');
this.getVacationRules();
console.log(this.GetVacationRulesList);
}
getVacationRules() {
this.P_PAGE_NUM = 1;
this.IsReachEnd = false;
let request: VacationRuleRequest = new VacationRuleRequest();
request.P_PAGE_LIMIT = this.P_PAGE_LIMIT;
request.P_PAGE_NUM = this.P_PAGE_NUM;
this.vacationRuleService.getVacationRule(request, () => {
this.getVacationRules();
}, this.ts.trPK('general', 'retry')).subscribe((result) => {
if (this.cs.validResponse(result)) {
console.log(result);
console.log(JSON.stringify(result));
} else {
this.cs.presentAlert(result.ErrorEndUserMessage);
}
});
}
deleteFunc(i) {
}
updateFunc(i) {
}
}

@ -0,0 +1,7 @@
import { Request } from '../../hmg-common/services/models/request';
export class VacationRuleRequest extends Request {
public static SHARED_DATA = 'vacation-request';
public P_PAGE_NUM: number;
public P_PAGE_LIMIT: number;
}

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { VacationRuleServiceService } from './vacation-rule-service.service';
describe('VacationRuleServiceService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: VacationRuleServiceService = TestBed.get(VacationRuleServiceService);
expect(service).toBeTruthy();
});
});

@ -0,0 +1,35 @@
import { Response } from 'src/app/hmg-common/services/models/response';
import { VacationRuleRequest } from './../model/VacationRuleRequest';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
@Injectable({
providedIn: 'root'
})
export class VacationRuleServiceService {
/* Vacation Rule Methods */
public static getVacationRule = 'Services/ERP.svc/REST/GET_VACATION_RULES';
public static changePassword = 'Services/ERP.svc/REST/ChangePassword_FromActiveSession';
public static userChecking = 'Services/ERP.svc/REST/Get_BasicUserInformation';
public static getVacationType = 'Services/ERP.svc/REST/GET_VR_ITEM_TYPES';
public static getNotificationType = 'Services/ERP.svc/REST/GET_ITEM_TYPE_NOTIFICATIONS';
public static createVacationRule = 'Services/ERP.svc/REST/CREATE_VACATION_RULE';
public static deleteVacationRule = 'Services/ERP.svc/REST/DELETE_VACATION_RULE';
public static updateVacationRule = 'Services/ERP.svc/REST/UPDATE_VACATION_RULE';
public static respondAttributes = 'Services/ERP.svc/REST/GET_RESPOND_ATTRIBUTES';
public static notificationReassign = 'Services/ERP.svc/REST/GET_NOTIFICATION_REASSIGN_MODE';
constructor(public authService: AuthenticationService, public con: ConnectorService) { }
public getVacationRule(vacationRuleRequest: VacationRuleRequest, onError: any, errorLabel: string): Observable<Response> {
const request = vacationRuleRequest;
console.log(request);
this.authService.authenticateRequest(request);
return this.con.post(VacationRuleServiceService.getVacationRule, request, onError, errorLabel)
}
}

@ -0,0 +1,38 @@
import { HmgCommonModule } from './../hmg-common/hmg-common.module';
import { HomeComponent } from './home/home.component';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { VacationRulePage } from './vacation-rule.page';
const routes: Routes = [
{
path: '',
component: VacationRulePage,
children: [
{
path: 'home',
component: HomeComponent
}
]
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
HmgCommonModule,
RouterModule.forChild(routes)
],
declarations: [
VacationRulePage,
HomeComponent
]
})
export class VacationRulePageModule { }

@ -0,0 +1,9 @@
<!-- <ion-header>
<ion-toolbar>
<ion-title>VacationRule</ion-title>
</ion-toolbar>
</ion-header> -->
<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 { VacationRulePage } from './vacation-rule.page';
describe('VacationRulePage', () => {
let component: VacationRulePage;
let fixture: ComponentFixture<VacationRulePage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ VacationRulePage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(VacationRulePage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-vacation-rule',
templateUrl: './vacation-rule.page.html',
styleUrls: ['./vacation-rule.page.scss'],
})
export class VacationRulePage implements OnInit {
constructor() { }
ngOnInit() {
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save