Merge branch 'work-list' of https://hmg.git.cloudforge.com/mohemmionic5 into work-list

arabic-version
Mohamed Mekawy 6 years ago
commit 90704cb93a

@ -54,7 +54,7 @@
<span>showing {{newWorkListResponse.length}} of {{filters[0].value}}</span>
</div> -->
<ion-row *ngIf='selectedFilter === "ITG"'>
<ion-row *ngIf='selectedFilter === "ITG"' class="filters-row">
<ion-col>
<ion-slides>
<ion-slide class='slideCss' *ngFor="let segment of ITGSegment">
@ -78,21 +78,31 @@
</div>
<div [ngClass]="showFormattedData.length > 0 ? 'work-list-container' : ''" *ngIf="selectedFilter == 'ITG'" >
<div *ngFor='let segmentInfo of ITGItem[0]; let i= index' (click)='openITG(segmentInfo)'>
<!-- <div *ngFor='let segmentInfo of ITGItem[0]; let i= index' (click)='openITG(segmentInfo)'> -->
<div *ngFor='let segmentInfo of ITGItem[0]; let i= index' >
<div *ngIf="activeSegment !== 'All'" (click)='openITG(segmentInfo)'>
<span class="date-span">{{segmentInfo.ModifiedDate |date}}</span>
<div class="date-data">
<p>{{segmentInfo.Title}}</p>
</div>
</div>
<div *ngIf="activeSegment == 'All'" >
<div *ngFor="let data of segmentInfo" (click)="openITGAll(data.ID, data.ItemID)">
<span class="date-span">{{data.ModifiedDate | date}}</span>
<div class="date-data">
<p>{{data.Title}}</p>
</div>
</div>
</div>
</div>
</div>
<div class="no-data-available" *ngIf="showFormattedData.length === 0">
<span>No Data Available</span>
</div>
</div>
<!-- </div> -->
<ion-infinite-scroll (ionInfinite)="doInfinite($event)" *ngIf="selectedFilter === 'ALL' || itemType !== ''">

