Adding action -- not working yet
authorJane Sandberg <sandbej@linnbenton.edu>
Thu, 13 Dec 2018 05:05:47 +0000 (21:05 -0800)
committerJane Sandberg <sandbej@linnbenton.edu>
Wed, 23 Jan 2019 23:08:13 +0000 (15:08 -0800)
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/booking/current-reservations.component.html
Open-ILS/src/eg2/src/app/staff/booking/current-reservations.component.ts

index 3584de9..ea7fb20 100644 (file)
@@ -6,6 +6,7 @@
   [sortable]="true" persistKey="booking.current_reservations" >
   <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-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>
@@ -34,6 +35,5 @@
 
 <eg-fm-record-editor #editDialog
   idlClass="bresv"
-  mode="update"
   readonlyFields="usr,xact_start,xact_finish,request_time,capture_time,cancel_time,pickup_time,return_time,capture_staff">
 </eg-fm-record-editor>
index 4b0384c..acaf2eb 100644 (file)
@@ -26,9 +26,11 @@ export class CurrentReservationsComponent implements OnInit {
 
   editSelected: (rows: IdlObject[]) => void;
   cancelSelected: (rows: IdlObject[]) => void;
+  viewByPatron: (rows: IdlObject[]) => void;
 
   constructor(
     private route: ActivatedRoute,
+    private router: Router,
     private toast: ToastService,
     private pcrud: PcrudService,
     private auth: AuthService,
@@ -76,6 +78,12 @@ export class CurrentReservationsComponent implements OnInit {
       this.grid.reload();
     }
 
+    this.viewByPatron = (reservations: IdlObject[]) => {
+      let patronIds = reservations.map(reservation => reservation.usr().id());
+      this.router.navigate(['/staff', 'booking', 'current_reservations', 'by_patron', patronIds[0]]);
+    }
+
+    this.editDialog.mode = 'update'; // this fmeditor is not used for creating objects, just updates
   }
 
   showEditDialog(idlThing: IdlObject) {