now using common lineitem display
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 22 May 2008 20:58:49 +0000 (20:58 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 22 May 2008 20:58:49 +0000 (20:58 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9674 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/view_po.js
Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po.html

index 99fb386..f55dac7 100644 (file)
@@ -40,42 +40,6 @@ function getDateTimeField(rowIndex) {
     return dojo.date.locale.format(date, {formatLength:'medium'});
 }
 
-function getLi(id) {
-    for(var i in lineitems) {
-        var li = lineitems[i];
-        if(li.id() == id) 
-            return li;
-    }
-}
-
-function getJUBTitle(rowIndex) {
-    var data = liGrid.model.getRow(rowIndex);
-    if(!data) return '';
-    return new openils.acq.Lineitems(
-        {lineitem:getLi(data.id)}).findAttr('title', 'lineitem_marc_attr_definition')
-}
-
-function getJUBIsbn(rowIndex) {
-    var data = liGrid.model.getRow(rowIndex);
-    if(!data) return '';
-    return new openils.acq.Lineitems(
-        {lineitem:getLi(data.id)}).findAttr('isbn', 'lineitem_marc_attr_definition')
-}
-
-function getJUBPubdate(rowIndex) {
-    var data = liGrid.model.getRow(rowIndex);
-    if(!data) return '';
-    return new openils.acq.Lineitems(
-        {lineitem:getLi(data.id)}).findAttr('pubdate', 'lineitem_marc_attr_definition')
-}
-
-function getJUBPrice(rowIndex) {
-    var data = liGrid.model.getRow(rowIndex);
-    if(!data) return;
-    return new openils.acq.Lineitems(
-        {lineitem:getLi(data.id)}).findAttr('price', 'lineitem_marc_attr_definition')
-}
-
 function loadPOGrid() {
     if(!PO) return;
     var store = new dojo.data.ItemFileReadStore({data:acqpo.toStoreData([PO])});
@@ -94,8 +58,7 @@ function loadLIGrid() {
         var store = new dojo.data.ItemFileReadStore({data:jub.toStoreData(lineitems)});
         var model = new dojox.grid.data.DojoData(
             null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
-        liGrid.setModel(model);
-        liGrid.update();
+        JUBGrid.populate(liGrid, model, lineitems)
     }
 
     fieldmapper.standardRequest(
index 3d0e2f6..8627719 100644 (file)
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 <%inherit file='base.html' />
+<%namespace file='/oils/default/common/jubgrid.html' name='jubgrid'/>
 
 <%def name='page_title()'>${_('View PO')}</%def>
 <%def name='block_content()'>
             </script>
             <div jsId='poGrid' dojoType="dojox.Grid" structure='poGridStructure'> </div>
         </div>
-
         <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="${_('Line Items')}">
             <script type='dojo/connect' event='onShow'>loadLIGrid();</script>
-            <script>
-                var liGridStructure = [{
-                    cells: [[
-                        {name: '${_("ID")}', field: 'id'},
-                        {name: '${_("Title")}', width: 'auto', get:getJUBTitle},
-                        {name: '${_("ISBN")}', get:getJUBIsbn},
-                        {name: '${_("Pubdate")}', get:getJUBPubdate},
-                        {name: '${_("Price")}', get:getJUBPrice},
-                        {name: '${_("Vendor")}', get:getProvider},
-                        {name: '${_("# of Copies")}', field: 'item_count'},
-                        {name: '${_("State")}', field: 'state'}
-                    ]]
-                }];
-            </script>
-            <div jsId='liGrid' dojoType="dojox.Grid" structure='liGridStructure'> </div>
+            ${jubgrid.jubgrid('oils-acq-lineitem', 'liGrid')}
         </div>
     </div>
 </div>