|
|
|
|
@ -10,6 +10,7 @@ import { IonInfiniteScroll } from '@ionic/angular';
|
|
|
|
|
import { WorklistMainService } from '../service/work-list.main.service';
|
|
|
|
|
import { WorklistAdvancedSearchComponent } from '../worklist-advanced-search/worklist-advanced-search.component';
|
|
|
|
|
import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user';
|
|
|
|
|
import { DatePipe } from '@angular/common';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-home',
|
|
|
|
|
@ -17,130 +18,178 @@ import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/mo
|
|
|
|
|
styleUrls: ['./home.component.scss']
|
|
|
|
|
})
|
|
|
|
|
export class HomeComponent implements OnInit {
|
|
|
|
|
// @ViewChild(Navbar) navBar: Navbar;
|
|
|
|
|
public static NOTIFICATION_DATA = 'notification_data';
|
|
|
|
|
public static NOTIFICATION_ARR = 'notification_arr';
|
|
|
|
|
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
|
|
|
|
|
private WorkListObj: WorkListRequest;
|
|
|
|
|
WorkListResObj: any; //WorKListResponse;
|
|
|
|
|
notificationType: string = '1';
|
|
|
|
|
pageNum: number = 1;
|
|
|
|
|
WorkListResObj: any;
|
|
|
|
|
notificationType = '1';
|
|
|
|
|
pageNum = 1;
|
|
|
|
|
rowsNo: number;
|
|
|
|
|
noOfrows: number;
|
|
|
|
|
selectedValue: string = '';
|
|
|
|
|
FromUserName: string = '';
|
|
|
|
|
ItemKeyDisplayName: string = '';
|
|
|
|
|
SentDate: string = '';
|
|
|
|
|
Subject: string = '';
|
|
|
|
|
inputSearch: string = '';
|
|
|
|
|
HideDateInput: boolean = false;
|
|
|
|
|
HideTextInput: boolean = false;
|
|
|
|
|
InputDate: string;
|
|
|
|
|
selectedValue = '';
|
|
|
|
|
FromUserName = '';
|
|
|
|
|
ItemKeyDisplayName = '';
|
|
|
|
|
SentDate = '';
|
|
|
|
|
Subject = '';
|
|
|
|
|
inputSearch = '';
|
|
|
|
|
// HideDateInput = false;
|
|
|
|
|
// HideTextInput = false;
|
|
|
|
|
inputDate: string;
|
|
|
|
|
filteredNotificationList: any;
|
|
|
|
|
IsReachEnd: boolean = false;
|
|
|
|
|
public noData: boolean = false;
|
|
|
|
|
public isAll: boolean = true;
|
|
|
|
|
public isPR: boolean = false;
|
|
|
|
|
public isPO: boolean = false;
|
|
|
|
|
public isMR: boolean = false;
|
|
|
|
|
public isHR: boolean = false;
|
|
|
|
|
public isITG: boolean = false;
|
|
|
|
|
public isSearch: boolean = false;
|
|
|
|
|
IsReachEnd = false;
|
|
|
|
|
public noData = false;
|
|
|
|
|
public isAll = true;
|
|
|
|
|
public isPR = false;
|
|
|
|
|
public isPO = false;
|
|
|
|
|
public isMR = false;
|
|
|
|
|
public isHR = false;
|
|
|
|
|
public isITG = false;
|
|
|
|
|
public isSearch = false;
|
|
|
|
|
public direction = 'ltr';
|
|
|
|
|
|
|
|
|
|
///// New /////////////
|
|
|
|
|
public currentActiveIndex = 0;
|
|
|
|
|
public previousActiveIndex = 0;
|
|
|
|
|
public worklistNotifications: any;
|
|
|
|
|
public totalRequestCount = 0;
|
|
|
|
|
public newWorkListResponse = [];
|
|
|
|
|
public allFormattedData = {};
|
|
|
|
|
public showFormattedData = {};
|
|
|
|
|
public selectedFilter = 'ALL';
|
|
|
|
|
public showSearchButton = false;
|
|
|
|
|
public options = {
|
|
|
|
|
cutoutPercentage: 80,
|
|
|
|
|
tooltips: { enabled: false },
|
|
|
|
|
legend: { display: false }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public data = {
|
|
|
|
|
datasets: [
|
|
|
|
|
{
|
|
|
|
|
data: [120, 30, 30, 30, 50],
|
|
|
|
|
data: [0, 0, 0, 0, 0],
|
|
|
|
|
backgroundColor: [
|
|
|
|
|
'#1fa269',
|
|
|
|
|
'#cb3232',
|
|
|
|
|
'#124375',
|
|
|
|
|
'#3dcab3',
|
|
|
|
|
'#3cb9d5'
|
|
|
|
|
'#18a169',
|
|
|
|
|
'#38c9b3',
|
|
|
|
|
'#114475',
|
|
|
|
|
'#3cb9d5',
|
|
|
|
|
'#cc3232'
|
|
|
|
|
],
|
|
|
|
|
borderWidth: 5
|
|
|
|
|
}]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public filters = [
|
|
|
|
|
{
|
|
|
|
|
value: 287,
|
|
|
|
|
text: 'All',
|
|
|
|
|
active: true,
|
|
|
|
|
color: '#124375'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 200,
|
|
|
|
|
text: 'HR',
|
|
|
|
|
active: false,
|
|
|
|
|
color: '#18a169'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 10,
|
|
|
|
|
text: 'PO',
|
|
|
|
|
active: false,
|
|
|
|
|
color: '#38c9b3'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 15,
|
|
|
|
|
text: 'PR',
|
|
|
|
|
active: false,
|
|
|
|
|
color: '#114475'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 50,
|
|
|
|
|
text: 'MR',
|
|
|
|
|
active: false,
|
|
|
|
|
color: '#3cb9d5'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 12,
|
|
|
|
|
text: 'ITG',
|
|
|
|
|
active: false,
|
|
|
|
|
color: '#cc3232'
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
public filters = [
|
|
|
|
|
{
|
|
|
|
|
value: 0,
|
|
|
|
|
name: 'All',
|
|
|
|
|
active: true,
|
|
|
|
|
color: '#124375',
|
|
|
|
|
key: 'ALL'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 0,
|
|
|
|
|
name: 'HR',
|
|
|
|
|
active: false,
|
|
|
|
|
color: '#18a169',
|
|
|
|
|
key: 'HRSSA'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 0,
|
|
|
|
|
name: 'PO',
|
|
|
|
|
active: false,
|
|
|
|
|
color: '#38c9b3',
|
|
|
|
|
key: 'POAPPRV'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 0,
|
|
|
|
|
name: 'PR',
|
|
|
|
|
active: false,
|
|
|
|
|
color: '#114475',
|
|
|
|
|
key: 'REQAPPRV'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 0,
|
|
|
|
|
name: 'MR',
|
|
|
|
|
active: false,
|
|
|
|
|
color: '#3cb9d5',
|
|
|
|
|
key: 'INVMOA'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 0,
|
|
|
|
|
name: 'ITG',
|
|
|
|
|
active: false,
|
|
|
|
|
color: '#cc3232',
|
|
|
|
|
key: 'ITG'
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
public slideOptsOne = {
|
|
|
|
|
slidesPerView: 4.3,
|
|
|
|
|
spaceBetween: 10
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
public common: CommonService,
|
|
|
|
|
public ts: TranslatorService,
|
|
|
|
|
public WorklistService: WorklistService,
|
|
|
|
|
public workListService: WorklistMainService,
|
|
|
|
|
public modalController: ModalController
|
|
|
|
|
) {
|
|
|
|
|
this.WorkListObj = new WorkListRequest();
|
|
|
|
|
this.WorkListObj.P_NOTIFICATION_TYPE = '1';
|
|
|
|
|
this.WorkListObj.P_SEARCH_FROM_USER = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SUBJECT = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SENT_DATE = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
|
|
|
|
|
this.WorkListObj.P_PAGE_NUM = 0;
|
|
|
|
|
this.WorkListObj.P_PAGE_LIMIT = 50; //number
|
|
|
|
|
constructor(
|
|
|
|
|
public common: CommonService,
|
|
|
|
|
public ts: TranslatorService,
|
|
|
|
|
public WorklistService: WorklistService,
|
|
|
|
|
public workListService: WorklistMainService,
|
|
|
|
|
public modalController: ModalController
|
|
|
|
|
) {
|
|
|
|
|
this.WorkListObj = new WorkListRequest();
|
|
|
|
|
this.WorkListObj.P_NOTIFICATION_TYPE = '1';
|
|
|
|
|
this.WorkListObj.P_SEARCH_FROM_USER = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SUBJECT = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SENT_DATE = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
|
|
|
|
|
this.WorkListObj.P_PAGE_NUM = 0;
|
|
|
|
|
this.WorkListObj.P_PAGE_LIMIT = 50;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public userData: any;
|
|
|
|
|
public userImage: any = '../assets/imgs/profile.png';
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
// this.direction = TranslatorService.getCurrentDirection();
|
|
|
|
|
this.worklistNotifications = this.common.sharedService.getSharedData('worklistNotifications', false);
|
|
|
|
|
this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER;
|
|
|
|
|
this.assignDataToFilters();
|
|
|
|
|
this.getAllPushNotificationFun();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assignDataToFilters() {
|
|
|
|
|
this.filters[0].value = this.worklistNotifications.P_OPEN_NTF_NUMBER;
|
|
|
|
|
const openNotificationsArray = this.worklistNotifications.GetOpenNotificationsList;
|
|
|
|
|
for (const notification of openNotificationsArray) {
|
|
|
|
|
if (notification.ITEM_TYPE === 'HRSSA') {
|
|
|
|
|
this.filters[1].value = notification.OPEN_NTF_NUMBER;
|
|
|
|
|
this.data.datasets[0].data[0] = notification.OPEN_NTF_NUMBER;
|
|
|
|
|
} else if (notification.ITEM_TYPE === 'POAPPRV') {
|
|
|
|
|
this.filters[2].value = notification.OPEN_NTF_NUMBER;
|
|
|
|
|
this.data.datasets[0].data[1] = notification.OPEN_NTF_NUMBER;
|
|
|
|
|
} else if (notification.ITEM_TYPE === 'REQAPPRV') {
|
|
|
|
|
this.filters[3].value = notification.OPEN_NTF_NUMBER;
|
|
|
|
|
this.data.datasets[0].data[2] = notification.OPEN_NTF_NUMBER;
|
|
|
|
|
} else if (notification.ITEM_TYPE === 'INVMOA') {
|
|
|
|
|
this.filters[4].value = notification.OPEN_NTF_NUMBER;
|
|
|
|
|
this.data.datasets[0].data[3] = notification.OPEN_NTF_NUMBER;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getFilteredData(filter: string) {
|
|
|
|
|
if(filter === 'ALL') {
|
|
|
|
|
this.showFormattedData = this.allFormattedData;
|
|
|
|
|
} else {
|
|
|
|
|
let arrayToFilter;
|
|
|
|
|
arrayToFilter = this.newWorkListResponse.filter((workList) => {
|
|
|
|
|
return workList.ITEM_TYPE === filter;
|
|
|
|
|
});
|
|
|
|
|
this.showFormattedData = this.categorizeData(arrayToFilter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
activeFilter(index: number) {
|
|
|
|
|
for (const filter of this.filters) {
|
|
|
|
|
filter.active = false;
|
|
|
|
|
}
|
|
|
|
|
this.filters[index].active = true;
|
|
|
|
|
this.showFormattedData = {};
|
|
|
|
|
this.previousActiveIndex = this.currentActiveIndex;
|
|
|
|
|
this.currentActiveIndex = index;
|
|
|
|
|
this.filters[this.previousActiveIndex].active = false;
|
|
|
|
|
this.filters[this.currentActiveIndex].active = true;
|
|
|
|
|
|
|
|
|
|
this.selectedFilter = this.filters[this.currentActiveIndex].key;
|
|
|
|
|
this.getFilteredData(this.selectedFilter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openProfilePage() {
|
|
|
|
|
@ -148,211 +197,247 @@ constructor(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async openSearchModal() {
|
|
|
|
|
console.log('umar786');
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: WorklistAdvancedSearchComponent,
|
|
|
|
|
cssClass: 'advanced-search-modal',
|
|
|
|
|
componentProps: {
|
|
|
|
|
// dateFrom : this.dateFrom,
|
|
|
|
|
// dateTo : this.dateTo
|
|
|
|
|
}
|
|
|
|
|
backdropDismiss: false,
|
|
|
|
|
componentProps: {}
|
|
|
|
|
});
|
|
|
|
|
modal.onDidDismiss().then(result => {
|
|
|
|
|
// console.log(result.data);
|
|
|
|
|
// this.loadMore = false;
|
|
|
|
|
// this.rightIconActive = false;
|
|
|
|
|
// this.leftIconActive = false;
|
|
|
|
|
// this.dayHoursData = [];
|
|
|
|
|
// this.timeCardSummaryData = [];
|
|
|
|
|
// this.dayAndHoursPageNumber = 1;
|
|
|
|
|
// this.loadMoreDateHoursData = false;
|
|
|
|
|
// this.dateFrom = result.data.dateFrom;
|
|
|
|
|
// this.dateTo = result.data.dateTo;
|
|
|
|
|
// this.selectedFilters = result.data.keySelectedFilters;
|
|
|
|
|
// this.selectedShiftFilter = result.data.selectedShiftType;
|
|
|
|
|
// if (this.dateFrom && this.dateTo) {
|
|
|
|
|
// this.getDayHoursTypeDetails();
|
|
|
|
|
// this.getTimeCardSummaryDetails();
|
|
|
|
|
// }
|
|
|
|
|
console.log(result.data);
|
|
|
|
|
if(result.data){
|
|
|
|
|
if(result.data.notificationType !== '' || result.data.selectedValue){
|
|
|
|
|
this.showSearchButton = true;
|
|
|
|
|
this.notificationType = result.data.notificationType;
|
|
|
|
|
this.selectedValue = result.data.selectedValue;
|
|
|
|
|
this.inputDate = result.data.inputDate;
|
|
|
|
|
this.inputSearch = result.data.inputSearch;
|
|
|
|
|
this.WorkListObj.P_PAGE_NUM = 1;
|
|
|
|
|
this.newWorkListResponse = [];
|
|
|
|
|
this.allFormattedData = {};
|
|
|
|
|
this.showFormattedData = {};
|
|
|
|
|
this.selectedFilter = 'ALL';
|
|
|
|
|
this.filters[this.currentActiveIndex].active = false;
|
|
|
|
|
this.currentActiveIndex = 0;
|
|
|
|
|
this.previousActiveIndex = 0;
|
|
|
|
|
this.filters[this.currentActiveIndex].active = true;
|
|
|
|
|
this.getAllPushNotificationFun();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
return await modal.present();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
// this.direction = TranslatorService.getCurrentDirection();
|
|
|
|
|
this.userData = this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA, false);
|
|
|
|
|
this.userImage = this.userData.EMPLOYEE_IMAGE ? 'data:image/png;base64,' + this.userData.EMPLOYEE_IMAGE : this.userImage;
|
|
|
|
|
}
|
|
|
|
|
ionViewDidLoad() {
|
|
|
|
|
// this.navBar.backButtonClick = () => {
|
|
|
|
|
// // you can set a full custom history here if you want
|
|
|
|
|
// let pages = [
|
|
|
|
|
// {
|
|
|
|
|
// page: "HomePage"
|
|
|
|
|
// }
|
|
|
|
|
// ];
|
|
|
|
|
// this.navCtrl.setPages(pages);
|
|
|
|
|
// };
|
|
|
|
|
ionViewDidLoad() {
|
|
|
|
|
// this.navBar.backButtonClick = () => {
|
|
|
|
|
// // you can set a full custom history here if you want
|
|
|
|
|
// let pages = [
|
|
|
|
|
// {
|
|
|
|
|
// page: "HomePage"
|
|
|
|
|
// }
|
|
|
|
|
// ];
|
|
|
|
|
// this.navCtrl.setPages(pages);
|
|
|
|
|
// };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ionViewWillEnter() {
|
|
|
|
|
// this.getAllPushNotificationFun();
|
|
|
|
|
}
|
|
|
|
|
getValueSelected(Value) {
|
|
|
|
|
this.selectedValue = Value.detail.value;
|
|
|
|
|
if (this.selectedValue == '1') {
|
|
|
|
|
this.HideDateInput = false;
|
|
|
|
|
this.HideTextInput = true;
|
|
|
|
|
} else if (this.selectedValue == '2') {
|
|
|
|
|
this.HideDateInput = false;
|
|
|
|
|
this.HideTextInput = true;
|
|
|
|
|
} else if (this.selectedValue == '3') {
|
|
|
|
|
this.HideDateInput = true;
|
|
|
|
|
this.HideTextInput = false;
|
|
|
|
|
} else if (this.selectedValue == '4') {
|
|
|
|
|
this.HideDateInput = false;
|
|
|
|
|
this.HideTextInput = true;
|
|
|
|
|
} else if (this.selectedValue == '5') {
|
|
|
|
|
this.HideDateInput = false;
|
|
|
|
|
this.HideTextInput = false;
|
|
|
|
|
}
|
|
|
|
|
ionViewWillEnter() {
|
|
|
|
|
// this.getAllPushNotificationFun(); //filter with item type
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getAllPushNotificationFun() {
|
|
|
|
|
this.WorkListObj.P_PAGE_NUM = 1;
|
|
|
|
|
this.IsReachEnd = false;
|
|
|
|
|
getAllPushNotificationFun() {
|
|
|
|
|
this.WorkListObj.P_PAGE_NUM = 1;
|
|
|
|
|
this.IsReachEnd = false;
|
|
|
|
|
|
|
|
|
|
if (this.selectedValue === '1') {
|
|
|
|
|
this.WorkListObj.P_SEARCH_FROM_USER = this.inputSearch;
|
|
|
|
|
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SENT_DATE = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SUBJECT = '';
|
|
|
|
|
} else if (this.selectedValue === '2') {
|
|
|
|
|
this.WorkListObj.P_SEARCH_FROM_USER = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SENT_DATE = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SUBJECT = this.inputSearch;
|
|
|
|
|
} else if (this.selectedValue === '3') {
|
|
|
|
|
this.WorkListObj.P_SEARCH_FROM_USER = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
|
|
|
|
|
if (this.inputDate) {
|
|
|
|
|
this.WorkListObj.P_SEARCH_SENT_DATE = moment(this.inputDate).format(
|
|
|
|
|
'DD-MMM-YYYY'
|
|
|
|
|
);
|
|
|
|
|
} else { this.WorkListObj.P_SEARCH_SENT_DATE = ''; }
|
|
|
|
|
this.WorkListObj.P_SEARCH_SUBJECT = '';
|
|
|
|
|
} else if (this.selectedValue === '4') {
|
|
|
|
|
this.WorkListObj.P_SEARCH_FROM_USER = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = this.inputSearch;
|
|
|
|
|
this.WorkListObj.P_SEARCH_SENT_DATE = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SUBJECT = '';
|
|
|
|
|
} else if (this.selectedValue === '5') {
|
|
|
|
|
this.WorkListObj.P_SEARCH_FROM_USER = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SENT_DATE = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SUBJECT = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.selectedValue == '1') {
|
|
|
|
|
this.WorkListObj.P_SEARCH_FROM_USER = this.inputSearch;
|
|
|
|
|
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SENT_DATE = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SUBJECT = '';
|
|
|
|
|
} else if (this.selectedValue == '2') {
|
|
|
|
|
this.WorkListObj.P_SEARCH_FROM_USER = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SENT_DATE = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SUBJECT = this.inputSearch;
|
|
|
|
|
} else if (this.selectedValue == '3') {
|
|
|
|
|
this.WorkListObj.P_SEARCH_FROM_USER = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
|
|
|
|
|
if (this.InputDate)
|
|
|
|
|
this.WorkListObj.P_SEARCH_SENT_DATE = moment(this.InputDate).format(
|
|
|
|
|
'DD-MMM-YYYY'
|
|
|
|
|
);
|
|
|
|
|
else this.WorkListObj.P_SEARCH_SENT_DATE = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SUBJECT = '';
|
|
|
|
|
} else if (this.selectedValue == '4') {
|
|
|
|
|
this.WorkListObj.P_SEARCH_FROM_USER = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = this.inputSearch;
|
|
|
|
|
this.WorkListObj.P_SEARCH_SENT_DATE = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SUBJECT = '';
|
|
|
|
|
} else if (this.selectedValue == '5') {
|
|
|
|
|
this.WorkListObj.P_SEARCH_FROM_USER = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SENT_DATE = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SUBJECT = '';
|
|
|
|
|
}
|
|
|
|
|
this.WorklistService.getWorkList(this.WorkListObj).subscribe((result) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
this.handleWorkListResult(result.GetWorkList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.WorklistService.getWorkList(this.WorkListObj).subscribe(
|
|
|
|
|
(result: WorKListResponse) => {
|
|
|
|
|
this.handleWorkListResult(result);
|
|
|
|
|
categorizeData(arrayToCategorize: any) {
|
|
|
|
|
const datePipe = new DatePipe('en-US');
|
|
|
|
|
let formattedData = {};
|
|
|
|
|
for (const workList of arrayToCategorize) {
|
|
|
|
|
workList.FORMATTED_DATE = datePipe.transform(new Date(workList.BEGIN_DATE), 'MMMM dd, y');
|
|
|
|
|
if (!(workList.FORMATTED_DATE in formattedData)) {
|
|
|
|
|
formattedData[workList.FORMATTED_DATE] = new Array();
|
|
|
|
|
formattedData[workList.FORMATTED_DATE].push(workList);
|
|
|
|
|
} else {
|
|
|
|
|
formattedData[workList.FORMATTED_DATE].push(workList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return formattedData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sortArray(arrayToSort: any) {
|
|
|
|
|
return arrayToSort.sort((a: any, b: any) =>
|
|
|
|
|
new Date(b.BEGIN_DATE).getTime() - new Date(a.BEGIN_DATE).getTime()
|
|
|
|
|
);
|
|
|
|
|
} //End getNotifications
|
|
|
|
|
|
|
|
|
|
private handleWorkListResult(result) {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
// this.sharedData.setSharedData(result, WorKListResponse.SHARED_DATA);
|
|
|
|
|
if (this.common.hasData(result.GetWorkList)) {
|
|
|
|
|
this.WorkListObj.P_PAGE_NUM++;
|
|
|
|
|
this.WorkListResObj = result.GetWorkList;
|
|
|
|
|
this.filteredNotificationList = this.WorkListResObj;
|
|
|
|
|
this.common.sharedService.setSharedData(this.WorkListResObj, HomeComponent.NOTIFICATION_ARR);
|
|
|
|
|
let lastItemIndex = this.WorkListResObj.length - 1;
|
|
|
|
|
if (result.GetWorkList[lastItemIndex]) {
|
|
|
|
|
let lastitem = result.GetWorkList[lastItemIndex];
|
|
|
|
|
if (lastitem.NO_OF_ROWS == lastitem.ROW_NUM) {
|
|
|
|
|
this.IsReachEnd = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.IsReachEnd = false;
|
|
|
|
|
}
|
|
|
|
|
// this.navCtrl.push('SmsAuthenticatePage');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private handleWorkListResult(result: any) {
|
|
|
|
|
const lastItemIndex = result.length - 1;
|
|
|
|
|
const lastitem = result[lastItemIndex];
|
|
|
|
|
if (lastitem) {
|
|
|
|
|
if (lastitem.NO_OF_ROWS === lastitem.ROW_NUM) {
|
|
|
|
|
this.IsReachEnd = true;
|
|
|
|
|
this.infiniteScroll.complete();
|
|
|
|
|
} else {
|
|
|
|
|
this.WorkListResObj = [];
|
|
|
|
|
this.IsReachEnd = false;
|
|
|
|
|
this.infiniteScroll.complete();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this.common.hasData(result)) {
|
|
|
|
|
this.WorkListObj.P_PAGE_NUM++;
|
|
|
|
|
if(this.newWorkListResponse.length === 0) {
|
|
|
|
|
this.newWorkListResponse = result;
|
|
|
|
|
} else {
|
|
|
|
|
this.newWorkListResponse = this.newWorkListResponse.concat(result);
|
|
|
|
|
}
|
|
|
|
|
this.newWorkListResponse = this.sortArray(this.newWorkListResponse);
|
|
|
|
|
console.log(this.newWorkListResponse);
|
|
|
|
|
this.allFormattedData = this.categorizeData(this.newWorkListResponse);
|
|
|
|
|
this.showFormattedData = this.allFormattedData;
|
|
|
|
|
this.common.sharedService.setSharedData(this.newWorkListResponse, HomeComponent.NOTIFICATION_ARR);
|
|
|
|
|
} else {
|
|
|
|
|
this.newWorkListResponse = [];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openNotificationDetail(obj) {
|
|
|
|
|
console.log(obj);
|
|
|
|
|
this.common.sharedService.setSharedData(obj, HomeComponent.NOTIFICATION_DATA);
|
|
|
|
|
//this.common.openWorklistMainPage();
|
|
|
|
|
if(obj.REQUEST_TYPE == 'PR'){
|
|
|
|
|
this.common.openWorklistMainPRPage();
|
|
|
|
|
}
|
|
|
|
|
else if(obj.REQUEST_TYPE == 'PO'){
|
|
|
|
|
this.common.openWorklistMainPOPage();
|
|
|
|
|
openNotificationDetail(obj) {
|
|
|
|
|
console.log(obj);
|
|
|
|
|
this.common.sharedService.setSharedData(obj, HomeComponent.NOTIFICATION_DATA);
|
|
|
|
|
// this.common.openWorklistMainPage();
|
|
|
|
|
if(obj.REQUEST_TYPE == 'PR'){
|
|
|
|
|
this.common.openWorklistMainPRPage();
|
|
|
|
|
}
|
|
|
|
|
else if(obj.REQUEST_TYPE == 'MO'){
|
|
|
|
|
this.common.openWorklistMainMRPage();
|
|
|
|
|
else if(obj.REQUEST_TYPE == 'PO'){
|
|
|
|
|
this.common.openWorklistMainPOPage();
|
|
|
|
|
}
|
|
|
|
|
else if(obj.REQUEST_TYPE == 'MO'){
|
|
|
|
|
this.common.openWorklistMainMRPage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
this.common.openWorklistMainPage();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
this.common.openWorklistMainPage();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// this.navCtrl.push("WorkListMainPage", { passNotificationList: obj });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//this.navCtrl.push("WorkListMainPage", { passNotificationList: obj });
|
|
|
|
|
isEmptyObject() {
|
|
|
|
|
return (this.showFormattedData && (Object.keys(this.showFormattedData).length > 0));
|
|
|
|
|
}
|
|
|
|
|
onChangeView(selectedValue: any) {
|
|
|
|
|
this.WorkListObj.P_NOTIFICATION_TYPE = selectedValue.detail.value;
|
|
|
|
|
|
|
|
|
|
clearSearch() {
|
|
|
|
|
this.showSearchButton = false;
|
|
|
|
|
this.notificationType = '';
|
|
|
|
|
this.selectedValue = '';
|
|
|
|
|
this.inputDate = '';
|
|
|
|
|
this.inputSearch = '';
|
|
|
|
|
this.WorkListObj.P_PAGE_NUM = 1;
|
|
|
|
|
this.newWorkListResponse = [];
|
|
|
|
|
this.allFormattedData = {};
|
|
|
|
|
this.showFormattedData = {};
|
|
|
|
|
this.selectedFilter = 'ALL';
|
|
|
|
|
this.filters[this.currentActiveIndex].active = false;
|
|
|
|
|
this.currentActiveIndex = 0;
|
|
|
|
|
this.previousActiveIndex = 0;
|
|
|
|
|
this.filters[this.currentActiveIndex].active = true;
|
|
|
|
|
this.WorkListObj.P_SEARCH_FROM_USER = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SENT_DATE = '';
|
|
|
|
|
this.WorkListObj.P_SEARCH_SUBJECT = '';
|
|
|
|
|
this.getAllPushNotificationFun();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
doInfinite(infiniteScroll) {
|
|
|
|
|
//this.pageNum= this.pageNum + 1;
|
|
|
|
|
onChangeView(selectedValue: any) {
|
|
|
|
|
this.WorkListObj.P_NOTIFICATION_TYPE = selectedValue.detail.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!this.IsReachEnd) {
|
|
|
|
|
this.WorklistService.getWorkList(this.WorkListObj).subscribe(
|
|
|
|
|
(result: any) => {
|
|
|
|
|
doInfinite(infiniteScroll) {
|
|
|
|
|
if (!this.IsReachEnd && this.selectedFilter === 'ALL') {
|
|
|
|
|
this.WorklistService.getWorkList(this.WorkListObj).subscribe((result) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
this.WorkListObj.P_PAGE_NUM++;
|
|
|
|
|
if (this.common.hasData(result.GetWorkList)) {
|
|
|
|
|
result.GetWorkList.forEach(element => {
|
|
|
|
|
if (element.ROW_NUM == element.NO_OF_ROWS) {
|
|
|
|
|
this.IsReachEnd = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.IsReachEnd = false;
|
|
|
|
|
}
|
|
|
|
|
this.WorkListResObj.push(element);
|
|
|
|
|
});
|
|
|
|
|
} // if list length >0
|
|
|
|
|
else {
|
|
|
|
|
this.IsReachEnd = true;
|
|
|
|
|
}
|
|
|
|
|
} // if response == 1
|
|
|
|
|
//this.pageNum++;
|
|
|
|
|
this.handleWorkListResult(result.GetWorkList);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
if (this.infiniteScroll && this.selectedFilter === 'ALL') {
|
|
|
|
|
this.infiniteScroll.complete();
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
if (this.infiniteScroll) this.infiniteScroll.complete();
|
|
|
|
|
}
|
|
|
|
|
} //end infiniteScroll
|
|
|
|
|
|
|
|
|
|
Count() {
|
|
|
|
|
this.workListService.getITGCount()
|
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
|
console.log('ENAD ITG COUNT:')
|
|
|
|
|
console.log(result);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Count() {
|
|
|
|
|
this.workListService.getITGCount()
|
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
|
console.log('ENAD ITG COUNT:')
|
|
|
|
|
console.log(result);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
filterNotificationByRequestType(reqType) {
|
|
|
|
|
let filterdType = [];
|
|
|
|
|
if (reqType == 'All') {
|
|
|
|
|
this.filteredNotificationList = this.WorkListResObj;
|
|
|
|
|
filterNotificationByRequestType(reqType) {
|
|
|
|
|
let filterdType = [];
|
|
|
|
|
if (reqType == 'All') {
|
|
|
|
|
this.filteredNotificationList = this.WorkListResObj;
|
|
|
|
|
if (this.filteredNotificationList == [] || this.filteredNotificationList == null || this.filteredNotificationList == '') {
|
|
|
|
|
this.noData = true;
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
this.noData = false;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (let i = 0; i < this.WorkListResObj.length; i++) {
|
|
|
|
|
if(reqType=='HR'){
|
|
|
|
|
if ('EIT' == this.WorkListResObj[i].REQUEST_TYPE || 'ABSENCE' == this.WorkListResObj[i].REQUEST_TYPE) {
|
|
|
|
|
filterdType.push(this.WorkListResObj[i]);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if (reqType == this.WorkListResObj[i].REQUEST_TYPE) {
|
|
|
|
|
filterdType.push(this.WorkListResObj[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.filteredNotificationList = filterdType;
|
|
|
|
|
if (this.filteredNotificationList == [] || this.filteredNotificationList == null || this.filteredNotificationList == '') {
|
|
|
|
|
this.noData = true;
|
|
|
|
|
return false;
|
|
|
|
|
@ -360,99 +445,78 @@ filterNotificationByRequestType(reqType) {
|
|
|
|
|
this.noData = false;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (let i = 0; i < this.WorkListResObj.length; i++) {
|
|
|
|
|
if(reqType=='HR'){
|
|
|
|
|
if ('EIT' == this.WorkListResObj[i].REQUEST_TYPE || 'ABSENCE' == this.WorkListResObj[i].REQUEST_TYPE) {
|
|
|
|
|
filterdType.push(this.WorkListResObj[i]);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if (reqType == this.WorkListResObj[i].REQUEST_TYPE) {
|
|
|
|
|
filterdType.push(this.WorkListResObj[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.filteredNotificationList = filterdType;
|
|
|
|
|
if (this.filteredNotificationList == [] || this.filteredNotificationList == null || this.filteredNotificationList == '') {
|
|
|
|
|
this.noData = true;
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
this.noData = false;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Details() {
|
|
|
|
|
this.workListService.getITGDetails()
|
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
|
console.log('ENAD ITG Details:')
|
|
|
|
|
console.log(result);
|
|
|
|
|
});
|
|
|
|
|
Details() {
|
|
|
|
|
this.workListService.getITGDetails()
|
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
|
console.log('ENAD ITG Details:')
|
|
|
|
|
console.log(result);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AllNotification() {
|
|
|
|
|
this.filterNotificationByRequestType('All');
|
|
|
|
|
this.isAll = true;
|
|
|
|
|
this.isPR = false;
|
|
|
|
|
this.isPO = false;
|
|
|
|
|
this.isMR = false;
|
|
|
|
|
this.isHR = false;
|
|
|
|
|
this.isITG = false;
|
|
|
|
|
}
|
|
|
|
|
PRNotification() {
|
|
|
|
|
this.filterNotificationByRequestType('PR');
|
|
|
|
|
this.isAll = false;
|
|
|
|
|
this.isPR = true;
|
|
|
|
|
this.isPO = false;
|
|
|
|
|
this.isMR = false;
|
|
|
|
|
this.isHR = false;
|
|
|
|
|
this.isITG = false;
|
|
|
|
|
AllNotification() {
|
|
|
|
|
this.filterNotificationByRequestType('All');
|
|
|
|
|
this.isAll = true;
|
|
|
|
|
this.isPR = false;
|
|
|
|
|
this.isPO = false;
|
|
|
|
|
this.isMR = false;
|
|
|
|
|
this.isHR = false;
|
|
|
|
|
this.isITG = false;
|
|
|
|
|
}
|
|
|
|
|
PONotification() {
|
|
|
|
|
this.filterNotificationByRequestType('PO');
|
|
|
|
|
this.isAll = false;
|
|
|
|
|
this.isPR = false;
|
|
|
|
|
this.isPO = true;
|
|
|
|
|
this.isMR = false;
|
|
|
|
|
this.isHR = false;
|
|
|
|
|
this.isITG = false;
|
|
|
|
|
|
|
|
|
|
PRNotification() {
|
|
|
|
|
this.filterNotificationByRequestType('PR');
|
|
|
|
|
this.isAll = false;
|
|
|
|
|
this.isPR = true;
|
|
|
|
|
this.isPO = false;
|
|
|
|
|
this.isMR = false;
|
|
|
|
|
this.isHR = false;
|
|
|
|
|
this.isITG = false;
|
|
|
|
|
}
|
|
|
|
|
MRNotification() {
|
|
|
|
|
this.filterNotificationByRequestType('MO');
|
|
|
|
|
this.isAll = false;
|
|
|
|
|
this.isPR = false;
|
|
|
|
|
this.isPO = false;
|
|
|
|
|
this.isMR = true;
|
|
|
|
|
this.isHR = false;
|
|
|
|
|
this.isITG = false;
|
|
|
|
|
}
|
|
|
|
|
HRNotification() {
|
|
|
|
|
this.filterNotificationByRequestType('HR');
|
|
|
|
|
this.isAll = false;
|
|
|
|
|
this.isPR = false;
|
|
|
|
|
this.isPO = false;
|
|
|
|
|
this.isMR = false;
|
|
|
|
|
this.isHR = true;
|
|
|
|
|
this.isITG = false;
|
|
|
|
|
|
|
|
|
|
PONotification() {
|
|
|
|
|
this.filterNotificationByRequestType('PO');
|
|
|
|
|
this.isAll = false;
|
|
|
|
|
this.isPR = false;
|
|
|
|
|
this.isPO = true;
|
|
|
|
|
this.isMR = false;
|
|
|
|
|
this.isHR = false;
|
|
|
|
|
this.isITG = false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
ITGNotification() {
|
|
|
|
|
// this.Details();
|
|
|
|
|
this.isAll = false;
|
|
|
|
|
this.isPR = false;
|
|
|
|
|
this.isPO = false;
|
|
|
|
|
this.isMR = false;
|
|
|
|
|
this.isHR = false;
|
|
|
|
|
this.isITG = true;
|
|
|
|
|
|
|
|
|
|
MRNotification() {
|
|
|
|
|
this.filterNotificationByRequestType('MO');
|
|
|
|
|
this.isAll = false;
|
|
|
|
|
this.isPR = false;
|
|
|
|
|
this.isPO = false;
|
|
|
|
|
this.isMR = true;
|
|
|
|
|
this.isHR = false;
|
|
|
|
|
this.isITG = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
searchBtn() {
|
|
|
|
|
this.isSearch = !this.isSearch;
|
|
|
|
|
HRNotification() {
|
|
|
|
|
this.filterNotificationByRequestType('HR');
|
|
|
|
|
this.isAll = false;
|
|
|
|
|
this.isPR = false;
|
|
|
|
|
this.isPO = false;
|
|
|
|
|
this.isMR = false;
|
|
|
|
|
this.isHR = true;
|
|
|
|
|
this.isITG = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|