completed worklist task

MOHEMM-Q3-DEV-LATEST
umasoodch 6 years ago
parent d2fac5c4d5
commit 9177721b59

@ -200,4 +200,4 @@
"android" "android"
] ]
} }
} }

@ -521,6 +521,7 @@ export class HomePage implements OnInit {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
const key = 'P_OPEN_NTF_NUMBER'; const key = 'P_OPEN_NTF_NUMBER';
this.statsButtons[0].statsValue = result[key]; this.statsButtons[0].statsValue = result[key];
this.common.sharedService.setSharedData(result, 'worklistNotifications');
} }
}); });
} }

@ -1,21 +1,12 @@
<!-- <ion-header>
<ion-toolbar class="header-toolbar">
<ion-title color="light"> {{ts.trPK('home','worklist')}}</ion-title>
<ion-buttons slot="start">
<nav-buttons backLink="/home"></nav-buttons>
</ion-buttons>
</ion-toolbar>
</ion-header> -->
<ion-header> <ion-header>
<ion-toolbar class="header-toolbar-new"> <ion-toolbar class="header-toolbar-new">
<ion-buttons slot="start"> <ion-buttons slot="start">
<nav-buttons backLink="/home"></nav-buttons> <nav-buttons backLink="/home"></nav-buttons>
</ion-buttons> </ion-buttons>
<ion-title>WORK LIST</ion-title> <ion-title>WORK LIST</ion-title>
<div class="profile-image-container" (click)="openProfilePage()"> <!-- <div class="profile-image-container" (click)="openProfilePage()">
<img [src]="userImage"/> <img [src]="userImage"/>
</div> </div> -->
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
@ -27,7 +18,7 @@
<span>Open Request Analysis</span> <span>Open Request Analysis</span>
</div> </div>
<div class="result-text-container"> <div class="result-text-container">
<h2>287</h2> <h2>{{totalRequestCount}}</h2>
<span>TOTAL <br> OPEN REQUEST</span> <span>TOTAL <br> OPEN REQUEST</span>
</div> </div>
<p-chart class="today-graph" type="doughnut" [data]="data" [options]="options"></p-chart> <p-chart class="today-graph" type="doughnut" [data]="data" [options]="options"></p-chart>
@ -38,7 +29,7 @@
<ion-slide *ngFor="let filter of filters; let i=index"> <ion-slide *ngFor="let filter of filters; let i=index">
<app-card-filter <app-card-filter
[value]="filter.value" [value]="filter.value"
[text]="filter.text" [text]="filter.name"
[color]="filter.color" [color]="filter.color"
[active]="filter.active" [active]="filter.active"
(click)="activeFilter(i)" (click)="activeFilter(i)"
@ -47,43 +38,34 @@
</ion-slides> </ion-slides>
</ion-row> </ion-row>
<ion-row class="search-container" (click)="openSearchModal()"> <ion-row class="search-container">
<ion-icon name="search" ></ion-icon> <ion-col style="float: left;" size=[6] *ngIf="showSearchButton && selectedFilter === 'ALL'" (click)="clearSearch()">
<span>Advanced Search</span> <span style="margin-left: 5px;">Clear Search</span>
<ion-icon name="close" ></ion-icon>
</ion-col>
<ion-col style="float: right;" size=[6] (click)="openSearchModal()" *ngIf="selectedFilter === 'ALL'">
<ion-icon name="search" ></ion-icon>
<span>Advanced Search</span>
</ion-col>
</ion-row> </ion-row>
<div class="work-list-container"> <div [ngClass]="isEmptyObject() ? 'work-list-container' : ''">
<div> <div *ngFor="let data of showFormattedData | keyvalue; let i = index">
<span class="date-span">December 02, 2019</span> <span class="date-span">{{data.key}}</span>
<div class="date-data"> <div class="date-data" *ngFor="let workList of data.value; let j = index">
<p>Missing swipes request for James Bond, Approved by David</p> <p>{{workList.SUBJECT}}</p>
</div>
<div class="date-data">
<p>Missing swipes request for James Bond, Approved by David</p>
</div>
<div class="date-data">
<p>Missing swipes request for James Bond, Approved by David</p>
</div>
<div class="date-data">
<p>Missing swipes request for James Bond, Approved by David</p>
</div>
</div>
<div>
<span class="date-span">December 02, 2019</span>
<div class="date-data">
<p>Missing swipes request for James Bond, Approved by David</p>
</div>
<div class="date-data">
<p>Missing swipes request for James Bond, Approved by David</p>
</div>
<div class="date-data">
<p>Missing swipes request for James Bond, Approved by David</p>
</div>
<div class="date-data">
<p>Missing swipes request for James Bond, Approved by David</p>
</div> </div>
</div> </div>
</div> </div>
<div class="no-data-available" *ngIf="!isEmptyObject()">
<span>No Data Available</span>
</div>
</div> </div>
<ion-infinite-scroll *ngIf="selectedFilter === 'ALL'" (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content> </ion-content>

@ -321,6 +321,7 @@ ion-content {
clear: both; clear: both;
min-height: 200px; min-height: 200px;
margin-bottom: 80px; margin-bottom: 80px;
padding-top: 15px;
} }
.work-list-container:before{ .work-list-container:before{
content: ""; content: "";
@ -328,23 +329,28 @@ ion-content {
height: 100%; height: 100%;
width: 4px; width: 4px;
left: 30px; left: 30px;
top: 0; top: 15px;
background-color: #dddddd; background-color: #dddddd;
} }
.search-container{ .search-container{
float: right;
margin-top: 15px; margin-top: 15px;
background-color: white; display: block;
margin-right: 20px; padding: 0 20px;
border-radius: 10px; ion-col{
padding: 8px; background: white;
font-family: WorkSans-Regular; border-radius: 12px;
margin-bottom: 15px; padding-right: 10px;
ion-icon { flex: none;
margin-right: 3px; ion-icon{
} margin-right: 3px;
span{ font-size: 14px;
font-size: 12px; margin-left: 3px;
vertical-align: middle;
}
span{
font-size: 12px;
vertical-align: middle;
}
} }
} }
.date-span { .date-span {
@ -373,4 +379,13 @@ ion-content {
p{ p{
font-size: 14px; font-size: 14px;
} }
}
.no-data-available {
background: white;
font-family: WorkSans-Regular;
padding: 30px;
position: absolute;
left: 50%;
margin-left: -100px;
margin-top: 100px;
} }

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

@ -1,4 +1,5 @@
<div class="search-header" (click)="dismissModal()"> <ion-content>
<div class="search-header" (click)="dismissModal()">
<h2>Advanced Search</h2> <h2>Advanced Search</h2>
<ion-icon slot="icon-only" name="md-close"></ion-icon> <ion-icon slot="icon-only" name="md-close"></ion-icon>
</div> </div>
@ -8,8 +9,8 @@
<ion-item lines="none"> <ion-item lines="none">
<ion-label>{{ts.trPK('worklist','view')}}</ion-label> <ion-label>{{ts.trPK('worklist','view')}}</ion-label>
<ion-select okText="{{ts.trPK('general','ok')}}" cancelText="{{ts.trPK('general','cancel')}}" <ion-select okText="{{ts.trPK('general','ok')}}" cancelText="{{ts.trPK('general','cancel')}}"
[(ngModel)]="notificationType" (ionChange)=onChangeView($event)> (ionChange)=onChangeView($event)>
<ion-select-option value="1" selected="true">{{ts.trPK('worklist','openNot')}}</ion-select-option> <ion-select-option value="1">{{ts.trPK('worklist','openNot')}}</ion-select-option>
<ion-select-option value="2">{{ts.trPK('worklist','fyi')}}</ion-select-option> <ion-select-option value="2">{{ts.trPK('worklist','fyi')}}</ion-select-option>
<ion-select-option value="3">{{ts.trPK('worklist','toDo')}}</ion-select-option> <ion-select-option value="3">{{ts.trPK('worklist','toDo')}}</ion-select-option>
<ion-select-option value="4">{{ts.trPK('worklist','all')}}</ion-select-option> <ion-select-option value="4">{{ts.trPK('worklist','all')}}</ion-select-option>
@ -17,10 +18,10 @@
</ion-select> </ion-select>
</ion-item> </ion-item>
<ion-item lines="none"> <ion-item lines="none" [ngStyle]="(hideDateInput === true || hideTextInput === true) ? {'margin-bottom': '0px'} : {}">
<ion-label>{{ts.trPK('worklist','searchby')}}</ion-label> <ion-label>{{ts.trPK('worklist','searchby')}}</ion-label>
<ion-select okText="{{ts.trPK('general','ok')}}" cancelText="{{ts.trPK('general','cancel')}}" <ion-select okText="{{ts.trPK('general','ok')}}" cancelText="{{ts.trPK('general','cancel')}}"
[(ngModel)]="searchBy" (ionChange)="getValueSelected($event)"> (ionChange)="getValueSelected($event)">
<ion-select-option value="1">{{ts.trPK('worklist','from')}}</ion-select-option> <ion-select-option value="1">{{ts.trPK('worklist','from')}}</ion-select-option>
<ion-select-option value="2">{{ts.trPK('worklist','subject')}}</ion-select-option> <ion-select-option value="2">{{ts.trPK('worklist','subject')}}</ion-select-option>
<ion-select-option value="3">{{ts.trPK('worklist','sent')}}</ion-select-option> <ion-select-option value="3">{{ts.trPK('worklist','sent')}}</ion-select-option>
@ -28,21 +29,39 @@
<ion-select-option value="5">{{ts.trPK('worklist','none')}}</ion-select-option> <ion-select-option value="5">{{ts.trPK('worklist','none')}}</ion-select-option>
</ion-select> </ion-select>
</ion-item> </ion-item>
<div>
<div *ngIf="hideDateInput">
<ion-item lines='none' style="border-radius: 10px;margin-right: 10px;margin-left: 10px;margin-top: 5px;">
<ion-label>{{ts.trPK('worklist','sent')}} </ion-label>
<ion-datetime placeholder="{{ts.trPK('worklist','enter')}}" displayFormat="DD-MMM-YYYY"
pickerFormat="DD-MMM-YYYY" [(ngModel)]="inputDate"></ion-datetime>
</ion-item>
</div>
<div *ngIf="hideTextInput">
<ion-item lines='none' style="border-radius: 10px;margin-right: 10px;margin-left: 10px;margin-top: 5px;">
<ion-input placeholder="{{ts.trPK('worklist','enter')}}" [(ngModel)]="inputSearch">
</ion-input>
</ion-item>
</div>
</div>
<ion-item lines="none"> <ion-item lines="none">
<ion-label>Request Type</ion-label> <ion-label>Request Type</ion-label>
<ion-select okText="{{ts.trPK('general','ok')}}" cancelText="{{ts.trPK('general','cancel')}}" <ion-select okText="{{ts.trPK('general','ok')}}" cancelText="{{ts.trPK('general','cancel')}}"
[(ngModel)]="searchBy" (ionChange)="getValueSelected($event)"> [(ngModel)]="requestType">
<ion-select-option value="1">{{ts.trPK('worklist','from')}}</ion-select-option> <ion-select-option value="1">{{ts.trPK('worklist','from')}}</ion-select-option>
<ion-select-option value="2">{{ts.trPK('worklist','subject')}}</ion-select-option> <ion-select-option value="2">{{ts.trPK('worklist','subject')}}</ion-select-option>
<ion-select-option value="3">{{ts.trPK('worklist','sent')}}</ion-select-option> <ion-select-option value="3">{{ts.trPK('worklist','sent')}}</ion-select-option>
<ion-select-option value="4">{{ts.trPK('worklist','itemType')}}</ion-select-option> <ion-select-option value="4">{{ts.trPK('worklist','itemType')}}</ion-select-option>
<ion-select-option value="5">{{ts.trPK('worklist','none')}}</ion-select-option> <ion-select-option value="5">{{ts.trPK('worklist','none')}}</ion-select-option>
</ion-select> </ion-select>
</ion-item> </ion-item>
<div class="search-button"> <div class="search-button" (click)="search()">
<span>SEARCH</span> <span>SEARCH</span>
</div> </div>
</div> </div>
</ion-content>

@ -9,6 +9,13 @@ import { TranslatorService } from 'src/app/hmg-common/services/translator/transl
}) })
export class WorklistAdvancedSearchComponent implements OnInit { export class WorklistAdvancedSearchComponent implements OnInit {
public hideDateInput: boolean = false;
public hideTextInput: boolean = false;
public inputDate: string = '';
public inputSearch: string = '';
public selectedValue: string = '';
public notificationType: string = '';
constructor( constructor(
public modalController: ModalController, public modalController: ModalController,
public ts: TranslatorService public ts: TranslatorService
@ -17,14 +24,41 @@ export class WorklistAdvancedSearchComponent implements OnInit {
ngOnInit() {} ngOnInit() {}
public dismissModal() { public dismissModal() {
console.log('umar 545'); this.modalController.dismiss();
}
public search() {
this.modalController.dismiss({ this.modalController.dismiss({
// dismissed: true, notificationType: this.notificationType,
// keySelectedFilters: selectedFilters, selectedValue: this.selectedValue,
// selectedShiftType: this.selectedShiftType, inputDate: this.inputDate,
// dateFrom: this.dateFrom, inputSearch: this.inputSearch,
// dateTo: this.dateTo
}); });
} }
onChangeView(selectedValue: any) {
this.notificationType = selectedValue.detail.value;
}
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;
}
}
} }

Loading…
Cancel
Save