LP1904036 place new hold button/action
authorBill Erickson <berickxx@gmail.com>
Tue, 2 Mar 2021 16:46:35 +0000 (11:46 -0500)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:25 +0000 (20:13 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/circ/patron/holds.component.html
Open-ILS/src/eg2/src/app/staff/circ/patron/holds.component.ts
Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.html
Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts

index 8ada06b..13d5bd5 100644 (file)
@@ -8,6 +8,8 @@
       <eg-holds-grid 
         printTemplate="holds_for_patron"
         persistKey="circ.patron.holds"
+        (placeHoldRequested)="newHold()"
+        [showPlaceHoldButton]="true"
         [hidePickupLibFilter]="true"
         [defaultSort]="[{name:'request_time',dir:'asc'}]"
         [patronId]="context.patron.id()"></eg-holds-grid>
index e7ed104..86dc486 100644 (file)
@@ -13,6 +13,7 @@ import {PatronContextService} from './patron.service';
 export class HoldsComponent implements OnInit {
 
     constructor(
+        private router: Router,
         private org: OrgService,
         private net: NetService,
         public patronService: PatronService,
@@ -22,5 +23,9 @@ export class HoldsComponent implements OnInit {
     ngOnInit() {
     }
 
+    newHold() {
+        this.router.navigate(['/staff/catalog/search'],
+          {queryParams: {holdForBarcode: this.context.patron.card().barcode()}});
+    }
 }
 
index f52e36f..eecc626 100644 (file)
         </eg-grid-toolbar-checkbox>
       </ng-container>
 
+      <ng-container *ngIf="showPlaceHoldButton">
+        <eg-grid-toolbar-button
+          i18n-label label="Place Hold" (onClick)="placeHoldRequested.emit()">
+        </eg-grid-toolbar-button>
+      </ng-container>
+
       <eg-grid-toolbar-action
         i18n-label label="Show Hold Details" i18n-group group="Hold"
         (onClick)="showDetails($event)"></eg-grid-toolbar-action>
index 357074a..9c6a9a3 100644 (file)
@@ -1,4 +1,4 @@
-import {Component, OnInit, Input, ViewChild} from '@angular/core';
+import {Component, OnInit, Input, Output, EventEmitter, ViewChild} from '@angular/core';
 import {Location} from '@angular/common';
 import {Observable, Observer, of} from 'rxjs';
 import {IdlObject} from '@eg/core/idl.service';
@@ -50,6 +50,10 @@ export class HoldsGridComponent implements OnInit {
 
     @Input() printTemplate: string;
 
+    // Adds a Place Hold grid toolbar button that emits
+    // placeHoldRequested on click.
+    @Input() showPlaceHoldButton = false;
+
     // If set, all holds are fetched on grid load and sorting/paging all
     // happens in the client.  If false, sorting and paging occur on
     // the server.
@@ -155,6 +159,9 @@ export class HoldsGridComponent implements OnInit {
         }
     }
 
+    // Notify the caller the place hold button was clicked.
+    @Output() placeHoldRequested: EventEmitter<void> = new EventEmitter<void>();
+
     constructor(
         private ngLocation: Location,
         private net: NetService,