bills UI cont.
authorBill Erickson <berick@esilibrary.com>
Tue, 20 May 2014 20:51:43 +0000 (16:51 -0400)
committerBill Erickson <berick@esilibrary.com>
Tue, 20 May 2014 20:51:43 +0000 (16:51 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/cat/item/index.tt2
Open-ILS/src/templates/staff/cat/item/summary_header.tt2
Open-ILS/src/templates/staff/cat/item/t_circs_pane.tt2
Open-ILS/src/templates/staff/cat/item/t_holds_pane.tt2
Open-ILS/src/templates/staff/circ/patron/t_bills.tt2
Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2
Open-ILS/src/templates/staff/css/circ/patron.css.tt2
Open-ILS/src/templates/staff/css/style.css.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/app.js
Open-ILS/web/js/ui/default/staff/circ/patron/bills.js
Open-ILS/web/js/ui/default/staff/services/grid.js

index 08bbb6e..af7f795 100644 (file)
@@ -39,7 +39,7 @@
         upload widget into the vertical middle of the row -->
     <div class="btn-pad" style="padding:4px;">
       <div class="flex-row">
-        <div class="header-label">[% l('OR') %]</div>
+        <div class="strong-text">[% l('OR') %]</div>
         <div class="btn-pad">
           <input type="file" eg-file-reader 
             container="barcodesFromFile" value="[% l('Upload from File') %]">
index 202c4b2..64a8300 100644 (file)
@@ -2,50 +2,50 @@
 <div class="flex-container-striped flex-container-bordered"
   ng-hide="context.itemNotFound">
   <div class="flex-row">
-    <div class="flex-cell header-label">[% l('Title:') %]</div>
+    <div class="flex-cell strong-text">[% l('Title:') %]</div>
     <div class="flex-cell flex-2">
       {{copy.call_number().record().simple_record().title() || copy.dummy_title()}}
     </div>
 
-    <div class="flex-cell header-label">[% l('Edition:') %]</div>
+    <div class="flex-cell strong-text">[% l('Edition:') %]</div>
     <div class="flex-cell"><!-- FIXME: no edition field on simple record --></div>
 
-    <div class="flex-cell header-label">[% l('TCN:') %]</div>
+    <div class="flex-cell strong-text">[% l('TCN:') %]</div>
     <div class="flex-cell">{{copy.call_number().record().tcn_value()}}</div>
 
-    <div class="flex-cell header-label">[% l('Created By:') %]</div>
+    <div class="flex-cell strong-text">[% l('Created By:') %]</div>
     <div class="flex-cell">{{copy.call_number().record().creator().usrname()}}</div>
   </div><!-- flex-row -->
 
   <div class="flex-row">
-    <div class="flex-cell header-label">[% l('Author:') %]</div>
+    <div class="flex-cell strong-text">[% l('Author:') %]</div>
     <div class="flex-cell flex-2">
       {{copy.call_number().record().simple_record().author() || copy.dummy_author()}}
     </div>
 
-    <div class="flex-cell header-label">[% l('Pub Date:') %]</div>
+    <div class="flex-cell strong-text">[% l('Pub Date:') %]</div>
     <div class="flex-cell">
       {{copy.call_number().record().simple_record().pubdate()}}
     </div>
 
-    <div class="flex-cell header-label">[% l('Databse ID:') %]</div>
+    <div class="flex-cell strong-text">[% l('Databse ID:') %]</div>
     <div class="flex-cell">{{copy.call_number().record().id()}}</div>
 
-    <div class="flex-cell header-label">[% l('Last Edited By:') %]</div>
+    <div class="flex-cell strong-text">[% l('Last Edited By:') %]</div>
     <div class="flex-cell">{{copy.call_number().record().editor().usrname()}}</div>
   </div><!-- flex-row -->
 
   <div class="flex-row">
-    <div class="flex-cell header-label">[% l('Bib Call #:') %]</div>
+    <div class="flex-cell strong-text">[% l('Bib Call #:') %]</div>
     <div class="flex-cell flex-2"><!-- FIXME: no bib call no on simple rec --></div>
 
-    <div class="flex-cell header-label">[% l('Item Call #:') %]</div>
+    <div class="flex-cell strong-text">[% l('Item Call #:') %]</div>
     <div class="flex-cell">{{copy.call_number().label()}}</div>
 
-    <div class="flex-cell header-label">[% l('Record Owner:') %]</div>
+    <div class="flex-cell strong-text">[% l('Record Owner:') %]</div>
     <div class="flex-cell">{{copy.call_number().record().owner().shortname()}}</div>
 
-    <div class="flex-cell header-label">[% l('Last Edited On:') %]</div>
+    <div class="flex-cell strong-text">[% l('Last Edited On:') %]</div>
     <div class="flex-cell">{{copy.edit_date() | date:'short'}}</div>
   </div><!-- flex-row -->
 </div>
index 1ba584c..24a3241 100644 (file)
@@ -5,7 +5,7 @@
 </div>
 <div class="col-md-6" ng-show="prev_circ_summary">
   <div class="flex-row">
-    <div class="flex-cell flex-2 header-label-big">
+    <div class="flex-cell flex-2 strong-text-2">
       [% l('Previous Circ Group') %]
     </div>
   </div>
@@ -98,7 +98,7 @@
 </div>
 <div class="col-md-6" ng-show="circ">
   <div class="flex-row">
-    <div class="flex-cell flex-2 header-label-big">
+    <div class="flex-cell flex-2 strong-text-2">
       [% l('Most Recent Circ Group') %]
     </div>
   </div>
index 2da962b..601c128 100644 (file)
@@ -5,7 +5,7 @@
 </div>
 <div class="col-md-6" ng-show="hold">
   <div class="flex-row">
-    <div class="flex-cell flex-2 header-label-big">
+    <div class="flex-cell flex-2 strong-text-2">
       [% l('Captured Hold Info') %]
     </div>
   </div>
@@ -93,7 +93,7 @@
 
 <div class="col-md-6" ng-show="transit">
   <div class="flex-row">
-    <div class="flex-cell flex-2 header-label-big">
+    <div class="flex-cell flex-2 strong-text-2">
       [% l('Most Recent Transit') %]
     </div>
   </div>
index bc4750f..48a050a 100644 (file)
@@ -3,30 +3,39 @@
   <div class="col-md-7">
 
     <div class="row">
-      <div class="col-md-6">
-        <div class="strong-text-4">
-          [% l('Total Owed: [_1]', '{{summary.balance_owed() | currency}}') %]
-        </div>
-      </div>
-      <div class="col-md-6">
-        <!-- TODO -->
-        <div class="strong-text-2">
-          [% l('Refunds Available: [_1]', '{{0 | currency}}') %]
-        </div>
-      </div>
+      <div class="col-md-4">[% l('Total Owed:') %]</div>
+      <div class="col-md-2 strong-text">{{summary.balance_owed() | currency}}</div>
+      <div class="col-md-4">[% l('Refunds Available:') %]</div>
+      <div class="col-md-2">{{0 | currency}}</div>
     </div>
     <div class="row">
-      <div class="col-md-6">
-        <div class="strong-text-4">
-          [% l('Total Selected: [_1]', '{{total_selected | currency}}') %]
-        </div>
-      </div>
-      <div class="col-md-6">
-        <!-- FIXME: check patron credit display settings -->
-        <div class="strong-text-2">
-          [% l('Credit Available: [_1]', '{{patron().credit_forward_balance() | currency}}') %]
-        </div>
-      </div>
+      <div class="col-md-4">[% l('Total Billed:') %]</div>
+      <div class="col-md-2">{{summary.total_owed() | currency}}</div>
+      <div class="col-md-4">[% l('Credit Available:') %]</div>
+      <div class="col-md-2">{{patron().credit_forward_balance() | currency}}</div>
+    </div>
+    <div class="row">
+      <div class="col-md-4">[% l('Total Paid:') %]</div>
+      <div class="col-md-2">{{summary.total_paid() | currency}}</div>
+      <div class="col-md-4">[% l('Session Voided:') %]</div>
+      <div class="col-md-2">{{0 | currency}}</div>
+    </div>
+    <div class="row"><hr/></div>
+    <div class="row">
+      <div class="col-md-4">[% l('Owed for Selected:') %]</div>
+      <div class="col-md-2">{{owed_selected | currency}}</div>
+      <div class="col-md-4">[% l('Pending Payment:') %]</div>
+      <div class="col-md-2 strong-text">{{pending_payment() | currency}}</div>
+    </div>
+    <div class="row">
+      <div class="col-md-4">[% l('Billed for Selected:') %]</div>
+      <div class="col-md-2">{{billed_selected | currency}}</div>
+      <div class="col-md-4">[% l('Pending Change:') %]</div>
+      <div class="col-md-2 strong-text">{{pending_change() | currency}}</div>
+    </div>
+    <div class="row">
+      <div class="col-md-4">[% l('Paid for Selected:') %]</div>
+      <div class="col-md-2">{{paid_selected | currency}}</div>
     </div>
   </div><!-- col -->
 
             [% l('Payment Received') %]
           </label>
           <div class="col-md-6">
-            <input type="number" min="0" id="amount-input" 
+            <input type="number" min="0" id="amount-input" ng-model="payment_amount"
               focus-me="focus_payment" value="0" class="form-control col-md-6 "/>
           </div>
         </div>
-        <div class="form-group pull-right">
-          <div class="col-md-12">
+        <div class="form-group xpull-right">
+          <label for="annotate-payment" class="control-label col-md-6">[% l('Annotate') %]</label>
+          <div class="col-md-6">
             <input id="annotate-payment" type="checkbox" ng-model="annotate_payment"/>
-            <label for="annotate-payment" class="ccontrol-label">[% l('Annotate') %]</label>
-            <button ng-click="applyDistribution($event)">[% l('See Distribution') %]</button>
-            <button type="submit">[% l('Apply Payment') %]</button>
+          </div>
+        </div>
+        <div class="form-group">
+          <div class="col-md-6 col-md-offset-6">
+            <button type="submit" class="btn btn-default">[% l('Apply Payment') %]</button>
           </div>
         </div>
 
index 192585c..5392af1 100644 (file)
@@ -6,6 +6,7 @@
   on-item-retrieved="gridItemRetrieved"
   on-item-selected="gridItemSelected"
   persist-key="circ.patron.bills">
+
   <eg-grid-field label="[% ('Balance Owed') %]" path='balance_owed'></eg-grid-field>
   <eg-grid-field label="[% ('Bill #') %]" path='id'></eg-grid-field>
   <eg-grid-field label="[% ('Start') %]" path='xact_start'></eg-grid-field>
index a599dce..d768865 100644 (file)
@@ -18,3 +18,22 @@ but the ones I'm finding aren't quite cutting it..*/
 #patron-search-form div.col-md-2 { padding: 2px; }
 #patron-search-form input:not([type="checkbox"]) { width: 100%; }
 
+
+#patron-payments-spreadsheet {
+  margin-top: 10px;
+  padding-top: 10px;
+  border-top: 1px solid #aaa;
+}
+
+#patron-payments-spreadsheet .flex-cell {
+  margin: 2px;
+}
+
+#patron-payments-spreadsheet .flex-cell.well {
+  min-height: 1.5em;
+  margin-bottom: 0px; /* bootstrap default is 20px */
+}
+
+[%# 
+vim: ft=css 
+%]
index 0a4f794..e040782 100644 (file)
@@ -118,22 +118,11 @@ table.list tr.selected td {
     border-bottom:1px solid #CCC;
 }
 
