[open-ils-commits] r12706 - in trunk/Open-ILS/web: js/ui/default/acq/po templates/default/acq/po (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Mar 27 16:00:01 EDT 2009
Author: erickson
Date: 2009-03-27 15:59:57 -0400 (Fri, 27 Mar 2009)
New Revision: 12706
Modified:
trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js
trunk/Open-ILS/web/templates/default/acq/po/view.tt2
Log:
plugged in intial lineitem table implementation
Modified: trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js 2009-03-27 19:58:50 UTC (rev 12705)
+++ trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js 2009-03-27 19:59:57 UTC (rev 12706)
@@ -1,81 +1,36 @@
-dojo.require("dijit.Dialog");
-dojo.require('dijit.form.FilteringSelect');
-dojo.require('dijit.layout.TabContainer');
dojo.require('dijit.layout.ContentPane');
-dojo.require('dojox.grid.DataGrid');
-dojo.require('dojo.data.ItemFileReadStore');
-dojo.require('openils.acq.PO');
-dojo.require('openils.Event');
dojo.require('openils.User');
dojo.require('openils.Util');
-dojo.require('fieldmapper.OrgUtils');
-dojo.require('openils.acq.Provider');
-dojo.require('openils.acq.Lineitem');
-dojo.require('dojo.date.locale');
-dojo.require('dojo.date.stamp');
var PO = null;
-var lineitems = [];
+var liTable;
-function getOrgInfo(rowIndex, item) {
- if(!item) return '';
- var data = this.grid.store.getValue(item , 'ordering_agency')
- return fieldmapper.aou.findOrgUnit(data).shortname();
-}
+function init() {
+ liTable = new AcqLiTable();
+ liTable.reset();
+ liTable.isPO = true;
-function getProvider(rowIndex, item) {
- if(!item) return '';
- var data = this.grid.store.getValue(item, 'provider');
- return openils.acq.Provider.retrieve(data).code();
-}
+ fieldmapper.standardRequest(
+ ['open-ils.acq', 'open-ils.acq.purchase_order.retrieve'],
+ { async: true,
+ params: [openils.User.authtoken, poId],
+ oncomplete: function(r) {
+ PO = openils.Util.readResponse(r);
+ console.log('got PO');
+ }
+ }
+ );
-function getPOOwner(rowIndex, item) {
- if(!item) return '';
- var data = this.grid.store.getValue(item, 'owner');
- return new openils.User({id:data}).user.usrname();
-}
-
-function getDateTimeField(rowIndex, item) {
- if(!item) return '';
- var data = this.grid.store.getValue(item, this.field);
- var date = dojo.date.stamp.fromISOString(data);
- return dojo.date.locale.format(date, {formatLength:'medium'});
-}
-
-function loadPOGrid() {
- if(!PO) return '';
- var store = new dojo.data.ItemFileReadStore({data:acqpo.toStoreData([PO])});
- poGrid.setStore(store);
- poGrid.render();
-}
-
-function loadLIGrid() {
- if(liGrid.isLoaded) return;
-
- function load(po) {
- 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:'*'}});
- JUBGrid.populate(liGrid, model, lineitems)
- }
-
- openils.acq.PO.retrieve(poId, load, {flesh_lineitems:1, clear_marc:1});
- liGrid.isLoaded = true;
-}
-
-function loadPage() {
- fetchPO();
-}
-
-function fetchPO() {
- openils.acq.PO.retrieve(poId,
- function(po) {
- PO = po;
- loadPOGrid();
- },
- {flesh_lineitem_count:1}
+ fieldmapper.standardRequest(
+ ['open-ils.acq', 'open-ils.acq.lineitem.search'],
+ { async: true,
+ params: [openils.User.authtoken, {purchase_order:poId}, {flesh_attrs:true}],
+ onresponse: function(r) {
+ liTable.show('list');
+ liTable.addLineitem(openils.Util.readResponse(r));
+ }
+ }
);
}
-openils.Util.addOnLoad(loadPage);
+openils.Util.addOnLoad(init);
Modified: trunk/Open-ILS/web/templates/default/acq/po/view.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/po/view.tt2 2009-03-27 19:58:50 UTC (rev 12705)
+++ trunk/Open-ILS/web/templates/default/acq/po/view.tt2 2009-03-27 19:59:57 UTC (rev 12706)
@@ -1,45 +1,14 @@
-[% WRAPPER default/base.tt2 %]
-<script>
- var poId = [% ctx.page_args.0 %];
-</script>
-
+[% WRAPPER 'default/base.tt2' %]
<script src='[% ctx.media_prefix %]/js/ui/default/acq/po/view_po.js'> </script>
-
-<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>
-
- <div dojoType="dijit.layout.ContentPane" layoutAlign="top">
- <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
- <table jsId="poGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'>
- <thead>
- <tr>
- <th field="id">ID</th>
- <th field="owner" get='getPOOwner'>Owner</th>
- <th field="ordering_agency" get='getOrgInfo'>Ordering Agency</th>
- <th field="create_time" width='auto' get='getDateTimeField'>Create Time</th>
- <th field="edit_time" width='auto' get='getDateTimeField'>Edit Time</th>
- <th field="provider" get='getProvider'>Provider</th>
- <th field="lineitem_count"># Lineitems</th>
- <th field="state">State</th>
- </tr>
- </thead>
- </table>
- </div>
- </div>
+<div dojoType="dijit.layout.ContentPane" style="height:100%">
+ <div>
+ <div id='oils-acq-picklist-header'>
+ <div>
+ Purchase Order
+ </div>
</div>
- <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Line Items">
- <script type='dojo/connect' event='onShow'>loadLIGrid();</script>
- [% grid_jsid = 'liGrid'; domprefix = 'oils-acq-lineitem' %]
- [% INCLUDE 'default/acq/common/jubgrid.tt2' %]
- </div>
</div>
+ <script type="text/javascript">var poId = '[% ctx.page_args.0 %]';</script>
+ [% INCLUDE 'default/acq/common/li_table.tt2' %]
</div>
[% END %]
More information about the open-ils-commits
mailing list