web staff: style overdue circs in items-out
authorBill Erickson <berick@esilibrary.com>
Tue, 26 Nov 2013 20:09:10 +0000 (15:09 -0500)
committerBill Erickson <berick@esilibrary.com>
Tue, 26 Nov 2013 20:09:10 +0000 (15:09 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/patron/t_items_out_table.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/app.js

index 218549c..0f76b4a 100644 (file)
@@ -4,6 +4,7 @@
     color: #2a6496;
     background-color: #F5F5F5;
   }
+  .overdue-alert td { color: red; font-weight: bold }
 </style>
 
 [%
@@ -43,7 +44,10 @@ items_out.setColumns([
       <tbody>
         <tr ng-repeat="circ in items_out.items | reverse track by $index"
           ng-click="onRowClick($event, circ)"
-          ng-class="{selected : items_out.selected[circ.id()]}">
+          ng-class="{
+            selected : items_out.selected[circ.id()], 
+            'overdue-alert' : circIsOverdue(circ)
+          }">
           <td>{{$index + 1}}</td>
           <td><span ng-if="items_out.selected[circ.id()]">&#x2713;</span> 
           <td ng-repeat="col in items_out.allColumns" 
index 3a68131..96b00d1 100644 (file)
@@ -614,6 +614,14 @@ function($scope,  $q,  $routeParams,  egNet,  egAuth,  egUser,  patronSvc,  egPC
     $scope.initTab('items_out', $routeParams.id);
     $scope.items_out = patronSvc.items_out;
 
+    // true if circ is overdue, false otherwise
+    $scope.circIsOverdue = function(circ) {
+        var date = new Date();
+        date.setTime(Date.parse(circ.due_date()));
+        return date < new Date();
+    }
+
+    // row selection via click
     $scope.onRowClick = function($event, circ) {
         $scope.lastSelected = circ;
         // control-click / command-click (mac) selects