From 1a7dff6e895d886b9d70ea93ef7caa1a0bef55c1 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 11 Jul 2012 11:29:55 -0400 Subject: [PATCH] acq invoice search; actual searching; showing results Signed-off-by: Bill Erickson --- Open-ILS/src/templates/acq/invoice/view.tt2 | 29 +++++++++++++++++++++++- Open-ILS/web/js/ui/default/acq/invoice/view.js | 29 +++++++++++++++--------- Open-ILS/web/js/ui/default/acq/search/unified.js | 13 +++++++---- 3 files changed, 55 insertions(+), 16 deletions(-) diff --git a/Open-ILS/src/templates/acq/invoice/view.tt2 b/Open-ILS/src/templates/acq/invoice/view.tt2 index 50c5e94850..f22941abbd 100644 --- a/Open-ILS/src/templates/acq/invoice/view.tt2 +++ b/Open-ILS/src/templates/acq/invoice/view.tt2 @@ -192,8 +192,35 @@ -
+

+ + + + + + + + +
+ + +
+ +
+
diff --git a/Open-ILS/web/js/ui/default/acq/invoice/view.js b/Open-ILS/web/js/ui/default/acq/invoice/view.js index c4b3e1466e..a83241a34c 100644 --- a/Open-ILS/web/js/ui/default/acq/invoice/view.js +++ b/Open-ILS/web/js/ui/default/acq/invoice/view.js @@ -221,10 +221,8 @@ function renderUnifiedSearch() { // define custom lineitem result handler resultManager.result_types = { "lineitem": { - "search_options": { - }, - "revealer": function() { - }, + "search_options": { "id_list": true }, + "revealer": function() { }, "finisher": function() { resultsLoader.batch_length = resultManager.count_results; }, @@ -234,23 +232,32 @@ function renderUnifiedSearch() { "interface": resultsLoader } }; - } dojo.addClass(dojo.byId('oils-acq-invoice-table'), 'hidden'); dojo.removeClass(dojo.byId('oils-acq-invoice-search'), 'hidden'); } +var resultsTbody, resultsRow; function searchResultsLoader() { - console.log('creating searchResultsLoader...'); - this.displayOffset = 0; this.displayLimit = 10; - this.addLineitem = function(li) { - console.log('adding lineitem ' + li); - dojo.byId('acq-invoice-search-results-div').appendChild( - dojo.create('div', {innerHTML : ' Some Book About Stuff ' + li})); + if (!resultsTbody) { + resultsTbody = dojo.byId('acq-invoice-search-results-tbody'); + resultsRow = resultsTbody.removeChild(dojo.byId('acq-invoice-search-results-tr')); + } + + this.addLineitem = function(li_id) { + console.log('Adding search result lineitem ' + li_id); + var row = resultsRow.cloneNode(true); + resultsTbody.appendChild(row); + openils.acq.Lineitem.fetchAndRender( + li_id, {}, + function(li, html) { + dojo.query('[name=search-results-content-div]', row)[0].innerHTML = html; + } + ); } } diff --git a/Open-ILS/web/js/ui/default/acq/search/unified.js b/Open-ILS/web/js/ui/default/acq/search/unified.js index 48ffffd231..f023dd4011 100644 --- a/Open-ILS/web/js/ui/default/acq/search/unified.js +++ b/Open-ILS/web/js/ui/default/acq/search/unified.js @@ -255,7 +255,7 @@ function TermManager() { }; this.terms = {}; - ["jub", "acqpl", "acqpo", "acqinv"].forEach( + ["jub", "acqpl", "acqpo", "acqinv", "acqlid"].forEach( function(hint) { var o = {}; o.__label = fieldmapper.IDL.fmclasses[hint].label; @@ -791,10 +791,15 @@ function ResultManager(liPager, poGrid, plGrid, invGrid) { this.go = function(search_object) { - if (unifiedSearchMode == 'invoice') { - var self = this; - dojo.forEach([1,2,3,4,5], function(idx) {self.add('lineitem', 'foo ' + idx)}); + if (unifiedSearchMode == 'invoice') { // TODO: s/invoice/inline/ or some such + uriManager = new URIManager(); + uriManager.search_object = search_object; + uriManager.result_type = dojo.byId("acq-unified-result-type").getValue(); + uriManager.conjunction = dojo.byId("acq-unified-conjunction").getValue(); + this.search(uriManager, termManager); + } else { + location.href = oilsBasePath + "/acq/search/unified?" + "so=" + base64Encode(search_object) + "&rt=" + dojo.byId("acq-unified-result-type").getValue() + -- 2.11.0