From: Bill Erickson Date: Fri, 23 Mar 2012 14:57:59 +0000 (-0400) Subject: ACQ provider admin page display improvements X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=22445e14c338a90fc6f957f2c93f00b628ffaa1b;p=contrib%2FConifer.git ACQ provider admin page display improvements 1. Sort providers I have permission to edit to the front. 2. Improved support for viewing all providers the user has access to view. 3. Enable the grid filter 4. Template cleanup to avoid the unnecessary horizontal scroll that sometimes occurs along the top. 5. Misc code cleanup Signed-off-by: Bill Erickson acq provider layout fixes Signed-off-by: Bill Erickson Signed-off-by: Jason Stephenson Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/templates/conify/global/acq/provider.tt2 b/Open-ILS/src/templates/conify/global/acq/provider.tt2 index 655d838a2c..cb47934460 100644 --- a/Open-ILS/src/templates/conify/global/acq/provider.tt2 +++ b/Open-ILS/src/templates/conify/global/acq/provider.tt2 @@ -1,22 +1,8 @@ [% WRAPPER base.tt2 %] [% ctx.page_title = 'Providers' %] - - -
-
+
+
Provider
@@ -24,163 +10,178 @@
-
-
- Context Org Unit - -
-
- - - - -
-
-
- -
-
-
- -
-
-
Provider Address
-
- - -
+
+ Context Org Unit +
-
- +
+ + +
-
-
-
Provider Contact
-
- - +
+
+
+ +
+
+
Provider Address
+
+ + +
-
-
- -
-
- -
-
Contact Address
-
- - +
+ +
-
- -
-
- -
-
-
-
Attribute Definitions
-
- - + +
+
+
Provider Contact
+
+ + +
+
+
+ +
+
+ +
+
Contact Address
+
+ + +
+
+ +
+
+
-
- - - - - -
- - -
+
+
+
Attribute Definitions
+
+ + +
+
+
+ + + + + +
+ + +
+
-
-
-
-
Holding Subfield
-
- - +
+
+
Holding Subfield
+
+ + +
+
+
+ +
-
- + Invoices +
+
-
+ showPaginator='true' + fmClass="acqinv"> + + + + + + +
- -
- Invoices -
- - - - - -
-
-
+ +
-
+ diff --git a/Open-ILS/web/js/ui/default/conify/global/acq/provider.js b/Open-ILS/web/js/ui/default/conify/global/acq/provider.js index 2dbe1da1b9..44eeb77925 100644 --- a/Open-ILS/web/js/ui/default/conify/global/acq/provider.js +++ b/Open-ILS/web/js/ui/default/conify/global/acq/provider.js @@ -9,50 +9,106 @@ dojo.require('openils.widget.OrgUnitFilteringSelect'); var provider; var xpathParser = new openils.MarcXPathParser(); var subFields= []; +var adminPermOrgs = []; +var viewPermOrgs = []; +var user; +var viewPerms = [ + 'ADMIN_PROVIDER', + 'MANAGE_PROVIDER', + 'VIEW_PROVIDER' +]; + function draw() { - var org_id = openils.User.user.ws_ou(); - var list = fieldmapper.aou.findOrgUnit(org_id).orgNodeTrail().map( - function (i) {return i.id() } - ); - new openils.User().buildPermOrgSelector( - 'VIEW_PROVIDER', contextOrgSelector, null, + user = new openils.User(); + + if(providerId) { + drawOneProvider(); + return; + } + + openils.Util.hide('provider-details-div'); + + // after a provider is created, load the provider page + pListGrid.onPostCreate = function(fmObject) { + location.href = location.href + '/' + fmObject.id(); + } + + user.buildPermOrgSelector( + viewPerms, + contextOrgSelector, null, + function() { - dojo.connect(contextOrgSelector, 'onChange', filterGrid); + if (!contextOrgSelector.attr('value')) return + + dojo.connect(contextOrgSelector, 'onChange', drawProviderGrid); + + // fetch the admin org units + user.getPermOrgList( + 'ADMIN_PROVIDER', + + function(list) { + adminPermOrgs = list; + + // fetch the view org units + user.getPermOrgList( + viewPerms, + function(list2) { + viewPermOrgs = list2 + drawProviderGrid(); + }, + true, true + ); + }, + true, true + ); } ); +} - if(providerId) { - openils.Util.addCSSClass(dojo.byId('provider-list-div'), 'hidden'); - - console.log('in draw'); - var pcrud = new openils.PermaCrud(); - pcrud.retrieve('acqpro', providerId, { - oncomplete : function(r) { - provider = openils.Util.readResponse(r); - console.log('provider is' + js2JSON(provider)); - var pane = new openils.widget.EditPane({fmObject:provider, paneStackCount:2}, dojo.byId('provider-summary-pane')); - pane.startup(); - console.log("pane started"); - dojo.connect(providerTabs, 'selectChild', drawProviderSummary); - } - - }); - - drawProviderSummary(); - } else { - openils.Util.addCSSClass(dojo.byId('provider-details-div'), 'hidden'); - console.log('in else block'); - pListGrid.loadAll({order_by:{acqpro : 'name'}},{'owner':list}); - pListGrid.onPostCreate = function(fmObject) { - location.href = location.href + '/' + fmObject.id(); - } - - } +function drawOneProvider() { + openils.Util.hide('provider-list-div'); + var pcrud = new openils.PermaCrud(); + pcrud.retrieve('acqpro', providerId, { + oncomplete : function(r) { + provider = openils.Util.readResponse(r); + console.log('provider is' + js2JSON(provider)); + var pane = new openils.widget.EditPane({fmObject:provider, paneStackCount:2}, dojo.byId('provider-summary-pane')); + pane.startup(); + console.log("pane started"); + dojo.connect(providerTabs, 'selectChild', drawProviderSummary); + } + }); + + drawProviderSummary(); +} + + +function drawProviderGrid() { + pListGrid.resetStore(); + + // view providers for here plus children + var list = fieldmapper.aou.descendantNodeList( + contextOrgSelector.attr('value'), true, true); + + pListGrid.loadAll( + {order_by : [ // sort providers I can edit to the front + { 'class' : 'acqpro', + field : 'owner', + compare : {'in' : adminPermOrgs}, + direction : 'desc' + }, + { 'class' : 'acqpro', + field : 'name' + } + ]}, + {'owner' : list} + ); } + function drawProviderSummary(child) { var loadedTabs = {'provider-address' : true}; if(child){ @@ -63,41 +119,47 @@ function drawProviderSummary(child) { pcListGrid.overrideEditWidgets.provider = new dijit.form.TextBox({disabled: 'true', value: providerId}); pcListGrid.resetStore(); - pcListGrid.loadAll( {oncomplete:function(r){ - var count = 0; - pcListGrid.store.fetch( {onComplete:function(list) { + pcListGrid.loadAll({ + oncomplete:function(r) { + var count = 0; + pcListGrid.store.fetch( { + onComplete:function(list) { count = list.length - if(count>=1){ - var contactIds = []; dojo.forEach(list, function(item) { - contactIds.push(pcListGrid.store.getValue(item, 'id')); } - ); - + if (count>=1) { + var contactIds = []; + dojo.forEach(list, function(item) { + contactIds.push(pcListGrid.store.getValue(item, 'id')); + }); + pcaListGrid.overrideEditWidgets.contact = new dijit.form.FilteringSelect({store: pcListGrid.store}); pcaListGrid.resetStore(); pcaListGrid.loadAll({order_by:{acqpca : 'contact'}}, {contact: contactIds}); - }else{ + + } else { return; } - } - } - ); - } - }, {provider : providerId}); + } + }); + } + }, {provider : providerId}); break; + case 'tab-attr': padListGrid.overrideEditWidgets.provider = new dijit.form.TextBox({disabled: 'true', value: providerId}); padListGrid.resetStore(); padListGrid.loadAll({order_by:{acqlipad : 'code'}}, {provider : providerId}); break; + case 'tab-hold': phsListGrid.overrideEditWidgets.provider = new dijit.form.TextBox({disabled: 'true', value: providerId}); phsListGrid.resetStore(); phsListGrid.loadAll({order_by:{acqphsm : 'name'}}, {provider : providerId}); break; + case "tab-invoice": invListGrid.resetStore(); invListGrid.loadAll( @@ -105,6 +167,7 @@ function drawProviderSummary(child) { {"provider": providerId} ); break; + default: paListGrid.overrideEditWidgets.provider = new dijit.form.TextBox({disabled: 'true', value: providerId}); @@ -127,7 +190,6 @@ function getParsedTag(rowIndex, item) { function getParsedSubf(rowIndex, item) { - if(item) { var subfields = xpathParser.parse(padListGrid.store.getValue(item, 'xpath')).subfields; return subfields.join(','); @@ -135,15 +197,5 @@ function getParsedSubf(rowIndex, item) { return''; } -function filterGrid() { - pListGrid.resetStore(); - var unit = contextOrgSelector.getValue(); - var list = fieldmapper.aou.findOrgUnit(unit).orgNodeTrail().map( function (i) {return i.id() } ); - if(unit){ - pListGrid.loadAll({order_by:{acqpro : 'name'}}, { 'owner' : list }); - } else { - pListGrid.loadAll({order_by:{acqpro : 'name'}}); - } -} openils.Util.addOnLoad(draw);