Merge branch 'itg-new-design' into work-list

# Conflicts:
#	Mohem/src/app/notification/home/home.component.html
#	Mohem/src/app/notification/home/home.component.scss
#	Mohem/src/app/notification/home/home.component.ts
MOE_DEV_NEW_TEMPORARY_DESIGN
umasoodch 6 years ago
commit 8f83946c48

File diff suppressed because it is too large Load Diff

@ -38,7 +38,7 @@
"@ionic-native/file": "^5.18.0",
"@ionic-native/file-path": "^5.18.0",
"@ionic-native/fingerprint-aio": "^5.18.0",
"@ionic-native/firebase-x": "^5.19.1",
"@ionic-native/firebase-x": "^5.21.5",
"@ionic-native/geolocation": "^5.10.0",
"@ionic-native/globalization": "^5.18.0",
"@ionic-native/health": "^5.4.0",
@ -83,7 +83,7 @@
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-filepath": "^1.5.6",
"cordova-plugin-fingerprint-aio": "^3.0.0",
"cordova-plugin-firebasex": "^7.0.1",
"cordova-plugin-firebasex": "^7.0.2",
"cordova-plugin-geolocation": "^4.0.2",
"cordova-plugin-globalization": "^1.11.0",
"cordova-plugin-inappbrowser": "^3.1.0",
@ -201,4 +201,4 @@
"android"
]
}
}
}

