[open-ils-commits] SPAM: r9578 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
public/oils/media/ui_js/oils/default/acq/po
templates/oils/default/acq/po
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue May 13 11:34:35 EDT 2008
Author: erickson
Date: 2008-05-13 11:34:33 -0400 (Tue, 13 May 2008)
New Revision: 9578
Added:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/view_po.js
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/search.js
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/search.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po.html
Log:
dojo-ized the PO details interface. for now, has summary and lineitem grids
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/search.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/search.js 2008-05-13 14:52:21 UTC (rev 9577)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/search.js 2008-05-13 15:34:33 UTC (rev 9578)
@@ -18,7 +18,7 @@
return openils.acq.Provider.retrieve(data.provider).name();
}
-function getOwner(rowIndex) {
+function getPOOwner(rowIndex) {
data = poGrid.model.getRow(rowIndex);
if(!data) return;
return new openils.User({id:data.owner}).user.usrname();
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/view_po.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/view_po.js (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/view_po.js 2008-05-13 15:34:33 UTC (rev 9578)
@@ -0,0 +1,104 @@
+dojo.require("dijit.Dialog");
+dojo.require('dijit.form.FilteringSelect');
+dojo.require('dijit.layout.TabContainer');
+dojo.require('dijit.layout.ContentPane');
+dojo.require('dojox.grid.Grid');
+dojo.require('openils.acq.PO');
+dojo.require('openils.Event');
+dojo.require('openils.User');
+dojo.require('fieldmapper.OrgUtils');
+dojo.require('openils.acq.Provider');
+dojo.require('openils.acq.Picklist');
+
+var PO = null;
+var lineitems = [];
+
+function getOrgInfo(rowIndex) {
+ data = poGrid.model.getRow(rowIndex);
+ if(!data) return;
+ return fieldmapper.aou.findOrgUnit(data.owner).shortname();
+}
+
+function getProvider(rowIndex) {
+ data = poGrid.model.getRow(rowIndex);
+ if(!data) return;
+ return openils.acq.Provider.retrieve(data.provider).name();
+}
+
+function getPOOwner(rowIndex) {
+ data = poGrid.model.getRow(rowIndex);
+ if(!data) return;
+ return new openils.User({id:data.owner}).user.usrname();
+}
+
+function getJUBTitle(rowIndex) {
+ var data = liGrid.model.getRow(rowIndex);
+ if(!data) return '';
+ for(var i in lineitems) {
+ var li = lineitems[i];
+ if(li.id() == data.id) {
+ openils.acq.Picklist.cache[data.id] = li;
+ return openils.acq.Picklist.find_attr(data.id, 'title', 'lineitem_marc_attr_definition')
+ }
+ }
+}
+
+function getJUBPrice(rowIndex) {
+ var data = liGrid.model.getRow(rowIndex);
+ if(!data) return;
+ for(var i in lineitems) {
+ var li = lineitems[i];
+ if(li.id() == data.id) {
+ openils.acq.Picklist.cache[data.id] = li;
+ return openils.acq.Picklist.find_attr(data.id, 'price', 'lineitem_marc_attr_definition')
+ }
+ }
+}
+
+
+function loadPOGrid() {
+ if(!PO) return;
+ var store = new dojo.data.ItemFileReadStore({data:acqpo.toStoreData([PO])});
+ var model = new dojox.grid.data.DojoData(
+ null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
+ poGrid.setModel(model);
+ poGrid.update();
+}
+
+function loadLIGrid() {
+ if(liGrid.isLoaded) return;
+
+ function load(r) {
+ var po = r.recv().content();
+ lineitems = po.lineitems();
+ 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();
+ }
+
+ fieldmapper.standardRequest(
+ ['open-ils.acq', 'open-ils.acq.purchase_order.retrieve'],
+ { async: true,
+ params: [openils.User.authtoken, poId, {flesh_lineitems:1, clear_marc:1}], /* XXX PAGING */
+ oncomplete : load
+ }
+ );
+ liGrid.isLoaded = true;
+}
+
+function loadPage() {
+ fetchPO();
+}
+
+function fetchPO() {
+ openils.acq.PO.retrieve(poId,
+ function(po) {
+ PO = po;
+ loadPOGrid();
+ }
+ );
+}
+
+dojo.addOnLoad(loadPage);
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/search.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/search.html 2008-05-13 14:52:21 UTC (rev 9577)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/search.html 2008-05-13 15:34:33 UTC (rev 9578)
@@ -32,7 +32,7 @@
var poGridStructure = [{
cells : [[
{name: '${_("ID")}', field: 'id'},
- {name: '${_("Owner")}', get:getOwner},
+ {name: '${_("Owner")}', get:getPOOwner},
{name: '${_("Ordering Agency")}', get:getOrgInfo},
{name: '${_("Create Time")}', field:'create_time'},
{name: '${_("Edit Time")}', field: "edit_time"},
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po.html 2008-05-13 14:52:21 UTC (rev 9577)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po.html 2008-05-13 15:34:33 UTC (rev 9578)
@@ -1,62 +1,57 @@
# -*- coding: utf-8 -*-
<%inherit file='../base.html' />
-<%namespace file='../../common/widgets.html' name='widget' />
-<%def name='page_title()'>${_('Evergreen View PO')}</%def>
+<%def name='page_title()'>${_('View PO')}</%def>
<%def name='block_content()'>
-<%include file='po_summary.html' />
-<form method="POST" action="${c.oils.acq.prefix.value}/po/update">
-<input type="hidden" name="${c.oils.acq.po_id.cgi_name}"
- value="${c.oils.acq.po.value.id()}">
-<table id="oils-acq-po-table">
- <thead>
- <tr>
- <td colspan="3" id="oils-acq-po-header-block">
- <table id="oils-acq-po-header-subtable">
- <tr>
- <td id="oils-acq-po-paging-block">
- PUT PAGING HERE
- </td>
- <td id="oils-acq-po-actions-block">
- PUT PO ACTIONS HERE
- </td>
- </tr></table>
- </td></tr>
- <tr><td colspan="2">Item</td><td># of Copies</td><td>Select</td>
- </thead>
- <tbody>
- <%
- import oilsweb.lib.bib
- from oilsweb.lib.acq.po_manager import PO_Manager
-%>
- % for li in c.oils.acq.po.value.lineitems():
- <tr class='oils-acq-po-records-title-row'>
- <td rowspan='3'>
- <img class='oils-acq-po-records-jacket'
- src='${c.oils.core.ac_prefix.value}/jacket/small/${oilsweb.lib.bib.scrub_isbn(PO_Manager.find_li_attr(li, "isbn"))}'/>
- </td>
- <td>
- <a href='../view_lineitem/${li.id()}'>${PO_Manager.find_li_attr(li, "title")}</a>
- </td>
- <td>${li.item_count()}</td>
- <td><input type='checkbox' name='${c.oils.acq.po_li_id_list.cgi_name}' value='${li.id()}'/></td>
- </tr>
+<script>
+ var poId = ${c.oils.acq.po_id.value};
+</script>
+<script src='${c.oils.core.media_prefix.value}/ui_js/oils/default/acq/po/view_po.js'> </script>
- <tr class='oils-acq-po-records-author-row'>
- <td colspan='4'>${PO_Manager.find_li_attr(li, "author")}
- </tr>
- <tr class='oils-acq-po-records-phys_desc-row'>
- <td colspan='3'>
- ${PO_Manager.find_li_attr(li, "isbn")} |
- ${PO_Manager.find_li_attr(li, "pubdate")} |
- ${PO_Manager.find_li_attr(li, "pagination")}
- <a class='oils-acq-po-li-delete-link' href='${c.oils.acq.prefix.value}/po/delete_li/${li.id()}'>${_('Delete')}</a>
- </td>
- <td>${PO_Manager.find_li_attr(li, "price")}</td>
- </tr>
- % endfor
- </tbody>
-</table>
-</form>
+<div id='oils-acq-list-header' class='container'>
+ <div id='oils-acq-list-header-label'>${_('PO Details')}</div>
+</div>
+
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign="top">
+ <div dojoType="dijit.layout.TabContainer">
+
+ <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="${_('Summary')}" selected='true'>
+ <script type='dojo/connect' event='onShow'>loadPOGrid();</script>
+ <script>
+ var poGridStructure = [{
+ cells : [[
+ {name: '${_("ID")}', field: 'id'},
+ {name: '${_("Owner")}', get:getPOOwner},
+ {name: '${_("Ordering Agency")}', get:getOrgInfo},
+ {name: '${_("Create Time")}', field:'create_time'},
+ {name: '${_("Edit Time")}', field: "edit_time"},
+ {name: '${_("Provider")}', get:getProvider},
+ {name: '${_("State")}', field:'state'}
+ ]]
+ }];
+ </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: '${_("Price")}', get:getJUBPrice},
+ {name: '${_("Vendor")}', field: 'provider'},
+ {name: '${_("# of Copies")}', field: 'item_count'},
+ {name: '${_("State")}', field: 'state'}
+ ]]
+ }];
+ </script>
+ <div jsId='liGrid' dojoType="dojox.Grid" structure='liGridStructure'> </div>
+ </div>
+ </div>
+</div>
+
</%def>
More information about the open-ils-commits
mailing list