From 868e8c7411f6d90df2dd0992ca1b02667802ccf4 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 27 Jul 2021 17:32:05 -0400 Subject: [PATCH] LP1936233 Hold/transit lookup repairs; hold cancel option Signed-off-by: Bill Erickson --- .../src/app/staff/cat/item/holds.component.html | 9 +++- .../eg2/src/app/staff/cat/item/holds.component.ts | 49 ++++++++++++++++------ .../src/eg2/src/app/staff/cat/item/item.module.ts | 2 + 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/cat/item/holds.component.html b/Open-ILS/src/eg2/src/app/staff/cat/item/holds.component.html index 44738091df..42cd108611 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/item/holds.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/item/holds.component.html @@ -1,3 +1,4 @@ +
@@ -5,7 +6,13 @@ Item is not captured for a hold
-

Captured Hold Info

+
+

Captured Hold Info

+
+ +
Patron
diff --git a/Open-ILS/src/eg2/src/app/staff/cat/item/holds.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/item/holds.component.ts index 2344b18875..f57f352442 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/item/holds.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/item/holds.component.ts @@ -7,6 +7,7 @@ import {AuthService} from '@eg/core/auth.service'; 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', @@ -20,6 +21,8 @@ export class ItemHoldsTransitsComponent implements OnInit { transit: IdlObject; loading = true; + @ViewChild('cancelDialog') private cancelDialog: HoldCancelDialogComponent; + constructor( private router: Router, private route: ActivatedRoute, @@ -37,30 +40,50 @@ export class ItemHoldsTransitsComponent implements OnInit { load(): Promise { 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(); + } + ); } } diff --git a/Open-ILS/src/eg2/src/app/staff/cat/item/item.module.ts b/Open-ILS/src/eg2/src/app/staff/cat/item/item.module.ts index f5b45d7199..675838e7c4 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/item/item.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/item/item.module.ts @@ -17,6 +17,7 @@ import {ItemHoldsTransitsComponent} from './holds.component'; import {GroupedMenuModule} from '@eg/share/grouped-menu/grouped-menu.module'; import {WorkLogModule} from '@eg/staff/share/worklog/worklog.module'; import {ItemStatusService} from './item.service'; +import {HoldsModule} from '@eg/staff/share/holds/holds.module'; @NgModule({ declarations: [ @@ -38,6 +39,7 @@ import {ItemStatusService} from './item.service'; PatronModule, BillingModule, WorkLogModule, + HoldsModule, GroupedMenuModule ], providers: [ -- 2.11.0