diff --git a/angular/src/app/cockpit-area/order-cockpit/order-cockpit.component.ts b/angular/src/app/cockpit-area/order-cockpit/order-cockpit.component.ts index 2087e792f..724852c28 100644 --- a/angular/src/app/cockpit-area/order-cockpit/order-cockpit.component.ts +++ b/angular/src/app/cockpit-area/order-cockpit/order-cockpit.component.ts @@ -24,7 +24,7 @@ export class OrderCockpitComponent implements OnInit { private pageable: Pageable = { pageSize: 8, pageNumber: 0, - //total: 1, + // total: 1, }; private sorting: any[] = []; @@ -69,7 +69,11 @@ export class OrderCockpitComponent implements OnInit { applyFilters(): void { this.waiterCockpitService.getOrders(this.pageable, this.sorting, this.filters) .subscribe((data: any) => { - this.orders = data.content; + if (!data) { + this.orders = []; + } else { + this.orders = data.content; + } this.totalOrders = data.totalElements; }); } @@ -84,7 +88,6 @@ export class OrderCockpitComponent implements OnInit { pageSize: pagingEvent.pageSize, pageNumber: pagingEvent.page - 1, sort: this.pageable.sort, - //total: 1, }; this.applyFilters(); } @@ -95,7 +98,7 @@ export class OrderCockpitComponent implements OnInit { property: sortEvent.name, direction: '' + sortEvent.order, }); - this.applyFilters(); + this.applyFilters(); } selected(selection: ITdDataTableSelectAllEvent): void { diff --git a/angular/src/app/cockpit-area/reservation-cockpit/reservation-cockpit.component.ts b/angular/src/app/cockpit-area/reservation-cockpit/reservation-cockpit.component.ts index 8feae7ace..9b05d24d4 100644 --- a/angular/src/app/cockpit-area/reservation-cockpit/reservation-cockpit.component.ts +++ b/angular/src/app/cockpit-area/reservation-cockpit/reservation-cockpit.component.ts @@ -27,10 +27,10 @@ export class ReservationCockpitComponent implements OnInit { pageable: Pageable = { pageSize: 8, pageNumber: 0, - //total: 1, + // total: 1, }; - reservations: ReservationView; + reservations: ReservationView[]; totalReservations: number; columns: ITdDataTableColumn[]; @@ -74,7 +74,11 @@ export class ReservationCockpitComponent implements OnInit { applyFilters(): void { this.waiterCockpitService.getReservations(this.pageable, this.sorting, this.filters) .subscribe((data: any) => { - this.reservations = data.content; + if (!data) { + this.reservations = []; + } else { + this.reservations = data.content; + } this.totalReservations = data.totalElements; }); } @@ -89,7 +93,7 @@ export class ReservationCockpitComponent implements OnInit { pageSize: pagingEvent.pageSize, pageNumber: pagingEvent.page - 1, sort: this.pageable.sort, - //total: 1, + // total: 1, }; this.applyFilters(); } diff --git a/angular/src/app/menu/menu.component.ts b/angular/src/app/menu/menu.component.ts index ffa5c4912..3d9431eee 100644 --- a/angular/src/app/menu/menu.component.ts +++ b/angular/src/app/menu/menu.component.ts @@ -24,11 +24,6 @@ export class MenuComponent { dishes$: Observable; - /*pageable: Pageable = { - pageSize: 8, - pageNumber: 0, - };*/ - constructor( private menuService: MenuService, ) {} @@ -39,12 +34,18 @@ export class MenuComponent { pageNumber: 0, sort: [{ property: filters.sort.property, - direction: filters.sort.direction - }] - }; - const composedFilters: Filter = this.menuService.composeFilters(pageable,filters); + direction: filters.sort.direction, + }], + }; + const composedFilters: Filter = this.menuService.composeFilters(pageable, filters); this.dishes$ = this.menuService.getDishes(composedFilters).pipe( - map((res) => res.content), + map((res) => { + if (!res) { + return []; + } else { + return res.content; + } + }), ); } } diff --git a/angular/src/app/menu/shared/menu.service.ts b/angular/src/app/menu/shared/menu.service.ts index 369a28cda..b438fbe52 100644 --- a/angular/src/app/menu/shared/menu.service.ts +++ b/angular/src/app/menu/shared/menu.service.ts @@ -36,14 +36,14 @@ export class MenuService { }; } - composeFilters(pageable: Pageable,filters: FilterFormData): Filter { + composeFilters(pageable: Pageable, filters: FilterFormData): Filter { const categories: { id: string }[] = Object.keys(filters.categories) .filter((categoryKey: string) => filters.categories[categoryKey]) .map((categoryKey: string) => ({id: categoryNameToServerId[categoryKey].toString()})); - if (filters.sort.property == null) { - filters.sort = null; - pageable.sort = null; - } + if (!filters.sort.property) { + filters.sort = undefined; + pageable.sort = undefined; + } return { categories, diff --git a/java/mtsj/pom.xml b/java/mtsj/pom.xml index aaf06cc70..f5f24e094 100644 --- a/java/mtsj/pom.xml +++ b/java/mtsj/pom.xml @@ -12,7 +12,7 @@ 2.0.4.RELEASE - 3.0.0-alpha.1 + 3.0.0 1.8 81 ${devon.port.range}81