From c24efb21fc8ffadba2154a90c05c6cffdc737a59 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Wed, 14 Jan 2015 17:20:23 -0500 Subject: [PATCH] LP#1402797 Implement retrieve record by id and tcn Signed-off-by: Mike Rylander Signed-off-by: Bill Erickson --- .../staff/cat/catalog/t_retrieve_by_id.tt2 | 22 ++++++ .../staff/cat/catalog/t_retrieve_by_tcn.tt2 | 25 +++++++ Open-ILS/src/templates/staff/navbar.tt2 | 13 ++++ .../js/ui/default/staff/cat/catalog/app.js | 74 +++++++++++++++++++ 4 files changed, 134 insertions(+) create mode 100644 Open-ILS/src/templates/staff/cat/catalog/t_retrieve_by_id.tt2 create mode 100644 Open-ILS/src/templates/staff/cat/catalog/t_retrieve_by_tcn.tt2 diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_retrieve_by_id.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_retrieve_by_id.tt2 new file mode 100644 index 0000000000..785b52d709 --- /dev/null +++ b/Open-ILS/src/templates/staff/cat/catalog/t_retrieve_by_id.tt2 @@ -0,0 +1,22 @@ + +
+
+ + + + + +
+ +
+ +
+
+ [% l('Bib Record Not Found: [_1]', '{{recordNotFound}}') %] +
+ + diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_retrieve_by_tcn.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_retrieve_by_tcn.tt2 new file mode 100644 index 0000000000..e8a86a61f4 --- /dev/null +++ b/Open-ILS/src/templates/staff/cat/catalog/t_retrieve_by_tcn.tt2 @@ -0,0 +1,25 @@ + +
+
+ + + + + +
+ +
+ +
+
+ [% l('More than one Bib Record found with TCN: [_1]', '{{recordNotFound}}') %] +
+
+ [% l('Bib Record Not Found: [_1]', '{{recordNotFound}}') %] +
+ + diff --git a/Open-ILS/src/templates/staff/navbar.tt2 b/Open-ILS/src/templates/staff/navbar.tt2 index 018a93f98d..e94b1eaa81 100644 --- a/Open-ILS/src/templates/staff/navbar.tt2 +++ b/Open-ILS/src/templates/staff/navbar.tt2 @@ -169,6 +169,19 @@ [% l('Record Buckets') %] +
  • +
  • + + + [% l('Retrieve Bib Record by ID') %] + +
  • +
  • + + + [% l('Retrieve Bib Record by TCN') %] + +
  • 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 9e9ad7d423..f41a3fe515 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 @@ -22,6 +22,18 @@ angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','egCoreMod','egGridMod' resolve : resolver }); + $routeProvider.when('/cat/catalog/retrieve_by_id', { + templateUrl: './cat/catalog/t_retrieve_by_id', + controller: 'CatalogRecordRetrieve', + resolve : resolver + }); + + $routeProvider.when('/cat/catalog/retrieve_by_tcn', { + templateUrl: './cat/catalog/t_retrieve_by_tcn', + controller: 'CatalogRecordRetrieve', + resolve : resolver + }); + // create some catalog page-specific mappings $routeProvider.when('/cat/catalog/record/:record_id', { templateUrl: './cat/catalog/t_catalog', @@ -42,6 +54,68 @@ angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','egCoreMod','egGridMod' /** * */ +.controller('CatalogRecordRetrieve', + ['$scope','$routeParams','$location','$q','egCore', +function($scope , $routeParams , $location , $q , egCore ) { + + $scope.focusMe = true; + + // jump to the patron checkout UI + function loadRecord(record_id) { + $location + .path('/cat/catalog/record/' + record_id); + } + + $scope.submitId = function(args) { + $scope.recordNotFound = null; + if (!args.record_id) return; + + // blur so next time it's set to true it will re-apply select() + $scope.selectMe = false; + + return loadRecord(args.record_id); + } + + $scope.submitTCN = function(args) { + $scope.recordNotFound = null; + $scope.moreRecordsFound = null; + if (!args.record_tcn) return; + + // blur so next time it's set to true it will re-apply select() + $scope.selectMe = false; + + // lookup TCN + egCore.net.request( + 'open-ils.search', + 'open-ils.search.biblio.tcn', + args.record_tcn) + + .then(function(resp) { // get_barcodes + + if (evt = egCore.evt.parse(resp)) { + alert(evt); // FIXME + return; + } + + if (!resp.count) { + $scope.recordNotFound = args.record_tcn; + $scope.selectMe = true; + return; + } + + if (resp.count > 1) { + $scope.moreRecordsFound = args.record_tcn; + $scope.selectMe = true; + return; + } + + var record_id = resp.ids[0]; + return loadRecord(record_id); + }); + } + +}]) + .controller('CatalogCtrl', ['$scope','$routeParams','$location','$q','egCore','egHolds', 'egGridDataProvider','egHoldGridActions', -- 2.43.2