From: Bill Erickson <berickxx@gmail.com>
Date: Mon, 25 Mar 2019 20:18:55 +0000 (+0000)
Subject: LP1821382 Request items menu action
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3785ed053676b4e0c873b77c26b6f6e54eb67f76;p=evergreen%2Fjoelewis.git

LP1821382 Request items menu action

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
---

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 8322b7a145..539c434e4a 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,7 +1,5 @@
 import {Component, OnInit, Input, ViewChild, Renderer2} from '@angular/core';
 import {Router, ActivatedRoute, ParamMap} from '@angular/router';
-import {Observable} from 'rxjs';
-import {tap} from 'rxjs/operators';
 import {EventService} from '@eg/core/event.service';
 import {NetService} from '@eg/core/net.service';
 import {AuthService} from '@eg/core/auth.service';
@@ -10,7 +8,6 @@ import {PermService} from '@eg/core/perm.service';
 import {IdlObject} from '@eg/core/idl.service';
 import {OrgService} from '@eg/core/org.service';
 import {BibRecordService, BibRecordSummary} from '@eg/share/catalog/bib-record.service';
-import {CatalogSearchContext, CatalogSearchState} from '@eg/share/catalog/search-context';
 import {CatalogService} from '@eg/share/catalog/catalog.service';
 import {StaffCatalogService} from '../catalog.service';
 import {HoldsService, HoldRequest,
@@ -89,13 +86,14 @@ export class HoldComponent implements OnInit {
 
         this.holdType = this.route.snapshot.params['type'];
         this.holdTargets = this.route.snapshot.queryParams['target'];
+        this.holdFor = this.route.snapshot.queryParams['holdFor'] || 'patron';
 
         if (!Array.isArray(this.holdTargets)) {
             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();
 
@@ -104,6 +102,10 @@ export class HoldComponent implements OnInit {
             return ctx;
         });
 
+        if (this.holdFor === 'staff') {
+            this.holdForChanged();
+        }
+
         this.getTargetMeta();
 
         this.org.settings('sms.enable').then(sets => {
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html
index 31b6e0c58e..42366eded1 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html
@@ -80,6 +80,10 @@
       i18n-label label="Print Labels" (onClick)="openItemPrintLabels($event)">
     </eg-grid-toolbar-action>
 
+    <eg-grid-toolbar-action
+      i18n-label label="Request Items" (onClick)="requestItems($event)">
+    </eg-grid-toolbar-action>
+
     <!-- row actions : Add -->
 
     <eg-grid-toolbar-action
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
index bf375bc4c8..623b547542 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
@@ -1,4 +1,5 @@
 import {Component, OnInit, Input, ViewChild} from '@angular/core';
+import {Router} from '@angular/router';
 import {Observable, Observer, of} from 'rxjs';
 import {map} from 'rxjs/operators';
 import {Pager} from '@eg/share/util/pager';
@@ -133,6 +134,7 @@ export class HoldingsMaintenanceComponent implements OnInit {
     contextOrg: IdlObject;
 
     constructor(
+        private router: Router,
         private org: OrgService,
         private idl: IdlService,
         private pcrud: PcrudService,
@@ -830,4 +832,11 @@ export class HoldingsMaintenanceComponent implements OnInit {
             dismissed => {}
         );
     }
+
+    requestItems(rows: HoldingsEntry[]) {
+        const copyIds = this.selectedCopyIds(rows);
+        if (copyIds.length === 0) { return; }
+        const params = {target: copyIds, holdFor: 'staff'};
+        this.router.navigate(['/staff/catalog/hold/C'], {queryParams: params});
+    }
 }