adding a toast message when filtering reservations by invalid patron barcode
authorJane Sandberg <sandbej@linnbenton.edu>
Tue, 26 Mar 2019 20:24:16 +0000 (13:24 -0700)
committerJane Sandberg <sandbej@linnbenton.edu>
Tue, 26 Mar 2019 20:24:16 +0000 (13:24 -0700)
Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts

index f37022b..2c84add 100644 (file)
@@ -1,12 +1,13 @@
 import {Component, OnInit, ViewChild} from '@angular/core';
+import {Router, ActivatedRoute, ParamMap} from '@angular/router';
 import { NgbTabChangeEvent } from '@ng-bootstrap/ng-bootstrap';
 import {ComboboxEntry} from '@eg/share/combobox/combobox.component';
 import {GridComponent} from '@eg/share/grid/grid.component';
 import {PatronService} from '@eg/staff/share/patron.service';
 import {PcrudService} from '@eg/core/pcrud.service';
 import {ReservationsGridComponent} from './reservations-grid.component';
-import {Router, ActivatedRoute, ParamMap} from '@angular/router';
 import {ServerStoreService} from '@eg/core/server-store.service';
+import {ToastService} from '@eg/share/toast/toast.service';
 
 @Component({
     selector: 'eg-manage-reservations',
@@ -35,7 +36,8 @@ export class ManageReservationsComponent implements OnInit {
         private router: Router,
         private pcrud: PcrudService,
         private patron: PatronService,
-        private store: ServerStoreService
+       private store: ServerStoreService,
+        private toast: ToastService
     ) {
         // This is in the constructor, because we need it first thing in ngOnInit
         this.chooseAppropriateFilter = () => {
@@ -95,6 +97,8 @@ export class ManageReservationsComponent implements OnInit {
                 this.patron.bcSearch(this.patronBarcode).subscribe(
                     (response) => {
                         this.router.navigate(['/staff', 'booking', 'manage_reservations', 'by_patron', response[0].id]);
+                    }, (error) => {
+                        this.toast.danger('No patron found with this barcode');
                 });
             } else {
                 this.removeFilters();