From c3cc24097ebf21fcf1bd5dde4967a7a70c7b56dd Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 23 Jul 2008 19:19:28 +0000 Subject: [PATCH] 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? git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@10101 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../media/ui_js/oils/default/common/jubgrid.js | 29 ++++++++++++++++++---- .../templates/oils/default/common/jubgrid.html | 15 +++++++++-- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js index 78958394df..9ca33899c3 100644 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js +++ b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js @@ -45,8 +45,21 @@ var JUBGrid = { 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 @@ var JUBGrid = { 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) { diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html index c0b46d6653..c8dc4d7027 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html @@ -58,9 +58,20 @@ pointing to the JUB model (and store) that you have created. {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'}, -- 2.11.0