[open-ils-commits] r9556 - branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial

svn at svn.open-ils.org svn at svn.open-ils.org
Mon May 12 15:42:36 EDT 2008


Author: erickson
Date: 2008-05-12 15:42:33 -0400 (Mon, 12 May 2008)
New Revision: 9556

Modified:
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html
Log:

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



Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html	2008-05-12 17:28:00 UTC (rev 9555)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html	2008-05-12 19:42:33 UTC (rev 9556)
@@ -22,17 +22,26 @@
     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 ----- */
     function loadFS() {
         var req = ses.request(
@@ -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'
                 );
             </script>
             <table class='dijitTooltipTable'>
@@ -210,6 +219,7 @@
 <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'>loadFSGrid();</script>
             <script>
                 /** Define the columns for the funding source grid ----- */
                 var fundingSourceGridLayout = [{



More information about the open-ils-commits mailing list