[open-ils-commits] r12804 - in trunk/Open-ILS/web: js/ui/default/acq/common templates/default/acq/common (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Apr 6 16:35:06 EDT 2009


Author: erickson
Date: 2009-04-06 16:34:59 -0400 (Mon, 06 Apr 2009)
New Revision: 12804

Modified:
   trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
   trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
Log:
for now, update the price when it's changed.  will probably make this more interactive in the future

Modified: trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js	2009-04-06 20:31:34 UTC (rev 12803)
+++ trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js	2009-04-06 20:34:59 UTC (rev 12804)
@@ -139,13 +139,32 @@
         dojo.query('[attr=title]', row)[0].onclick = function() {self.drawInfo(li.id())};
         dojo.query('[name=copieslink]', row)[0].onclick = function() {self.drawCopies(li.id())};
         dojo.query('[name=count]', row)[0].appendChild(document.createTextNode(li.item_count()));
-        dojo.query('[name=estimated_price]', row)[0].value =  
-            liWrapper.findAttr('estimated_price', 'lineitem_local_attr_definition');
 
+        var priceInput = dojo.query('[name=estimated_price]', row)[0];
+        priceInput.value = liWrapper.findAttr('estimated_price', 'lineitem_local_attr_definition') || '';
+        priceInput.onchange = function() { self.updateLiPrice(priceInput, li) };
+
         self.tbody.appendChild(row);
         self.selectors.push(dojo.query('[name=selectbox]', row)[0]);
     };
 
+    self.updateLiPrice = function(input, li) {
+        var price = input.value;
+        var liWrapper = new openils.acq.Lineitem({lineitem:li});
+        var oldPrice = liWrapper.findAttr('estimated_price', 'lineitem_local_attr_definition') || null;
+        if(price == oldPrice) return;
+        console.log("setting price " + price + " for " + li.id());
+        fieldmapper.standardRequest(
+            ['open-ils.acq', 'open-ils.acq.lineitem_local_attr.set'],
+            {   async : true,
+                params : [this.authtoken, li.id(), 'estimated_price', price],
+                oncomplete : function(r) {
+                    openils.Util.readResponse(r);
+                }
+            }
+        );
+    }
+
     this.removeLineitem = function(liId) {
         this.tbody.removeChild(dojo.query('[li='+liId+']', this.tbody)[0]);
         delete this.liCache[liId];

Modified: trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2	2009-04-06 20:31:34 UTC (rev 12803)
+++ trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2	2009-04-06 20:34:59 UTC (rev 12804)
@@ -6,7 +6,7 @@
         <table id='acq-lit-table' class='oils-generic-table'>
             <thead>
                 <tr>
-                    <th style='border:1px solid #aaa;' colspan='0'>
+                    <th colspan='0'>
                         <table style='width:100%;'>
                             <tr>
                                 <td>



More information about the open-ils-commits mailing list