+<eg-hold-cancel-dialog #cancelDialog></eg-hold-cancel-dialog>
<div class="row pt-3">
<div class="col-lg-6">
Item is not captured for a hold
</div>
<div *ngIf="hold" class="well-table">
- <h3 i18n>Captured Hold Info</h3>
+ <div class="d-flex">
+ <h3 i18n>Captured Hold Info</h3>
+ <div class="flex-1"></div>
+ <button class="btn btn-outline-danger" (click)="showCancelDialog()" i18n>
+ Cancel Hold
+ </button>
+ </div>
<div class="well-row">
<div class="well-label" i18n>Patron</div>
<div class="well-value">
import {NetService} from '@eg/core/net.service';
import {OrgService} from '@eg/core/org.service';
import {EventService} from '@eg/core/event.service';
+import {HoldCancelDialogComponent} from '@eg/staff/share/holds/cancel-dialog.component';
@Component({
selector: 'eg-item-holds-transits',
transit: IdlObject;
loading = true;
+ @ViewChild('cancelDialog') private cancelDialog: HoldCancelDialogComponent;
+
constructor(
private router: Router,
private route: ActivatedRoute,
load(): Promise<any> {
this.loading = true;
+ this.hold = null;
+ this.transit = null;
return this.pcrud.search('ahr', {
- current_copy: 2523,
+ current_copy: this.item.id(),
cancel_time: null,
fulfillment_time: null,
capture_time: {'<>': null}
}, {
flesh: 2,
flesh_fields: {ahr: ['requestor', 'usr'], au: ['card']}
- }).pipe(concatMap(hold => {
- hold.pickup_lib(this.org.get(hold.pickup_lib()));
- hold.current_shelf_lib(this.org.get(hold.current_shelf_lib()));
- this.hold = hold;
+
+ }).toPromise().then(hold => {
+ if (hold) {
+ hold.pickup_lib(this.org.get(hold.pickup_lib()));
+ hold.current_shelf_lib(this.org.get(hold.current_shelf_lib()));
+ this.hold = hold;
+ }
+ })
+
+ .then(_ => {
return this.pcrud.search('atc',
{target_copy: this.item.id()},
{order_by: {atc: 'source_send_time DESC'}, limit: 1}
- );
- }))
- .pipe(tap(transit => {
- transit.source(this.org.get(transit.source()));
- transit.dest(this.org.get(transit.dest()));
- this.transit = transit;
- }))
- .toPromise().then(_ => this.loading = false);
+ ).toPromise();
+ })
+
+ .then(transit => {
+ if (transit) {
+ transit.source(this.org.get(transit.source()));
+ transit.dest(this.org.get(transit.dest()));
+ this.transit = transit;
+ }
+ })
+ .then(_ => this.loading = false);
+ }
+
+ showCancelDialog() {
+ this.cancelDialog.holdIds = [this.hold.id()];
+ this.cancelDialog.open({}).subscribe(
+ rowsModified => {
+ this.load();
+ }
+ );
}
}