From fc25604b3b9e00b127a3090a6c59de92e93c203c Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 26 Nov 2018 16:47:19 -0500 Subject: [PATCH] place holds cont. Signed-off-by: Bill Erickson --- .../src/app/staff/catalog/hold/hold.component.html | 20 +++---- .../src/app/staff/catalog/hold/hold.component.ts | 63 +++++++++++++++++++--- 2 files changed, 68 insertions(+), 15 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 3686ce1063..2656c43b4d 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 @@ -147,7 +147,7 @@
+ [disabled]="!user" i18n>Place Hold(s)
@@ -167,13 +167,16 @@ hold on record(s) + + ANY + +
Format
-
Title
+
Title
Author
-
TCN
Call Number
Barcode
Holds Status
@@ -189,21 +192,20 @@ src="/images/format_icons/icon_format/{{code}}.png"/>
-
+
{{ctx.bibSummary.display.author}}
-
{{ctx.bibSummary.record.tcn_value()}}
- - ANY + + {{ctx.volume.label()}}
- - ANY + + {{ctx.copy.barcode()}}
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 daf2279f23..7da3aba2d9 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 @@ -1,6 +1,7 @@ import {Component, OnInit, Input, ViewChild, Renderer2} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {Router, ActivatedRoute, ParamMap} from '@angular/router'; +import {tap} from 'rxjs/operators/tap'; import {EventService} from '@eg/core/event.service'; import {NetService} from '@eg/core/net.service'; import {AuthService} from '@eg/core/auth.service'; @@ -19,6 +20,10 @@ class HoldContext { recordId: number; bibSummary: BibRecordSummary; holdTarget: number; + volume: IdlObject; + copy: IdlObject; + part: IdlObject; + issuance: IdlObject; lastRequest: HoldRequest; canOverride?: boolean; } @@ -111,12 +116,59 @@ export class HoldComponent implements OnInit { this.renderer.selectRootElement('#patron-barcode').focus()); } + // Load the bib, call number, copy, etc. data associated with each target. findRecords() { - if (this.holdType === 'T') { - this.holdContexts.forEach(ctx => ctx.recordId = ctx.holdTarget); - this.getRecordSummaries(); - } else { - // TODO BIB IDS FOR OTHER HOLD TYPES + + switch (this.holdType) { + + case 'T': + this.holdContexts.forEach(ctx => ctx.recordId = ctx.holdTarget); + this.getRecordSummaries(); + break; + + case 'V': + const volIds = this.holdContexts.map(ctx => ctx.holdTarget); + this.pcrud.search('acn', {id: volIds}) + .subscribe( + vol => { + this.holdContexts.filter( + ctx => ctx.holdTarget === vol.id() + ).forEach(ctx => { + ctx.volume = vol; + ctx.recordId = vol.record(); + }); + }, + err => {}, + () => this.getRecordSummaries() + ); + break; + + case 'C': + case 'R': + case 'F': + const copyIds = this.holdContexts.map(ctx => ctx.holdTarget); + this.pcrud.search('acp', {id: copyIds}, + {flesh: 1, flesh_fields: {'acp': ['call_number']} + ).subscribe( + copy => { + this.holdContexts.filter( + ctx => ctx.holdTarget === copy.id() + ).forEach(ctx => { + ctx.copy = copy; + ctx.volume = copy.call_number(); + ctx.recordId = copy.call_number().record(); + }); + }, + err => {}, + () => this.getRecordSummaries() + ) + break; + + case 'I': // TODO + break; + + case 'P': // TODO + break; } } @@ -127,7 +179,6 @@ export class HoldComponent implements OnInit { this.bib.getBibSummary(ids).subscribe( sum => { this.holdContexts.forEach(ctx => { - console.log(ctx.recordId, sum.id); if (ctx.recordId === sum.id) { ctx.bibSummary = sum; } -- 2.11.0