wire up Bill Patron, and have it append to the list without refreshing the whole...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 2 Nov 2009 07:28:26 +0000 (07:28 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 2 Nov 2009 07:28:26 +0000 (07:28 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14719 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/patron/bill2.js
Open-ILS/xul/staff_client/server/patron/bill2.xul
Open-ILS/xul/staff_client/server/patron/bill_wizard.js

index 9d1856d..ee18597 100644 (file)
@@ -94,6 +94,21 @@ function event_listeners() {
             false
         );
 
+        $('bill_patron_btn').addEventListener(
+            'command',
+            function() {
+                JSAN.use('util.window'); var win = new util.window();
+                var my_xulG = win.open(
+                    urls.XUL_PATRON_BILL_WIZARD,
+                    'billwizard',
+                    'chrome,resizable,modal',
+                    { 'patron_id' : g.patron_id }
+                );
+                if (my_xulG.xact_id) { g.funcs.push( gen_list_append_func( my_xulG.xact_id ) ); /* FIXME: do something to update summary sidebar */ }
+            },
+            false
+        );
+
 }
 
 function $(id) { return document.getElementById(id); }
@@ -232,6 +247,13 @@ function check_all_refunds() {
     }
 }
 
+function gen_list_append_func(r) {
+    return function() {
+        if (typeof r == 'object') { g.row_map[ r.id() ] = g.bill_list.append( { 'retrieve_id' : r.id(), 'row' : { 'my' : { 'checked' : true, 'mbts' : r } } } );
+        } else { g.row_map[r] = g.bill_list.append( { 'retrieve_id' : r, 'row' : { 'my' : { 'checked' : true } } } ); }
+    }
+}
+
 function retrieve_mbts_for_list() {
     var method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE.authoritative';
     g.mbts_ids = g.network.simple_request(method,[ses(),g.patron_id]);
@@ -246,16 +268,9 @@ function retrieve_mbts_for_list() {
    
         g.mbts_ids.reverse();
  
-        function gen_func(r) {
-            return function() {
-                if (typeof r == 'object') { g.row_map[ r.id() ] = g.bill_list.append( { 'retrieve_id' : r.id(), 'row' : { 'my' : { 'checked' : true, 'mbts' : r } } } );
-                } else { g.row_map[r] = g.bill_list.append( { 'retrieve_id' : r, 'row' : { 'my' : { 'checked' : true } } } ); }
-            }
-        }
-
         for (var i = 0; i < g.mbts_ids.length; i++) {
             dump('i = ' + i + ' g.mbts_ids[i] = ' + g.mbts_ids[i] + '\n');
-            g.funcs.push( gen_func(g.mbts_ids[i]) );
+            g.funcs.push( gen_list_append_func(g.mbts_ids[i]) );
         }
     }
 }
index 7b0eb25..283d2c2 100644 (file)
             </hbox>
             <splitter />
             <hbox>
-                <button label="Bill Patron" accesskey="" />
+                <button id="bill_patron_btn" label="Bill Patron" accesskey="" />
                 <button label="History" accesskey="" />
                 <spacer flex="1"/>
                 <menubar>
index ff77218..f9461ab 100644 (file)
@@ -202,6 +202,14 @@ function patron_bill_finish() {
                 );
                 if (typeof mb_id.ilsevent != 'undefined') throw(mb_id);
                 //alert($('patronStrings').getString('staff.patron.bill_wizard.patron_bill_finish.billing_added'));
+
+                update_modal_xulG(
+                    {
+                        mb_id : mb_id,
+                        xact_id : xact_id
+                    }
+                );
+
             } else {
                 throw(xact_id);
             }