From: Galen Charlton Date: Thu, 4 Aug 2016 15:40:40 +0000 (-0400) Subject: various changes to checkout page X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2920468ae4ef33b73cb685593bb7fb07d57e66a0;p=working%2FEvergreen.git various changes to checkout page - disable quick receipt button unless at least one checkout has been made - change the Done button to a button + dropdown allowing for ending the session with no receipt, a printed receipt, an email receipt, or an automatically generated receipt based on the user's preference - use the btn-default style for the quick receipt button - add explicit email option to the quick receipt dropdown - display toast upon sending an email receipt Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 index 2b891b0fc5..e1125c366b 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 @@ -131,21 +131,32 @@
- +
- - +
-
+
+ id="done-button" type="button" + ng-click="done_auto_receipt()">[% l('Done') %] + +
diff --git a/Open-ILS/src/templates/staff/circ/share/circ_strings.tt2 b/Open-ILS/src/templates/staff/circ/share/circ_strings.tt2 index 316e64a8f3..4f9c917ada 100644 --- a/Open-ILS/src/templates/staff/circ/share/circ_strings.tt2 +++ b/Open-ILS/src/templates/staff/circ/share/circ_strings.tt2 @@ -12,6 +12,8 @@ s.CIRC_CLAIMS_RETURNED = '[% l('Item "[_1]" is marked as Claims Returned', '{{barcode}}') %]'; s.CHECKOUT_FAILED_GENERIC = '[% l('Unable to checkout copy "[_1]" : [_2]', '{{barcode}}', '{{textcode}}') %]'; +s.EMAILED_CHECKOUT_RECEIPT = + "[% l('Emailed checkout receipt') %]"; s.COPY_ALERT_MSG_DIALOG_TITLE = '[% l('Copy Alert Message for "[_1]"', '{{copy_barcode}}') %]'; s.UNCAT_ALERT_DIALOG = 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 652a35f6dc..e1aecc7b6e 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 @@ -5,7 +5,14 @@ */ angular.module('egPatronApp', ['ngRoute', 'ui.bootstrap', - 'egCoreMod', 'egUiMod', 'egGridMod', 'egUserMod']) + 'egCoreMod', 'egUiMod', 'egGridMod', 'egUserMod', 'ngToast']) + +.config(['ngToastProvider', function(ngToastProvider) { + ngToastProvider.configure({ + verticalPosition: 'bottom', + animation: 'fade' + }); +}]) .config(function($routeProvider, $locationProvider, $compileProvider) { $locationProvider.html5Mode(true); diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js index d2fddcc353..8fbd14cdc1 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js @@ -5,10 +5,10 @@ angular.module('egPatronApp').controller('PatronCheckoutCtrl', ['$scope','$q','$routeParams','egCore','egUser','patronSvc', - 'egGridDataProvider','$location','$timeout','egCirc', + 'egGridDataProvider','$location','$timeout','egCirc','ngToast', function($scope , $q , $routeParams , egCore , egUser , patronSvc , - egGridDataProvider , $location , $timeout , egCirc) { + egGridDataProvider , $location , $timeout , egCirc , ngToast) { $scope.initTab('checkout', $routeParams.id).finally(function(){ $scope.focusMe = true; @@ -44,7 +44,7 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc , } } - $scope.email_receipt = function() { + $scope.may_email_receipt = function() { return setting_value( patronSvc.current, 'circ.send_email_checkout_receipts' @@ -208,38 +208,63 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc , }); } - $scope.send_email_receipt = function () { - if ($scope.email_receipt() && $scope.checkouts.length) { + $scope.email_receipt = function() { + if ($scope.may_email_receipt() && $scope.checkouts.length) { return egCore.net.request( 'open-ils.circ', 'open-ils.circ.checkout.batch_notify.session.atomic', egCore.auth.token(), patronSvc.current.id(), $scope.checkouts.map(function (c) { return c.circ.id() }) - ); // fire and forget? + ).then(function() { + ngToast.create(egCore.strings.EMAILED_CHECKOUT_RECEIPT); + return $q.when(); + }); } return $q.when(); } - $scope.print_or_email_receipt = function () { - if ($scope.email_receipt()) return $scope.send_email_receipt(); + $scope.print_or_email_receipt = function() { + if ($scope.may_email_receipt()) return $scope.email_receipt(); $scope.print_receipt(); } - // Redirect the user to the barcode entry page to load a new patron. - // If configured to do so, print the receipt first - $scope.done = function() { - $scope.send_email_receipt().then( function () { + // set of functions to issue a receipt (if desired), then + // redirect + $scope.done_auto_receipt = function() { + if ($scope.may_email_receipt()) { + $scope.email_receipt().then(function() { + $scope.done_redirect(); + }); + } else { if (printOnComplete) { $scope.print_receipt().then(function() { - $location.path('/circ/patron/bcsearch'); + $scope.done_redirect(); }); } else { - $location.path('/circ/patron/bcsearch'); + $scope.done_redirect(); } + } + } + $scope.done_print_receipt = function() { + $scope.print_receipt().then( function () { + $scope.done_redirect(); + }); + } + $scope.done_email_receipt = function() { + $scope.email_receipt().then( function () { + $scope.done_redirect(); }); } + $scope.done_no_receipt = function() { + $scope.done_redirect(); + } + + // Redirect the user to the barcode entry page to load a new patron. + $scope.done_redirect = function() { + $location.path('/circ/patron/bcsearch'); + } }])