From 8fb783e122402c2caaf4b154f63e0d60adb08ff1 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 20 May 2014 16:51:43 -0400 Subject: [PATCH] bills UI cont. Signed-off-by: Bill Erickson --- Open-ILS/src/templates/staff/cat/item/index.tt2 | 2 +- .../templates/staff/cat/item/summary_header.tt2 | 24 ++++---- .../src/templates/staff/cat/item/t_circs_pane.tt2 | 4 +- .../src/templates/staff/cat/item/t_holds_pane.tt2 | 4 +- .../src/templates/staff/circ/patron/t_bills.tt2 | 68 +++++++++++++--------- .../templates/staff/circ/patron/t_bills_list.tt2 | 1 + .../src/templates/staff/css/circ/patron.css.tt2 | 19 ++++++ Open-ILS/src/templates/staff/css/style.css.tt2 | 11 ---- .../web/js/ui/default/staff/circ/patron/app.js | 2 +- .../web/js/ui/default/staff/circ/patron/bills.js | 43 ++++++++++++-- Open-ILS/web/js/ui/default/staff/services/grid.js | 17 ++++-- 11 files changed, 128 insertions(+), 67 deletions(-) diff --git a/Open-ILS/src/templates/staff/cat/item/index.tt2 b/Open-ILS/src/templates/staff/cat/item/index.tt2 index 08bbb6e034..af7f795f4e 100644 --- a/Open-ILS/src/templates/staff/cat/item/index.tt2 +++ b/Open-ILS/src/templates/staff/cat/item/index.tt2 @@ -39,7 +39,7 @@ upload widget into the vertical middle of the row -->
-
[% l('OR') %]
+
[% l('OR') %]
diff --git a/Open-ILS/src/templates/staff/cat/item/summary_header.tt2 b/Open-ILS/src/templates/staff/cat/item/summary_header.tt2 index 202c4b2f98..64a8300b5b 100644 --- a/Open-ILS/src/templates/staff/cat/item/summary_header.tt2 +++ b/Open-ILS/src/templates/staff/cat/item/summary_header.tt2 @@ -2,50 +2,50 @@
-
[% l('Title:') %]
+
[% l('Title:') %]
{{copy.call_number().record().simple_record().title() || copy.dummy_title()}}
-
[% l('Edition:') %]
+
[% l('Edition:') %]
-
[% l('TCN:') %]
+
[% l('TCN:') %]
{{copy.call_number().record().tcn_value()}}
-
[% l('Created By:') %]
+
[% l('Created By:') %]
{{copy.call_number().record().creator().usrname()}}
-
[% l('Author:') %]
+
[% l('Author:') %]
{{copy.call_number().record().simple_record().author() || copy.dummy_author()}}
-
[% l('Pub Date:') %]
+
[% l('Pub Date:') %]
{{copy.call_number().record().simple_record().pubdate()}}
-
[% l('Databse ID:') %]
+
[% l('Databse ID:') %]
{{copy.call_number().record().id()}}
-
[% l('Last Edited By:') %]
+
[% l('Last Edited By:') %]
{{copy.call_number().record().editor().usrname()}}
-
[% l('Bib Call #:') %]
+
[% l('Bib Call #:') %]
-
[% l('Item Call #:') %]
+
[% l('Item Call #:') %]
{{copy.call_number().label()}}
-
[% l('Record Owner:') %]
+
[% l('Record Owner:') %]
{{copy.call_number().record().owner().shortname()}}
-
[% l('Last Edited On:') %]
+
[% l('Last Edited On:') %]
{{copy.edit_date() | date:'short'}}
diff --git a/Open-ILS/src/templates/staff/cat/item/t_circs_pane.tt2 b/Open-ILS/src/templates/staff/cat/item/t_circs_pane.tt2 index 1ba584c48e..24a3241537 100644 --- a/Open-ILS/src/templates/staff/cat/item/t_circs_pane.tt2 +++ b/Open-ILS/src/templates/staff/cat/item/t_circs_pane.tt2 @@ -5,7 +5,7 @@
-
+
[% l('Previous Circ Group') %]
@@ -98,7 +98,7 @@
-
+
[% l('Most Recent Circ Group') %]
diff --git a/Open-ILS/src/templates/staff/cat/item/t_holds_pane.tt2 b/Open-ILS/src/templates/staff/cat/item/t_holds_pane.tt2 index 2da962bd45..601c1287bc 100644 --- a/Open-ILS/src/templates/staff/cat/item/t_holds_pane.tt2 +++ b/Open-ILS/src/templates/staff/cat/item/t_holds_pane.tt2 @@ -5,7 +5,7 @@
-
+
[% l('Captured Hold Info') %]
@@ -93,7 +93,7 @@
-
+
[% l('Most Recent Transit') %]
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2 index bc4750f195..48a050adc1 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2 @@ -3,30 +3,39 @@
-
-
- [% l('Total Owed: [_1]', '{{summary.balance_owed() | currency}}') %] -
-
-
- -
- [% l('Refunds Available: [_1]', '{{0 | currency}}') %] -
-
+
[% l('Total Owed:') %]
+
{{summary.balance_owed() | currency}}
+
[% l('Refunds Available:') %]
+
{{0 | currency}}
-
-
- [% l('Total Selected: [_1]', '{{total_selected | currency}}') %] -
-
-
- -
- [% l('Credit Available: [_1]', '{{patron().credit_forward_balance() | currency}}') %] -
-
+
[% l('Total Billed:') %]
+
{{summary.total_owed() | currency}}
+
[% l('Credit Available:') %]
+
{{patron().credit_forward_balance() | currency}}
+
+
+
[% l('Total Paid:') %]
+
{{summary.total_paid() | currency}}
+
[% l('Session Voided:') %]
+
{{0 | currency}}
+
+

