From: phasefx Date: Wed, 24 Mar 2010 16:08:17 +0000 (+0000) Subject: for user requests, View Picklist instead of Add to Picklist where appropriate. TODO... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5e985bf0c578b0983e1fd04a62756fe4f5feb998;p=evergreen%2Fbjwebb.git for user requests, View Picklist instead of Add to Picklist where appropriate. TODO: change the cancel method wired up here git-svn-id: svn://svn.open-ils.org/ILS/trunk@15947 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/ui/default/acq/picklist/user_request.js b/Open-ILS/web/js/ui/default/acq/picklist/user_request.js index ca0f04c43..6e5a6be06 100644 --- a/Open-ILS/web/js/ui/default/acq/picklist/user_request.js +++ b/Open-ILS/web/js/ui/default/acq/picklist/user_request.js @@ -28,6 +28,15 @@ function drawRequest() { // hide the grid and the context selector dijit.byId('stackContainer').forward(); + // toggle the View Picklist/Add to Picklist button label + if (aur_obj.lineitem()) { + openils.Util.addCSSClass( document.getElementById('add_to_picklist'), 'hidden' ); + openils.Util.removeCSSClass( document.getElementById('view_picklist'), 'hidden' ); + } else { + openils.Util.addCSSClass( document.getElementById('view_picklist'), 'hidden' ); + openils.Util.removeCSSClass( document.getElementById('add_to_picklist'), 'hidden' ); + } + // draw a detail page for a particular request var div = document.getElementById('detail_content_pane'); while (div.lastChild) { div.removeChild( div.lastChild ); } @@ -43,8 +52,26 @@ function drawRequest() { // and to "reject" it (aka apply a cancel reason) } +function fooPicklist() { + if (aur_obj.lineitem()) { + viewPicklist(); + } else { + addToPicklist(); + } +} + +function viewPicklist() { + var lineitem = fieldmapper.standardRequest( + [ 'open-ils.acq', 'open-ils.acq.lineitem.retrieve' ], + { + params: [openils.User.authtoken, aur_obj.lineitem()] + } + ); + location.href = oilsBasePath + "/acq/picklist/view/" + lineitem.picklist(); +} + function addToPicklist() { - // reqId + // reqId, from detail view location.href = oilsBasePath + "/acq/picklist/brief_record?ur=" + reqId + "&prepop=" + encodeURIComponent(js2JSON({ "1": aur_obj.title() || aur_obj.article_title() || aur_obj.volume(), "2": aur_obj.author(), @@ -55,13 +82,29 @@ function addToPicklist() { } function setNoHold() { - // reqId - alert('stub'); + // reqId, from detail view + fieldmapper.standardRequest( + [ 'open-ils.acq', 'open-ils.acq.user_request.set_no_hold.batch' ], + { async: true, + params: [openils.User.authtoken, [reqId]], + oncomplete: function(r) { + drawRequest(); + } + } + ); } function cancelRequest() { - // reqId - alert('stub'); + // reqId, from detail view + fieldmapper.standardRequest( + [ 'open-ils.acq', 'open-ils.acq.user_request.cancel.batch' ], + { async: true, + params: [openils.User.authtoken, [reqId]], + oncomplete: function(r) { + drawRequest(); + } + } + ); } // format the title data as id:title diff --git a/Open-ILS/web/templates/default/acq/picklist/user_request.tt2 b/Open-ILS/web/templates/default/acq/picklist/user_request.tt2 index f89553cc0..417329746 100644 --- a/Open-ILS/web/templates/default/acq/picklist/user_request.tt2 +++ b/Open-ILS/web/templates/default/acq/picklist/user_request.tt2 @@ -48,7 +48,7 @@
Patron Request
- +