Angular selfcheck WIP : fines list
authorBill Erickson <berickxx@gmail.com>
Thu, 27 Oct 2016 21:57:31 +0000 (17:57 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 27 Oct 2016 21:57:31 +0000 (17:57 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/templates/staff/circ/selfcheck/t_fines.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/circ/selfcheck/app.js

diff --git a/Open-ILS/src/templates/staff/circ/selfcheck/t_fines.tt2 b/Open-ILS/src/templates/staff/circ/selfcheck/t_fines.tt2
new file mode 100644 (file)
index 0000000..231a792
--- /dev/null
@@ -0,0 +1,29 @@
+
+<div class="row">
+  <div class="col-md-1"><!-- checkbox --></div>
+  <div class="col-md-2">[% l('Type') %]</div>
+  <div class="col-md-3">[% l('Details') %]</div>
+  <div class="col-md-2">[% l('Total Billed') %]</div>
+  <div class="col-md-2">[% l('Total Paid') %]</div>
+  <div class="col-md-2">[% l('Balance Owed') %]</div>
+</div>
+
+<div class="row" ng-repeat="xact in xacts">
+  <div class="col-md-1"><!-- checkbox --></div>
+  <div class="col-md-2">
+    <span ng-if="xact.transaction.xact_type() == 'grocery'">
+      [% l('Miscellaneous') %]</span>
+    <span ng-if="xact.transaction.xact_type() == 'circulation'">
+      [% l('Circulation') %]</span>
+  </div>
+  <div class="col-md-3">
+    <span ng-if="xact.transaction.xact_type() == 'grocery'">
+      {{xact.transaction.last_billing_type()}}</span>
+    <span ng-if="xact.transaction.xact_type() == 'circulation'">
+      {{xact.record.title()}}</span>
+  </div>
+  <div class="col-md-2">{{xact.transaction.total_owed() | currency}}</div>
+  <div class="col-md-2">{{xact.transaction.total_paid() | currency}}</div>
+  <div class="col-md-2">{{xact.transaction.balance_owed() | currency}}</div>
+</div>
+
index 347039b..64ac90d 100644 (file)
@@ -78,6 +78,12 @@ angular.module('egSelfCheckApp',
         resolve : resolver
     });
 
+    $routeProvider.when('/circ/selfcheck/fines', {
+        templateUrl: './circ/selfcheck/t_fines',
+        controller: 'FinesCtrl',
+        resolve : resolver
+    });
+
     $routeProvider.otherwise({redirectTo : '/circ/selfcheck/login'});
 })
 
@@ -270,6 +276,17 @@ function($q , $timeout , $window , $location , $timeout , egCore , egConfirmDial
         return deferred.promise;
     }
 
+    /*
+     * Returns an array of results (non-streaming)
+     */
+    service.get_fines = function() {
+        return egCore.net.request(
+            'open-ils.actor', 
+            'open-ils.actor.user.transactions.have_balance.fleshed',
+            egCore.auth.token(), service.patron.id()
+        );
+    }
+
     return service;
 }])
 
@@ -380,3 +397,17 @@ function($scope,  $q,  $location , egCore,  scSvc) {
 
 }])
 
+.controller('FinesCtrl',
+       ['$scope','$q','$location','egCore','scSvc',
+function($scope,  $q,  $location , egCore,  scSvc) {
+    scSvc.new_path_init();
+    $scope.scanbox.focus = true;
+    $scope.xacts = [];
+
+    scSvc.get_fines().then(function(xacts) {
+        console.log('here with ' + xacts.length)
+        $scope.xacts = xacts;
+    });
+
+}])
+