From f41f72974e2721cfdbd35cb5cb686acce1cb2ecb Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 19 Nov 2018 18:07:36 -0500 Subject: [PATCH] place holds continued Signed-off-by: Bill Erickson --- .../src/app/staff/catalog/hold/hold.component.html | 54 ++++++++++++++-------- .../src/app/staff/catalog/hold/hold.component.ts | 48 ++++++++++++++----- 2 files changed, 72 insertions(+), 30 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html index f594ad09fd..b7857e5944 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html @@ -123,25 +123,41 @@
Barcode
Holds Status
-
- -
{{rec.display.author}}
-
{{rec.record.tcn_value()}}
-
- - ANY - -
-
- - ANY - -
-
-
Hold Pending
-
+
+ + +
{{ctx.bibSummary.display.author}}
+
{{ctx.bibSummary.record.tcn_value()}}
+
+ + ANY + +
+
+ + ANY + +
+
+ +
Hold Pending
+
+ + +
Hold Succeeded
+
+ +
+ {{ctx.lastRequest.result.last_event.toString()}} +
+
+
+
+
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts index 0a342704b5..ab77e3110f 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts @@ -9,7 +9,14 @@ import {BibRecordService, BibRecordSummary} from '@eg/share/catalog/bib-record.s import {CatalogSearchContext, CatalogSearchState} from '@eg/share/catalog/search-context'; import {CatalogService} from '@eg/share/catalog/catalog.service'; import {StaffCatalogService} from '../catalog.service'; -import {HoldService} from '@eg/staff/share/hold.service'; +import {HoldService, HoldRequest} from '@eg/staff/share/hold.service'; + +class HoldContext { + recordId: number; + bibSummary: BibRecordSummary; + holdTarget: number; + lastRequest: HoldRequest; +} @Component({ templateUrl: 'hold.component.html' @@ -29,6 +36,8 @@ export class HoldComponent implements OnInit { phoneValue: string; suspend: boolean; activeDate: string; + + holdContexts: HoldContext[]; recordIds: number[]; recordSummaries: BibRecordSummary[]; @@ -47,8 +56,7 @@ export class HoldComponent implements OnInit { private staffCat: StaffCatalogService, private holds: HoldService ) { - this.recordIds = []; - this.recordSummaries = []; + this.holdContexts = []; } ngOnInit() { @@ -60,9 +68,17 @@ export class HoldComponent implements OnInit { this.holdTargets = [this.holdTargets]; } + this.holdTargets = this.holdTargets.map(t => Number(t)); this.holdFor = 'patron'; this.requestor = this.auth.user(); this.pickupLib = this.auth.user().ws_ou(); + + this.holdContexts = this.holdTargets.map(target => { + const ctx = new HoldContext(); + ctx.holdTarget = target; + return ctx; + }); + this.findRecords(); setTimeout(() => // Focus barcode input @@ -71,23 +87,30 @@ export class HoldComponent implements OnInit { findRecords() { if (this.holdType === 'T') { - this.recordIds = this.holdTargets; + this.holdContexts.forEach(ctx => ctx.recordId = ctx.holdTarget); this.getRecordSummaries(); } else { - // TODO OTHER HOLD TYPES + // TODO BIB IDS FOR OTHER HOLD TYPES } } getRecordSummaries() { - this.bib.getBibSummary(this.recordIds).subscribe( - sum => this.recordSummaries.push(sum), - err => {}, - () => {} - ) + + const ids = this.holdContexts.map(ctx => ctx.recordId); + + this.bib.getBibSummary(ids).subscribe( + sum => { + this.holdContexts.forEach(ctx => { + console.log(ctx.recordId, sum.id); + if (ctx.recordId === sum.id) { + ctx.bibSummary = sum; + } + }); + } + ); } holdForChanged() { - console.log('placing hold for ' + this.holdFor); if (this.holdFor === 'patron') { if (this.userBarcode) { @@ -209,6 +232,9 @@ export class HoldComponent implements OnInit { }).subscribe(request => { console.log('hold returned: ', request); + const ctx = this.holdContexts.filter( + ctx => ctx.holdTarget === request.holdTarget)[0]; + ctx.lastRequest = request; this.placeHolds(idx + 1); }); } -- 2.11.0