</label>
</div>
<div class="pad-horiz">
- <button class="btn btn-default"
- ng-click="print_receipt()">[% l('Print Receipt') %]</button>
+ <span ng-show="email_receipt()" class="glyphicon glyphicon-envelope" aria-label="[% l('Send Email Receipt') %]"></span>
+ <div class="btn-group" uib-dropdown>
+ <button ng-click="print_or_email_receipt()" id="quick-button" type="button" class="btn btn-danger">[% l('Quick Receipt') %]</button>
+ <button ng-show="email_receipt()" type="button" class="btn btn-danger" uib-dropdown-toggle>
+ <span class="caret"></span>
+ <span class="sr-only">[% l('print option') %]</span>
+ </button>
+ <ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="quick-button">
+ <li role="menuitem"><a ng-click="print_receipt()" href="#">[% l('Print Receipt') %]</a></li>
+ </ul>
+ </div>
</div>
<div>
<button class="btn btn-default"
);
}
+ $scope.email_receipt = function() {
+ return (
+ patronSvc.current &&
+ patronSvc.current.settings()['circ.send_email_checkout_receipts'] &&
+ patronSvc.current.settings()['circ.send_email_checkout_receipts'] == 'true'
+ );
+ }
+
$scope.using_hatch = egCore.hatch.usingHatch();
egCore.hatch.getItem('circ.checkout.strict_barcode')
});
}
+ $scope.send_email_receipt = function () {
+ if ($scope.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?
+ }
+ return $q.when();
+ }
+
+ $scope.print_or_email_receipt = function () {
+ if ($scope.email_receipt()) return $scope.send_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() {
- if (printOnComplete) {
+ $scope.send_email_receipt().then( function () {
+ if (printOnComplete) {
- $scope.print_receipt().then(function() {
- $location.path('/circ/patron/bcsearch');
- });
+ $scope.print_receipt().then(function() {
+ $location.path('/circ/patron/bcsearch');
+ });
- } else {
- $location.path('/circ/patron/bcsearch');
- }
+ } else {
+ $location.path('/circ/patron/bcsearch');
+ }
+ });
}
}])