lp1792995 wrong row details shown on billing grid user/mccanna/lp1792995_bills_grid_full_details_signoff
authorMike Risher <mrisher@catalyte.io>
Tue, 4 Feb 2020 22:42:08 +0000 (22:42 +0000)
committerTerran McCanna <tmccanna@georgialibraries.org>
Mon, 17 Feb 2020 21:57:30 +0000 (16:57 -0500)
When using the bill grid, if one right clicks on a row and views full
details one is taken to the first selected row.  Make the UI show
full details for the row being right clicked on.  If no row is
clicked on show first selected item's details.

Signed-off-by: Mike Risher <mrisher@catalyte.io>
 Changes to be committed:
modified:   Open-ILS/web/js/ui/default/staff/circ/patron/bills.js
modified:   Open-ILS/web/js/ui/default/staff/services/grid.js

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Open-ILS/web/js/ui/default/staff/circ/patron/bills.js
Open-ILS/web/js/ui/default/staff/services/grid.js

index 25a01d8..cb10593 100644 (file)
@@ -812,9 +812,15 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location,
 
     // direct the user to the transaction details page
     $scope.showFullDetails = function(all) {
-        if (all[0]) 
+        var lastClicked = $scope.gridControls.contextMenuItem();
+        if (lastClicked) {
+            $location.path('/circ/patron/' + 
+                patronSvc.current.id() + '/bill/' + lastClicked + '/statement');
+        } else if (all[0]) {
             $location.path('/circ/patron/' + 
                 patronSvc.current.id() + '/bill/' + all[0].id + '/statement');
+        }
+            
     }
 
     $scope.activateBill = function(xact) {
index 6224cb9..83a1ebb 100644 (file)
@@ -281,6 +281,10 @@ angular.module('egGridMod',
                     return grid.columnsProvider;
                 }
 
+                controls.contextMenuItem = function() {
+                    return $scope.contextMenuItem;
+                }
+
                 // link in the control functions
                 controls.selectedItems = function() {
                     return grid.getSelectedItems()
@@ -711,6 +715,9 @@ angular.module('egGridMod',
                     if(s.hasOwnProperty('item')){ break; }
                     e = e.parentElement;
                 }
+                
+                $scope.contextMenuItem = grid.indexValue(s.item);
+                
                 // select the right-clicked row if it is not already selected (lp1776557):
                 if(!$scope.selected[grid.indexValue(s.item)]){ $event.target.click(); }