From 0bf56649b954df9563c41b3c79878c9a65b6fa61 Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Tue, 26 Mar 2019 14:42:56 -0700 Subject: [PATCH] fixes to resource filtering --- .../src/app/staff/booking/manage-reservations.component.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts b/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts index 2c84add1dd..f346c472e0 100644 --- a/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts @@ -1,5 +1,6 @@ import {Component, OnInit, ViewChild} from '@angular/core'; import {Router, ActivatedRoute, ParamMap} from '@angular/router'; +import {single} from 'rxjs/operators'; import { NgbTabChangeEvent } from '@ng-bootstrap/ng-bootstrap'; import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; import {GridComponent} from '@eg/share/grid/grid.component'; @@ -77,10 +78,16 @@ export class ManageReservationsComponent implements OnInit { if (this.resourceBarcode) { this.pcrud.search('brsrc', - {'barcode' : this.resourceBarcode}, {'limit': 1, 'select': ['id']}) + {'barcode' : this.resourceBarcode}, {'limit': 1}) + .pipe(single()) .subscribe((res) => { - this.resourceId = res.id(); - this.reservationsGrid.reloadGrid(); + if (res.id()) { + this.resourceId = res.id(); + this.reservationsGrid.reloadGrid(); + } else { + this.resourceId = -1; + this.toast.danger('No resource found with this barcode'); + } }); } -- 2.11.0