+
+
[% l('Owed for Selected:') %]
+
{{owed_selected | currency}}
+
[% l('Pending Payment:') %]
+
{{pending_payment() | currency}}
+
+
+
[% l('Billed for Selected:') %]
+
{{billed_selected | currency}}
+
[% l('Pending Change:') %]
+
{{pending_change() | currency}}
+
+
+
[% l('Paid for Selected:') %]
+
{{paid_selected | currency}}
@@ -49,16 +58,19 @@ [% l('Payment Received') %]
-
-
-
+
+ +
- - - +
+
+
+
+
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 index 192585cfa7..5392af1c86 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 @@ -6,6 +6,7 @@ on-item-retrieved="gridItemRetrieved" on-item-selected="gridItemSelected" persist-key="circ.patron.bills"> + diff --git a/Open-ILS/src/templates/staff/css/circ/patron.css.tt2 b/Open-ILS/src/templates/staff/css/circ/patron.css.tt2 index a599dcec35..d7688653d2 100644 --- a/Open-ILS/src/templates/staff/css/circ/patron.css.tt2 +++ b/Open-ILS/src/templates/staff/css/circ/patron.css.tt2 @@ -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 +%] diff --git a/Open-ILS/src/templates/staff/css/style.css.tt2 b/Open-ILS/src/templates/staff/css/style.css.tt2 index 0a4f7946f7..e0407827aa 100644 --- a/Open-ILS/src/templates/staff/css/style.css.tt2 +++ b/Open-ILS/src/templates/staff/css/style.css.tt2 @@ -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; } diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js index 75a4874f59..5d265cc66d 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js @@ -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) { diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js b/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js index fd55a6de69..4841ccf060 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js @@ -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); } } diff --git a/Open-ILS/web/js/ui/default/staff/services/grid.js b/Open-ILS/web/js/ui/default/staff/services/grid.js index 1d9baea1c3..a555b686b1 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -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); + } } } } -- 2.11.0