[open-ils-commits] r14718 - trunk/Open-ILS/xul/staff_client/server/patron (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Nov 2 02:15:54 EST 2009


Author: phasefx
Date: 2009-11-02 02:15:50 -0500 (Mon, 02 Nov 2009)
New Revision: 14718

Modified:
   trunk/Open-ILS/xul/staff_client/server/patron/bill2.js
   trunk/Open-ILS/xul/staff_client/server/patron/bill2.xul
Log:
some refactoring.  redistribute payment when Payment Received field changes its value and leaves focus, or when the field is in focus and the enter key is pressed.  In the case of the Enter key while in that field, switch focus to the Apply Payment button, so that a subsequent enter press would apply the payment

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill2.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill2.js	2009-11-02 06:47:32 UTC (rev 14717)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill2.js	2009-11-02 07:15:50 UTC (rev 14718)
@@ -31,18 +31,8 @@
 
         retrieve_mbts_for_list();
 
-        $('details').addEventListener(
-            'command',
-            handle_details,
-            false
-        );
+        event_listeners();
 
-        $('add').addEventListener(
-            'command',
-            handle_add,
-            false
-        );
-
         JSAN.use('util.exec'); var exec = new util.exec(20); 
         exec.on_error = function(E) { alert(E); return true; }
         exec.timer(g.funcs,100);
@@ -75,6 +65,37 @@
     }
 }
 
+function event_listeners() {
+        $('details').addEventListener(
+            'command',
+            handle_details,
+            false
+        );
+
+        $('add').addEventListener(
+            'command',
+            handle_add,
+            false
+        );
+
+        $('payment').addEventListener(
+            'change',
+            function(ev) { distribute_payment(); },
+            false
+        );
+
+        $('payment').addEventListener(
+            'keypress',
+            function(ev) {
+                if (! (ev.keyCode == 13 /* enter */ || ev.keyCode == 77 /* mac enter */) ) { return; }
+                distribute_payment();
+                $('apply_payment_btn').focus();
+            },
+            false
+        );
+
+}
+
 function $(id) { return document.getElementById(id); }
 
 function default_focus() {

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill2.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill2.xul	2009-11-02 06:47:32 UTC (rev 14717)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill2.xul	2009-11-02 07:15:50 UTC (rev 14718)
@@ -110,7 +110,7 @@
                     <hbox>
                         <checkbox id="annotate_payment" label="&staff.patron.bills_overlay.annotate_payment.label;" accesskey="n" oils_persist="checked" checked="false" oncommand="default_focus();"/>
                         <button label="See Distribution" accesskey="D" oncommand="distribute_payment(); default_focus();"/>
-                        <button label="Apply Payment" accesskey="P"/>
+                        <button id="apply_payment_btn" label="Apply Payment" accesskey="P"/>
                     </hbox>
                 </groupbox>
             </hbox>



More information about the open-ils-commits mailing list