From: Bill Erickson Date: Wed, 21 May 2014 19:33:25 +0000 (-0400) Subject: payments UI repairs; adding menus X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e085003a57d22a568dee59a7c883ecaf6c80e1b1;p=working%2FEvergreen.git payments UI repairs; adding menus Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/templates/staff/circ/patron/index.tt2 b/Open-ILS/src/templates/staff/circ/patron/index.tt2 index f4d2fabb3c..12c07e3339 100644 --- a/Open-ILS/src/templates/staff/circ/patron/index.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/index.tt2 @@ -40,7 +40,7 @@ angular.module('egCoreMod').run(['egStrings', function(s) {

- [% l('[_1], [_2], [_3]', + [% l('[_1], [_2] [_3]', '{{patron().family_name()}}', '{{patron().first_given_name()}}', '{{patron().second_given_name()}}') %] diff --git a/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 index 2f59fded33..68307dd5ca 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 @@ -3,7 +3,7 @@ idl-class="mobts" query="gridQuery" on-item-retrieved="gridItemRetrieved" - on-item-selected="gridItemSelected" + on-selection-change="gridSelectionChanged" revision="gridRevision" persist-key="circ.patron.bills"> @@ -16,9 +16,33 @@ - + + + + + + + + + + @@ -26,10 +50,30 @@ - + {{item.title}} + + + + + + + {{item.copy_barcode}} + + + + + - + + diff --git a/Open-ILS/src/templates/staff/circ/patron/t_summary.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_summary.tt2 index 251bc5e500..6f23d45384 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_summary.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_summary.tt2 @@ -1,20 +1,5 @@
-
+ type='checkbox' ng-model="selectAll"/>
= $scope.owed_selected()) { + var amt = $scope.payment_amount || 0; + if (amt >= $scope.owed_selected()) { return { payment : $scope.owed_selected(), - change : $scope.payment_amount - $scope.owed_selected() + change : amt - $scope.owed_selected() } } - return { - payment : $scope.payment_amount, - change : 0 - }; + return {payment : amt, change : 0}; } // calculates amount owed, billed, and paid for selected items @@ -113,15 +111,37 @@ function($scope, $q , $routeParams, $locale , egCore , egGridDataProvider , bi var query = {usr : billSvc.userId, balance_owed : {'<>' : 0}}; $scope.gridQuery = function() {return query}; + + var allItems = []; $scope.gridItemRetrieved = function(item) { item.payment_pending = 0; + allItems.push(item); } var selectedItems = []; - $scope.gridItemSelected = function(sel, desel, all) { - // keep a local cache of the selected items so we can - // calculate payment info from them. + $scope.gridSelectionChanged = function(all) { + // update the item.payment_pending value each time the user + // selects different transactions to pay against. selectedItems = all; + updatePendingColumn(); + } + + // update the item.payment_pending for each (selected) + // transaction any time the user-entered payment amount is modified + $scope.$watch('payment_amount', updatePendingColumn); + + function updatePendingColumn() { + // reset all to zero.. + angular.forEach(allItems, function(item) {item.payment_pending = 0}); + + // then apply the current payment amounts + var payments = generatePayments(); + angular.forEach(payments, function(payment) { + var item = selectedItems.filter(function(item) { + return (item.id == payment[0]) + })[0]; + item.payment_pending = payment[1]; + }); } function generatePayments() { diff --git a/Open-ILS/web/js/ui/default/staff/services/grid.js b/Open-ILS/web/js/ui/default/staff/services/grid.js index ca2b44196b..7a9f147f60 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -67,8 +67,9 @@ angular.module('egGridMod', // are absorbed by the grid. onItemRetrieved : '=', - // function called with (selectedItem, deSelectedItem, allSelectedItems) - onItemSelected : '=', + // function called with all selected items each time the + // selection set changes + onSelectionChange : '=', // function; if set, row index values will be hyperlinked and // the onclick for an item will call activateItem with the item @@ -126,7 +127,7 @@ angular.module('egGridMod', // items needed only by the grid; remove from scope angular.forEach( - ['idlClass','onItemRetrieved','onItemSelected','persistKey'], + ['idlClass','onItemRetrieved','onSelectionChange','persistKey'], function(field) { grid[field] = $scope[field]; delete $scope[field]; @@ -169,6 +170,12 @@ angular.module('egGridMod', delete $scope.autoFields; } + if (grid.onSelectionChange) { + $scope.$watch('selected', function() { + grid.onSelectionChange(grid.getSelectedItems()) + }, true); + } + if (!grid.dataProvider) { @@ -440,14 +447,13 @@ angular.module('egGridMod', }); } - // if all are selected, deselect all, otherwise select all - $scope.toggleSelectAllItems = function() { - if (Object.keys($scope.selected).length == $scope.items.length) { - $scope.selected = {}; - } else { + $scope.$watch('selectAll', function(newVal) { + if (newVal) { grid.selectAllItems(); + } else { + $scope.selected = {}; } - } + }); // returns true if item1 appears in the list before item2; // false otherwise. this is slightly more efficient that @@ -534,6 +540,7 @@ angular.module('egGridMod', } + /* if (grid.onItemSelected) { // multiple items may be selected / de-selected within a // single click action. Find all that have changed state. @@ -556,6 +563,7 @@ angular.module('egGridMod', grid.onItemSelected(item, null, all); }); } + */ } // Builds a sort expression from column sort priorities. @@ -762,6 +770,11 @@ angular.module('egGridMod', path : '@', // optional; flesh path label : '@', // optional; display label flex : '@', // optional; default flex width + + // optional: for non-IDL columns, specifying a datatype + // lets the caller control which display filter is used. + // datatype should match the standard IDL datatypes. + datatype : '@' }, link : function(scope, element, attrs, egGridCtrl) { @@ -787,6 +800,7 @@ angular.module('egGridMod', if (tmpl && !tmpl.match(/^\s*$/)) scope.template = tmpl + 'datatype', // for non-IDL fields, can be used to apply filters egGridCtrl.columnsProvider.add(scope); scope.$destroy(); } @@ -930,7 +944,11 @@ angular.module('egGridMod', // lookup the matching IDL field var idl_field = cols.idlFieldFromPath(column.path); - if (!idl_field) return; // ad-hoc field + if (!idl_field) { + // column is not represented within the IDL + column.adhoc = true; + return; + } column.datatype = idl_field.datatype; @@ -1117,7 +1135,7 @@ angular.module('egGridMod', angular.forEach(provider.columnsProvider.columns, function(col) { // only query IDL-tracked columns - if (col.datatype && (col.required || col.visible)) + if (!col.adhoc && (col.required || col.visible)) queryFields[col.name] = col.path; } );