From 7c025bb7a41c0a206074f75eea23c42a7c79aa71 Mon Sep 17 00:00:00 2001 From: erickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Tue, 30 Mar 2010 15:50:41 +0000 Subject: [PATCH] moved to auto-grid for allocations and debits for paging support, etc. hiding percent-based allocation option for now since they are not supported by the back-end git-svn-id: svn://svn.open-ils.org/ILS/trunk@16056 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/fm_IDL.xml | 2 +- .../web/js/ui/default/acq/financial/view_fund.js | 13 +-- .../templates/default/acq/financial/view_fund.tt2 | 100 +++++++++++---------- 3 files changed, 56 insertions(+), 59 deletions(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 77e4fb1522..3e813f5c63 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -4955,7 +4955,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA <field reporter:label="Origin Amount" name="origin_amount" reporter:datatype="money" /> <field reporter:label="Origin Currency" name="origin_currency_type" reporter:datatype="link" /> <field reporter:label="Amount" name="amount" reporter:datatype="money" /> - <field reporter:label="Encumbrance" name="encumbrance" reporter:datatype="text" /> + <field reporter:label="Encumbrance" name="encumbrance" reporter:datatype="bool" /> <field reporter:label="Debit Type" name="debit_type" reporter:datatype="text" /> <field reporter:label="Create Time" name="create_time" reporter:datatype="timestamp" /> </fields> diff --git a/Open-ILS/web/js/ui/default/acq/financial/view_fund.js b/Open-ILS/web/js/ui/default/acq/financial/view_fund.js index aedddf1e8f..0813a59245 100644 --- a/Open-ILS/web/js/ui/default/acq/financial/view_fund.js +++ b/Open-ILS/web/js/ui/default/acq/financial/view_fund.js @@ -13,6 +13,7 @@ dojo.require('openils.Event'); dojo.require('openils.User'); dojo.require('openils.Util'); dojo.require("openils.widget.AutoFieldWidget"); +dojo.require("openils.widget.AutoGrid"); var fund = null; var tagManager; @@ -25,7 +26,6 @@ function getSummaryInfo(rowIndex, item) { function createAllocation(fields) { fields.fund = fundID; - if(isNaN(fields.percent)) fields.percent = null; if(isNaN(fields.amount)) fields.amount = null; openils.acq.Fund.createAllocation(fields, function(r){location.href = location.href;}); @@ -52,17 +52,13 @@ function loadFundGrid() { function loadAllocationGrid() { if(fundAllocationGrid.isLoaded) return; - var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.allocations())}); - fundAllocationGrid.setStore(store); - fundAllocationGrid.render(); + fundAllocationGrid.loadAll({order_by : {acqfa : 'create_time DESC'}}); fundAllocationGrid.isLoaded = true; } function loadDebitGrid() { if(fundDebitGrid.isLoaded) return; - var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.debits())}); - fundDebitGrid.setStore(store); - fundDebitGrid.render(); + fundDebitGrid.loadAll({order_by : {acqfdeb : 'create_time DESC'}}); fundDebitGrid.isLoaded = true; } @@ -72,8 +68,7 @@ function fetchFund() { { async: true, params: [ openils.User.authtoken, fundID, - {flesh_summary:1, flesh_allocations:1, flesh_debits:1, flesh_tags:1} - /* TODO grab allocations and debits only on as-needed basis */ + {flesh_summary:1, flesh_tags:1} ], oncomplete: function(r) { fund = r.recv().content(); diff --git a/Open-ILS/web/templates/default/acq/financial/view_fund.tt2 b/Open-ILS/web/templates/default/acq/financial/view_fund.tt2 index 4d183d19ad..836ca7241a 100644 --- a/Open-ILS/web/templates/default/acq/financial/view_fund.tt2 +++ b/Open-ILS/web/templates/default/acq/financial/view_fund.tt2 @@ -2,10 +2,10 @@ <script> var fundID = [% ctx.page_args.0 %] function getFundingSource(rowIndex, item) { - if(!item) return ''; - var fs_id = this.grid.store.getValue(item, 'funding_source'); - var fs = openils.acq.FundingSource.retrieve(fs_id); - return '<a href="[% ctx.base_path %]/acq/funding_source/view/'+fs.id()+'">'+fs.name()+'</a>'; + if(!item) return ''; + var fs_id = this.grid.store.getValue(item, 'funding_source'); + var fs = openils.acq.FundingSource.retrieve(fs_id); + return '<a href="[% ctx.base_path %]/acq/funding_source/view/'+fs.id()+'">'+fs.name()+'</a>'; } </script> @@ -24,11 +24,12 @@ <div dojoType="dijit.TooltipDialog" execute="createAllocation(arguments[0]);"> <script type='dojo/connect' event='onOpen'> openils.acq.FundingSource.createStore( - function(store) { - fundingSourceSelector.store = - new dojo.data.ItemFileReadStore({data:store}); - fundingSourceSelector.setValue(store.items[0].code); - }, 'MANAGE_FUNDING_SOURCE' + function(store) { + fundingSourceSelector.store = + new dojo.data.ItemFileReadStore({data:store}); + fundingSourceSelector.setValue(store.items[0].code); + }, + 'MANAGE_FUNDING_SOURCE' ); </script> <table class='dijitTooltipTable'> @@ -47,6 +48,8 @@ <input dojoType="dijit.form.CurrencyTextBox" name="amount" currency='USD'> </input> </td> </tr> + + <!-- Percent-based allocations are not supported. Will implement or remove later. <tr> <td><label for="amount">Percent: </label></td> <td> @@ -58,6 +61,8 @@ </input> </td> </tr> + --> + <tr> <td><label for="note">Note: </label></td> <td> @@ -155,6 +160,8 @@ <div dojoType="dijit.layout.ContentPane" layoutAlign="top"> <div dojoType="dijit.layout.TabContainer"> + + <!-- Fund Summary --> <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Summary" selected='true'> @@ -164,7 +171,7 @@ <thead> <tr> <th field="id">ID</th> - <th field="name" width='auto'>Name</th> + <th field="name">Name</th> <th field="code">Code</th> <th field="currency_type">Currency Type</th> <th field="org" get='getOrgInfo'>Owner</th> @@ -177,59 +184,54 @@ </tr> </thead> </table> - - <!-- - {name: 'Balance (Total - (Spent + Encumbrances))")}', get:getSummaryInfo}, - {name: 'Amount Allocated to this Fund")}', get:getSummaryInfo}, - {name: 'Spent Balance (Total - Spent)")}', get:getSummaryInfo}, - {name: 'Total Debits (Spent + Encumbered)")}', get:getSummaryInfo}, - --> - + </div> + </div> </div> - </div> -</div> + + <!-- Fund Allocations --> <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Allocations"> <script type='dojo/connect' event='onShow'>loadAllocationGrid();</script> <div dojoType="dijit.layout.ContentPane" layoutAlign="top"> - <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'> - <table jsId="fundAllocationGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'> - <thead> - <tr> - <th field="id">ID</th> - <th field="funding_source" get='getFundingSource'>Funding Source</th> - <th field="amount">Amount</th> - <th field="percent">Percent</th> - <th field="allocator">Allocated By</th> - <th field="note" width='auto'>Note</th> - </tr> - </thead> - </table> + <div dojoType="dijit.layout.ContentPane" layoutAlign="client"> + + <table + jsId="fundAllocationGrid" + autoHeight='true' + dojoType="openils.widget.AutoGrid" + fieldOrder="['funding_source', 'amount', 'create_time', 'allocator', 'note']" + suppressFields="['id', 'fund']" + defaultCellWidth='"auto"' + fmClass="acqfa" + query="{id: '*'}" + showPaginator='true'> + </table> </div> </div> - </div> + + <!--- Fund Debits --> <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Debits"> <script type='dojo/connect' event='onShow'>loadDebitGrid();</script> - <div dojoType="dijit.layout.ContentPane" layoutAlign="top"> - <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'> - <table jsId="fundDebitGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'> - <thead> - <tr> - <th field="id">ID</th> - <th field="origin_amount">Origin Amount</th> - <th field="origin_currency_type">Origin Currency Type</th> - <th field="amount">Amount</th> - <th field="encumbrance">Encumbrance</th> - <th field="debit_type">Debit Type</th> - <th field="xfer_destination" get='getXferDestination'>Transfer Destination</th> - </tr> - </thead> - </table> + <div dojoType="dijit.layout.ContentPane" layoutAlign="top" style='height:600px;'> + <div dojoType="dijit.layout.ContentPane" layoutAlign="client"> + + <table + jsId="fundDebitGrid" + autoHeight='true' + dojoType="openils.widget.AutoGrid" + fieldOrder="['amount', 'encumbrance', 'debit_type', 'origin_amount', 'origin_currency_type']" + suppressFields="['id', 'fund']" + defaultCellWidth='"auto"' + fmClass="acqfdeb" + query="{id: '*'}" + showPaginator='true'> + </table> </div> </div> </div> + <div dojoType="dijit.layout.ContentPane" class="oils-acq-detail-content-pane" title="Tags"> <script type="dojo/connect" event="onShow"> tagManager.displayFund(fund); -- 2.11.0