From: Jane Sandberg Date: Tue, 26 Mar 2019 21:42:56 +0000 (-0700) Subject: fixes to resource filtering X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0bf56649b954df9563c41b3c79878c9a65b6fa61;p=working%2FEvergreen.git fixes to resource filtering --- 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'); + } }); }