--- /dev/null
+<form ng-submit="ok(args)" role="form">
+ <div class="modal-header">
+ <button type="button" class="close" ng-click="cancel()"
+ aria-hidden="true">×</button>
+ <h4 class="modal-title">
+ [% l('Please enter your KCLS login credentials.') %]
+ </h4>
+ </div>
+ <div class="modal-body">
+ <div>
+ <i>(hint: your username is the first part of your KCLS email address)</i>
+ </div>
+ <div class="form-group row pad-vert">
+ <div class="col-md-4">
+ [% l('Username: ') %]
+ </div>
+ <div class="col-md-8">
+ <input type="text" class="form-control" ng-model="context.username"/>
+ </div>
+ </div>
+ <div class="form-group row pad-vert">
+ <div class="col-md-4">
+ [% l('Password: ') %]
+ </div>
+ <div class="col-md-8">
+ <input type="password" class="form-control" ng-model="context.password"/>
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <input type="submit" class="btn btn-primary" value="[% l('Submit') %]"/>
+ <button class="btn btn-warning" ng-click="cancel($event)">[% l('Cancel') %]</button>
+ </div>
+</form>
$scope.gridControls.refresh();
}
+ // Returns a promise resolved to the list of payments altered as
+ // necessary to include lost payment authorization data, rejected
+ // if the payment is canceled.
+ function handleLostPayAuth(payments) {
+
+ var lostXacts = [];
+ payments.forEach(function(payment) {
+ var xactId = payment[0];
+ var gridItem = $scope.gridControls.allItems().filter(
+ function(item) {return item.id == xactId})[0];
+
+ var stopFines = gridItem['circulation.stop_fines'];
+ if (stopFines === 'LOST') {
+ console.debug("Processing lost payment transaction ", xactId);
+ lostXacts.push(xactId);
+ }
+ });
+
+ if (lostXacts.length === 0) {
+ return $q.when(payments);
+ }
+
+ return $uibModal.open({
+ templateUrl : './circ/patron/t_lost_payment_auth',
+ backdrop: 'static',
+ controller : [
+ '$scope','$uibModalInstance',
+ function($scope , $uibModalInstance) {
+ $scope.context = {
+ username: '',
+ password: ''
+ };
+
+ $scope.ok = function() {
+ console.log($scope.context.username);
+ console.log($scope.context.password);
+ $uibModalInstance.close(payments);
+ }
+
+ $scope.cancel = function() {
+ $uibModalInstance.dismiss();
+ }
+ }
+ ]
+ }).result;
+ }
+
// generates payments, collects user note if needed, and sends payment
// to server.
function sendPayment(note, cc_args) {
var make_payments = generatePayments();
var patron_credit = $scope.convert_to_credit.isChecked ?
$scope.pending_change() : 0;
+
+ // KCLS prompt for lost payment authorization.
+ handleLostPayAuth(make_payments)
+ .then(function(make_payments) {
+ // NOTE: avoiding indentation to reduce variation with stock.
+
billSvc.applyPayment($scope.payment_type,
make_payments, note, $scope.check_number, cc_args, patron_credit)
.then(
console.error('Payment was rejected: ' + msg);
}
)
+ })
.finally(function() { $scope.applyingPayment = false; })
}