From 23d67886e18f716aa57b9d411e8fa17d74ef6703 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 21 Apr 2009 20:24:01 +0000 Subject: [PATCH] by default, load the most recently accessed 'local' purchase orders. made filters non-required, horizonatalized filter layout. ported to autogrid git-svn-id: svn://svn.open-ils.org/ILS/trunk@12952 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/css/skin/default/acq.css | 3 +- Open-ILS/web/js/ui/default/acq/po/search.js | 87 ++++++++++-------------- Open-ILS/web/templates/default/acq/po/search.tt2 | 82 ++++++++++------------ 3 files changed, 73 insertions(+), 99 deletions(-) diff --git a/Open-ILS/web/css/skin/default/acq.css b/Open-ILS/web/css/skin/default/acq.css index e16d4f4ea..a3a687767 100644 --- a/Open-ILS/web/css/skin/default/acq.css +++ b/Open-ILS/web/css/skin/default/acq.css @@ -7,7 +7,7 @@ */ .oils-acq-detail-content-pane {height:600px;width:100%} -.oils-acq-basic-form-table td {padding:4px;} +.oils-acq-basic-form-div {padding:4px; width:95%;} /* bib search */ #oils-acq-search-container { width:100%; } @@ -49,6 +49,7 @@ /* list of pos */ #oils-acq-po-list-table {width: 100%;} #oils-acq-po-list-table td {padding: 3px;} +#oils-acq-po-search-form .dijit {width:130px;} /* a single po */ #oils-acq-po-table { width: 100%; } diff --git a/Open-ILS/web/js/ui/default/acq/po/search.js b/Open-ILS/web/js/ui/default/acq/po/search.js index 956ffe707..b50ff16ba 100644 --- a/Open-ILS/web/js/ui/default/acq/po/search.js +++ b/Open-ILS/web/js/ui/default/acq/po/search.js @@ -2,80 +2,63 @@ dojo.require('dijit.form.Form'); dojo.require('dijit.form.Button'); dojo.require('dijit.form.FilteringSelect'); dojo.require('dijit.form.NumberTextBox'); -dojo.require('dojox.grid.DataGrid'); dojo.require('dojo.data.ItemFileWriteStore'); -dojo.require('openils.acq.Provider'); -dojo.require('fieldmapper.OrgUtils'); dojo.require('dojo.date.locale'); dojo.require('dojo.date.stamp'); dojo.require('openils.User'); dojo.require('openils.Util'); -dojo.require('openils.acq.PO'); -dojo.require('openils.widget.OrgUnitFilteringSelect'); +dojo.require('openils.widget.AutoGrid'); +dojo.require('openils.widget.AutoFieldWidget'); +dojo.require('openils.PermaCrud'); -function getOrgInfo(rowIndex, item) { - if(!item) return ''; - var data = this.grid.store.getValue(item, 'ordering_agency') - return fieldmapper.aou.findOrgUnit(data).shortname(); -} - -function getProvider(rowIndex, item) { - if(!item) return ''; - var data = this.grid.store.getValue(item, 'provider'); - return openils.acq.Provider.retrieve(data).code(); -} - function getPOOwner(rowIndex, item) { if(!item) return ''; var data = this.grid.store.getValue(item, 'owner'); return new openils.User({id:data}).user.usrname(); } -function getDateTimeField(rowIndex, item) { - if(!item) return ''; - var data = this.grid.store.getValue(item, this.field); - var date = dojo.date.stamp.fromISOString(data); - return dojo.date.locale.format(date, {formatLength:'medium'}); -} - function doSearch(fields) { - if(!isNaN(fields.id)) - fields = {id:fields.id}; - else + + if(isNaN(fields.id)) { delete fields.id; + for(var k in fields) { + if(fields[k] == '' || fields[k] == null) + delete fields[k]; + } + } else { + // ID search trumps other searches + fields = {id:fields.id}; + } - var store = new dojo.data.ItemFileWriteStore({data:acqpo.initStoreData()}); - poGrid.setStore(store); - poGrid.render(); + // no search fields + var some = false; + for(var k in fields) some = true; + if(!some) fields.id = {'!=' : null}; - fieldmapper.standardRequest( - ['open-ils.acq', 'open-ils.acq.purchase_order.search'], - { async:1, - params: [openils.User.authtoken, fields], - onresponse : function(r) { - if(po = openils.Util.readResponse(r)) { - openils.acq.PO.cache[po.id()] = po; - store.newItem(acqpo.toStoreItem(po)); - } - dojo.style('po-grid', 'visibility', 'visible'); - } - } - ); + poGrid.resetStore(); + poGrid.loadAll({order_by:{acqpo : 'edit_time DESC'}, limit: 30}, fields); } function loadForm() { - /* load the providers */ - openils.acq.Provider.createStore( - function(store) { - providerSelector.store = - new dojo.data.ItemFileReadStore({data:store}); - }, - 'MANAGE_PROVIDER' - ); + new openils.widget.AutoFieldWidget({ + fmClass : 'acqpo', + fmField : 'provider', + parentNode : dojo.byId('po-search-provider-selector'), + orgLimitPerms : ['VIEW_PURCHASE_ORDER'], + dijitArgs : {name:'provider', required:false} + }).build(); + + new openils.widget.AutoFieldWidget({ + fmClass : 'acqpo', + fmField : 'ordering_agency', + parentNode : dojo.byId('po-search-agency-selector'), + orgLimitPerms : ['VIEW_PURCHASE_ORDER'], + dijitArgs : {name:'ordering_agency', required:false} + }).build(); - new openils.User().buildPermOrgSelector('VIEW_PURCHASE_ORDER', poSearchOrderingAgencySelect); + doSearch({ordering_agency : openils.User.user.ws_ou()}); } openils.Util.addOnLoad(loadForm); diff --git a/Open-ILS/web/templates/default/acq/po/search.tt2 b/Open-ILS/web/templates/default/acq/po/search.tt2 index 3b77c8941..4945db192 100644 --- a/Open-ILS/web/templates/default/acq/po/search.tt2 +++ b/Open-ILS/web/templates/default/acq/po/search.tt2 @@ -15,65 +15,55 @@ -
+ + - - - - - - - - - - - - - - - - - - - - -
- -
-
Search
+ +
+ + + + + + + + + + + + + + Search +
+
- +
- - - - - - +
IDOwnerOrdering AgencyCreate TimeEdit TimeProviderState
- - [% END %] -- 2.11.0