@ -23,6 +23,8 @@ export class HomeComponent implements OnInit {
public static ALL_REQUEST = 'all_request';
public static NOTIFICATION_DATA = 'notification_data';
public static NOTIFICATION_ARR = 'notification_arr';
public static NAMES_ALL_iTEMS = 'names-all-items';
public static IS_ALL_NAME = 'is_all_names';
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
private WorkListObj: WorkListRequest;
WorkListResObj: any;
@ -49,10 +51,11 @@ export class HomeComponent implements OnInit {
public isSearch = false;
public direction = 'ltr';
public ITGCount = 0;
public ITGSegment: {name: string, code: any, data: any, style: boolean} [] = [];
public ITGSegment: { name: string, code: any, data: any, style: boolean, names?: any }[] = [];
public ITGAllItem: any = [];
public selectedITGToActive = false;
public ITGItem: any = [];
public ITGAllItems: any = [];
public activeSegment: any;
public currentActiveIndex = 0;
@ -79,17 +82,17 @@ export class HomeComponent implements OnInit {
};
public data = {
datasets: [
{
data: [0, 0, 0, 0, 0],
backgroundColor: [
'#18a169',
'#38c9b3',
'#114475',
'#3cb9d5',
'#cc3232'
],
borderWidth: 5
}]
{
data: [0, 0, 0, 0, 0],
backgroundColor: [
'#18a169',
'#38c9b3',
'#114475',
'#3cb9d5',
'#cc3232'
],
borderWidth: 5
}]
};
public filters = [
{
@ -164,15 +167,10 @@ export class HomeComponent implements OnInit {
this.WorkListObj.P_PAGE_LIMIT = 50;
}
ionViewDidEnter() {
console.log("ionViewDidEnter");
// this.direction = TranslatorService.getCurrentDirection();
this.worklistNotifications = this.common.sharedService.getSharedData('worklistNotifications', false);
console.log('ionViewDidEnter');
// this.direction = TranslatorService.getCurrentDirection();
this.worklistNotifications = this.common.sharedService.getSharedData('worklistNotifications', false);
}
ngOnInit() {
this.openNotificationsDashboard();
@ -241,15 +239,15 @@ export class HomeComponent implements OnInit {
disableFilters() {
for (const filter of this.filters) {
if (filter.key === this.itemType) {
filter.disable = false;
filter.active = true;
this.selectedFilter = filter.name;
filter.disable = false;
filter.active = true;
this.selectedFilter = filter.name;
} else if (this.itemType === '') {
filter.disable = false;
filter.active = false;
} else {
filter.disable = true;
filter.active = false;
filter.disable = true;
filter.active = false;
}
}
if (this.itemType === '') {
@ -468,54 +466,66 @@ export class HomeComponent implements OnInit {
}
doInfinite(infiniteScroll) {
if (!this.isReachEnd && this.selectedFilter !== 'ITG') {
this.WorklistService.getWorkList(this.WorkListObj).subscribe((result) => {
if (this.common.validResponse(result)) {
this.handleWorkListResult(result.GetWorkList);
}
});
} else {
if (this.infiniteScroll) {
this.infiniteScroll.complete();
if (!this.isReachEnd && this.selectedFilter !== 'ITG') {
this.WorklistService.getWorkList(this.WorkListObj).subscribe((result) => {
if (this.common.validResponse(result)) {
this.handleWorkListResult(result.GetWorkList);
}
});
} else {
if (this.infiniteScroll) {
this.infiniteScroll.complete();
}
}
}
Count() {
this.workListService.getITGCount()
.subscribe((result: any) => {
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
};
}
this.setActive(this.ITGSegment[0].code);
});
const datas = [];
const names = [];
this.ITGSegment[0] = {
name: 'All',
code: 'All',
data: null,
style: false
};
this.workListService.getITGCount()
.subscribe((result: any) => {
for (let i = 1; 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
};
datas[i] = result.RequestType[i].RequestDetails;
names[i] = result.RequestType[i].RequestTypeCode;
}
this.ITGSegment[0].data = datas;
this.ITGSegment[0].names = names;
this.setActive(this.ITGSegment[0].code);
});
}
Details() {
this.workListService.getITGDetails()
.subscribe((result: any) => {
this.ITGCount = result.TotalCount;
this.totalRequestCount = this.totalRequestCount + result.TotalCount;
this.filters[5].value = result.TotalCount;
});
this.workListService.getITGDetails()
.subscribe((result: any) => {
this.totalRequestCount = this.totalRequestCount + result.TotalCount;
this.filters[5].value = result.TotalCount;
});
}
ITGNotification() {
this.isAll = false;
this.isPR = false;
this.isPO = false;
this.isMR = false;
this.isHR = false;
this.isITG = true;
// 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;
this.isSearch = !this.isSearch;
}
setActive(selectedSegment) {
@ -532,13 +542,38 @@ export class HomeComponent implements OnInit {
this.ITGSegment[i].style = false;
}
}
console.log(this.ITGSegment);
}
openITG(segmentInfo) {
openITG(segmentInfo, name?) {
if (name) {
this.common.sharedService.setSharedData(name, HomeComponent.REQUSET_NAME);
this.common.sharedService.setSharedData(this.ITGSegment, HomeComponent.NAMES_ALL_iTEMS);
this.common.sharedService.setSharedData(true, HomeComponent.IS_ALL_NAME);
} else {
this.common.sharedService.setSharedData(this.activeSegment, HomeComponent.REQUSET_NAME);
this.common.sharedService.setSharedData(false, HomeComponent.IS_ALL_NAME);
}
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();
}
openITGAll(id, item) {
let count = 0;
let ITEM: any;
let NAME: any;
for (let i = 1; i < this.ITGSegment.length; i++) {
// tslint:disable-next-line: prefer-for-of
for (let j = 0; j < this.ITGSegment[i].data.length; j++) {
if (this.ITGSegment[i].data[j].ID === id && this.ITGSegment[i].data[j].ItemID === item) {
ITEM = this.ITGSegment[i].data[j];
NAME = this.ITGSegment[i].code;
count++;
}
}
}
this.openITG(ITEM, NAME);
}
}

@ -26,6 +26,8 @@ export class WorkListMainItgComponent implements OnInit {
public request_info: any;
public request_name: any;
public all_request: any;
public all_request_names: any;
public is_all_items_sents: any;
public request = new itgRequest();
public activeSegment: any = "info";
public request_details: any;
@ -49,6 +51,7 @@ export class WorkListMainItgComponent implements OnInit {
public ExchangeServerSelected: any;
public ExchangeServerDBSelected: any;
public actionBTN: { name: string, image: string, isAvailable: boolean }[] = [];
index2: number;
constructor(
public common: CommonService,
public ts: TranslatorService,
@ -59,6 +62,8 @@ export class WorkListMainItgComponent implements OnInit {
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_names = this.common.sharedService.getSharedData(HomeComponent.NAMES_ALL_iTEMS);
this.is_all_items_sents = this.common.sharedService.getSharedData(HomeComponent.IS_ALL_NAME);
this.all_request = this.all_request[0];
this.changeITGForm(this.request_info, this.request_name);
}
@ -76,10 +81,9 @@ export class WorkListMainItgComponent implements OnInit {
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.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;
@ -87,7 +91,9 @@ export class WorkListMainItgComponent implements OnInit {
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 }
this.actionBTN[i] = {
name: this.options[i].Action, image: this.imageURL(this.options[i].Action), isAvailable: this.options[i].IsAvailable
};
}
if (this.grantInfo) {
@ -134,20 +140,44 @@ export class WorkListMainItgComponent implements OnInit {
}
skip() {
for (let i = 0; i < this.all_request.length; i++) { // search for the request that clicked on all request
if (this.request_info.ID == this.all_request[i].ID) { // check if the ID for the request is found.
this.index = i + 1;
if (this.index !== this.all_request.length) { // check if its last one to redirecte to home otherwise to next request.
this.clearDataArray();
this.changeITGForm(this.all_request[this.index], this.request_name);
break;
if (this.is_all_items_sents) {
for (let i = 1; i < this.all_request_names.length; i++) {
for (let j = 0; j < this.all_request_names[i].data.length; j++) {
if (this.request_info.ID === this.all_request_names[i].data[j].ID
&& this.request_info.ItemID === this.all_request_names[i].data[j].ItemID) {
this.index2 = j + 1;
this.index = i + 1;
if (this.all_request_names[i].data.length !== this.index2) {// if there is another request with same type
this.clearDataArray();
this.changeITGForm(this.all_request_names[i].data[this.index2], this.all_request_names[i].code);
return false;
} else if (this.index !== this.all_request_names.length) { // if there is another deffernet type.
this.clearDataArray();
this.changeITGForm(this.all_request_names[this.index].data[j], this.all_request_names[this.index].code);
return false;
}
} else if (this.index === this.all_request_names.length) { //if its the end request redirecte to worklist home
this.common.openNotificationPage();
return false;
}
}
}
} else {
for (let i = 0; i < this.all_request.length; i++) { // search for the request that clicked on all request
if (this.request_info.ID == this.all_request[i].ID) { // check if the ID for the request is found.
this.index = i + 1;
if (this.index !== this.all_request.length) { // check if its last one to redirecte to home otherwise to next request.
this.clearDataArray();
this.changeITGForm(this.all_request[this.index], this.request_name);
break
} else {
this.common.openNotificationPage();
break
}
} else {
this.common.openNotificationPage();
break;
break
}
} else {
this.common.openNotificationPage();
break;
}
}
}

Loading…
Cancel
Save