From 3778b8a2feeb9084399a42691305e391c7607cb8 Mon Sep 17 00:00:00 2001 From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Wed, 9 Dec 2009 14:29:50 +0000 Subject: [PATCH] Full Details button for payment history interface git-svn-id: svn://svn.open-ils.org/ILS/trunk@15116 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../xul/staff_client/server/patron/bill_history.js | 55 ++++++++++++++-------- .../staff_client/server/patron/bill_history.xul | 2 + 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/bill_history.js b/Open-ILS/xul/staff_client/server/patron/bill_history.js index e96d4898f4..8d499ef1a5 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_history.js +++ b/Open-ILS/xul/staff_client/server/patron/bill_history.js @@ -147,8 +147,9 @@ function init_payments_list() { JSAN.use('util.functional'); g.payments_list_selection = util.functional.map_list( g.payments_list.retrieve_selection(), - function(o) { return o.getAttribute('retrieve_id'); } + function(o) { return JSON2js( o.getAttribute('retrieve_id') ); } ); + $('payments_details').disabled = g.payments_list_selection.length == 0; }, 'retrieve_row' : function(params) { var id = params.retrieve_id; @@ -199,7 +200,13 @@ function my_init() { $('details').addEventListener( 'command', - handle_details, + gen_handle_details('bills'), + false + ); + + $('payments_details').addEventListener( + 'command', + gen_handle_details('payments'), false ); @@ -248,23 +255,31 @@ function handle_add() { } } -function handle_details() { - JSAN.use('util.window'); var win = new util.window(); - for (var i = 0; i < g.bill_list_selection.length; i++) { - var my_xulG = win.open( - urls.XUL_PATRON_BILL_DETAILS, - 'test_billdetails_' + g.bill_list_selection[i], - 'chrome,resizable', - { - 'patron_id' : g.patron_id, - 'mbts_id' : g.bill_list_selection[i], - 'refresh' : function() { - if (typeof window.refresh == 'function') window.refresh(); - if (typeof window.xulG == 'object' && typeof window.xulG.refresh == 'function') window.xulG.refresh(); - }, - } - ); - } +function gen_handle_details(which_list) { + return function() { + JSAN.use('util.functional'); + var selection; + switch(which_list) { + case 'payments': selection = util.functional.map_list( g.payments_list_selection, function(o) { return o.xact; } ); break; + default: selection = g.bill_list_selection; break; + } + JSAN.use('util.window'); var win = new util.window(); + for (var i = 0; i < selection.length; i++) { + var my_xulG = win.open( + urls.XUL_PATRON_BILL_DETAILS, + 'test_billdetails_' + selection[i], + 'chrome,resizable', + { + 'patron_id' : g.patron_id, + 'mbts_id' : selection[i], + 'refresh' : function() { + if (typeof window.refresh == 'function') window.refresh(); + if (typeof window.xulG == 'object' && typeof window.xulG.refresh == 'function') window.xulG.refresh(); + }, + } + ); + } + }; } function print_bills() { @@ -300,7 +315,7 @@ function payment_history_init() { if (result && typeof result.ilsevent == 'undefined') { g.payments_list.append( { - 'retrieve_id' : result.id(), + 'retrieve_id' : js2JSON( { 'id' : result.id(), 'xact' : result.xact() } ), 'row' : { 'my' : { 'mp' : result diff --git a/Open-ILS/xul/staff_client/server/patron/bill_history.xul b/Open-ILS/xul/staff_client/server/patron/bill_history.xul index 53e7c79c2e..0b10f0cba3 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_history.xul +++ b/Open-ILS/xul/staff_client/server/patron/bill_history.xul @@ -70,6 +70,8 @@ <tree id="payments_tree" flex="1" enableColumnDrag="true" seltype="multiple"/> <hbox> <hbox id="payments_list_actions" /> + <spacer flex="1"/> + <button id="payments_details" label="&staff.patron.bill_history.full_details.label;" disabled="true" accesskey="&staff.patron.bill_history.full_details.accesskey;"/> </hbox> </tabpanel> </tabpanels> -- 2.11.0