From 1f5090668421d3a7d0eb761149607648c53966fe Mon Sep 17 00:00:00 2001 From: enadhilal Date: Sun, 23 Feb 2020 15:51:35 +0300 Subject: [PATCH] make segment active when first open & fixing skip function --- Mohem/src/app/notification/home/home.component.ts | 1 + .../work-list-main-itg.component.ts | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Mohem/src/app/notification/home/home.component.ts b/Mohem/src/app/notification/home/home.component.ts index 0947abe6..7b9e3d72 100644 --- a/Mohem/src/app/notification/home/home.component.ts +++ b/Mohem/src/app/notification/home/home.component.ts @@ -406,6 +406,7 @@ export class HomeComponent implements OnInit { style: false }; } + this.setActive(this.ITGSegment[0].code); }); } diff --git a/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts b/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts index 2d1f4a92..96518745 100644 --- a/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts +++ b/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts @@ -134,19 +134,19 @@ export class WorkListMainItgComponent implements OnInit { } 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; + 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[i + 1], this.request_name); + this.changeITGForm(this.all_request[this.index], this.request_name); break; } else { - alert("not found") + this.common.openNotificationPage(); break; } } else { - alert(" not found at all") + this.common.openNotificationPage(); break; } }