@ -1172,6 +1172,9 @@ public getMonthNameAr(value: number): string {
public openWorklistMainMRPage() {
this.nav.navigateForward(['/notification/worklist-main-MR']);
}
public openWorklistITGPage() {
this.nav.navigateForward(['/notification/worklist-main-ITG']);
}
public openMySpecialistPage() {
this.nav.navigateForward(['/my-specialist/home']);
}

@ -6,6 +6,7 @@ import { HmgCommonModule } from '../hmg-common/hmg-common.module';
import { IonicModule } from '@ionic/angular';
import { HomePage } from './home.page';
import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx';
import { WorklistMainService } from '../notification/service/work-list.main.service';
const routes: Routes = [
{
@ -26,7 +27,8 @@ const routes: Routes = [
HomePage
],
providers: [
BarcodeScanner
BarcodeScanner,
WorklistMainService
]
})
export class HomePageModule { }

@ -33,6 +33,7 @@ import {GetOpenNotificationsResponse} from '../hmg-common/services/dashbored/mod
import {GetSubordinatesAttdStatusResponse} from '../hmg-common/services/dashbored/models/GetSubordinatesAttdStatusResponse'
import {GetSubordinatesLeavesResponse} from '../hmg-common/services/dashbored/models/GetSubordinatesLeavesResponse'
import { AccrualService } from '../accrual-balances/services/accrual.service';
import { WorklistMainService } from '../notification/service/work-list.main.service';
@Component({
selector: 'app-home',
@ -122,6 +123,7 @@ export class HomePage implements OnInit {
public displayTime: any;
public menuEntries: any;
public percent: any;
public countAllNotification: number =0;
constructor(
public ts: TranslatorService,
@ -143,7 +145,8 @@ export class HomePage implements OnInit {
private file: File,
private permissions: DevicePermissionsService,
public DS: DashboredService,
public accrualService: AccrualService
public accrualService: AccrualService,
public workListService: WorklistMainService,
) {
this.events.subscribe('img-change', displayImg => {
this.userImage = this.sanitizer.bypassSecurityTrustUrl('data:Image/*;base64,' + displayImg);
@ -525,12 +528,20 @@ export class HomePage implements OnInit {
this.DS.getOpenNotifications( () => { console.log('Error '); }).subscribe((result: GetOpenNotificationsResponse) => {
if (this.common.validResponse(result)) {
const key = 'P_OPEN_NTF_NUMBER';
this.statsButtons[0].statsValue = result[key];
this.countAllNotification = result[key];
this.ITGCountAllNotification();
this.common.sharedService.setSharedData(result, 'worklistNotifications');
}
});
}
ITGCountAllNotification(){
this.workListService.getITGDetails()
.subscribe((result: any) => {
this.statsButtons[0].statsValue = this.countAllNotification + result.TotalCount;
});
}
getSubordinatesLeaves() {
const request: GetSubordinatesLeavesRequest = new GetSubordinatesLeavesRequest();
request.P_DATE_FROM = '/Date(1578603600000+0300)/'; // test

@ -10,7 +10,7 @@
<ion-content>
<div class="contentBg">
<div class="result-graph">
<div class="result-graph">
<div class="request-heading">
<span>Open Request Analysis</span>
</div>
@ -48,7 +48,20 @@
<!-- <div class="total-result" *ngIf="isEmptyObject() && selectedFilter === 'ALL' && showSearchButton === false">
<span>showing {{newWorkListResponse.length}} of {{filters[0].value}}</span>
</div> -->
<div [ngClass]="isEmptyObject() ? 'work-list-container' : ''">
<ion-row *ngIf='selectedFilter === "ITG"'>
<ion-col>
<ion-slides>
<ion-slide class='slideCss' *ngFor="let segment of ITGSegment">
<span [ngClass]="segment.style? 'text-span-active': 'text-span'" (click)="setActive(segment.code)">
{{segment.name}}
</span>
</ion-slide>
</ion-slides>
</ion-col>
</ion-row>
<div [ngClass]="isEmptyObject() ? 'work-list-container' : ''" *ngIf='selectedFilter != "ITG"'>
<div *ngFor="let data of showFormattedData | keyvalue; let i = index">
<span class="date-span">{{data.key}}</span>
<div (click)="openNotificationDetail(data.value)" class="date-data" *ngFor="let workList of data.value; let j = index">
@ -56,6 +69,18 @@
</div>
</div>
</div>
<div [ngClass]="isEmptyObject() ? 'work-list-container' : ''" *ngIf="selectedFilter == 'ITG'" >
<div *ngFor='let segmentInfo of ITGItem[0]; let i= index' (click)='openITG(segmentInfo)'>
<span class="date-span">{{segmentInfo.ModifiedDate |date}}</span>
<div class="date-data">
<p>{{segmentInfo.Title}}</p>
</div>
</div>
</div>
<div class="no-data-available" *ngIf="!isEmptyObject()">
<span>No Data Available</span>
</div>

@ -396,3 +396,25 @@ ion-content {
color: #888;
font-size: 15px;
}
.text-span{
font-size: 14px;
color: #888;
background-color: white;
width: 93%;
height: 30px;
border: 1px solid;
border-radius: 15px;
}
.text-span-active{
font-size: 14px;
color: #888;
background-color:#22c6b3;
width: 93%;
height: 30px;
border: 1px solid;
border-radius: 15px;
}
.slideCss{
width: 200px !important;
}

@ -16,6 +16,9 @@ import { DatePipe } from '@angular/common';
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
public static REQUSET_NAME = 'requst_name';
public static REQUSET_INFO = 'requset_info';
public static ALL_REQUEST = 'all_request';
public static NOTIFICATION_DATA = 'notification_data';
public static NOTIFICATION_ARR = 'notification_arr';
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
@ -34,10 +37,22 @@ export class HomeComponent implements OnInit {
inputDate: string;
filteredNotificationList: any;
isReachEnd = false;
public isAll = true;
public isPR = false;
public isPO = false;
public isMR = false;
public isHR = false;
public noData = false;
public isITG = false;
public isSearch = false;
public direction = 'ltr';
public ITGCount: number = 0;
public ITGSegment:{name: string, code:any, data: any, style: boolean} [] =[];
public ITGAllItem: any = [];
public selectedITGToActive = false;
public ITGItem: any =[]
public activeSegment: any;
public currentActiveIndex = 0;
public previousActiveIndex = 0;
@ -141,9 +156,11 @@ export class HomeComponent implements OnInit {
ngOnInit() {
// this.direction = TranslatorService.getCurrentDirection();
this.worklistNotifications = this.common.sharedService.getSharedData('worklistNotifications', false);
this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER;
this.Details();
this.Count();
this.assignDataToFilters();
this.getAllPushNotificationFun();
this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER;
}
assignDataToFilters() {
@ -162,7 +179,10 @@ export class HomeComponent implements OnInit {
} else if (notification.ITEM_TYPE === 'INVMOA') {
this.filters[4].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[3] = notification.OPEN_NTF_NUMBER;
}
}else if (notification.ITEM_TYPE === 'ITG') {
this.filters[5].value = notification.OPEN_NTF_NUMBER;
this.data.datasets[0].data[4] = notification.OPEN_NTF_NUMBER;
}
}
}
@ -216,7 +236,6 @@ export class HomeComponent implements OnInit {
componentProps: {}
});
modal.onDidDismiss().then(result => {
console.log(result.data);
if (result.data) {
if (result.data.notificationType !== '' || result.data.selectedValue !== '' || result.data.itemType !== '') {
this.showSearchButton = true;
@ -322,7 +341,6 @@ export class HomeComponent implements OnInit {
}
openNotificationDetail(obj) {
console.log(obj);
this.common.sharedService.setSharedData(obj[0], HomeComponent.NOTIFICATION_DATA);
if (obj.REQUEST_TYPE === 'PR') {
this.common.openWorklistMainPRPage();
@ -336,7 +354,7 @@ export class HomeComponent implements OnInit {
}
isEmptyObject() {
return (this.showFormattedData && (Object.keys(this.showFormattedData).length > 0));
return (this.showFormattedData && (Object.keys(this.showFormattedData).length > 0) || this.ITGItem.length > 0);
}
resetData() {
@ -381,16 +399,54 @@ export class HomeComponent implements OnInit {
Count() {
this.workListService.getITGCount()
.subscribe((result: any) => {
console.log('ENAD ITG COUNT:');
console.log(result);
for(let i= 0; i< result.RequestType.length; i++){
this.ITGSegment[i] = {name: result.RequestType[i].RequestTypeName, code: result.RequestType[i].RequestTypeCode, data:result.RequestType[i].RequestDetails, style: false};
}
});
}
Details() {
this.workListService.getITGDetails()
.subscribe((result: any) => {
console.log('ENAD ITG Details:');
console.log(result);
this.totalRequestCount = this.totalRequestCount + result.TotalCount;
this.filters[5].value = result.TotalCount;
});
}
ITGNotification() {
// this.Details();
this.isAll = false;
this.isPR = false;
this.isPO = false;
this.isMR = false;
this.isHR = false;
this.isITG = true;
}
searchBtn() {
this.isSearch = !this.isSearch;
}
setActive(selectedSegment){
this.ITGItem =[];
let count=0;
this.activeSegment = selectedSegment;
for(let i =0; i< this.ITGSegment.length; i++){
if(this.ITGSegment[i].code === selectedSegment){
this.ITGSegment[i].style = true;
this.ITGItem[count] = this.ITGSegment[i].data;
count++;
}else{
this.ITGSegment[i].style = false;
}
}
}
openITG(segmentInfo){
this.common.sharedService.setSharedData(segmentInfo, HomeComponent.REQUSET_INFO);
this.common.sharedService.setSharedData(this.activeSegment, HomeComponent.REQUSET_NAME);
this.common.sharedService.setSharedData(this.ITGItem,HomeComponent.ALL_REQUEST);
this.common.openWorklistITGPage();
}
}

@ -0,0 +1,12 @@
import { Request } from 'src/app/hmg-common/services/models/request';
export class itgRequest extends Request {
public RequestType: string;
public ItemID: number;
public TaskID: number;
public EmployeeNumber: string;
public Comments: string;
public IsSubTask: boolean;
public NewUserEMPId: string;
public AdditionalFields?: [{}];
}

@ -26,9 +26,11 @@ import { ItemHistoryComponent } from './item-history/item-history.component';
import { QutationAnalysisComponent } from './qutation-analysis/qutation-analysis.component';
import { WorklistMainMRComponent } from './worklist-main-mr/worklist-main-mr.component';
import { WorklistAdvancedSearchComponent } from './worklist-advanced-search/worklist-advanced-search.component';
import { WorkListMainItgComponent } from './work-list-main-itg/work-list-main-itg.component';
// import { WorklistMainComponent } from './worklist-main/worklist-main.component';
import {MoreActionModalComponent} from './more-action-modal/more-action-modal.component'
import { WorkListReplacementItgComponent } from './work-list-replacement-itg/work-list-replacement-itg.component';
const routes: Routes = [
@ -98,13 +100,21 @@ const routes: Routes = [
component: QutationAnalysisComponent
},
{
path:'worklist-main-MR',
component:WorklistMainMRComponent
path: 'worklist-main-MR',
component: WorklistMainMRComponent
},
{
path: 'worklist-main-ITG',
component: WorkListMainItgComponent
},
{
path: 'more-action-modal',
component: MoreActionModalComponent
},
{
path: 'worklist-replacement-itg',
component: WorkListReplacementItgComponent
}
]
}
];
@ -136,7 +146,9 @@ const routes: Routes = [
ItemHistoryComponent,
QutationAnalysisComponent,
WorklistMainMRComponent,
WorklistAdvancedSearchComponent
WorklistAdvancedSearchComponent,
WorkListMainItgComponent,
WorkListReplacementItgComponent
// WorklistMainComponent
],
entryComponents: [

@ -19,6 +19,7 @@ import { MOItemHistoryRes } from "../models/MOItemHistoryRes";
import { QuotationAnalysisResponse } from '../models/quotationAnalysisRes';
import { Request } from 'src/app/hmg-common/services/models/request';
import { LoginModel } from '../../authentication/models/LoginModel';
import { itgRequest } from '../models/itgFormDetailsRequest';
@Injectable()
export class WorklistMainService {
@ -44,9 +45,11 @@ export class WorklistMainService {
public static getQutationAnalysisUrl =
"Services/ERP.svc/REST/GET_QUOTATION_ANALYSIS";
public static getITGFormTaskCount =
'http://10.80.100.124:7086/Services/COCWS.svc/REST/ITGGetTaskCountRequestType';
'Services/COCWS.svc/REST/ITGGetTaskCountRequestType';
public static getITGFormTaskDetails =
'http://10.80.100.124:7086/Services/COCWS.svc/REST/ITGFormsPendingTasks';
'Services/COCWS.svc/REST/ITGFormsPendingTasks';
public static getITGFormDetails =
'Services/COCWS.svc/REST/ITGGetFormDetials';
@ -241,7 +244,7 @@ export class WorklistMainService {
const request = new Request;
console.log(request)
this.authService.authenticateRequest(request);
return this.api.postToken(
return this.api.post(
WorklistMainService.getITGFormTaskCount,
request,
onError,
@ -249,12 +252,25 @@ export class WorklistMainService {
);
}
public getITGFormDetails(request:itgRequest, onError?: any, errorLabel?: string): Observable<any> {
this.authService.authenticateRequest(request);
request.EmployeeNumber = request.P_USER_NAME;
console.log(request);
return this.api.post(
WorklistMainService.getITGFormDetails,
request,
onError,
errorLabel
);
}
public getITGDetails( onError?: any, errorLabel?: string): Observable<any> {
const request = new Request;
console.log(request)
this.authService.authenticateRequest(request);
return this.api.postToken(
return this.api.post(
WorklistMainService.getITGFormTaskDetails,
request,
onError,
@ -262,4 +278,19 @@ export class WorklistMainService {
);
}
public getITGActionRequest(itgrequest:itgRequest,actionURL:string, onError?: any, errorLabel?: string): Observable<any> {
this.authService.authenticateRequest(itgrequest);
itgrequest.EmployeeNumber = itgrequest.P_USER_NAME;
console.log(itgrequest);
console.log(actionURL);
return this.api.post(
actionURL,
itgrequest,
onError,
errorLabel
);
}
}

@ -0,0 +1,151 @@
<ion-header>
<ion-toolbar class="header-toolbar">
<ion-title color="light"> {{ts.trPK('worklistMain','title')}}</ion-title>
<ion-buttons slot="start">
<nav-buttons backLink="/notification/homepage"></nav-buttons>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content class="colorBG">
<ion-segment [dir]="directionLTR" mode="md" color="secondary" (ionChange)="segmentChangedClick($event)"
[value]="defaultSegment" class="ion-segment-all">
<ion-segment-button value="{{segmentVal.name}}"
[ngClass]="activeSegment == segmentVal.name ? 'active-Segment' : 'normal-Segment'"
*ngFor="let segmentVal of segmentsArray">
{{segmentVal.name}}
</ion-segment-button>
</ion-segment>
<ion-card class="cardContent" *ngFor='let segmentContant of segmentData'>
<ion-card-content *ngIf='activeSegment === segmentContant.name'>
<ion-grid style="text-align: left" *ngFor='let dataContant of segmentContant.data'>
<ion-row>
<ion-col>
<label class="colItemReq"> {{dataContant.Title}}</label>
<br />
<label>{{dataContant.Value}}</label>
</ion-col>
</ion-row>
<ion-row *ngIf='dataContant.TableValue'>
<ion-col style="border: 1px solid gainsboro; border-radius: 15px; padding-left: 20px;">
<label class="colItemReq" *ngFor="let header of dataContant.TableValue.Header"><br /> {{header}}</label>
<br />
<label *ngFor="let rows of dataContant.TableValue.Rows"><br />{{rows}}</label>
<label *ngIf="dataContant.TableValue.Rows"><br />none</label>
</ion-col>
</ion-row>
</ion-grid>
</ion-card-content>
</ion-card>
<!-- if there is additional screen like in VIDA -->
<!-- <ng-container>
<ion-card class="cardContent" *ngFor='let segmentContant of segmentDataTable'>
<ion-card-content *ngIf='activeSegment === segmentContant.name'>
<ion-grid style="text-align: left" *ngFor='let dataContant of segmentContant.data'>
<ion-row *ngFor="let headerData of dataContant.Header">
<ion-col>
<label class="colItemReq"> {{headerData}}</label>
<br />
<label>{{headerData}}</label>
</ion-col>
</ion-row>
</ion-grid>
</ion-card-content>
</ion-card>
</ng-container> -->
<!-- END -->
<ion-card class="cardContent" *ngIf='activeSegment === "Approval Level"'>
<ion-card-content>
<ion-grid>
<ion-row>
<ion-col>
<ion-list class="notification-list" style="margin-left: -30px;" *ngFor="let approvalInfo of workList">
<div class="timeline">
<ion-item>
<div class="timeline-item" slot="start">
<div>
<button ion-button style=" background: none;width: 60%;">
<img src="../assets/imgs/noteSmall.png">
</button>
<div
[ngClass]="{'bg-blue-dot' : approvalInfo.Action === 'Submit', 'bg-green-dot':approvalInfo.Action === 'Approved', 'bg-red-dot':approvalInfo.Action === 'Rejected', 'bg-gray-dot':approvalInfo.Action === 'Pending', 'bg-gray-dot':approvalInfo.Action === ''}"
class="timeline-thumb timeline-icon">
</div>
<p style="margin-left: -20%; font-size: 12px !important;">{{approvalInfo.Action}}</p>
</div>
</div>
<p style="margin-left: 10%;">{{approvalInfo.Name}}</p>
</ion-item>
</div>
</ion-list>
</ion-col>
</ion-row>
</ion-grid>
</ion-card-content>
</ion-card>
<ion-card class="cardContent">
<ion-card-content>
<ion-grid>
<ion-row>
<ion-col>
<ion-label>
<h2 class="boldTxtNav">Comment</h2>
</ion-label>
<ion-input type='text' [(ngModel)]='commentText'></ion-input>
<ion-item *ngFor="let object of grantInfo">
<ion-label>{{object.Label}}</ion-label>
<ion-select *ngIf="!object.ConditionalFieldName" [(ngModel)]='ExchangeServerSelected'
(ionChange)="filterGrantDB(ExchangeServerSelected,object, object.FieldName)" id='{{object.FieldName}}'>
<ion-select-option value="{{value}}" *ngFor="let value of object.Value">
{{value}}</ion-select-option>
</ion-select>
<ion-select *ngIf="object.ConditionalFieldName" [(ngModel)]='ExchangeServerDBSelected'
(ionChange)="filterGrantDB(ExchangeServerDBSelected,object)" id='{{object.FieldName}}'>
<ion-select-option value="{{value}}" *ngFor="let value of filteredGrantFieldsConditionalValue">
{{value}}</ion-select-option>
</ion-select>
</ion-item>
</ion-col>
</ion-row>
</ion-grid>
</ion-card-content>
</ion-card>
</ion-content>
<ion-footer class="footerSearchBtn">
<ion-tabs>
<ion-tab-bar class="tabBar" slot="bottom">
<!-- <ion-tab-button *ngFor='let action of actionBTN' [hidden]="action.isAvailable" > -->
<ion-tab-button *ngFor='let action of actionBTN' [hidden]='!action.isAvailable'
(click)="selectAtion(action.name)">
<img [src]="action.image">
<ion-label style="font-size: 12px;">{{action.name}}</ion-label>
</ion-tab-button>
<ion-tab-button (click)="skip()">
<img src="../assets/imgs/action-skip.png">
<ion-label style="font-size: 12px;">Skip</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
</ion-footer>

@ -0,0 +1,13 @@
.timeline-thumb {
height: 30px !important;
left: 54px !important;
}
.timeline-icon{
width: 30px !important;
}
.timeline:before{
position: fixed !important;
}

@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { WorkListMainItgComponent } from './work-list-main-itg.component';
describe('WorkListMainItgComponent', () => {
let component: WorkListMainItgComponent;
let fixture: ComponentFixture<WorkListMainItgComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ WorkListMainItgComponent ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(WorkListMainItgComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,342 @@
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 { HomeComponent } from '../home/home.component';
import { WorklistMainService } from '../service/work-list.main.service';
import { itgRequest } from '../models/itgFormDetailsRequest';
import { ModalController } from '@ionic/angular';
import { WorkListReplacementRollComponent } from '../work-list-replacement-roll/work-list-replacement-roll.component';
import { WorkListReplacementItgComponent } from '../work-list-replacement-itg/work-list-replacement-itg.component';
@Component({
selector: 'app-work-list-main-itg',
templateUrl: './work-list-main-itg.component.html',
styleUrls: ['./work-list-main-itg.component.scss'],
})
export class WorkListMainItgComponent implements OnInit {
public static APPROVAL = "Services/COCWS.svc/REST/ITGApproveRequest"
public static REJECT = 'Services/COCWS.svc/REST/ITGRejectRequest'
public static DELEGATE = 'Services/COCWS.svc/REST/ITGDelegateRequest';
public static REQUEST_INFORMATION = 'Services/COCWS.svc/REST/ITGRequestInformation';
public static ANSWER = 'Services/COCWS.svc/REST/ITGAnswer';
public static GRANT = 'Services/COCWS.svc/REST/ITGGrantAccess';
public request_info: any;
public request_name: any;
public all_request: any;
public request = new itgRequest();
public activeSegment: any = "info";
public request_details: any;
public segmentsArray: { name: string, number: number }[] = [];
public segmentData: { name: string, data: any }[] = [];
public header: any = [];
public rows: any = [];
public workList: any;
public commentText: string;
public replcamentID: string;
public actionSelected: any;
public options: any;
public index: number = 0;
public grantDATA: any;
public grantInfo: any;
public grantFieldsConditionalValue: any = [];
public filteredGrantFieldsConditionalValue: any = [];
public grantFieldsLabel: any = [];
public grantFieldsValue: any = [];
public grantRequest: any = [];
public ExchangeServerSelected: any;
public ExchangeServerDBSelected: any;
public actionBTN: { name: string, image: string, isAvailable: boolean }[] = [];
constructor(
public common: CommonService,
public ts: TranslatorService,
public workListService: WorklistMainService,
public modalCtrl: ModalController) { }
ngOnInit() {
this.request_info = this.common.sharedService.getSharedData(HomeComponent.REQUSET_INFO);
this.request_name = this.common.sharedService.getSharedData(HomeComponent.REQUSET_NAME);
this.all_request = this.common.sharedService.getSharedData(HomeComponent.ALL_REQUEST);
this.all_request = this.all_request[0];
this.changeITGForm(this.request_info, this.request_name);
}
changeITGForm(data, requestName) {
this.request_info = data;
this.request_name = requestName;
this.request.RequestType = this.request_name;
this.request.ItemID = this.request_info.ItemID;
this.request.TaskID = this.request_info.ID;
this.request.Comments = this.request_info.Comments;
this.request.NewUserEMPId = this.request_info.NewUserEMPId;
this.workListService.getITGFormDetails(this.request).subscribe((result: any) => {
this.request_details = result.ITGRequest;
this.grantInfo = result.ITGRequest.GrantFields;
let count = 0;
for (let i = 0; i < result.ITGRequest.FieldGoups.length; i++) {
this.segmentsArray[i] = { name: result.ITGRequest.FieldGoups[i].Title, number: i };
this.segmentData[i] = { name: result.ITGRequest.FieldGoups[i].Title, data: result.ITGRequest.FieldGoups[i].Fields}
}
this.segmentsArray[this.segmentsArray.length] = { name: 'Approval Level', number: this.segmentsArray.length }
this.workList = this.request_details.WFHistory;
this.options = this.request_details.AllowedActions;
this.activeSegment = this.segmentsArray[0].name;
for (let i = 0; i < this.options.length; i++) {
this.imageURL(this.options[i].Action);
this.actionBTN[i] = { name: this.options[i].Action, image: this.imageURL(this.options[i].Action), isAvailable: this.options[i].IsAvailable }
}
if (this.grantInfo) {
let count = 0;
this.grantFieldsConditionalValue = [];
for (let i = 0; i < this.grantInfo.length; i++) {
if (this.grantInfo[i].Value) {
for (let j = 0; j < this.grantInfo[i].Value.length; j++) {
this.grantFieldsValue[j] = this.grantInfo[i].Value[j];
}
}
if (this.grantInfo[i].ConditionalValue) {
for (let j = 0; j < this.grantInfo[i].ConditionalValue.length; j++) {
this.grantFieldsConditionalValue[count] = this.grantInfo[i].ConditionalValue[j];
count++;
}
}
}
}
//result.ITGRequest.FieldGoups.Fields
});
}
imageURL(actionName) {
if (actionName == "Approve") {
return "../assets/imgs/action-approve.png"
}
if (actionName == "Reject") {
return "../assets/imgs/action-reject.png"
}
if (actionName == "RequestInformation") {
return "../assets/imgs/action-info.png"
}
if (actionName == "Grant") {
return "../assets/imgs/action-info.png"
}
if (actionName == "Delegate") {
return "../assets/imgs/action-info.png"
}
}
public segmentChangedClick(event: any) {
this.activeSegment = event.detail.value;
}
skip() {
for (let i = 0; i < this.all_request.length; i++) {
if (this.index < this.all_request.length) {
if (this.request_info.ID == this.all_request[i].ID) {
this.index = i + 1;
this.clearDataArray();
this.changeITGForm(this.all_request[i + 1], this.request_name);
break;
} else {
alert("not found")
break;
}
} else {
alert(" not found at all")
break;
}
}
}
clearDataArray() {
this.commentText = '';
this.actionSelected = '';
this.segmentsArray = [];
this.segmentData = [];
this.workList = [];
this.actionBTN = [];
}
actionService(action, comments?, grantRequests?) {
let url: string;
let request = new itgRequest();
request.RequestType = this.request_name;
request.ItemID = this.request_info.ItemID;
request.TaskID = this.request_info.ID;
request.Comments = this.commentText;
request.Comments = this.request_info.Comments;
request.EmployeeNumber = this.request_info.EmployeeNumber;
request.NewUserEMPId = this.replcamentID;
this.common.confirmAlertDialogAction(
() => {
if (action == 1) { //approved
url = WorkListMainItgComponent.APPROVAL;
this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => {
// this.common.openNotificationPage();
this.skip();
});
} else if (action == 2) {//reject
url = WorkListMainItgComponent.REJECT;
this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => {
// this.common.openNotificationPage();
this.skip();
});
} else if (action == 3) {//request more info
request.NewUserEMPId = this.replcamentID;
url = WorkListMainItgComponent.REQUEST_INFORMATION;
if (!comments) {
this.common.presentAlert(this.ts.trPK('worklist', 'empty-comment'));
} else {
this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => {
// this.common.openNotificationPage();
this.skip();
});
}
} else if (action == 4) {//delegate
request.NewUserEMPId = this.replcamentID;
url = WorkListMainItgComponent.DELEGATE;
this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => {
// this.common.openNotificationPage();
this.skip();
});
} else if (action == 5) { //answer
url = WorkListMainItgComponent.ANSWER;
if (!comments) {
this.common.presentAlert(this.ts.trPK('worklist', 'empty-comment'));
} else {
this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => {
// this.common.openNotificationPage();
this.skip();
});
}
} else if (action == 6) { //grant
url = WorkListMainItgComponent.GRANT;
if (!comments) {
this.common.presentAlert(this.ts.trPK('worklist', 'empty-comment'));
}
else {
if (this.grantRequest) {
request.AdditionalFields = this.grantRequest;
this.workListService.getITGActionRequest(request, url)
.subscribe((result: any) => {
// this.common.openNotificationPage();
this.skip();
});
} else {
this.common.presentAlert(this.ts.trPK('worklist', 'empty-comment'));
}
}
}
}, this.ts.trPK('general', 'ok'),
() => { this.actionSelected = '' }, this.ts.trPK('general', 'cancel'),
this.ts.trPK('vacation-rule', 'confirmation'),
this.confirmMsg(action));
}
confirmMsg(action) {
if (action === 1) {
return this.ts.trPK('worklist', 'approveMsg');
}
if (action === 2) {
return this.ts.trPK('worklist', 'rejectMsg');
}
if (action === 3) {
return this.ts.trPK('worklist', 'requestInformationMsg');
}
if (action === 4) {
return this.ts.trPK('worklist', 'delegateMsg');
}
if (action === 5) {
return this.ts.trPK('worklist', 'answerMsg');
}
if (action === 6) {
return this.ts.trPK('worklist', 'grantMsg');
}
}
selectAtion(actionSelected) {
this.actionSelected = actionSelected;
if (this.actionSelected == "Answer") {
this.actionService(5, this.commentText)
}
if (this.actionSelected == "Approve") {
this.actionService(1, this.commentText);
}
if (this.actionSelected == "Delegate") {
// this.actionService(4, this.commentText)
// this.common.openWorklistRollReplacement();
this.presentModal(4);
}
if (this.actionSelected === 'Doable') {
}
if (this.actionSelected === 'Grant') {
this.actionService(6, this.commentText, this.grantRequest);
}
if (this.actionSelected === 'NotDoable') {
}
if (this.actionSelected === 'Question') {
}
if (this.actionSelected === 'Reject') {
this.actionService(2, this.commentText);
}
if (this.actionSelected === 'RequestInformation') {
this.presentModal(3);
}
}
async presentModal(actionNumber) {
const modal = await this.modalCtrl.create({
component: WorkListReplacementItgComponent,
backdropDismiss: false,
});
modal.cssClass = 'replaceRoll-modal';
modal.onDidDismiss()
.then((data) => {
this.replcamentID = data.data.empData.USER_NAME;
if (actionNumber == 3) {
this.actionService(3, this.commentText);
} else if (actionNumber == 4) {
this.actionService(4);
}
});
return await modal.present();
}
filterGrantDB(valueSelected, object, selectedOption?) {
let count = 0;
this.filteredGrantFieldsConditionalValue = [];
this.grantRequest.push({ Key: object.FieldName, Value: valueSelected });
for (let i = 0; i < this.grantInfo.length; i++) {
if (selectedOption === this.grantInfo[i].ConditionalFieldName) {
for (let j = 0; j < this.grantFieldsConditionalValue.length; j++) {
if (valueSelected === this.grantFieldsConditionalValue[j].Key) {
this.filteredGrantFieldsConditionalValue[count] = this.grantInfo[i].ConditionalValue[j].Value[0];
count++;
}
}
}
}
}
}

@ -0,0 +1,60 @@
<ion-header>
<ion-toolbar class="header-toolbar">
<!-- <nav-buttons></nav-buttons> -->
<ion-title color="light">{{ 'vacation-rule, search-employee' | translate}}</ion-title>
<ion-buttons slot="primary">
<ion-button style="background: none !important;" (click)="closePage()">
<ion-icon slot="icon-only" name="close"></ion-icon>
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content padding>
<div style="padding: 0 10px;" [innerHTML]='"vacation-rule, replacement-employee-tip" | translate'></div>
<ion-item lines="none">
<ion-label class="boldTxtNav">{{'vacation-rule, search-by' | translate}}</ion-label>
<ion-select okText='{{"general, ok" | translate }}' cancelText='{{"general, cancel" | translate }}'
[(ngModel)]="searchKeySelect">
<ion-select-option value="1" selected="true">{{'vacation-rule, search-by-name' | translate}}</ion-select-option>
<ion-select-option value="2">{{'vacation-rule, search-by-username' | translate}}</ion-select-option>
<ion-select-option value="3">{{'vacation-rule, search-by-email' | translate}}</ion-select-option>
</ion-select>
</ion-item>
<ion-item lines='none'>
<ion-input [(ngModel)]="searchKey" placeholder="{{'vacation-rule, search-employee' | translate}}"></ion-input>
<ion-button style="width: 19%;" button-type="clear" (click)="SearchReplacementList()">
<ion-icon slot="icon-only" name="search"></ion-icon>
</ion-button>
</ion-item>
<!-- <ion-item>
<ion-list [(ngModel)]="selEmp" *ngIf="ReplacementList">
<ion-item *ngFor="let employee of ReplacementList;let i=index;">
<ion-label><span class="boldTxt">{{employee.EMPLOYEE_DISPLAY_NAME}}</span> <br>{{employee.USER_NAME}}<br>
{{employee.EMAIL_ADDRESS}}</ion-label>
<ion-radio value="{{i}}"></ion-radio>
</ion-item>
</ion-list>
</ion-item> -->
<ion-list>
<ion-radio-group mode="md" [(ngModel)]="selEmp" *ngIf="ReplacementList">
<ion-item *ngFor="let employee of ReplacementList;let i=index;">
<ion-label><span class="boldTxt">{{employee.EMPLOYEE_DISPLAY_NAME}}</span> <br>{{employee.USER_NAME}}<br>
{{employee.EMAIL_ADDRESS}}</ion-label>
<ion-radio value="{{i}}"></ion-radio>
</ion-item>
</ion-radio-group>
</ion-list>
</ion-content>
<ion-footer>
<div class="centerDiv">
<ion-button (click)="closePage()" class="footer-button" color="customnavy">{{'general, save' | translate}}
</ion-button>
</div>
</ion-footer>

@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { WorkListReplacementItgComponent } from './work-list-replacement-itg.component';
describe('WorkListReplacementItgComponent', () => {
let component: WorkListReplacementItgComponent;
let fixture: ComponentFixture<WorkListReplacementItgComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ WorkListReplacementItgComponent ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(WorkListReplacementItgComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,131 @@
import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { ReplacementServiceRequest } from 'src/app/vacation-rule/model/replacement-Service.request';
import { VacationRuleServiceService } from 'src/app/vacation-rule/service/vacation-rule-service.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
@Component({
selector: 'app-work-list-replacement-itg',
templateUrl: './work-list-replacement-itg.component.html',
styleUrls: ['./work-list-replacement-itg.component.scss'],
})
export class WorkListReplacementItgComponent implements OnInit {
P_SEARCH_USER_NAME: string = "";
P_SEARCH_EMPLOYEE_DISPLAY_NAME: string = "";
P_SEARCH_EMAIL_ADDRESS: string = "";
P_PAGE_NUM: number = 1;
P_PAGE_LIMIT: number = 50;
ReplacementList: any = [];
IsReachEnd: boolean = false;
selEmp: string = null;
callback: any;
searchKey: any = "";
searchKeySelect: string = "";
replacmentRequest: any = "";
isAbs: boolean = false;
isSave: boolean = false;
constructor(public vacationRuleService: VacationRuleServiceService,
public ts: TranslatorService,
public cs: CommonService,
public modalController: ModalController) { }
ngOnInit() {}
SearchReplacementList() {
this.ReplacementList = [];
this.IsReachEnd = false;
this.P_PAGE_NUM = 1;
if (this.searchKey) {
switch (this.searchKeySelect) {
case '1': {
this.P_SEARCH_EMPLOYEE_DISPLAY_NAME = this.searchKey;
this.P_SEARCH_USER_NAME = "";
this.P_SEARCH_EMAIL_ADDRESS = "";
break;
}
case '2': {
this.P_SEARCH_USER_NAME = this.searchKey;
this.P_SEARCH_EMPLOYEE_DISPLAY_NAME = "";
this.P_SEARCH_EMAIL_ADDRESS = "";
break;
}
case '3': {
this.P_SEARCH_EMAIL_ADDRESS = this.searchKey;
this.P_SEARCH_USER_NAME = "";
this.P_SEARCH_EMPLOYEE_DISPLAY_NAME = "";
break;
}
default: {
this.P_SEARCH_USER_NAME = "";
this.P_SEARCH_EMPLOYEE_DISPLAY_NAME = "";
this.P_SEARCH_EMAIL_ADDRESS = "";
break;
}
}
} else {
this.P_SEARCH_USER_NAME = "";
this.P_SEARCH_EMPLOYEE_DISPLAY_NAME = "";
this.P_SEARCH_EMAIL_ADDRESS = "";
}
const request = new ReplacementServiceRequest();
request.P_SEARCH_USER_NAME = this.P_SEARCH_USER_NAME;
request.P_SEARCH_EMPLOYEE_DISPLAY_NAME = this.P_SEARCH_EMPLOYEE_DISPLAY_NAME;
request.P_SEARCH_EMAIL_ADDRESS = this.P_SEARCH_EMAIL_ADDRESS;
request.P_PAGE_NUM = this.P_PAGE_NUM;
request.P_PAGE_LIMIT = this.P_PAGE_LIMIT;
request.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp;
this.vacationRuleService.getReplacementList(request).
subscribe((result: any) => {
this.handleReplacment(result);
});
}
handleReplacment(result) {
if (this.cs.validResponse(result)) {
if (this.cs.hasData(result.ReplacementList)) {
this.ReplacementList = result.ReplacementList;
this.P_PAGE_NUM++;
let lastItemIndex = this.ReplacementList.length - 1;
if (result.ReplacementList[lastItemIndex]) {
let lastitem = result.ReplacementList[lastItemIndex];
if (lastitem.NO_OF_ROWS == lastitem.ROW_NUM) {
this.IsReachEnd = true;
} else {
this.IsReachEnd = false;
}
}
}
}
}
doInfinite(infiniteScroll) {
}
closePage() {
this.isSave = true;
let data: any = null;
if (this.isSave == true) {
if (this.selEmp) {
data = this.ReplacementList[this.selEmp];
} else {
data = null;
}
if (typeof this.callback == 'function') {
this.callback(data);
}
this.modalController.dismiss({
'dismissed': true,
empData: data
});
}
}
}

@ -7,7 +7,7 @@
<ion-content >
<ion-list syle="margin-bottom:2px !important" [hidden]="isAnswer==true">
<ion-list style="margin-bottom:2px !important" [hidden]="isAnswer==true">
<ion-item>
<ion-label class="boldTxtNav">{{'replacementRoll, searchBy' | translate}}</ion-label>
<ion-select okText='{{"general, ok" | translate }}' cancelText='{{"general, cancel" | translate }}'

@ -1678,6 +1678,34 @@
"note": {
"en":"Note",
"ar":"مذكرة"
},
"approveMsg":{
"en":"are you sure that you want to approve this request?",
"ar":"هل انت متاكد من قبول هذا الطلب؟"
},
"rejectMsg":{
"en":"are you sure that you want to reject this request?",
"ar":"هل انت متاكد من رفض هذا الطلب؟"
},
"delegateMsg":{
"en":"are you sure that you want to delegate this request?",
"ar":"هل انت متاكد من تحويل هذا الطلب؟"
},
"requestInformationMsg":{
"en":"are you sure that you want to more information for this request?",
"ar":"هل انت متاكد من طلب مزيد من المعلومات لهذا الطلب؟"
},
"grantMsg":{
"en":"are you sure that you want to grant access for this request?",
"ar":"هل انت متاكد من انشاء صلاحيه لهذا الطلب؟"
},
"answerMsg":{
"en":"press on ok to continue",
"ar":"اضغط على موافق للاستمرار"
},
"empty-comment":{
"en":"you shoud add comment",
"ar":"يجب عليك اضافة تعليق"
}
},
"worklistMain": {

@ -64,10 +64,6 @@ margin-left: 10px !important;
white-space: normal;
overflow: hidden;
box-sizing: border-box;
}
.colItemReqHeader{

Loading…
Cancel
Save