Add Show Reservations for Resources
authorJane Sandberg <sandbej@linnbenton.edu>
Tue, 22 Jan 2019 23:10:55 +0000 (15:10 -0800)
committerJane Sandberg <sandbej@linnbenton.edu>
Tue, 22 Jan 2019 23:10:55 +0000 (15:10 -0800)
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.html
Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts

index 622bbb1..d419ebe 100644 (file)
@@ -7,6 +7,7 @@
   <eg-grid-toolbar-action label="Edit Selected" i18n-label [action]="editSelected"></eg-grid-toolbar-action>
   <eg-grid-toolbar-action label="Cancel Selected" i18n-label [action]="cancelSelected"></eg-grid-toolbar-action>
   <eg-grid-toolbar-action label="View Reservations for This Patron" i18n-label [action]="viewByPatron"></eg-grid-toolbar-action>
+  <eg-grid-toolbar-action label="View Reservations for This Resource" i18n-label [action]="viewByResource"></eg-grid-toolbar-action>
   <eg-grid-column name="id" [hidden]="true" [index]="true" i18n-label label="ID" path="id"></eg-grid-column>
   <eg-grid-column i18n-label [hidden]="true" path="usr.first_given_name"></eg-grid-column>
   <eg-grid-column i18n-label [hidden]="true" path="usr.second_given_name"></eg-grid-column>
index b5a64cb..dc7646d 100644 (file)
@@ -34,6 +34,7 @@ export class ManageReservationsComponent implements OnInit {
   editSelected: (rows: IdlObject[]) => void;
   cancelSelected: (rows: IdlObject[]) => void;
   viewByPatron: (rows: IdlObject[]) => void;
+  viewByResource: (rows: IdlObject[]) => void;
 
   constructor(
     private route: ActivatedRoute,
@@ -98,6 +99,11 @@ export class ManageReservationsComponent implements OnInit {
       const patronIds = reservations.map(reservation => reservation.usr().id());
       this.router.navigate(['/staff', 'booking', 'manage_reservations', 'by_patron', patronIds[0]]);
     }
+    this.viewByResource = (reservations: IdlObject[]) => {
+      const resourceBarcodes = reservations.map(reservation => reservation.target_resource().barcode());
+      this.router.navigate(['/staff', 'booking', 'manage_reservations', 'by_resource', resourceBarcodes[0]]);
+    }
+
 
     this.editDialog.mode = 'update'; // this fmeditor is not used for creating objects, just updates