[open-ils-commits] r10101 - in branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb: public/oils/media/ui_js/oils/default/common templates/oils/default/common

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jul 23 15:19:37 EDT 2008


Author: erickson
Date: 2008-07-23 15:19:28 -0400 (Wed, 23 Jul 2008)
New Revision: 10101

Modified:
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html
Log:

Broke price information out into estimated and actual price columns.  Not entirely sure we want 
these to be broken out, but it's trivial to pull them back into a single column if not.

I have an editor in place for setting the prices, but I'm trying to understand how one
captures the edited data when you are editing a column that is not part of the grid's 
data model.  Bueller?




Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js	2008-07-23 17:39:38 UTC (rev 10100)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js	2008-07-23 19:19:28 UTC (rev 10101)
@@ -45,9 +45,22 @@
     getJUBIsbn : function(rowIndex) {
         return JUBGrid._getMARCAttr(rowIndex, 'isbn');
     },
-    getJUBPrice : function(rowIndex) {
-        return JUBGrid._getMARCAttr(rowIndex, 'price');
+    getJUBActualPrice : function(rowIndex) {
+        var data = JUBGrid.jubGrid.model.getRow(rowIndex);
+        if (!data) return '';
+        var price = new openils.acq.Lineitems(
+            {lineitem:JUBGrid.getLi(data.id)}).getActualPrice();
+        if(price) return price.price;
+        return ''
     },
+    getJUBEstimatedPrice : function(rowIndex) {
+        var data = JUBGrid.jubGrid.model.getRow(rowIndex);
+        if (!data) return '';
+	    var price = new openils.acq.Lineitems(
+            {lineitem:JUBGrid.getLi(data.id)}).getEstimatedPrice();
+        if(price) return price.price;
+        return ''
+    },
     getJUBPubdate : function(rowIndex) {
         return JUBGrid._getMARCAttr(rowIndex, 'pubdate');
     },
@@ -85,10 +98,16 @@
         return fieldmapper.aou.findOrgUnit(data.owning_lib).shortname();
     },
 
+    gridDataChanged : function(newVal, rowIdx, cellIdx) {
+        // cellIdx == -1 if you are editing a column that
+        // is not represented in the data model. Khaaaaaaan!!! 
+    },
+
     populate : function(gridWidget, model, lineitems) {
-	for (var i in lineitems) {
-	    JUBGrid.lineitems[lineitems[i].id()] = lineitems[i];
-	}
+        for (var i in lineitems) {
+            JUBGrid.lineitems[lineitems[i].id()] = lineitems[i];
+        }
+        dojo.connect (gridWidget, "onApplyCellEdit", JUBGrid.gridDataChanged);
         JUBGrid.jubGrid = gridWidget;
         JUBGrid.jubGrid.setModel(model);
         if(JUBGrid.showDetails) {

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html	2008-07-23 17:39:38 UTC (rev 10100)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html	2008-07-23 19:19:28 UTC (rev 10101)
@@ -58,9 +58,20 @@
             {name: '${_("Author")}', get:JUBGrid.getJUBAuthor},
             {name: '${_("ISBN")}', get:JUBGrid.getJUBIsbn},
             {name: '${_("Pubdate")}', get:JUBGrid.getJUBPubdate},
-            {name: '${_("Price")}', get:JUBGrid.getJUBPrice},
+            {name: '${_("Actual Price")}', 
+                field:'actual_price',
+                get:JUBGrid.getJUBActualPrice,
+                editor:dojox.grid.editors.Dijit, 
+                editorClass: "dijit.form.CurrencyTextBox" 
+            },
+            {name: '${_("Estimated Price")}', 
+                field:'estimated_price',
+                get:JUBGrid.getJUBEstimatedPrice,
+                editor:dojox.grid.editors.Dijit, 
+                editorClass: "dijit.form.CurrencyTextBox" 
+            },
             {name: '${_("Vendor")}',
-	     field: 'provider', width:'auto', get:JUBGrid.getProvider,
+	     field: 'provider', get:JUBGrid.getProvider,
 	     editor:openils.editors.ProviderSelectEditor,
 	    },
             {name: '${_("No. Copies")}', field: 'item_count'},



More information about the open-ils-commits mailing list