lp1717366 toggle patron summary setting user/klbeck/lp1717366-patron-summary-toggle
authorKatlyn Beck <kbeck@catalyte.io>
Tue, 27 Nov 2018 21:15:11 +0000 (21:15 +0000)
committerKatlyn Beck <kbeck@catalyte.io>
Tue, 27 Nov 2018 21:15:11 +0000 (21:15 +0000)
- Added function to manage state of summary based on circ.auto_hide_patron_summary

Signed-off-by: Katlyn Beck <kbeck@catalyte.io>
 Changes to be committed:
modified:   Open-ILS/web/js/ui/default/staff/circ/patron/app.js

Open-ILS/web/js/ui/default/staff/circ/patron/app.js

index d007257..7c3aefa 100644 (file)
@@ -357,14 +357,25 @@ function($scope,  $q , $location , $filter , egCore , egNet , egUser , egAlertDi
         lNode.style.visibility = 'hidden';
     }
 
+    function setSummaryState(condition) {
+        if (condition) {
+            egCore.hatch.setItem('eg.circ.patron.summary.collapse', true);
+        } else {
+            egCore.hatch.removeItem('eg.circ.patron.summary.collapse');
+        }
+    }
+
+    egCore.hatch.getItem('circ.auto_hide_patron_summary').then(function(res) {
+        setSummaryState(res);
+    });
+
     $scope.toggle_expand_summary = function() {
         if ($scope.collapsePatronSummary) {
             $scope.collapsePatronSummary = false;
-            egCore.hatch.removeItem('eg.circ.patron.summary.collapse');
         } else {
             $scope.collapsePatronSummary = true;
-            egCore.hatch.setItem('eg.circ.patron.summary.collapse', true);
         }
+        setSummaryState($scope.collapsePatronSummary);
     }
     
     // always expand the patron summary in the search UI, regardless