<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>
export class HoldsComponent implements OnInit {
constructor(
+ private router: Router,
private org: OrgService,
private net: NetService,
public patronService: PatronService,
ngOnInit() {
}
+ newHold() {
+ this.router.navigate(['/staff/catalog/search'],
+ {queryParams: {holdForBarcode: this.context.patron.card().barcode()}});
+ }
}
</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>
-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';
@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.
}
}
+ // Notify the caller the place hold button was clicked.
+ @Output() placeHoldRequested: EventEmitter<void> = new EventEmitter<void>();
+
constructor(
private ngLocation: Location,
private net: NetService,