diff --git a/Mohem/src/app/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts index 2e4030e2..677f6a8e 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -78,6 +78,15 @@ export class CommonService { 'نوفمبر', 'ديسمبر' ]; + public filterKeys = { + 'HRSSA': 0, + 'INVMOA': 0, + 'REQAPPRV': 0, + 'POAPPRV': 0, + 'INVITEM': 0, + "STAMP": 0, + 'ITG': 0 + } private progressLoaders: any[] = []; private loadingProgress: any; @@ -1571,7 +1580,7 @@ export class CommonService { public totalCounter = 0; getTotalNumberOfWorklistRequest() { - this.totalCounter = parseInt(this.sharedService.getSharedData('total-count')); + this.totalCounter = parseInt(this.sharedService.getSharedData('total-count', false)); return this.totalCounter; } setTotalNumberOfWorklistRequest() { @@ -1579,6 +1588,14 @@ export class CommonService { this.sharedService.setSharedData(this.totalCounter, 'total-count'); } + public setFilterValues(data) { + for (const notification of data) { + + this.filterKeys[notification.ITEM_TYPE] = notification.OPEN_NTF_NUMBER + } + } + + public filters = [ { value: 0, @@ -1586,7 +1603,8 @@ export class CommonService { active: false, color: '#18a169', key: 'HRSSA', - disable: false + disable: false, + total: 0 }, { value: 0, @@ -1594,7 +1612,8 @@ export class CommonService { active: false, color: '#3cb9d5', key: 'INVMOA', - disable: false + disable: false, + total: 0 }, { value: 0, @@ -1602,7 +1621,8 @@ export class CommonService { active: false, color: '#114475', key: 'REQAPPRV', - disable: false + disable: false, + total: 0 }, { value: 0, @@ -1610,7 +1630,8 @@ export class CommonService { active: false, color: '#38c9b3', key: 'POAPPRV', - disable: false + disable: false, + total: 0 }, { value: 0, @@ -1618,7 +1639,8 @@ export class CommonService { active: false, color: '#cc3232', key: 'ITG', - disable: false + disable: false, + total: 0 }, { value: 0, @@ -1626,7 +1648,8 @@ export class CommonService { active: false, color: '#9e7e97', key: 'INVITEM', - disable: false + disable: false, + total: 0 }, { value: 0, @@ -1634,8 +1657,10 @@ export class CommonService { active: false, color: '#ff9800', key: 'STAMP', - disable: false - } + disable: false, + total: 0, + }, + ]; public data = { @@ -1655,31 +1680,29 @@ export class CommonService { }] }; - assignDataToFilters(result) { - const openNotificationsArray = result; - - for (const notification of openNotificationsArray) { - if (notification.ITEM_TYPE === 'HRSSA') { - this.filters[0].value = notification.OPEN_NTF_NUMBER; - this.data.datasets[0].data[0] = notification.OPEN_NTF_NUMBER; - } else if (notification.ITEM_TYPE === 'INVMOA') { - this.filters[1].value = notification.OPEN_NTF_NUMBER; - this.data.datasets[0].data[1] = notification.OPEN_NTF_NUMBER; - } else if (notification.ITEM_TYPE === 'REQAPPRV') { - this.filters[2].value = notification.OPEN_NTF_NUMBER; - this.data.datasets[0].data[2] = notification.OPEN_NTF_NUMBER; - } else if (notification.ITEM_TYPE === 'POAPPRV') { - this.filters[3].value = notification.OPEN_NTF_NUMBER; - this.data.datasets[0].data[3] = notification.OPEN_NTF_NUMBER; - } else if (notification.ITEM_TYPE === 'INVITEM') { - this.filters[5].value = notification.OPEN_NTF_NUMBER; - this.data.datasets[0].data[5] = notification.OPEN_NTF_NUMBER; - } else if (notification.ITEM_TYPE === 'STAMP') { - this.filters[6].value = notification.OPEN_NTF_NUMBER; - this.data.datasets[0].data[6] = notification.OPEN_NTF_NUMBER; - } - } - let val = {'filters': [], 'data': {}}; + getFiltersData() { + // for (const notification of openNotificationsArray) { + // if (notification.ITEM_TYPE === 'HRSSA') { + this.filters[0].value = this.filterKeys['HRSSA']; + this.data.datasets[0].data[0] = this.filterKeys['HRSSA']; + // } else if (notification.ITEM_TYPE === 'INVMOA') { + this.filters[1].value = this.filterKeys['INVMOA']; + this.data.datasets[0].data[1] = this.filterKeys['INVMOA']; + // } else if (notification.ITEM_TYPE === 'REQAPPRV') { + this.filters[2].value = this.filterKeys['REQAPPRV']; + this.data.datasets[0].data[2] = this.filterKeys['REQAPPRV']; + // } else if (notification.ITEM_TYPE === 'POAPPRV') { + this.filters[3].value = this.filterKeys['POAPPRV']; + this.data.datasets[0].data[3] = this.filterKeys['POAPPRV']; + // } else if (notification.ITEM_TYPE === 'INVITEM') { + this.filters[5].value = this.filterKeys['INVITEM']; + this.data.datasets[0].data[5] = this.filterKeys['INVITEM']; + // } else if (notification.ITEM_TYPE === 'STAMP') { + this.filters[6].value = this.filterKeys['STAMP']; + this.data.datasets[0].data[6] = this.filterKeys['STAMP']; + + + let val = { 'filters': [], 'data': {} }; val.filters = this.filters; val.data = this.data; return val; diff --git a/Mohem/src/app/hmg-common/services/menu/models/menu-response.ts b/Mohem/src/app/hmg-common/services/menu/models/menu-response.ts index 07db1f07..0a7cd754 100644 --- a/Mohem/src/app/hmg-common/services/menu/models/menu-response.ts +++ b/Mohem/src/app/hmg-common/services/menu/models/menu-response.ts @@ -6,6 +6,7 @@ export class MenuResponse { public static SELECTED_MENU = 'selected_menu'; public static SHARED_SEL_EMP = 'sel_empolyee'; public static SHARED_SEL_RESP_ID = 'sel_resp_id'; + public static ITG_COUNTS = 'itg-counts'; public userid: string; public search: boolean; public List_Menu: ListMenu; diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index 1828171a..098458d0 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -369,7 +369,12 @@ export class HomePage implements OnInit { callDashboardServices() { this.getMenu(); this.setServicesPrivilage(); - this.openNotificationsDashbored(); + if (this.common.getTotalNumberOfWorklistRequest()) { + this.statsButtons[1].statsValue = this.common.getTotalNumberOfWorklistRequest(); + } else { + this.openNotificationsDashbored(); + } + this.showOpenMissingSwipes(); this.showAttendanceTracking(); var accrualBalance = this.common.sharedService.getSharedData('leaveAccrualBalance', false); @@ -660,12 +665,15 @@ export class HomePage implements OnInit { result, 'worklistNotifications' ); + this.common.setFilterValues(result['GetOpenNotificationsList']); } }); } ITGCountAllNotification() { this.workListService.getITGDetails('', '', this.isPostNoLoad).subscribe((result: any) => { + this.common.sharedService.setSharedData(result, MenuResponse.ITG_COUNTS); + this.common.filterKeys['ITG'] = result.TotalCount; this.statsButtons[1].statsValue = Math.floor(this.countAllNotification + result.TotalCount); this.common.stopLoading(); diff --git a/Mohem/src/app/notification/home/home.component.ts b/Mohem/src/app/notification/home/home.component.ts index 24e820ef..4b900361 100644 --- a/Mohem/src/app/notification/home/home.component.ts +++ b/Mohem/src/app/notification/home/home.component.ts @@ -11,6 +11,7 @@ import { WorklistAdvancedSearchComponent } from '../worklist-advanced-search/wor import { DatePipe } from '@angular/common'; import { GetOpenNotificationsResponse } from 'src/app/hmg-common/services/dashbored/models/GetOpenNotificationsResponse'; import { DashboredService } from 'src/app/hmg-common/services/dashbored/dashbored.service'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; @Component({ selector: 'app-home', @@ -22,6 +23,7 @@ export class HomeComponent implements OnInit { public static REQUSET_INFO = 'requset_info'; public static ALL_REQUEST = 'all_request'; public static NOTIFICATION_DATA = 'notification_data'; + public static COUNT_CHANGED = 'count_changed'; public static NOTIFICATION_ARR = 'notification_arr'; public static NAMES_ALL_iTEMS = 'names-all-items'; public static IS_ALL_NAME = 'is_all_names'; @@ -70,7 +72,7 @@ export class HomeComponent implements OnInit { public showSearchButton = false; public itemType = 'HRSSA'; public receivedITGCount = false; - + public countChanged: any = false; public totalHR = 0; public totalPO = 0; public totalPR = 0; @@ -195,16 +197,14 @@ export class HomeComponent implements OnInit { this.isLoading = true; } - + ionViewWillEnter() { this.totalRequestCount = this.common.getTotalNumberOfWorklistRequest(); - const values = this.common.assignDataToFilters(this.common.sharedService.getSharedData('worklistNotifications', false)); + const values = this.common.getFiltersData(); this.data = values.data; this.filters = values.filters; - console.log(this.filters); - console.log(this.data); - console.log(this.totalRequestCount); + const loadWorkList = this.common.sharedService.getSharedData('loadWorkList', false); if (loadWorkList) { this.receivedITGCount = false; @@ -229,22 +229,34 @@ export class HomeComponent implements OnInit { } callWorkListServices() { + // if (this.countChanged) { this.Count(); + // } this.getAllPushNotificationFun(); } openNotificationsDashboard() { - this.DS.getOpenNotifications('', '', this.isPostNoLoad).subscribe((result: GetOpenNotificationsResponse) => { - if (this.common.validResponse(result)) { - this.worklistNotifications = result; - this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER; - this.resetFiltersUI(); - this.assignDataToFilters(); - this.common.sharedService.setSharedData(result, 'worklistNotifications'); - this.Details(); - this.callWorkListServices(); - } - }); + // if (this.countChanged) { + + // this.DS.getOpenNotifications('', '', this.isPostNoLoad).subscribe((result: GetOpenNotificationsResponse) => { + // if (this.common.validResponse(result)) { + // this.countChanged = false; + // this.worklistNotifications = result; + // this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER; + //this.resetFiltersUI(); + // this.assignDataToFilters(); + // this.common.sharedService.setSharedData(result, 'worklistNotifications'); + this.Details(); + this.callWorkListServices(); + // } + // }); + // } else { + // this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER; + // this.resetFiltersUI(); + // this.assignDataToFilters(); + // this.Details(); + // this.callWorkListServices(); + // } } assignDataToFilters() { @@ -308,7 +320,7 @@ export class HomeComponent implements OnInit { } else { this.common.stopLoading(); } - + } activeFilter(index: number) { @@ -335,7 +347,7 @@ export class HomeComponent implements OnInit { configureFilters() { for (const filter of this.filters) { if (filter.key === this.itemType) { - const index = this.filters.map(function(e) { return e.key; }).indexOf(this.itemType); + const index = this.filters.map(function (e) { return e.key; }).indexOf(this.itemType); this.currentActiveIndex = index; this.previousActiveIndex = 0; filter.disable = false; @@ -360,13 +372,13 @@ export class HomeComponent implements OnInit { this.currentActiveIndex = 0; this.previousActiveIndex = 0; for (const filter of this.filters) { - filter.disable = false; - if (filter.key === this.itemType) { - filter.active = true; - } else { - filter.active = false; - } + filter.disable = false; + if (filter.key === this.itemType) { + filter.active = true; + } else { + filter.active = false; } + } } async openSearchModal() { @@ -375,7 +387,7 @@ export class HomeComponent implements OnInit { cssClass: 'advanced-search-modal-custom', backdropDismiss: false, componentProps: { - itemType: this.itemType + itemType: this.itemType } }); modal.onDidDismiss().then(result => { @@ -521,7 +533,7 @@ export class HomeComponent implements OnInit { } } - public resetFiltersUI () { + public resetFiltersUI() { this.ngZone.run(() => { this.filters[0].value = 0; this.filters[1].value = 0; @@ -608,6 +620,7 @@ export class HomeComponent implements OnInit { .subscribe((result: any) => { if (result.RequestType) { if (result.RequestType.length > 0) { + this.countChanged = false; this.ITGSegment[0] = { name: 'All', code: 'All', @@ -638,14 +651,30 @@ export class HomeComponent implements OnInit { } Details() { - this.workListService.getITGDetails('', '', this.isPostNoLoad) - .subscribe((result: any) => { - this.ITGCount = result.TotalCount; - this.totalRequestCount = this.totalRequestCount + result.TotalCount; - this.data.datasets[0].data[4] = this.ITGCount; - this.filters[4].value = result.TotalCount; - this.receivedITGCount = true; - }); + // var result = this.common.sharedService.getSharedData(MenuResponse.ITG_COUNTS, false); + // if (this.countChanged) { + // this.workListService.getITGDetails('', '', this.isPostNoLoad) + // .subscribe((result: any) => { + // this.countChanged = false; + // this.ITGCount = result.TotalCount; + // // this.totalRequestCount = this.totalRequestCount + result.TotalCount; + // this.data.datasets[0].data[4] = this.ITGCount; + // this.filters[4].value = result.TotalCount; + // this.receivedITGCount = true; + // }) + // } else { + + //this.workListService.getITGDetails('', '', this.isPostNoLoad) + //.subscribe((result: any) => { + this.ITGCount = this.common.filterKeys['ITG'];//result.TotalCount; + // this.totalRequestCount = this.totalRequestCount + result.TotalCount; + this.data.datasets[0].data[4] = this.common.filterKeys['ITG'];//this.ITGCount; + this.filters[4].value = this.common.filterKeys['ITG']; + this.receivedITGCount = true; + //}); + //} + + } searchBtn() { 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 58242557..20b990ad 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 @@ -195,6 +195,10 @@ export class WorkListMainItgComponent implements OnInit { skip() { // check if the user clicked on all type of request + this.common.setTotalNumberOfWorklistRequest(); + // this.common.assignDataToFilters(this.common.sharedService.getSharedData('worklistNotifications', false), 'ITG'); + if (this.common.filterKeys['ITG'] != 0) + this.common.filterKeys['ITG'] = (this.common.filterKeys['ITG'] - 1) 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++) { @@ -277,6 +281,7 @@ export class WorkListMainItgComponent implements OnInit { setTimeout(() => { // this.messageSuccess = false; this.common.sharedService.setSharedData(true, 'loadWorkList'); + this.confirmMsg(1); this.skip(); }, 2000); @@ -492,8 +497,8 @@ export class WorkListMainItgComponent implements OnInit { this.actionService(1, this.commentText); } if (this.actionSelected === 'Delegate') { - this.common.sharedService.setSharedData(info,'selectedEmpInfo'), - this.presentModal(4); + this.common.sharedService.setSharedData(info, 'selectedEmpInfo'), + this.presentModal(4); } if (this.actionSelected === 'Doable') { this.actionService(1, this.commentText); @@ -531,9 +536,9 @@ export class WorkListMainItgComponent implements OnInit { modal.cssClass = 'replaceRoll-modal'; modal.onDidDismiss() .then((data) => { - if(data.data.empData){ + if (data.data.empData) { this.replcamentID = data.data.empData.USER_NAME ? data.data.empData.USER_NAME : data.data.empData.EmployeeID; - this.commentText = data.data.comments ? data.data.comments: null; + this.commentText = data.data.comments ? data.data.comments : null; if (actionNumber === 3) { this.actionService(3, this.commentText); } else if (actionNumber === 4) { @@ -564,8 +569,8 @@ export class WorkListMainItgComponent implements OnInit { returnDateTime(stringDate: string) { let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - let dateArr= allDateTime[0].split('/') - let correctDate = dateArr[1]+'/'+dateArr[0]+'/'+dateArr[2]; + let dateArr = allDateTime[0].split('/') + let correctDate = dateArr[1] + '/' + dateArr[0] + '/' + dateArr[2]; let fullDate = this.transform(correctDate); return fullDate + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; @@ -590,7 +595,7 @@ export class WorkListMainItgComponent implements OnInit { return this.locale[lang].month_names_short[month]; } - backgroundColor(statusName: string){ + backgroundColor(statusName: string) { // {'bg-blue-txt' : approvalInfo.Action === 'Submit','bg-red-txt': approvalInfo.Action == 'Not Doable' ,'bg-orange-txt' : approvalInfo.Action === 'Pending' ,'bg-red-txt' : approvalInfo.Action === 'Rejected','bg-green-txt' : approvalInfo.Action != 'Pending' && approvalInfo.Action != 'Rejected' && approvalInfo.Action != 'Submit'} switch (statusName) { case 'Submit': diff --git a/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts b/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts index 8aa95dfd..ab7390a1 100644 --- a/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts +++ b/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts @@ -430,8 +430,7 @@ export class WorklistMainIcComponent implements OnInit { // this.messageSuccess = true; this.common.greenToastPK('worklist', 'done-successfully'); setTimeout(() => { - // this.messageSuccess = false; - // this.openNotificationsDashboard(); + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); }, 5000); } else { @@ -470,6 +469,9 @@ export class WorklistMainIcComponent implements OnInit { let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo); let previousRequest = this.notificationArray[index].REQUEST_TYPE; let previousRequestType = this.notificationArray[index].ITEM_TYPE; + if (this.common.filterKeys[previousRequestType] != 0) + this.common.filterKeys[previousRequestType] = (this.common.filterKeys[previousRequestType] - 1) + index += 1; if (index < this.notificationArray.length) { @@ -480,9 +482,11 @@ export class WorklistMainIcComponent implements OnInit { } else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) { this.checkRequestType(index); } else { + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } else { + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } @@ -1216,9 +1220,9 @@ export class WorklistMainIcComponent implements OnInit { // this.messageSuccess = true; this.common.greenToastPK('worklist', 'done-successfully'); setTimeout(() => { - // this.messageSuccess = false; + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); - }, 2000); + }, 1000); // this.nextNotfification(); } else { @@ -1278,34 +1282,34 @@ export class WorklistMainIcComponent implements OnInit { this.actionButton(flag); } - returnDateTime(stringDate: string){ + returnDateTime(stringDate: string) { let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - let fullDate = this.transform(stringDate); + let fullDate = this.transform(stringDate); return fullDate + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; - + } locale = { en: { - // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], - month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] } -}; + }; transform(value: string) { let x = new Date(Date.parse(value)); //return value.toLowerCase(); - let month = this.getMonthNameShort('en',x.getMonth()) - return ""+ x.getDate()+" "+ month +" "+x.getFullYear(); + let month = this.getMonthNameShort('en', x.getMonth()) + return "" + x.getDate() + " " + month + " " + x.getFullYear(); } - - getMonthNameShort(lang,month) { + + getMonthNameShort(lang, month) { lang = lang && (lang in this.locale) ? lang : 'en'; return this.locale[lang].month_names_short[month]; -}; + }; } diff --git a/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts b/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts index 0237e6dc..a8d3fa92 100644 --- a/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts +++ b/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts @@ -373,6 +373,7 @@ export class WorklistMainMRComponent implements OnInit { setTimeout(() => { // this.messageSuccess = false; // this.openNotificationsDashboard(); + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); }, 5000); } else { @@ -414,7 +415,11 @@ export class WorklistMainMRComponent implements OnInit { let itemNo = this.getPassNotificationDetails.ROW_NUM; let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo); let previousRequest = this.notificationArray[index].REQUEST_TYPE; + let previousRequestType = this.notificationArray[index].ITEM_TYPE; + if (this.common.filterKeys[previousRequestType] != 0) + this.common.filterKeys[previousRequestType] = (this.common.filterKeys[previousRequestType] - 1) + index += 1; if (index < this.notificationArray.length) { @@ -425,9 +430,11 @@ export class WorklistMainMRComponent implements OnInit { } else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) { this.checkRequestType(index); } else { + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } else { + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } @@ -1117,9 +1124,9 @@ export class WorklistMainMRComponent implements OnInit { // this.messageSuccess = true; this.common.greenToastPK('worklist', 'done-successfully'); setTimeout(() => { - // this.messageSuccess = false; + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); - }, 2000); + }, 1000); // this.nextNotfification(); } else { @@ -1153,7 +1160,7 @@ export class WorklistMainMRComponent implements OnInit { if (data.data == 'cancel' || data.data == undefined) { return; } else if (data.data == 'Success') { - // this.openNotificationsDashboard(); + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); } @@ -1224,35 +1231,35 @@ export class WorklistMainMRComponent implements OnInit { this.actionButton(flag); } - returnDateTime(stringDate: string){ + returnDateTime(stringDate: string) { let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - let fullDate = this.transform(stringDate); + let fullDate = this.transform(stringDate); return fullDate + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; - + } locale = { en: { - // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], - month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] } -}; + }; transform(value: string) { let x = new Date(Date.parse(value)); //return value.toLowerCase(); - let month = this.getMonthNameShort('en',x.getMonth()) - return ""+ x.getDate()+" "+ month +" "+x.getFullYear(); + let month = this.getMonthNameShort('en', x.getMonth()) + return "" + x.getDate() + " " + month + " " + x.getFullYear(); } - - getMonthNameShort(lang,month) { + + getMonthNameShort(lang, month) { lang = lang && (lang in this.locale) ? lang : 'en'; return this.locale[lang].month_names_short[month]; -}; + }; } diff --git a/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts b/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts index ca8179b7..14f5dfa7 100644 --- a/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts +++ b/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts @@ -407,8 +407,7 @@ export class WorklistMainPoComponent implements OnInit { // this.messageSuccess = true; this.common.greenToastPK('worklist', 'done-successfully'); setTimeout(() => { - // this.messageSuccess = false; - // this.openNotificationsDashboard(); + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); }, 5000); } else { @@ -446,7 +445,11 @@ export class WorklistMainPoComponent implements OnInit { let itemNo = this.getPassNotificationDetails.ROW_NUM; let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo); let previousRequest = this.notificationArray[index].REQUEST_TYPE; + let previousRequestType = this.notificationArray[index].ITEM_TYPE; + if (this.common.filterKeys[previousRequestType] != 0) + this.common.filterKeys[previousRequestType] = (this.common.filterKeys[previousRequestType] - 1) + index += 1; if (index < this.notificationArray.length) { @@ -457,9 +460,11 @@ export class WorklistMainPoComponent implements OnInit { } else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) { this.checkRequestType(index); } else { + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } else { + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } @@ -1184,8 +1189,9 @@ export class WorklistMainPoComponent implements OnInit { } else if (data.data.data === 'Success') { this.common.greenToastPK('worklist', 'done-successfully'); setTimeout(() => { + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); - }, 2000); + }, 1000); } else { this.common.redToastPK('worklist', 'save-error'); } @@ -1207,7 +1213,7 @@ export class WorklistMainPoComponent implements OnInit { console.log(data.data); if (data.data == "cancel" || data.data == undefined) { return; - } else {} + } else { } }); return await modal.present(); @@ -1232,33 +1238,33 @@ export class WorklistMainPoComponent implements OnInit { this.actionButton(flag); } - returnDateTime(stringDate: string){ + returnDateTime(stringDate: string) { let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - let fullDate = this.transform(stringDate); + let fullDate = this.transform(stringDate); return fullDate + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; - + } locale = { en: { - // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], - month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] } -}; + }; transform(value: string) { let x = new Date(Date.parse(value)); //return value.toLowerCase(); - let month = this.getMonthNameShort('en',x.getMonth()) - return ""+ x.getDate()+" "+ month +" "+x.getFullYear(); + let month = this.getMonthNameShort('en', x.getMonth()) + return "" + x.getDate() + " " + month + " " + x.getFullYear(); } - - getMonthNameShort(lang,month) { + + getMonthNameShort(lang, month) { lang = lang && (lang in this.locale) ? lang : 'en'; return this.locale[lang].month_names_short[month]; -}; + }; } diff --git a/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts b/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts index 2d558b5b..63816e8d 100644 --- a/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts +++ b/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts @@ -395,12 +395,7 @@ export class WorklistMainPRComponent implements OnInit { if (result.MessageStatus == 1) { this.common.sharedService.setSharedData(true, 'loadWorkList'); this.common.greenToastPK('worklist', 'done-successfully'); - // show succsfull popup - // this.messageSuccess = true; - // setTimeout(() => { - // this.messageSuccess = false; - // }, 5000); - // this.openNotificationsDashboard(); + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); } else { this.common.redToastPK('worklist', 'save-error'); @@ -440,9 +435,12 @@ export class WorklistMainPRComponent implements OnInit { let itemNo = this.getPassNotificationDetails.ROW_NUM; console.log(itemNo); let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo); - console.log(index); - console.log(this.notificationArray); + let previousRequest = this.notificationArray[index].REQUEST_TYPE; + let previousRequestType = this.notificationArray[index].ITEM_TYPE; + if (this.common.filterKeys[previousRequestType] != 0) + this.common.filterKeys[previousRequestType] = (this.common.filterKeys[previousRequestType] - 1) + index += 1; if (index < this.notificationArray.length) { @@ -453,9 +451,11 @@ export class WorklistMainPRComponent implements OnInit { } else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) { this.checkRequestType(index); } else { + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } else { + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } @@ -1117,9 +1117,9 @@ export class WorklistMainPRComponent implements OnInit { // this.messageSuccess = true; this.common.greenToastPK('worklist', 'done-successfully'); setTimeout(() => { - // this.messageSuccess = false; + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); - }, 2000); + }, 1000); // this.nextNotfification(); } else { @@ -1178,33 +1178,33 @@ export class WorklistMainPRComponent implements OnInit { this.actionButton(flag); } - returnDateTime(stringDate: string){ + returnDateTime(stringDate: string) { let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - let fullDate = this.transform(stringDate); + let fullDate = this.transform(stringDate); return fullDate + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; - + } locale = { en: { - // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], - month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] } -}; + }; transform(value: string) { let x = new Date(Date.parse(value)); //return value.toLowerCase(); - let month = this.getMonthNameShort('en',x.getMonth()) - return ""+ x.getDate()+" "+ month +" "+x.getFullYear(); + let month = this.getMonthNameShort('en', x.getMonth()) + return "" + x.getDate() + " " + month + " " + x.getFullYear(); } - - getMonthNameShort(lang,month) { + + getMonthNameShort(lang, month) { lang = lang && (lang in this.locale) ? lang : 'en'; return this.locale[lang].month_names_short[month]; -}; + }; } \ No newline at end of file diff --git a/Mohem/src/app/notification/worklist-main/worklist-main.component.ts b/Mohem/src/app/notification/worklist-main/worklist-main.component.ts index caee4d46..b01c944f 100644 --- a/Mohem/src/app/notification/worklist-main/worklist-main.component.ts +++ b/Mohem/src/app/notification/worklist-main/worklist-main.component.ts @@ -53,8 +53,8 @@ export class WorklistMainComponent implements OnInit { public static PASS_RES_ATTR = "passResAttr"; TransactionID: number = -999; notificationBodyRes: any = []; - stampNsNotificationBodyRes: any =[]; - stampMsNotificationBodyRes: any =[]; + stampNsNotificationBodyRes: any = []; + stampMsNotificationBodyRes: any = []; actionHistoryRes: any = []; notificationButtonRes: any; actionMode: any; @@ -436,59 +436,59 @@ export class WorklistMainComponent implements OnInit { this.notificationBodyRes = result.GetAbsenceCollectionNotificationBodyList; } - } else if (Type === "ADDRESS"){ + } else if (Type === "ADDRESS") { if (result.GetAddressNotificationBodyList) { this.notificationBodyRes = - result.GetAddressNotificationBodyList; + result.GetAddressNotificationBodyList; console.log(result); } - } else if (Type === "BASIC_DETAILS"){ + } else if (Type === "BASIC_DETAILS") { if (result.GetBasicDetNtfBodyList) { this.notificationBodyRes = result.GetBasicDetNtfBodyList; - console.log(result); - } - } else if (Type === "CEI"){ + console.log(result); + } + } else if (Type === "CEI") { if (result.GetCEICollectionNotificationBodyList) { this.notificationBodyRes = result.GetCEICollectionNotificationBodyList[0].Collection_Notification; console.log(result.GetCEICollectionNotificationBodyList[0].Collection_Notification); - } + } } - else if (Type === "STAMP_MS"){ + else if (Type === "STAMP_MS") { if (result.GetStampMsNotificationBodyList) { this.stampMsNotificationBodyRes = result.GetStampMsNotificationBodyList; - console.log(result); - } + console.log(result); + } } - else if (Type === "STAMP_NS"){ + else if (Type === "STAMP_NS") { if (result.GetStampNsNotificationBodyList) { this.stampNsNotificationBodyRes = result.GetStampNsNotificationBodyList; - console.log(result); - } + console.log(result); + } } - else if (Type === "PHONE_NUMBERS"){ + else if (Type === "PHONE_NUMBERS") { if (result.GetPhonesNotificationBodyList) { this.notificationBodyRes = result.GetPhonesNotificationBodyList; - console.log(result); - } + console.log(result); + } } - else if (Type === "TERMINATION"){ + else if (Type === "TERMINATION") { if (result.GetTermNotificationBodyList) { this.notificationBodyRes = result.GetTermNotificationBodyList; - console.log(result); - } + console.log(result); + } } - else if (Type === "CONTACT"){ + else if (Type === "CONTACT") { if (result.GetContactNotificationBodyList) { this.notificationBodyRes = result.GetContactNotificationBodyList.ContactNotificationBody; - console.log(result); - } + console.log(result); + } } } } //End handleWorkListBodyResult @@ -560,10 +560,9 @@ export class WorklistMainComponent implements OnInit { // } // this.messageSuccess = true; this.common.greenToastPK('worklist', 'done-successfully'); - this.common.setTotalNumberOfWorklistRequest(); + setTimeout(() => { - // this.messageSuccess = false; - // this.openNotificationsDashboard(); + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); }, 2000); } else { @@ -601,14 +600,20 @@ export class WorklistMainComponent implements OnInit { if (document.getElementById("notificationDynamicFields") != null) { document.getElementById("notificationDynamicFields").innerHTML = ""; } + let itemNo = this.getPassNotificationDetails.ROW_NUM; console.log(itemNo); let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo); console.log(index); console.log(this.notificationArray); let previousRequest = this.notificationArray[index].REQUEST_TYPE; - index += 1; + if (previousRequest == 'STAMP_MS' || previousRequest == 'STAMP_NS') { + previousRequest = 'STAMP'; + } + if (this.common.filterKeys[previousRequest] != 0) + this.common.filterKeys[previousRequest] = (this.common.filterKeys[previousRequest] - 1) + index += 1; if (index < this.notificationArray.length) { this.activeSegment = 'info'; if (this.selectedFilter === 'ALL') { @@ -622,11 +627,15 @@ export class WorklistMainComponent implements OnInit { this.common.sharedService.setSharedData(this.arr_hr_req_only[requestIndex], HomeComponent.NOTIFICATION_DATA); this.intializeNotificationDetail(); } else { + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + this.common.openNotificationPage(); } } } } else { + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + this.common.openNotificationPage(); } @@ -1019,7 +1028,7 @@ export class WorklistMainComponent implements OnInit { let jobTitle = title.split('.'); if (jobTitle && jobTitle.length > 1) { jobName = jobTitle[0] + " " + jobTitle[1]; - }​ + } } else { jobName = ''; } @@ -1148,7 +1157,7 @@ export class WorklistMainComponent implements OnInit { setTimeout(() => { // this.messageSuccess = false; this.nextNotfification(); - }, 2000); + }, 1000); // this.nextNotfification(); } else { this.common.redToastPK('worklist', 'save-error'); @@ -1170,6 +1179,7 @@ export class WorklistMainComponent implements OnInit { return; } else if (data.data == "Success") { // this.openNotificationsDashboard(); + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); } }); @@ -1245,41 +1255,41 @@ export class WorklistMainComponent implements OnInit { console.log(this.arr_hr_req_only); } - returnDateTime(stringDate: string){ + returnDateTime(stringDate: string) { let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - let fullDate = this.transform(stringDate); + let fullDate = this.transform(stringDate); return fullDate + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; - + } locale = { en: { - // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], - month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] } -}; + }; transform(value: string) { let x = new Date(Date.parse(value)); //return value.toLowerCase(); - let month = this.getMonthNameShort('en',x.getMonth()) - return ""+ x.getDate()+" "+ month +" "+x.getFullYear(); + let month = this.getMonthNameShort('en', x.getMonth()) + return "" + x.getDate() + " " + month + " " + x.getFullYear(); } - getMonthNameShort(lang,month) { + getMonthNameShort(lang, month) { lang = lang && (lang in this.locale) ? lang : 'en'; return this.locale[lang].month_names_short[month]; -} + } -showLoading( notificationList ) { - if (notificationList.length < 0) { - return true; - } else if (notificationList === []){ - return false; - } else {return true;} -} + showLoading(notificationList) { + if (notificationList.length < 0) { + return true; + } else if (notificationList === []) { + return false; + } else { return true; } + } }