From 4e71416e67efa6cd195b7341fc93a212f35793a2 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 15 Jul 2008 00:43:42 +0000 Subject: [PATCH] added year filter git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@10037 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../ui_js/oils/default/acq/financial/list_funds.js | 27 ++++++++++++++++++++-- .../oils/default/acq/financial/list_funds.html | 6 ++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/list_funds.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/list_funds.js index 0f059f9013..5b047ef141 100644 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/list_funds.js +++ b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/list_funds.js @@ -8,8 +8,6 @@ dojo.require('openils.acq.CurrencyType'); dojo.require('openils.Event'); dojo.require('openils.acq.Fund'); -var globalUser = new openils.User(); - function getOrgInfo(rowIndex) { data = fundListGrid.model.getRow(rowIndex); if(!data) return; @@ -31,9 +29,34 @@ function loadFundGrid() { {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); fundListGrid.setModel(model); fundListGrid.update(); + + var yearStore = {identifier:'year', name:'year', items:[]}; + + var added = []; + for(var i = 0; i < storeData.items.length; i++) { + var year = storeData.items[i].year; + if(added.indexOf(year) == -1) { + yearStore.items.push({year:year}); + added.push(year); + } + } + yearStore.items = yearStore.items.sort().reverse(); + fundFilterYearSelect.store = new dojo.data.ItemFileReadStore({data:yearStore}); + var today = new Date().getFullYear().toString(); + fundFilterYearSelect.setValue((added.indexOf(today != -1)) ? today : added[0]); } ); } +function filterGrid() { + var year = fundFilterYearSelect.getValue(); + if(year) + fundListGrid.model.query = {year:year}; + else + fundListGrid.model.query = {id:'*'}; + fundListGrid.model.refresh(); + fundListGrid.update(); +} + dojo.addOnLoad(loadFundGrid); diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html index c83c7da81e..8d19b49758 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html @@ -36,7 +36,7 @@
@@ -81,6 +81,10 @@ fundListGrid, function(){location.href = location.href})"> ${_('Delete Selected')} + + + -- 2.11.0