From b02b3d5097a8841eccffd30327f8c5096305f53b Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 12 May 2008 19:42:33 +0000 Subject: [PATCH] finished wiring up the fund allocation create tooltip also, no longer reloading entire page on fund allocation and funding source credit create complete, just refetching objects and redrawing grids git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9556 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../default/acq/financial/view_funding_source.html | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html index f824e21b82..62d2894728 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html @@ -22,15 +22,24 @@ var fundingSourceID = ${c.oils.acq.funding_source_id}; var fundingSource = null; + function resetPage() { + fundingSource = null; + fsCreditGrid.isLoaded = false; + fsAllocationGrid.isLoaded = false; + loadFS(); + } + /** creates a new funding_source_credit from the dialog ----- */ function applyFSCredit(fields) { fields.funding_source = fundingSourceID; - openils.acq.FundingSource.createCredit( - fields, - function(fscId) { - location.href = location.href; - } - ); + openils.acq.FundingSource.createCredit(fields, resetPage); + } + + function applyFSAllocation(fields) { + fields.funding_source = fundingSourceID; + if(isNaN(fields.percent)) fields.percent = null; + if(isNaN(fields.amount)) fields.amount = null; + openils.acq.Fund.createAllocation(fields, resetPage); } /** fetch the fleshed funding source ----- */ @@ -79,6 +88,7 @@ /** builds the credits grid ----- */ function loadFSGrid() { + if(!fundingSource) return; var store = new dojo.data.ItemFileReadStore({data:acqfs.toStoreData([fundingSource])}); var model = new dojox.grid.data.DojoData(null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); fundingSourceGrid.setModel(model); @@ -156,8 +166,7 @@ fundingSourceFundSelector.store = new dojo.data.ItemFileReadStore({data:store}); fundingSourceFundSelector.setValue(store.items[0].id); - }, - 'ADMIN_FUND' /* need to check MANAGE_FUND as well... */ + }, 'MANAGE_FUND' ); @@ -210,6 +219,7 @@
+