added copy location display and editing for lineitem details. still need to find...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 26 Jun 2008 22:11:16 +0000 (22:11 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 26 Jun 2008 22:11:16 +0000 (22:11 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9944 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/editors.js
Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js
Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html

index 7f9846b..e7ecd5f 100644 (file)
@@ -50,4 +50,22 @@ dojo.declare('openils.editors.OrgUnitSelectEditor', dojox.grid.editors.Dijit, {
     },
 });
 
+dojo.declare('openils.editors.CopyLocationSelectEditor', dojox.grid.editors.Dijit, {
+    editorClass: "dijit.form.FilteringSelect",
+    createEditor: function(inNode, inDatum, inRowIndex) {
+        dojo.require('openils.CopyLocation');
+           var editor = new this.editorClass(this.getEditorProps(inDatum), inNode);
+        openils.CopyLocation.createStore(1,  /* XXX how do we propagate arguments to the editor?? */
+            function(store) {
+                editor.store = new dojo.data.ItemFileReadStore({data:store});
+                editor.startup();
+                if(inDatum)
+                    editor.setValue(inDatum);
+            }
+        );
+           return editor;
+    },
+});
+
 }
+
index 03c6f39..4ae3e31 100644 (file)
@@ -55,6 +55,11 @@ var JUBGrid = {
         if(!data || !data.provider) return;
         return openils.acq.Provider.retrieve(data.provider).code();
     },
+    getCopyLocation : function(rowIndex) {
+        var data = JUBGrid.jubDetailGrid.model.getRow(rowIndex);
+        if(!data || !data.location) return '';
+        return openils.CopyLocation.retrieve(data.location).name();
+    },
     getLIDFundName : function(rowIndex) {
         var data = JUBGrid.jubDetailGrid.model.getRow(rowIndex);
         if (!data || !data.fund) return;
@@ -78,20 +83,21 @@ var JUBGrid = {
         if(JUBGrid.showDetails) {
             dojo.connect(gridWidget, "onRowClick", 
                 function(evt) {
-            var jub = model.getRow(evt.rowIndex);
-            var grid;
+                    var jub = model.getRow(evt.rowIndex);
+                    var grid;
 
-            JUBGrid.jubDetailGrid.lineitemID = jub.id;
+                    JUBGrid.jubDetailGrid.lineitemID = jub.id;
 
-            if (jub.state == "approved") {
-                grid = JUBGrid.jubDetailGridLayoutReadOnly;
-            } else {
-                grid = JUBGrid.jubDetailGridLayout;
-            }
-            openils.acq.Lineitems.loadGrid(
+                    if (jub.state == "approved") {
+                        grid = JUBGrid.jubDetailGridLayoutReadOnly;
+                    } else {
+                        grid = JUBGrid.jubDetailGridLayout;
+                    }
+                    openils.acq.Lineitems.loadGrid(
                         JUBGrid.jubDetailGrid, 
                         JUBGrid.jubGrid.model.getRow(evt.rowIndex).id, grid);
-                });
+                }
+            );
         }
         gridWidget.update();
     },
index eeaed9f..e55482a 100644 (file)
@@ -44,6 +44,7 @@ pointing to the JUB model (and store) that you have created.
 % endif
 
     <script src='${c.oils.core.media_prefix.value}/ui_js/oils/default/common/jubgrid.js'> </script>
+    <script src='${c.oils.core.media_prefix.value}/js/dojo/openils/CopyLocation.js'> </script>
     <script type="text/javascript">
     JUBGrid.getPO = function(rowIndex) {
         var data = JUBGrid.jubGrid.model.getRow(rowIndex);
@@ -85,10 +86,13 @@ pointing to the JUB model (and store) that you have created.
                 editorClass: "dijit.form.TextBox" 
                },
             {name:"Shelving Location", field:"location", width:'auto',
+                editor:openils.editors.CopyLocationSelectEditor,
+                get:JUBGrid.getCopyLocation
+                /*
                 editor:dojox.grid.editors.Dijit, 
-                editorClass: "dijit.form.TextBox" 
+                editorClass: "dijit.form.FilteringSelect",
+                */
                },
-
         ]]
     }];