From 0cf7f2a543690613ad70c37ff3c4928f17154365 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 8 Apr 2008 15:37:59 +0000 Subject: [PATCH] added a FilteringSelect to create a new funding source. has some hard-coded vals for now.. working to replace git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9268 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../oils/media/js/openils/acq/FundingSource.js | 26 +++++++++++- .../acq/financial/list_funding_sources.html | 46 ++++++++++++++++------ 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js index dbfbde9d2a..f15312f1a9 100644 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js +++ b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js @@ -27,7 +27,7 @@ openils.acq.FundingSource.loadGrid = function(domId, columns) { name:src.name(), owner: findOrgUnit(src.owner()).name(), currency_type:src.currency_type(), - balance:src.summary()['balance'] + balance:new String(src.summary()['balance']) }); } gridRefs.grid.update(); @@ -36,5 +36,29 @@ openils.acq.FundingSource.loadGrid = function(domId, columns) { req.send(); return gridRefs.grid; }; + +/** + * Create a new funding source object + * @param fields Key/value pairs used to create the new funding source + */ +openils.acq.FundingSource.create = function(fields, onCreateComplete) { + + var fs = new acqfs() + for(var field in fields) + fs[field](fields[field]); + + var ses = new OpenSRF.ClientSession('open-ils.acq'); + var req = ses.request('open-ils.acq.funding_source.create', oilsAuthtoken, fs); + + req.oncomplete = function(r) { + var msg = r.recv(); + var id = msg.content(); + fs.id(id); /* XXX check for event */ + if(onCreateComplete) + onCreateComplete(fs); + }; + req.send(); +}; + } diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funding_sources.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funding_sources.html index 5fb6a6a350..a9c43681f7 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funding_sources.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funding_sources.html @@ -13,19 +13,30 @@ --> + +
${('New Funding Source')} -
- +
+
@@ -33,20 +44,29 @@ - + - - +
- + + + +
+ +
+ +
@@ -69,7 +89,7 @@ /* build the funding-source grid on page load */ dojo.addOnLoad( function(){ - var fsGrid = openils.acq.FundingSource.loadGrid('oils-acq-funding-source-grid', cols); + fsGrid = openils.acq.FundingSource.loadGrid('oils-acq-funding-source-grid', cols); fsGrid.onRowClick = function(evt) { /** XXX Need to make this more user friendly / obvious ... */ id = fsGrid.model.getDatum(evt.rowIndex, 0); -- 2.11.0