From 9c6a92f8dc9d5d2965b75e7ce74b7d6ba34bc783 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 28 Jul 2017 16:55:22 -0400 Subject: [PATCH] LP#1701001: add search-to-hold to catalog app This patch teaches the web staff client's catalog app how to activate the patron search button in the embedded catalog's place hold form. It also adds a handler for the button action to display a modal to allow the staff member to search for and select a patron, then injects the patron's barcode into the form. Signed-off-by: Galen Charlton Signed-off-by: Chris Sharp Signed-off-by: Jason Etheridge --- Open-ILS/src/templates/staff/cat/catalog/index.tt2 | 1 + .../web/js/ui/default/staff/cat/catalog/app.js | 44 +++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/templates/staff/cat/catalog/index.tt2 b/Open-ILS/src/templates/staff/cat/catalog/index.tt2 index c2df10ec4a..b98c3f14ec 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/index.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/index.tt2 @@ -8,6 +8,7 @@ + [% INCLUDE 'staff/cat/share/marcedit_strings.tt2' %] diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index d73224aebb..8b541f5914 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -7,7 +7,7 @@ * */ -angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','ngLocationUpdate','egCoreMod','egGridMod', 'egMarcMod', 'egUserMod', 'egHoldingsMod', 'ngToast']) +angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','ngLocationUpdate','egCoreMod','egGridMod', 'egMarcMod', 'egUserMod', 'egHoldingsMod', 'ngToast','egPatronSearchMod']) .config(['ngToastProvider', function(ngToastProvider) { ngToastProvider.configure({ @@ -426,6 +426,36 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e return record_id; } + patron_search_dialog = function() { + return $uibModal.open({ + templateUrl: './share/t_patron_selector', + size: 'lg', + animation: true, + controller: + ['$scope','$uibModalInstance','$controller', + function($scope , $uibModalInstance , $controller) { + angular.extend(this, $controller('BasePatronSearchCtrl', {$scope : $scope})); + $scope.clearForm(); + $scope.need_one_selected = function() { + var items = $scope.gridControls.selectedItems(); + return (items.length == 1) ? false : true + } + $scope.ok = function() { + var items = $scope.gridControls.selectedItems(); + if (items.length == 1) { + $uibModalInstance.close(items[0].card().barcode()); + } else { + $uibModalInstance.close() + } + } + $scope.cancel = function($event) { + $uibModalInstance.dismiss(); + $event.preventDefault(); + } + }] + }); + } + // also set it when the iframe changes to a new record $scope.handle_page = function(url) { @@ -464,6 +494,18 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e } else { $scope.in_opac_call = false; } + + if ($scope.opac_iframe && $location.path().match(/cat\/catalog/)) { + var doc = $scope.opac_iframe.dom.contentWindow.document; + $(doc).find('#hold_usr_search').show(); + $(doc).find('#hold_usr_search').on('click', function() { + patron_search_dialog().result.then(function(barc) { + $(doc).find('#hold_usr_input').val(barc); + $(doc).find('#hold_usr_input').change(); + }); + }) + } + } // xulG catalog handlers -- 2.11.0