LP#1635386 Clarify and simplify row highlighting code
[working/Evergreen.git] / Open-ILS / web / js / ui / default / staff / circ / patron / bills.js
index a84ab2c..bd1e9be 100644 (file)
@@ -222,14 +222,13 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location,
     // -------------
     // Apply coloring to rows based on fines stop reason
     $scope.colorizeBillsList = {
-        rowClass: function(item) {
+        apply: function(item) {
             if (!item['circulation.checkin_time']) {
                 if (item['circulation.stop_fines'] == 'LOST') {
                     return 'dark-red-row-highlight';
                 } else if (item['circulation.stop_fines'] == 'LONGOVERDUE') {
                     return 'red-row-highlight';
-                } else if (item['circulation.due_date'] &&  // Still checked out - need feedback on this approach, feel like there's a better way
-                          !item['circulation.stop_fines']) {
+                } else {
                     return 'orange-row-highlight';
                 }
             }
@@ -240,29 +239,17 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location,
     $scope.statusIconColumn = {
         isEnabled: true,
         template: function(item) {
-            var template = "";
-            var icons = [];
-            var now = new Date();
-
-            if (item['circulation.due_date'] &&
-                !item['circulation.checkin_time']) {
-                var due_date = new Date(item['circulation.due_date']);
-
-                if (item['circulation.stop_fines'] &&
-                    item['circulation.stop_fines'] == "LOST") {
-                    icons.push('glyphicon-question-sign');
-                } else if (item['circulation.stop_fines'] &&
-                    item['circulation.stop_fines'] == "LONGOVERDUE") {
-                    icons.push('glyphicon-exclamation-sign');
-                } else if (now >= due_date) {
-                    icons.push('glyphicon-time');
+            var icon = '';
+            if (!item['circulation.checkin_time']) {
+                if (item['circulation.stop_fines'] == "LOST") {
+                    icon = 'glyphicon-question-sign';
+                } else if (item['circulation.stop_fines'] == "LONGOVERDUE") {
+                    icon = 'glyphicon-exclamation-sign';
+                } else {
+                    icon = 'glyphicon-time';
                 }
             }
-
-            angular.forEach(icons, function(icon) {
-                template = template + "<i class='glyphicon " + icon + "'></i>"
-            });
-            return template;
+            return "<i class='glyphicon " + icon + "'></i>"
         }
     }