diff --git a/src/frontend/app/list/basket-list.component.ts b/src/frontend/app/list/basket-list.component.ts index 11b293aec2f485cb10707c921737c648a6405f1b..d2df30ac241fe67c47af4fb507117b8db1440d23 100755 --- a/src/frontend/app/list/basket-list.component.ts +++ b/src/frontend/app/list/basket-list.component.ts @@ -147,7 +147,7 @@ export class BasketListComponent implements OnInit { window['MainHeaderComponent'].setSnav(this.sidenavLeft); window['MainHeaderComponent'].setSnavRight(this.sidenavRight); - this.listProperties = this.filtersListService.initListsProperties('bbain', params['groupSerialId'], params['basketId']); + this.listProperties = this.filtersListService.initListsProperties(this.currentBasketInfo.ownerId, this.currentBasketInfo.groupId, this.currentBasketInfo.basketId); this.refreshDao(); diff --git a/src/frontend/service/filtersList.service.ts b/src/frontend/service/filtersList.service.ts index 1cc8f24b50fad3c273e3def488c1292d32057783..d2639e3eea9694cea9f2aea4cae9eeca850b9630 100644 --- a/src/frontend/service/filtersList.service.ts +++ b/src/frontend/service/filtersList.service.ts @@ -1,18 +1,18 @@ import { Injectable } from '@angular/core'; interface listProperties { - 'id' : string, - 'groupId' : number, - 'basketId' : number, - 'page' : string, - 'order' : string, - 'orderDir' : string, - 'search' : string, + 'id': number, + 'groupId': number, + 'basketId': number, + 'page': string, + 'order': string, + 'orderDir': string, + 'search': string, 'delayed': boolean, - 'categories' : string[], - 'priorities' : string[], - 'entities' : string[], - 'statuses' : string[] + 'categories': string[], + 'priorities': string[], + 'entities': string[], + 'statuses': string[] } @Injectable() @@ -26,11 +26,11 @@ export class FiltersListService { this.listsProperties = JSON.parse(sessionStorage.getItem('propertyList')); } - initListsProperties(userId: string, groupId: number, basketId: number) { + initListsProperties(userId: number, groupId: number, basketId: number) { + this.listsPropertiesIndex = 0; let listProperties: listProperties; - if (this.listsProperties != null) { this.listsProperties.forEach((element, index) => { if (element.id == userId && element.groupId == groupId && element.basketId == basketId) { @@ -39,38 +39,39 @@ export class FiltersListService { } }); } else { - this.listsProperties = []; + this.listsProperties = []; } if (!listProperties) { listProperties = { - 'id' : userId, - 'groupId' : groupId, - 'basketId' : basketId, - 'page' : '0', - 'order' : '', - 'orderDir' : 'DESC', - 'search' : '', + 'id': userId, + 'groupId': groupId, + 'basketId': basketId, + 'page': '0', + 'order': '', + 'orderDir': 'DESC', + 'search': '', 'delayed': false, - 'categories' : [], - 'priorities' : [], - 'entities' : [], - 'statuses' : [], + 'categories': [], + 'priorities': [], + 'entities': [], + 'statuses': [], }; this.listsProperties.push(listProperties); this.saveListsProperties(); } + return listProperties; } - updateListsPropertiesPage(page : number) { + updateListsPropertiesPage(page: number) { if (this.listsProperties) { this.listsProperties[this.listsPropertiesIndex].page = page; this.saveListsProperties(); - } + } } - - updateListsProperties(listProperties : any) { + + updateListsProperties(listProperties: any) { if (this.listsProperties) { this.listsProperties[this.listsPropertiesIndex] = listProperties; this.saveListsProperties(); @@ -81,53 +82,53 @@ export class FiltersListService { sessionStorage.setItem('propertyList', JSON.stringify(this.listsProperties)); } - getUrlFilters () { + getUrlFilters() { let filters = ''; if (this.listsProperties) { if (this.listsProperties[this.listsPropertiesIndex].delayed) { filters += '&delayed=true'; } if (this.listsProperties[this.listsPropertiesIndex].order.length > 0) { - filters += '&order='+this.listsProperties[this.listsPropertiesIndex].order + ' ' + this.listsProperties[this.listsPropertiesIndex].orderDir; + filters += '&order=' + this.listsProperties[this.listsPropertiesIndex].order + ' ' + this.listsProperties[this.listsPropertiesIndex].orderDir; } if (this.listsProperties[this.listsPropertiesIndex].search.length > 0) { - filters += '&search='+this.listsProperties[this.listsPropertiesIndex].search; + filters += '&search=' + this.listsProperties[this.listsPropertiesIndex].search; } if (this.listsProperties[this.listsPropertiesIndex].categories.length > 0) { let cat: any[] = []; this.listsProperties[this.listsPropertiesIndex].categories.forEach((element: any) => { cat.push(element.id); }); - - filters += '&categories='+cat.join(','); + + filters += '&categories=' + cat.join(','); } if (this.listsProperties[this.listsPropertiesIndex].priorities.length > 0) { let prio: any[] = []; this.listsProperties[this.listsPropertiesIndex].priorities.forEach((element: any) => { prio.push(element.id); }); - - filters += '&priorities='+prio.join(','); + + filters += '&priorities=' + prio.join(','); } if (this.listsProperties[this.listsPropertiesIndex].statuses.length > 0) { let status: any[] = []; this.listsProperties[this.listsPropertiesIndex].statuses.forEach((element: any) => { status.push(element.id); }); - - filters += '&statuses='+status.join(','); + + filters += '&statuses=' + status.join(','); } - + if (this.listsProperties[this.listsPropertiesIndex].entities.length > 0) { let ent: any[] = []; this.listsProperties[this.listsPropertiesIndex].entities.forEach((element: any) => { ent.push(element.id); }); - - filters += '&entities='+ent.join(','); + + filters += '&entities=' + ent.join(','); } } return filters; } - + }