some refactoring. redistribute payment when Payment Received field changes its value...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 2 Nov 2009 07:15:50 +0000 (07:15 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 2 Nov 2009 07:15:50 +0000 (07:15 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14718 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 90cf67d..9d1856d 100644 (file)
@@ -31,17 +31,7 @@ function my_init() {
 
         retrieve_mbts_for_list();
 
-        $('details').addEventListener(
-            'command',
-            handle_details,
-            false
-        );
-
-        $('add').addEventListener(
-            'command',
-            handle_add,
-            false
-        );
+        event_listeners();
 
         JSAN.use('util.exec'); var exec = new util.exec(20); 
         exec.on_error = function(E) { alert(E); return true; }
@@ -75,6 +65,37 @@ function my_init() {
     }
 }
 
+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() {
index f3911a0..7b0eb25 100644 (file)
                     <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>