-/* used for th-like things in grids */
-.header-label {
- font-weight: bold;
-}
-
-.header-label-big {
- font-weight: bold;
- font-size: 120%;
-}
-
 .btn-pad {
   /* sometimes you don't want buttons scrunched together -- add some margin */
   margin-left: 10px;
 }
 
-
 .strong-text {
   font-weight: bold;
 }
index 75a4874..5d265cc 100644 (file)
@@ -4,7 +4,7 @@
  * Search, checkout, items out, holds, bills, edit, etc.
  */
 
-angular.module('egPatronApp', ['ngRoute', 'ui.bootstrap', 
+angular.module('egPatronApp', ['ngRoute', 'ui.bootstrap', 'ngLocale',
     'egCoreMod', 'egUiMod', 'egGridMod', 'egUserMod'])
 
 .config(function($routeProvider, $locationProvider, $compileProvider) {
index fd55a6d..4841ccf 100644 (file)
@@ -24,16 +24,45 @@ function($q , egCore) {
  * Manages Bills
  */
 .controller('PatronBillsCtrl',
-       ['$scope','$q','$routeParams','egCore','egGridDataProvider','billSvc',
-function($scope,  $q , $routeParams,  egCore , egGridDataProvider , billSvc) {
+       ['$scope','$q','$routeParams','$locale','egCore','egGridDataProvider','billSvc',
+function($scope,  $q , $routeParams,  $locale , egCore , egGridDataProvider , billSvc) {
     $scope.initTab('bills', $routeParams.id);
     billSvc.userId = $routeParams.id;
 
-    $scope.total_selected = 0;
+    $scope.payment_amount = 0;
+    $scope.owed_selected = 0;
+    $scope.billed_selected = 0;
+    $scope.paid_selected = 0;
     $scope.payment_type = 'cash';
     $scope.focus_payment = true;
     $scope.annotate_payment = false;
 
+    function pending_payment_info() {
+        if ($scope.payment_amount >= $scope.owed_selected) {
+            return {
+                payment : $scope.owed_selected,
+                change : $scope.payment_amount - $scope.owed_selected
+            }
+        } 
+        return {
+            payment : $scope.payment_amount,
+            change : 0
+        };
+    }
+    $scope.pending_payment = function() {
+        return pending_payment_info().payment;
+    }
+    $scope.pending_change = function() {
+        return pending_payment_info().change;
+    }
+
+    // Avoid using parens [e.g. (1.23)] to indicate negative numbers, 
+    // which is the Angular default.
+    // http://stackoverflow.com/questions/17441254/why-angularjs-currency-filter-formats-negative-numbers-with-parenthesis
+    // FIXME: This change needs to be moved into a project-wide collection
+    // of locale overrides.
+    $locale.NUMBER_FORMATS.PATTERNS[1].negPre = '-';
+    $locale.NUMBER_FORMATS.PATTERNS[1].negSuf = '';
 
     var query = {usr : billSvc.userId, balance_owed : {'<>' : 0}};
     $scope.gridQuery = function() {return query};
@@ -43,9 +72,13 @@ function($scope,  $q , $routeParams,  egCore , egGridDataProvider , billSvc) {
 
     $scope.gridItemSelected = function(selected, deSelected) {
         if (selected) {
-            $scope.total_selected += Number(selected.balance_owed);
+            $scope.owed_selected   += Number(selected.balance_owed);
+            $scope.billed_selected += Number(selected.total_owed);
+            $scope.paid_selected   += Number(selected.total_paid);
         } else {
-            $scope.total_selected += Number(deSelected.balance_owed);
+            $scope.owed_selected   -= Number(deSelected.balance_owed);
+            $scope.billed_selected -= Number(deSelected.total_owed);
+            $scope.paid_selected   -= Number(deSelected.total_paid);
         }
     }
 
index 1d9baea..a555b68 100644 (file)
@@ -467,6 +467,7 @@ angular.module('egGridMod',
             // handles click, control-click, and shift-click
             $scope.handleRowClick = function($event, item) {
                 var index = grid.indexValue(item);
+                var wasSelected = Boolean($scope.selected[index]);
 
                 if ($event.ctrlKey || $event.metaKey /* mac command */) {
                     // control-click
@@ -509,12 +510,18 @@ angular.module('egGridMod',
                     grid.lastSelectedItemIndex = index;
                 }
 
-                var selected = grid.getSelectedItems();
+
                 if (grid.onItemSelected) {
-                    if ($scope.selected[index]) {
-                        grid.onItemSelected(item, null, selected);
-                    } else {
-                        grid.onItemSelected(null, item, selected);
+                    var isSelected = Boolean($scope.selected[index]);
+
+                    if (isSelected != wasSelected) { 
+                        // something changed state; report it
+                        var all = grid.getSelectedItems();
+                        if (isSelected) {
+                            grid.onItemSelected(item, null, all);
+                        } else {
+                            grid.onItemSelected(null, item, all);
+                        }
                     }
                 }
             }