From 1a38594e4376f625ac16f4f536fd649b6828911c Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 12 May 2008 20:14:13 +0000 Subject: [PATCH] moved fund js to external file git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9559 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../ui_js/oils/default/acq/financial/view_fund.js | 77 +++++++++++++++++++++ .../oils/default/acq/financial/view_fund.html | 80 +--------------------- 2 files changed, 80 insertions(+), 77 deletions(-) create mode 100644 Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/view_fund.js diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/view_fund.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/view_fund.js new file mode 100644 index 0000000000..d03f54a3b3 --- /dev/null +++ b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/view_fund.js @@ -0,0 +1,77 @@ +dojo.require("dijit.Dialog"); +dojo.require('dijit.layout.TabContainer'); +dojo.require('dijit.layout.ContentPane'); +dojo.require('dojox.grid.Grid'); + +dojo.require("fieldmapper.OrgUtils"); +dojo.require('openils.acq.Fund'); +dojo.require('openils.acq.FundingSource'); +dojo.require('openils.Event'); +dojo.require('openils.User'); + +var fund = null; + +function getSummaryInfo(rowIndex) { + switch(this.index) { + case 4: return new String(fund.summary().combined_balance); + case 5: return new String(fund.summary().allocation_total); + case 6: return new String(fund.summary().spent_balance); + case 7: return new String(fund.summary().debit_total); + case 8: return new String(fund.summary().spent_total); + case 9: return new String(fund.summary().encumberance_total); + } +} + +function getOrgInfo(rowIndex) { + data = fundGrid.model.getRow(rowIndex); + if(!data) return; + return fieldmapper.aou.findOrgUnit(data.org).shortname(); +} + + +function loadFundGrid() { + var store = new dojo.data.ItemFileReadStore({data:acqf.toStoreData([fund])}); + var model = new dojox.grid.data.DojoData( + null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); + fundGrid.setModel(model); + fundGrid.update(); +} + +function loadAllocationGrid() { + if(fundAllocationGrid.isLoaded) return; + var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.allocations())}); + var model = new dojox.grid.data.DojoData( + null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); + fundAllocationGrid.setModel(model); + fundAllocationGrid.update(); + fundAllocationGrid.isLoaded = true; +} + +function loadDebitGrid() { + if(fundDebitGrid.isLoaded) return; + var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.debits())}); + var model = new dojox.grid.data.DojoData( + null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); + fundDebitGrid.setModel(model); + fundDebitGrid.update(); + fundDebitGrid.isLoaded = true; +} + +function fetchFund() { + fieldmapper.standardRequest( + ['open-ils.acq', 'open-ils.acq.fund.retrieve'], + { async: true, + params: [ + openils.User.authtoken, fundID, + {flesh_summary:1, flesh_allocations:1, flesh_debits:1} + /* TODO grab allocations and debits only on as-needed basis */ + ], + oncomplete: function(r) { + fund = r.recv().content(); + loadFundGrid(fund); + } + } + ); +} + +dojo.addOnLoad(fetchFund); diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html index d9fec41106..fdd0993b77 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html @@ -4,37 +4,7 @@ <%def name="block_content()"> - function loadFundGrid() { - var store = new dojo.data.ItemFileReadStore({data:acqf.toStoreData([fund])}); - var model = new dojox.grid.data.DojoData( - null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); - fundGrid.setModel(model); - fundGrid.update(); - } - - function loadAllocationGrid() { - if(fundAllocationGrid.isLoaded) return; - var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.allocations())}); - var model = new dojox.grid.data.DojoData( - null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); - fundAllocationGrid.setModel(model); - fundAllocationGrid.update(); - fundAllocationGrid.isLoaded = true; - } - - function loadDebitGrid() { - if(fundDebitGrid.isLoaded) return; - var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.debits())}); - var model = new dojox.grid.data.DojoData( - null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); - fundDebitGrid.setModel(model); - fundDebitGrid.update(); - fundDebitGrid.isLoaded = true; - } - - function fetchFund() { - fieldmapper.standardRequest( - ['open-ils.acq', 'open-ils.acq.fund.retrieve'], - { async: true, - params: [ - openils.User.authtoken, fundID, - {flesh_summary:1, flesh_allocations:1, flesh_debits:1} - /* TODO grab allocations and debits only on as-needed basis */ - ], - oncomplete: function(r) { - fund = r.recv().content(); - loadFundGrid(fund); - } - } - ); - } + + - dojo.addOnLoad(fetchFund); - -
${_('Fund Details')}
-- 2.11.0