added worklist filters logic

itg-new-design
umasoodch 6 years ago
parent 96971a6b68
commit 5208584999

@ -26,7 +26,7 @@
<ion-row class="filters-row"> <ion-row class="filters-row">
<ion-slides [options]="slideOptsOne"> <ion-slides [options]="slideOptsOne">
<ion-slide *ngFor="let filter of filters; let i=index"> <ion-slide *ngFor="let filter of filters; let i=index" [ngClass]="filter.disable === true ? 'disable-filter' : ''">
<app-card-filter <app-card-filter
[value]="filter.value" [value]="filter.value"
[text]="filter.name" [text]="filter.name"
@ -39,7 +39,7 @@
</ion-row> </ion-row>
<ion-row class="search-container"> <ion-row class="search-container">
<ion-col style="float: left;" size=[6] *ngIf="showSearchButton && selectedFilter === 'ALL'" (click)="clearSearch()"> <ion-col style="float: left;" size=[6] *ngIf="showSearchButton" (click)="clearSearch()">
<span style="margin-left: 5px;">Clear Search</span> <span style="margin-left: 5px;">Clear Search</span>
<ion-icon name="close" ></ion-icon> <ion-icon name="close" ></ion-icon>
</ion-col> </ion-col>

@ -221,9 +221,6 @@ ion-input ,ion-datetime{
///////////////////////////////////////////NEW DESIGN///////////////////////////////////// ///////////////////////////////////////////NEW DESIGN/////////////////////////////////////
.header-toolbar-new{
--background: #22c6b3;
}
.profile-image-container{ .profile-image-container{
position: relative; position: relative;
z-index: 999; z-index: 999;
@ -388,4 +385,8 @@ ion-content {
left: 50%; left: 50%;
margin-left: -100px; margin-left: -100px;
margin-top: 100px; margin-top: 100px;
} }
.disable-filter {
pointer-events: none;
opacity: .3;
}

@ -33,8 +33,6 @@ export class HomeComponent implements OnInit {
SentDate = ''; SentDate = '';
Subject = ''; Subject = '';
inputSearch = ''; inputSearch = '';
// HideDateInput = false;
// HideTextInput = false;
inputDate: string; inputDate: string;
filteredNotificationList: any; filteredNotificationList: any;
IsReachEnd = false; IsReachEnd = false;
@ -47,7 +45,7 @@ export class HomeComponent implements OnInit {
public isITG = false; public isITG = false;
public isSearch = false; public isSearch = false;
public direction = 'ltr'; public direction = 'ltr';
///// New /////////////
public currentActiveIndex = 0; public currentActiveIndex = 0;
public previousActiveIndex = 0; public previousActiveIndex = 0;
public worklistNotifications: any; public worklistNotifications: any;
@ -57,6 +55,7 @@ export class HomeComponent implements OnInit {
public showFormattedData = {}; public showFormattedData = {};
public selectedFilter = 'ALL'; public selectedFilter = 'ALL';
public showSearchButton = false; public showSearchButton = false;
public itemType = '';
public options = { public options = {
cutoutPercentage: 80, cutoutPercentage: 80,
tooltips: { enabled: false }, tooltips: { enabled: false },
@ -82,42 +81,48 @@ export class HomeComponent implements OnInit {
name: 'All', name: 'All',
active: true, active: true,
color: '#124375', color: '#124375',
key: 'ALL' key: 'ALL',
disable: false
}, },
{ {
value: 0, value: 0,
name: 'HR', name: 'HR',
active: false, active: false,
color: '#18a169', color: '#18a169',
key: 'HRSSA' key: 'HRSSA',
disable: false
}, },
{ {
value: 0, value: 0,
name: 'PO', name: 'PO',
active: false, active: false,
color: '#38c9b3', color: '#38c9b3',
key: 'POAPPRV' key: 'POAPPRV',
disable: false
}, },
{ {
value: 0, value: 0,
name: 'PR', name: 'PR',
active: false, active: false,
color: '#114475', color: '#114475',
key: 'REQAPPRV' key: 'REQAPPRV',
disable: false
}, },
{ {
value: 0, value: 0,
name: 'MR', name: 'MR',
active: false, active: false,
color: '#3cb9d5', color: '#3cb9d5',
key: 'INVMOA' key: 'INVMOA',
disable: false
}, },
{ {
value: 0, value: 0,
name: 'ITG', name: 'ITG',
active: false, active: false,
color: '#cc3232', color: '#cc3232',
key: 'ITG' key: 'ITG',
disable: false
} }
]; ];
public slideOptsOne = { public slideOptsOne = {
@ -168,9 +173,9 @@ export class HomeComponent implements OnInit {
} }
} }
} }
getFilteredData(filter: string) { getFilteredData(filter: string) {
if(filter === 'ALL') { if (filter === 'ALL') {
this.showFormattedData = this.allFormattedData; this.showFormattedData = this.allFormattedData;
} else { } else {
let arrayToFilter; let arrayToFilter;
@ -196,6 +201,25 @@ export class HomeComponent implements OnInit {
this.common.openProfile(); this.common.openProfile();
} }
disableFilters() {
for (const filter of this.filters) {
if (filter.key === this.itemType) {
filter.disable = false;
filter.active = true;
this.selectedFilter = filter.name;
} else if (this.itemType === 'none') {
filter.disable = false;
filter.active = false;
} else {
filter.disable = true;
filter.active = false;
}
}
if (this.itemType === 'none') {
this.filters[0].active = true;
}
}
async openSearchModal() { async openSearchModal() {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: WorklistAdvancedSearchComponent, component: WorklistAdvancedSearchComponent,
@ -205,9 +229,10 @@ export class HomeComponent implements OnInit {
}); });
modal.onDidDismiss().then(result => { modal.onDidDismiss().then(result => {
console.log(result.data); console.log(result.data);
if(result.data){ if (result.data) {
if(result.data.notificationType !== '' || result.data.selectedValue){ if (result.data.notificationType !== '' || result.data.selectedValue !== '' || result.data.itemType !== '') {
this.showSearchButton = true; this.showSearchButton = true;
this.itemType = result.data.itemType;
this.notificationType = result.data.notificationType; this.notificationType = result.data.notificationType;
this.selectedValue = result.data.selectedValue; this.selectedValue = result.data.selectedValue;
this.inputDate = result.data.inputDate; this.inputDate = result.data.inputDate;
@ -222,58 +247,24 @@ export class HomeComponent implements OnInit {
this.previousActiveIndex = 0; this.previousActiveIndex = 0;
this.filters[this.currentActiveIndex].active = true; this.filters[this.currentActiveIndex].active = true;
this.getAllPushNotificationFun(); this.getAllPushNotificationFun();
if (this.itemType !== '') {
this.disableFilters();
}
} }
} }
}); });
return await modal.present(); return await modal.present();
} }
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(); //filter with item type
}
getAllPushNotificationFun() { getAllPushNotificationFun() {
this.WorkListObj.P_PAGE_NUM = 1; this.WorkListObj.P_PAGE_NUM = 1;
this.IsReachEnd = false; this.IsReachEnd = false;
this.WorkListObj.P_SEARCH_FROM_USER = this.selectedValue === '1' ? this.inputSearch : '';
if (this.selectedValue === '1') { this.WorkListObj.P_SEARCH_SUBJECT = this.selectedValue === '2' ? this.inputSearch : '';
this.WorkListObj.P_SEARCH_FROM_USER = this.inputSearch; this.WorkListObj.P_SEARCH_SENT_DATE = (this.inputDate && this.selectedValue === '3')
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = ''; ? moment(this.inputDate).format('DD-MMM-YYYY') : '';
this.WorkListObj.P_SEARCH_SENT_DATE = ''; this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = this.selectedValue === '4' ? this.inputSearch : '';;
this.WorkListObj.P_SEARCH_SUBJECT = ''; if (this.selectedValue === '5') {
} 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_FROM_USER = '';
this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = ''; this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = '';
this.WorkListObj.P_SEARCH_SENT_DATE = ''; this.WorkListObj.P_SEARCH_SENT_DATE = '';
@ -290,10 +281,10 @@ export class HomeComponent implements OnInit {
categorizeData(arrayToCategorize: any) { categorizeData(arrayToCategorize: any) {
const datePipe = new DatePipe('en-US'); const datePipe = new DatePipe('en-US');
let formattedData = {}; const formattedData = {};
for (const workList of arrayToCategorize) { for (const workList of arrayToCategorize) {
workList.FORMATTED_DATE = datePipe.transform(new Date(workList.BEGIN_DATE), 'MMMM dd, y'); workList.FORMATTED_DATE = datePipe.transform(new Date(workList.BEGIN_DATE), 'MMMM dd, y');
if (!(workList.FORMATTED_DATE in formattedData)) { if (!(workList.FORMATTED_DATE in formattedData)) {
formattedData[workList.FORMATTED_DATE] = new Array(); formattedData[workList.FORMATTED_DATE] = new Array();
formattedData[workList.FORMATTED_DATE].push(workList); formattedData[workList.FORMATTED_DATE].push(workList);
} else { } else {
@ -323,7 +314,7 @@ export class HomeComponent implements OnInit {
} }
if (this.common.hasData(result)) { if (this.common.hasData(result)) {
this.WorkListObj.P_PAGE_NUM++; this.WorkListObj.P_PAGE_NUM++;
if(this.newWorkListResponse.length === 0) { if (this.newWorkListResponse.length === 0) {
this.newWorkListResponse = result; this.newWorkListResponse = result;
} else { } else {
this.newWorkListResponse = this.newWorkListResponse.concat(result); this.newWorkListResponse = this.newWorkListResponse.concat(result);
@ -342,22 +333,16 @@ export class HomeComponent implements OnInit {
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') {
else if(obj.REQUEST_TYPE == 'PO'){
this.common.openWorklistMainPOPage(); this.common.openWorklistMainPOPage();
} } else if (obj.REQUEST_TYPE === 'MO') {
else if(obj.REQUEST_TYPE == 'MO'){
this.common.openWorklistMainMRPage(); this.common.openWorklistMainMRPage();
} } else {
else{
this.common.openWorklistMainPage(); this.common.openWorklistMainPage();
} }
// this.navCtrl.push("WorkListMainPage", { passNotificationList: obj });
} }
isEmptyObject() { isEmptyObject() {
@ -365,6 +350,8 @@ export class HomeComponent implements OnInit {
} }
clearSearch() { clearSearch() {
this.itemType = 'none';
this.disableFilters();
this.showSearchButton = false; this.showSearchButton = false;
this.notificationType = ''; this.notificationType = '';
this.selectedValue = ''; this.selectedValue = '';
@ -398,7 +385,7 @@ export class HomeComponent implements OnInit {
} }
}); });
} else { } else {
if (this.infiniteScroll && this.selectedFilter === 'ALL') { if (this.infiniteScroll && this.selectedFilter === 'ALL') {
this.infiniteScroll.complete(); this.infiniteScroll.complete();
} }
} }
@ -407,105 +394,54 @@ export class HomeComponent implements OnInit {
Count() { Count() {
this.workListService.getITGCount() this.workListService.getITGCount()
.subscribe((result: any) => { .subscribe((result: any) => {
console.log('ENAD ITG COUNT:') console.log('ENAD ITG COUNT:');
console.log(result); console.log(result);
}); });
} }
filterNotificationByRequestType(reqType) { // filterNotificationByRequestType(reqType) {
let filterdType = []; // const filterdType = [];
if (reqType == 'All') { // if (reqType === 'All') {
this.filteredNotificationList = this.WorkListResObj; // this.filteredNotificationList = this.WorkListResObj;
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;
} else { // } else {
this.noData = false; // this.noData = false;
return false; // return false;
} // }
} // }
for (let i = 0; i < this.WorkListResObj.length; i++) { // for (let i = 0; i < this.WorkListResObj.length; i++) {
if(reqType=='HR'){ // if (reqType === 'HR') {
if ('EIT' == this.WorkListResObj[i].REQUEST_TYPE || 'ABSENCE' == this.WorkListResObj[i].REQUEST_TYPE) { // if ('EIT' === this.WorkListResObj[i].REQUEST_TYPE || 'ABSENCE' === this.WorkListResObj[i].REQUEST_TYPE) {
filterdType.push(this.WorkListResObj[i]); // filterdType.push(this.WorkListResObj[i]);
} // }
}else{ // } else {
if (reqType == this.WorkListResObj[i].REQUEST_TYPE) { // if (reqType === this.WorkListResObj[i].REQUEST_TYPE) {
filterdType.push(this.WorkListResObj[i]); // filterdType.push(this.WorkListResObj[i]);
} // }
} // }
} // }
this.filteredNotificationList = filterdType; // 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;
} else { // } else {
this.noData = false; // this.noData = false;
return 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() {
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;
}
PONotification() {
this.filterNotificationByRequestType('PO');
this.isAll = false;
this.isPR = false;
this.isPO = true;
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;
}
ITGNotification() { ITGNotification() {
// this.Details(); // this.Details();
this.isAll = false; this.isAll = false;

@ -1,18 +1,12 @@
// import { Request } from './request';
import { Request } from 'src/app/hmg-common/services/models/request'; import { Request } from 'src/app/hmg-common/services/models/request';
export class WorkListRequest extends Request{ export class WorkListRequest extends Request{
public static SHARED_DATA = 'login-request'; public static SHARED_DATA = 'login-request';
// Channel: Channel, //channel public P_NOTIFICATION_TYPE: string;
// LanguageID: LanguageID,//langlist public P_SEARCH_FROM_USER: string;
// P_USER_NAME:userName,//string public P_SEARCH_SUBJECT: string;
// P_SESSION_ID:sessionID,//number public P_SEARCH_SENT_DATE: string;
public P_NOTIFICATION_TYPE: string;//string public P_SEARCH_ITEM_TYPE_DSP_NAME: string;
public P_SEARCH_FROM_USER:string;//string public P_PAGE_NUM: number;
public P_SEARCH_SUBJECT:string;//string public P_PAGE_LIMIT: number;
public P_SEARCH_SENT_DATE:string;//string
public P_SEARCH_ITEM_TYPE_DSP_NAME:string;//string
public P_PAGE_NUM:number;//number
public P_PAGE_LIMIT:number;//number
} }

@ -46,14 +46,13 @@
</div> </div>
<ion-item lines="none"> <ion-item lines="none">
<ion-label>Request Type</ion-label> <ion-label>Item 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)]="requestType"> [(ngModel)]="itemType">
<ion-select-option value="1">{{ts.trPK('worklist','from')}}</ion-select-option> <ion-select-option value="HRSSA">HR</ion-select-option>
<ion-select-option value="2">{{ts.trPK('worklist','subject')}}</ion-select-option> <ion-select-option value="POAPPRV">PO</ion-select-option>
<ion-select-option value="3">{{ts.trPK('worklist','sent')}}</ion-select-option> <ion-select-option value="REQAPPRV">PR</ion-select-option>
<ion-select-option value="4">{{ts.trPK('worklist','itemType')}}</ion-select-option> <ion-select-option value="INVMOA">MR</ion-select-option>
<ion-select-option value="5">{{ts.trPK('worklist','none')}}</ion-select-option>
</ion-select> </ion-select>
</ion-item> </ion-item>

@ -9,12 +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 hideDateInput = false;
public hideTextInput: boolean = false; public hideTextInput = false;
public inputDate: string = ''; public inputDate = '';
public inputSearch: string = ''; public inputSearch = '';
public selectedValue: string = ''; public selectedValue = '';
public notificationType: string = ''; public notificationType = '';
public itemType = '';
constructor( constructor(
public modalController: ModalController, public modalController: ModalController,
@ -28,11 +29,13 @@ export class WorklistAdvancedSearchComponent implements OnInit {
} }
public search() { public search() {
console.log(this.itemType);
this.modalController.dismiss({ this.modalController.dismiss({
notificationType: this.notificationType, notificationType: this.notificationType,
selectedValue: this.selectedValue, selectedValue: this.selectedValue,
inputDate: this.inputDate, inputDate: this.inputDate,
inputSearch: this.inputSearch, inputSearch: this.inputSearch,
itemType: this.itemType
}); });
} }
@ -42,23 +45,21 @@ export class WorklistAdvancedSearchComponent implements OnInit {
getValueSelected(value) { getValueSelected(value) {
this.selectedValue = value.detail.value; this.selectedValue = value.detail.value;
if (this.selectedValue == '1') { if (this.selectedValue === '1') {
this.hideDateInput = false; this.hideDateInput = false;
this.hideTextInput = true; this.hideTextInput = true;
} else if (this.selectedValue == '2') { } else if (this.selectedValue === '2') {
this.hideDateInput = false; this.hideDateInput = false;
this.hideTextInput = true; this.hideTextInput = true;
} else if (this.selectedValue == '3') { } else if (this.selectedValue === '3') {
this.hideDateInput = true; this.hideDateInput = true;
this.hideTextInput = false; this.hideTextInput = false;
} else if (this.selectedValue == '4') { } else if (this.selectedValue === '4') {
this.hideDateInput = false; this.hideDateInput = false;
this.hideTextInput = true; this.hideTextInput = true;
} else if (this.selectedValue == '5') { } else if (this.selectedValue === '5') {
this.hideDateInput = false; this.hideDateInput = false;
this.hideTextInput = false; this.hideTextInput = false;
} }
} }
} }

Loading…
Cancel
Save